From 7efb593975392efcc2b6f0fa19cb7705f49b00fa Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 8 Oct 2025 14:29:48 +0200 Subject: [PATCH 001/252] BridgeJS: Initial protocol support [fe09c4b1] Simplify export swift [b42bb7c1] WIP: Simplify protocol method generation [75e1ed37] BridgeJSLink simplification [b1fcc4d0] Cleanup [70aa0332] WIP: Final wrap [2f648eaf] WIP: Protocols simplification [f2f89b33] WIP: Fix for parameters in methods [6026fc1d] WIP: Test protocol methods with parameters --- .../JavaScript/BridgeJS.ExportSwift.json | 5 +- .../JavaScript/BridgeJS.ExportSwift.json | 5 +- .../Sources/BridgeJSCore/ExportSwift.swift | 422 +++++++++++++--- .../Sources/BridgeJSCore/ImportTS.swift | 4 + .../Sources/BridgeJSLink/BridgeJSLink.swift | 80 ++- .../Sources/BridgeJSLink/JSGlueGen.swift | 26 + .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 26 +- .../BridgeJSToolTests/Inputs/Protocol.swift | 41 ++ .../BridgeJSLinkTests/Protocol.Export.d.ts | 44 ++ .../BridgeJSLinkTests/Protocol.Export.js | 286 +++++++++++ .../__Snapshots__/ExportSwiftTests/Async.json | 5 +- .../ExportSwiftTests/DefaultParameters.json | 5 +- .../ExportSwiftTests/EnumAssociatedValue.json | 5 +- .../ExportSwiftTests/EnumCase.json | 5 +- .../ExportSwiftTests/EnumNamespace.json | 5 +- .../ExportSwiftTests/EnumRawType.json | 5 +- .../ExportSwiftTests/Namespaces.json | 5 +- .../ExportSwiftTests/Optionals.json | 5 +- .../ExportSwiftTests/PrimitiveParameters.json | 5 +- .../ExportSwiftTests/PrimitiveReturn.json | 5 +- .../ExportSwiftTests/PropertyTypes.json | 5 +- .../ExportSwiftTests/Protocol.json | 305 ++++++++++++ .../ExportSwiftTests/Protocol.swift | 174 +++++++ .../ExportSwiftTests/StaticFunctions.json | 5 +- .../ExportSwiftTests/StaticProperties.json | 5 +- .../ExportSwiftTests/StringParameter.json | 5 +- .../ExportSwiftTests/StringReturn.json | 5 +- .../ExportSwiftTests/SwiftClass.json | 5 +- .../ExportSwiftTests/Throws.json | 5 +- .../VoidParameterVoidReturn.json | 5 +- .../JavaScriptKit/BridgeJSInstrincics.swift | 65 +++ .../BridgeJS/Exporting-Swift-to-JavaScript.md | 1 + .../Exporting-Swift-Protocols.md | 209 ++++++++ .../BridgeJSRuntimeTests/ExportAPITests.swift | 81 +++ .../Generated/BridgeJS.ExportSwift.swift | 285 +++++++++++ .../JavaScript/BridgeJS.ExportSwift.json | 465 +++++++++++++++++- Tests/prelude.mjs | 105 +++- 37 files changed, 2612 insertions(+), 107 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json index cbd7d10e4..cfec1d468 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -720,5 +720,8 @@ } } ], - "moduleName" : "Benchmarks" + "moduleName" : "Benchmarks", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json index 5ef85519c..3e00433ef 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -138,5 +138,8 @@ "functions" : [ ], - "moduleName" : "PlayBridgeJS" + "moduleName" : "PlayBridgeJS", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 00902ee97..9179a9668 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -24,6 +24,8 @@ public class ExportSwift { private var exportedFunctions: [ExportedFunction] = [] private var exportedClasses: [ExportedClass] = [] private var exportedEnums: [ExportedEnum] = [] + private var exportedProtocols: [ExportedProtocol] = [] + private var exportedProtocolNameByKey: [String: String] = [:] private var typeDeclResolver: TypeDeclResolver = TypeDeclResolver() private let enumCodegen: EnumCodegen = EnumCodegen() @@ -64,7 +66,8 @@ public class ExportSwift { moduleName: moduleName, functions: exportedFunctions, classes: exportedClasses, - enums: exportedEnums + enums: exportedEnums, + protocols: exportedProtocols ) ) } @@ -77,10 +80,13 @@ public class ExportSwift { /// The names of the exported enums, in the order they were written in the source file var exportedEnumNames: [String] = [] var exportedEnumByName: [String: ExportedEnum] = [:] + /// The names of the exported protocols, in the order they were written in the source file + var exportedProtocolNames: [String] = [] + var exportedProtocolByName: [String: ExportedProtocol] = [:] var errors: [DiagnosticError] = [] - /// Creates a unique key for a class by combining name and namespace - private func classKey(name: String, namespace: [String]?) -> String { + /// Creates a unique key by combining name and namespace + private func makeKey(name: String, namespace: [String]?) -> String { if let namespace = namespace, !namespace.isEmpty { return "\(namespace.joined(separator: ".")).\(name)" } else { @@ -88,19 +94,39 @@ public class ExportSwift { } } - /// Creates a unique key for an enum by combining name and namespace - private func enumKey(name: String, namespace: [String]?) -> String { - if let namespace = namespace, !namespace.isEmpty { - return "\(namespace.joined(separator: ".")).\(name)" - } else { - return name + struct NamespaceResolution { + let namespace: [String]? + let isValid: Bool + } + + /// Resolves and validates namespace from both @JS attribute and computed (nested) namespace + /// Returns the effective namespace and whether validation succeeded + private func resolveNamespace( + from jsAttribute: AttributeSyntax, + for node: some SyntaxProtocol, + declarationType: String + ) -> NamespaceResolution { + let attributeNamespace = extractNamespace(from: jsAttribute) + let computedNamespace = computeNamespace(for: node) + + if computedNamespace != nil && attributeNamespace != nil { + diagnose( + node: jsAttribute, + message: "Nested \(declarationType)s cannot specify their own namespace", + hint: + "Remove the namespace from @JS attribute - nested \(declarationType)s inherit namespace from parent" + ) + return NamespaceResolution(namespace: nil, isValid: false) } + + return NamespaceResolution(namespace: computedNamespace ?? attributeNamespace, isValid: true) } enum State { case topLevel case classBody(name: String, key: String) case enumBody(name: String, key: String) + case protocolBody(name: String, key: String) } struct StateStack { @@ -386,6 +412,42 @@ public class ExportSwift { return nil } + /// Shared parameter parsing logic used by functions, initializers, and protocol methods + private func parseParameters( + from parameterClause: FunctionParameterClauseSyntax, + allowDefaults: Bool = true + ) -> [Parameter] { + var parameters: [Parameter] = [] + + for param in parameterClause.parameters { + let resolvedType = self.parent.lookupType(for: param.type) + + if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { + diagnoseNestedOptional(node: param.type, type: param.type.trimmedDescription) + continue + } + + guard let type = resolvedType else { + diagnoseUnsupportedType(node: param.type, type: param.type.trimmedDescription) + continue + } + + let name = param.secondName?.text ?? param.firstName.text + let label = param.firstName.text + + let defaultValue: DefaultValue? + if allowDefaults { + defaultValue = extractDefaultValue(from: param.defaultValue, type: type) + } else { + defaultValue = nil + } + + parameters.append(Parameter(label: label, name: name, type: type, defaultValue: defaultValue)) + } + + return parameters + } + override func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { guard node.attributes.hasJSAttribute() else { return .skipChildren @@ -427,6 +489,9 @@ public class ExportSwift { } } return .skipChildren + case .protocolBody(_, _): + // Protocol methods are handled in visitProtocolMethod during protocol parsing + return .skipChildren } } @@ -470,27 +535,7 @@ public class ExportSwift { ) } - var parameters: [Parameter] = [] - for param in node.signature.parameterClause.parameters { - let resolvedType = self.parent.lookupType(for: param.type) - - if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { - diagnoseNestedOptional(node: param.type, type: param.type.trimmedDescription) - continue - } - - guard let type = resolvedType else { - diagnoseUnsupportedType(node: param.type, type: param.type.trimmedDescription) - continue - } - - let name = param.secondName?.text ?? param.firstName.text - let label = param.firstName.text - - let defaultValue = extractDefaultValue(from: param.defaultValue, type: type) - - parameters.append(Parameter(label: label, name: name, type: type, defaultValue: defaultValue)) - } + let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: true) let returnType: BridgeType if let returnClause = node.signature.returnClause { let resolvedType = self.parent.lookupType(for: returnClause.type) @@ -529,6 +574,8 @@ public class ExportSwift { let isNamespaceEnum = exportedEnumByName[enumKey]?.cases.isEmpty ?? true staticContext = isNamespaceEnum ? .namespaceEnum : .enumName(enumName) + case .protocolBody(_, _): + return nil } let classNameForABI: String? @@ -638,19 +685,7 @@ public class ExportSwift { ) } - var parameters: [Parameter] = [] - for param in node.signature.parameterClause.parameters { - guard let type = self.parent.lookupType(for: param.type) else { - diagnoseUnsupportedType(node: param.type, type: param.type.trimmedDescription) - continue - } - let name = param.secondName?.text ?? param.firstName.text - let label = param.firstName.text - - let defaultValue = extractDefaultValue(from: param.defaultValue, type: type) - - parameters.append(Parameter(label: label, name: name, type: type, defaultValue: defaultValue)) - } + let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: true) guard let effects = collectEffects(signature: node.signature) else { return .skipChildren @@ -677,7 +712,7 @@ public class ExportSwift { let attributeNamespace = extractNamespace(from: jsAttribute) if attributeNamespace != nil { diagnose( - node: node.attributes.firstJSAttribute!, + node: jsAttribute, message: "Namespace parameter within @JS attribute is not supported for property declarations", hint: "Remove the namespace from @JS attribute. If you need dedicated namespace, consider using a nested enum or class instead." @@ -714,6 +749,9 @@ public class ExportSwift { case .topLevel: diagnose(node: node, message: "@JS var must be inside a @JS class or enum") return .skipChildren + case .protocolBody(_, _): + diagnose(node: node, message: "Properties are not supported in protocols") + return .skipChildren } // Process each binding (variable declaration) @@ -785,20 +823,10 @@ public class ExportSwift { return .skipChildren } - let attributeNamespace = extractNamespace(from: jsAttribute) - let computedNamespace = computeNamespace(for: node) - - if computedNamespace != nil && attributeNamespace != nil { - diagnose( - node: jsAttribute, - message: "Nested classes cannot specify their own namespace", - hint: "Remove the namespace from @JS attribute - nested classes inherit namespace from parent" - ) + let namespaceResult = resolveNamespace(from: jsAttribute, for: node, declarationType: "class") + guard namespaceResult.isValid else { return .skipChildren } - - let effectiveNamespace = computedNamespace ?? attributeNamespace - let swiftCallName = ExportSwift.computeSwiftCallName(for: node, itemName: name) let explicitAccessControl = computeExplicitAtLeastInternalAccessControl( for: node, @@ -811,9 +839,9 @@ public class ExportSwift { constructor: nil, methods: [], properties: [], - namespace: effectiveNamespace + namespace: namespaceResult.namespace ) - let uniqueKey = classKey(name: name, namespace: effectiveNamespace) + let uniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) stateStack.push(state: .classBody(name: name, key: uniqueKey)) exportedClassByName[uniqueKey] = exportedClass @@ -829,10 +857,6 @@ public class ExportSwift { } override func visit(_ node: EnumDeclSyntax) -> SyntaxVisitorContinueKind { - guard node.attributes.hasJSAttribute() else { - return .skipChildren - } - guard let jsAttribute = node.attributes.firstJSAttribute else { return .skipChildren } @@ -844,19 +868,10 @@ public class ExportSwift { return Constants.supportedRawTypes.contains(typeName) }?.type.trimmedDescription - let attributeNamespace = extractNamespace(from: jsAttribute) - let computedNamespace = computeNamespace(for: node) - - if computedNamespace != nil && attributeNamespace != nil { - diagnose( - node: jsAttribute, - message: "Nested enums cannot specify their own namespace", - hint: "Remove the namespace from @JS attribute - nested enums inherit namespace from parent" - ) + let namespaceResult = resolveNamespace(from: jsAttribute, for: node, declarationType: "enum") + guard namespaceResult.isValid else { return .skipChildren } - - let effectiveNamespace = computedNamespace ?? attributeNamespace let emitStyle = extractEnumStyle(from: jsAttribute) ?? .const let swiftCallName = ExportSwift.computeSwiftCallName(for: node, itemName: name) let explicitAccessControl = computeExplicitAtLeastInternalAccessControl( @@ -871,13 +886,13 @@ public class ExportSwift { explicitAccessControl: explicitAccessControl, cases: [], // Will be populated in visit(EnumCaseDeclSyntax) rawType: SwiftEnumRawType(rawType), - namespace: effectiveNamespace, + namespace: namespaceResult.namespace, emitStyle: emitStyle, staticMethods: [], staticProperties: [] ) - let enumUniqueKey = enumKey(name: name, namespace: effectiveNamespace) + let enumUniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) exportedEnumByName[enumUniqueKey] = exportedEnum exportedEnumNames.append(enumUniqueKey) @@ -966,6 +981,100 @@ public class ExportSwift { stateStack.pop() } + override func visit(_ node: ProtocolDeclSyntax) -> SyntaxVisitorContinueKind { + guard let jsAttribute = node.attributes.firstJSAttribute else { + return .skipChildren + } + + let name = node.name.text + + let namespaceResult = resolveNamespace(from: jsAttribute, for: node, declarationType: "protocol") + guard namespaceResult.isValid else { + return .skipChildren + } + _ = computeExplicitAtLeastInternalAccessControl( + for: node, + message: "Protocol visibility must be at least internal" + ) + + var methods: [ExportedFunction] = [] + for member in node.memberBlock.members { + if let funcDecl = member.decl.as(FunctionDeclSyntax.self) { + if let exportedFunction = visitProtocolMethod( + node: funcDecl, + protocolName: name, + namespace: namespaceResult.namespace + ) { + methods.append(exportedFunction) + } + } + } + + let exportedProtocol = ExportedProtocol( + name: name, + methods: methods, + namespace: namespaceResult.namespace + ) + + let protocolUniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) + exportedProtocolByName[protocolUniqueKey] = exportedProtocol + exportedProtocolNames.append(protocolUniqueKey) + + parent.exportedProtocolNameByKey[protocolUniqueKey] = name + + return .skipChildren + } + + private func visitProtocolMethod( + node: FunctionDeclSyntax, + protocolName: String, + namespace: [String]? + ) -> ExportedFunction? { + let name = node.name.text + + let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: false) + + let returnType: BridgeType + if let returnClause = node.signature.returnClause { + let resolvedType = self.parent.lookupType(for: returnClause.type) + + if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { + diagnoseNestedOptional(node: returnClause.type, type: returnClause.type.trimmedDescription) + return nil + } + + guard let type = resolvedType else { + diagnoseUnsupportedType(node: returnClause.type, type: returnClause.type.trimmedDescription) + return nil + } + returnType = type + } else { + returnType = .void + } + + let abiName = ABINameGenerator.generateABIName( + baseName: name, + namespace: namespace, + staticContext: nil, + operation: nil, + className: protocolName + ) + + guard let effects = collectEffects(signature: node.signature) else { + return nil + } + + return ExportedFunction( + name: name, + abiName: abiName, + parameters: parameters, + returnType: returnType, + effects: effects, + namespace: namespace, + staticContext: nil + ) + } + override func visit(_ node: EnumCaseDeclSyntax) -> SyntaxVisitorContinueKind { guard case .enumBody(_, let enumKey) = stateStack.current else { return .visitChildren @@ -1095,6 +1204,12 @@ public class ExportSwift { collector.exportedEnumByName[$0]! } ) + exportedProtocols.append( + contentsOf: collector.exportedProtocolNames.map { + collector.exportedProtocolByName[$0]! + } + ) + return collector.errors } @@ -1163,10 +1278,20 @@ public class ExportSwift { return primitiveType } + let protocolKey = typeName + if let protocolName = exportedProtocolNameByKey[protocolKey] { + return .swiftProtocol(protocolName) + } + guard let typeDecl = typeDeclResolver.resolve(type) else { return nil } + if typeDecl.is(ProtocolDeclSyntax.self) { + let swiftCallName = ExportSwift.computeSwiftCallName(for: typeDecl, itemName: typeDecl.name.text) + return .swiftProtocol(swiftCallName) + } + if let enumDecl = typeDecl.as(EnumDeclSyntax.self) { let swiftCallName = ExportSwift.computeSwiftCallName(for: enumDecl, itemName: enumDecl.name.text) let rawTypeString = enumDecl.inheritanceClause?.inheritedTypes.first { inheritedType in @@ -1220,11 +1345,18 @@ public class ExportSwift { func renderSwiftGlue() throws -> String? { var decls: [DeclSyntax] = [] - guard exportedFunctions.count > 0 || exportedClasses.count > 0 || exportedEnums.count > 0 else { + guard + exportedFunctions.count > 0 || exportedClasses.count > 0 || exportedEnums.count > 0 + || exportedProtocols.count > 0 + else { return nil } decls.append(Self.prelude) + for proto in exportedProtocols { + decls.append(try renderProtocolWrapper(protocol: proto)) + } + for enumDef in exportedEnums { switch enumDef.enumType { case .simple: @@ -1343,7 +1475,26 @@ public class ExportSwift { if returnType == .void { return CodeBlockItemSyntax(item: .init(ExpressionStmtSyntax(expression: callExpr))) } else { - return CodeBlockItemSyntax(item: .init(DeclSyntax("let ret = \(raw: callExpr)"))) + switch returnType { + case .swiftProtocol(let protocolName): + let wrapperName = "Any\(protocolName)" + return CodeBlockItemSyntax( + item: .init(DeclSyntax("let ret = \(raw: callExpr) as! \(raw: wrapperName)")) + ) + case .optional(let wrappedType): + if case .swiftProtocol(let protocolName) = wrappedType { + let wrapperName = "Any\(protocolName)" + return CodeBlockItemSyntax( + item: .init( + DeclSyntax("let ret = (\(raw: callExpr)).flatMap { $0 as? \(raw: wrapperName) }") + ) + ) + } else { + return CodeBlockItemSyntax(item: .init(DeclSyntax("let ret = \(raw: callExpr)"))) + } + default: + return CodeBlockItemSyntax(item: .init(DeclSyntax("let ret = \(raw: callExpr)"))) + } } } @@ -1356,7 +1507,20 @@ public class ExportSwift { if returnType == .void { append("\(raw: name)") } else { - append("let ret = \(raw: name)") + switch returnType { + case .swiftProtocol(let protocolName): + let wrapperName = "Any\(protocolName)" + append("let ret = \(raw: name) as! \(raw: wrapperName)") + case .optional(let wrappedType): + if case .swiftProtocol(let protocolName) = wrappedType { + let wrapperName = "Any\(protocolName)" + append("let ret = \(raw: name).flatMap { $0 as? \(raw: wrapperName) }") + } else { + append("let ret = \(raw: name)") + } + default: + append("let ret = \(raw: name)") + } } } @@ -1374,7 +1538,20 @@ public class ExportSwift { if returnType == .void { append("\(raw: selfExpr).\(raw: propertyName)") } else { - append("let ret = \(raw: selfExpr).\(raw: propertyName)") + switch returnType { + case .swiftProtocol(let protocolName): + let wrapperName = "Any\(protocolName)" + append("let ret = \(raw: selfExpr).\(raw: propertyName) as! \(raw: wrapperName)") + case .optional(let wrappedType): + if case .swiftProtocol(let protocolName) = wrappedType { + let wrapperName = "Any\(protocolName)" + append("let ret = \(raw: selfExpr).\(raw: propertyName).flatMap { $0 as? \(raw: wrapperName) }") + } else { + append("let ret = \(raw: selfExpr).\(raw: propertyName)") + } + default: + append("let ret = \(raw: selfExpr).\(raw: propertyName)") + } } } @@ -1930,6 +2107,90 @@ public class ExportSwift { } """ } + + /// Generates an AnyProtocol wrapper struct for a protocol + /// + /// Creates a struct that wraps a JSObject and implements protocol methods + /// by calling `@_extern(wasm)` functions that forward to JavaScript + func renderProtocolWrapper(protocol proto: ExportedProtocol) throws -> DeclSyntax { + let wrapperName = "Any\(proto.name)" + let protocolName = proto.name + + var methodDecls: [DeclSyntax] = [] + + for method in proto.methods { + var swiftParams: [String] = [] + for param in method.parameters { + let label = param.label ?? param.name + if label == param.name { + swiftParams.append("\(param.name): \(param.type.swiftType)") + } else { + swiftParams.append("\(label) \(param.name): \(param.type.swiftType)") + } + } + + var externParams: [String] = ["this: Int32"] + for param in method.parameters { + let loweringInfo = try param.type.loweringParameterInfo() + assert( + loweringInfo.loweredParameters.count == 1, + "Protocol parameters must lower to a single WASM type" + ) + let (_, wasmType) = loweringInfo.loweredParameters[0] + externParams.append("\(param.name): \(wasmType.swiftType)") + } + + var callArgs: [String] = ["this: Int32(bitPattern: jsObject.id)"] + for param in method.parameters { + callArgs.append("\(param.name): \(param.name).bridgeJSLowerParameter()") + } + + let returnTypeStr: String + let externReturnType: String + let callCode: DeclSyntax + + if method.returnType == .void { + returnTypeStr = "" + externReturnType = "" + callCode = """ + _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) + """ + } else { + returnTypeStr = " -> \(method.returnType.swiftType)" + let liftingInfo = try method.returnType.liftingReturnInfo() + if let abiType = liftingInfo.valueToLift { + externReturnType = " -> \(abiType.swiftType)" + } else { + externReturnType = "" + } + callCode = """ + let ret = _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) + return \(raw: method.returnType.swiftType).bridgeJSLiftReturn(ret) + """ + } + let methodImplementation: DeclSyntax = """ + func \(raw: method.name)(\(raw: swiftParams.joined(separator: ", ")))\(raw: returnTypeStr) { + @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: method.abiName)") + func _extern_\(raw: method.name)(\(raw: externParams.joined(separator: ", ")))\(raw: externReturnType) + \(raw: callCode) + } + """ + + methodDecls.append(methodImplementation) + } + + return """ + struct \(raw: wrapperName): \(raw: protocolName), _BridgedSwiftProtocolWrapper { + let jsObject: JSObject + + \(raw: methodDecls.map { $0.description }.joined(separator: "\n\n")) + + static func bridgeJSLiftParameter(_ value: Int32) -> Self { + return \(raw: wrapperName)(jsObject: JSObject(id: UInt32(bitPattern: value))) + } + } + """ + } } fileprivate enum Constants { @@ -1994,6 +2255,7 @@ extension BridgeType { case .jsObject(nil): return "JSObject" case .jsObject(let name?): return name case .swiftHeapObject(let name): return name + case .swiftProtocol(let name): return "Any\(name)" case .void: return "Void" case .optional(let wrappedType): return "Optional<\(wrappedType.swiftType)>" case .caseEnum(let name): return name @@ -2029,6 +2291,7 @@ extension BridgeType { case .string: return .string case .jsObject: return .jsObject case .swiftHeapObject: return .swiftHeapObject + case .swiftProtocol: return .jsObject case .void: return .void case .optional(let wrappedType): var optionalParams: [(name: String, type: WasmCoreType)] = [("isSome", .i32)] @@ -2081,6 +2344,7 @@ extension BridgeType { case .string: return .string case .jsObject: return .jsObject case .swiftHeapObject: return .swiftHeapObject + case .swiftProtocol: return .jsObject case .void: return .void case .optional: return .optional case .caseEnum: return .caseEnum diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index abacddd0b..64e89d66b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -435,6 +435,8 @@ extension BridgeType { case .void: return .void case .swiftHeapObject: throw BridgeJSCoreError("swiftHeapObject is not supported in imported signatures") + case .swiftProtocol: + throw BridgeJSCoreError("swiftProtocol is not supported in imported signatures") case .caseEnum, .rawValueEnum, .associatedValueEnum, .namespaceEnum: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") case .optional: @@ -465,6 +467,8 @@ extension BridgeType { case .void: return .void case .swiftHeapObject: throw BridgeJSCoreError("swiftHeapObject is not supported in imported signatures") + case .swiftProtocol: + throw BridgeJSCoreError("swiftProtocol is not supported in imported signatures") case .caseEnum, .rawValueEnum, .associatedValueEnum, .namespaceEnum: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") case .optional: diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 087cf17df..88f2af3d7 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -240,7 +240,9 @@ struct BridgeJSLink { enumPropertyPrinter.write("},") if !property.isReadonly { - let setterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) + let setterThunkBuilder = ExportedThunkBuilder( + effects: Effects(isAsync: false, isThrows: false) + ) try setterThunkBuilder.lowerParameter( param: Parameter(label: "value", name: "value", type: property.type) ) @@ -300,6 +302,29 @@ struct BridgeJSLink { data.importObjectBuilders.append(importObjectBuilder) } + for skeleton in exportedSkeletons { + if !skeleton.protocols.isEmpty { + let importObjectBuilder: ImportObjectBuilder + if let existingBuilder = data.importObjectBuilders.first(where: { $0.moduleName == skeleton.moduleName } + ) { + importObjectBuilder = existingBuilder + } else { + importObjectBuilder = ImportObjectBuilder(moduleName: skeleton.moduleName) + data.importObjectBuilders.append(importObjectBuilder) + } + + for proto in skeleton.protocols { + for method in proto.methods { + try renderProtocolMethod( + importObjectBuilder: importObjectBuilder, + protocol: proto, + method: method + ) + } + } + } + } + return data } @@ -572,6 +597,22 @@ struct BridgeJSLink { """ let printer = CodeFragmentPrinter(header: header) printer.nextLine() + + for skeleton in exportedSkeletons { + for proto in skeleton.protocols { + printer.write("export interface \(proto.name) {") + printer.indent { + for method in proto.methods { + printer.write( + "\(method.name)\(renderTSSignature(parameters: method.parameters, returnType: method.returnType, effects: method.effects));" + ) + } + } + printer.write("}") + printer.nextLine() + } + } + printer.write(lines: data.topLevelDtsEnumLines) // Generate Object types for const-style enums @@ -1468,7 +1509,9 @@ extension BridgeJSLink { if !property.isReadonly { // Generate setter - let setterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) + let setterThunkBuilder = ExportedThunkBuilder( + effects: Effects(isAsync: false, isThrows: false) + ) try setterThunkBuilder.lowerParameter( param: Parameter(label: "value", name: "value", type: property.type) ) @@ -1539,7 +1582,9 @@ extension BridgeJSLink { if !property.isReadonly { // Generate setter - let setterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) + let setterThunkBuilder = ExportedThunkBuilder( + effects: Effects(isAsync: false, isThrows: false) + ) try setterThunkBuilder.lowerParameter( param: Parameter(label: "value", name: "value", type: property.type) ) @@ -1704,7 +1749,9 @@ extension BridgeJSLink { // Generate static property setter if not readonly if !property.isReadonly { - let setterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) + let setterThunkBuilder = ExportedThunkBuilder( + effects: Effects(isAsync: false, isThrows: false) + ) try setterThunkBuilder.lowerParameter( param: Parameter(label: "value", name: "value", type: property.type) ) @@ -1752,7 +1799,9 @@ extension BridgeJSLink { // Generate instance property setter if not readonly if !property.isReadonly { - let setterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) + let setterThunkBuilder = ExportedThunkBuilder( + effects: Effects(isAsync: false, isThrows: false) + ) setterThunkBuilder.lowerSelf() try setterThunkBuilder.lowerParameter( param: Parameter(label: "value", name: "value", type: property.type) @@ -2367,6 +2416,25 @@ extension BridgeJSLink { ) return (funcLines, []) } + + func renderProtocolMethod( + importObjectBuilder: ImportObjectBuilder, + protocol: ExportedProtocol, + method: ExportedFunction + ) throws { + let thunkBuilder = ImportedThunkBuilder() + thunkBuilder.liftSelf() + for param in method.parameters { + try thunkBuilder.liftParameter(param: param) + } + let returnExpr = try thunkBuilder.callMethod(name: method.name, returnType: method.returnType) + let funcLines = thunkBuilder.renderFunction( + name: method.abiName, + returnExpr: returnExpr, + returnType: method.returnType + ) + importObjectBuilder.assignToImportObject(name: method.abiName, function: funcLines) + } } struct BridgeJSLinkError: Error { @@ -2402,6 +2470,8 @@ extension BridgeType { return "\(name)Tag" case .namespaceEnum(let name): return name + case .swiftProtocol(let name): + return name } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 9d0d91624..ef431432f 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -297,6 +297,25 @@ struct IntrinsicJSFragment: Sendable { switch wrappedType { case .swiftHeapObject: return ["+\(isSomeVar)", "\(isSomeVar) ? \(value).pointer : 0"] + case .swiftProtocol: + return [ + "+\(isSomeVar)", + "\(isSomeVar) ? \(JSGlueVariableScope.reservedSwift).memory.retain(\(value)) : 0", + ] + case .jsObject: + let idVar = scope.variable("id") + printer.write("let \(idVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + } + printer.write("}") + cleanupCode.write("if (\(idVar) !== undefined) {") + cleanupCode.indent { + cleanupCode.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") + } + cleanupCode.write("}") + return ["+\(isSomeVar)", "\(isSomeVar) ? \(idVar) : 0"] default: return ["+\(isSomeVar)", "\(isSomeVar) ? \(value) : 0"] } @@ -326,6 +345,9 @@ struct IntrinsicJSFragment: Sendable { case .string: printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnString);") printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = undefined;") + case .jsObject, .swiftProtocol: + printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnString);") + printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = undefined;") case .swiftHeapObject(let className): let pointerVar = scope.variable("pointer") printer.write( @@ -397,6 +419,7 @@ struct IntrinsicJSFragment: Sendable { case .jsObject: return .jsObjectLowerParameter case .swiftHeapObject: return .swiftHeapObjectLowerParameter + case .swiftProtocol: return .jsObjectLowerParameter case .void: return .void case .optional(let wrappedType): return try .optionalLowerParameter(wrappedType: wrappedType) @@ -422,6 +445,7 @@ struct IntrinsicJSFragment: Sendable { case .string: return .stringLiftReturn case .jsObject: return .jsObjectLiftReturn case .swiftHeapObject(let name): return .swiftHeapObjectLiftReturn(name) + case .swiftProtocol: return .jsObjectLiftReturn case .void: return .void case .optional(let wrappedType): return .optionalLiftReturn(wrappedType: wrappedType) case .caseEnum: return .identity @@ -455,6 +479,7 @@ struct IntrinsicJSFragment: Sendable { message: "Swift heap objects are not supported to be passed as parameters to imported JS functions: \(name)" ) + case .swiftProtocol: return .jsObjectLiftParameter case .void: throw BridgeJSLinkError( message: "Void can't appear in parameters of imported JS functions" @@ -494,6 +519,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Swift heap objects are not supported to be returned from imported JS functions" ) + case .swiftProtocol: return .jsObjectLowerReturn case .void: return .void case .optional(let wrappedType): throw BridgeJSLinkError( diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 845957828..1a414b956 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -74,6 +74,7 @@ public enum BridgeType: Codable, Equatable, Sendable { case rawValueEnum(String, SwiftEnumRawType) case associatedValueEnum(String) case namespaceEnum(String) + case swiftProtocol(String) } public enum WasmCoreType: String, Codable, Sendable { @@ -269,6 +270,18 @@ public enum EnumType: String, Codable, Sendable { // MARK: - Exported Skeleton +public struct ExportedProtocol: Codable, Equatable { + public let name: String + public let methods: [ExportedFunction] + public let namespace: [String]? + + public init(name: String, methods: [ExportedFunction], namespace: [String]? = nil) { + self.name = name + self.methods = methods + self.namespace = namespace + } +} + public struct ExportedFunction: Codable, Equatable, Sendable { public var name: String public var abiName: String @@ -407,12 +420,20 @@ public struct ExportedSkeleton: Codable { public let functions: [ExportedFunction] public let classes: [ExportedClass] public let enums: [ExportedEnum] + public let protocols: [ExportedProtocol] - public init(moduleName: String, functions: [ExportedFunction], classes: [ExportedClass], enums: [ExportedEnum]) { + public init( + moduleName: String, + functions: [ExportedFunction], + classes: [ExportedClass], + enums: [ExportedEnum], + protocols: [ExportedProtocol] = [] + ) { self.moduleName = moduleName self.functions = functions self.classes = classes self.enums = enums + self.protocols = protocols } } @@ -514,6 +535,9 @@ extension BridgeType { return nil case .namespaceEnum: return nil + case .swiftProtocol: + // Protocols pass JSObject IDs as Int32 + return .i32 } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift new file mode 100644 index 000000000..f02133692 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift @@ -0,0 +1,41 @@ +import JavaScriptKit + +@JS protocol MyViewControllerDelegate { + func onSomethingHappened() + func onValueChanged(_ value: String) + func onCountUpdated(count: Int) -> Bool + func onLabelUpdated(_ prefix: String, _ suffix: String) + func isCountEven() -> Bool +} + +@JS class MyViewController { + @JS + var delegate: MyViewControllerDelegate + + @JS + var secondDelegate: MyViewControllerDelegate? + + @JS init(delegate: MyViewControllerDelegate) { + self.delegate = delegate + } + + @JS func triggerEvent() { + delegate.onSomethingHappened() + } + + @JS func updateValue(_ value: String) { + delegate.onValueChanged(value) + } + + @JS func updateCount(_ count: Int) -> Bool { + return delegate.onCountUpdated(count: count) + } + + @JS func updateLabel(_ prefix: String, _ suffix: String) { + delegate.onLabelUpdated(prefix, suffix) + } + + @JS func checkEvenCount() -> Bool { + return delegate.isCountEven() + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts new file mode 100644 index 000000000..0f5d0fb20 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts @@ -0,0 +1,44 @@ +// 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 interface MyViewControllerDelegate { + onSomethingHappened(): void; + onValueChanged(value: string): void; + onCountUpdated(count: number): boolean; + onLabelUpdated(prefix: string, suffix: string): void; + isCountEven(): boolean; +} + +/// 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 MyViewController extends SwiftHeapObject { + triggerEvent(): void; + updateValue(value: string): void; + updateCount(count: number): boolean; + updateLabel(prefix: string, suffix: string): void; + checkEvenCount(): boolean; + delegate: MyViewControllerDelegate; + secondDelegate: MyViewControllerDelegate | null; +} +export type Exports = { + MyViewController: { + new(delegate: MyViewControllerDelegate): MyViewController; + } +} +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/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js new file mode 100644 index 000000000..142c1cf0b --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -0,0 +1,286 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + const bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + } + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_MyViewController_wrap"] = function(pointer) { + const obj = MyViewController.__construct(pointer); + return swift.memory.retain(obj); + }; + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_MyViewControllerDelegate_onSomethingHappened"] = function bjs_MyViewControllerDelegate_onSomethingHappened(self) { + try { + swift.memory.getObject(self).onSomethingHappened(); + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_onValueChanged"] = function bjs_MyViewControllerDelegate_onValueChanged(self, value) { + try { + const valueObject = swift.memory.getObject(value); + swift.memory.release(value); + swift.memory.getObject(self).onValueChanged(valueObject); + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_onCountUpdated"] = function bjs_MyViewControllerDelegate_onCountUpdated(self, count) { + try { + let ret = swift.memory.getObject(self).onCountUpdated(count); + return ret ? 1 : 0; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_MyViewControllerDelegate_onLabelUpdated"] = function bjs_MyViewControllerDelegate_onLabelUpdated(self, prefix, suffix) { + try { + const prefixObject = swift.memory.getObject(prefix); + swift.memory.release(prefix); + const suffixObject = swift.memory.getObject(suffix); + swift.memory.release(suffix); + swift.memory.getObject(self).onLabelUpdated(prefixObject, suffixObject); + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_isCountEven"] = function bjs_MyViewControllerDelegate_isCountEven(self) { + try { + let ret = swift.memory.getObject(self).isCountEven(); + return ret ? 1 : 0; + } catch (error) { + setException(error); + return 0 + } + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class MyViewController extends SwiftHeapObject { + 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); + } + triggerEvent() { + instance.exports.bjs_MyViewController_triggerEvent(this.pointer); + } + updateValue(value) { + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + instance.exports.bjs_MyViewController_updateValue(this.pointer, valueId, valueBytes.length); + swift.memory.release(valueId); + } + updateCount(count) { + const ret = instance.exports.bjs_MyViewController_updateCount(this.pointer, count); + return ret !== 0; + } + updateLabel(prefix, suffix) { + const prefixBytes = textEncoder.encode(prefix); + const prefixId = swift.memory.retain(prefixBytes); + const suffixBytes = textEncoder.encode(suffix); + const suffixId = swift.memory.retain(suffixBytes); + instance.exports.bjs_MyViewController_updateLabel(this.pointer, prefixId, prefixBytes.length, suffixId, suffixBytes.length); + swift.memory.release(prefixId); + swift.memory.release(suffixId); + } + checkEvenCount() { + const ret = instance.exports.bjs_MyViewController_checkEvenCount(this.pointer); + return ret !== 0; + } + get delegate() { + const ret = instance.exports.bjs_MyViewController_delegate_get(this.pointer); + const ret1 = swift.memory.getObject(ret); + swift.memory.release(ret); + return ret1; + } + set delegate(value) { + instance.exports.bjs_MyViewController_delegate_set(this.pointer, swift.memory.retain(value)); + } + get secondDelegate() { + instance.exports.bjs_MyViewController_secondDelegate_get(this.pointer); + const optResult = tmpRetString; + tmpRetString = undefined; + return optResult; + } + set secondDelegate(value) { + const isSome = value != null; + instance.exports.bjs_MyViewController_secondDelegate_set(this.pointer, +isSome, isSome ? swift.memory.retain(value) : 0); + } + } + return { + MyViewController, + }; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json index b9f863571..41696d635 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json @@ -174,5 +174,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json index edfd4e577..05d71b5f8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json @@ -642,5 +642,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json index 6a9cf04c0..c75e7d856 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json @@ -782,5 +782,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json index 1184b4b08..825b41050 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json @@ -306,5 +306,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json index 673cfcccb..0b94c1c5d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json @@ -396,5 +396,8 @@ "functions" : [ ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json index 334c8f055..b5da17265 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json @@ -1476,5 +1476,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json index 87684f133..dc6134526 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json @@ -172,5 +172,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json index aef4e8905..104b11d5a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json @@ -689,5 +689,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json index 10638ebf3..e54d0ad53 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json @@ -59,5 +59,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json index b1f89765b..99c5aff05 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json @@ -75,5 +75,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json index 8de3a12d4..946411036 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json @@ -350,5 +350,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json new file mode 100644 index 000000000..77327c454 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json @@ -0,0 +1,305 @@ +{ + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_MyViewController_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "delegate", + "name" : "delegate", + "type" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_MyViewController_triggerEvent", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "triggerEvent", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewController_updateValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "updateValue", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewController_updateCount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "updateCount", + "parameters" : [ + { + "label" : "_", + "name" : "count", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_MyViewController_updateLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "updateLabel", + "parameters" : [ + { + "label" : "_", + "name" : "prefix", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "suffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewController_checkEvenCount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "checkEvenCount", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + } + ], + "name" : "MyViewController", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "delegate", + "type" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "secondDelegate", + "type" : { + "optional" : { + "_0" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + } + } + } + ], + "swiftCallName" : "MyViewController" + } + ], + "enums" : [ + + ], + "functions" : [ + + ], + "moduleName" : "TestModule", + "protocols" : [ + { + "methods" : [ + { + "abiName" : "bjs_MyViewControllerDelegate_onSomethingHappened", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "onSomethingHappened", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_onValueChanged", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "onValueChanged", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_onCountUpdated", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "onCountUpdated", + "parameters" : [ + { + "label" : "count", + "name" : "count", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_onLabelUpdated", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "onLabelUpdated", + "parameters" : [ + { + "label" : "_", + "name" : "prefix", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "suffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_isCountEven", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "isCountEven", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + } + ], + "name" : "MyViewControllerDelegate" + } + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift new file mode 100644 index 000000000..6ac515c7d --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -0,0 +1,174 @@ +// 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 + +struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProtocolWrapper { + let jsObject: JSObject + + func onSomethingHappened() { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onSomethingHappened") + func _extern_onSomethingHappened(this: Int32) + _extern_onSomethingHappened(this: Int32(bitPattern: jsObject.id)) + } + + func onValueChanged(_ value: String) { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onValueChanged") + func _extern_onValueChanged(this: Int32, value: Int32) + _extern_onValueChanged(this: Int32(bitPattern: jsObject.id), value: value.bridgeJSLowerParameter()) + } + + func onCountUpdated(count: Int) -> Bool { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onCountUpdated") + func _extern_onCountUpdated(this: Int32, count: Int32) -> Int32 + let ret = _extern_onCountUpdated(this: Int32(bitPattern: jsObject.id), count: count.bridgeJSLowerParameter()) + return Bool.bridgeJSLiftReturn(ret) + } + + func onLabelUpdated(_ prefix: String, _ suffix: String) { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onLabelUpdated") + func _extern_onLabelUpdated(this: Int32, prefix: Int32, suffix: Int32) + _extern_onLabelUpdated(this: Int32(bitPattern: jsObject.id), prefix: prefix.bridgeJSLowerParameter(), suffix: suffix.bridgeJSLowerParameter()) + } + + func isCountEven() -> Bool { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_isCountEven") + func _extern_isCountEven(this: Int32) -> Int32 + let ret = _extern_isCountEven(this: Int32(bitPattern: jsObject.id)) + return Bool.bridgeJSLiftReturn(ret) + } + + static func bridgeJSLiftParameter(_ value: Int32) -> Self { + return AnyMyViewControllerDelegate(jsObject: JSObject(id: UInt32(bitPattern: value))) + } +} + +@_expose(wasm, "bjs_MyViewController_init") +@_cdecl("bjs_MyViewController_init") +public func _bjs_MyViewController_init(delegate: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = MyViewController(delegate: AnyMyViewControllerDelegate.bridgeJSLiftParameter(delegate)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MyViewController_triggerEvent") +@_cdecl("bjs_MyViewController_triggerEvent") +public func _bjs_MyViewController_triggerEvent(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + MyViewController.bridgeJSLiftParameter(_self).triggerEvent() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MyViewController_updateValue") +@_cdecl("bjs_MyViewController_updateValue") +public func _bjs_MyViewController_updateValue(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + MyViewController.bridgeJSLiftParameter(_self).updateValue(_: String.bridgeJSLiftParameter(valueBytes, valueLength)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MyViewController_updateCount") +@_cdecl("bjs_MyViewController_updateCount") +public func _bjs_MyViewController_updateCount(_self: UnsafeMutableRawPointer, count: Int32) -> Int32 { + #if arch(wasm32) + let ret = MyViewController.bridgeJSLiftParameter(_self).updateCount(_: Int.bridgeJSLiftParameter(count)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MyViewController_updateLabel") +@_cdecl("bjs_MyViewController_updateLabel") +public func _bjs_MyViewController_updateLabel(_self: UnsafeMutableRawPointer, prefixBytes: Int32, prefixLength: Int32, suffixBytes: Int32, suffixLength: Int32) -> Void { + #if arch(wasm32) + MyViewController.bridgeJSLiftParameter(_self).updateLabel(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength), _: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MyViewController_checkEvenCount") +@_cdecl("bjs_MyViewController_checkEvenCount") +public func _bjs_MyViewController_checkEvenCount(_self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = MyViewController.bridgeJSLiftParameter(_self).checkEvenCount() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MyViewController_delegate_get") +@_cdecl("bjs_MyViewController_delegate_get") +public func _bjs_MyViewController_delegate_get(_self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = MyViewController.bridgeJSLiftParameter(_self).delegate as! AnyMyViewControllerDelegate + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MyViewController_delegate_set") +@_cdecl("bjs_MyViewController_delegate_set") +public func _bjs_MyViewController_delegate_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { + #if arch(wasm32) + MyViewController.bridgeJSLiftParameter(_self).delegate = AnyMyViewControllerDelegate.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MyViewController_secondDelegate_get") +@_cdecl("bjs_MyViewController_secondDelegate_get") +public func _bjs_MyViewController_secondDelegate_get(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = MyViewController.bridgeJSLiftParameter(_self).secondDelegate.flatMap { + $0 as? AnyMyViewControllerDelegate + } + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MyViewController_secondDelegate_set") +@_cdecl("bjs_MyViewController_secondDelegate_set") +public func _bjs_MyViewController_secondDelegate_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: Int32) -> Void { + #if arch(wasm32) + MyViewController.bridgeJSLiftParameter(_self).secondDelegate = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MyViewController_deinit") +@_cdecl("bjs_MyViewController_deinit") +public func _bjs_MyViewController_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension MyViewController: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "TestModule", name: "bjs_MyViewController_wrap") + func _bjs_MyViewController_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_MyViewController_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_MyViewController_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json index 8a73c1b8b..cbd0fa2b8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json @@ -322,5 +322,8 @@ "functions" : [ ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json index 4808e5184..63de88b99 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json @@ -326,5 +326,8 @@ "functions" : [ ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json index 55972aa19..cf6b0025e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json @@ -57,5 +57,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json index 5d727c858..f34a04f9b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json @@ -24,5 +24,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json index 59b7f9ef9..fc99462b7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json @@ -132,5 +132,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json index 51d548e64..d85339150 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json @@ -24,5 +24,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json index f3f7abaa4..df3f5041f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json @@ -24,5 +24,8 @@ } } ], - "moduleName" : "TestModule" + "moduleName" : "TestModule", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Sources/JavaScriptKit/BridgeJSInstrincics.swift b/Sources/JavaScriptKit/BridgeJSInstrincics.swift index d8ddf8fd5..4742aa629 100644 --- a/Sources/JavaScriptKit/BridgeJSInstrincics.swift +++ b/Sources/JavaScriptKit/BridgeJSInstrincics.swift @@ -301,6 +301,21 @@ extension _JSBridgedClass { @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Int32 { jsObject.bridgeJSLowerReturn() } } +/// A protocol that Swift protocol wrappers exposed from JavaScript must conform to. +/// +/// The conformance is automatically synthesized by the BridgeJS code generator. +public protocol _BridgedSwiftProtocolWrapper { + var jsObject: JSObject { get } + static func bridgeJSLiftParameter(_ value: Int32) -> Self +} + +extension _BridgedSwiftProtocolWrapper { + // MARK: ExportSwift + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Int32 { + jsObject.bridgeJSLowerReturn() + } +} + /// A protocol that Swift enum types that do not have a payload can conform to. /// /// The conformance is automatically synthesized by the BridgeJS code generator. @@ -603,6 +618,56 @@ extension Optional where Wrapped == JSObject { } } +extension Optional where Wrapped: _BridgedSwiftProtocolWrapper { + // MARK: ImportTS + + @available( + *, + unavailable, + message: "Optional protocol types are not supported to be passed to imported JS functions" + ) + @_spi(BridgeJS) public func bridgeJSLowerParameter() -> Void {} + + @available( + *, + unavailable, + message: "Optional protocol types are not supported to be passed to imported JS functions" + ) + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ objectId: Int32) -> Wrapped? { + return nil + } + + // MARK: ExportSwift + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ objectId: Int32) -> Wrapped? { + if isSome == 0 { + return nil + } else { + return Wrapped.bridgeJSLiftParameter(objectId) + } + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "swift_js_return_optional_object") + func _swift_js_return_optional_object(_ isSome: Int32, _ objectId: Int32) + #else + /// Write an optional protocol wrapper to reserved storage to be returned to JavaScript + func _swift_js_return_optional_object(_ isSome: Int32, _ objectId: Int32) { + _onlyAvailableOnWasm() + } + #endif + + switch consume self { + case .none: + _swift_js_return_optional_object(0, 0) + case .some(let wrapper): + let retainedId = wrapper.bridgeJSLowerReturn() + _swift_js_return_optional_object(1, retainedId) + } + } +} + /// Optional support for Swift heap objects extension Optional where Wrapped: _BridgedSwiftHeapObject { // MARK: ImportTS diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md index 05be58faf..dbdfba785 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md @@ -66,6 +66,7 @@ This command will: - - - +- - - - diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md new file mode 100644 index 000000000..802ff3aeb --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md @@ -0,0 +1,209 @@ +# Exporting Swift Protocols + +Learn how to expose Swift protocols to JavaScript as TypeScript interfaces. + +## Overview + +> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). + +BridgeJS allows you to export Swift protocols as TypeScript interfaces. JavaScript objects implementing these interfaces can be passed to Swift code, enabling protocol-oriented design across the Swift-JavaScript boundary. + +When you mark a protocol with `@JS`, BridgeJS generates: + +- A TypeScript interface with the protocol's method signatures +- A Swift wrapper struct (`Any{ProtocolName}`) that conforms to the protocol and bridges calls to JavaScript objects + +## Example: Counter Protocol + +Mark a Swift protocol with `@JS` to expose it: + +```swift +import JavaScriptKit + +@JS protocol Counter { + func increment(by amount: Int) + func reset() + func getValue() -> Int +} + +@JS class CounterManager { + var delegate: Counter + + @JS init(delegate: Counter) { + self.delegate = delegate + } + + @JS func incrementTwice() { + delegate.increment(by: 1) + delegate.increment(by: 1) + } + + @JS func getCurrentValue() -> Int { + return delegate.getValue() + } +} +``` + +In JavaScript: + +```javascript +import { init } from "./.build/plugins/PackageToJS/outputs/Package/index.js"; +const { exports } = await init({}); + +// Implement the Counter protocol +const counterImpl = { + count: 0, + increment(amount) { + this.count += amount; + }, + reset() { + this.count = 0; + }, + getValue() { + return this.count; + } +}; + +// Pass the implementation to Swift +const manager = new exports.CounterManager(counterImpl); +manager.incrementTwice(); +console.log(manager.getCurrentValue()); // 2 +``` + +The generated TypeScript interface: + +```typescript +export interface Counter { + increment(amount: number): void; + reset(): void; + getValue(): number; +} + +export type Exports = { + CounterManager: { + new(delegate: Counter): CounterManager; + } +} +``` + +## Generated Wrapper + +BridgeJS generates a Swift wrapper struct for each `@JS` protocol. This wrapper holds a `JSObject` reference and forwards protocol method calls to the JavaScript implementation: + +```swift +struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { + let jsObject: JSObject + + func increment(by amount: Int) { + @_extern(wasm, module: "TestModule", name: "bjs_Counter_increment") + func _extern_increment(this: Int32, amount: Int32) + _extern_increment( + this: Int32(bitPattern: jsObject.id), + amount: amount.bridgeJSLowerParameter() + ) + } + + func reset() { + @_extern(wasm, module: "TestModule", name: "bjs_Counter_reset") + func _extern_reset(this: Int32) + _extern_reset(this: Int32(bitPattern: jsObject.id)) + } + + func getValue() -> Int { + @_extern(wasm, module: "TestModule", name: "bjs_Counter_getValue") + func _extern_getValue(this: Int32) -> Int32 + let ret = _extern_getValue(this: Int32(bitPattern: jsObject.id)) + return Int.bridgeJSLiftReturn(ret) + } + + static func bridgeJSLiftParameter(_ value: Int32) -> Self { + return AnyCounter(jsObject: JSObject(id: UInt32(bitPattern: value))) + } +} +``` + +## Swift Implementation + +You can also implement protocols in Swift and use them from JavaScript: + +```swift +@JS protocol Counter { + func increment(by amount: Int) + func reset() + func getValue() -> Int +} + +final class SwiftCounter: Counter { + private var count = 0 + + func increment(by amount: Int) { + count += amount + } + + func reset() { + count = 0 + } + + func getValue() -> Int { + return count + } +} + +@JS func createCounter() -> Counter { + return SwiftCounter() +} +``` + +From JavaScript: + +```javascript +const counter = exports.createCounter(); +counter.increment(5); +counter.increment(3); +console.log(counter.getValue()); // 8 +counter.reset(); +console.log(counter.getValue()); // 0 +``` + +## How It Works + +When you pass a JavaScript object implementing a protocol to Swift: + +1. **JavaScript Side**: The object is stored in JavaScriptKit's memory heap and its ID is passed as an `Int32` to Swift +2. **Swift Side**: BridgeJS creates an `Any{ProtocolName}` wrapper that holds a `JSObject` reference +3. **Method Calls**: Protocol method calls are forwarded through WASM to the JavaScript implementation +4. **Memory Management**: The `JSObject` reference keeps the JavaScript object alive using JavaScriptKit's retain/release system. When the Swift wrapper is deallocated, the JavaScript object is automatically released. + +## Supported Features + +| Swift Feature | Status | +|:--------------|:-------| +| Method requirements: `func method()` | ✅ | +| Method requirements with parameters | ✅ | +| Method requirements with return values | ✅ | +| Throwing method requirements: `func method() throws(JSException)` | ✅ | +| Async method requirements: `func method() async` | ✅ | +| Optional protocol methods | ❌ | +| Property requirements: `var property: Type { get }` | ❌ | +| Property requirements: `var property: Type { get set }` | ❌ | +| Associated types | ❌ | +| Protocol inheritance | ❌ | +| Protocol composition: `Protocol1 & Protocol2` | ❌ | +| Generics | ❌ | + +### Type Support for Protocol Method Parameters and Return Types + +Protocol method parameters and return values have more limited type support compared to regular exported Swift functions and classes. + +**Supported Types:** +- Primitives: `Bool`, `Int`, `Float`, `Double` +- `String` +- `JSObject` + +**Not Supported:** +- `@JS class` types +- `@JS enum` types (case, raw value, or associated value) +- `@JS protocol` types +- Optional types: `Int?`, `String?`, etc. + +> Note: For regular `@JS func` and `@JS class` exports (not within protocols), all these types including optionals, enums, and classes are fully supported. See and for more information. diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 3336801de..b6255a4ef 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -857,6 +857,87 @@ enum APIOptionalResult { "const:\(StaticPropertyHolder.staticConstant),var:\(StaticPropertyHolder.staticVariable),computed:\(StaticPropertyHolder.computedProperty),readonly:\(StaticPropertyHolder.readOnlyComputed)" } +// MARK: - Protocol Tests + +@JS protocol Counter { + func increment(by amount: Int) + func getValue() -> Int + func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) + func getLabel() -> String + func isEven() -> Bool +} + +@JS class CounterManager { + + @JS var counter: Counter + @JS var backupCounter: Counter? + + @JS init(counter: Counter) { + self.counter = counter + self.backupCounter = nil + } + + @JS func incrementByAmount(_ amount: Int) { + counter.increment(by: amount) + } + + @JS func setCounterLabel(_ prefix: String, _ suffix: String) { + counter.setLabelElements(prefix, suffix) + } + + @JS func isCounterEven() -> Bool { + return counter.isEven() + } + + @JS func getCounterLabel() -> String { + return counter.getLabel() + } + + @JS func getCurrentValue() -> Int { + return counter.getValue() + } + + @JS func incrementBoth() { + counter.increment(by: 1) + backupCounter?.increment(by: 1) + } + + @JS func getBackupValue() -> Int? { + return backupCounter?.getValue() + } + + @JS func hasBackup() -> Bool { + return backupCounter != nil + } +} + +@JS class SwiftCounter: Counter { + private var value: Int = 0 + private var label: String = "" + + @JS init() {} + + @JS func increment(by amount: Int) { + value += amount + } + + @JS func getValue() -> Int { + return value + } + + @JS func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) { + self.label = labelPrefix + labelSuffix + } + + @JS func getLabel() -> String { + return label + } + + @JS func isEven() -> Bool { + return value % 2 == 0 + } +} + class ExportAPITests: XCTestCase { func testAll() { var hasDeinitGreeter = false diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index 0eff4e0b7..1e22c2b09 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -6,6 +6,47 @@ @_spi(BridgeJS) import JavaScriptKit +struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { + let jsObject: JSObject + + func increment(by amount: Int) { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_increment") + func _extern_increment(this: Int32, amount: Int32) + _extern_increment(this: Int32(bitPattern: jsObject.id), amount: amount.bridgeJSLowerParameter()) + } + + func getValue() -> Int { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_getValue") + func _extern_getValue(this: Int32) -> Int32 + let ret = _extern_getValue(this: Int32(bitPattern: jsObject.id)) + return Int.bridgeJSLiftReturn(ret) + } + + func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_setLabelElements") + func _extern_setLabelElements(this: Int32, labelPrefix: Int32, labelSuffix: Int32) + _extern_setLabelElements(this: Int32(bitPattern: jsObject.id), labelPrefix: labelPrefix.bridgeJSLowerParameter(), labelSuffix: labelSuffix.bridgeJSLowerParameter()) + } + + func getLabel() -> String { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_getLabel") + func _extern_getLabel(this: Int32) -> Int32 + let ret = _extern_getLabel(this: Int32(bitPattern: jsObject.id)) + return String.bridgeJSLiftReturn(ret) + } + + func isEven() -> Bool { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_isEven") + func _extern_isEven(this: Int32) -> Int32 + let ret = _extern_isEven(this: Int32(bitPattern: jsObject.id)) + return Bool.bridgeJSLiftReturn(ret) + } + + static func bridgeJSLiftParameter(_ value: Int32) -> Self { + return AnyCounter(jsObject: JSObject(id: UInt32(bitPattern: value))) + } +} + extension Direction: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { return bridgeJSRawValue @@ -3242,4 +3283,248 @@ extension StaticPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_StaticPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) } +} + +@_expose(wasm, "bjs_CounterManager_init") +@_cdecl("bjs_CounterManager_init") +public func _bjs_CounterManager_init(counter: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = CounterManager(counter: AnyCounter.bridgeJSLiftParameter(counter)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CounterManager_incrementByAmount") +@_cdecl("bjs_CounterManager_incrementByAmount") +public func _bjs_CounterManager_incrementByAmount(_self: UnsafeMutableRawPointer, amount: Int32) -> Void { + #if arch(wasm32) + CounterManager.bridgeJSLiftParameter(_self).incrementByAmount(_: Int.bridgeJSLiftParameter(amount)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CounterManager_setCounterLabel") +@_cdecl("bjs_CounterManager_setCounterLabel") +public func _bjs_CounterManager_setCounterLabel(_self: UnsafeMutableRawPointer, prefixBytes: Int32, prefixLength: Int32, suffixBytes: Int32, suffixLength: Int32) -> Void { + #if arch(wasm32) + CounterManager.bridgeJSLiftParameter(_self).setCounterLabel(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength), _: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CounterManager_isCounterEven") +@_cdecl("bjs_CounterManager_isCounterEven") +public func _bjs_CounterManager_isCounterEven(_self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = CounterManager.bridgeJSLiftParameter(_self).isCounterEven() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CounterManager_getCounterLabel") +@_cdecl("bjs_CounterManager_getCounterLabel") +public func _bjs_CounterManager_getCounterLabel(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = CounterManager.bridgeJSLiftParameter(_self).getCounterLabel() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CounterManager_getCurrentValue") +@_cdecl("bjs_CounterManager_getCurrentValue") +public func _bjs_CounterManager_getCurrentValue(_self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = CounterManager.bridgeJSLiftParameter(_self).getCurrentValue() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CounterManager_incrementBoth") +@_cdecl("bjs_CounterManager_incrementBoth") +public func _bjs_CounterManager_incrementBoth(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + CounterManager.bridgeJSLiftParameter(_self).incrementBoth() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CounterManager_getBackupValue") +@_cdecl("bjs_CounterManager_getBackupValue") +public func _bjs_CounterManager_getBackupValue(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = CounterManager.bridgeJSLiftParameter(_self).getBackupValue() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CounterManager_hasBackup") +@_cdecl("bjs_CounterManager_hasBackup") +public func _bjs_CounterManager_hasBackup(_self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = CounterManager.bridgeJSLiftParameter(_self).hasBackup() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CounterManager_counter_get") +@_cdecl("bjs_CounterManager_counter_get") +public func _bjs_CounterManager_counter_get(_self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = CounterManager.bridgeJSLiftParameter(_self).counter as! AnyCounter + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CounterManager_counter_set") +@_cdecl("bjs_CounterManager_counter_set") +public func _bjs_CounterManager_counter_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { + #if arch(wasm32) + CounterManager.bridgeJSLiftParameter(_self).counter = AnyCounter.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CounterManager_backupCounter_get") +@_cdecl("bjs_CounterManager_backupCounter_get") +public func _bjs_CounterManager_backupCounter_get(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = CounterManager.bridgeJSLiftParameter(_self).backupCounter.flatMap { + $0 as? AnyCounter + } + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CounterManager_backupCounter_set") +@_cdecl("bjs_CounterManager_backupCounter_set") +public func _bjs_CounterManager_backupCounter_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: Int32) -> Void { + #if arch(wasm32) + CounterManager.bridgeJSLiftParameter(_self).backupCounter = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CounterManager_deinit") +@_cdecl("bjs_CounterManager_deinit") +public func _bjs_CounterManager_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension CounterManager: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_CounterManager_wrap") + func _bjs_CounterManager_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_CounterManager_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_CounterManager_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +@_expose(wasm, "bjs_SwiftCounter_init") +@_cdecl("bjs_SwiftCounter_init") +public func _bjs_SwiftCounter_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = SwiftCounter() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftCounter_increment") +@_cdecl("bjs_SwiftCounter_increment") +public func _bjs_SwiftCounter_increment(_self: UnsafeMutableRawPointer, amount: Int32) -> Void { + #if arch(wasm32) + SwiftCounter.bridgeJSLiftParameter(_self).increment(by: Int.bridgeJSLiftParameter(amount)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftCounter_getValue") +@_cdecl("bjs_SwiftCounter_getValue") +public func _bjs_SwiftCounter_getValue(_self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = SwiftCounter.bridgeJSLiftParameter(_self).getValue() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftCounter_setLabelElements") +@_cdecl("bjs_SwiftCounter_setLabelElements") +public func _bjs_SwiftCounter_setLabelElements(_self: UnsafeMutableRawPointer, labelPrefixBytes: Int32, labelPrefixLength: Int32, labelSuffixBytes: Int32, labelSuffixLength: Int32) -> Void { + #if arch(wasm32) + SwiftCounter.bridgeJSLiftParameter(_self).setLabelElements(_: String.bridgeJSLiftParameter(labelPrefixBytes, labelPrefixLength), _: String.bridgeJSLiftParameter(labelSuffixBytes, labelSuffixLength)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftCounter_getLabel") +@_cdecl("bjs_SwiftCounter_getLabel") +public func _bjs_SwiftCounter_getLabel(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftCounter.bridgeJSLiftParameter(_self).getLabel() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftCounter_isEven") +@_cdecl("bjs_SwiftCounter_isEven") +public func _bjs_SwiftCounter_isEven(_self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = SwiftCounter.bridgeJSLiftParameter(_self).isEven() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftCounter_deinit") +@_cdecl("bjs_SwiftCounter_deinit") +public func _bjs_SwiftCounter_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension SwiftCounter: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftCounter_wrap") + func _bjs_SwiftCounter_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_SwiftCounter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_SwiftCounter_wrap(Unmanaged.passRetained(self).toOpaque())))) + } } \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index 9af2ee957..a6be6754a 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -1162,6 +1162,352 @@ } ], "swiftCallName" : "StaticPropertyHolder" + }, + { + "constructor" : { + "abiName" : "bjs_CounterManager_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "counter", + "name" : "counter", + "type" : { + "swiftProtocol" : { + "_0" : "Counter" + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_CounterManager_incrementByAmount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "incrementByAmount", + "parameters" : [ + { + "label" : "_", + "name" : "amount", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_CounterManager_setCounterLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setCounterLabel", + "parameters" : [ + { + "label" : "_", + "name" : "prefix", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "suffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_CounterManager_isCounterEven", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "isCounterEven", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_CounterManager_getCounterLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getCounterLabel", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_CounterManager_getCurrentValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getCurrentValue", + "parameters" : [ + + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_CounterManager_incrementBoth", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "incrementBoth", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_CounterManager_getBackupValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getBackupValue", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_CounterManager_hasBackup", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "hasBackup", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + } + ], + "name" : "CounterManager", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "counter", + "type" : { + "swiftProtocol" : { + "_0" : "Counter" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "backupCounter", + "type" : { + "optional" : { + "_0" : { + "swiftProtocol" : { + "_0" : "Counter" + } + } + } + } + } + ], + "swiftCallName" : "CounterManager" + }, + { + "constructor" : { + "abiName" : "bjs_SwiftCounter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_SwiftCounter_increment", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "increment", + "parameters" : [ + { + "label" : "by", + "name" : "amount", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_SwiftCounter_getValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getValue", + "parameters" : [ + + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_SwiftCounter_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_SwiftCounter_getLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getLabel", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_SwiftCounter_isEven", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "isEven", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + } + ], + "name" : "SwiftCounter", + "properties" : [ + + ], + "swiftCallName" : "SwiftCounter" } ], "enums" : [ @@ -5435,5 +5781,122 @@ } } ], - "moduleName" : "BridgeJSRuntimeTests" + "moduleName" : "BridgeJSRuntimeTests", + "protocols" : [ + { + "methods" : [ + { + "abiName" : "bjs_Counter_increment", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "increment", + "parameters" : [ + { + "label" : "by", + "name" : "amount", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_Counter_getValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getValue", + "parameters" : [ + + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_Counter_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_Counter_getLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getLabel", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_Counter_isEven", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "isEven", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + } + ], + "name" : "Counter" + } + ] } \ No newline at end of file diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 7f5610273..e2d0c9806 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -683,6 +683,7 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(exports.testComplexInit(), "Hello, DefaultGreeter!"); const customGreeter = new exports.Greeter("CustomName"); assert.equal(exports.testComplexInit(customGreeter), "Hello, CustomName!"); + customGreeter.release(); const cd1 = new exports.ConstructorDefaults(); @@ -704,6 +705,8 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { const cd5 = new exports.ConstructorDefaults("Test", 99, false, exports.Status.Loading); assert.equal(cd5.describe(), "Test:99:false:loading:nil"); cd5.release(); + + testProtocolSupport(exports); } /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ @@ -802,4 +805,104 @@ function setupTestGlobals(global) { sym: Symbol("s"), bi: BigInt(3) }; -} \ No newline at end of file +} + +/** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ +function testProtocolSupport(exports) { + let counterValue = 0; + let counterLabel = ""; + const jsCounter = { + increment(amount) { counterValue += amount; }, + getValue() { return counterValue; }, + setLabelElements(labelPrefix, labelSuffix) { counterLabel = labelPrefix + labelSuffix; }, + getLabel() { return counterLabel; }, + isEven() { return counterValue % 2 === 0; } + }; + + const manager = new exports.CounterManager(jsCounter); + manager.incrementByAmount(4); + assert.equal(manager.getCurrentValue(), 4); + + manager.setCounterLabel("Test", "Label"); + assert.equal(manager.getCounterLabel(), "TestLabel"); + assert.equal(jsCounter.getLabel(), "TestLabel"); + + assert.equal(manager.isCounterEven(), true); + manager.incrementByAmount(1); + assert.equal(manager.isCounterEven(), false); + assert.equal(jsCounter.isEven(), false); + + jsCounter.increment(3); + assert.equal(jsCounter.getValue(), 8); + manager.release(); + + const swiftCounter = new exports.SwiftCounter(); + const swiftManager = new exports.CounterManager(swiftCounter); + + swiftManager.incrementByAmount(10); + assert.equal(swiftManager.getCurrentValue(), 10); + + swiftManager.setCounterLabel("Swift", "Label"); + assert.equal(swiftManager.getCounterLabel(), "SwiftLabel"); + + swiftCounter.increment(5); + assert.equal(swiftCounter.getValue(), 15); + swiftManager.release(); + swiftCounter.release(); + + let optionalCounterValue = 100; + let optionalCounterLabel = "optional"; + const optionalCounter = { + increment(amount) { optionalCounterValue += amount; }, + getValue() { return optionalCounterValue; }, + setLabelElements(labelPrefix, labelSuffix) { optionalCounterLabel = labelPrefix + labelSuffix; }, + getLabel() { return optionalCounterLabel; }, + isEven() { return optionalCounterValue % 2 === 0; } + }; + + let mainCounterValue = 0; + let mainCounterLabel = "main"; + const mainCounter = { + increment(amount) { mainCounterValue += amount; }, + getValue() { return mainCounterValue; }, + setLabelElements(labelPrefix, labelSuffix) { mainCounterLabel = labelPrefix + labelSuffix; }, + getLabel() { return mainCounterLabel; }, + isEven() { return mainCounterValue % 2 === 0; } + }; + + const managerWithOptional = new exports.CounterManager(mainCounter); + + assert.equal(managerWithOptional.backupCounter, null); + assert.equal(managerWithOptional.hasBackup(), false); + assert.equal(managerWithOptional.getBackupValue(), null); + + managerWithOptional.backupCounter = optionalCounter; + assert.notEqual(managerWithOptional.backupCounter, null); + assert.equal(managerWithOptional.hasBackup(), true); + + managerWithOptional.incrementBoth(); + assert.equal(managerWithOptional.getCurrentValue(), 1); + assert.equal(managerWithOptional.getBackupValue(), 101); + + managerWithOptional.incrementBoth(); + assert.equal(managerWithOptional.getCurrentValue(), 2); + assert.equal(managerWithOptional.getBackupValue(), 102); + + managerWithOptional.backupCounter = null; + assert.equal(managerWithOptional.backupCounter, null); + assert.equal(managerWithOptional.hasBackup(), false); + + managerWithOptional.incrementBoth(); + assert.equal(managerWithOptional.getCurrentValue(), 3); + assert.equal(managerWithOptional.getBackupValue(), null); + + const swiftBackupCounter = new exports.SwiftCounter(); + swiftBackupCounter.increment(1); + managerWithOptional.backupCounter = swiftBackupCounter; + + assert.equal(managerWithOptional.hasBackup(), true); + assert.equal(managerWithOptional.getBackupValue(), 1); + + managerWithOptional.release(); + swiftBackupCounter.release(); +} From f60bfd699898fbb33d05a397286e255f31433c5d Mon Sep 17 00:00:00 2001 From: Tobias Haeberle Date: Sat, 18 Oct 2025 09:34:07 +0200 Subject: [PATCH 002/252] adds a --platform flag to js to control the target platform of the generated code --- Plugins/PackageToJS/Sources/PackageToJS.swift | 3 +++ .../PackageToJS/Sources/PackageToJSPlugin.swift | 3 +++ Plugins/PackageToJS/Templates/index.js | 16 ++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/Plugins/PackageToJS/Sources/PackageToJS.swift b/Plugins/PackageToJS/Sources/PackageToJS.swift index c486c327a..d969620ed 100644 --- a/Plugins/PackageToJS/Sources/PackageToJS.swift +++ b/Plugins/PackageToJS/Sources/PackageToJS.swift @@ -8,6 +8,8 @@ struct PackageToJS { var configuration: String? /// Name of the package (default: lowercased Package.swift name) var packageName: String? + /// Target platform for the generated JavaScript (default: browser) + var platform: String? /// Whether to explain the build plan (default: false) var explain: Bool = false /// Whether to print verbose output @@ -717,6 +719,7 @@ struct PackagingPlanner { "USE_WASI_CDN": options.useCDN, "HAS_BRIDGE": exportedSkeletons.count > 0 || importedSkeletons.count > 0, "HAS_IMPORTS": importedSkeletons.count > 0, + "TARGET_PLATFORM_NODE": options.platform == "node", ] let constantSubstitutions: [String: String] = [ "PACKAGE_TO_JS_MODULE_PATH": wasmFilename, diff --git a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift index dc9958b97..054bc4724 100644 --- a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift +++ b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift @@ -446,6 +446,7 @@ extension PackageToJS.PackageOptions { let configuration: String? = (extractor.extractOption(named: "configuration") + extractor.extractSingleDashOption(named: "c")).last let packageName = extractor.extractOption(named: "package-name").last + let platform = extractor.extractOption(named: "platform").last let explain = extractor.extractFlag(named: "explain") let useCDN = extractor.extractFlag(named: "use-cdn") let verbose = extractor.extractFlag(named: "verbose") @@ -454,6 +455,7 @@ extension PackageToJS.PackageOptions { outputPath: outputPath, configuration: configuration, packageName: packageName, + platform: platform, explain: explain != 0, verbose: verbose != 0, useCDN: useCDN != 0, @@ -466,6 +468,7 @@ extension PackageToJS.PackageOptions { --output Path to the output directory (default: .build/plugins/PackageToJS/outputs/Package) -c, --configuration The build configuration to use (values: debug, release; default: debug) --package-name Name of the package (default: lowercased Package.swift name) + --platform Target platform for generated JavaScript (values: browser, node; default: browser) --use-cdn Whether to use CDN for dependency packages --enable-code-coverage Whether to enable code coverage collection --explain Whether to explain the build plan diff --git a/Plugins/PackageToJS/Templates/index.js b/Plugins/PackageToJS/Templates/index.js index f44dce480..e482b8d4c 100644 --- a/Plugins/PackageToJS/Templates/index.js +++ b/Plugins/PackageToJS/Templates/index.js @@ -1,9 +1,24 @@ // @ts-check import { instantiate } from './instantiate.js'; +/* #if TARGET_PLATFORM_NODE */ +import { defaultNodeSetup /* #if USE_SHARED_MEMORY */, createDefaultWorkerFactory /* #endif */} from './platforms/node.js'; +/* #else */ import { defaultBrowserSetup /* #if USE_SHARED_MEMORY */, createDefaultWorkerFactory /* #endif */} from './platforms/browser.js'; +/* #endif */ /** @type {import('./index.d').init} */ export async function init(_options) { +/* #if TARGET_PLATFORM_NODE */ + /** @type {import('./platforms/node.d.ts').DefaultNodeSetupOptions} */ + const options = _options || {}; + const instantiateOptions = await defaultNodeSetup({ + args: options.args, + onExit: options.onExit, +/* #if USE_SHARED_MEMORY */ + spawnWorker: options.spawnWorker || createDefaultWorkerFactory() +/* #endif */ + }); +/* #else */ /** @type {import('./index.d').Options} */ const options = _options || { /* #if HAS_IMPORTS */ @@ -24,5 +39,6 @@ export async function init(_options) { spawnWorker: createDefaultWorkerFactory() /* #endif */ }) +/* #endif */ return await instantiate(instantiateOptions); } From 4b7292430c6c3f7c25972355529edd588cfc28f9 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sun, 19 Oct 2025 04:04:38 +0000 Subject: [PATCH 003/252] [PackageToJS] Fix flaky `timestampBasedRebuild` test by abstracting file system operations The mtime-based change detection is not very reliable in tests due to the coarse timestamp resolution of some file systems, especially on artificial file operations in tests that happen in quick succession. This change introduces an abstraction over file system operations in MiniMake, allowing tests to use an in-memory file system with precise control over modification times. https://apenwarr.ca/log/20181113 --- Plugins/PackageToJS/Sources/MiniMake.swift | 51 +++++++++--- Plugins/PackageToJS/Tests/MiniMakeTests.swift | 81 +++++++++++++++++-- 2 files changed, 112 insertions(+), 20 deletions(-) diff --git a/Plugins/PackageToJS/Sources/MiniMake.swift b/Plugins/PackageToJS/Sources/MiniMake.swift index 0004af6c0..663635b7c 100644 --- a/Plugins/PackageToJS/Sources/MiniMake.swift +++ b/Plugins/PackageToJS/Sources/MiniMake.swift @@ -93,14 +93,18 @@ struct MiniMake { private var tasks: [TaskKey: Task] /// Whether to explain why tasks are built private var shouldExplain: Bool + /// File system operations + private var fileSystem: MiniMakeFileSystem /// Prints progress of the build private var printProgress: ProgressPrinter.PrintProgress init( explain: Bool = false, + fileSystem: MiniMakeFileSystem = DefaultMiniMakeFileSystem(), printProgress: @escaping ProgressPrinter.PrintProgress ) { self.tasks = [:] + self.fileSystem = fileSystem self.shouldExplain = explain self.printProgress = printProgress } @@ -222,7 +226,7 @@ struct MiniMake { /// Cleans all outputs of all tasks func cleanEverything(scope: VariableScope) { for task in self.tasks.values { - try? FileManager.default.removeItem(at: scope.resolve(path: task.output)) + try? fileSystem.removeItem(at: scope.resolve(path: task.output)) } } @@ -234,26 +238,20 @@ struct MiniMake { return true } let outputURL = scope.resolve(path: task.output) - if !FileManager.default.fileExists(atPath: outputURL.path) { + if !fileSystem.fileExists(at: outputURL) { explain("Task \(task.output) should be built because it doesn't exist") return true } - let outputMtime = try? outputURL.resourceValues(forKeys: [.contentModificationDateKey]) - .contentModificationDate + let outputMtime = try? fileSystem.modificationDate(of: outputURL) return task.inputs.contains { input in let inputURL = scope.resolve(path: input) // Ignore directory modification times - var isDirectory: ObjCBool = false - let fileExists = FileManager.default.fileExists( - atPath: inputURL.path, - isDirectory: &isDirectory - ) - if fileExists && isDirectory.boolValue { + let (fileExists, isDirectory) = fileSystem.fileExists(at: inputURL) + if fileExists && isDirectory { return false } - let inputMtime = try? inputURL.resourceValues(forKeys: [.contentModificationDateKey] - ).contentModificationDate + let inputMtime = try? fileSystem.modificationDate(of: inputURL) let shouldBuild = outputMtime == nil || inputMtime == nil || outputMtime! < inputMtime! if shouldBuild { @@ -337,3 +335,32 @@ struct BuildPath: Encodable, Hashable, CustomStringConvertible { try container.encode(self.description) } } + +/// Abstraction over file system operations +protocol MiniMakeFileSystem { + func removeItem(at url: URL) throws + func fileExists(at url: URL) -> Bool + func fileExists(at url: URL) -> (exists: Bool, isDirectory: Bool) + func modificationDate(of url: URL) throws -> Date? +} + +/// Default implementation of MiniMakeFileSystem using FileManager +struct DefaultMiniMakeFileSystem: MiniMakeFileSystem { + func removeItem(at url: URL) throws { + try FileManager.default.removeItem(at: url) + } + + func fileExists(at url: URL) -> Bool { + FileManager.default.fileExists(atPath: url.path) + } + + func fileExists(at url: URL) -> (exists: Bool, isDirectory: Bool) { + var isDirectory: ObjCBool = false + let exists = FileManager.default.fileExists(atPath: url.path, isDirectory: &isDirectory) + return (exists, isDirectory.boolValue) + } + + func modificationDate(of url: URL) throws -> Date? { + try url.resourceValues(forKeys: [.contentModificationDateKey]).contentModificationDate + } +} diff --git a/Plugins/PackageToJS/Tests/MiniMakeTests.swift b/Plugins/PackageToJS/Tests/MiniMakeTests.swift index c0bba29c7..140f28805 100644 --- a/Plugins/PackageToJS/Tests/MiniMakeTests.swift +++ b/Plugins/PackageToJS/Tests/MiniMakeTests.swift @@ -4,6 +4,67 @@ import Testing @testable import PackageToJS @Suite struct MiniMakeTests { + final class InMemoryFileSystem: MiniMakeFileSystem { + struct FileEntry { + var content: Data + var modificationDate: Date + var isDirectory: Bool + } + private var storage: [URL: FileEntry] = [:] + + struct MonotonicDateGenerator { + private var currentDate: Date + + init(startingFrom date: Date = Date()) { + self.currentDate = date + } + + mutating func next() -> Date { + currentDate = currentDate.addingTimeInterval(1) + return currentDate + } + } + var dateGenerator = MonotonicDateGenerator() + + // MARK: - MiniMakeFileSystem conformance + + func removeItem(at url: URL) throws { + storage.removeValue(forKey: url) + } + + func fileExists(at url: URL) -> Bool { + return storage[url] != nil + } + + func fileExists(at url: URL) -> (exists: Bool, isDirectory: Bool) { + if let entry = storage[url] { + return (true, entry.isDirectory) + } else { + return (false, false) + } + } + + func modificationDate(of url: URL) throws -> Date? { + return storage[url]?.modificationDate + } + + func writeFile(at url: URL, content: Data) { + storage[url] = FileEntry(content: content, modificationDate: dateGenerator.next(), isDirectory: false) + } + + // MARK: - Helpers for tests + + func touch(_ url: URL) { + let date = dateGenerator.next() + if var entry = storage[url] { + entry.modificationDate = date + storage[url] = entry + } else { + storage[url] = FileEntry(content: Data(), modificationDate: date, isDirectory: false) + } + } + } + // Test basic task management functionality @Test func basicTaskManagement() throws { try withTemporaryDirectory { tempDir, _ in @@ -114,7 +175,11 @@ import Testing // Test that rebuilds are controlled by timestamps @Test func timestampBasedRebuild() throws { try withTemporaryDirectory { tempDir, _ in - var make = MiniMake(printProgress: { _, _ in }) + let fs = InMemoryFileSystem() + var make = MiniMake( + fileSystem: fs, + printProgress: { _, _ in } + ) let prefix = BuildPath(prefix: "PREFIX") let scope = MiniMake.VariableScope(variables: [ "PREFIX": tempDir.path @@ -123,25 +188,25 @@ import Testing let output = prefix.appending(path: "output.txt") var buildCount = 0 - try "Initial".write(toFile: scope.resolve(path: input).path, atomically: true, encoding: .utf8) + // Create initial input file + fs.touch(scope.resolve(path: input)) let task = make.addTask(inputFiles: [input], output: output) { task, scope in buildCount += 1 - let content = try String(contentsOfFile: scope.resolve(path: task.inputs[0]).path, encoding: .utf8) - try content.write(toFile: scope.resolve(path: task.output).path, atomically: true, encoding: .utf8) + fs.touch(scope.resolve(path: task.output)) } // First build - try make.build(output: task, scope: scope) + #expect(throws: Never.self) { try make.build(output: task, scope: scope) } #expect(buildCount == 1, "First build should occur") // Second build without changes - try make.build(output: task, scope: scope) + #expect(throws: Never.self) { try make.build(output: task, scope: scope) } #expect(buildCount == 1, "No rebuild should occur if input is not modified") // Modify input and rebuild - try "Modified".write(toFile: scope.resolve(path: input).path, atomically: true, encoding: .utf8) - try make.build(output: task, scope: scope) + fs.touch(scope.resolve(path: input)) + #expect(throws: Never.self) { try make.build(output: task, scope: scope) } #expect(buildCount == 2, "Should rebuild when input is modified") } } From fa6e32199343618c048f65ef22e945f0e879a8f1 Mon Sep 17 00:00:00 2001 From: Tobias Haeberle Date: Sun, 19 Oct 2025 10:32:09 +0200 Subject: [PATCH 004/252] Improve template code to better support node 1. Fixed missing type export (platforms/node.d.ts) - Exported DefaultNodeSetupOptions type that is referenced in index.js 2. Updated index.d.ts to support both platforms - Made init() function accept DefaultNodeSetupOptions for node platform - Made init() function accept Options for browser platform 3. Fixed conditional compilation in node.js - Wrapped getImports() in HAS_IMPORTS conditional (platforms/node.js) --- Plugins/PackageToJS/Templates/index.d.ts | 14 ++++++++++++++ Plugins/PackageToJS/Templates/platforms/node.d.ts | 6 ++++-- Plugins/PackageToJS/Templates/platforms/node.js | 2 ++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Plugins/PackageToJS/Templates/index.d.ts b/Plugins/PackageToJS/Templates/index.d.ts index 757a88287..601f354be 100644 --- a/Plugins/PackageToJS/Templates/index.d.ts +++ b/Plugins/PackageToJS/Templates/index.d.ts @@ -1,4 +1,7 @@ import type { Exports, Imports, ModuleSource } from './instantiate.js' +/* #if TARGET_PLATFORM_NODE */ +import type { DefaultNodeSetupOptions } from './platforms/node.js' +/* #endif */ export type Options = { /** @@ -18,10 +21,21 @@ export type Options = { /** * Instantiate and initialize the module * +/* #if TARGET_PLATFORM_NODE */ + * This is a convenience function for Node.js environments. +/* #else */ * This is a convenience function for browser environments. +/* #endif */ * If you need a more flexible API, see `instantiate`. */ +/* #if TARGET_PLATFORM_NODE */ +export declare function init(options?: DefaultNodeSetupOptions): Promise<{ + instance: WebAssembly.Instance, + exports: Exports +}> +/* #else */ export declare function init(options?: Options): Promise<{ instance: WebAssembly.Instance, exports: Exports }> +/* #endif */ diff --git a/Plugins/PackageToJS/Templates/platforms/node.d.ts b/Plugins/PackageToJS/Templates/platforms/node.d.ts index 9d80205fc..f756c8efc 100644 --- a/Plugins/PackageToJS/Templates/platforms/node.d.ts +++ b/Plugins/PackageToJS/Templates/platforms/node.d.ts @@ -1,7 +1,7 @@ import type { InstantiateOptions } from "../instantiate.js" import type { Worker } from "node:worker_threads" -export function defaultNodeSetup(options: { +export type DefaultNodeSetupOptions = { /* #if IS_WASI */ args?: string[], /* #endif */ @@ -9,6 +9,8 @@ export function defaultNodeSetup(options: { /* #if USE_SHARED_MEMORY */ spawnWorker: (module: WebAssembly.Module, memory: WebAssembly.Memory, startArg: any) => Worker, /* #endif */ -}): Promise +} + +export function defaultNodeSetup(options: DefaultNodeSetupOptions): Promise export function createDefaultWorkerFactory(preludeScript: string): (module: WebAssembly.Module, memory: WebAssembly.Memory, startArg: any) => Worker diff --git a/Plugins/PackageToJS/Templates/platforms/node.js b/Plugins/PackageToJS/Templates/platforms/node.js index 4d29fc33f..ddd017154 100644 --- a/Plugins/PackageToJS/Templates/platforms/node.js +++ b/Plugins/PackageToJS/Templates/platforms/node.js @@ -139,7 +139,9 @@ export async function defaultNodeSetup(options) { return { module, +/* #if HAS_IMPORTS */ getImports() { return {} }, +/* #endif */ /* #if IS_WASI */ wasi: Object.assign(wasi, { setInstance(instance) { From c3c342427d55be70ee3b464e6009acef728ffdc3 Mon Sep 17 00:00:00 2001 From: Tobias Haeberle Date: Sun, 19 Oct 2025 10:32:48 +0200 Subject: [PATCH 005/252] Add devDependency @types/node so TypeScript can understand Node.js APIs --- Plugins/PackageToJS/Templates/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Plugins/PackageToJS/Templates/package.json b/Plugins/PackageToJS/Templates/package.json index a3e7074bb..0566b0b5e 100644 --- a/Plugins/PackageToJS/Templates/package.json +++ b/Plugins/PackageToJS/Templates/package.json @@ -9,5 +9,8 @@ }, "dependencies": { "@bjorn3/browser_wasi_shim": "0.3.0" + }, + "devDependencies": { + "@types/node": "^22.0.0" } } From eed636d73b00ed96604685b3fc3b290d46cd2691 Mon Sep 17 00:00:00 2001 From: Tobias Haeberle Date: Mon, 20 Oct 2025 08:01:54 +0200 Subject: [PATCH 006/252] run tscCheck on preprocessed templates test both browser and node platform variants --- .../PackageToJS/Tests/TemplatesTests.swift | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/Plugins/PackageToJS/Tests/TemplatesTests.swift b/Plugins/PackageToJS/Tests/TemplatesTests.swift index e885eb087..9e85c64ab 100644 --- a/Plugins/PackageToJS/Tests/TemplatesTests.swift +++ b/Plugins/PackageToJS/Tests/TemplatesTests.swift @@ -9,10 +9,47 @@ import Foundation .appendingPathComponent("Templates") /// `npx tsc -p Templates/tsconfig.json` - @Test func tscCheck() throws { + /// Test both node and browser platform variants + @Test(arguments: ["node", "browser"]) + func tscCheck(platform: String) throws { + // Create a temporary directory for preprocessed files + let tempDir = FileManager.default.temporaryDirectory + .appendingPathComponent("JavaScriptKit-tsc-\(platform)-\(UUID().uuidString)") + defer { + try? FileManager.default.removeItem(at: tempDir) + } + + // Copy entire templates folder to temp location + try FileManager.default.copyItem(at: Self.templatesPath, to: tempDir) + + // Setup preprocessing conditions + let conditions: [String: Bool] = [ + "USE_SHARED_MEMORY": false, + "IS_WASI": true, + "USE_WASI_CDN": false, + "HAS_BRIDGE": false, + "HAS_IMPORTS": platform == "browser", + "TARGET_PLATFORM_NODE": platform == "node", + ] + let preprocessOptions = PreprocessOptions(conditions: conditions, substitutions: [:]) + + // Preprocess all JS and TS files in-place + let enumerator = FileManager.default.enumerator(at: tempDir, includingPropertiesForKeys: nil) + while let fileURL = enumerator?.nextObject() as? URL { + guard !fileURL.hasDirectoryPath, + fileURL.pathExtension == "js" || fileURL.pathExtension == "ts" else { + continue + } + + let content = try String(contentsOf: fileURL, encoding: .utf8) + let preprocessed = try preprocess(source: content, file: fileURL.path, options: preprocessOptions) + try preprocessed.write(to: fileURL, atomically: true, encoding: .utf8) + } + + // Run TypeScript on the preprocessed files let tsc = Process() tsc.executableURL = try which("npx") - tsc.arguments = ["tsc", "-p", Self.templatesPath.appending(path: "tsconfig.json").path] + tsc.arguments = ["tsc", "-p", tempDir.appending(path: "tsconfig.json").path] try tsc.run() tsc.waitUntilExit() #expect(tsc.terminationStatus == 0) From a1b912b9b29e78b828db78df34fb9c3a5a72fd50 Mon Sep 17 00:00:00 2001 From: Tobias Haeberle Date: Mon, 20 Oct 2025 08:23:30 +0200 Subject: [PATCH 007/252] update snapshot salts --- .../planBuild_debug.json | 24 +++++++------- .../planBuild_release.json | 24 +++++++------- .../planBuild_release_dwarf.json | 24 +++++++------- .../planBuild_release_name.json | 24 +++++++------- .../planBuild_release_no_optimize.json | 24 +++++++------- .../PackagingPlannerTests/planTestBuild.json | 32 +++++++++---------- 6 files changed, 76 insertions(+), 76 deletions(-) diff --git a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_debug.json b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_debug.json index 13768da75..f09b0b44f 100644 --- a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_debug.json +++ b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_debug.json @@ -48,7 +48,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -65,7 +65,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -82,7 +82,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -99,7 +99,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -128,7 +128,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/package.json" ], "output" : "$OUTPUT\/package.json", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1d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3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -172,7 +172,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -189,7 +189,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.worker.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -206,7 +206,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -223,7 +223,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -240,7 +240,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -257,7 +257,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", diff --git a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release.json b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release.json index ccfbc35cc..71801d180 100644 --- a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release.json +++ b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release.json @@ -62,7 +62,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -79,7 +79,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -96,7 +96,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -113,7 +113,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -143,7 +143,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/package.json" ], "output" : "$OUTPUT\/package.json", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT" ] @@ -170,7 +170,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -187,7 +187,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -204,7 +204,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.worker.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -221,7 +221,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -238,7 +238,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -255,7 +255,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -272,7 +272,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", diff --git a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_dwarf.json b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_dwarf.json index 13768da75..f09b0b44f 100644 --- a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_dwarf.json +++ b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_dwarf.json @@ -48,7 +48,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -65,7 +65,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -82,7 +82,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -99,7 +99,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -128,7 +128,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/package.json" ], "output" : "$OUTPUT\/package.json", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT" ] @@ -155,7 +155,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -172,7 +172,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -189,7 +189,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.worker.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -206,7 +206,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -223,7 +223,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -240,7 +240,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -257,7 +257,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", diff --git a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_name.json b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_name.json index ccfbc35cc..71801d180 100644 --- a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_name.json +++ b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_name.json @@ -62,7 +62,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -79,7 +79,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -96,7 +96,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -113,7 +113,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -143,7 +143,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/package.json" ], "output" : "$OUTPUT\/package.json", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT" ] @@ -170,7 +170,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -187,7 +187,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -204,7 +204,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.worker.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -221,7 +221,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -238,7 +238,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -255,7 +255,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -272,7 +272,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", diff --git a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_no_optimize.json b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_no_optimize.json index 13768da75..f09b0b44f 100644 --- a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_no_optimize.json +++ b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_no_optimize.json @@ -48,7 +48,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -65,7 +65,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -82,7 +82,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -99,7 +99,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -128,7 +128,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/package.json" ], "output" : "$OUTPUT\/package.json", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT" ] @@ -155,7 +155,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -172,7 +172,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -189,7 +189,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.worker.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -206,7 +206,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -223,7 +223,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -240,7 +240,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -257,7 +257,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", diff --git a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planTestBuild.json b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planTestBuild.json index 89425dc83..475f6726e 100644 --- a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planTestBuild.json +++ b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planTestBuild.json @@ -73,7 +73,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/bin\/test.js" ], "output" : "$OUTPUT\/bin\/test.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/bin" @@ -89,7 +89,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -106,7 +106,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -123,7 +123,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -140,7 +140,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -169,7 +169,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/package.json" ], "output" : "$OUTPUT\/package.json", - "salt" : "eyJjb25kaX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klTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -213,7 +213,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -230,7 +230,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.worker.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -247,7 +247,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -264,7 +264,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -281,7 +281,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -298,7 +298,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -314,7 +314,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/test.browser.html" ], "output" : "$OUTPUT\/test.browser.html", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/bin" @@ -329,7 +329,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/test.d.ts" ], "output" : "$OUTPUT\/test.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/bin" @@ -344,7 +344,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/test.js" ], "output" : "$OUTPUT\/test.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlVTRV9TSEFSRURfTUVNT1JZIjpmYWxzZSwiVVNFX1dBU0lfQ0ROIjpmYWxzZX0sInN1YnN0aXR1dGlvbnMiOnsiUEFDS0FHRV9UT19KU19NT0RVTEVfUEFUSCI6Im1haW4ud2FzbSIsIlBBQ0tBR0VfVE9fSlNfUEFDS0FHRV9OQU1FIjoidGVzdCJ9fQ==", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", "wants" : [ "$OUTPUT", "$OUTPUT\/bin" From 83b31fa305276bf9a8d502f5b00cab24f5000139 Mon Sep 17 00:00:00 2001 From: Tobias Haeberle Date: Mon, 20 Oct 2025 09:50:51 +0200 Subject: [PATCH 008/252] add Plugin/PackageToJS/Templates to bootstrap --- Makefile | 1 + .../PackageToJS/Templates/package-lock.json | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Plugins/PackageToJS/Templates/package-lock.json diff --git a/Makefile b/Makefile index 5ac35ea57..4ae7ccaf6 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ SWIFT_SDK_ID ?= wasm32-unknown-wasi .PHONY: bootstrap bootstrap: npm ci + cd Plugins/PackageToJS/Templates && npm ci .PHONY: unittest unittest: diff --git a/Plugins/PackageToJS/Templates/package-lock.json b/Plugins/PackageToJS/Templates/package-lock.json new file mode 100644 index 000000000..a0a1b13a8 --- /dev/null +++ b/Plugins/PackageToJS/Templates/package-lock.json @@ -0,0 +1,41 @@ +{ + "name": "@PACKAGE_TO_JS_PACKAGE_NAME@", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@PACKAGE_TO_JS_PACKAGE_NAME@", + "version": "0.0.0", + "dependencies": { + "@bjorn3/browser_wasi_shim": "0.3.0" + }, + "devDependencies": { + "@types/node": "^22.0.0" + } + }, + "node_modules/@bjorn3/browser_wasi_shim": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@bjorn3/browser_wasi_shim/-/browser_wasi_shim-0.3.0.tgz", + "integrity": "sha512-FlRBYttPRLcWORzBe6g8nmYTafBkOEFeOqMYM4tAHJzFsQy4+xJA94z85a9BCs8S+Uzfh9LrkpII7DXr2iUVFg==", + "license": "MIT OR Apache-2.0" + }, + "node_modules/@types/node": { + "version": "22.18.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.18.11.tgz", + "integrity": "sha512-Gd33J2XIrXurb+eT2ktze3rJAfAp9ZNjlBdh4SVgyrKEOADwCbdUDaK7QgJno8Ue4kcajscsKqu6n8OBG3hhCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + } + } +} From 4e8bc2f1b11d1a1b54fb052395c897e9df30d397 Mon Sep 17 00:00:00 2001 From: Tobias Haeberle Date: Mon, 20 Oct 2025 17:42:21 +0200 Subject: [PATCH 009/252] formatting --- Plugins/PackageToJS/Tests/TemplatesTests.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/PackageToJS/Tests/TemplatesTests.swift b/Plugins/PackageToJS/Tests/TemplatesTests.swift index 9e85c64ab..c7b1ba6fb 100644 --- a/Plugins/PackageToJS/Tests/TemplatesTests.swift +++ b/Plugins/PackageToJS/Tests/TemplatesTests.swift @@ -37,7 +37,8 @@ import Foundation let enumerator = FileManager.default.enumerator(at: tempDir, includingPropertiesForKeys: nil) while let fileURL = enumerator?.nextObject() as? URL { guard !fileURL.hasDirectoryPath, - fileURL.pathExtension == "js" || fileURL.pathExtension == "ts" else { + fileURL.pathExtension == "js" || fileURL.pathExtension == "ts" + else { continue } From 76ee898ddb25807d0a62461b976eb435e5576d4d Mon Sep 17 00:00:00 2001 From: Tobias Haeberle Date: Mon, 20 Oct 2025 22:00:51 +0200 Subject: [PATCH 010/252] model `platform` as enum --- Plugins/PackageToJS/Sources/PackageToJS.swift | 9 +++-- .../Sources/PackageToJSPlugin.swift | 33 ++++++++++++++----- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/Plugins/PackageToJS/Sources/PackageToJS.swift b/Plugins/PackageToJS/Sources/PackageToJS.swift index d969620ed..a9fe6489e 100644 --- a/Plugins/PackageToJS/Sources/PackageToJS.swift +++ b/Plugins/PackageToJS/Sources/PackageToJS.swift @@ -2,6 +2,11 @@ import Foundation struct PackageToJS { struct PackageOptions { + enum Platform: String, CaseIterable { + case browser + case node + } + /// Path to the output directory var outputPath: String? /// The build configuration to use (default: debug) @@ -9,7 +14,7 @@ struct PackageToJS { /// Name of the package (default: lowercased Package.swift name) var packageName: String? /// Target platform for the generated JavaScript (default: browser) - var platform: String? + var platform: Platform = .browser /// Whether to explain the build plan (default: false) var explain: Bool = false /// Whether to print verbose output @@ -719,7 +724,7 @@ struct PackagingPlanner { "USE_WASI_CDN": options.useCDN, "HAS_BRIDGE": exportedSkeletons.count > 0 || importedSkeletons.count > 0, "HAS_IMPORTS": importedSkeletons.count > 0, - "TARGET_PLATFORM_NODE": options.platform == "node", + "TARGET_PLATFORM_NODE": options.platform == .node, ] let constantSubstitutions: [String: String] = [ "PACKAGE_TO_JS_MODULE_PATH": wasmFilename, diff --git a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift index 054bc4724..60ebec7e7 100644 --- a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift +++ b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift @@ -175,7 +175,7 @@ struct PackageToJSPlugin: CommandPlugin { } var extractor = ArgumentExtractor(arguments) - let buildOptions = PackageToJS.BuildOptions.parse(from: &extractor) + let buildOptions = try PackageToJS.BuildOptions.parse(from: &extractor) if extractor.remainingArguments.count > 0 { printStderr( @@ -239,7 +239,7 @@ struct PackageToJSPlugin: CommandPlugin { } var extractor = ArgumentExtractor(arguments) - let testOptions = PackageToJS.TestOptions.parse(from: &extractor) + let testOptions = try PackageToJS.TestOptions.parse(from: &extractor) if extractor.remainingArguments.count > 0 { printStderr( @@ -440,13 +440,28 @@ private func printStderr(_ message: String) { // MARK: - Options parsing +extension ArgumentExtractor { + mutating func extractPlatformOption(named name: String) throws -> PackageToJS.PackageOptions.Platform { + let stringValue : String? = self.extractOption(named: name).last + guard let stringValue else { + throw PackageToJSError("Missing value for option --\(name)") + } + guard let platform = PackageToJS.PackageOptions.Platform(rawValue: stringValue) else { + throw PackageToJSError( + "Invalid platform: \(stringValue), expected one of \(PackageToJS.PackageOptions.Platform.allCases.map(\.rawValue).joined(separator: ", "))" + ) + } + return platform + } +} + extension PackageToJS.PackageOptions { - static func parse(from extractor: inout ArgumentExtractor) -> PackageToJS.PackageOptions { + static func parse(from extractor: inout ArgumentExtractor) throws -> PackageToJS.PackageOptions { let outputPath = extractor.extractOption(named: "output").last let configuration: String? = (extractor.extractOption(named: "configuration") + extractor.extractSingleDashOption(named: "c")).last let packageName = extractor.extractOption(named: "package-name").last - let platform = extractor.extractOption(named: "platform").last + let platform = try extractor.extractPlatformOption(named: "platform") let explain = extractor.extractFlag(named: "explain") let useCDN = extractor.extractFlag(named: "use-cdn") let verbose = extractor.extractFlag(named: "verbose") @@ -468,7 +483,7 @@ extension PackageToJS.PackageOptions { --output Path to the output directory (default: .build/plugins/PackageToJS/outputs/Package) -c, --configuration The build configuration to use (values: debug, release; default: debug) --package-name Name of the package (default: lowercased Package.swift name) - --platform Target platform for generated JavaScript (values: browser, node; default: browser) + --platform Target platform for generated JavaScript (values: \(PackageToJS.PackageOptions.Platform.allCases.map(\.rawValue).joined(separator: ", ")); default: \(PackageToJS.PackageOptions.Platform.browser)) --use-cdn Whether to use CDN for dependency packages --enable-code-coverage Whether to enable code coverage collection --explain Whether to explain the build plan @@ -478,7 +493,7 @@ extension PackageToJS.PackageOptions { } extension PackageToJS.BuildOptions { - static func parse(from extractor: inout ArgumentExtractor) -> PackageToJS.BuildOptions { + static func parse(from extractor: inout ArgumentExtractor) throws -> PackageToJS.BuildOptions { let product = extractor.extractOption(named: "product").last let noOptimize = extractor.extractFlag(named: "no-optimize") let rawDebugInfoFormat = extractor.extractOption(named: "debug-info-format").last @@ -491,7 +506,7 @@ extension PackageToJS.BuildOptions { } debugInfoFormat = format } - let packageOptions = PackageToJS.PackageOptions.parse(from: &extractor) + let packageOptions = try PackageToJS.PackageOptions.parse(from: &extractor) return PackageToJS.BuildOptions( product: product, noOptimize: noOptimize != 0, @@ -529,7 +544,7 @@ extension PackageToJS.BuildOptions { } extension PackageToJS.TestOptions { - static func parse(from extractor: inout ArgumentExtractor) -> PackageToJS.TestOptions { + static func parse(from extractor: inout ArgumentExtractor) throws -> PackageToJS.TestOptions { let buildOnly = extractor.extractFlag(named: "build-only") let listTests = extractor.extractFlag(named: "list-tests") let filter = extractor.extractOption(named: "filter") @@ -537,7 +552,7 @@ extension PackageToJS.TestOptions { let environment = extractor.extractOption(named: "environment").last let inspect = extractor.extractFlag(named: "inspect") let extraNodeArguments = extractor.extractSingleDashOption(named: "Xnode") - let packageOptions = PackageToJS.PackageOptions.parse(from: &extractor) + let packageOptions = try PackageToJS.PackageOptions.parse(from: &extractor) var options = PackageToJS.TestOptions( buildOnly: buildOnly != 0, listTests: listTests != 0, From 27dadd9c6c280e4549d84ce26800d3dc94d3f18f Mon Sep 17 00:00:00 2001 From: Tobias Haeberle Date: Mon, 20 Oct 2025 22:43:45 +0200 Subject: [PATCH 011/252] use browser as default value for platform --- Plugins/PackageToJS/Sources/PackageToJSPlugin.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift index 60ebec7e7..e934279f6 100644 --- a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift +++ b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift @@ -442,10 +442,10 @@ private func printStderr(_ message: String) { extension ArgumentExtractor { mutating func extractPlatformOption(named name: String) throws -> PackageToJS.PackageOptions.Platform { - let stringValue : String? = self.extractOption(named: name).last - guard let stringValue else { - throw PackageToJSError("Missing value for option --\(name)") + guard let stringValue = self.extractOption(named: name).last else { + return .browser } + guard let platform = PackageToJS.PackageOptions.Platform(rawValue: stringValue) else { throw PackageToJSError( "Invalid platform: \(stringValue), expected one of \(PackageToJS.PackageOptions.Platform.allCases.map(\.rawValue).joined(separator: ", "))" From d4044cf3cc9d0024df6094b0a690e59b4bde1d83 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 21 Oct 2025 15:02:10 +0900 Subject: [PATCH 012/252] PackageToJS: Expose Playwright Launch Options in test harness --- Examples/Testing/README.md | 7 ++++++ .../run-tests-with-browser-options.mjs | 23 +++++++++++++++++++ Plugins/PackageToJS/Templates/test.d.ts | 7 ++++++ Plugins/PackageToJS/Templates/test.js | 2 +- 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 Examples/Testing/run-tests-with-browser-options.mjs diff --git a/Examples/Testing/README.md b/Examples/Testing/README.md index 2f28357a6..ae1c68b6f 100644 --- a/Examples/Testing/README.md +++ b/Examples/Testing/README.md @@ -31,3 +31,10 @@ llvm-cov show -instr-profile=.build/plugins/PackageToJS/outputs/PackageTests/def ```console npx serve .build/coverage/html ``` +## Customize test harness + +See [./run-tests-with-browser-options.mjs](./run-tests-with-browser-options.mjs) for an example of customizing the test harness to run tests with specific browser options. + +```console +node run-tests-with-browser-options.mjs +``` diff --git a/Examples/Testing/run-tests-with-browser-options.mjs b/Examples/Testing/run-tests-with-browser-options.mjs new file mode 100644 index 000000000..9051c28c8 --- /dev/null +++ b/Examples/Testing/run-tests-with-browser-options.mjs @@ -0,0 +1,23 @@ +// Import the generated test harness function +import { testBrowser } from "./.build/plugins/PackageToJS/outputs/PackageTests/test.js" + +// Execute the test with custom browser options +async function runTest(args) { + const exitCode = await testBrowser({ + args: args, + playwright: { + browser: "chromium", + launchOptions: { + headless: false, + } + } + }); + if (exitCode !== 0) { + process.exit(exitCode); + } +} +// Run XCTest test suites +await runTest([]); +// Run Swift Testing test suites +await runTest(["--testing-library", "swift-testing"]); +process.exit(0); diff --git a/Plugins/PackageToJS/Templates/test.d.ts b/Plugins/PackageToJS/Templates/test.d.ts index 21383997b..03a064f28 100644 --- a/Plugins/PackageToJS/Templates/test.d.ts +++ b/Plugins/PackageToJS/Templates/test.d.ts @@ -9,8 +9,15 @@ export type SetupOptionsFn = ( export function testBrowser( options: { + /** Path to the prelude script to be injected before tests run */ preludeScript?: string, + /** Command-line arguments to pass to the test runner */ args?: string[], + /** Options for Playwright browser */ + playwright?: { + browser?: string, + launchOptions?: import("playwright").LaunchOptions + } } ): Promise diff --git a/Plugins/PackageToJS/Templates/test.js b/Plugins/PackageToJS/Templates/test.js index 518dacf20..19a1deac6 100644 --- a/Plugins/PackageToJS/Templates/test.js +++ b/Plugins/PackageToJS/Templates/test.js @@ -96,7 +96,7 @@ Please run the following command to install it: process.exit(1); } })(); - const browser = await playwright.chromium.launch(); + const browser = await playwright[options.playwright?.browser ?? "chromium"].launch(options.playwright?.launchOptions ?? {}); const context = await browser.newContext(); const page = await context.newPage(); From 395ca2471cf165beefd2bb2def116850cb24f41c Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 8 Oct 2025 14:29:48 +0200 Subject: [PATCH 013/252] BridgeJS: Basic support for properties in protocols --- .../Sources/BridgeJSCore/ExportSwift.swift | 221 ++++++++++++++++-- .../Sources/BridgeJSLink/BridgeJSLink.swift | 60 +++++ .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 25 +- .../BridgeJSToolTests/Inputs/Protocol.swift | 2 + .../BridgeJSLinkTests/Protocol.Export.d.ts | 2 + .../BridgeJSLinkTests/Protocol.Export.js | 25 ++ .../ExportSwiftTests/Protocol.swift | 23 ++ .../Exporting-Swift-Protocols.md | 17 -- .../BridgeJSRuntimeTests/ExportAPITests.swift | 11 +- .../Generated/BridgeJS.ExportSwift.swift | 63 +++++ .../JavaScript/BridgeJS.ExportSwift.json | 41 +++- Tests/prelude.mjs | 29 ++- 12 files changed, 470 insertions(+), 49 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 9179a9668..01a8343e7 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -749,9 +749,8 @@ public class ExportSwift { case .topLevel: diagnose(node: node, message: "@JS var must be inside a @JS class or enum") return .skipChildren - case .protocolBody(_, _): - diagnose(node: node, message: "Properties are not supported in protocols") - return .skipChildren + case .protocolBody(let protocolName, let protocolKey): + return visitProtocolProperty(node: node, protocolName: protocolName, protocolKey: protocolKey) } // Process each binding (variable declaration) @@ -775,23 +774,8 @@ public class ExportSwift { // Check if property is readonly let isLet = node.bindingSpecifier.tokenKind == .keyword(.let) - let isGetterOnly = node.bindings.contains(where: { - switch $0.accessorBlock?.accessors { - case .accessors(let accessors): - // Has accessors - check if it only has a getter (no setter, willSet, or didSet) - return !accessors.contains(where: { accessor in - let tokenKind = accessor.accessorSpecifier.tokenKind - return tokenKind == .keyword(.set) || tokenKind == .keyword(.willSet) - || tokenKind == .keyword(.didSet) - }) - case .getter: - // Has only a getter block - return true - case nil: - // No accessor block - this is a stored property, not readonly - return false - } - }) + let isGetterOnly = node.bindings.contains(where: { self.hasOnlyGetter($0.accessorBlock) }) + let isReadonly = isLet || isGetterOnly let exportedProperty = ExportedProperty( @@ -997,6 +981,17 @@ public class ExportSwift { message: "Protocol visibility must be at least internal" ) + let protocolUniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) + + exportedProtocolByName[protocolUniqueKey] = ExportedProtocol( + name: name, + methods: [], + properties: [], + namespace: namespaceResult.namespace + ) + + stateStack.push(state: .protocolBody(name: name, key: protocolUniqueKey)) + var methods: [ExportedFunction] = [] for member in node.memberBlock.members { if let funcDecl = member.decl.as(FunctionDeclSyntax.self) { @@ -1007,18 +1002,22 @@ public class ExportSwift { ) { methods.append(exportedFunction) } + } else if let varDecl = member.decl.as(VariableDeclSyntax.self) { + _ = visitProtocolProperty(node: varDecl, protocolName: name, protocolKey: protocolUniqueKey) } } let exportedProtocol = ExportedProtocol( name: name, methods: methods, + properties: exportedProtocolByName[protocolUniqueKey]?.properties ?? [], namespace: namespaceResult.namespace ) - - let protocolUniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) + exportedProtocolByName[protocolUniqueKey] = exportedProtocol exportedProtocolNames.append(protocolUniqueKey) + + stateStack.pop() parent.exportedProtocolNameByKey[protocolUniqueKey] = name @@ -1075,6 +1074,89 @@ public class ExportSwift { ) } + private func visitProtocolProperty( + node: VariableDeclSyntax, + protocolName: String, + protocolKey: String + ) -> SyntaxVisitorContinueKind { + for binding in node.bindings { + guard let pattern = binding.pattern.as(IdentifierPatternSyntax.self) else { + diagnose(node: binding.pattern, message: "Complex patterns not supported for protocol properties") + continue + } + + let propertyName = pattern.identifier.text + + guard let typeAnnotation = binding.typeAnnotation else { + diagnose(node: binding, message: "Protocol property must have explicit type annotation") + continue + } + + guard let propertyType = self.parent.lookupType(for: typeAnnotation.type) else { + diagnoseUnsupportedType(node: typeAnnotation.type, type: typeAnnotation.type.trimmedDescription) + continue + } + + if case .optional = propertyType { + diagnose( + node: typeAnnotation.type, + message: "Optional properties are not yet supported in protocols" + ) + continue + } + + guard let accessorBlock = binding.accessorBlock else { + diagnose( + node: binding, + message: "Protocol property must specify { get } or { get set }", + hint: "Add { get } for readonly or { get set } for readwrite property" + ) + continue + } + + let isReadonly = hasOnlyGetter(accessorBlock) + + let exportedProperty = ExportedProtocolProperty( + name: propertyName, + type: propertyType, + isReadonly: isReadonly + ) + + if var currentProtocol = exportedProtocolByName[protocolKey] { + var properties = currentProtocol.properties + properties.append(exportedProperty) + + currentProtocol = ExportedProtocol( + name: currentProtocol.name, + methods: currentProtocol.methods, + properties: properties, + namespace: currentProtocol.namespace + ) + exportedProtocolByName[protocolKey] = currentProtocol + } + } + + return .skipChildren + } + + private func hasOnlyGetter(_ accessorBlock: AccessorBlockSyntax?) -> Bool { + switch accessorBlock?.accessors { + case .accessors(let accessors): + // Has accessors - check if it only has a getter (no setter, willSet, or didSet) + return !accessors.contains(where: { accessor in + let tokenKind = accessor.accessorSpecifier.tokenKind + return tokenKind == .keyword(.set) || tokenKind == .keyword(.willSet) + || tokenKind == .keyword(.didSet) + }) + case .getter: + // Has only a getter block + return true + case nil: + // No accessor block - this is a stored property, not readonly + return false + } + } + override func visit(_ node: EnumCaseDeclSyntax) -> SyntaxVisitorContinueKind { guard case .enumBody(_, let enumKey) = stateStack.current else { return .visitChildren @@ -2179,11 +2261,24 @@ public class ExportSwift { methodDecls.append(methodImplementation) } + var propertyDecls: [DeclSyntax] = [] + + for property in proto.properties { + let propertyImpl = try renderProtocolProperty( + property: property, + protocolName: protocolName, + moduleName: moduleName + ) + propertyDecls.append(propertyImpl) + } + + let allDecls = (methodDecls + propertyDecls).map { $0.description }.joined(separator: "\n\n") + return """ struct \(raw: wrapperName): \(raw: protocolName), _BridgedSwiftProtocolWrapper { let jsObject: JSObject - \(raw: methodDecls.map { $0.description }.joined(separator: "\n\n")) + \(raw: allDecls) static func bridgeJSLiftParameter(_ value: Int32) -> Self { return \(raw: wrapperName)(jsObject: JSObject(id: UInt32(bitPattern: value))) @@ -2191,6 +2286,86 @@ public class ExportSwift { } """ } + + private func renderProtocolProperty( + property: ExportedProtocolProperty, + protocolName: String, + moduleName: String + ) throws -> DeclSyntax { + let getterAbiName = ABINameGenerator.generateABIName( + baseName: property.name, + namespace: nil, + staticContext: nil, + operation: "get", + className: protocolName + ) + let setterAbiName = ABINameGenerator.generateABIName( + baseName: property.name, + namespace: nil, + staticContext: nil, + operation: "set", + className: protocolName + ) + + // Generate getter + let liftingInfo = try property.type.liftingReturnInfo() + let getterReturnType: String + let getterCallCode: String + + if let abiType = liftingInfo.valueToLift { + getterReturnType = " -> \(abiType.swiftType)" + getterCallCode = """ + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return \(property.type.swiftType).bridgeJSLiftReturn(ret) + """ + } else { + // For String and other types that use tmpRetString + getterReturnType = "" + getterCallCode = """ + _extern_get(this: Int32(bitPattern: jsObject.id)) + return \(property.type.swiftType).bridgeJSLiftReturn() + """ + } + + if property.isReadonly { + // Readonly property - only getter + return """ + var \(raw: property.name): \(raw: property.type.swiftType) { + get { + @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: getterAbiName)") + func _extern_get(this: Int32)\(raw: getterReturnType) + \(raw: getterCallCode) + } + } + """ + } else { + // Readwrite property - getter and setter + let loweringInfo = try property.type.loweringParameterInfo() + assert( + loweringInfo.loweredParameters.count == 1, + "Protocol property setters must lower to a single WASM parameter" + ) + + let (paramName, wasmType) = loweringInfo.loweredParameters[0] + let setterParams = "this: Int32, \(paramName): \(wasmType.swiftType)" + let setterCallArgs = "this: Int32(bitPattern: jsObject.id), \(paramName): newValue.bridgeJSLowerParameter()" + + return """ + var \(raw: property.name): \(raw: property.type.swiftType) { + get { + @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: getterAbiName)") + func _extern_get(this: Int32)\(raw: getterReturnType) + \(raw: getterCallCode) + } + set { + @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: setterAbiName)") + func _extern_set(\(raw: setterParams)) + _extern_set(\(raw: setterCallArgs)) + } + } + """ + } + } } fileprivate enum Constants { diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 88f2af3d7..1a182457f 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -314,6 +314,13 @@ struct BridgeJSLink { } for proto in skeleton.protocols { + for property in proto.properties { + try renderProtocolProperty( + importObjectBuilder: importObjectBuilder, + protocol: proto, + property: property + ) + } for method in proto.methods { try renderProtocolMethod( importObjectBuilder: importObjectBuilder, @@ -607,6 +614,13 @@ struct BridgeJSLink { "\(method.name)\(renderTSSignature(parameters: method.parameters, returnType: method.returnType, effects: method.effects));" ) } + for property in proto.properties { + let propertySignature = + property.isReadonly + ? "readonly \(property.name): \(property.type.tsType);" + : "\(property.name): \(property.type.tsType);" + printer.write(propertySignature) + } } printer.write("}") printer.nextLine() @@ -2417,6 +2431,52 @@ extension BridgeJSLink { return (funcLines, []) } + func renderProtocolProperty( + importObjectBuilder: ImportObjectBuilder, + protocol: ExportedProtocol, + property: ExportedProtocolProperty + ) throws { + let getterAbiName = ABINameGenerator.generateABIName( + baseName: property.name, + namespace: nil, + staticContext: nil, + operation: "get", + className: `protocol`.name + ) + + let getterThunkBuilder = ImportedThunkBuilder() + getterThunkBuilder.liftSelf() + let returnExpr = try getterThunkBuilder.callPropertyGetter(name: property.name, returnType: property.type) + let getterLines = getterThunkBuilder.renderFunction( + name: getterAbiName, + returnExpr: returnExpr, + returnType: property.type + ) + importObjectBuilder.assignToImportObject(name: getterAbiName, function: getterLines) + + if !property.isReadonly { + let setterAbiName = ABINameGenerator.generateABIName( + baseName: property.name, + namespace: nil, + staticContext: nil, + operation: "set", + className: `protocol`.name + ) + let setterThunkBuilder = ImportedThunkBuilder() + setterThunkBuilder.liftSelf() + try setterThunkBuilder.liftParameter( + param: Parameter(label: nil, name: "value", type: property.type) + ) + setterThunkBuilder.callPropertySetter(name: property.name, returnType: property.type) + let setterLines = setterThunkBuilder.renderFunction( + name: setterAbiName, + returnExpr: nil, + returnType: .void + ) + importObjectBuilder.assignToImportObject(name: setterAbiName, function: setterLines) + } + } + func renderProtocolMethod( importObjectBuilder: ImportObjectBuilder, protocol: ExportedProtocol, diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 1a414b956..3cf34554a 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -270,14 +270,37 @@ public enum EnumType: String, Codable, Sendable { // MARK: - Exported Skeleton +public struct ExportedProtocolProperty: Codable, Equatable, Sendable { + public let name: String + public let type: BridgeType + public let isReadonly: Bool + + public init( + name: String, + type: BridgeType, + isReadonly: Bool + ) { + self.name = name + self.type = type + self.isReadonly = isReadonly + } +} + public struct ExportedProtocol: Codable, Equatable { public let name: String public let methods: [ExportedFunction] + public let properties: [ExportedProtocolProperty] public let namespace: [String]? - public init(name: String, methods: [ExportedFunction], namespace: [String]? = nil) { + public init( + name: String, + methods: [ExportedFunction], + properties: [ExportedProtocolProperty] = [], + namespace: [String]? = nil + ) { self.name = name self.methods = methods + self.properties = properties self.namespace = namespace } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift index f02133692..54ca6abf7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift @@ -1,6 +1,8 @@ import JavaScriptKit @JS protocol MyViewControllerDelegate { + var eventCount: Int { get set } + var delegateName: String { get } func onSomethingHappened() func onValueChanged(_ value: String) func onCountUpdated(count: Int) -> Bool diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts index 0f5d0fb20..a6d1125eb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts @@ -10,6 +10,8 @@ export interface MyViewControllerDelegate { onCountUpdated(count: number): boolean; onLabelUpdated(prefix: string, suffix: string): void; isCountEven(): boolean; + eventCount: number; + readonly delegateName: string; } /// Represents a Swift heap object like a class instance or an actor instance. diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index 142c1cf0b..847787d5c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -147,6 +147,31 @@ export async function createInstantiator(options, swift) { return swift.memory.retain(obj); }; const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_MyViewControllerDelegate_eventCount_get"] = function bjs_MyViewControllerDelegate_eventCount_get(self) { + try { + let ret = swift.memory.getObject(self).eventCount; + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_MyViewControllerDelegate_eventCount_get"] = function bjs_MyViewControllerDelegate_eventCount_get(self, value) { + try { + swift.memory.getObject(self).eventCount = value; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_delegateName_get"] = function bjs_MyViewControllerDelegate_delegateName_get(self) { + try { + let ret = swift.memory.getObject(self).delegateName; + tmpRetBytes = textEncoder.encode(ret); + return tmpRetBytes.length; + } catch (error) { + setException(error); + } + } TestModule["bjs_MyViewControllerDelegate_onSomethingHappened"] = function bjs_MyViewControllerDelegate_onSomethingHappened(self) { try { swift.memory.getObject(self).onSomethingHappened(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index 6ac515c7d..0e5304673 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -41,6 +41,29 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto return Bool.bridgeJSLiftReturn(ret) } + var eventCount: Int { + get { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Int.bridgeJSLiftReturn(ret) + } + set { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_set") + func _extern_set(this: Int32, value: Int32) + _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + } + } + + var delegateName: String { + get { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_delegateName_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return String.bridgeJSLiftReturn(ret) + } + } + static func bridgeJSLiftParameter(_ value: Int32) -> Self { return AnyMyViewControllerDelegate(jsObject: JSObject(id: UInt32(bitPattern: value))) } diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md index 802ff3aeb..8e1aa8a9a 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md @@ -190,20 +190,3 @@ When you pass a JavaScript object implementing a protocol to Swift: | Protocol inheritance | ❌ | | Protocol composition: `Protocol1 & Protocol2` | ❌ | | Generics | ❌ | - -### Type Support for Protocol Method Parameters and Return Types - -Protocol method parameters and return values have more limited type support compared to regular exported Swift functions and classes. - -**Supported Types:** -- Primitives: `Bool`, `Int`, `Float`, `Double` -- `String` -- `JSObject` - -**Not Supported:** -- `@JS class` types -- `@JS enum` types (case, raw value, or associated value) -- `@JS protocol` types -- Optional types: `Int?`, `String?`, etc. - -> Note: For regular `@JS func` and `@JS class` exports (not within protocols), all these types including optionals, enums, and classes are fully supported. See and for more information. diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index b6255a4ef..b49dca59d 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -860,6 +860,8 @@ enum APIOptionalResult { // MARK: - Protocol Tests @JS protocol Counter { + var count: Int { get set } + var name: String { get } func increment(by amount: Int) func getValue() -> Int func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) @@ -912,17 +914,18 @@ enum APIOptionalResult { } @JS class SwiftCounter: Counter { - private var value: Int = 0 + @JS var count: Int = 0 + @JS let name: String = "SwiftCounter" private var label: String = "" @JS init() {} @JS func increment(by amount: Int) { - value += amount + count += amount } @JS func getValue() -> Int { - return value + return count } @JS func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) { @@ -934,7 +937,7 @@ enum APIOptionalResult { } @JS func isEven() -> Bool { - return value % 2 == 0 + return count % 2 == 0 } } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index 1e22c2b09..3ee75a189 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -19,7 +19,11 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_getValue") func _extern_getValue(this: Int32) -> Int32 let ret = _extern_getValue(this: Int32(bitPattern: jsObject.id)) +<<<<<<< HEAD return Int.bridgeJSLiftReturn(ret) +======= + return Int.bridgeJSLiftReturn(ret) +>>>>>>> f19c8b06 (WIP: Initial protocol support) } func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) { @@ -32,7 +36,11 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_getLabel") func _extern_getLabel(this: Int32) -> Int32 let ret = _extern_getLabel(this: Int32(bitPattern: jsObject.id)) +<<<<<<< HEAD return String.bridgeJSLiftReturn(ret) +======= + return String.bridgeJSLiftReturn(ret) +>>>>>>> f19c8b06 (WIP: Initial protocol support) } func isEven() -> Bool { @@ -42,6 +50,29 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { return Bool.bridgeJSLiftReturn(ret) } + var count: Int { + get { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_count_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Int.bridgeJSLiftReturn(ret) + } + set { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_count_get") + func _extern_set(this: Int32, value: Int32) + _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + } + } + + var name: String { + get { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_name_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return String.bridgeJSLiftReturn(ret) + } + } + static func bridgeJSLiftParameter(_ value: Int32) -> Self { return AnyCounter(jsObject: JSObject(id: UInt32(bitPattern: value))) } @@ -3509,6 +3540,38 @@ public func _bjs_SwiftCounter_isEven(_self: UnsafeMutableRawPointer) -> Int32 { #endif } +@_expose(wasm, "bjs_SwiftCounter_count_get") +@_cdecl("bjs_SwiftCounter_count_get") +public func _bjs_SwiftCounter_count_get(_self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = SwiftCounter.bridgeJSLiftParameter(_self).count + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftCounter_count_set") +@_cdecl("bjs_SwiftCounter_count_set") +public func _bjs_SwiftCounter_count_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { + #if arch(wasm32) + SwiftCounter.bridgeJSLiftParameter(_self).count = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftCounter_name_get") +@_cdecl("bjs_SwiftCounter_name_get") +public func _bjs_SwiftCounter_name_get(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftCounter.bridgeJSLiftParameter(_self).name + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_SwiftCounter_deinit") @_cdecl("bjs_SwiftCounter_deinit") public func _bjs_SwiftCounter_deinit(pointer: UnsafeMutableRawPointer) { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index a6be6754a..49afbd693 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -1505,7 +1505,26 @@ ], "name" : "SwiftCounter", "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "count", + "type" : { + "int" : { + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + } ], "swiftCallName" : "SwiftCounter" } @@ -5896,7 +5915,27 @@ } } ], - "name" : "Counter" + "name" : "Counter", + "properties" : [ + { + "isReadonly" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] } ] } \ No newline at end of file diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index e2d0c9806..ab3f44770 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -812,7 +812,9 @@ function testProtocolSupport(exports) { let counterValue = 0; let counterLabel = ""; const jsCounter = { - increment(amount) { counterValue += amount; }, + count: 0, + name: "JSCounter", + increment(amount) { counterValue += amount; this.count += amount; }, getValue() { return counterValue; }, setLabelElements(labelPrefix, labelSuffix) { counterLabel = labelPrefix + labelSuffix; }, getLabel() { return counterLabel; }, @@ -820,8 +822,13 @@ function testProtocolSupport(exports) { }; const manager = new exports.CounterManager(jsCounter); + + assert.equal(jsCounter.count, 0); + assert.equal(jsCounter.name, "JSCounter"); + manager.incrementByAmount(4); assert.equal(manager.getCurrentValue(), 4); + assert.equal(jsCounter.count, 4); manager.setCounterLabel("Test", "Label"); assert.equal(manager.getCounterLabel(), "TestLabel"); @@ -839,21 +846,33 @@ function testProtocolSupport(exports) { const swiftCounter = new exports.SwiftCounter(); const swiftManager = new exports.CounterManager(swiftCounter); + assert.equal(swiftCounter.count, 0); + assert.equal(swiftCounter.name, "SwiftCounter"); + swiftManager.incrementByAmount(10); assert.equal(swiftManager.getCurrentValue(), 10); + assert.equal(swiftCounter.count, 10); swiftManager.setCounterLabel("Swift", "Label"); assert.equal(swiftManager.getCounterLabel(), "SwiftLabel"); swiftCounter.increment(5); assert.equal(swiftCounter.getValue(), 15); + assert.equal(swiftCounter.count, 15); + + swiftCounter.count = 100; + assert.equal(swiftCounter.count, 100); + assert.equal(swiftCounter.getValue(), 100); + swiftManager.release(); swiftCounter.release(); let optionalCounterValue = 100; let optionalCounterLabel = "optional"; const optionalCounter = { - increment(amount) { optionalCounterValue += amount; }, + count: 100, + name: "OptionalCounter", + increment(amount) { optionalCounterValue += amount; this.count += amount; }, getValue() { return optionalCounterValue; }, setLabelElements(labelPrefix, labelSuffix) { optionalCounterLabel = labelPrefix + labelSuffix; }, getLabel() { return optionalCounterLabel; }, @@ -863,7 +882,9 @@ function testProtocolSupport(exports) { let mainCounterValue = 0; let mainCounterLabel = "main"; const mainCounter = { - increment(amount) { mainCounterValue += amount; }, + count: 0, + name: "MainCounter", + increment(amount) { mainCounterValue += amount; this.count += amount; }, getValue() { return mainCounterValue; }, setLabelElements(labelPrefix, labelSuffix) { mainCounterLabel = labelPrefix + labelSuffix; }, getLabel() { return mainCounterLabel; }, @@ -902,6 +923,8 @@ function testProtocolSupport(exports) { assert.equal(managerWithOptional.hasBackup(), true); assert.equal(managerWithOptional.getBackupValue(), 1); + assert.equal(swiftBackupCounter.count, 1); + assert.equal(swiftBackupCounter.name, "SwiftCounter"); managerWithOptional.release(); swiftBackupCounter.release(); From 731a047d0c616c24cd3e92165bdc0876feb03b69 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 14 Oct 2025 17:39:46 +0200 Subject: [PATCH 014/252] BridgeJS: Naive implementation for swiftheapobject BridgeJS: Improve SwiftHeapObject handling in import side --- .../Sources/BridgeJSCore/ExportSwift.swift | 8 +- .../Sources/BridgeJSCore/ImportTS.swift | 32 +++- .../Sources/BridgeJSLink/BridgeJSLink.swift | 16 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 47 ++++-- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 6 + .../BridgeJSToolTests/Inputs/Protocol.swift | 18 +++ .../BridgeJSLinkTests/Protocol.Export.d.ts | 10 ++ .../BridgeJSLinkTests/Protocol.Export.js | 46 +++++- .../ExportSwiftTests/Protocol.json | 143 +++++++++++++++++- .../ExportSwiftTests/Protocol.swift | 85 +++++++++++ .../JavaScriptKit/BridgeJSInstrincics.swift | 16 +- .../Exporting-Swift-Protocols.md | 67 +++++++- .../BridgeJSRuntimeTests/ExportAPITests.swift | 10 ++ .../Generated/BridgeJS.ExportSwift.swift | 38 ++++- .../JavaScript/BridgeJS.ExportSwift.json | 84 ++++++++++ Tests/prelude.mjs | 32 +++- 16 files changed, 614 insertions(+), 44 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 01a8343e7..2d5f2d412 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -2213,7 +2213,7 @@ public class ExportSwift { var externParams: [String] = ["this: Int32"] for param in method.parameters { - let loweringInfo = try param.type.loweringParameterInfo() + let loweringInfo = try param.type.loweringParameterInfo(context: .protocolExport) assert( loweringInfo.loweredParameters.count == 1, "Protocol parameters must lower to a single WASM type" @@ -2239,7 +2239,7 @@ public class ExportSwift { """ } else { returnTypeStr = " -> \(method.returnType.swiftType)" - let liftingInfo = try method.returnType.liftingReturnInfo() + let liftingInfo = try method.returnType.liftingReturnInfo(context: .protocolExport) if let abiType = liftingInfo.valueToLift { externReturnType = " -> \(abiType.swiftType)" } else { @@ -2308,7 +2308,7 @@ public class ExportSwift { ) // Generate getter - let liftingInfo = try property.type.liftingReturnInfo() + let liftingInfo = try property.type.liftingReturnInfo(context: .protocolExport) let getterReturnType: String let getterCallCode: String @@ -2340,7 +2340,7 @@ public class ExportSwift { """ } else { // Readwrite property - getter and setter - let loweringInfo = try property.type.loweringParameterInfo() + let loweringInfo = try property.type.loweringParameterInfo(context: .protocolExport) assert( loweringInfo.loweredParameters.count == 1, "Protocol property setters must lower to a single WASM parameter" diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 64e89d66b..ac8ab03e2 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -424,7 +424,7 @@ extension BridgeType { static let void = LoweringParameterInfo(loweredParameters: []) } - func loweringParameterInfo() throws -> LoweringParameterInfo { + func loweringParameterInfo(context: BridgeContext = .importTS) throws -> LoweringParameterInfo { switch self { case .bool: return .bool case .int: return .int @@ -433,8 +433,18 @@ extension BridgeType { case .string: return .string case .jsObject: return .jsObject case .void: return .void - case .swiftHeapObject: - throw BridgeJSCoreError("swiftHeapObject is not supported in imported signatures") + case .swiftHeapObject(let className): + switch context { + case .importTS: + throw BridgeJSCoreError( + """ + swiftHeapObject '\(className)' is not supported in TypeScript imports. + Swift classes can only be used in @JS protocols where Swift owns the instance. + """ + ) + case .protocolExport: + return LoweringParameterInfo(loweredParameters: [("pointer", .pointer)]) + } case .swiftProtocol: throw BridgeJSCoreError("swiftProtocol is not supported in imported signatures") case .caseEnum, .rawValueEnum, .associatedValueEnum, .namespaceEnum: @@ -456,7 +466,7 @@ extension BridgeType { static let void = LiftingReturnInfo(valueToLift: nil) } - func liftingReturnInfo() throws -> LiftingReturnInfo { + func liftingReturnInfo(context: BridgeContext = .importTS) throws -> LiftingReturnInfo { switch self { case .bool: return .bool case .int: return .int @@ -465,8 +475,18 @@ extension BridgeType { case .string: return .string case .jsObject: return .jsObject case .void: return .void - case .swiftHeapObject: - throw BridgeJSCoreError("swiftHeapObject is not supported in imported signatures") + case .swiftHeapObject(let className): + switch context { + case .importTS: + throw BridgeJSCoreError( + """ + swiftHeapObject '\(className)' cannot be returned from imported TypeScript functions. + JavaScript cannot create Swift heap objects. + """ + ) + case .protocolExport: + return LiftingReturnInfo(valueToLift: .pointer) + } case .swiftProtocol: throw BridgeJSCoreError("swiftProtocol is not supported in imported signatures") case .caseEnum, .rawValueEnum, .associatedValueEnum, .namespaceEnum: diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 1a182457f..9f85dbcf1 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -1856,13 +1856,15 @@ extension BridgeJSLink { let body: CodeFragmentPrinter let scope: JSGlueVariableScope let cleanupCode: CodeFragmentPrinter + let context: BridgeContext var parameterNames: [String] = [] var parameterForwardings: [String] = [] - init() { + init(context: BridgeContext = .importTS) { self.body = CodeFragmentPrinter() self.scope = JSGlueVariableScope() self.cleanupCode = CodeFragmentPrinter() + self.context = context } func liftSelf() { @@ -1870,7 +1872,7 @@ extension BridgeJSLink { } func liftParameter(param: Parameter) throws { - let liftingFragment = try IntrinsicJSFragment.liftParameter(type: param.type) + let liftingFragment = try IntrinsicJSFragment.liftParameter(type: param.type, context: context) assert( liftingFragment.parameters.count >= 1, "Lifting fragment should have at least one parameter to lift" @@ -1927,7 +1929,7 @@ extension BridgeJSLink { } private func call(callExpr: String, returnType: BridgeType) throws -> String? { - let loweringFragment = try IntrinsicJSFragment.lowerReturn(type: returnType) + let loweringFragment = try IntrinsicJSFragment.lowerReturn(type: returnType, context: context) let returnExpr: String? if loweringFragment.parameters.count == 0 { body.write("\(callExpr);") @@ -1947,7 +1949,7 @@ extension BridgeJSLink { func callConstructor(name: String) throws -> String? { let call = "new imports.\(name)(\(parameterForwardings.joined(separator: ", ")))" let type: BridgeType = .jsObject(name) - let loweringFragment = try IntrinsicJSFragment.lowerReturn(type: type) + let loweringFragment = try IntrinsicJSFragment.lowerReturn(type: type, context: context) return try lowerReturnValue(returnType: type, returnExpr: call, loweringFragment: loweringFragment) } @@ -2444,7 +2446,7 @@ extension BridgeJSLink { className: `protocol`.name ) - let getterThunkBuilder = ImportedThunkBuilder() + let getterThunkBuilder = ImportedThunkBuilder(context: .protocolExport) getterThunkBuilder.liftSelf() let returnExpr = try getterThunkBuilder.callPropertyGetter(name: property.name, returnType: property.type) let getterLines = getterThunkBuilder.renderFunction( @@ -2462,7 +2464,7 @@ extension BridgeJSLink { operation: "set", className: `protocol`.name ) - let setterThunkBuilder = ImportedThunkBuilder() + let setterThunkBuilder = ImportedThunkBuilder(context: .protocolExport) setterThunkBuilder.liftSelf() try setterThunkBuilder.liftParameter( param: Parameter(label: nil, name: "value", type: property.type) @@ -2482,7 +2484,7 @@ extension BridgeJSLink { protocol: ExportedProtocol, method: ExportedFunction ) throws { - let thunkBuilder = ImportedThunkBuilder() + let thunkBuilder = ImportedThunkBuilder(context: .protocolExport) thunkBuilder.liftSelf() for param in method.parameters { try thunkBuilder.liftParameter(param: param) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index ef431432f..b7adcb670 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -219,6 +219,20 @@ struct IntrinsicJSFragment: Sendable { } ) } + static func swiftHeapObjectLiftParameter(_ name: String) -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: ["pointer"], + printCode: { arguments, scope, printer, cleanupCode in + return ["\(name).__construct(\(arguments[0]))"] + } + ) + } + static let swiftHeapObjectLowerReturn = IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanupCode in + return ["\(arguments[0]).pointer"] + } + ) static func associatedEnumLowerParameter(enumBase: String) -> IntrinsicJSFragment { IntrinsicJSFragment( @@ -468,17 +482,23 @@ struct IntrinsicJSFragment: Sendable { // MARK: - ImportedJS /// Returns a fragment that lifts Wasm core values to JS values for parameters - static func liftParameter(type: BridgeType) throws -> IntrinsicJSFragment { + /// + /// - Parameters: + /// - type: The bridge type to lift + /// - context: The bridge context (defaults to .importTS for backward compatibility) + static func liftParameter(type: BridgeType, context: BridgeContext = .importTS) throws -> IntrinsicJSFragment { switch type { case .int, .float, .double: return .identity case .bool: return .boolLiftParameter case .string: return .stringLiftParameter case .jsObject: return .jsObjectLiftParameter case .swiftHeapObject(let name): - throw BridgeJSLinkError( - message: - "Swift heap objects are not supported to be passed as parameters to imported JS functions: \(name)" - ) + guard context == .protocolExport else { + throw BridgeJSLinkError( + message: "swiftHeapObject '\(name)' can only be used in protocol exports, not in \(context)" + ) + } + return .swiftHeapObjectLiftParameter(name) case .swiftProtocol: return .jsObjectLiftParameter case .void: throw BridgeJSLinkError( @@ -509,16 +529,23 @@ struct IntrinsicJSFragment: Sendable { } /// Returns a fragment that lowers a JS value to Wasm core values for return values - static func lowerReturn(type: BridgeType) throws -> IntrinsicJSFragment { + /// + /// - Parameters: + /// - type: The bridge type to lower + /// - context: The bridge context (defaults to .importTS for backward compatibility) + static func lowerReturn(type: BridgeType, context: BridgeContext = .importTS) throws -> IntrinsicJSFragment { switch type { case .int, .float, .double: return .identity case .bool: return .boolLowerReturn case .string: return .stringLowerReturn case .jsObject: return .jsObjectLowerReturn - case .swiftHeapObject: - throw BridgeJSLinkError( - message: "Swift heap objects are not supported to be returned from imported JS functions" - ) + case .swiftHeapObject(let name): + guard context == .protocolExport else { + throw BridgeJSLinkError( + message: "swiftHeapObject '\(name)' can only be used in protocol exports, not in \(context)" + ) + } + return .swiftHeapObjectLowerReturn case .swiftProtocol: return .jsObjectLowerReturn case .void: return .void case .optional(let wrappedType): diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 3cf34554a..504cd68a2 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -67,6 +67,12 @@ public struct ABINameGenerator { // MARK: - Types +/// Context for bridge operations that determines which types are valid +public enum BridgeContext: Sendable { + case importTS + case protocolExport +} + public enum BridgeType: Codable, Equatable, Sendable { case int, float, double, string, bool, jsObject(String?), swiftHeapObject(String), void indirect case optional(BridgeType) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift index 54ca6abf7..901b64335 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift @@ -1,5 +1,17 @@ import JavaScriptKit +@JS class Helper { + @JS var value: Int + + @JS init(value: Int) { + self.value = value + } + + @JS func increment() { + value += 1 + } +} + @JS protocol MyViewControllerDelegate { var eventCount: Int { get set } var delegateName: String { get } @@ -8,6 +20,8 @@ import JavaScriptKit func onCountUpdated(count: Int) -> Bool func onLabelUpdated(_ prefix: String, _ suffix: String) func isCountEven() -> Bool + func onHelperUpdated(_ helper: Helper) + func createHelper() -> Helper } @JS class MyViewController { @@ -40,4 +54,8 @@ import JavaScriptKit @JS func checkEvenCount() -> Bool { return delegate.isCountEven() } + + @JS func sendHelper(_ helper: Helper) { + delegate.onHelperUpdated(helper) + } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts index a6d1125eb..6ff2f6f8f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts @@ -10,6 +10,8 @@ export interface MyViewControllerDelegate { onCountUpdated(count: number): boolean; onLabelUpdated(prefix: string, suffix: string): void; isCountEven(): boolean; + onHelperUpdated(helper: Helper): void; + createHelper(): Helper; eventCount: number; readonly delegateName: string; } @@ -21,16 +23,24 @@ export interface SwiftHeapObject { /// Note: Calling this method will release the heap object and it will no longer be accessible. release(): void; } +export interface Helper extends SwiftHeapObject { + increment(): void; + value: number; +} export interface MyViewController extends SwiftHeapObject { triggerEvent(): void; updateValue(value: string): void; updateCount(count: number): boolean; updateLabel(prefix: string, suffix: string): void; checkEvenCount(): boolean; + sendHelper(helper: Helper): void; delegate: MyViewControllerDelegate; secondDelegate: MyViewControllerDelegate | null; } export type Exports = { + Helper: { + new(value: number): Helper; + } MyViewController: { new(delegate: MyViewControllerDelegate): MyViewController; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index 847787d5c..d49b9b8f2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -142,6 +142,10 @@ export async function createInstantiator(options, swift) { if (!importObject["TestModule"]) { importObject["TestModule"] = {}; } + importObject["TestModule"]["bjs_Helper_wrap"] = function(pointer) { + const obj = Helper.__construct(pointer); + return swift.memory.retain(obj); + }; importObject["TestModule"]["bjs_MyViewController_wrap"] = function(pointer) { const obj = MyViewController.__construct(pointer); return swift.memory.retain(obj); @@ -156,7 +160,7 @@ export async function createInstantiator(options, swift) { return 0 } } - TestModule["bjs_MyViewControllerDelegate_eventCount_get"] = function bjs_MyViewControllerDelegate_eventCount_get(self, value) { + TestModule["bjs_MyViewControllerDelegate_eventCount_set"] = function bjs_MyViewControllerDelegate_eventCount_set(self, value) { try { swift.memory.getObject(self).eventCount = value; } catch (error) { @@ -217,6 +221,22 @@ export async function createInstantiator(options, swift) { return 0 } } + TestModule["bjs_MyViewControllerDelegate_onHelperUpdated"] = function bjs_MyViewControllerDelegate_onHelperUpdated(self, helper) { + try { + swift.memory.getObject(self).onHelperUpdated(Helper.__construct(helper)); + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_createHelper"] = function bjs_MyViewControllerDelegate_createHelper(self) { + try { + let ret = swift.memory.getObject(self).createHelper(); + return ret.pointer; + } catch (error) { + setException(error); + return 0 + } + } }, setInstance: (i) => { instance = i; @@ -248,6 +268,26 @@ export async function createInstantiator(options, swift) { this.deinit(this.pointer); } } + class Helper extends SwiftHeapObject { + 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); + } + increment() { + instance.exports.bjs_Helper_increment(this.pointer); + } + get value() { + const ret = instance.exports.bjs_Helper_value_get(this.pointer); + return ret; + } + set value(value) { + instance.exports.bjs_Helper_value_set(this.pointer, value); + } + } class MyViewController extends SwiftHeapObject { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MyViewController_deinit, MyViewController.prototype); @@ -283,6 +323,9 @@ export async function createInstantiator(options, swift) { const ret = instance.exports.bjs_MyViewController_checkEvenCount(this.pointer); return ret !== 0; } + sendHelper(helper) { + instance.exports.bjs_MyViewController_sendHelper(this.pointer, helper.pointer); + } get delegate() { const ret = instance.exports.bjs_MyViewController_delegate_get(this.pointer); const ret1 = swift.memory.getObject(ret); @@ -304,6 +347,7 @@ export async function createInstantiator(options, swift) { } } return { + Helper, MyViewController, }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json index 77327c454..6d8a2545a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json @@ -1,5 +1,59 @@ { "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Helper_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_Helper_increment", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "increment", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "Helper", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "Helper" + }, { "constructor" : { "abiName" : "bjs_MyViewController_init", @@ -136,6 +190,31 @@ "returnType" : { "bool" : { + } + } + }, + { + "abiName" : "bjs_MyViewController_sendHelper", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "sendHelper", + "parameters" : [ + { + "label" : "_", + "name" : "helper", + "type" : { + "swiftHeapObject" : { + "_0" : "Helper" + } + } + } + ], + "returnType" : { + "void" : { + } } } @@ -297,9 +376,71 @@ } } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_onHelperUpdated", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "onHelperUpdated", + "parameters" : [ + { + "label" : "_", + "name" : "helper", + "type" : { + "swiftHeapObject" : { + "_0" : "Helper" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_createHelper", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createHelper", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Helper" + } + } } ], - "name" : "MyViewControllerDelegate" + "name" : "MyViewControllerDelegate", + "properties" : [ + { + "isReadonly" : false, + "name" : "eventCount", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "name" : "delegateName", + "type" : { + "string" : { + + } + } + } + ] } ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index 0e5304673..dbb78e3f2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -41,6 +41,19 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto return Bool.bridgeJSLiftReturn(ret) } + func onHelperUpdated(_ helper: Helper) { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onHelperUpdated") + func _extern_onHelperUpdated(this: Int32, helper: UnsafeMutableRawPointer) + _extern_onHelperUpdated(this: Int32(bitPattern: jsObject.id), helper: helper.bridgeJSLowerParameter()) + } + + func createHelper() -> Helper { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createHelper") + func _extern_createHelper(this: Int32) -> UnsafeMutableRawPointer + let ret = _extern_createHelper(this: Int32(bitPattern: jsObject.id)) + return Helper.bridgeJSLiftReturn(ret) + } + var eventCount: Int { get { @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_get") @@ -69,6 +82,68 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto } } +@_expose(wasm, "bjs_Helper_init") +@_cdecl("bjs_Helper_init") +public func _bjs_Helper_init(value: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Helper(value: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Helper_increment") +@_cdecl("bjs_Helper_increment") +public func _bjs_Helper_increment(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Helper.bridgeJSLiftParameter(_self).increment() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Helper_value_get") +@_cdecl("bjs_Helper_value_get") +public func _bjs_Helper_value_get(_self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = Helper.bridgeJSLiftParameter(_self).value + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Helper_value_set") +@_cdecl("bjs_Helper_value_set") +public func _bjs_Helper_value_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { + #if arch(wasm32) + Helper.bridgeJSLiftParameter(_self).value = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Helper_deinit") +@_cdecl("bjs_Helper_deinit") +public func _bjs_Helper_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension Helper: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "TestModule", name: "bjs_Helper_wrap") + func _bjs_Helper_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_Helper_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_Helper_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + @_expose(wasm, "bjs_MyViewController_init") @_cdecl("bjs_MyViewController_init") public func _bjs_MyViewController_init(delegate: Int32) -> UnsafeMutableRawPointer { @@ -132,6 +207,16 @@ public func _bjs_MyViewController_checkEvenCount(_self: UnsafeMutableRawPointer) #endif } +@_expose(wasm, "bjs_MyViewController_sendHelper") +@_cdecl("bjs_MyViewController_sendHelper") +public func _bjs_MyViewController_sendHelper(_self: UnsafeMutableRawPointer, helper: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + MyViewController.bridgeJSLiftParameter(_self).sendHelper(_: Helper.bridgeJSLiftParameter(helper)) + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_MyViewController_delegate_get") @_cdecl("bjs_MyViewController_delegate_get") public func _bjs_MyViewController_delegate_get(_self: UnsafeMutableRawPointer) -> Int32 { diff --git a/Sources/JavaScriptKit/BridgeJSInstrincics.swift b/Sources/JavaScriptKit/BridgeJSInstrincics.swift index 4742aa629..b33257757 100644 --- a/Sources/JavaScriptKit/BridgeJSInstrincics.swift +++ b/Sources/JavaScriptKit/BridgeJSInstrincics.swift @@ -268,14 +268,14 @@ public protocol _BridgedSwiftHeapObject: AnyObject {} extension _BridgedSwiftHeapObject { // MARK: ImportTS - @available(*, unavailable, message: "Swift heap objects are not supported to be passed to imported JS functions") - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Void {} - @available( - *, - unavailable, - message: "Swift heap objects are not supported to be returned from imported JS functions" - ) - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ pointer: UnsafeMutableRawPointer) -> Void {} + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { + // For protocol parameters, we pass the unretained pointer since JS already has a reference + return Unmanaged.passUnretained(self).toOpaque() + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ pointer: UnsafeMutableRawPointer) -> Self { + // For protocol returns, take an unretained value since JS manages the lifetime + return Unmanaged.fromOpaque(pointer).takeUnretainedValue() + } // MARK: ExportSwift @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ pointer: UnsafeMutableRawPointer) -> Self { diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md index 8e1aa8a9a..b70b5c023 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md @@ -21,6 +21,8 @@ Mark a Swift protocol with `@JS` to expose it: import JavaScriptKit @JS protocol Counter { + var count: Int { get set } + var name: String { get } func increment(by amount: Int) func reset() func getValue() -> Int @@ -41,6 +43,14 @@ import JavaScriptKit @JS func getCurrentValue() -> Int { return delegate.getValue() } + + @JS func getCounterName() -> String { + return delegate.name + } + + @JS func setCountValue(_ value: Int) { + delegate.count = value + } } ``` @@ -53,6 +63,7 @@ const { exports } = await init({}); // Implement the Counter protocol const counterImpl = { count: 0, + name: "JSCounter", increment(amount) { this.count += amount; }, @@ -68,12 +79,17 @@ const counterImpl = { const manager = new exports.CounterManager(counterImpl); manager.incrementTwice(); console.log(manager.getCurrentValue()); // 2 +console.log(manager.getCounterName()); // "JSCounter" +manager.setCountValue(10); +console.log(counterImpl.count); // 10 ``` The generated TypeScript interface: ```typescript export interface Counter { + count: number; + readonly name: string; increment(amount: number): void; reset(): void; getValue(): number; @@ -94,6 +110,27 @@ BridgeJS generates a Swift wrapper struct for each `@JS` protocol. This wrapper struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { let jsObject: JSObject + var count: Int { + get { + @_extern(wasm, module: "TestModule", name: "bjs_Counter_count_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Int.bridgeJSLiftReturn(ret) + } + set { + @_extern(wasm, module: "TestModule", name: "bjs_Counter_count_set") + func _extern_set(this: Int32, value: Int32) + _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + } + } + + var name: String { + @_extern(wasm, module: "TestModule", name: "bjs_Counter_name_get") + func _extern_get(this: Int32) + _extern_get(this: Int32(bitPattern: jsObject.id)) + return String.bridgeJSLiftReturn() + } + func increment(by amount: Int) { @_extern(wasm, module: "TestModule", name: "bjs_Counter_increment") func _extern_increment(this: Int32, amount: Int32) @@ -128,13 +165,16 @@ You can also implement protocols in Swift and use them from JavaScript: ```swift @JS protocol Counter { + var count: Int { get set } + var name: String { get } func increment(by amount: Int) func reset() func getValue() -> Int } final class SwiftCounter: Counter { - private var count = 0 + var count = 0 + let name = "SwiftCounter" func increment(by amount: Int) { count += amount @@ -158,9 +198,13 @@ From JavaScript: ```javascript const counter = exports.createCounter(); +console.log(counter.name); // "SwiftCounter" counter.increment(5); counter.increment(3); console.log(counter.getValue()); // 8 +console.log(counter.count); // 8 +counter.count = 100; +console.log(counter.getValue()); // 100 counter.reset(); console.log(counter.getValue()); // 0 ``` @@ -183,10 +227,27 @@ When you pass a JavaScript object implementing a protocol to Swift: | Method requirements with return values | ✅ | | Throwing method requirements: `func method() throws(JSException)` | ✅ | | Async method requirements: `func method() async` | ✅ | +| Property requirements: `var property: Type { get }` | ✅ | +| Property requirements: `var property: Type { get set }` | ✅ | | Optional protocol methods | ❌ | -| Property requirements: `var property: Type { get }` | ❌ | -| Property requirements: `var property: Type { get set }` | ❌ | | Associated types | ❌ | | Protocol inheritance | ❌ | | Protocol composition: `Protocol1 & Protocol2` | ❌ | | Generics | ❌ | + +### Type Support for Protocol Properties and Method Parameters + +Protocol properties and method parameters have more limited type support compared to regular exported Swift functions and classes. This is because protocols bridge Swift implementations to JavaScript objects using the TypeScript import mechanism. + +**Supported Types:** +- Primitives: `Bool`, `Int`, `Float`, `Double` +- `String` +- `JSObject` + +**Not Supported:** +- `@JS class` types +- `@JS enum` types (case, raw value, or associated value) +- `@JS protocol` types +- Optional types: `Int?`, `String?`, etc. + +> Note: For regular `@JS func` and `@JS class` exports (not within protocols), all these types including optionals, enums, and classes are fully supported. See and for more information. diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index b49dca59d..1cdea545c 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -867,6 +867,8 @@ enum APIOptionalResult { func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) func getLabel() -> String func isEven() -> Bool + func processGreeter(_ greeter: Greeter) -> String + func createGreeter() -> Greeter } @JS class CounterManager { @@ -939,6 +941,14 @@ enum APIOptionalResult { @JS func isEven() -> Bool { return count % 2 == 0 } + + @JS func processGreeter(_ greeter: Greeter) -> String { + return "SwiftCounter processed: \(greeter.greet())" + } + + @JS func createGreeter() -> Greeter { + return Greeter(name: "CounterGreeter") + } } class ExportAPITests: XCTestCase { diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index 3ee75a189..026c1f322 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -50,6 +50,20 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { return Bool.bridgeJSLiftReturn(ret) } + func processGreeter(_ greeter: Greeter) -> String { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_processGreeter") + func _extern_processGreeter(this: Int32, greeter: UnsafeMutableRawPointer) -> Int32 + let ret = _extern_processGreeter(this: Int32(bitPattern: jsObject.id), greeter: greeter.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(ret) + } + + func createGreeter() -> Greeter { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_createGreeter") + func _extern_createGreeter(this: Int32) -> UnsafeMutableRawPointer + let ret = _extern_createGreeter(this: Int32(bitPattern: jsObject.id)) + return Greeter.bridgeJSLiftReturn(ret) + } + var count: Int { get { @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_count_get") @@ -58,7 +72,7 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { return Int.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_count_get") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_count_set") func _extern_set(this: Int32, value: Int32) _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) } @@ -3540,6 +3554,28 @@ public func _bjs_SwiftCounter_isEven(_self: UnsafeMutableRawPointer) -> Int32 { #endif } +@_expose(wasm, "bjs_SwiftCounter_processGreeter") +@_cdecl("bjs_SwiftCounter_processGreeter") +public func _bjs_SwiftCounter_processGreeter(_self: UnsafeMutableRawPointer, greeter: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftCounter.bridgeJSLiftParameter(_self).processGreeter(_: Greeter.bridgeJSLiftParameter(greeter)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftCounter_createGreeter") +@_cdecl("bjs_SwiftCounter_createGreeter") +public func _bjs_SwiftCounter_createGreeter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = SwiftCounter.bridgeJSLiftParameter(_self).createGreeter() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_SwiftCounter_count_get") @_cdecl("bjs_SwiftCounter_count_get") public func _bjs_SwiftCounter_count_get(_self: UnsafeMutableRawPointer) -> Int32 { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index 49afbd693..79b0884b9 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -1501,6 +1501,48 @@ } } + }, + { + "abiName" : "bjs_SwiftCounter_processGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_SwiftCounter_createGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createGreeter", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } } ], "name" : "SwiftCounter", @@ -5913,6 +5955,48 @@ } } + }, + { + "abiName" : "bjs_Counter_processGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_Counter_createGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createGreeter", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } } ], "name" : "Counter", diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index ab3f44770..f5bbc3556 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -818,7 +818,9 @@ function testProtocolSupport(exports) { getValue() { return counterValue; }, setLabelElements(labelPrefix, labelSuffix) { counterLabel = labelPrefix + labelSuffix; }, getLabel() { return counterLabel; }, - isEven() { return counterValue % 2 === 0; } + isEven() { return counterValue % 2 === 0; }, + processGreeter(greeter) { return `JSCounter processed: ${greeter.greet()}`; }, + createGreeter() { return new exports.Greeter("JSCounterGreeter"); } }; const manager = new exports.CounterManager(jsCounter); @@ -864,6 +866,26 @@ function testProtocolSupport(exports) { assert.equal(swiftCounter.count, 100); assert.equal(swiftCounter.getValue(), 100); + const testGreeter = new exports.Greeter("TestUser"); + const jsResult = jsCounter.processGreeter(testGreeter); + assert.equal(jsResult, "JSCounter processed: Hello, TestUser!"); + + const swiftResult = swiftCounter.processGreeter(testGreeter); + assert.equal(swiftResult, "SwiftCounter processed: Hello, TestUser!"); + + // Test swiftHeapObject return from protocol methods + const jsCreatedGreeter = jsCounter.createGreeter(); + assert.equal(jsCreatedGreeter.name, "JSCounterGreeter"); + assert.equal(jsCreatedGreeter.greet(), "Hello, JSCounterGreeter!"); + jsCreatedGreeter.release(); + + const swiftCreatedGreeter = swiftCounter.createGreeter(); + assert.equal(swiftCreatedGreeter.name, "CounterGreeter"); + assert.equal(swiftCreatedGreeter.greet(), "Hello, CounterGreeter!"); + swiftCreatedGreeter.release(); + + testGreeter.release(); + swiftManager.release(); swiftCounter.release(); @@ -876,7 +898,9 @@ function testProtocolSupport(exports) { getValue() { return optionalCounterValue; }, setLabelElements(labelPrefix, labelSuffix) { optionalCounterLabel = labelPrefix + labelSuffix; }, getLabel() { return optionalCounterLabel; }, - isEven() { return optionalCounterValue % 2 === 0; } + isEven() { return optionalCounterValue % 2 === 0; }, + processGreeter(greeter) { return `OptionalCounter processed: ${greeter.greet()}`; }, + createGreeter() { return new exports.Greeter("OptionalCounterGreeter"); } }; let mainCounterValue = 0; @@ -888,7 +912,9 @@ function testProtocolSupport(exports) { getValue() { return mainCounterValue; }, setLabelElements(labelPrefix, labelSuffix) { mainCounterLabel = labelPrefix + labelSuffix; }, getLabel() { return mainCounterLabel; }, - isEven() { return mainCounterValue % 2 === 0; } + isEven() { return mainCounterValue % 2 === 0; }, + processGreeter(greeter) { return `MainCounter processed: ${greeter.greet()}`; }, + createGreeter() { return new exports.Greeter("MainCounterGreeter"); } }; const managerWithOptional = new exports.CounterManager(mainCounter); From d59368a35382da9bb8f1a42a0ad0a1d5206e62f3 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 15 Oct 2025 12:42:58 +0200 Subject: [PATCH 015/252] BridgeJS: Support for Optional for properties / method parameters / method return types in protocol --- .../Sources/BridgeJSCore/ExportSwift.swift | 74 ++++--- .../Sources/BridgeJSCore/ImportTS.swift | 23 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 3 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 196 +++++++++++++++++- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 2 +- .../BridgeJSToolTests/Inputs/Protocol.swift | 9 +- .../BridgeJSLinkTests/Protocol.Export.d.ts | 3 + .../BridgeJSLinkTests/Protocol.Export.js | 44 ++++ .../ExportSwiftTests/Protocol.json | 63 ++++++ .../ExportSwiftTests/Protocol.swift | 27 +++ .../JavaScriptKit/BridgeJSInstrincics.swift | 49 +++-- .../Exporting-Swift-Protocols.md | 41 ++-- .../BridgeJSRuntimeTests/ExportAPITests.swift | 20 +- .../Generated/BridgeJS.ExportSwift.swift | 71 +++++++ .../JavaScript/BridgeJS.ExportSwift.json | 127 ++++++++++++ Tests/prelude.mjs | 44 +++- 16 files changed, 708 insertions(+), 88 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 2d5f2d412..526b25626 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -982,16 +982,16 @@ public class ExportSwift { ) let protocolUniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) - + exportedProtocolByName[protocolUniqueKey] = ExportedProtocol( name: name, methods: [], properties: [], namespace: namespaceResult.namespace ) - + stateStack.push(state: .protocolBody(name: name, key: protocolUniqueKey)) - + var methods: [ExportedFunction] = [] for member in node.memberBlock.members { if let funcDecl = member.decl.as(FunctionDeclSyntax.self) { @@ -1013,10 +1013,10 @@ public class ExportSwift { properties: exportedProtocolByName[protocolUniqueKey]?.properties ?? [], namespace: namespaceResult.namespace ) - + exportedProtocolByName[protocolUniqueKey] = exportedProtocol exportedProtocolNames.append(protocolUniqueKey) - + stateStack.pop() parent.exportedProtocolNameByKey[protocolUniqueKey] = name @@ -1097,14 +1097,6 @@ public class ExportSwift { continue } - if case .optional = propertyType { - diagnose( - node: typeAnnotation.type, - message: "Optional properties are not yet supported in protocols" - ) - continue - } - guard let accessorBlock = binding.accessorBlock else { diagnose( node: binding, @@ -1125,7 +1117,7 @@ public class ExportSwift { if var currentProtocol = exportedProtocolByName[protocolKey] { var properties = currentProtocol.properties properties.append(exportedProperty) - + currentProtocol = ExportedProtocol( name: currentProtocol.name, methods: currentProtocol.methods, @@ -2240,15 +2232,34 @@ public class ExportSwift { } else { returnTypeStr = " -> \(method.returnType.swiftType)" let liftingInfo = try method.returnType.liftingReturnInfo(context: .protocolExport) - if let abiType = liftingInfo.valueToLift { + + if case .optional = method.returnType { + if let abiType = liftingInfo.valueToLift { + externReturnType = " -> \(abiType.swiftType)" + callCode = """ + let ret = _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) + return \(raw: method.returnType.swiftType).bridgeJSLiftReturn(ret) + """ + } else { + externReturnType = "" + callCode = """ + _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) + return \(raw: method.returnType.swiftType).bridgeJSLiftReturn() + """ + } + } else if let abiType = liftingInfo.valueToLift { externReturnType = " -> \(abiType.swiftType)" + callCode = """ + let ret = _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) + return \(raw: method.returnType.swiftType).bridgeJSLiftReturn(ret) + """ } else { externReturnType = "" + callCode = """ + _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) + return \(raw: method.returnType.swiftType).bridgeJSLiftReturn() + """ } - callCode = """ - let ret = _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) - return \(raw: method.returnType.swiftType).bridgeJSLiftReturn(ret) - """ } let methodImplementation: DeclSyntax = """ func \(raw: method.name)(\(raw: swiftParams.joined(separator: ", ")))\(raw: returnTypeStr) { @@ -2286,7 +2297,7 @@ public class ExportSwift { } """ } - + private func renderProtocolProperty( property: ExportedProtocolProperty, protocolName: String, @@ -2306,27 +2317,27 @@ public class ExportSwift { operation: "set", className: protocolName ) - + // Generate getter let liftingInfo = try property.type.liftingReturnInfo(context: .protocolExport) let getterReturnType: String let getterCallCode: String - + if let abiType = liftingInfo.valueToLift { getterReturnType = " -> \(abiType.swiftType)" getterCallCode = """ - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) - return \(property.type.swiftType).bridgeJSLiftReturn(ret) - """ + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return \(property.type.swiftType).bridgeJSLiftReturn(ret) + """ } else { // For String and other types that use tmpRetString getterReturnType = "" getterCallCode = """ - _extern_get(this: Int32(bitPattern: jsObject.id)) - return \(property.type.swiftType).bridgeJSLiftReturn() - """ + _extern_get(this: Int32(bitPattern: jsObject.id)) + return \(property.type.swiftType).bridgeJSLiftReturn() + """ } - + if property.isReadonly { // Readonly property - only getter return """ @@ -2345,11 +2356,11 @@ public class ExportSwift { loweringInfo.loweredParameters.count == 1, "Protocol property setters must lower to a single WASM parameter" ) - + let (paramName, wasmType) = loweringInfo.loweredParameters[0] let setterParams = "this: Int32, \(paramName): \(wasmType.swiftType)" let setterCallArgs = "this: Int32(bitPattern: jsObject.id), \(paramName): newValue.bridgeJSLowerParameter()" - + return """ var \(raw: property.name): \(raw: property.type.swiftType) { get { @@ -2542,6 +2553,7 @@ extension BridgeType { throw BridgeJSCoreError("Namespace enums are not supported to pass as parameters") } } + } extension DeclModifierSyntax { diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index ac8ab03e2..52ff813aa 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -449,8 +449,13 @@ extension BridgeType { throw BridgeJSCoreError("swiftProtocol is not supported in imported signatures") case .caseEnum, .rawValueEnum, .associatedValueEnum, .namespaceEnum: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .optional: - throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") + case .optional(let wrappedType): + switch context { + case .importTS: + throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") + case .protocolExport: + return try wrappedType.loweringParameterInfo(context: context) + } } } @@ -492,7 +497,19 @@ extension BridgeType { case .caseEnum, .rawValueEnum, .associatedValueEnum, .namespaceEnum: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") case .optional: - throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") + switch context { + case .importTS: + throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") + case .protocolExport: + // For Optional, return the length (or -1 for null) + if case .optional(.string) = self { + return .string + } + if case .optional(.swiftHeapObject) = self { + return LiftingReturnInfo(valueToLift: .pointer) + } + return LiftingReturnInfo(valueToLift: nil) + } } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 9f85dbcf1..4445ddeb6 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -1883,6 +1883,7 @@ extension BridgeJSLink { valuesToLift = [scope.variable(param.name)] } else { valuesToLift = liftingFragment.parameters.map { scope.variable(param.name + $0.capitalizedFirstLetter) } + parameterNames.append(contentsOf: valuesToLift) } let liftedValues = liftingFragment.printCode(valuesToLift, scope, body, cleanupCode) assert(liftedValues.count == 1, "Lifting fragment should produce exactly one value") @@ -2455,7 +2456,7 @@ extension BridgeJSLink { returnType: property.type ) importObjectBuilder.assignToImportObject(name: getterAbiName, function: getterLines) - + if !property.isReadonly { let setterAbiName = ABINameGenerator.generateABIName( baseName: property.name, diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index b7adcb670..1e92b09a4 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -263,6 +263,70 @@ struct IntrinsicJSFragment: Sendable { ) } + static func optionalLiftParameter(wrappedType: BridgeType, context: BridgeContext) throws -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: ["isSome", "wrappedValue"], + printCode: { arguments, scope, printer, cleanupCode in + let isSome = arguments[0] + let wrappedValue = arguments[1] + + let resultExpr: String + switch wrappedType { + case .int, .float, .double, .caseEnum: + resultExpr = "\(isSome) ? \(wrappedValue) : null" + + case .bool: + resultExpr = "\(isSome) ? \(wrappedValue) !== 0 : null" + + case .string: + let objectLabel = scope.variable("obj") + printer.write("let \(objectLabel);") + printer.write("if (\(isSome)) {") + printer.indent { + printer.write( + "\(objectLabel) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(wrappedValue));" + ) + printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(wrappedValue));") + } + printer.write("}") + resultExpr = "\(isSome) ? \(objectLabel) : null" + + case .swiftHeapObject(let name): + resultExpr = "\(isSome) ? \(name).__construct(\(wrappedValue)) : null" + + case .jsObject: + resultExpr = + "\(isSome) ? \(JSGlueVariableScope.reservedSwift).memory.getObject(\(wrappedValue)) : null" + + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + let objectLabel = scope.variable("obj") + printer.write("let \(objectLabel);") + printer.write("if (\(isSome)) {") + printer.indent { + printer.write( + "\(objectLabel) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(wrappedValue));" + ) + printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(wrappedValue));") + } + printer.write("}") + resultExpr = "\(isSome) ? \(objectLabel) : null" + case .bool: + resultExpr = "\(isSome) ? \(wrappedValue) !== 0 : null" + default: + resultExpr = "\(isSome) ? \(wrappedValue) : null" + } + + default: + resultExpr = "\(isSome) ? \(wrappedValue) : null" + } + + return [resultExpr] + } + ) + } + static func optionalLowerParameter(wrappedType: BridgeType) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["value"], @@ -423,6 +487,114 @@ struct IntrinsicJSFragment: Sendable { ) } + static func optionalLowerReturn(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + switch wrappedType { + case .bool, .int, .float, .double, .string, .swiftHeapObject, .jsObject, .swiftProtocol, .caseEnum, + .rawValueEnum: + break + case .void, .optional, .associatedValueEnum, .namespaceEnum: + throw BridgeJSLinkError(message: "Unsupported optional wrapped type for protocol export: \(wrappedType)") + } + + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanupCode in + let value = arguments[0] + let isSomeVar = scope.variable("isSome") + + printer.write("const \(isSomeVar) = \(value) != null;") + + switch wrappedType { + case .bool: + printer.write( + "bjs[\"swift_js_return_optional_bool\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) ? 1 : 0) : 0);" + ) + case .int, .caseEnum: + printer.write( + "bjs[\"swift_js_return_optional_int\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) | 0) : 0);" + ) + case .float: + printer.write( + "bjs[\"swift_js_return_optional_float\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? Math.fround(\(value)) : 0.0);" + ) + case .double: + printer.write( + "bjs[\"swift_js_return_optional_double\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? \(value) : 0.0);" + ) + case .string: + let bytesVar = scope.variable("bytes") + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write( + "const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" + ) + printer.write("bjs[\"swift_js_return_optional_string\"](1, \(bytesVar), \(bytesVar).length);") + printer.write("return \(bytesVar).length;") + } + printer.write("} else {") + printer.indent { + printer.write("bjs[\"swift_js_return_optional_string\"](0, 0, 0);") + printer.write("return -1;") + } + printer.write("}") + + case .swiftHeapObject: + printer.write("return \(isSomeVar) ? \(value).pointer : 0;") + case .jsObject, .swiftProtocol: + let idVar = scope.variable("id") + printer.write("let \(idVar) = 0;") + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + } + printer.write("}") + printer.write("bjs[\"swift_js_return_optional_object\"](\(isSomeVar) ? 1 : 0, \(idVar));") + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + let bytesVar = scope.variable("bytes") + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write( + "const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" + ) + printer.write( + "bjs[\"swift_js_return_optional_string\"](1, \(bytesVar), \(bytesVar).length);" + ) + printer.write("return \(bytesVar).length;") + } + printer.write("} else {") + printer.indent { + printer.write("bjs[\"swift_js_return_optional_string\"](0, 0, 0);") + printer.write("return -1;") + } + printer.write("}") + case .bool: + printer.write( + "bjs[\"swift_js_return_optional_bool\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) ? 1 : 0) : 0);" + ) + case .float: + printer.write( + "bjs[\"swift_js_return_optional_float\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? Math.fround(\(value)) : 0.0);" + ) + case .double: + printer.write( + "bjs[\"swift_js_return_optional_double\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? \(value) : 0.0);" + ) + default: + printer.write( + "bjs[\"swift_js_return_optional_int\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) | 0) : 0);" + ) + } + default: + () + } + + return [] + } + ) + } + // MARK: - ExportSwift /// Returns a fragment that lowers a JS value to Wasm core values for parameters @@ -505,9 +677,15 @@ struct IntrinsicJSFragment: Sendable { message: "Void can't appear in parameters of imported JS functions" ) case .optional(let wrappedType): - throw BridgeJSLinkError( - message: "Optional types are not supported for imported JS functions: \(wrappedType)" - ) + switch context { + case .importTS: + throw BridgeJSLinkError( + message: "Optional types are not supported for imported JS functions: \(wrappedType)" + ) + case .protocolExport: + // Protocol exports support Optional - use existing optionalLiftParameter fragment + return try .optionalLiftParameter(wrappedType: wrappedType, context: context) + } case .caseEnum: return .identity case .rawValueEnum(_, let rawType): switch rawType { @@ -549,9 +727,15 @@ struct IntrinsicJSFragment: Sendable { case .swiftProtocol: return .jsObjectLowerReturn case .void: return .void case .optional(let wrappedType): - throw BridgeJSLinkError( - message: "Optional types are not supported for imported JS functions: \(wrappedType)" - ) + switch context { + case .importTS: + throw BridgeJSLinkError( + message: "Optional types are not supported for imported JS functions: \(wrappedType)" + ) + case .protocolExport: + // Protocol exports support Optional - use side channel approach for return values + return try .optionalLowerReturn(wrappedType: wrappedType) + } case .caseEnum: return .identity case .rawValueEnum(_, let rawType): switch rawType { diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 504cd68a2..233e79038 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -280,7 +280,7 @@ public struct ExportedProtocolProperty: Codable, Equatable, Sendable { public let name: String public let type: BridgeType public let isReadonly: Bool - + public init( name: String, type: BridgeType, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift index 901b64335..63a6d9acb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift @@ -2,11 +2,11 @@ import JavaScriptKit @JS class Helper { @JS var value: Int - + @JS init(value: Int) { self.value = value } - + @JS func increment() { value += 1 } @@ -15,6 +15,7 @@ import JavaScriptKit @JS protocol MyViewControllerDelegate { var eventCount: Int { get set } var delegateName: String { get } + var optionalName: String? { get set } func onSomethingHappened() func onValueChanged(_ value: String) func onCountUpdated(count: Int) -> Bool @@ -22,6 +23,8 @@ import JavaScriptKit func isCountEven() -> Bool func onHelperUpdated(_ helper: Helper) func createHelper() -> Helper + func onOptionalHelperUpdated(_ helper: Helper?) + func createOptionalHelper() -> Helper? } @JS class MyViewController { @@ -54,7 +57,7 @@ import JavaScriptKit @JS func checkEvenCount() -> Bool { return delegate.isCountEven() } - + @JS func sendHelper(_ helper: Helper) { delegate.onHelperUpdated(helper) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts index 6ff2f6f8f..2d4899793 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts @@ -12,8 +12,11 @@ export interface MyViewControllerDelegate { isCountEven(): boolean; onHelperUpdated(helper: Helper): void; createHelper(): Helper; + onOptionalHelperUpdated(helper: Helper | null): void; + createOptionalHelper(): Helper | null; eventCount: number; readonly delegateName: string; + optionalName: string | null; } /// Represents a Swift heap object like a class instance or an actor instance. diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index d49b9b8f2..1d9329c3e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -176,6 +176,34 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_MyViewControllerDelegate_optionalName_get"] = function bjs_MyViewControllerDelegate_optionalName_get(self) { + try { + let ret = swift.memory.getObject(self).optionalName; + const isSome = ret != null; + if (isSome) { + const bytes = textEncoder.encode(ret); + bjs["swift_js_return_optional_string"](1, bytes, bytes.length); + return bytes.length; + } else { + bjs["swift_js_return_optional_string"](0, 0, 0); + return -1; + } + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_optionalName_set"] = function bjs_MyViewControllerDelegate_optionalName_set(self, valueIsSome, valueWrappedValue) { + try { + let obj; + if (valueIsSome) { + obj = swift.memory.getObject(valueWrappedValue); + swift.memory.release(valueWrappedValue); + } + swift.memory.getObject(self).optionalName = valueIsSome ? obj : null; + } catch (error) { + setException(error); + } + } TestModule["bjs_MyViewControllerDelegate_onSomethingHappened"] = function bjs_MyViewControllerDelegate_onSomethingHappened(self) { try { swift.memory.getObject(self).onSomethingHappened(); @@ -237,6 +265,22 @@ export async function createInstantiator(options, swift) { return 0 } } + TestModule["bjs_MyViewControllerDelegate_onOptionalHelperUpdated"] = function bjs_MyViewControllerDelegate_onOptionalHelperUpdated(self, helperIsSome, helperWrappedValue) { + try { + swift.memory.getObject(self).onOptionalHelperUpdated(helperIsSome ? Helper.__construct(helperWrappedValue) : null); + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_createOptionalHelper"] = function bjs_MyViewControllerDelegate_createOptionalHelper(self) { + try { + let ret = swift.memory.getObject(self).createOptionalHelper(); + const isSome = ret != null; + return isSome ? ret.pointer : 0; + } catch (error) { + setException(error); + } + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json index 6d8a2545a..30abfc91c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json @@ -418,6 +418,56 @@ "_0" : "Helper" } } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_onOptionalHelperUpdated", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "onOptionalHelperUpdated", + "parameters" : [ + { + "label" : "_", + "name" : "helper", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Helper" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_createOptionalHelper", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createOptionalHelper", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Helper" + } + } + } + } } ], "name" : "MyViewControllerDelegate", @@ -439,6 +489,19 @@ } } + }, + { + "isReadonly" : false, + "name" : "optionalName", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } } ] } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index dbb78e3f2..ea1d71eab 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -54,6 +54,19 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto return Helper.bridgeJSLiftReturn(ret) } + func onOptionalHelperUpdated(_ helper: Optional) { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onOptionalHelperUpdated") + func _extern_onOptionalHelperUpdated(this: Int32, helper: UnsafeMutableRawPointer) + _extern_onOptionalHelperUpdated(this: Int32(bitPattern: jsObject.id), helper: helper.bridgeJSLowerParameter()) + } + + func createOptionalHelper() -> Optional { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createOptionalHelper") + func _extern_createOptionalHelper(this: Int32) -> UnsafeMutableRawPointer + let ret = _extern_createOptionalHelper(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturn(ret) + } + var eventCount: Int { get { @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_get") @@ -77,6 +90,20 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto } } + var optionalName: Optional { + get { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturn(ret) + } + set { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_set") + func _extern_set(this: Int32, value: Int32) + _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + } + } + static func bridgeJSLiftParameter(_ value: Int32) -> Self { return AnyMyViewControllerDelegate(jsObject: JSObject(id: UInt32(bitPattern: value))) } diff --git a/Sources/JavaScriptKit/BridgeJSInstrincics.swift b/Sources/JavaScriptKit/BridgeJSInstrincics.swift index b33257757..5a8f7f014 100644 --- a/Sources/JavaScriptKit/BridgeJSInstrincics.swift +++ b/Sources/JavaScriptKit/BridgeJSInstrincics.swift @@ -538,11 +538,23 @@ extension Optional where Wrapped == Int { extension Optional where Wrapped == String { // MARK: ImportTS - @available(*, unavailable, message: "Optional String type is not supported to be passed to imported JS functions") - @_spi(BridgeJS) public func bridgeJSLowerParameter() -> Void {} + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + switch consume self { + case .none: + return 0 + case .some(let value): + return value.bridgeJSLowerParameter() + } + } - @available(*, unavailable, message: "Optional String type is not supported to be passed to imported JS functions") - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32) -> String? { return nil } + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ length: Int32) -> String? { + // JavaScript returns -1 for null, or the byte length if present + // The actual string is already in tmpRetString side channel + if length < 0 { + return nil + } + return String.bridgeJSLiftReturn(length) + } // MARK: ExportSwift @@ -671,19 +683,24 @@ extension Optional where Wrapped: _BridgedSwiftProtocolWrapper { /// Optional support for Swift heap objects extension Optional where Wrapped: _BridgedSwiftHeapObject { // MARK: ImportTS - @available( - *, - unavailable, - message: "Optional Swift heap objects are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Void {} + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { + switch consume self { + case .none: + // Return null pointer for nil + return UnsafeMutableRawPointer(bitPattern: 0).unsafelyUnwrapped + case .some(let value): + // Pass unretained pointer since JS will manage the lifetime + return Unmanaged.passUnretained(value).toOpaque() + } + } - @available( - *, - unavailable, - message: "Optional Swift heap objects are not supported to be returned from imported JS functions" - ) - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ pointer: UnsafeMutableRawPointer) -> Void { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ pointer: UnsafeMutableRawPointer) -> Wrapped? + { + if pointer == UnsafeMutableRawPointer(bitPattern: 0) { + return nil + } else { + return Wrapped.bridgeJSLiftReturn(pointer) + } } // MARK: ExportSwift diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md index b70b5c023..b6672a0aa 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md @@ -23,6 +23,7 @@ import JavaScriptKit @JS protocol Counter { var count: Int { get set } var name: String { get } + var label: String? { get set } func increment(by amount: Int) func reset() func getValue() -> Int @@ -51,6 +52,10 @@ import JavaScriptKit @JS func setCountValue(_ value: Int) { delegate.count = value } + + @JS func updateLabel(_ newLabel: String?) { + delegate.label = newLabel + } } ``` @@ -64,6 +69,7 @@ const { exports } = await init({}); const counterImpl = { count: 0, name: "JSCounter", + label: "Default Label", increment(amount) { this.count += amount; }, @@ -82,6 +88,11 @@ console.log(manager.getCurrentValue()); // 2 console.log(manager.getCounterName()); // "JSCounter" manager.setCountValue(10); console.log(counterImpl.count); // 10 + +manager.updateLabel("Custom Label"); +console.log(counterImpl.label); // "Custom Label" +manager.updateLabel(null); +console.log(counterImpl.label); // null ``` The generated TypeScript interface: @@ -90,6 +101,7 @@ The generated TypeScript interface: export interface Counter { count: number; readonly name: string; + label: string | null; increment(amount: number): void; reset(): void; getValue(): number; @@ -222,32 +234,17 @@ When you pass a JavaScript object implementing a protocol to Swift: | Swift Feature | Status | |:--------------|:-------| -| Method requirements: `func method()` | ✅ | -| Method requirements with parameters | ✅ | -| Method requirements with return values | ✅ | -| Throwing method requirements: `func method() throws(JSException)` | ✅ | -| Async method requirements: `func method() async` | ✅ | -| Property requirements: `var property: Type { get }` | ✅ | -| Property requirements: `var property: Type { get set }` | ✅ | +| Method requirements: `func foo(_ param: String?) -> FooClass?` | ✅ | +| Property requirements: `var property: Type { get }` / `var property: Type { get set }` | ✅ | +| Optional parameters / return values in methods | ✅ | +| Optional properties | ✅ | | Optional protocol methods | ❌ | | Associated types | ❌ | | Protocol inheritance | ❌ | | Protocol composition: `Protocol1 & Protocol2` | ❌ | | Generics | ❌ | -### Type Support for Protocol Properties and Method Parameters - -Protocol properties and method parameters have more limited type support compared to regular exported Swift functions and classes. This is because protocols bridge Swift implementations to JavaScript objects using the TypeScript import mechanism. - -**Supported Types:** -- Primitives: `Bool`, `Int`, `Float`, `Double` -- `String` -- `JSObject` - -**Not Supported:** -- `@JS class` types -- `@JS enum` types (case, raw value, or associated value) -- `@JS protocol` types -- Optional types: `Int?`, `String?`, etc. +**Type Limitations:** +- `@JS enum` types are not supported in protocol signatures (use raw values or separate parameters instead) -> Note: For regular `@JS func` and `@JS class` exports (not within protocols), all these types including optionals, enums, and classes are fully supported. See and for more information. +> Note: Protocol type support matches that of regular `@JS func` and `@JS class` exports. See and for more information. diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 1cdea545c..019565515 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -862,6 +862,7 @@ enum APIOptionalResult { @JS protocol Counter { var count: Int { get set } var name: String { get } + var optionalTag: String? { get set } func increment(by amount: Int) func getValue() -> Int func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) @@ -869,6 +870,8 @@ enum APIOptionalResult { func isEven() -> Bool func processGreeter(_ greeter: Greeter) -> String func createGreeter() -> Greeter + func processOptionalGreeter(_ greeter: Greeter?) -> String + func createOptionalGreeter() -> Greeter? } @JS class CounterManager { @@ -918,6 +921,7 @@ enum APIOptionalResult { @JS class SwiftCounter: Counter { @JS var count: Int = 0 @JS let name: String = "SwiftCounter" + @JS var optionalTag: String? = nil private var label: String = "" @JS init() {} @@ -941,14 +945,26 @@ enum APIOptionalResult { @JS func isEven() -> Bool { return count % 2 == 0 } - + @JS func processGreeter(_ greeter: Greeter) -> String { return "SwiftCounter processed: \(greeter.greet())" } - + @JS func createGreeter() -> Greeter { return Greeter(name: "CounterGreeter") } + + @JS func processOptionalGreeter(_ greeter: Greeter?) -> String { + if let greeter = greeter { + return "SwiftCounter processed optional: \(greeter.greet())" + } else { + return "SwiftCounter received nil" + } + } + + @JS func createOptionalGreeter() -> Greeter? { + return Greeter(name: "OptionalCounterGreeter") + } } class ExportAPITests: XCTestCase { diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index 026c1f322..55cde9577 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -64,6 +64,20 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { return Greeter.bridgeJSLiftReturn(ret) } + func processOptionalGreeter(_ greeter: Optional) -> String { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_processOptionalGreeter") + func _extern_processOptionalGreeter(this: Int32, greeter: UnsafeMutableRawPointer) -> Int32 + let ret = _extern_processOptionalGreeter(this: Int32(bitPattern: jsObject.id), greeter: greeter.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(ret) + } + + func createOptionalGreeter() -> Optional { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_createOptionalGreeter") + func _extern_createOptionalGreeter(this: Int32) -> UnsafeMutableRawPointer + let ret = _extern_createOptionalGreeter(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturn(ret) + } + var count: Int { get { @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_count_get") @@ -87,6 +101,20 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { } } + var optionalTag: Optional { + get { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_optionalTag_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturn(ret) + } + set { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_optionalTag_set") + func _extern_set(this: Int32, value: Int32) + _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + } + } + static func bridgeJSLiftParameter(_ value: Int32) -> Self { return AnyCounter(jsObject: JSObject(id: UInt32(bitPattern: value))) } @@ -3576,6 +3604,28 @@ public func _bjs_SwiftCounter_createGreeter(_self: UnsafeMutableRawPointer) -> U #endif } +@_expose(wasm, "bjs_SwiftCounter_processOptionalGreeter") +@_cdecl("bjs_SwiftCounter_processOptionalGreeter") +public func _bjs_SwiftCounter_processOptionalGreeter(_self: UnsafeMutableRawPointer, greeterIsSome: Int32, greeterValue: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftCounter.bridgeJSLiftParameter(_self).processOptionalGreeter(_: Optional.bridgeJSLiftParameter(greeterIsSome, greeterValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftCounter_createOptionalGreeter") +@_cdecl("bjs_SwiftCounter_createOptionalGreeter") +public func _bjs_SwiftCounter_createOptionalGreeter(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftCounter.bridgeJSLiftParameter(_self).createOptionalGreeter() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_SwiftCounter_count_get") @_cdecl("bjs_SwiftCounter_count_get") public func _bjs_SwiftCounter_count_get(_self: UnsafeMutableRawPointer) -> Int32 { @@ -3608,6 +3658,27 @@ public func _bjs_SwiftCounter_name_get(_self: UnsafeMutableRawPointer) -> Void { #endif } +@_expose(wasm, "bjs_SwiftCounter_optionalTag_get") +@_cdecl("bjs_SwiftCounter_optionalTag_get") +public func _bjs_SwiftCounter_optionalTag_get(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftCounter.bridgeJSLiftParameter(_self).optionalTag + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftCounter_optionalTag_set") +@_cdecl("bjs_SwiftCounter_optionalTag_set") +public func _bjs_SwiftCounter_optionalTag_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + SwiftCounter.bridgeJSLiftParameter(_self).optionalTag = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_SwiftCounter_deinit") @_cdecl("bjs_SwiftCounter_deinit") public func _bjs_SwiftCounter_deinit(pointer: UnsafeMutableRawPointer) { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index 79b0884b9..f97beee6b 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -1543,6 +1543,56 @@ "_0" : "Greeter" } } + }, + { + "abiName" : "bjs_SwiftCounter_processOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "greeter", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_SwiftCounter_createOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createOptionalGreeter", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } } ], "name" : "SwiftCounter", @@ -1566,6 +1616,20 @@ } } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalTag", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } } ], "swiftCallName" : "SwiftCounter" @@ -5997,6 +6061,56 @@ "_0" : "Greeter" } } + }, + { + "abiName" : "bjs_Counter_processOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "greeter", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_Counter_createOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createOptionalGreeter", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } } ], "name" : "Counter", @@ -6018,6 +6132,19 @@ } } + }, + { + "isReadonly" : false, + "name" : "optionalTag", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } } ] } diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index f5bbc3556..73bc7279f 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -814,13 +814,18 @@ function testProtocolSupport(exports) { const jsCounter = { count: 0, name: "JSCounter", + optionalTag: null, increment(amount) { counterValue += amount; this.count += amount; }, getValue() { return counterValue; }, setLabelElements(labelPrefix, labelSuffix) { counterLabel = labelPrefix + labelSuffix; }, getLabel() { return counterLabel; }, isEven() { return counterValue % 2 === 0; }, processGreeter(greeter) { return `JSCounter processed: ${greeter.greet()}`; }, - createGreeter() { return new exports.Greeter("JSCounterGreeter"); } + createGreeter() { return new exports.Greeter("JSCounterGreeter"); }, + processOptionalGreeter(greeter) { + return greeter ? `JSCounter processed optional: ${greeter.greet()}` : "JSCounter received null"; + }, + createOptionalGreeter() { return new exports.Greeter("JSOptionalGreeter"); } }; const manager = new exports.CounterManager(jsCounter); @@ -884,6 +889,29 @@ function testProtocolSupport(exports) { assert.equal(swiftCreatedGreeter.greet(), "Hello, CounterGreeter!"); swiftCreatedGreeter.release(); + const optGreeterTest = new exports.Greeter("OptionalTest"); + assert.equal(jsCounter.processOptionalGreeter(optGreeterTest), "JSCounter processed optional: Hello, OptionalTest!"); + assert.equal(jsCounter.processOptionalGreeter(null), "JSCounter received null"); + assert.equal(swiftCounter.processOptionalGreeter(optGreeterTest), "SwiftCounter processed optional: Hello, OptionalTest!"); + assert.equal(swiftCounter.processOptionalGreeter(null), "SwiftCounter received nil"); + optGreeterTest.release(); + + const jsOptGreeter = jsCounter.createOptionalGreeter(); + assert.notEqual(jsOptGreeter, null); + assert.equal(jsOptGreeter.name, "JSOptionalGreeter"); + jsOptGreeter.release(); + + const swiftOptGreeter = swiftCounter.createOptionalGreeter(); + assert.notEqual(swiftOptGreeter, null); + assert.equal(swiftOptGreeter.name, "OptionalCounterGreeter"); + swiftOptGreeter.release(); + + assert.equal(jsCounter.optionalTag, null); + jsCounter.optionalTag = "test-tag"; + assert.equal(jsCounter.optionalTag, "test-tag"); + jsCounter.optionalTag = null; + assert.equal(jsCounter.optionalTag, null); + testGreeter.release(); swiftManager.release(); @@ -894,13 +922,18 @@ function testProtocolSupport(exports) { const optionalCounter = { count: 100, name: "OptionalCounter", + optionalTag: "optional-tag", increment(amount) { optionalCounterValue += amount; this.count += amount; }, getValue() { return optionalCounterValue; }, setLabelElements(labelPrefix, labelSuffix) { optionalCounterLabel = labelPrefix + labelSuffix; }, getLabel() { return optionalCounterLabel; }, isEven() { return optionalCounterValue % 2 === 0; }, processGreeter(greeter) { return `OptionalCounter processed: ${greeter.greet()}`; }, - createGreeter() { return new exports.Greeter("OptionalCounterGreeter"); } + createGreeter() { return new exports.Greeter("OptionalCounterGreeter"); }, + processOptionalGreeter(greeter) { + return greeter ? `OptionalCounter processed optional: ${greeter.greet()}` : "OptionalCounter received null"; + }, + createOptionalGreeter() { return null; } }; let mainCounterValue = 0; @@ -908,13 +941,18 @@ function testProtocolSupport(exports) { const mainCounter = { count: 0, name: "MainCounter", + optionalTag: null, increment(amount) { mainCounterValue += amount; this.count += amount; }, getValue() { return mainCounterValue; }, setLabelElements(labelPrefix, labelSuffix) { mainCounterLabel = labelPrefix + labelSuffix; }, getLabel() { return mainCounterLabel; }, isEven() { return mainCounterValue % 2 === 0; }, processGreeter(greeter) { return `MainCounter processed: ${greeter.greet()}`; }, - createGreeter() { return new exports.Greeter("MainCounterGreeter"); } + createGreeter() { return new exports.Greeter("MainCounterGreeter"); }, + processOptionalGreeter(greeter) { + return greeter ? `MainCounter processed optional: ${greeter.greet()}` : "MainCounter received null"; + }, + createOptionalGreeter() { return new exports.Greeter("MainOptionalGreeter"); } }; const managerWithOptional = new exports.CounterManager(mainCounter); From 128f696dc6e275d76c20afcd55dd8a790c54d458 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 15 Oct 2025 15:54:07 +0200 Subject: [PATCH 016/252] BridgeJS: Protocol support for enum values (all types + optionals) BridgeJS: Final refinings to enum support and revisiting tests --- .../Sources/BridgeJSCore/ExportSwift.swift | 153 +++-- .../Sources/BridgeJSCore/ImportTS.swift | 71 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 75 +- .../BridgeJSToolTests/Inputs/Protocol.swift | 15 + .../BridgeJSLinkTests/Protocol.Export.d.ts | 27 + .../BridgeJSLinkTests/Protocol.Export.js | 122 ++++ .../EnumAssociatedValue.swift | 254 ++++++- .../ExportSwiftTests/Protocol.json | 147 ++++ .../ExportSwiftTests/Protocol.swift | 107 +++ .../ExportSwiftTests/StaticFunctions.swift | 31 +- .../JavaScriptKit/BridgeJSInstrincics.swift | 212 +++--- .../BridgeJSRuntimeTests/ExportAPITests.swift | 64 +- .../Generated/BridgeJS.ExportSwift.swift | 643 +++++++++++++----- .../JavaScript/BridgeJS.ExportSwift.json | 197 ++++-- Tests/prelude.mjs | 223 +++--- 15 files changed, 1830 insertions(+), 511 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 526b25626..7aa4503fa 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1751,13 +1751,13 @@ public class ExportSwift { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> \(raw: typeName) { - return \(raw: typeName)(bridgeJSRawValue: value)! + return bridgeJSLiftParameter(value) } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> \(raw: typeName) { return \(raw: typeName)(bridgeJSRawValue: value)! } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { @@ -1774,13 +1774,32 @@ public class ExportSwift { func renderAssociatedValueEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { let typeName = enumDef.swiftCallName return """ - extension \(raw: typeName): _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> \(raw: typeName) { + extension \(raw: typeName): _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> \(raw: typeName) { switch caseId { \(raw: generateStackLiftSwitchCases(enumDef: enumDef).joined(separator: "\n")) default: fatalError("Unknown \(raw: typeName) case ID: \\(caseId)") } } + + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + \(raw: generateLowerParameterSwitchCases(enumDef: enumDef).joined(separator: "\n")) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> \(raw: typeName) { + let caseId = _swift_js_pop_param_int32() + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> \(raw: typeName) { + return _bridgeJSLiftFromCaseId(caseId) + } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { @@ -1849,6 +1868,80 @@ public class ExportSwift { return cases } + /// Generates code to push associated value payloads to side channels + /// This helper is reused by both lowerParameter and lowerReturn to avoid duplication + private func generatePayloadPushingCode( + associatedValues: [AssociatedValue] + ) -> [String] { + var bodyLines: [String] = [] + for (index, associatedValue) in associatedValues.enumerated() { + let paramName = associatedValue.label ?? "param\(index)" + switch associatedValue.type { + case .string: + bodyLines.append("var __bjs_\(paramName) = \(paramName)") + bodyLines.append("__bjs_\(paramName).withUTF8 { ptr in") + bodyLines.append("_swift_js_push_string(ptr.baseAddress, Int32(ptr.count))") + bodyLines.append("}") + case .int: + bodyLines.append("_swift_js_push_int(Int32(\(paramName)))") + case .bool: + bodyLines.append("_swift_js_push_int(\(paramName) ? 1 : 0)") + case .float: + bodyLines.append("_swift_js_push_f32(\(paramName))") + case .double: + bodyLines.append("_swift_js_push_f64(\(paramName))") + case .optional(let wrappedType): + bodyLines.append("let __bjs_isSome_\(paramName) = \(paramName) != nil") + bodyLines.append("if let __bjs_unwrapped_\(paramName) = \(paramName) {") + switch wrappedType { + case .string: + bodyLines.append("var __bjs_str_\(paramName) = __bjs_unwrapped_\(paramName)") + bodyLines.append("__bjs_str_\(paramName).withUTF8 { ptr in") + bodyLines.append("_swift_js_push_string(ptr.baseAddress, Int32(ptr.count))") + bodyLines.append("}") + case .int: + bodyLines.append("_swift_js_push_int(Int32(__bjs_unwrapped_\(paramName)))") + case .bool: + bodyLines.append("_swift_js_push_int(__bjs_unwrapped_\(paramName) ? 1 : 0)") + case .float: + bodyLines.append("_swift_js_push_f32(__bjs_unwrapped_\(paramName))") + case .double: + bodyLines.append("_swift_js_push_f64(__bjs_unwrapped_\(paramName))") + default: + bodyLines.append( + "preconditionFailure(\"BridgeJS: unsupported optional wrapped type in generated code\")" + ) + } + bodyLines.append("}") + bodyLines.append("_swift_js_push_int(__bjs_isSome_\(paramName) ? 1 : 0)") + default: + bodyLines.append( + "preconditionFailure(\"BridgeJS: unsupported associated value type in generated code\")" + ) + } + } + return bodyLines + } + + private func generateLowerParameterSwitchCases(enumDef: ExportedEnum) -> [String] { + var cases: [String] = [] + for (caseIndex, enumCase) in enumDef.cases.enumerated() { + if enumCase.associatedValues.isEmpty { + cases.append("case .\(enumCase.name):") + cases.append("return Int32(\(caseIndex))") + } else { + let payloadCode = generatePayloadPushingCode(associatedValues: enumCase.associatedValues) + let pattern = enumCase.associatedValues.enumerated() + .map { index, associatedValue in "let \(associatedValue.label ?? "param\(index)")" } + .joined(separator: ", ") + cases.append("case .\(enumCase.name)(\(pattern)):") + cases.append(contentsOf: payloadCode) + cases.append("return Int32(\(caseIndex))") + } + } + return cases + } + private func generateReturnSwitchCases(enumDef: ExportedEnum) -> [String] { var cases: [String] = [] for (caseIndex, enumCase) in enumDef.cases.enumerated() { @@ -1856,59 +1949,13 @@ public class ExportSwift { cases.append("case .\(enumCase.name):") cases.append("_swift_js_push_tag(Int32(\(caseIndex)))") } else { - var bodyLines: [String] = [] - bodyLines.append("_swift_js_push_tag(Int32(\(caseIndex)))") - for (index, associatedValue) in enumCase.associatedValues.enumerated() { - let paramName = associatedValue.label ?? "param\(index)" - switch associatedValue.type { - case .string: - bodyLines.append("var __bjs_\(paramName) = \(paramName)") - bodyLines.append("__bjs_\(paramName).withUTF8 { ptr in") - bodyLines.append("_swift_js_push_string(ptr.baseAddress, Int32(ptr.count))") - bodyLines.append("}") - case .int: - bodyLines.append("_swift_js_push_int(Int32(\(paramName)))") - case .bool: - bodyLines.append("_swift_js_push_int(\(paramName) ? 1 : 0)") - case .float: - bodyLines.append("_swift_js_push_f32(\(paramName))") - case .double: - bodyLines.append("_swift_js_push_f64(\(paramName))") - case .optional(let wrappedType): - bodyLines.append("let __bjs_isSome_\(paramName) = \(paramName) != nil") - bodyLines.append("if let __bjs_unwrapped_\(paramName) = \(paramName) {") - switch wrappedType { - case .string: - bodyLines.append("var __bjs_str_\(paramName) = __bjs_unwrapped_\(paramName)") - bodyLines.append("__bjs_str_\(paramName).withUTF8 { ptr in") - bodyLines.append("_swift_js_push_string(ptr.baseAddress, Int32(ptr.count))") - bodyLines.append("}") - case .int: - bodyLines.append("_swift_js_push_int(Int32(__bjs_unwrapped_\(paramName)))") - case .bool: - bodyLines.append("_swift_js_push_int(__bjs_unwrapped_\(paramName) ? 1 : 0)") - case .float: - bodyLines.append("_swift_js_push_f32(__bjs_unwrapped_\(paramName))") - case .double: - bodyLines.append("_swift_js_push_f64(__bjs_unwrapped_\(paramName))") - default: - bodyLines.append( - "preconditionFailure(\"BridgeJS: unsupported optional wrapped type in generated code\")" - ) - } - bodyLines.append("}") - bodyLines.append("_swift_js_push_int(__bjs_isSome_\(paramName) ? 1 : 0)") - default: - bodyLines.append( - "preconditionFailure(\"BridgeJS: unsupported associated value type in generated code\")" - ) - } - } let pattern = enumCase.associatedValues.enumerated() .map { index, associatedValue in "let \(associatedValue.label ?? "param\(index)")" } .joined(separator: ", ") cases.append("case .\(enumCase.name)(\(pattern)):") - cases.append(contentsOf: bodyLines) + cases.append("_swift_js_push_tag(Int32(\(caseIndex)))") + let payloadCode = generatePayloadPushingCode(associatedValues: enumCase.associatedValues) + cases.append(contentsOf: payloadCode) } } return cases diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 52ff813aa..26e22e873 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -447,14 +447,41 @@ extension BridgeType { } case .swiftProtocol: throw BridgeJSCoreError("swiftProtocol is not supported in imported signatures") - case .caseEnum, .rawValueEnum, .associatedValueEnum, .namespaceEnum: - throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") + case .caseEnum: + switch context { + case .importTS: + throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") + case .protocolExport: + return LoweringParameterInfo(loweredParameters: [("value", .i32)]) + } + case .rawValueEnum(_, let rawType): + switch context { + case .importTS: + throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") + case .protocolExport: + let wasmType = rawType == .string ? WasmCoreType.i32 : (rawType.wasmCoreType ?? .i32) + return LoweringParameterInfo(loweredParameters: [("value", wasmType)]) + } + case .associatedValueEnum: + switch context { + case .importTS: + throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") + case .protocolExport: + return LoweringParameterInfo(loweredParameters: [("caseId", .i32)]) + } + case .namespaceEnum: + throw BridgeJSCoreError("Namespace enums cannot be used as parameters") case .optional(let wrappedType): switch context { case .importTS: throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") case .protocolExport: - return try wrappedType.loweringParameterInfo(context: context) + let wrappedInfo = try wrappedType.loweringParameterInfo(context: context) + guard wrappedInfo.loweredParameters.count == 1 else { + throw BridgeJSCoreError("Optional wrapped type must lower to single parameter") + } + let (_, wrappedWasmType) = wrappedInfo.loweredParameters[0] + return LoweringParameterInfo(loweredParameters: [("value", wrappedWasmType)]) } } } @@ -494,22 +521,38 @@ extension BridgeType { } case .swiftProtocol: throw BridgeJSCoreError("swiftProtocol is not supported in imported signatures") - case .caseEnum, .rawValueEnum, .associatedValueEnum, .namespaceEnum: - throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .optional: + case .caseEnum: switch context { case .importTS: - throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") + throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") + case .protocolExport: + return LiftingReturnInfo(valueToLift: .i32) + } + case .rawValueEnum(_, let rawType): + switch context { + case .importTS: + throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") + case .protocolExport: + let wasmType = rawType == .string ? WasmCoreType.i32 : (rawType.wasmCoreType ?? .i32) + return LiftingReturnInfo(valueToLift: wasmType) + } + case .associatedValueEnum: + switch context { + case .importTS: + throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") case .protocolExport: - // For Optional, return the length (or -1 for null) - if case .optional(.string) = self { - return .string - } - if case .optional(.swiftHeapObject) = self { - return LiftingReturnInfo(valueToLift: .pointer) - } return LiftingReturnInfo(valueToLift: nil) } + case .namespaceEnum: + throw BridgeJSCoreError("Namespace enums cannot be used as return values") + case .optional(let wrappedType): + switch context { + case .importTS: + throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") + case .protocolExport: + let wrappedInfo = try wrappedType.liftingReturnInfo(context: context) + return wrappedInfo + } } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 1e92b09a4..453974716 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -490,9 +490,9 @@ struct IntrinsicJSFragment: Sendable { static func optionalLowerReturn(wrappedType: BridgeType) throws -> IntrinsicJSFragment { switch wrappedType { case .bool, .int, .float, .double, .string, .swiftHeapObject, .jsObject, .swiftProtocol, .caseEnum, - .rawValueEnum: + .rawValueEnum, .associatedValueEnum: break - case .void, .optional, .associatedValueEnum, .namespaceEnum: + case .void, .optional, .namespaceEnum: throw BridgeJSLinkError(message: "Unsupported optional wrapped type for protocol export: \(wrappedType)") } @@ -586,6 +586,23 @@ struct IntrinsicJSFragment: Sendable { "bjs[\"swift_js_return_optional_int\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) | 0) : 0);" ) } + case .associatedValueEnum(let fullName): + let base = fullName.components(separatedBy: ".").last ?? fullName + let caseIdVar = scope.variable("caseId") + let cleanupVar = scope.variable("cleanup") + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write( + "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(value));" + ) + cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") + printer.write("bjs[\"swift_js_return_optional_int\"](1, \(caseIdVar));") + } + printer.write("} else {") + printer.indent { + printer.write("bjs[\"swift_js_return_optional_int\"](0, 0);") + } + printer.write("}") default: () } @@ -693,11 +710,27 @@ struct IntrinsicJSFragment: Sendable { case .bool: return .boolLiftParameter default: return .identity } - case .associatedValueEnum(let string): - throw BridgeJSLinkError( - message: - "Associated value enums are not supported to be passed as parameters to imported JS functions: \(string)" - ) + case .associatedValueEnum(let fullName): + switch context { + case .importTS: + throw BridgeJSLinkError( + message: + "Associated value enums are not supported to be passed as parameters to imported JS functions: \(fullName)" + ) + case .protocolExport: + let base = fullName.components(separatedBy: ".").last ?? fullName + return IntrinsicJSFragment( + parameters: ["caseId"], + printCode: { arguments, scope, printer, cleanupCode in + let caseId = arguments[0] + let resultVar = scope.variable("enumValue") + printer.write( + "const \(resultVar) = enumHelpers.\(base).raise(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + ) + return [resultVar] + } + ) + } case .namespaceEnum(let string): throw BridgeJSLinkError( message: @@ -743,10 +776,30 @@ struct IntrinsicJSFragment: Sendable { case .bool: return .boolLowerReturn default: return .identity } - case .associatedValueEnum(let string): - throw BridgeJSLinkError( - message: "Associated value enums are not supported to be returned from imported JS functions: \(string)" - ) + case .associatedValueEnum(let fullName): + switch context { + case .importTS: + throw BridgeJSLinkError( + message: + "Associated value enums are not supported to be returned from imported JS functions: \(fullName)" + ) + case .protocolExport: + let base = fullName.components(separatedBy: ".").last ?? fullName + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanupCode in + let value = arguments[0] + let caseIdVar = scope.variable("caseId") + let cleanupVar = scope.variable("cleanup") + printer.write( + "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(value));" + ) + cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") + printer.write("return \(caseIdVar);") + return [] + } + ) + } case .namespaceEnum(let string): throw BridgeJSLinkError( message: "Namespace enums are not supported to be returned from imported JS functions: \(string)" diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift index 63a6d9acb..9f2556e98 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift @@ -1,5 +1,15 @@ import JavaScriptKit +@JS enum ExampleEnum: String { + case test = "test" + case test2 = "test2" +} + +@JS enum Result { + case success(String) + case failure(Int) +} + @JS class Helper { @JS var value: Int @@ -16,6 +26,8 @@ import JavaScriptKit var eventCount: Int { get set } var delegateName: String { get } var optionalName: String? { get set } + var myEnum: ExampleEnum { get set } + var result: Result? { get set } func onSomethingHappened() func onValueChanged(_ value: String) func onCountUpdated(count: Int) -> Bool @@ -25,6 +37,9 @@ import JavaScriptKit func createHelper() -> Helper func onOptionalHelperUpdated(_ helper: Helper?) func createOptionalHelper() -> Helper? + func createEnum() -> ExampleEnum + func handleResult(_ result: Result) + func getResult() -> Result } @JS class MyViewController { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts index 2d4899793..9e64ddff9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts @@ -14,11 +14,36 @@ export interface MyViewControllerDelegate { createHelper(): Helper; onOptionalHelperUpdated(helper: Helper | null): void; createOptionalHelper(): Helper | null; + createEnum(): ExampleEnumTag; + handleResult(result: ResultTag): void; + getResult(): ResultTag; eventCount: number; readonly delegateName: string; optionalName: string | null; + myEnum: ExampleEnumTag; + result: ResultTag | null; } +export const ExampleEnumValues: { + readonly Test: "test"; + readonly Test2: "test2"; +}; +export type ExampleEnumTag = typeof ExampleEnumValues[keyof typeof ExampleEnumValues]; + +export const ResultValues: { + readonly Tag: { + readonly Success: 0; + readonly Failure: 1; + }; +}; + +export type ResultTag = + { tag: typeof ResultValues.Tag.Success; param0: string } | { tag: typeof ResultValues.Tag.Failure; param0: number } + +export type ExampleEnumObject = typeof ExampleEnumValues; + +export type ResultObject = typeof ResultValues; + /// Represents a Swift heap object like a class instance or an actor instance. export interface SwiftHeapObject { /// Release the heap object. @@ -47,6 +72,8 @@ export type Exports = { MyViewController: { new(delegate: MyViewControllerDelegate): MyViewController; } + ExampleEnum: ExampleEnumObject + Result: ResultObject } export type Imports = { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index 1d9329c3e..8aa18d391 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -4,6 +4,57 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. +export const ExampleEnumValues = { + Test: "test", + Test2: "test2", +}; + +export const ResultValues = { + Tag: { + Success: 0, + Failure: 1, + }, +}; + +const __bjs_createResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case ResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: ResultValues.Tag.Success, cleanup }; + } + case ResultValues.Tag.Failure: { + tmpParamInts.push((value.param0 | 0)); + const cleanup = undefined; + return { caseId: ResultValues.Tag.Failure, cleanup }; + } + default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); + } + }, + raise: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { + const tag = tmpRetTag | 0; + switch (tag) { + case ResultValues.Tag.Success: { + const string = tmpRetStrings.pop(); + return { tag: ResultValues.Tag.Success, param0: string }; + } + case ResultValues.Tag.Failure: { + const int = tmpRetInts.pop(); + return { tag: ResultValues.Tag.Failure, param0: int }; + } + default: throw new Error("Unknown ResultValues tag returned from Swift: " + String(tag)); + } + } + }); +}; export async function createInstantiator(options, swift) { let instance; let memory; @@ -26,6 +77,7 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + const enumHelpers = {}; return { /** @@ -204,6 +256,45 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_MyViewControllerDelegate_myEnum_get"] = function bjs_MyViewControllerDelegate_myEnum_get(self) { + try { + let ret = swift.memory.getObject(self).myEnum; + tmpRetBytes = textEncoder.encode(ret); + return tmpRetBytes.length; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_myEnum_set"] = function bjs_MyViewControllerDelegate_myEnum_set(self, value) { + try { + const valueObject = swift.memory.getObject(value); + swift.memory.release(value); + swift.memory.getObject(self).myEnum = valueObject; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_result_get"] = function bjs_MyViewControllerDelegate_result_get(self) { + try { + let ret = swift.memory.getObject(self).result; + const isSome = ret != null; + if (isSome) { + const { caseId: caseId, cleanup: cleanup } = enumHelpers.Result.lower(ret); + bjs["swift_js_return_optional_int"](1, caseId); + } else { + bjs["swift_js_return_optional_int"](0, 0); + } + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_result_set"] = function bjs_MyViewControllerDelegate_result_set(self, valueIsSome, valueWrappedValue) { + try { + swift.memory.getObject(self).result = valueIsSome ? valueWrappedValue : null; + } catch (error) { + setException(error); + } + } TestModule["bjs_MyViewControllerDelegate_onSomethingHappened"] = function bjs_MyViewControllerDelegate_onSomethingHappened(self) { try { swift.memory.getObject(self).onSomethingHappened(); @@ -281,11 +372,40 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_MyViewControllerDelegate_createEnum"] = function bjs_MyViewControllerDelegate_createEnum(self) { + try { + let ret = swift.memory.getObject(self).createEnum(); + tmpRetBytes = textEncoder.encode(ret); + return tmpRetBytes.length; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_handleResult"] = function bjs_MyViewControllerDelegate_handleResult(self, result) { + try { + const enumValue = enumHelpers.Result.raise(result, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + swift.memory.getObject(self).handleResult(enumValue); + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_getResult"] = function bjs_MyViewControllerDelegate_getResult(self) { + try { + let ret = swift.memory.getObject(self).getResult(); + const { caseId: caseId, cleanup: cleanup } = enumHelpers.Result.lower(ret); + return caseId; + } catch (error) { + setException(error); + } + } }, setInstance: (i) => { instance = i; memory = instance.exports.memory; + const ResultHelpers = __bjs_createResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); + enumHelpers.Result = ResultHelpers; + setException = (error) => { instance.exports._swift_js_exception.value = swift.memory.retain(error) } @@ -393,6 +513,8 @@ export async function createInstantiator(options, swift) { return { Helper, MyViewController, + ExampleEnum: ExampleEnumValues, + Result: ResultValues, }; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift index 008eeda0d..ce952ca9d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift @@ -7,7 +7,9 @@ @_spi(BridgeJS) import JavaScriptKit extension APIResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { + // MARK: Private Helper + + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) @@ -26,6 +28,44 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .failure(let param0): + _swift_js_push_int(Int32(param0)) + return Int32(1) + case .flag(let param0): + _swift_js_push_int(param0 ? 1 : 0) + return Int32(2) + case .rate(let param0): + _swift_js_push_f32(param0) + return Int32(3) + case .precise(let param0): + _swift_js_push_f64(param0) + return Int32(4) + case .info: + return Int32(5) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> APIResult { + let caseId = _swift_js_pop_param_int32() + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { + return _bridgeJSLiftFromCaseId(caseId) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): @@ -53,7 +93,9 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } extension ComplexResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> ComplexResult { + // MARK: Private Helper + + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) @@ -72,6 +114,72 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } } + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .error(let param0, let param1): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(param1)) + return Int32(1) + case .status(let param0, let param1, let param2): + _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_int(Int32(param1)) + var __bjs_param2 = param2 + __bjs_param2.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(2) + case .coordinates(let param0, let param1, let param2): + _swift_js_push_f64(param0) + _swift_js_push_f64(param1) + _swift_js_push_f64(param2) + return Int32(3) + case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): + _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_int(param1 ? 1 : 0) + _swift_js_push_int(Int32(param2)) + _swift_js_push_int(Int32(param3)) + _swift_js_push_f64(param4) + _swift_js_push_f64(param5) + var __bjs_param6 = param6 + __bjs_param6.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + var __bjs_param7 = param7 + __bjs_param7.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + var __bjs_param8 = param8 + __bjs_param8.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(4) + case .info: + return Int32(5) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> ComplexResult { + let caseId = _swift_js_pop_param_int32() + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> ComplexResult { + return _bridgeJSLiftFromCaseId(caseId) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): @@ -127,7 +235,9 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> Utilities.Result { + // MARK: Private Helper + + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Utilities.Result { switch caseId { case 0: return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) @@ -140,6 +250,45 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { } } + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .failure(let param0, let param1): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(param1)) + return Int32(1) + case .status(let param0, let param1, let param2): + _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_int(Int32(param1)) + var __bjs_param2 = param2 + __bjs_param2.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(2) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> Utilities.Result { + let caseId = _swift_js_pop_param_int32() + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> Utilities.Result { + return _bridgeJSLiftFromCaseId(caseId) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): @@ -168,7 +317,9 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { } extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> NetworkingResult { + // MARK: Private Helper + + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> NetworkingResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) @@ -179,6 +330,37 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { } } + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .failure(let param0, let param1): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(param1)) + return Int32(1) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> NetworkingResult { + let caseId = _swift_js_pop_param_int32() + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> NetworkingResult { + return _bridgeJSLiftFromCaseId(caseId) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): @@ -199,7 +381,9 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { } extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIOptionalResult { + // MARK: Private Helper + + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIOptionalResult { switch caseId { case 0: return .success(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())) @@ -212,6 +396,66 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { } } + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + var __bjs_str_param0 = __bjs_unwrapped_param0 + __bjs_str_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + } + _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + return Int32(0) + case .failure(let param0, let param1): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + _swift_js_push_int(Int32(__bjs_unwrapped_param0)) + } + _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + let __bjs_isSome_param1 = param1 != nil + if let __bjs_unwrapped_param1 = param1 { + _swift_js_push_int(__bjs_unwrapped_param1 ? 1 : 0) + } + _swift_js_push_int(__bjs_isSome_param1 ? 1 : 0) + return Int32(1) + case .status(let param0, let param1, let param2): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + _swift_js_push_int(__bjs_unwrapped_param0 ? 1 : 0) + } + _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + let __bjs_isSome_param1 = param1 != nil + if let __bjs_unwrapped_param1 = param1 { + _swift_js_push_int(Int32(__bjs_unwrapped_param1)) + } + _swift_js_push_int(__bjs_isSome_param1 ? 1 : 0) + let __bjs_isSome_param2 = param2 != nil + if let __bjs_unwrapped_param2 = param2 { + var __bjs_str_param2 = __bjs_unwrapped_param2 + __bjs_str_param2.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + } + _swift_js_push_int(__bjs_isSome_param2 ? 1 : 0) + return Int32(2) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> APIOptionalResult { + let caseId = _swift_js_pop_param_int32() + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIOptionalResult { + return _bridgeJSLiftFromCaseId(caseId) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json index 30abfc91c..bddcf2aa2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json @@ -250,7 +250,71 @@ } ], "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "test", + "rawValue" : "test" + }, + { + "associatedValues" : [ + + ], + "name" : "test2", + "rawValue" : "test2" + } + ], + "emitStyle" : "const", + "name" : "ExampleEnum", + "rawType" : "String", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "ExampleEnum" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "int" : { + + } + } + } + ], + "name" : "failure" + } + ], + "emitStyle" : "const", + "name" : "Result", + "staticMethods" : [ + + ], + "staticProperties" : [ + ], + "swiftCallName" : "Result" + } ], "functions" : [ @@ -468,6 +532,66 @@ } } } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_createEnum", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createEnum", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "ExampleEnum", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_handleResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "handleResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "Result" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_getResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getResult", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "Result" + } + } } ], "name" : "MyViewControllerDelegate", @@ -502,6 +626,29 @@ } } } + }, + { + "isReadonly" : false, + "name" : "myEnum", + "type" : { + "rawValueEnum" : { + "_0" : "ExampleEnum", + "_1" : "String" + } + } + }, + { + "isReadonly" : false, + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "Result" + } + } + } + } } ] } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index ea1d71eab..8bd37e8e2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -67,6 +67,26 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto return Optional.bridgeJSLiftReturn(ret) } + func createEnum() -> ExampleEnum { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createEnum") + func _extern_createEnum(this: Int32) -> Int32 + let ret = _extern_createEnum(this: Int32(bitPattern: jsObject.id)) + return ExampleEnum.bridgeJSLiftReturn(ret) + } + + func handleResult(_ result: Result) { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_handleResult") + func _extern_handleResult(this: Int32, result: Int32) + _extern_handleResult(this: Int32(bitPattern: jsObject.id), result: result.bridgeJSLowerParameter()) + } + + func getResult() -> Result { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_getResult") + func _extern_getResult(this: Int32) + _extern_getResult(this: Int32(bitPattern: jsObject.id)) + return Result.bridgeJSLiftReturn() + } + var eventCount: Int { get { @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_get") @@ -104,11 +124,98 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto } } + var myEnum: ExampleEnum { + get { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_myEnum_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return ExampleEnum.bridgeJSLiftReturn(ret) + } + set { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_myEnum_set") + func _extern_set(this: Int32, value: Int32) + _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + } + } + + var result: Optional { + get { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_get") + func _extern_get(this: Int32) + _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturn() + } + set { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_set") + func _extern_set(this: Int32, value: Int32) + _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + } + } + static func bridgeJSLiftParameter(_ value: Int32) -> Self { return AnyMyViewControllerDelegate(jsObject: JSObject(id: UInt32(bitPattern: value))) } } +extension ExampleEnum: _BridgedSwiftEnumNoPayload { +} + +extension Result: _BridgedSwiftAssociatedValueEnum { + // MARK: Private Helper + + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Result { + switch caseId { + case 0: + return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + case 1: + return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + default: + fatalError("Unknown Result case ID: \(caseId)") + } + } + + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .failure(let param0): + _swift_js_push_int(Int32(param0)) + return Int32(1) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> Result { + let caseId = _swift_js_pop_param_int32() + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> Result { + return _bridgeJSLiftFromCaseId(caseId) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + switch self { + case .success(let param0): + _swift_js_push_tag(Int32(0)) + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + case .failure(let param0): + _swift_js_push_tag(Int32(1)) + _swift_js_push_int(Int32(param0)) + } + } +} + @_expose(wasm, "bjs_Helper_init") @_cdecl("bjs_Helper_init") public func _bjs_Helper_init(value: Int32) -> UnsafeMutableRawPointer { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift index 4e301151a..a26d5ea1c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift @@ -53,7 +53,9 @@ public func _bjs_Calculator_static_square(value: Int32) -> Int32 { } extension APIResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { + // MARK: Private Helper + + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) @@ -64,6 +66,33 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .failure(let param0): + _swift_js_push_int(Int32(param0)) + return Int32(1) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> APIResult { + let caseId = _swift_js_pop_param_int32() + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { + return _bridgeJSLiftFromCaseId(caseId) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): diff --git a/Sources/JavaScriptKit/BridgeJSInstrincics.swift b/Sources/JavaScriptKit/BridgeJSInstrincics.swift index 5a8f7f014..be6e7b472 100644 --- a/Sources/JavaScriptKit/BridgeJSInstrincics.swift +++ b/Sources/JavaScriptKit/BridgeJSInstrincics.swift @@ -325,6 +325,11 @@ public protocol _BridgedSwiftEnumNoPayload {} /// /// The conformance is automatically synthesized by the BridgeJS code generator. public protocol _BridgedSwiftCaseEnum { + // MARK: ImportTS + @_spi(BridgeJS) consuming func bridgeJSLowerParameter() -> Int32 + @_spi(BridgeJS) static func bridgeJSLiftReturn(_ value: Int32) -> Self + + // MARK: ExportSwift @_spi(BridgeJS) static func bridgeJSLiftParameter(_ value: Int32) -> Self @_spi(BridgeJS) consuming func bridgeJSLowerReturn() -> Int32 } @@ -332,7 +337,12 @@ public protocol _BridgedSwiftCaseEnum { /// A protocol that Swift associated value enum types conform to. /// /// The conformance is automatically synthesized by the BridgeJS code generator. -public protocol _BridgedSwiftAssociatedValueEnum { +public protocol _BridgedSwiftAssociatedValueEnum: _BridgedSwiftTypeLoweredIntoVoidType { + // MARK: ImportTS + @_spi(BridgeJS) consuming func bridgeJSLowerParameter() -> Int32 + @_spi(BridgeJS) static func bridgeJSLiftReturn() -> Self + + // MARK: ExportSwift @_spi(BridgeJS) static func bridgeJSLiftParameter(_ caseId: Int32) -> Self @_spi(BridgeJS) consuming func bridgeJSLowerReturn() -> Void } @@ -340,8 +350,9 @@ public protocol _BridgedSwiftAssociatedValueEnum { extension _BridgedSwiftEnumNoPayload where Self: RawRepresentable, RawValue == String { // MARK: ImportTS @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { rawValue.bridgeJSLowerParameter() } - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ bytesCount: Int32) -> Self { - Self(rawValue: .bridgeJSLiftReturn(bytesCount))! + + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ id: Int32) -> Self { + Self(rawValue: .bridgeJSLiftReturn(id))! } // MARK: ExportSwift @@ -823,20 +834,21 @@ extension Optional where Wrapped == Double { extension Optional where Wrapped: _BridgedSwiftCaseEnum { // MARK: ImportTS - @available( - *, - unavailable, - message: "Optional case enum types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Void {} + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + switch consume self { + case .none: + return -1 // Sentinel for nil + case .some(let value): + return value.bridgeJSLowerParameter() + } + } - @available( - *, - unavailable, - message: "Optional case enum types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ wrappedValue: Int32) -> Wrapped? { - return nil + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Wrapped? { + if value == -1 { + return nil + } else { + return Wrapped.bridgeJSLiftReturn(value) + } } // MARK: ExportSwift @@ -890,19 +902,23 @@ extension Optional where Wrapped: _BridgedSwiftTypeLoweredIntoVoidType { extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == String { // MARK: ImportTS - @available( - *, - unavailable, - message: "Optional String raw value enum types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Void {} + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + switch consume self { + case .none: + return 0 // Sentinel for nil + case .some(let value): + return value.bridgeJSLowerParameter() + } + } - @available( - *, - unavailable, - message: "Optional String raw value enum types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32) -> Wrapped? { return nil } + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ length: Int32) -> Wrapped? { + if length == 0 { + return nil + } else { + let rawValue = String.bridgeJSLiftReturn(length) + return Wrapped(rawValue: rawValue) + } + } // MARK: ExportSwift @@ -924,20 +940,21 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Int { // MARK: ImportTS - @available( - *, - unavailable, - message: "Optional Int raw value enum types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Void {} + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + switch consume self { + case .none: + return -1 // Sentinel for nil + case .some(let value): + return value.bridgeJSLowerParameter() + } + } - @available( - *, - unavailable, - message: "Optional Int raw value enum types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ wrappedValue: Int32) -> Wrapped? { - return nil + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Wrapped? { + if value == -1 { + return nil + } else { + return Wrapped(rawValue: Int(value)) + } } // MARK: ExportSwift @@ -956,20 +973,21 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Bool { // MARK: ImportTS - @available( - *, - unavailable, - message: "Optional Bool raw value enum types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Void {} + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + switch consume self { + case .none: + return -1 // Sentinel for nil + case .some(let value): + return value.bridgeJSLowerParameter() + } + } - @available( - *, - unavailable, - message: "Optional Bool raw value enum types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ wrappedValue: Int32) -> Wrapped? { - return nil + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Wrapped? { + if value == -1 { + return nil + } else { + return Wrapped(rawValue: value != 0) + } } // MARK: ExportSwift @@ -988,20 +1006,21 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Float { // MARK: ImportTS - @available( - *, - unavailable, - message: "Optional Float raw value enum types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Void {} + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Float32 { + switch consume self { + case .none: + return Float32.nan // Sentinel for nil (NaN) + case .some(let value): + return value.bridgeJSLowerParameter() + } + } - @available( - *, - unavailable, - message: "Optional Float raw value enum types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ wrappedValue: Float32) -> Wrapped? { - return nil + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Float32) -> Wrapped? { + if value.isNaN { + return nil + } else { + return Wrapped(rawValue: Float(value)) + } } // MARK: ExportSwift @@ -1020,20 +1039,21 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Double { // MARK: ImportTS - @available( - *, - unavailable, - message: "Optional Double raw value enum types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Void {} + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Float64 { + switch consume self { + case .none: + return Float64.nan // Sentinel for nil (NaN) + case .some(let value): + return value.bridgeJSLowerParameter() + } + } - @available( - *, - unavailable, - message: "Optional Double raw value enum types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ wrappedValue: Float64) -> Wrapped? { - return nil + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Float64) -> Wrapped? { + if value.isNaN { + return nil + } else { + return Wrapped(rawValue: Double(value)) + } } // MARK: ExportSwift @@ -1053,21 +1073,27 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres extension Optional where Wrapped: _BridgedSwiftAssociatedValueEnum { // MARK: ImportTS - @available( - *, - unavailable, - message: "Optional associated value enums are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Void { - fatalError("Optional associated value enum bridgeJSLowerParameter is not supported for ImportTS") + + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + switch consume self { + case .none: + return -1 // Sentinel for nil + case .some(let value): + return value.bridgeJSLowerParameter() + } } - @available( - *, - unavailable, - message: "Optional associated value enums are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ caseId: Int32) -> Wrapped? { return nil } + @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> Wrapped? { + // Read tag from side channel + let tag = _swift_js_pop_param_int32() + if tag == -1 { + return nil + } else { + // Put tag back for the wrapped type's liftReturn to consume + _swift_js_push_int(tag) + return Wrapped.bridgeJSLiftReturn() + } + } // MARK: ExportSwift diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 019565515..168a8c6ee 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -859,10 +859,11 @@ enum APIOptionalResult { // MARK: - Protocol Tests -@JS protocol Counter { +@JS protocol DataProcessor { var count: Int { get set } var name: String { get } var optionalTag: String? { get set } + var apiResult: APIResult? { get set } func increment(by amount: Int) func getValue() -> Int func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) @@ -872,56 +873,59 @@ enum APIOptionalResult { func createGreeter() -> Greeter func processOptionalGreeter(_ greeter: Greeter?) -> String func createOptionalGreeter() -> Greeter? + func handleAPIResult(_ result: APIResult) + func getAPIResult() -> APIResult } -@JS class CounterManager { +@JS class DataProcessorManager { - @JS var counter: Counter - @JS var backupCounter: Counter? + @JS var processor: DataProcessor + @JS var backupProcessor: DataProcessor? - @JS init(counter: Counter) { - self.counter = counter - self.backupCounter = nil + @JS init(processor: DataProcessor) { + self.processor = processor + self.backupProcessor = nil } @JS func incrementByAmount(_ amount: Int) { - counter.increment(by: amount) + processor.increment(by: amount) } - @JS func setCounterLabel(_ prefix: String, _ suffix: String) { - counter.setLabelElements(prefix, suffix) + @JS func setProcessorLabel(_ prefix: String, _ suffix: String) { + processor.setLabelElements(prefix, suffix) } - @JS func isCounterEven() -> Bool { - return counter.isEven() + @JS func isProcessorEven() -> Bool { + return processor.isEven() } - @JS func getCounterLabel() -> String { - return counter.getLabel() + @JS func getProcessorLabel() -> String { + return processor.getLabel() } @JS func getCurrentValue() -> Int { - return counter.getValue() + return processor.getValue() } @JS func incrementBoth() { - counter.increment(by: 1) - backupCounter?.increment(by: 1) + processor.increment(by: 1) + backupProcessor?.increment(by: 1) } @JS func getBackupValue() -> Int? { - return backupCounter?.getValue() + return backupProcessor?.getValue() } @JS func hasBackup() -> Bool { - return backupCounter != nil + return backupProcessor != nil } } -@JS class SwiftCounter: Counter { +@JS class SwiftDataProcessor: DataProcessor { @JS var count: Int = 0 - @JS let name: String = "SwiftCounter" + @JS let name: String = "SwiftDataProcessor" @JS var optionalTag: String? = nil + @JS var apiResult: APIResult? = nil private var label: String = "" @JS init() {} @@ -947,23 +951,31 @@ enum APIOptionalResult { } @JS func processGreeter(_ greeter: Greeter) -> String { - return "SwiftCounter processed: \(greeter.greet())" + return "SwiftProcessor processed: \(greeter.greet())" } @JS func createGreeter() -> Greeter { - return Greeter(name: "CounterGreeter") + return Greeter(name: "ProcessorGreeter") } @JS func processOptionalGreeter(_ greeter: Greeter?) -> String { if let greeter = greeter { - return "SwiftCounter processed optional: \(greeter.greet())" + return "SwiftProcessor processed optional: \(greeter.greet())" } else { - return "SwiftCounter received nil" + return "SwiftProcessor received nil" } } @JS func createOptionalGreeter() -> Greeter? { - return Greeter(name: "OptionalCounterGreeter") + return Greeter(name: "OptionalProcessorGreeter") + } + + @JS func handleAPIResult(_ result: APIResult) { + self.apiResult = result + } + + @JS func getAPIResult() -> APIResult { + return apiResult ?? .failure(0) } } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index 55cde9577..58938a945 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -6,17 +6,17 @@ @_spi(BridgeJS) import JavaScriptKit -struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { +struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { let jsObject: JSObject func increment(by amount: Int) { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_increment") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_increment") func _extern_increment(this: Int32, amount: Int32) _extern_increment(this: Int32(bitPattern: jsObject.id), amount: amount.bridgeJSLowerParameter()) } func getValue() -> Int { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_getValue") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getValue") func _extern_getValue(this: Int32) -> Int32 let ret = _extern_getValue(this: Int32(bitPattern: jsObject.id)) <<<<<<< HEAD @@ -27,13 +27,13 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { } func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_setLabelElements") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_setLabelElements") func _extern_setLabelElements(this: Int32, labelPrefix: Int32, labelSuffix: Int32) _extern_setLabelElements(this: Int32(bitPattern: jsObject.id), labelPrefix: labelPrefix.bridgeJSLowerParameter(), labelSuffix: labelSuffix.bridgeJSLowerParameter()) } func getLabel() -> String { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_getLabel") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getLabel") func _extern_getLabel(this: Int32) -> Int32 let ret = _extern_getLabel(this: Int32(bitPattern: jsObject.id)) <<<<<<< HEAD @@ -44,49 +44,62 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { } func isEven() -> Bool { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_isEven") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_isEven") func _extern_isEven(this: Int32) -> Int32 let ret = _extern_isEven(this: Int32(bitPattern: jsObject.id)) return Bool.bridgeJSLiftReturn(ret) } func processGreeter(_ greeter: Greeter) -> String { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_processGreeter") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processGreeter") func _extern_processGreeter(this: Int32, greeter: UnsafeMutableRawPointer) -> Int32 let ret = _extern_processGreeter(this: Int32(bitPattern: jsObject.id), greeter: greeter.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(ret) } func createGreeter() -> Greeter { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_createGreeter") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createGreeter") func _extern_createGreeter(this: Int32) -> UnsafeMutableRawPointer let ret = _extern_createGreeter(this: Int32(bitPattern: jsObject.id)) return Greeter.bridgeJSLiftReturn(ret) } func processOptionalGreeter(_ greeter: Optional) -> String { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_processOptionalGreeter") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processOptionalGreeter") func _extern_processOptionalGreeter(this: Int32, greeter: UnsafeMutableRawPointer) -> Int32 let ret = _extern_processOptionalGreeter(this: Int32(bitPattern: jsObject.id), greeter: greeter.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(ret) } func createOptionalGreeter() -> Optional { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_createOptionalGreeter") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createOptionalGreeter") func _extern_createOptionalGreeter(this: Int32) -> UnsafeMutableRawPointer let ret = _extern_createOptionalGreeter(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturn(ret) } + func handleAPIResult(_ result: APIResult) { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_handleAPIResult") + func _extern_handleAPIResult(this: Int32, result: Int32) + _extern_handleAPIResult(this: Int32(bitPattern: jsObject.id), result: result.bridgeJSLowerParameter()) + } + + func getAPIResult() -> APIResult { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getAPIResult") + func _extern_getAPIResult(this: Int32) + _extern_getAPIResult(this: Int32(bitPattern: jsObject.id)) + return APIResult.bridgeJSLiftReturn() + } + var count: Int { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_count_get") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_get") func _extern_get(this: Int32) -> Int32 let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) return Int.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_count_set") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_set") func _extern_set(this: Int32, value: Int32) _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) } @@ -94,7 +107,7 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { var name: String { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_name_get") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_name_get") func _extern_get(this: Int32) -> Int32 let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) return String.bridgeJSLiftReturn(ret) @@ -103,20 +116,34 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { var optionalTag: Optional { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_optionalTag_get") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_get") func _extern_get(this: Int32) -> Int32 let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Counter_optionalTag_set") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_set") + func _extern_set(this: Int32, value: Int32) + _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + } + } + + var apiResult: Optional { + get { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_get") + func _extern_get(this: Int32) + _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturn() + } + set { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_set") func _extern_set(this: Int32, value: Int32) _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) } } static func bridgeJSLiftParameter(_ value: Int32) -> Self { - return AnyCounter(jsObject: JSObject(id: UInt32(bitPattern: value))) + return AnyDataProcessor(jsObject: JSObject(id: UInt32(bitPattern: value))) } } @@ -125,13 +152,13 @@ extension Direction: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Direction { - return Direction(bridgeJSRawValue: value)! + 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 bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { @@ -168,13 +195,13 @@ extension Status: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Status { - return Status(bridgeJSRawValue: value)! + 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 bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { @@ -213,13 +240,13 @@ extension TSDirection: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> TSDirection { - return TSDirection(bridgeJSRawValue: value)! + 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 bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { @@ -259,13 +286,13 @@ extension Networking.API.Method: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Networking.API.Method { - return Networking.API.Method(bridgeJSRawValue: value)! + 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 bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { @@ -308,13 +335,13 @@ extension Internal.SupportedMethod: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Internal.SupportedMethod { - return Internal.SupportedMethod(bridgeJSRawValue: value)! + 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 bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { @@ -339,7 +366,7 @@ extension Internal.SupportedMethod: _BridgedSwiftCaseEnum { } extension APIResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) @@ -358,6 +385,44 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .failure(let param0): + _swift_js_push_int(Int32(param0)) + return Int32(1) + case .flag(let param0): + _swift_js_push_int(param0 ? 1 : 0) + return Int32(2) + case .rate(let param0): + _swift_js_push_f32(param0) + return Int32(3) + case .precise(let param0): + _swift_js_push_f64(param0) + return Int32(4) + case .info: + return Int32(5) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> APIResult { + let caseId = _swift_js_pop_param_int32() + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { + return _bridgeJSLiftFromCaseId(caseId) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): @@ -385,7 +450,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } extension ComplexResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> ComplexResult { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) @@ -406,6 +471,80 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } } + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .error(let param0, let param1): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(param1)) + return Int32(1) + case .location(let param0, let param1, let param2): + _swift_js_push_f64(param0) + _swift_js_push_f64(param1) + var __bjs_param2 = param2 + __bjs_param2.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(2) + case .status(let param0, let param1, let param2): + _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_int(Int32(param1)) + var __bjs_param2 = param2 + __bjs_param2.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(3) + case .coordinates(let param0, let param1, let param2): + _swift_js_push_f64(param0) + _swift_js_push_f64(param1) + _swift_js_push_f64(param2) + return Int32(4) + case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): + _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_int(param1 ? 1 : 0) + _swift_js_push_int(Int32(param2)) + _swift_js_push_int(Int32(param3)) + _swift_js_push_f64(param4) + _swift_js_push_f64(param5) + var __bjs_param6 = param6 + __bjs_param6.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + var __bjs_param7 = param7 + __bjs_param7.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + var __bjs_param8 = param8 + __bjs_param8.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(5) + case .info: + return Int32(6) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> ComplexResult { + let caseId = _swift_js_pop_param_int32() + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> ComplexResult { + return _bridgeJSLiftFromCaseId(caseId) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): @@ -469,7 +608,7 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> Utilities.Result { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Utilities.Result { switch caseId { case 0: return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) @@ -482,6 +621,45 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { } } + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .failure(let param0, let param1): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(param1)) + return Int32(1) + case .status(let param0, let param1, let param2): + _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_int(Int32(param1)) + var __bjs_param2 = param2 + __bjs_param2.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(2) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> Utilities.Result { + let caseId = _swift_js_pop_param_int32() + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> Utilities.Result { + return _bridgeJSLiftFromCaseId(caseId) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): @@ -510,7 +688,7 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { } extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> API.NetworkingResult { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> API.NetworkingResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) @@ -521,6 +699,37 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { } } + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .failure(let param0, let param1): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(param1)) + return Int32(1) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> API.NetworkingResult { + let caseId = _swift_js_pop_param_int32() + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> API.NetworkingResult { + return _bridgeJSLiftFromCaseId(caseId) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): @@ -541,7 +750,7 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { } extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIOptionalResult { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIOptionalResult { switch caseId { case 0: return .success(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())) @@ -554,6 +763,66 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { } } + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + var __bjs_str_param0 = __bjs_unwrapped_param0 + __bjs_str_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + } + _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + return Int32(0) + case .failure(let param0, let param1): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + _swift_js_push_int(Int32(__bjs_unwrapped_param0)) + } + _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + let __bjs_isSome_param1 = param1 != nil + if let __bjs_unwrapped_param1 = param1 { + _swift_js_push_int(__bjs_unwrapped_param1 ? 1 : 0) + } + _swift_js_push_int(__bjs_isSome_param1 ? 1 : 0) + return Int32(1) + case .status(let param0, let param1, let param2): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + _swift_js_push_int(__bjs_unwrapped_param0 ? 1 : 0) + } + _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + let __bjs_isSome_param1 = param1 != nil + if let __bjs_unwrapped_param1 = param1 { + _swift_js_push_int(Int32(__bjs_unwrapped_param1)) + } + _swift_js_push_int(__bjs_isSome_param1 ? 1 : 0) + let __bjs_isSome_param2 = param2 != nil + if let __bjs_unwrapped_param2 = param2 { + var __bjs_str_param2 = __bjs_unwrapped_param2 + __bjs_str_param2.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + } + _swift_js_push_int(__bjs_isSome_param2 ? 1 : 0) + return Int32(2) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> APIOptionalResult { + let caseId = _swift_js_pop_param_int32() + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIOptionalResult { + return _bridgeJSLiftFromCaseId(caseId) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): @@ -607,13 +876,13 @@ extension StaticCalculator: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> StaticCalculator { - return StaticCalculator(bridgeJSRawValue: value)! + 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 bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { @@ -664,13 +933,13 @@ extension StaticPropertyEnum: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> StaticPropertyEnum { - return StaticPropertyEnum(bridgeJSRawValue: value)! + 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 bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { @@ -3358,129 +3627,129 @@ extension StaticPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { } } -@_expose(wasm, "bjs_CounterManager_init") -@_cdecl("bjs_CounterManager_init") -public func _bjs_CounterManager_init(counter: Int32) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_DataProcessorManager_init") +@_cdecl("bjs_DataProcessorManager_init") +public func _bjs_DataProcessorManager_init(processor: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = CounterManager(counter: AnyCounter.bridgeJSLiftParameter(counter)) + let ret = DataProcessorManager(processor: AnyDataProcessor.bridgeJSLiftParameter(processor)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_CounterManager_incrementByAmount") -@_cdecl("bjs_CounterManager_incrementByAmount") -public func _bjs_CounterManager_incrementByAmount(_self: UnsafeMutableRawPointer, amount: Int32) -> Void { +@_expose(wasm, "bjs_DataProcessorManager_incrementByAmount") +@_cdecl("bjs_DataProcessorManager_incrementByAmount") +public func _bjs_DataProcessorManager_incrementByAmount(_self: UnsafeMutableRawPointer, amount: Int32) -> Void { #if arch(wasm32) - CounterManager.bridgeJSLiftParameter(_self).incrementByAmount(_: Int.bridgeJSLiftParameter(amount)) + DataProcessorManager.bridgeJSLiftParameter(_self).incrementByAmount(_: Int.bridgeJSLiftParameter(amount)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_CounterManager_setCounterLabel") -@_cdecl("bjs_CounterManager_setCounterLabel") -public func _bjs_CounterManager_setCounterLabel(_self: UnsafeMutableRawPointer, prefixBytes: Int32, prefixLength: Int32, suffixBytes: Int32, suffixLength: Int32) -> Void { +@_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) - CounterManager.bridgeJSLiftParameter(_self).setCounterLabel(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength), _: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) + DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorLabel(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength), _: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_CounterManager_isCounterEven") -@_cdecl("bjs_CounterManager_isCounterEven") -public func _bjs_CounterManager_isCounterEven(_self: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_DataProcessorManager_isProcessorEven") +@_cdecl("bjs_DataProcessorManager_isProcessorEven") +public func _bjs_DataProcessorManager_isProcessorEven(_self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) - let ret = CounterManager.bridgeJSLiftParameter(_self).isCounterEven() + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).isProcessorEven() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_CounterManager_getCounterLabel") -@_cdecl("bjs_CounterManager_getCounterLabel") -public func _bjs_CounterManager_getCounterLabel(_self: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_DataProcessorManager_getProcessorLabel") +@_cdecl("bjs_DataProcessorManager_getProcessorLabel") +public func _bjs_DataProcessorManager_getProcessorLabel(_self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = CounterManager.bridgeJSLiftParameter(_self).getCounterLabel() + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorLabel() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_CounterManager_getCurrentValue") -@_cdecl("bjs_CounterManager_getCurrentValue") -public func _bjs_CounterManager_getCurrentValue(_self: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_DataProcessorManager_getCurrentValue") +@_cdecl("bjs_DataProcessorManager_getCurrentValue") +public func _bjs_DataProcessorManager_getCurrentValue(_self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) - let ret = CounterManager.bridgeJSLiftParameter(_self).getCurrentValue() + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getCurrentValue() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_CounterManager_incrementBoth") -@_cdecl("bjs_CounterManager_incrementBoth") -public func _bjs_CounterManager_incrementBoth(_self: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_DataProcessorManager_incrementBoth") +@_cdecl("bjs_DataProcessorManager_incrementBoth") +public func _bjs_DataProcessorManager_incrementBoth(_self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - CounterManager.bridgeJSLiftParameter(_self).incrementBoth() + DataProcessorManager.bridgeJSLiftParameter(_self).incrementBoth() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_CounterManager_getBackupValue") -@_cdecl("bjs_CounterManager_getBackupValue") -public func _bjs_CounterManager_getBackupValue(_self: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_DataProcessorManager_getBackupValue") +@_cdecl("bjs_DataProcessorManager_getBackupValue") +public func _bjs_DataProcessorManager_getBackupValue(_self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = CounterManager.bridgeJSLiftParameter(_self).getBackupValue() + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getBackupValue() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_CounterManager_hasBackup") -@_cdecl("bjs_CounterManager_hasBackup") -public func _bjs_CounterManager_hasBackup(_self: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_DataProcessorManager_hasBackup") +@_cdecl("bjs_DataProcessorManager_hasBackup") +public func _bjs_DataProcessorManager_hasBackup(_self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) - let ret = CounterManager.bridgeJSLiftParameter(_self).hasBackup() + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).hasBackup() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_CounterManager_counter_get") -@_cdecl("bjs_CounterManager_counter_get") -public func _bjs_CounterManager_counter_get(_self: UnsafeMutableRawPointer) -> Int32 { +@_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 = CounterManager.bridgeJSLiftParameter(_self).counter as! AnyCounter + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).processor as! AnyDataProcessor return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_CounterManager_counter_set") -@_cdecl("bjs_CounterManager_counter_set") -public func _bjs_CounterManager_counter_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +@_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) - CounterManager.bridgeJSLiftParameter(_self).counter = AnyCounter.bridgeJSLiftParameter(value) + DataProcessorManager.bridgeJSLiftParameter(_self).processor = AnyDataProcessor.bridgeJSLiftParameter(value) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_CounterManager_backupCounter_get") -@_cdecl("bjs_CounterManager_backupCounter_get") -public func _bjs_CounterManager_backupCounter_get(_self: UnsafeMutableRawPointer) -> Void { +@_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 = CounterManager.bridgeJSLiftParameter(_self).backupCounter.flatMap { - $0 as? AnyCounter + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).backupProcessor.flatMap { + $0 as? AnyDataProcessor } return ret.bridgeJSLowerReturn() #else @@ -3488,213 +3757,255 @@ public func _bjs_CounterManager_backupCounter_get(_self: UnsafeMutableRawPointer #endif } -@_expose(wasm, "bjs_CounterManager_backupCounter_set") -@_cdecl("bjs_CounterManager_backupCounter_set") -public func _bjs_CounterManager_backupCounter_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: Int32) -> Void { +@_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) - CounterManager.bridgeJSLiftParameter(_self).backupCounter = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + DataProcessorManager.bridgeJSLiftParameter(_self).backupProcessor = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_CounterManager_deinit") -@_cdecl("bjs_CounterManager_deinit") -public func _bjs_CounterManager_deinit(pointer: UnsafeMutableRawPointer) { - Unmanaged.fromOpaque(pointer).release() +@_expose(wasm, "bjs_DataProcessorManager_deinit") +@_cdecl("bjs_DataProcessorManager_deinit") +public func _bjs_DataProcessorManager_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() } -extension CounterManager: ConvertibleToJSValue, _BridgedSwiftHeapObject { +extension DataProcessorManager: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_CounterManager_wrap") - func _bjs_CounterManager_wrap(_: UnsafeMutableRawPointer) -> Int32 + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessorManager_wrap") + func _bjs_DataProcessorManager_wrap(_: UnsafeMutableRawPointer) -> Int32 #else - func _bjs_CounterManager_wrap(_: UnsafeMutableRawPointer) -> Int32 { + func _bjs_DataProcessorManager_wrap(_: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif - return .object(JSObject(id: UInt32(bitPattern: _bjs_CounterManager_wrap(Unmanaged.passRetained(self).toOpaque())))) + return .object(JSObject(id: UInt32(bitPattern: _bjs_DataProcessorManager_wrap(Unmanaged.passRetained(self).toOpaque())))) } } -@_expose(wasm, "bjs_SwiftCounter_init") -@_cdecl("bjs_SwiftCounter_init") -public func _bjs_SwiftCounter_init() -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_SwiftDataProcessor_init") +@_cdecl("bjs_SwiftDataProcessor_init") +public func _bjs_SwiftDataProcessor_init() -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = SwiftCounter() + let ret = SwiftDataProcessor() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_increment") -@_cdecl("bjs_SwiftCounter_increment") -public func _bjs_SwiftCounter_increment(_self: UnsafeMutableRawPointer, amount: Int32) -> Void { +@_expose(wasm, "bjs_SwiftDataProcessor_increment") +@_cdecl("bjs_SwiftDataProcessor_increment") +public func _bjs_SwiftDataProcessor_increment(_self: UnsafeMutableRawPointer, amount: Int32) -> Void { #if arch(wasm32) - SwiftCounter.bridgeJSLiftParameter(_self).increment(by: Int.bridgeJSLiftParameter(amount)) + SwiftDataProcessor.bridgeJSLiftParameter(_self).increment(by: Int.bridgeJSLiftParameter(amount)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_getValue") -@_cdecl("bjs_SwiftCounter_getValue") -public func _bjs_SwiftCounter_getValue(_self: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_SwiftDataProcessor_getValue") +@_cdecl("bjs_SwiftDataProcessor_getValue") +public func _bjs_SwiftDataProcessor_getValue(_self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) - let ret = SwiftCounter.bridgeJSLiftParameter(_self).getValue() + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).getValue() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_setLabelElements") -@_cdecl("bjs_SwiftCounter_setLabelElements") -public func _bjs_SwiftCounter_setLabelElements(_self: UnsafeMutableRawPointer, labelPrefixBytes: Int32, labelPrefixLength: Int32, labelSuffixBytes: Int32, labelSuffixLength: Int32) -> Void { +@_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) - SwiftCounter.bridgeJSLiftParameter(_self).setLabelElements(_: String.bridgeJSLiftParameter(labelPrefixBytes, labelPrefixLength), _: String.bridgeJSLiftParameter(labelSuffixBytes, labelSuffixLength)) + SwiftDataProcessor.bridgeJSLiftParameter(_self).setLabelElements(_: String.bridgeJSLiftParameter(labelPrefixBytes, labelPrefixLength), _: String.bridgeJSLiftParameter(labelSuffixBytes, labelSuffixLength)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_getLabel") -@_cdecl("bjs_SwiftCounter_getLabel") -public func _bjs_SwiftCounter_getLabel(_self: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_SwiftDataProcessor_getLabel") +@_cdecl("bjs_SwiftDataProcessor_getLabel") +public func _bjs_SwiftDataProcessor_getLabel(_self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = SwiftCounter.bridgeJSLiftParameter(_self).getLabel() + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).getLabel() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_isEven") -@_cdecl("bjs_SwiftCounter_isEven") -public func _bjs_SwiftCounter_isEven(_self: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_SwiftDataProcessor_isEven") +@_cdecl("bjs_SwiftDataProcessor_isEven") +public func _bjs_SwiftDataProcessor_isEven(_self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) - let ret = SwiftCounter.bridgeJSLiftParameter(_self).isEven() + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).isEven() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_processGreeter") -@_cdecl("bjs_SwiftCounter_processGreeter") -public func _bjs_SwiftCounter_processGreeter(_self: UnsafeMutableRawPointer, greeter: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_SwiftDataProcessor_processGreeter") +@_cdecl("bjs_SwiftDataProcessor_processGreeter") +public func _bjs_SwiftDataProcessor_processGreeter(_self: UnsafeMutableRawPointer, greeter: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = SwiftCounter.bridgeJSLiftParameter(_self).processGreeter(_: Greeter.bridgeJSLiftParameter(greeter)) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).processGreeter(_: Greeter.bridgeJSLiftParameter(greeter)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_createGreeter") -@_cdecl("bjs_SwiftCounter_createGreeter") -public func _bjs_SwiftCounter_createGreeter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_SwiftDataProcessor_createGreeter") +@_cdecl("bjs_SwiftDataProcessor_createGreeter") +public func _bjs_SwiftDataProcessor_createGreeter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = SwiftCounter.bridgeJSLiftParameter(_self).createGreeter() + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).createGreeter() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_processOptionalGreeter") -@_cdecl("bjs_SwiftCounter_processOptionalGreeter") -public func _bjs_SwiftCounter_processOptionalGreeter(_self: UnsafeMutableRawPointer, greeterIsSome: Int32, greeterValue: UnsafeMutableRawPointer) -> Void { +@_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 = SwiftCounter.bridgeJSLiftParameter(_self).processOptionalGreeter(_: Optional.bridgeJSLiftParameter(greeterIsSome, greeterValue)) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).processOptionalGreeter(_: Optional.bridgeJSLiftParameter(greeterIsSome, greeterValue)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_createOptionalGreeter") -@_cdecl("bjs_SwiftCounter_createOptionalGreeter") -public func _bjs_SwiftCounter_createOptionalGreeter(_self: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_SwiftDataProcessor_createOptionalGreeter") +@_cdecl("bjs_SwiftDataProcessor_createOptionalGreeter") +public func _bjs_SwiftDataProcessor_createOptionalGreeter(_self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = SwiftCounter.bridgeJSLiftParameter(_self).createOptionalGreeter() + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).createOptionalGreeter() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_count_get") -@_cdecl("bjs_SwiftCounter_count_get") -public func _bjs_SwiftCounter_count_get(_self: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_SwiftDataProcessor_handleAPIResult") +@_cdecl("bjs_SwiftDataProcessor_handleAPIResult") +public func _bjs_SwiftDataProcessor_handleAPIResult(_self: UnsafeMutableRawPointer, result: Int32) -> Void { + #if arch(wasm32) + SwiftDataProcessor.bridgeJSLiftParameter(_self).handleAPIResult(_: APIResult.bridgeJSLiftParameter(result)) + #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 = SwiftCounter.bridgeJSLiftParameter(_self).count + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).getAPIResult() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_count_set") -@_cdecl("bjs_SwiftCounter_count_set") -public func _bjs_SwiftCounter_count_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +@_expose(wasm, "bjs_SwiftDataProcessor_count_get") +@_cdecl("bjs_SwiftDataProcessor_count_get") +public func _bjs_SwiftDataProcessor_count_get(_self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) - SwiftCounter.bridgeJSLiftParameter(_self).count = Int.bridgeJSLiftParameter(value) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).count + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_name_get") -@_cdecl("bjs_SwiftCounter_name_get") -public func _bjs_SwiftCounter_name_get(_self: UnsafeMutableRawPointer) -> Void { +@_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) - let ret = SwiftCounter.bridgeJSLiftParameter(_self).name + 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_SwiftCounter_optionalTag_get") -@_cdecl("bjs_SwiftCounter_optionalTag_get") -public func _bjs_SwiftCounter_optionalTag_get(_self: UnsafeMutableRawPointer) -> Void { +@_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_apiResult_get") +@_cdecl("bjs_SwiftDataProcessor_apiResult_get") +public func _bjs_SwiftDataProcessor_apiResult_get(_self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = SwiftCounter.bridgeJSLiftParameter(_self).optionalTag + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).apiResult return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_optionalTag_set") -@_cdecl("bjs_SwiftCounter_optionalTag_set") -public func _bjs_SwiftCounter_optionalTag_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueBytes: Int32, valueLength: Int32) -> Void { +@_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) - SwiftCounter.bridgeJSLiftParameter(_self).optionalTag = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) + SwiftDataProcessor.bridgeJSLiftParameter(_self).apiResult = Optional.bridgeJSLiftParameter(valueIsSome, valueCaseId) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_SwiftCounter_deinit") -@_cdecl("bjs_SwiftCounter_deinit") -public func _bjs_SwiftCounter_deinit(pointer: UnsafeMutableRawPointer) { - Unmanaged.fromOpaque(pointer).release() +@_expose(wasm, "bjs_SwiftDataProcessor_deinit") +@_cdecl("bjs_SwiftDataProcessor_deinit") +public func _bjs_SwiftDataProcessor_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() } -extension SwiftCounter: ConvertibleToJSValue, _BridgedSwiftHeapObject { +extension SwiftDataProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftCounter_wrap") - func _bjs_SwiftCounter_wrap(_: UnsafeMutableRawPointer) -> Int32 + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftDataProcessor_wrap") + func _bjs_SwiftDataProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 #else - func _bjs_SwiftCounter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + func _bjs_SwiftDataProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif - return .object(JSObject(id: UInt32(bitPattern: _bjs_SwiftCounter_wrap(Unmanaged.passRetained(self).toOpaque())))) + return .object(JSObject(id: UInt32(bitPattern: _bjs_SwiftDataProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) } } \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index f97beee6b..cc3807494 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -1165,7 +1165,7 @@ }, { "constructor" : { - "abiName" : "bjs_CounterManager_init", + "abiName" : "bjs_DataProcessorManager_init", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1173,11 +1173,11 @@ }, "parameters" : [ { - "label" : "counter", - "name" : "counter", + "label" : "processor", + "name" : "processor", "type" : { "swiftProtocol" : { - "_0" : "Counter" + "_0" : "DataProcessor" } } } @@ -1185,7 +1185,7 @@ }, "methods" : [ { - "abiName" : "bjs_CounterManager_incrementByAmount", + "abiName" : "bjs_DataProcessorManager_incrementByAmount", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1210,13 +1210,13 @@ } }, { - "abiName" : "bjs_CounterManager_setCounterLabel", + "abiName" : "bjs_DataProcessorManager_setProcessorLabel", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "setCounterLabel", + "name" : "setProcessorLabel", "parameters" : [ { "label" : "_", @@ -1244,13 +1244,13 @@ } }, { - "abiName" : "bjs_CounterManager_isCounterEven", + "abiName" : "bjs_DataProcessorManager_isProcessorEven", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "isCounterEven", + "name" : "isProcessorEven", "parameters" : [ ], @@ -1261,13 +1261,13 @@ } }, { - "abiName" : "bjs_CounterManager_getCounterLabel", + "abiName" : "bjs_DataProcessorManager_getProcessorLabel", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "getCounterLabel", + "name" : "getProcessorLabel", "parameters" : [ ], @@ -1278,7 +1278,7 @@ } }, { - "abiName" : "bjs_CounterManager_getCurrentValue", + "abiName" : "bjs_DataProcessorManager_getCurrentValue", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1295,7 +1295,7 @@ } }, { - "abiName" : "bjs_CounterManager_incrementBoth", + "abiName" : "bjs_DataProcessorManager_incrementBoth", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1312,7 +1312,7 @@ } }, { - "abiName" : "bjs_CounterManager_getBackupValue", + "abiName" : "bjs_DataProcessorManager_getBackupValue", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1333,7 +1333,7 @@ } }, { - "abiName" : "bjs_CounterManager_hasBackup", + "abiName" : "bjs_DataProcessorManager_hasBackup", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1350,38 +1350,38 @@ } } ], - "name" : "CounterManager", + "name" : "DataProcessorManager", "properties" : [ { "isReadonly" : false, "isStatic" : false, - "name" : "counter", + "name" : "processor", "type" : { "swiftProtocol" : { - "_0" : "Counter" + "_0" : "DataProcessor" } } }, { "isReadonly" : false, "isStatic" : false, - "name" : "backupCounter", + "name" : "backupProcessor", "type" : { "optional" : { "_0" : { "swiftProtocol" : { - "_0" : "Counter" + "_0" : "DataProcessor" } } } } } ], - "swiftCallName" : "CounterManager" + "swiftCallName" : "DataProcessorManager" }, { "constructor" : { - "abiName" : "bjs_SwiftCounter_init", + "abiName" : "bjs_SwiftDataProcessor_init", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1393,7 +1393,7 @@ }, "methods" : [ { - "abiName" : "bjs_SwiftCounter_increment", + "abiName" : "bjs_SwiftDataProcessor_increment", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1418,7 +1418,7 @@ } }, { - "abiName" : "bjs_SwiftCounter_getValue", + "abiName" : "bjs_SwiftDataProcessor_getValue", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1435,7 +1435,7 @@ } }, { - "abiName" : "bjs_SwiftCounter_setLabelElements", + "abiName" : "bjs_SwiftDataProcessor_setLabelElements", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1469,7 +1469,7 @@ } }, { - "abiName" : "bjs_SwiftCounter_getLabel", + "abiName" : "bjs_SwiftDataProcessor_getLabel", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1486,7 +1486,7 @@ } }, { - "abiName" : "bjs_SwiftCounter_isEven", + "abiName" : "bjs_SwiftDataProcessor_isEven", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1503,7 +1503,7 @@ } }, { - "abiName" : "bjs_SwiftCounter_processGreeter", + "abiName" : "bjs_SwiftDataProcessor_processGreeter", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1528,7 +1528,7 @@ } }, { - "abiName" : "bjs_SwiftCounter_createGreeter", + "abiName" : "bjs_SwiftDataProcessor_createGreeter", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1545,7 +1545,7 @@ } }, { - "abiName" : "bjs_SwiftCounter_processOptionalGreeter", + "abiName" : "bjs_SwiftDataProcessor_processOptionalGreeter", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1574,7 +1574,7 @@ } }, { - "abiName" : "bjs_SwiftCounter_createOptionalGreeter", + "abiName" : "bjs_SwiftDataProcessor_createOptionalGreeter", "effects" : { "isAsync" : false, "isStatic" : false, @@ -1593,9 +1593,51 @@ } } } + }, + { + "abiName" : "bjs_SwiftDataProcessor_handleAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "handleAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_getAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getAPIResult", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } } ], - "name" : "SwiftCounter", + "name" : "SwiftDataProcessor", "properties" : [ { "isReadonly" : false, @@ -1630,9 +1672,23 @@ } } } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "apiResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } } ], - "swiftCallName" : "SwiftCounter" + "swiftCallName" : "SwiftDataProcessor" } ], "enums" : [ @@ -5911,7 +5967,7 @@ { "methods" : [ { - "abiName" : "bjs_Counter_increment", + "abiName" : "bjs_DataProcessor_increment", "effects" : { "isAsync" : false, "isStatic" : false, @@ -5936,7 +5992,7 @@ } }, { - "abiName" : "bjs_Counter_getValue", + "abiName" : "bjs_DataProcessor_getValue", "effects" : { "isAsync" : false, "isStatic" : false, @@ -5953,7 +6009,7 @@ } }, { - "abiName" : "bjs_Counter_setLabelElements", + "abiName" : "bjs_DataProcessor_setLabelElements", "effects" : { "isAsync" : false, "isStatic" : false, @@ -5987,7 +6043,7 @@ } }, { - "abiName" : "bjs_Counter_getLabel", + "abiName" : "bjs_DataProcessor_getLabel", "effects" : { "isAsync" : false, "isStatic" : false, @@ -6004,7 +6060,7 @@ } }, { - "abiName" : "bjs_Counter_isEven", + "abiName" : "bjs_DataProcessor_isEven", "effects" : { "isAsync" : false, "isStatic" : false, @@ -6021,7 +6077,7 @@ } }, { - "abiName" : "bjs_Counter_processGreeter", + "abiName" : "bjs_DataProcessor_processGreeter", "effects" : { "isAsync" : false, "isStatic" : false, @@ -6046,7 +6102,7 @@ } }, { - "abiName" : "bjs_Counter_createGreeter", + "abiName" : "bjs_DataProcessor_createGreeter", "effects" : { "isAsync" : false, "isStatic" : false, @@ -6063,7 +6119,7 @@ } }, { - "abiName" : "bjs_Counter_processOptionalGreeter", + "abiName" : "bjs_DataProcessor_processOptionalGreeter", "effects" : { "isAsync" : false, "isStatic" : false, @@ -6092,7 +6148,7 @@ } }, { - "abiName" : "bjs_Counter_createOptionalGreeter", + "abiName" : "bjs_DataProcessor_createOptionalGreeter", "effects" : { "isAsync" : false, "isStatic" : false, @@ -6111,9 +6167,51 @@ } } } + }, + { + "abiName" : "bjs_DataProcessor_handleAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "handleAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_getAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getAPIResult", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } } ], - "name" : "Counter", + "name" : "DataProcessor", "properties" : [ { "isReadonly" : false, @@ -6145,6 +6243,19 @@ } } } + }, + { + "isReadonly" : false, + "name" : "apiResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } } ] } diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 73bc7279f..cb67a6a70 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -809,160 +809,185 @@ function setupTestGlobals(global) { /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ function testProtocolSupport(exports) { - let counterValue = 0; - let counterLabel = ""; - const jsCounter = { + let processorValue = 0; + let processorLabel = ""; + let apiResultValue = null; + const jsProcessor = { count: 0, - name: "JSCounter", + name: "JSProcessor", optionalTag: null, - increment(amount) { counterValue += amount; this.count += amount; }, - getValue() { return counterValue; }, - setLabelElements(labelPrefix, labelSuffix) { counterLabel = labelPrefix + labelSuffix; }, - getLabel() { return counterLabel; }, - isEven() { return counterValue % 2 === 0; }, - processGreeter(greeter) { return `JSCounter processed: ${greeter.greet()}`; }, - createGreeter() { return new exports.Greeter("JSCounterGreeter"); }, + apiResult: null, + increment(amount) { processorValue += amount; this.count += amount; }, + getValue() { return processorValue; }, + setLabelElements(labelPrefix, labelSuffix) { processorLabel = labelPrefix + labelSuffix; }, + getLabel() { return processorLabel; }, + isEven() { return processorValue % 2 === 0; }, + processGreeter(greeter) { return `JSProcessor processed: ${greeter.greet()}`; }, + createGreeter() { return new exports.Greeter("JSProcessorGreeter"); }, processOptionalGreeter(greeter) { - return greeter ? `JSCounter processed optional: ${greeter.greet()}` : "JSCounter received null"; + return greeter ? `JSProcessor processed optional: ${greeter.greet()}` : "JSProcessor received null"; }, - createOptionalGreeter() { return new exports.Greeter("JSOptionalGreeter"); } + createOptionalGreeter() { return new exports.Greeter("JSOptionalGreeter"); }, + handleAPIResult(result) { apiResultValue = result; }, + getAPIResult() { return apiResultValue; } }; - const manager = new exports.CounterManager(jsCounter); + const manager = new exports.DataProcessorManager(jsProcessor); - assert.equal(jsCounter.count, 0); - assert.equal(jsCounter.name, "JSCounter"); + assert.equal(jsProcessor.count, 0); + assert.equal(jsProcessor.name, "JSProcessor"); manager.incrementByAmount(4); assert.equal(manager.getCurrentValue(), 4); - assert.equal(jsCounter.count, 4); + assert.equal(jsProcessor.count, 4); - manager.setCounterLabel("Test", "Label"); - assert.equal(manager.getCounterLabel(), "TestLabel"); - assert.equal(jsCounter.getLabel(), "TestLabel"); + manager.setProcessorLabel("Test", "Label"); + assert.equal(manager.getProcessorLabel(), "TestLabel"); + assert.equal(jsProcessor.getLabel(), "TestLabel"); - assert.equal(manager.isCounterEven(), true); + assert.equal(manager.isProcessorEven(), true); manager.incrementByAmount(1); - assert.equal(manager.isCounterEven(), false); - assert.equal(jsCounter.isEven(), false); + assert.equal(manager.isProcessorEven(), false); + assert.equal(jsProcessor.isEven(), false); - jsCounter.increment(3); - assert.equal(jsCounter.getValue(), 8); + jsProcessor.increment(3); + assert.equal(jsProcessor.getValue(), 8); manager.release(); - const swiftCounter = new exports.SwiftCounter(); - const swiftManager = new exports.CounterManager(swiftCounter); + const swiftProcessor = new exports.SwiftDataProcessor(); + const swiftManager = new exports.DataProcessorManager(swiftProcessor); - assert.equal(swiftCounter.count, 0); - assert.equal(swiftCounter.name, "SwiftCounter"); + assert.equal(swiftProcessor.count, 0); + assert.equal(swiftProcessor.name, "SwiftDataProcessor"); swiftManager.incrementByAmount(10); assert.equal(swiftManager.getCurrentValue(), 10); - assert.equal(swiftCounter.count, 10); + assert.equal(swiftProcessor.count, 10); - swiftManager.setCounterLabel("Swift", "Label"); - assert.equal(swiftManager.getCounterLabel(), "SwiftLabel"); + swiftManager.setProcessorLabel("Swift", "Label"); + assert.equal(swiftManager.getProcessorLabel(), "SwiftLabel"); - swiftCounter.increment(5); - assert.equal(swiftCounter.getValue(), 15); - assert.equal(swiftCounter.count, 15); + swiftProcessor.increment(5); + assert.equal(swiftProcessor.getValue(), 15); + assert.equal(swiftProcessor.count, 15); - swiftCounter.count = 100; - assert.equal(swiftCounter.count, 100); - assert.equal(swiftCounter.getValue(), 100); + swiftProcessor.count = 100; + assert.equal(swiftProcessor.count, 100); + assert.equal(swiftProcessor.getValue(), 100); const testGreeter = new exports.Greeter("TestUser"); - const jsResult = jsCounter.processGreeter(testGreeter); - assert.equal(jsResult, "JSCounter processed: Hello, TestUser!"); + const jsResult = jsProcessor.processGreeter(testGreeter); + assert.equal(jsResult, "JSProcessor processed: Hello, TestUser!"); - const swiftResult = swiftCounter.processGreeter(testGreeter); - assert.equal(swiftResult, "SwiftCounter processed: Hello, TestUser!"); + const swiftResult = swiftProcessor.processGreeter(testGreeter); + assert.equal(swiftResult, "SwiftProcessor processed: Hello, TestUser!"); // Test swiftHeapObject return from protocol methods - const jsCreatedGreeter = jsCounter.createGreeter(); - assert.equal(jsCreatedGreeter.name, "JSCounterGreeter"); - assert.equal(jsCreatedGreeter.greet(), "Hello, JSCounterGreeter!"); + const jsCreatedGreeter = jsProcessor.createGreeter(); + assert.equal(jsCreatedGreeter.name, "JSProcessorGreeter"); + assert.equal(jsCreatedGreeter.greet(), "Hello, JSProcessorGreeter!"); jsCreatedGreeter.release(); - const swiftCreatedGreeter = swiftCounter.createGreeter(); - assert.equal(swiftCreatedGreeter.name, "CounterGreeter"); - assert.equal(swiftCreatedGreeter.greet(), "Hello, CounterGreeter!"); + const swiftCreatedGreeter = swiftProcessor.createGreeter(); + assert.equal(swiftCreatedGreeter.name, "ProcessorGreeter"); + assert.equal(swiftCreatedGreeter.greet(), "Hello, ProcessorGreeter!"); swiftCreatedGreeter.release(); const optGreeterTest = new exports.Greeter("OptionalTest"); - assert.equal(jsCounter.processOptionalGreeter(optGreeterTest), "JSCounter processed optional: Hello, OptionalTest!"); - assert.equal(jsCounter.processOptionalGreeter(null), "JSCounter received null"); - assert.equal(swiftCounter.processOptionalGreeter(optGreeterTest), "SwiftCounter processed optional: Hello, OptionalTest!"); - assert.equal(swiftCounter.processOptionalGreeter(null), "SwiftCounter received nil"); + assert.equal(jsProcessor.processOptionalGreeter(optGreeterTest), "JSProcessor processed optional: Hello, OptionalTest!"); + assert.equal(jsProcessor.processOptionalGreeter(null), "JSProcessor received null"); + assert.equal(swiftProcessor.processOptionalGreeter(optGreeterTest), "SwiftProcessor processed optional: Hello, OptionalTest!"); + assert.equal(swiftProcessor.processOptionalGreeter(null), "SwiftProcessor received nil"); optGreeterTest.release(); - const jsOptGreeter = jsCounter.createOptionalGreeter(); + const jsOptGreeter = jsProcessor.createOptionalGreeter(); assert.notEqual(jsOptGreeter, null); assert.equal(jsOptGreeter.name, "JSOptionalGreeter"); jsOptGreeter.release(); - const swiftOptGreeter = swiftCounter.createOptionalGreeter(); + const swiftOptGreeter = swiftProcessor.createOptionalGreeter(); assert.notEqual(swiftOptGreeter, null); - assert.equal(swiftOptGreeter.name, "OptionalCounterGreeter"); + assert.equal(swiftOptGreeter.name, "OptionalProcessorGreeter"); swiftOptGreeter.release(); - assert.equal(jsCounter.optionalTag, null); - jsCounter.optionalTag = "test-tag"; - assert.equal(jsCounter.optionalTag, "test-tag"); - jsCounter.optionalTag = null; - assert.equal(jsCounter.optionalTag, null); + assert.equal(jsProcessor.optionalTag, null); + jsProcessor.optionalTag = "test-tag"; + assert.equal(jsProcessor.optionalTag, "test-tag"); + jsProcessor.optionalTag = null; + assert.equal(jsProcessor.optionalTag, null); + + const successResult = { tag: exports.Result.Tag.Success, param0: "Operation completed" }; + const failureResult = { tag: exports.Result.Tag.Failure, param0: 500 }; + + jsProcessor.handleAPIResult(successResult); + assert.deepEqual(jsProcessor.getAPIResult(), successResult); + + jsProcessor.handleAPIResult(failureResult); + assert.deepEqual(jsProcessor.getAPIResult(), failureResult); + + assert.equal(jsProcessor.apiResult, null); + jsProcessor.apiResult = successResult; + assert.deepEqual(jsProcessor.apiResult, successResult); + jsProcessor.apiResult = null; + assert.equal(jsProcessor.apiResult, null); testGreeter.release(); swiftManager.release(); - swiftCounter.release(); + swiftProcessor.release(); - let optionalCounterValue = 100; - let optionalCounterLabel = "optional"; - const optionalCounter = { + let optionalProcessorValue = 100; + let optionalProcessorLabel = "optional"; + const optionalProcessor = { count: 100, - name: "OptionalCounter", + name: "OptionalProcessor", optionalTag: "optional-tag", - increment(amount) { optionalCounterValue += amount; this.count += amount; }, - getValue() { return optionalCounterValue; }, - setLabelElements(labelPrefix, labelSuffix) { optionalCounterLabel = labelPrefix + labelSuffix; }, - getLabel() { return optionalCounterLabel; }, - isEven() { return optionalCounterValue % 2 === 0; }, - processGreeter(greeter) { return `OptionalCounter processed: ${greeter.greet()}`; }, - createGreeter() { return new exports.Greeter("OptionalCounterGreeter"); }, + apiResult: null, + increment(amount) { optionalProcessorValue += amount; this.count += amount; }, + getValue() { return optionalProcessorValue; }, + setLabelElements(labelPrefix, labelSuffix) { optionalProcessorLabel = labelPrefix + labelSuffix; }, + getLabel() { return optionalProcessorLabel; }, + isEven() { return optionalProcessorValue % 2 === 0; }, + processGreeter(greeter) { return `OptionalProcessor processed: ${greeter.greet()}`; }, + createGreeter() { return new exports.Greeter("OptionalProcessorGreeter"); }, processOptionalGreeter(greeter) { - return greeter ? `OptionalCounter processed optional: ${greeter.greet()}` : "OptionalCounter received null"; + return greeter ? `OptionalProcessor processed optional: ${greeter.greet()}` : "OptionalProcessor received null"; }, - createOptionalGreeter() { return null; } + createOptionalGreeter() { return null; }, + handleAPIResult(result) { }, + getAPIResult() { return { tag: exports.APIResult.Tag.Info }; } }; - let mainCounterValue = 0; - let mainCounterLabel = "main"; - const mainCounter = { + let mainProcessorValue = 0; + let mainProcessorLabel = "main"; + const mainProcessor = { count: 0, - name: "MainCounter", + name: "MainProcessor", optionalTag: null, - increment(amount) { mainCounterValue += amount; this.count += amount; }, - getValue() { return mainCounterValue; }, - setLabelElements(labelPrefix, labelSuffix) { mainCounterLabel = labelPrefix + labelSuffix; }, - getLabel() { return mainCounterLabel; }, - isEven() { return mainCounterValue % 2 === 0; }, - processGreeter(greeter) { return `MainCounter processed: ${greeter.greet()}`; }, - createGreeter() { return new exports.Greeter("MainCounterGreeter"); }, + apiResult: null, + increment(amount) { mainProcessorValue += amount; this.count += amount; }, + getValue() { return mainProcessorValue; }, + setLabelElements(labelPrefix, labelSuffix) { mainProcessorLabel = labelPrefix + labelSuffix; }, + getLabel() { return mainProcessorLabel; }, + isEven() { return mainProcessorValue % 2 === 0; }, + processGreeter(greeter) { return `MainProcessor processed: ${greeter.greet()}`; }, + createGreeter() { return new exports.Greeter("MainProcessorGreeter"); }, processOptionalGreeter(greeter) { - return greeter ? `MainCounter processed optional: ${greeter.greet()}` : "MainCounter received null"; + return greeter ? `MainProcessor processed optional: ${greeter.greet()}` : "MainProcessor received null"; }, - createOptionalGreeter() { return new exports.Greeter("MainOptionalGreeter"); } + createOptionalGreeter() { return new exports.Greeter("MainOptionalGreeter"); }, + handleAPIResult(result) { }, + getAPIResult() { return { tag: exports.APIResult.Tag.Info }; } }; - const managerWithOptional = new exports.CounterManager(mainCounter); + const managerWithOptional = new exports.DataProcessorManager(mainProcessor); - assert.equal(managerWithOptional.backupCounter, null); + assert.equal(managerWithOptional.backupProcessor, null); assert.equal(managerWithOptional.hasBackup(), false); assert.equal(managerWithOptional.getBackupValue(), null); - managerWithOptional.backupCounter = optionalCounter; - assert.notEqual(managerWithOptional.backupCounter, null); + managerWithOptional.backupProcessor = optionalProcessor; + assert.notEqual(managerWithOptional.backupProcessor, null); assert.equal(managerWithOptional.hasBackup(), true); managerWithOptional.incrementBoth(); @@ -973,23 +998,23 @@ function testProtocolSupport(exports) { assert.equal(managerWithOptional.getCurrentValue(), 2); assert.equal(managerWithOptional.getBackupValue(), 102); - managerWithOptional.backupCounter = null; - assert.equal(managerWithOptional.backupCounter, null); + managerWithOptional.backupProcessor = null; + assert.equal(managerWithOptional.backupProcessor, null); assert.equal(managerWithOptional.hasBackup(), false); managerWithOptional.incrementBoth(); assert.equal(managerWithOptional.getCurrentValue(), 3); assert.equal(managerWithOptional.getBackupValue(), null); - const swiftBackupCounter = new exports.SwiftCounter(); - swiftBackupCounter.increment(1); - managerWithOptional.backupCounter = swiftBackupCounter; + const swiftBackupProcessor = new exports.SwiftDataProcessor(); + swiftBackupProcessor.increment(1); + managerWithOptional.backupProcessor = swiftBackupProcessor; assert.equal(managerWithOptional.hasBackup(), true); assert.equal(managerWithOptional.getBackupValue(), 1); - assert.equal(swiftBackupCounter.count, 1); - assert.equal(swiftBackupCounter.name, "SwiftCounter"); + assert.equal(swiftBackupProcessor.count, 1); + assert.equal(swiftBackupProcessor.name, "SwiftDataProcessor"); managerWithOptional.release(); - swiftBackupCounter.release(); + swiftBackupProcessor.release(); } From e7e1b79b683b400209876d6ae254afa466ae62df Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 16 Oct 2025 14:06:22 +0200 Subject: [PATCH 017/252] BridgeJS: Fix for side channelling values on properties getters / setters --- .../Generated/BridgeJS.ExportSwift.swift | 114 +++- .../Sources/BridgeJSCore/ExportSwift.swift | 134 +++-- .../Sources/BridgeJSCore/ImportTS.swift | 24 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 92 ++++ .../Sources/BridgeJSLink/JSGlueGen.swift | 173 +++--- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 4 +- .../BridgeJSToolTests/Inputs/Protocol.swift | 23 +- .../ArrayParameter.Import.js | 35 ++ .../BridgeJSLinkTests/Async.Export.js | 35 ++ .../BridgeJSLinkTests/Async.Import.js | 35 ++ .../DefaultParameters.Export.js | 35 ++ .../EnumAssociatedValue.Export.js | 35 ++ .../BridgeJSLinkTests/EnumCase.Export.js | 35 ++ .../BridgeJSLinkTests/EnumNamespace.Export.js | 35 ++ .../BridgeJSLinkTests/EnumRawType.Export.js | 35 ++ .../BridgeJSLinkTests/Interface.Import.js | 35 ++ .../InvalidPropertyNames.Import.js | 35 ++ .../MultipleImportedTypes.Import.js | 35 ++ .../BridgeJSLinkTests/Namespaces.Export.js | 35 ++ .../BridgeJSLinkTests/Optionals.Export.js | 35 ++ .../PrimitiveParameters.Export.js | 35 ++ .../PrimitiveParameters.Import.js | 35 ++ .../PrimitiveReturn.Export.js | 35 ++ .../PrimitiveReturn.Import.js | 35 ++ .../BridgeJSLinkTests/PropertyTypes.Export.js | 35 ++ .../BridgeJSLinkTests/Protocol.Export.d.ts | 31 +- .../BridgeJSLinkTests/Protocol.Export.js | 181 ++++++- .../StaticFunctions.Export.js | 35 ++ .../StaticProperties.Export.js | 35 ++ .../StringParameter.Export.js | 35 ++ .../StringParameter.Import.js | 35 ++ .../BridgeJSLinkTests/StringReturn.Export.js | 35 ++ .../BridgeJSLinkTests/StringReturn.Import.js | 35 ++ .../BridgeJSLinkTests/SwiftClass.Export.js | 35 ++ .../TS2SkeletonLike.Import.js | 35 ++ .../BridgeJSLinkTests/Throws.Export.js | 35 ++ .../BridgeJSLinkTests/TypeAlias.Import.js | 35 ++ .../TypeScriptClass.Import.js | 35 ++ .../VoidParameterVoidReturn.Export.js | 35 ++ .../VoidParameterVoidReturn.Import.js | 35 ++ .../ExportSwiftTests/DefaultParameters.swift | 4 +- .../EnumAssociatedValue.swift | 25 +- .../ExportSwiftTests/EnumCase.swift | 16 +- .../ExportSwiftTests/EnumNamespace.swift | 8 +- .../ExportSwiftTests/Protocol.json | 143 ++++- .../ExportSwiftTests/Protocol.swift | 175 ++++++- .../ExportSwiftTests/StaticFunctions.swift | 9 +- .../ExportSwiftTests/StaticProperties.swift | 4 +- .../JavaScriptKit/BridgeJSInstrincics.swift | 461 ++++++++++------ .../Exporting-Swift-Protocols.md | 5 +- .../BridgeJSRuntimeTests/ExportAPITests.swift | 70 ++- .../Generated/BridgeJS.ExportSwift.swift | 408 +++++++++++++-- .../JavaScript/BridgeJS.ExportSwift.json | 494 +++++++++++++++++- Tests/prelude.mjs | 319 ++++++----- 54 files changed, 3417 insertions(+), 585 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift b/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift index d02d0fae8..ab0cbb197 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift @@ -7,7 +7,7 @@ @_spi(BridgeJS) import JavaScriptKit extension APIResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) @@ -26,6 +26,43 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .failure(let param0): + _swift_js_push_int(Int32(param0)) + return Int32(1) + case .flag(let param0): + _swift_js_push_int(param0 ? 1 : 0) + return Int32(2) + case .rate(let param0): + _swift_js_push_f32(param0) + return Int32(3) + case .precise(let param0): + _swift_js_push_f64(param0) + return Int32(4) + case .info: + return Int32(5) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { + return _bridgeJSLiftFromCaseId(caseId) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): @@ -53,7 +90,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } extension ComplexResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> ComplexResult { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) @@ -74,6 +111,79 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } } + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .error(let param0, let param1): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(param1)) + return Int32(1) + case .location(let param0, let param1, let param2): + _swift_js_push_f64(param0) + _swift_js_push_f64(param1) + var __bjs_param2 = param2 + __bjs_param2.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(2) + case .status(let param0, let param1, let param2): + _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_int(Int32(param1)) + var __bjs_param2 = param2 + __bjs_param2.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(3) + case .coordinates(let param0, let param1, let param2): + _swift_js_push_f64(param0) + _swift_js_push_f64(param1) + _swift_js_push_f64(param2) + return Int32(4) + case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): + _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_int(param1 ? 1 : 0) + _swift_js_push_int(Int32(param2)) + _swift_js_push_int(Int32(param3)) + _swift_js_push_f64(param4) + _swift_js_push_f64(param5) + var __bjs_param6 = param6 + __bjs_param6.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + var __bjs_param7 = param7 + __bjs_param7.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + var __bjs_param8 = param8 + __bjs_param8.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(5) + case .info: + return Int32(6) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> ComplexResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> ComplexResult { + return _bridgeJSLiftFromCaseId(caseId) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 7aa4503fa..4cdc8a3bc 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -588,7 +588,6 @@ public class ExportSwift { baseName: name, namespace: finalNamespace, staticContext: isStatic ? staticContext : nil, - operation: nil, className: classNameForABI ) @@ -1054,8 +1053,6 @@ public class ExportSwift { let abiName = ABINameGenerator.generateABIName( baseName: name, namespace: namespace, - staticContext: nil, - operation: nil, className: protocolName ) @@ -1167,6 +1164,8 @@ public class ExportSwift { } else { var numericExpr = element.rawValue?.value var isNegative = false + + // Check for prefix operator (for negative numbers) if let prefixExpr = numericExpr?.as(PrefixOperatorExprSyntax.self), prefixExpr.operator.text == "-" { @@ -1790,8 +1789,7 @@ public class ExportSwift { } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> \(raw: typeName) { - let caseId = _swift_js_pop_param_int32() + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> \(raw: typeName) { return _bridgeJSLiftFromCaseId(caseId) } @@ -1868,8 +1866,6 @@ public class ExportSwift { return cases } - /// Generates code to push associated value payloads to side channels - /// This helper is reused by both lowerParameter and lowerReturn to avoid duplication private func generatePayloadPushingCode( associatedValues: [AssociatedValue] ) -> [String] { @@ -2229,10 +2225,8 @@ public class ExportSwift { """ } - /// Generates an AnyProtocol wrapper struct for a protocol - /// /// Creates a struct that wraps a JSObject and implements protocol methods - /// by calling `@_extern(wasm)` functions that forward to JavaScript + /// by calling `@_extern(wasm)` functions that forward to JavaScript via JSObject ID func renderProtocolWrapper(protocol proto: ExportedProtocol) throws -> DeclSyntax { let wrapperName = "Any\(proto.name)" let protocolName = proto.name @@ -2253,57 +2247,73 @@ public class ExportSwift { var externParams: [String] = ["this: Int32"] for param in method.parameters { let loweringInfo = try param.type.loweringParameterInfo(context: .protocolExport) - assert( - loweringInfo.loweredParameters.count == 1, - "Protocol parameters must lower to a single WASM type" - ) - let (_, wasmType) = loweringInfo.loweredParameters[0] - externParams.append("\(param.name): \(wasmType.swiftType)") + for (paramName, wasmType) in loweringInfo.loweredParameters { + let fullParamName = + loweringInfo.loweredParameters.count > 1 + ? "\(param.name)\(paramName.capitalizedFirstLetter)" : param.name + externParams.append("\(fullParamName): \(wasmType.swiftType)") + } } + var preCallStatements: [String] = [] var callArgs: [String] = ["this: Int32(bitPattern: jsObject.id)"] for param in method.parameters { - callArgs.append("\(param.name): \(param.name).bridgeJSLowerParameter()") + let loweringInfo = try param.type.loweringParameterInfo(context: .protocolExport) + if case .optional = param.type, loweringInfo.loweredParameters.count > 1 { + let isSomeName = "\(param.name)\(loweringInfo.loweredParameters[0].name.capitalizedFirstLetter)" + let wrappedName = "\(param.name)\(loweringInfo.loweredParameters[1].name.capitalizedFirstLetter)" + preCallStatements.append( + "let (\(isSomeName), \(wrappedName)) = \(param.name).bridgeJSLowerParameterWithPresence()" + ) + callArgs.append("\(isSomeName): \(isSomeName)") + callArgs.append("\(wrappedName): \(wrappedName)") + } else { + callArgs.append("\(param.name): \(param.name).bridgeJSLowerParameter()") + } } let returnTypeStr: String let externReturnType: String let callCode: DeclSyntax + let preCallCode = preCallStatements.isEmpty ? "" : preCallStatements.joined(separator: "\n") + "\n" + if method.returnType == .void { returnTypeStr = "" externReturnType = "" callCode = """ - _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) + \(raw: preCallCode)_extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) """ } else { returnTypeStr = " -> \(method.returnType.swiftType)" - let liftingInfo = try method.returnType.liftingReturnInfo(context: .protocolExport) + let liftingInfo = try method.returnType.liftingReturnInfo( + context: .protocolExport + ) if case .optional = method.returnType { if let abiType = liftingInfo.valueToLift { externReturnType = " -> \(abiType.swiftType)" callCode = """ - let ret = _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) + \(raw: preCallCode)let ret = _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) return \(raw: method.returnType.swiftType).bridgeJSLiftReturn(ret) """ } else { externReturnType = "" callCode = """ - _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) + \(raw: preCallCode)_extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) return \(raw: method.returnType.swiftType).bridgeJSLiftReturn() """ } } else if let abiType = liftingInfo.valueToLift { externReturnType = " -> \(abiType.swiftType)" callCode = """ - let ret = _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) + \(raw: preCallCode)let ret = _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) return \(raw: method.returnType.swiftType).bridgeJSLiftReturn(ret) """ } else { externReturnType = "" callCode = """ - _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) + \(raw: preCallCode)_extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) return \(raw: method.returnType.swiftType).bridgeJSLiftReturn() """ } @@ -2352,73 +2362,106 @@ public class ExportSwift { ) throws -> DeclSyntax { let getterAbiName = ABINameGenerator.generateABIName( baseName: property.name, - namespace: nil, - staticContext: nil, operation: "get", className: protocolName ) let setterAbiName = ABINameGenerator.generateABIName( baseName: property.name, - namespace: nil, - staticContext: nil, operation: "set", className: protocolName ) - // Generate getter + let usesSideChannel: Bool + if case .optional(let wrappedType) = property.type { + switch wrappedType { + case .string: + usesSideChannel = true + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + usesSideChannel = true + default: + usesSideChannel = true + } + case .int, .float, .double: + usesSideChannel = true + case .bool, .caseEnum, .associatedValueEnum, .swiftHeapObject: + usesSideChannel = false + default: + usesSideChannel = false + } + } else { + usesSideChannel = false + } + let liftingInfo = try property.type.liftingReturnInfo(context: .protocolExport) let getterReturnType: String - let getterCallCode: String + let getterBody: String - if let abiType = liftingInfo.valueToLift { + if usesSideChannel { + // Optional case/raw enums use side-channel reading (Void return) + getterReturnType = "" + getterBody = """ + _extern_get(this: Int32(bitPattern: jsObject.id)) + return \(property.type.swiftType).bridgeJSLiftReturnFromSideChannel() + """ + } else if let abiType = liftingInfo.valueToLift { getterReturnType = " -> \(abiType.swiftType)" - getterCallCode = """ + getterBody = """ let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) return \(property.type.swiftType).bridgeJSLiftReturn(ret) """ } else { - // For String and other types that use tmpRetString getterReturnType = "" - getterCallCode = """ + getterBody = """ _extern_get(this: Int32(bitPattern: jsObject.id)) return \(property.type.swiftType).bridgeJSLiftReturn() """ } if property.isReadonly { - // Readonly property - only getter return """ var \(raw: property.name): \(raw: property.type.swiftType) { get { @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: getterAbiName)") func _extern_get(this: Int32)\(raw: getterReturnType) - \(raw: getterCallCode) + \(raw: getterBody) } } """ } else { - // Readwrite property - getter and setter let loweringInfo = try property.type.loweringParameterInfo(context: .protocolExport) - assert( - loweringInfo.loweredParameters.count == 1, - "Protocol property setters must lower to a single WASM parameter" - ) - let (paramName, wasmType) = loweringInfo.loweredParameters[0] - let setterParams = "this: Int32, \(paramName): \(wasmType.swiftType)" - let setterCallArgs = "this: Int32(bitPattern: jsObject.id), \(paramName): newValue.bridgeJSLowerParameter()" + let setterParams = + (["this: Int32"] + loweringInfo.loweredParameters.map { "\($0.name): \($0.type.swiftType)" }).joined( + separator: ", " + ) + + let setterBody: String + if case .optional = property.type, loweringInfo.loweredParameters.count > 1 { + let isSomeParam = loweringInfo.loweredParameters[0].name + let wrappedParam = loweringInfo.loweredParameters[1].name + setterBody = """ + let (\(isSomeParam), \(wrappedParam)) = newValue.bridgeJSLowerParameterWithPresence() + _extern_set(this: Int32(bitPattern: jsObject.id), \(isSomeParam): \(isSomeParam), \(wrappedParam): \(wrappedParam)) + """ + } else { + let paramName = loweringInfo.loweredParameters[0].name + setterBody = + "_extern_set(this: Int32(bitPattern: jsObject.id), \(paramName): newValue.bridgeJSLowerParameter())" + } return """ var \(raw: property.name): \(raw: property.type.swiftType) { get { @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: getterAbiName)") func _extern_get(this: Int32)\(raw: getterReturnType) - \(raw: getterCallCode) + \(raw: getterBody) } set { @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: setterAbiName)") func _extern_set(\(raw: setterParams)) - _extern_set(\(raw: setterCallArgs)) + \(raw: setterBody) } } """ @@ -2600,7 +2643,6 @@ extension BridgeType { throw BridgeJSCoreError("Namespace enums are not supported to pass as parameters") } } - } extension DeclModifierSyntax { diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 26e22e873..4589817d1 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -459,8 +459,8 @@ extension BridgeType { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") case .protocolExport: - let wasmType = rawType == .string ? WasmCoreType.i32 : (rawType.wasmCoreType ?? .i32) - return LoweringParameterInfo(loweredParameters: [("value", wasmType)]) + // For protocol export we return .i32 for String raw value type instead of nil + return LoweringParameterInfo(loweredParameters: [("value", rawType.wasmCoreType ?? .i32)]) } case .associatedValueEnum: switch context { @@ -477,11 +477,9 @@ extension BridgeType { throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") case .protocolExport: let wrappedInfo = try wrappedType.loweringParameterInfo(context: context) - guard wrappedInfo.loweredParameters.count == 1 else { - throw BridgeJSCoreError("Optional wrapped type must lower to single parameter") - } - let (_, wrappedWasmType) = wrappedInfo.loweredParameters[0] - return LoweringParameterInfo(loweredParameters: [("value", wrappedWasmType)]) + var params = [("isSome", WasmCoreType.i32)] + params.append(contentsOf: wrappedInfo.loweredParameters) + return LoweringParameterInfo(loweredParameters: params) } } } @@ -498,7 +496,9 @@ extension BridgeType { static let void = LiftingReturnInfo(valueToLift: nil) } - func liftingReturnInfo(context: BridgeContext = .importTS) throws -> LiftingReturnInfo { + func liftingReturnInfo( + context: BridgeContext = .importTS + ) throws -> LiftingReturnInfo { switch self { case .bool: return .bool case .int: return .int @@ -533,15 +533,15 @@ extension BridgeType { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") case .protocolExport: - let wasmType = rawType == .string ? WasmCoreType.i32 : (rawType.wasmCoreType ?? .i32) - return LiftingReturnInfo(valueToLift: wasmType) + // For protocol export we return .i32 for String raw value type instead of nil + return LiftingReturnInfo(valueToLift: rawType.wasmCoreType ?? .i32) } case .associatedValueEnum: switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") case .protocolExport: - return LiftingReturnInfo(valueToLift: nil) + return LiftingReturnInfo(valueToLift: .i32) } case .namespaceEnum: throw BridgeJSCoreError("Namespace enums cannot be used as return values") @@ -551,7 +551,7 @@ extension BridgeType { throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") case .protocolExport: let wrappedInfo = try wrappedType.liftingReturnInfo(context: context) - return wrappedInfo + return LiftingReturnInfo(valueToLift: wrappedInfo.valueToLift) } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 4445ddeb6..6abfd3057 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -589,6 +589,61 @@ struct BridgeJSLink { printer.write("}") } printer.write("}") + printer.write("bjs[\"swift_js_get_optional_int_presence\"] = function() {") + printer.indent { + printer.write("return \(JSGlueVariableScope.reservedStorageToReturnOptionalInt) != null ? 1 : 0;") + } + printer.write("}") + printer.write("bjs[\"swift_js_get_optional_int_value\"] = function() {") + printer.indent { + printer.write("const value = \(JSGlueVariableScope.reservedStorageToReturnOptionalInt);") + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = undefined;") + printer.write("return value;") + } + printer.write("}") + printer.write("bjs[\"swift_js_get_optional_string\"] = function() {") + printer.indent { + printer.write("const str = \(JSGlueVariableScope.reservedStorageToReturnString);") + printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = undefined;") + printer.write("if (str == null) {") + printer.indent { + printer.write("return -1;") + } + printer.write("} else {") + printer.indent { + printer.write("const bytes = \(JSGlueVariableScope.reservedTextEncoder).encode(str);") + printer.write("\(JSGlueVariableScope.reservedStorageToReturnBytes) = bytes;") + printer.write("return bytes.length;") + } + printer.write("}") + } + printer.write("}") + printer.write("bjs[\"swift_js_get_optional_float_presence\"] = function() {") + printer.indent { + printer.write("return \(JSGlueVariableScope.reservedStorageToReturnOptionalFloat) != null ? 1 : 0;") + } + printer.write("}") + printer.write("bjs[\"swift_js_get_optional_float_value\"] = function() {") + printer.indent { + printer.write("const value = \(JSGlueVariableScope.reservedStorageToReturnOptionalFloat);") + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalFloat) = undefined;") + printer.write("return value;") + } + printer.write("}") + printer.write("bjs[\"swift_js_get_optional_double_presence\"] = function() {") + printer.indent { + printer.write( + "return \(JSGlueVariableScope.reservedStorageToReturnOptionalDouble) != null ? 1 : 0;" + ) + } + printer.write("}") + printer.write("bjs[\"swift_js_get_optional_double_value\"] = function() {") + printer.indent { + printer.write("const value = \(JSGlueVariableScope.reservedStorageToReturnOptionalDouble);") + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalDouble) = undefined;") + printer.write("return value;") + } + printer.write("}") } } return printer @@ -1962,6 +2017,43 @@ extension BridgeJSLink { } func callPropertyGetter(name: String, returnType: BridgeType) throws -> String? { + if context == .protocolExport, case .optional(let wrappedType) = returnType { + let usesSideChannel: Bool + switch wrappedType { + case .string, .int, .float, .double, .jsObject, .swiftProtocol: + usesSideChannel = true + case .rawValueEnum: + usesSideChannel = true + case .bool, .caseEnum, .swiftHeapObject, .associatedValueEnum: + usesSideChannel = false + default: + usesSideChannel = false + } + + if usesSideChannel { + let resultVar = scope.variable("ret") + body.write( + "let \(resultVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(self).\(name);" + ) + + switch wrappedType { + case .string, .rawValueEnum(_, .string): + body.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(resultVar);") + case .int, .rawValueEnum(_, .int): + body.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(resultVar);") + case .float, .rawValueEnum(_, .float): + body.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalFloat) = \(resultVar);") + case .double, .rawValueEnum(_, .double): + body.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalDouble) = \(resultVar);") + case .jsObject, .swiftProtocol: + body.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(resultVar);") + default: + break + } + return nil // Side-channel types return nil (no direct return value) + } + } + return try call( callExpr: "\(JSGlueVariableScope.reservedSwift).memory.getObject(self).\(name)", returnType: returnType diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 453974716..9cdf9d72b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -263,21 +263,19 @@ struct IntrinsicJSFragment: Sendable { ) } - static func optionalLiftParameter(wrappedType: BridgeType, context: BridgeContext) throws -> IntrinsicJSFragment { + static func optionalLiftParameter(wrappedType: BridgeType) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["isSome", "wrappedValue"], printCode: { arguments, scope, printer, cleanupCode in let isSome = arguments[0] let wrappedValue = arguments[1] - let resultExpr: String + switch wrappedType { case .int, .float, .double, .caseEnum: resultExpr = "\(isSome) ? \(wrappedValue) : null" - case .bool: resultExpr = "\(isSome) ? \(wrappedValue) !== 0 : null" - case .string: let objectLabel = scope.variable("obj") printer.write("let \(objectLabel);") @@ -290,14 +288,11 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") resultExpr = "\(isSome) ? \(objectLabel) : null" - case .swiftHeapObject(let name): resultExpr = "\(isSome) ? \(name).__construct(\(wrappedValue)) : null" - case .jsObject: resultExpr = "\(isSome) ? \(JSGlueVariableScope.reservedSwift).memory.getObject(\(wrappedValue)) : null" - case .rawValueEnum(_, let rawType): switch rawType { case .string: @@ -317,7 +312,18 @@ struct IntrinsicJSFragment: Sendable { default: resultExpr = "\(isSome) ? \(wrappedValue) : null" } - + case .associatedValueEnum(let fullName): + let base = fullName.components(separatedBy: ".").last ?? fullName + let enumVar = scope.variable("enumValue") + printer.write("let \(enumVar);") + printer.write("if (\(isSome)) {") + printer.indent { + printer.write( + "\(enumVar) = enumHelpers.\(base).raise(\(wrappedValue), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + ) + } + printer.write("}") + resultExpr = "\(isSome) ? \(enumVar) : null" default: resultExpr = "\(isSome) ? \(wrappedValue) : null" } @@ -371,6 +377,9 @@ struct IntrinsicJSFragment: Sendable { cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") return ["+\(isSomeVar)", "\(isSomeVar) ? \(caseIdVar) : 0"] + case .rawValueEnum: + // Raw value enums with optional - falls through to handle based on raw type + return ["+\(isSomeVar)", "\(isSomeVar) ? \(value) : 0"] default: switch wrappedType { case .swiftHeapObject: @@ -489,11 +498,9 @@ struct IntrinsicJSFragment: Sendable { static func optionalLowerReturn(wrappedType: BridgeType) throws -> IntrinsicJSFragment { switch wrappedType { - case .bool, .int, .float, .double, .string, .swiftHeapObject, .jsObject, .swiftProtocol, .caseEnum, - .rawValueEnum, .associatedValueEnum: - break case .void, .optional, .namespaceEnum: throw BridgeJSLinkError(message: "Unsupported optional wrapped type for protocol export: \(wrappedType)") + default: break } return IntrinsicJSFragment( @@ -501,7 +508,6 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanupCode in let value = arguments[0] let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(value) != null;") switch wrappedType { @@ -509,10 +515,12 @@ struct IntrinsicJSFragment: Sendable { printer.write( "bjs[\"swift_js_return_optional_bool\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) ? 1 : 0) : 0);" ) - case .int, .caseEnum: + case .int: printer.write( "bjs[\"swift_js_return_optional_int\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) | 0) : 0);" ) + case .caseEnum: + printer.write("return \(isSomeVar) ? (\(value) | 0) : -1;") case .float: printer.write( "bjs[\"swift_js_return_optional_float\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? Math.fround(\(value)) : 0.0);" @@ -537,9 +545,6 @@ struct IntrinsicJSFragment: Sendable { printer.write("return -1;") } printer.write("}") - - case .swiftHeapObject: - printer.write("return \(isSomeVar) ? \(value).pointer : 0;") case .jsObject, .swiftProtocol: let idVar = scope.variable("id") printer.write("let \(idVar) = 0;") @@ -561,30 +566,31 @@ struct IntrinsicJSFragment: Sendable { printer.write( "bjs[\"swift_js_return_optional_string\"](1, \(bytesVar), \(bytesVar).length);" ) - printer.write("return \(bytesVar).length;") } printer.write("} else {") printer.indent { printer.write("bjs[\"swift_js_return_optional_string\"](0, 0, 0);") - printer.write("return -1;") } printer.write("}") - case .bool: - printer.write( - "bjs[\"swift_js_return_optional_bool\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) ? 1 : 0) : 0);" - ) - case .float: - printer.write( - "bjs[\"swift_js_return_optional_float\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? Math.fround(\(value)) : 0.0);" - ) - case .double: - printer.write( - "bjs[\"swift_js_return_optional_double\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? \(value) : 0.0);" - ) default: - printer.write( - "bjs[\"swift_js_return_optional_int\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) | 0) : 0);" - ) + switch rawType { + case .bool: + printer.write( + "bjs[\"swift_js_return_optional_bool\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) ? 1 : 0) : 0);" + ) + case .float: + printer.write( + "bjs[\"swift_js_return_optional_float\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? Math.fround(\(value)) : 0.0);" + ) + case .double: + printer.write( + "bjs[\"swift_js_return_optional_double\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? \(value) : 0.0);" + ) + default: + printer.write( + "bjs[\"swift_js_return_optional_int\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) | 0) : 0);" + ) + } } case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName @@ -595,14 +601,14 @@ struct IntrinsicJSFragment: Sendable { printer.write( "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(value));" ) - cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") - printer.write("bjs[\"swift_js_return_optional_int\"](1, \(caseIdVar));") + printer.write("return \(caseIdVar);") } printer.write("} else {") printer.indent { - printer.write("bjs[\"swift_js_return_optional_int\"](0, 0);") + printer.write("return -1;") } printer.write("}") + cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") default: () } @@ -671,10 +677,6 @@ struct IntrinsicJSFragment: Sendable { // MARK: - ImportedJS /// Returns a fragment that lifts Wasm core values to JS values for parameters - /// - /// - Parameters: - /// - type: The bridge type to lift - /// - context: The bridge context (defaults to .importTS for backward compatibility) static func liftParameter(type: BridgeType, context: BridgeContext = .importTS) throws -> IntrinsicJSFragment { switch type { case .int, .float, .double: return .identity @@ -682,12 +684,14 @@ struct IntrinsicJSFragment: Sendable { case .string: return .stringLiftParameter case .jsObject: return .jsObjectLiftParameter case .swiftHeapObject(let name): - guard context == .protocolExport else { + switch context { + case .importTS: throw BridgeJSLinkError( message: "swiftHeapObject '\(name)' can only be used in protocol exports, not in \(context)" ) + case .protocolExport: + return .swiftHeapObjectLiftParameter(name) } - return .swiftHeapObjectLiftParameter(name) case .swiftProtocol: return .jsObjectLiftParameter case .void: throw BridgeJSLinkError( @@ -700,8 +704,7 @@ struct IntrinsicJSFragment: Sendable { message: "Optional types are not supported for imported JS functions: \(wrappedType)" ) case .protocolExport: - // Protocol exports support Optional - use existing optionalLiftParameter fragment - return try .optionalLiftParameter(wrappedType: wrappedType, context: context) + return try .optionalLiftParameter(wrappedType: wrappedType) } case .caseEnum: return .identity case .rawValueEnum(_, let rawType): @@ -740,10 +743,6 @@ struct IntrinsicJSFragment: Sendable { } /// Returns a fragment that lowers a JS value to Wasm core values for return values - /// - /// - Parameters: - /// - type: The bridge type to lower - /// - context: The bridge context (defaults to .importTS for backward compatibility) static func lowerReturn(type: BridgeType, context: BridgeContext = .importTS) throws -> IntrinsicJSFragment { switch type { case .int, .float, .double: return .identity @@ -751,12 +750,14 @@ struct IntrinsicJSFragment: Sendable { case .string: return .stringLowerReturn case .jsObject: return .jsObjectLowerReturn case .swiftHeapObject(let name): - guard context == .protocolExport else { + switch context { + case .importTS: throw BridgeJSLinkError( message: "swiftHeapObject '\(name)' can only be used in protocol exports, not in \(context)" ) + case .protocolExport: + return .swiftHeapObjectLowerReturn } - return .swiftHeapObjectLowerReturn case .swiftProtocol: return .jsObjectLowerReturn case .void: return .void case .optional(let wrappedType): @@ -784,21 +785,7 @@ struct IntrinsicJSFragment: Sendable { "Associated value enums are not supported to be returned from imported JS functions: \(fullName)" ) case .protocolExport: - let base = fullName.components(separatedBy: ".").last ?? fullName - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in - let value = arguments[0] - let caseIdVar = scope.variable("caseId") - let cleanupVar = scope.variable("cleanup") - printer.write( - "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(value));" - ) - cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") - printer.write("return \(caseIdVar);") - return [] - } - ) + return associatedValueLowerReturn(fullName: fullName) } case .namespaceEnum(let string): throw BridgeJSLinkError( @@ -809,6 +796,23 @@ struct IntrinsicJSFragment: Sendable { // MARK: - Enums Payload Fragments + static func associatedValueLowerReturn(fullName: String) -> IntrinsicJSFragment { + let base = fullName.components(separatedBy: ".").last ?? fullName + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanupCode in + let value = arguments[0] + let caseIdVar = scope.variable("caseId") + let cleanupVar = scope.variable("cleanup") + printer.write( + "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(value));" + ) + cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") + printer.write("return \(caseIdVar);") + return [] + } + ) + } /// Fragment for generating an entire associated value enum helper static func associatedValueEnumHelper(enumDefinition: ExportedEnum) -> IntrinsicJSFragment { return IntrinsicJSFragment( @@ -1118,26 +1122,27 @@ struct IntrinsicJSFragment: Sendable { cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") } cleanup.write("}") + case .int: + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) | 0) : 0);" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + case .bool: + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) ? 1 : 0) : 0);" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + case .float: + printer.write( + "\(JSGlueVariableScope.reservedTmpParamF32s).push(\(isSomeVar) ? Math.fround(\(value)) : 0.0);" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + case .double: + printer.write( + "\(JSGlueVariableScope.reservedTmpParamF64s).push(\(isSomeVar) ? \(value) : 0.0);" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") default: - switch wrappedType { - case .int: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) | 0) : 0);" - ) - case .bool: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) ? 1 : 0) : 0);" - ) - case .float: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamF32s).push(\(isSomeVar) ? Math.fround(\(value)) : 0.0);" - ) - case .double: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamF64s).push(\(isSomeVar) ? \(value) : 0.0);" - ) - default: () - } printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") } diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 233e79038..c9a602751 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -9,8 +9,8 @@ public struct ABINameGenerator { /// Generates ABI name using standardized namespace + context pattern public static func generateABIName( baseName: String, - namespace: [String]?, - staticContext: StaticContext?, + namespace: [String]? = nil, + staticContext: StaticContext? = nil, operation: String? = nil, className: String? = nil ) -> String { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift index 9f2556e98..689f4a355 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift @@ -1,5 +1,12 @@ import JavaScriptKit +@JS enum Direction { + case north + case south + case east + case west +} + @JS enum ExampleEnum: String { case test = "test" case test2 = "test2" @@ -10,6 +17,12 @@ import JavaScriptKit case failure(Int) } +@JS enum Priority: Int { + case low = -1 + case medium = 0 + case high = 1 +} + @JS class Helper { @JS var value: Int @@ -26,8 +39,14 @@ import JavaScriptKit var eventCount: Int { get set } var delegateName: String { get } var optionalName: String? { get set } - var myEnum: ExampleEnum { get set } - var result: Result? { get set } + var optionalRawEnum: ExampleEnum? { get set } + var rawStringEnum: ExampleEnum { get set } + var result: Result { get set } + var optionalResult: Result? { get set } + var direction: Direction { get set } + var directionOptional: Direction? { get set } + var priority: Priority { get set } + var priorityOptional: Priority? { get set } func onSomethingHappened() func onValueChanged(_ value: String) func onCountUpdated(count: Int) -> Bool diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js index 7295699a6..c9485c396 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_checkArray"] = function bjs_checkArray(a) { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js index 92f10f94e..a763e45f5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js index 74fb30c53..b5537ddcb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_asyncReturnVoid"] = function bjs_asyncReturnVoid() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index dac7bdfcd..a2b070028 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -144,6 +144,41 @@ export async function createInstantiator(options, swift) { 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; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index ea0aef157..b6518d71f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -622,6 +622,41 @@ export async function createInstantiator(options, swift) { 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; + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js index 9cbed9a23..04eda0631 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js @@ -162,6 +162,41 @@ export async function createInstantiator(options, swift) { 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; + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index b934456f3..9e645a67d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -182,6 +182,41 @@ export async function createInstantiator(options, swift) { 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; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js index 6b56108a4..15b03a4b0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js @@ -213,6 +213,41 @@ export async function createInstantiator(options, swift) { 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; + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js index cead874b3..51921ddc3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_returnAnimatable"] = function bjs_returnAnimatable() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index f469072f2..b6694c06b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_createArrayBuffer"] = function bjs_createArrayBuffer() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index 116933d71..3253d17d5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_createDatabaseConnection"] = function bjs_createDatabaseConnection(config) { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index 5044b4b16..89dd90235 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js index f67a06e8d..319556b90 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js index eea05ba15..17e1a1e5f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js index 882e633ec..e8d18b98e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_check"] = function bjs_check(a, b) { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js index 7c20fa15f..c7efcf0d7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js index 481cc4951..24fa28a0e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_checkNumber"] = function bjs_checkNumber() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js index bbfbb0ac7..bc9748d8f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts index 9e64ddff9..b7fddd42e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts @@ -20,10 +20,24 @@ export interface MyViewControllerDelegate { eventCount: number; readonly delegateName: string; optionalName: string | null; - myEnum: ExampleEnumTag; - result: ResultTag | null; + optionalRawEnum: ExampleEnumTag | null; + rawStringEnum: ExampleEnumTag; + result: ResultTag; + optionalResult: ResultTag | null; + direction: DirectionTag; + directionOptional: DirectionTag | null; + priority: PriorityTag; + priorityOptional: PriorityTag | null; } +export const DirectionValues: { + readonly North: 0; + readonly South: 1; + readonly East: 2; + readonly West: 3; +}; +export type DirectionTag = typeof DirectionValues[keyof typeof DirectionValues]; + export const ExampleEnumValues: { readonly Test: "test"; readonly Test2: "test2"; @@ -40,10 +54,21 @@ export const ResultValues: { export type ResultTag = { tag: typeof ResultValues.Tag.Success; param0: string } | { tag: typeof ResultValues.Tag.Failure; param0: number } +export const PriorityValues: { + readonly Low: -1; + readonly Medium: 0; + readonly High: 1; +}; +export type PriorityTag = typeof PriorityValues[keyof typeof PriorityValues]; + +export type DirectionObject = typeof DirectionValues; + export type ExampleEnumObject = typeof ExampleEnumValues; export type ResultObject = typeof ResultValues; +export type PriorityObject = typeof PriorityValues; + /// Represents a Swift heap object like a class instance or an actor instance. export interface SwiftHeapObject { /// Release the heap object. @@ -72,8 +97,10 @@ export type Exports = { MyViewController: { new(delegate: MyViewControllerDelegate): MyViewController; } + Direction: DirectionObject ExampleEnum: ExampleEnumObject Result: ResultObject + Priority: PriorityObject } export type Imports = { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index 8aa18d391..2740c7c20 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -4,6 +4,13 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. +export const DirectionValues = { + North: 0, + South: 1, + East: 2, + West: 3, +}; + export const ExampleEnumValues = { Test: "test", Test2: "test2", @@ -55,6 +62,12 @@ const __bjs_createResultValuesHelpers = () => { } }); }; +export const PriorityValues = { + Low: -1, + Medium: 0, + High: 1, +}; + export async function createInstantiator(options, swift) { let instance; let memory; @@ -190,6 +203,41 @@ export async function createInstantiator(options, swift) { 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; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; @@ -231,15 +279,7 @@ export async function createInstantiator(options, swift) { TestModule["bjs_MyViewControllerDelegate_optionalName_get"] = function bjs_MyViewControllerDelegate_optionalName_get(self) { try { let ret = swift.memory.getObject(self).optionalName; - const isSome = ret != null; - if (isSome) { - const bytes = textEncoder.encode(ret); - bjs["swift_js_return_optional_string"](1, bytes, bytes.length); - return bytes.length; - } else { - bjs["swift_js_return_optional_string"](0, 0, 0); - return -1; - } + tmpRetString = ret; } catch (error) { setException(error); } @@ -256,20 +296,40 @@ export async function createInstantiator(options, swift) { setException(error); } } - TestModule["bjs_MyViewControllerDelegate_myEnum_get"] = function bjs_MyViewControllerDelegate_myEnum_get(self) { + TestModule["bjs_MyViewControllerDelegate_optionalRawEnum_get"] = function bjs_MyViewControllerDelegate_optionalRawEnum_get(self) { try { - let ret = swift.memory.getObject(self).myEnum; + let ret = swift.memory.getObject(self).optionalRawEnum; + tmpRetString = ret; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_optionalRawEnum_set"] = function bjs_MyViewControllerDelegate_optionalRawEnum_set(self, valueIsSome, valueWrappedValue) { + try { + let obj; + if (valueIsSome) { + obj = swift.memory.getObject(valueWrappedValue); + swift.memory.release(valueWrappedValue); + } + swift.memory.getObject(self).optionalRawEnum = valueIsSome ? obj : null; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_rawStringEnum_get"] = function bjs_MyViewControllerDelegate_rawStringEnum_get(self) { + try { + let ret = swift.memory.getObject(self).rawStringEnum; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { setException(error); } } - TestModule["bjs_MyViewControllerDelegate_myEnum_set"] = function bjs_MyViewControllerDelegate_myEnum_set(self, value) { + TestModule["bjs_MyViewControllerDelegate_rawStringEnum_set"] = function bjs_MyViewControllerDelegate_rawStringEnum_set(self, value) { try { const valueObject = swift.memory.getObject(value); swift.memory.release(value); - swift.memory.getObject(self).myEnum = valueObject; + swift.memory.getObject(self).rawStringEnum = valueObject; } catch (error) { setException(error); } @@ -277,20 +337,104 @@ export async function createInstantiator(options, swift) { TestModule["bjs_MyViewControllerDelegate_result_get"] = function bjs_MyViewControllerDelegate_result_get(self) { try { let ret = swift.memory.getObject(self).result; + const { caseId: caseId, cleanup: cleanup } = enumHelpers.Result.lower(ret); + return caseId; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_result_set"] = function bjs_MyViewControllerDelegate_result_set(self, value) { + try { + const enumValue = enumHelpers.Result.raise(value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + swift.memory.getObject(self).result = enumValue; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_optionalResult_get"] = function bjs_MyViewControllerDelegate_optionalResult_get(self) { + try { + let ret = swift.memory.getObject(self).optionalResult; const isSome = ret != null; if (isSome) { const { caseId: caseId, cleanup: cleanup } = enumHelpers.Result.lower(ret); - bjs["swift_js_return_optional_int"](1, caseId); + return caseId; } else { - bjs["swift_js_return_optional_int"](0, 0); + return -1; } } catch (error) { setException(error); } } - TestModule["bjs_MyViewControllerDelegate_result_set"] = function bjs_MyViewControllerDelegate_result_set(self, valueIsSome, valueWrappedValue) { + TestModule["bjs_MyViewControllerDelegate_optionalResult_set"] = function bjs_MyViewControllerDelegate_optionalResult_set(self, valueIsSome, valueWrappedValue) { + try { + let enumValue; + if (valueIsSome) { + enumValue = enumHelpers.Result.raise(valueWrappedValue, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + } + swift.memory.getObject(self).optionalResult = valueIsSome ? enumValue : null; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_direction_get"] = function bjs_MyViewControllerDelegate_direction_get(self) { + try { + let ret = swift.memory.getObject(self).direction; + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_MyViewControllerDelegate_direction_set"] = function bjs_MyViewControllerDelegate_direction_set(self, value) { + try { + swift.memory.getObject(self).direction = value; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_directionOptional_get"] = function bjs_MyViewControllerDelegate_directionOptional_get(self) { + try { + let ret = swift.memory.getObject(self).directionOptional; + const isSome = ret != null; + return isSome ? (ret | 0) : -1; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_directionOptional_set"] = function bjs_MyViewControllerDelegate_directionOptional_set(self, valueIsSome, valueWrappedValue) { + try { + swift.memory.getObject(self).directionOptional = valueIsSome ? valueWrappedValue : null; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_priority_get"] = function bjs_MyViewControllerDelegate_priority_get(self) { + try { + let ret = swift.memory.getObject(self).priority; + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_MyViewControllerDelegate_priority_set"] = function bjs_MyViewControllerDelegate_priority_set(self, value) { + try { + swift.memory.getObject(self).priority = value; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_priorityOptional_get"] = function bjs_MyViewControllerDelegate_priorityOptional_get(self) { + try { + let ret = swift.memory.getObject(self).priorityOptional; + tmpRetOptionalInt = ret; + } catch (error) { + setException(error); + } + } + TestModule["bjs_MyViewControllerDelegate_priorityOptional_set"] = function bjs_MyViewControllerDelegate_priorityOptional_set(self, valueIsSome, valueWrappedValue) { try { - swift.memory.getObject(self).result = valueIsSome ? valueWrappedValue : null; + swift.memory.getObject(self).priorityOptional = valueIsSome ? valueWrappedValue : null; } catch (error) { setException(error); } @@ -367,7 +511,6 @@ export async function createInstantiator(options, swift) { try { let ret = swift.memory.getObject(self).createOptionalHelper(); const isSome = ret != null; - return isSome ? ret.pointer : 0; } catch (error) { setException(error); } @@ -513,8 +656,10 @@ export async function createInstantiator(options, swift) { return { Helper, MyViewController, + Direction: DirectionValues, ExampleEnum: ExampleEnumValues, Result: ResultValues, + Priority: PriorityValues, }; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index 44ad0a93e..6fa84a4fc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -190,6 +190,41 @@ export async function createInstantiator(options, swift) { 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; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js index eb1c5ad1d..29060b938 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js @@ -143,6 +143,41 @@ export async function createInstantiator(options, swift) { 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; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js index b7d4b5053..a9f4bcd7b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js index bc109fc91..4f6e1dae4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_checkString"] = function bjs_checkString(a) { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js index 08eef7e03..2d9a848f9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js index 11d304468..80d4fcd90 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_checkString"] = function bjs_checkString() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js index 0a545a0e2..395057d81 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js index 453d5f76a..a1d39cd28 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_createTS2Skeleton"] = function bjs_createTS2Skeleton() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js index af17ab147..f2e0bfc9c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js index 9ba7cf60e..7c4438b08 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_checkSimple"] = function bjs_checkSimple(a) { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index 98fb575d8..49b0b3310 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_Greeter_init"] = function bjs_Greeter_init(name) { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js index d2716dfa9..a0f6f0dd4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js index 4b4c75eaa..bd1d9bfba 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js @@ -138,6 +138,41 @@ export async function createInstantiator(options, swift) { 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; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_check"] = function bjs_check() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index fd382c0ac..675f7bfb0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -11,13 +11,13 @@ extension Status: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Status { - return Status(bridgeJSRawValue: value)! + 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 bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift index ce952ca9d..0c70fe5cc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift @@ -7,8 +7,6 @@ @_spi(BridgeJS) import JavaScriptKit extension APIResult: _BridgedSwiftAssociatedValueEnum { - // MARK: Private Helper - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: @@ -55,8 +53,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> APIResult { - let caseId = _swift_js_pop_param_int32() + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIResult { return _bridgeJSLiftFromCaseId(caseId) } @@ -93,8 +90,6 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } extension ComplexResult: _BridgedSwiftAssociatedValueEnum { - // MARK: Private Helper - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: @@ -169,8 +164,7 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> ComplexResult { - let caseId = _swift_js_pop_param_int32() + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> ComplexResult { return _bridgeJSLiftFromCaseId(caseId) } @@ -235,8 +229,6 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { - // MARK: Private Helper - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Utilities.Result { switch caseId { case 0: @@ -278,8 +270,7 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> Utilities.Result { - let caseId = _swift_js_pop_param_int32() + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> Utilities.Result { return _bridgeJSLiftFromCaseId(caseId) } @@ -317,8 +308,6 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { } extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { - // MARK: Private Helper - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> NetworkingResult { switch caseId { case 0: @@ -350,8 +339,7 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> NetworkingResult { - let caseId = _swift_js_pop_param_int32() + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> NetworkingResult { return _bridgeJSLiftFromCaseId(caseId) } @@ -381,8 +369,6 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { } extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { - // MARK: Private Helper - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIOptionalResult { switch caseId { case 0: @@ -445,8 +431,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> APIOptionalResult { - let caseId = _swift_js_pop_param_int32() + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIOptionalResult { return _bridgeJSLiftFromCaseId(caseId) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift index 4a1be41e6..06bfa86af 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift @@ -11,13 +11,13 @@ extension Direction: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Direction { - return Direction(bridgeJSRawValue: value)! + 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 bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { @@ -54,13 +54,13 @@ extension Status: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Status { - return Status(bridgeJSRawValue: value)! + 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 bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { @@ -93,13 +93,13 @@ extension TSDirection: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> TSDirection { - return TSDirection(bridgeJSRawValue: value)! + 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 bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { @@ -136,13 +136,13 @@ extension PublicStatus: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> PublicStatus { - return PublicStatus(bridgeJSRawValue: value)! + return bridgeJSLiftParameter(value) } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> PublicStatus { return PublicStatus(bridgeJSRawValue: value)! } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift index daa5577a5..ca201f3d9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift @@ -11,13 +11,13 @@ extension Networking.API.Method: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Networking.API.Method { - return Networking.API.Method(bridgeJSRawValue: value)! + 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 bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { @@ -60,13 +60,13 @@ extension Internal.SupportedMethod: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Internal.SupportedMethod { - return Internal.SupportedMethod(bridgeJSRawValue: value)! + 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 bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json index bddcf2aa2..46b96429d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json @@ -250,6 +250,43 @@ } ], "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "north" + }, + { + "associatedValues" : [ + + ], + "name" : "south" + }, + { + "associatedValues" : [ + + ], + "name" : "east" + }, + { + "associatedValues" : [ + + ], + "name" : "west" + } + ], + "emitStyle" : "const", + "name" : "Direction", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Direction" + }, { "cases" : [ { @@ -314,6 +351,41 @@ ], "swiftCallName" : "Result" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "low", + "rawValue" : "-1" + }, + { + "associatedValues" : [ + + ], + "name" : "medium", + "rawValue" : "0" + }, + { + "associatedValues" : [ + + ], + "name" : "high", + "rawValue" : "1" + } + ], + "emitStyle" : "const", + "name" : "Priority", + "rawType" : "Int", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Priority" } ], "functions" : [ @@ -629,7 +701,21 @@ }, { "isReadonly" : false, - "name" : "myEnum", + "name" : "optionalRawEnum", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "ExampleEnum", + "_1" : "String" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "rawStringEnum", "type" : { "rawValueEnum" : { "_0" : "ExampleEnum", @@ -640,6 +726,15 @@ { "isReadonly" : false, "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "Result" + } + } + }, + { + "isReadonly" : false, + "name" : "optionalResult", "type" : { "optional" : { "_0" : { @@ -649,6 +744,52 @@ } } } + }, + { + "isReadonly" : false, + "name" : "direction", + "type" : { + "caseEnum" : { + "_0" : "Direction" + } + } + }, + { + "isReadonly" : false, + "name" : "directionOptional", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "priority", + "type" : { + "rawValueEnum" : { + "_0" : "Priority", + "_1" : "Int" + } + } + }, + { + "isReadonly" : false, + "name" : "priorityOptional", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Priority", + "_1" : "Int" + } + } + } + } } ] } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index 8bd37e8e2..d68ef81d0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -56,8 +56,9 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto func onOptionalHelperUpdated(_ helper: Optional) { @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onOptionalHelperUpdated") - func _extern_onOptionalHelperUpdated(this: Int32, helper: UnsafeMutableRawPointer) - _extern_onOptionalHelperUpdated(this: Int32(bitPattern: jsObject.id), helper: helper.bridgeJSLowerParameter()) + func _extern_onOptionalHelperUpdated(this: Int32, helperIsSome: Int32, helperPointer: UnsafeMutableRawPointer) + let (helperIsSome, helperPointer) = helper.bridgeJSLowerParameterWithPresence() + _extern_onOptionalHelperUpdated(this: Int32(bitPattern: jsObject.id), helperIsSome: helperIsSome, helperPointer: helperPointer) } func createOptionalHelper() -> Optional { @@ -82,9 +83,9 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto func getResult() -> Result { @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_getResult") - func _extern_getResult(this: Int32) - _extern_getResult(this: Int32(bitPattern: jsObject.id)) - return Result.bridgeJSLiftReturn() + func _extern_getResult(this: Int32) -> Int32 + let ret = _extern_getResult(this: Int32(bitPattern: jsObject.id)) + return Result.bridgeJSLiftReturn(ret) } var eventCount: Int { @@ -113,56 +114,186 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto var optionalName: Optional { get { @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) - return Optional.bridgeJSLiftReturn(ret) + func _extern_get(this: Int32) + _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturnFromSideChannel() } set { @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_set") - func _extern_set(this: Int32, value: Int32) - _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + func _extern_set(this: Int32, isSome: Int32, value: Int32) + let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() + _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + } + } + + var optionalRawEnum: Optional { + get { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalRawEnum_get") + func _extern_get(this: Int32) + _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturnFromSideChannel() + } + set { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalRawEnum_set") + func _extern_set(this: Int32, isSome: Int32, value: Int32) + let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() + _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) } } - var myEnum: ExampleEnum { + var rawStringEnum: ExampleEnum { get { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_myEnum_get") + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_rawStringEnum_get") func _extern_get(this: Int32) -> Int32 let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) return ExampleEnum.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_myEnum_set") + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_rawStringEnum_set") func _extern_set(this: Int32, value: Int32) _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) } } - var result: Optional { + var result: Result { get { @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_get") - func _extern_get(this: Int32) - _extern_get(this: Int32(bitPattern: jsObject.id)) - return Optional.bridgeJSLiftReturn() + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Result.bridgeJSLiftReturn(ret) } set { @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_set") + func _extern_set(this: Int32, caseId: Int32) + _extern_set(this: Int32(bitPattern: jsObject.id), caseId: newValue.bridgeJSLowerParameter()) + } + } + + var optionalResult: Optional { + get { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalResult_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturn(ret) + } + set { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalResult_set") + func _extern_set(this: Int32, isSome: Int32, caseId: Int32) + let (isSome, caseId) = newValue.bridgeJSLowerParameterWithPresence() + _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, caseId: caseId) + } + } + + var direction: Direction { + get { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_direction_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Direction.bridgeJSLiftReturn(ret) + } + set { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_direction_set") + func _extern_set(this: Int32, value: Int32) + _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + } + } + + var directionOptional: Optional { + get { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_directionOptional_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturn(ret) + } + set { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_directionOptional_set") + func _extern_set(this: Int32, isSome: Int32, value: Int32) + let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() + _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + } + } + + var priority: Priority { + get { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priority_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Priority.bridgeJSLiftReturn(ret) + } + set { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priority_set") func _extern_set(this: Int32, value: Int32) _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) } } + var priorityOptional: Optional { + get { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priorityOptional_get") + func _extern_get(this: Int32) + _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturnFromSideChannel() + } + set { + @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priorityOptional_set") + func _extern_set(this: Int32, isSome: Int32, value: Int32) + let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() + _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + } + } + static func bridgeJSLiftParameter(_ value: Int32) -> Self { return AnyMyViewControllerDelegate(jsObject: JSObject(id: UInt32(bitPattern: value))) } } +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 ExampleEnum: _BridgedSwiftEnumNoPayload { } extension Result: _BridgedSwiftAssociatedValueEnum { - // MARK: Private Helper - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Result { switch caseId { case 0: @@ -190,8 +321,7 @@ extension Result: _BridgedSwiftAssociatedValueEnum { } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> Result { - let caseId = _swift_js_pop_param_int32() + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> Result { return _bridgeJSLiftFromCaseId(caseId) } @@ -216,6 +346,9 @@ extension Result: _BridgedSwiftAssociatedValueEnum { } } +extension Priority: _BridgedSwiftEnumNoPayload { +} + @_expose(wasm, "bjs_Helper_init") @_cdecl("bjs_Helper_init") public func _bjs_Helper_init(value: Int32) -> UnsafeMutableRawPointer { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift index a26d5ea1c..7aa91b915 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift @@ -11,13 +11,13 @@ extension Calculator: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Calculator { - return Calculator(bridgeJSRawValue: value)! + return bridgeJSLiftParameter(value) } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Calculator { return Calculator(bridgeJSRawValue: value)! } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { @@ -53,8 +53,6 @@ public func _bjs_Calculator_static_square(value: Int32) -> Int32 { } extension APIResult: _BridgedSwiftAssociatedValueEnum { - // MARK: Private Helper - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: @@ -82,8 +80,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> APIResult { - let caseId = _swift_js_pop_param_int32() + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIResult { return _bridgeJSLiftFromCaseId(caseId) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift index 6edd0c8f3..72d561a00 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift @@ -11,13 +11,13 @@ extension PropertyEnum: _BridgedSwiftCaseEnum { return bridgeJSRawValue } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> PropertyEnum { - return PropertyEnum(bridgeJSRawValue: value)! + return bridgeJSLiftParameter(value) } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> PropertyEnum { return PropertyEnum(bridgeJSRawValue: value)! } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSRawValue + return bridgeJSLowerParameter() } private init?(bridgeJSRawValue: Int32) { diff --git a/Sources/JavaScriptKit/BridgeJSInstrincics.swift b/Sources/JavaScriptKit/BridgeJSInstrincics.swift index be6e7b472..9c97583cb 100644 --- a/Sources/JavaScriptKit/BridgeJSInstrincics.swift +++ b/Sources/JavaScriptKit/BridgeJSInstrincics.swift @@ -77,6 +77,10 @@ import _CJavaScriptKit // - `func bridgeJSLiftParameter(_ ...) -> <#TargetType#>`: lift the given Wasm core type parameters to a higher-level type // - `func bridgeJSLowerReturn() -> <#WasmCoreType#>`: lower the given higher-level return value to a Wasm core type // +// Optional types (ExportSwift only) additionally define: +// - `func bridgeJSLowerParameterWithPresence()`: lower optional as (isSome, value) tuple for protocol setters/parameters +// - `func bridgeJSLiftReturnFromSideChannel()`: lift optional from side-channel storage for protocol property getters +// // See JSGlueGen.swift in BridgeJSLink for JS-side lowering/lifting implementation. /// A protocol that Swift types that can appear as parameters or return values on @@ -340,7 +344,7 @@ public protocol _BridgedSwiftCaseEnum { public protocol _BridgedSwiftAssociatedValueEnum: _BridgedSwiftTypeLoweredIntoVoidType { // MARK: ImportTS @_spi(BridgeJS) consuming func bridgeJSLowerParameter() -> Int32 - @_spi(BridgeJS) static func bridgeJSLiftReturn() -> Self + @_spi(BridgeJS) static func bridgeJSLiftReturn(_ caseId: Int32) -> Self // MARK: ExportSwift @_spi(BridgeJS) static func bridgeJSLiftParameter(_ caseId: Int32) -> Self @@ -464,21 +468,25 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo } #endif -// MARK: Optional Type Support - extension Optional where Wrapped == Bool { // MARK: ImportTS @available(*, unavailable, message: "Optional Bool type is not supported to be passed to imported JS functions") @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Void {} - @available(*, unavailable, message: "Optional Bool type is not supported to be passed to imported JS functions") - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ wrappedValue: Int32) -> Bool? { - return nil - } - // MARK: ExportSwift + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + isSome: Int32, value: Int32 + ) { + switch consume self { + case .none: + return (isSome: 0, value: 0) + case .some(let wrapped): + return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) + } + } + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Bool? { if isSome == 0 { return nil @@ -487,6 +495,19 @@ extension Optional where Wrapped == Bool { } } + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Bool? { + switch value { + case -1: + return nil + case 0: + return false + case 1: + return true + default: + return nil // Treat invalid values as null + } + } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_return_optional_bool") @@ -507,18 +528,25 @@ extension Optional where Wrapped == Bool { } } -/// Optional support for Int extension Optional where Wrapped == Int { // MARK: ImportTS @available(*, unavailable, message: "Optional Int type is not supported to be passed to imported JS functions") @_spi(BridgeJS) public func bridgeJSLowerParameter() -> Void {} - @available(*, unavailable, message: "Optional Int type is not supported to be passed to imported JS functions") - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ wrappedValue: Int32) -> Int? { return nil } - // MARK: ExportSwift + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + isSome: Int32, value: Int32 + ) { + switch consume self { + case .none: + return (isSome: 0, value: 0) + case .some(let wrapped): + return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) + } + } + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Int? { if isSome == 0 { return nil @@ -527,6 +555,29 @@ extension Optional where Wrapped == Int { } } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Int? { + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_int_presence") + func _swift_js_get_optional_int_presence() -> Int32 + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_int_value") + func _swift_js_get_optional_int_value() -> Int32 + #else + func _swift_js_get_optional_int_presence() -> Int32 { + _onlyAvailableOnWasm() + } + func _swift_js_get_optional_int_value() -> Int32 { + _onlyAvailableOnWasm() + } + #endif + + let isSome = _swift_js_get_optional_int_presence() + if isSome == 0 { + return nil + } else { + return Int.bridgeJSLiftReturn(_swift_js_get_optional_int_value()) + } + } + @_spi(BridgeJS) public func bridgeJSLowerReturn() -> Void { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_return_optional_int") @@ -547,34 +598,43 @@ extension Optional where Wrapped == Int { } } extension Optional where Wrapped == String { - // MARK: ImportTS + // MARK: ExportSwift - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + isSome: Int32, value: Int32 + ) { switch consume self { case .none: - return 0 - case .some(let value): - return value.bridgeJSLowerParameter() + return (isSome: 0, value: 0) + case .some(let wrapped): + return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) } } - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ length: Int32) -> String? { - // JavaScript returns -1 for null, or the byte length if present - // The actual string is already in tmpRetString side channel - if length < 0 { + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ bytes: Int32, _ count: Int32) -> String? + { + if isSome == 0 { return nil + } else { + return String.bridgeJSLiftParameter(bytes, count) } - return String.bridgeJSLiftReturn(length) } - // MARK: ExportSwift + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> String? { + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_string") + func _swift_js_get_optional_string() -> Int32 + #else + func _swift_js_get_optional_string() -> Int32 { + _onlyAvailableOnWasm() + } + #endif - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ bytes: Int32, _ count: Int32) -> String? - { - if isSome == 0 { + let length = _swift_js_get_optional_string() + if length < 0 { return nil } else { - return String.bridgeJSLiftParameter(bytes, count) + return String.bridgeJSLiftReturn(length) } } @@ -600,18 +660,19 @@ extension Optional where Wrapped == String { } } extension Optional where Wrapped == JSObject { - // MARK: ImportTS - - @available(*, unavailable, message: "Optional JSObject type is not supported to be passed to imported JS functions") - @_spi(BridgeJS) public func bridgeJSLowerParameter() -> Void {} + // MARK: ExportSwift - @available(*, unavailable, message: "Optional JSObject type is not supported to be passed to imported JS functions") - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ objectId: Int32) -> JSObject? { - return nil + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + isSome: Int32, value: Int32 + ) { + switch consume self { + case .none: + return (isSome: 0, value: 0) + case .some(let wrapped): + return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) + } } - // MARK: ExportSwift - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ objectId: Int32) -> JSObject? { if isSome == 0 { return nil @@ -642,24 +703,6 @@ extension Optional where Wrapped == JSObject { } extension Optional where Wrapped: _BridgedSwiftProtocolWrapper { - // MARK: ImportTS - - @available( - *, - unavailable, - message: "Optional protocol types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public func bridgeJSLowerParameter() -> Void {} - - @available( - *, - unavailable, - message: "Optional protocol types are not supported to be passed to imported JS functions" - ) - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ objectId: Int32) -> Wrapped? { - return nil - } - // MARK: ExportSwift @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ objectId: Int32) -> Wrapped? { @@ -705,6 +748,17 @@ extension Optional where Wrapped: _BridgedSwiftHeapObject { } } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + isSome: Int32, pointer: UnsafeMutableRawPointer + ) { + switch consume self { + case .none: + return (isSome: 0, pointer: UnsafeMutableRawPointer(bitPattern: 0)!) + case .some(let value): + return (isSome: 1, pointer: value.bridgeJSLowerParameter()) + } + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ pointer: UnsafeMutableRawPointer) -> Wrapped? { if pointer == UnsafeMutableRawPointer(bitPattern: 0) { @@ -753,11 +807,6 @@ extension Optional where Wrapped == Float { @available(*, unavailable, message: "Optional Float type is not supported to be passed to imported JS functions") @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Void {} - @available(*, unavailable, message: "Optional Float type is not supported to be passed to imported JS functions") - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ wrappedValue: Float32) -> Float? { - return nil - } - // MARK: ExportSwift @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Float? { @@ -768,6 +817,29 @@ extension Optional where Wrapped == Float { } } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Float? { + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_float_presence") + func _swift_js_get_optional_float_presence() -> Int32 + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_float_value") + func _swift_js_get_optional_float_value() -> Float32 + #else + func _swift_js_get_optional_float_presence() -> Int32 { + _onlyAvailableOnWasm() + } + func _swift_js_get_optional_float_value() -> Float32 { + _onlyAvailableOnWasm() + } + #endif + + let isSome = _swift_js_get_optional_float_presence() + if isSome == 0 { + return nil + } else { + return Float.bridgeJSLiftReturn(_swift_js_get_optional_float_value()) + } + } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_return_optional_float") @@ -795,11 +867,6 @@ extension Optional where Wrapped == Double { @available(*, unavailable, message: "Optional Double type is not supported to be passed to imported JS functions") @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Void {} - @available(*, unavailable, message: "Optional Double type is not supported to be passed to imported JS functions") - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ isSome: Int32, _ wrappedValue: Float64) -> Double? { - return nil - } - // MARK: ExportSwift @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float64) -> Double? { @@ -810,6 +877,29 @@ extension Optional where Wrapped == Double { } } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Double? { + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_double_presence") + func _swift_js_get_optional_double_presence() -> Int32 + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_double_value") + func _swift_js_get_optional_double_value() -> Float64 + #else + func _swift_js_get_optional_double_presence() -> Int32 { + _onlyAvailableOnWasm() + } + func _swift_js_get_optional_double_value() -> Float64 { + _onlyAvailableOnWasm() + } + #endif + + let isSome = _swift_js_get_optional_double_presence() + if isSome == 0 { + return nil + } else { + return Double.bridgeJSLiftReturn(_swift_js_get_optional_double_value()) + } + } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_return_optional_double") @@ -832,32 +922,30 @@ extension Optional where Wrapped == Double { /// Optional support for case enums extension Optional where Wrapped: _BridgedSwiftCaseEnum { - // MARK: ImportTS + // MARK: ExportSwift - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameterWithPresence() -> (isSome: Int32, value: Int32) { switch consume self { case .none: - return -1 // Sentinel for nil + return (isSome: 0, value: 0) case .some(let value): - return value.bridgeJSLowerParameter() + return (isSome: 1, value: value.bridgeJSLowerParameter()) } } - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Wrapped? { - if value == -1 { + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Wrapped? { + if isSome == 0 { return nil } else { - return Wrapped.bridgeJSLiftReturn(value) + return Wrapped.bridgeJSLiftParameter(wrappedValue) } } - // MARK: ExportSwift - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Wrapped? { - if isSome == 0 { + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Wrapped? { + if value == -1 { return nil } else { - return Wrapped.bridgeJSLiftParameter(wrappedValue) + return Wrapped.bridgeJSLiftReturn(value) } } @@ -900,28 +988,19 @@ extension Optional where Wrapped: _BridgedSwiftTypeLoweredIntoVoidType { // MARK: Optional Raw Value Enum Support extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == String { - // MARK: ImportTS + // MARK: ExportSwift - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + isSome: Int32, value: Int32 + ) { switch consume self { case .none: - return 0 // Sentinel for nil - case .some(let value): - return value.bridgeJSLowerParameter() + return (isSome: 0, value: 0) + case .some(let wrapped): + return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) } } - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ length: Int32) -> Wrapped? { - if length == 0 { - return nil - } else { - let rawValue = String.bridgeJSLiftReturn(length) - return Wrapped(rawValue: rawValue) - } - } - - // MARK: ExportSwift - @_spi(BridgeJS) public static func bridgeJSLiftParameter( _ isSome: Int32, _ bytes: Int32, @@ -931,6 +1010,25 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_string") + func _swift_js_get_optional_string() -> Int32 + #else + func _swift_js_get_optional_string() -> Int32 { + _onlyAvailableOnWasm() + } + #endif + + let length = _swift_js_get_optional_string() + if length < 0 { + return nil + } else { + let rawValue = String.bridgeJSLiftReturn(length) + return Wrapped(rawValue: rawValue) + } + } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { let optionalRawValue: String? = self?.rawValue optionalRawValue.bridgeJSLowerReturn() @@ -938,58 +1036,52 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres } extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Int { - // MARK: ImportTS - - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + // MARK: ExportSwift + @_spi(BridgeJS) public consuming func bridgeJSLowerParameterWithPresence() -> (isSome: Int32, value: Int32) { switch consume self { case .none: - return -1 // Sentinel for nil + return (isSome: 0, value: 0) case .some(let value): - return value.bridgeJSLowerParameter() + return (isSome: 1, value: value.bridgeJSLowerParameter()) } } - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Wrapped? { - if value == -1 { - return nil - } else { - return Wrapped(rawValue: Int(value)) - } - } - - // MARK: ExportSwift - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Wrapped? { let optionalRawValue = Int?.bridgeJSLiftParameter(isSome, wrappedValue) return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - let optionalRawValue: Int? = self?.rawValue - optionalRawValue.bridgeJSLowerReturn() - } -} - -extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Bool { - // MARK: ImportTS - - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { - switch consume self { - case .none: - return -1 // Sentinel for nil - case .some(let value): - return value.bridgeJSLowerParameter() + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_int_presence") + func _swift_js_get_optional_int_presence() -> Int32 + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_int_value") + func _swift_js_get_optional_int_value() -> Int32 + #else + func _swift_js_get_optional_int_presence() -> Int32 { + _onlyAvailableOnWasm() } - } + func _swift_js_get_optional_int_value() -> Int32 { + _onlyAvailableOnWasm() + } + #endif - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Wrapped? { - if value == -1 { + let isSome = _swift_js_get_optional_int_presence() + if isSome == 0 { return nil } else { - return Wrapped(rawValue: value != 0) + let rawValue = _swift_js_get_optional_int_value() + return Wrapped(rawValue: Int(rawValue)) } } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + let optionalRawValue: Int? = self?.rawValue + optionalRawValue.bridgeJSLowerReturn() + } +} + +extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Bool { // MARK: ExportSwift @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Wrapped? { @@ -1004,31 +1096,46 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres } extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Float { - // MARK: ImportTS + // MARK: ExportSwift - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Float32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + isSome: Int32, value: Float32 + ) { switch consume self { case .none: - return Float32.nan // Sentinel for nil (NaN) - case .some(let value): - return value.bridgeJSLowerParameter() - } - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Float32) -> Wrapped? { - if value.isNaN { - return nil - } else { - return Wrapped(rawValue: Float(value)) + return (isSome: 0, value: 0.0) + case .some(let wrapped): + return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) } } - // MARK: ExportSwift - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Wrapped? { let optionalRawValue = Float?.bridgeJSLiftParameter(isSome, wrappedValue) return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_float_presence") + func _swift_js_get_optional_float_presence() -> Int32 + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_float_value") + func _swift_js_get_optional_float_value() -> Float32 + #else + func _swift_js_get_optional_float_presence() -> Int32 { + _onlyAvailableOnWasm() + } + func _swift_js_get_optional_float_value() -> Float32 { + _onlyAvailableOnWasm() + } + #endif + + let isSome = _swift_js_get_optional_float_presence() + if isSome == 0 { + return nil + } else { + let rawValue = _swift_js_get_optional_float_value() + return Wrapped(rawValue: Float(rawValue)) + } + } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { let optionalRawValue: Float? = self?.rawValue @@ -1037,32 +1144,48 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres } extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Double { - // MARK: ImportTS + // MARK: ExportSwift - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Float64 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + isSome: Int32, value: Float64 + ) { switch consume self { case .none: - return Float64.nan // Sentinel for nil (NaN) - case .some(let value): - return value.bridgeJSLowerParameter() + return (isSome: 0, value: 0.0) + case .some(let wrapped): + return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) } } - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Float64) -> Wrapped? { - if value.isNaN { - return nil - } else { - return Wrapped(rawValue: Double(value)) - } - } - - // MARK: ExportSwift - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float64) -> Wrapped? { let optionalRawValue = Double?.bridgeJSLiftParameter(isSome, wrappedValue) return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_double_presence") + func _swift_js_get_optional_double_presence() -> Int32 + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_double_value") + func _swift_js_get_optional_double_value() -> Float64 + #else + func _swift_js_get_optional_double_presence() -> Int32 { + _onlyAvailableOnWasm() + } + func _swift_js_get_optional_double_value() -> Float64 { + _onlyAvailableOnWasm() + } + #endif + + let isSome = _swift_js_get_optional_double_presence() + if isSome == 0 { + return nil + } else { + let rawValue = _swift_js_get_optional_double_value() + return Wrapped(rawValue: Double(rawValue)) + } + } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { let optionalRawValue: Double? = self?.rawValue optionalRawValue.bridgeJSLowerReturn() @@ -1072,36 +1195,30 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres // MARK: Optional Associated Value Enum Support extension Optional where Wrapped: _BridgedSwiftAssociatedValueEnum { - // MARK: ImportTS + // MARK: ExportSwift - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameterWithPresence() -> (isSome: Int32, caseId: Int32) { switch consume self { case .none: - return -1 // Sentinel for nil + return (isSome: 0, caseId: 0) case .some(let value): - return value.bridgeJSLowerParameter() + return (isSome: 1, caseId: value.bridgeJSLowerParameter()) } } - @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> Wrapped? { - // Read tag from side channel - let tag = _swift_js_pop_param_int32() - if tag == -1 { + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ caseId: Int32) -> Wrapped? { + if isSome == 0 { return nil } else { - // Put tag back for the wrapped type's liftReturn to consume - _swift_js_push_int(tag) - return Wrapped.bridgeJSLiftReturn() + return Wrapped.bridgeJSLiftParameter(caseId) } } - // MARK: ExportSwift - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ caseId: Int32) -> Wrapped? { - if isSome == 0 { + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ caseId: Int32) -> Wrapped? { + if caseId == -1 { return nil } else { - return Wrapped.bridgeJSLiftParameter(caseId) + return Wrapped.bridgeJSLiftReturn(caseId) } } diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md index b6672a0aa..4dba78c38 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md @@ -244,7 +244,4 @@ When you pass a JavaScript object implementing a protocol to Swift: | Protocol composition: `Protocol1 & Protocol2` | ❌ | | Generics | ❌ | -**Type Limitations:** -- `@JS enum` types are not supported in protocol signatures (use raw values or separate parameters instead) - -> Note: Protocol type support matches that of regular `@JS func` and `@JS class` exports. See and for more information. +> Note: Protocol type support matches that of regular `@JS func` and `@JS class` exports. See , , and for more information. diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 168a8c6ee..97ebcfd2e 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -863,7 +863,13 @@ enum APIOptionalResult { var count: Int { get set } var name: String { get } var optionalTag: String? { get set } + var optionalCount: Int? { get set } + var direction: Direction? { get set } + var optionalTheme: Theme? { get set } + var httpStatus: HttpStatus? { get set } var apiResult: APIResult? { get set } + var helper: Greeter { get set } + var optionalHelper: Greeter? { get set } func increment(by amount: Int) func getValue() -> Int func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) @@ -873,8 +879,8 @@ enum APIOptionalResult { func createGreeter() -> Greeter func processOptionalGreeter(_ greeter: Greeter?) -> String func createOptionalGreeter() -> Greeter? - func handleAPIResult(_ result: APIResult) - func getAPIResult() -> APIResult + func handleAPIResult(_ result: APIResult?) + func getAPIResult() -> APIResult? } @JS class DataProcessorManager { @@ -919,13 +925,67 @@ enum APIOptionalResult { @JS func hasBackup() -> Bool { return backupProcessor != nil } + + @JS func getProcessorOptionalTag() -> String? { + return processor.optionalTag + } + + @JS func setProcessorOptionalTag(_ tag: String?) { + processor.optionalTag = tag + } + + @JS func getProcessorOptionalCount() -> Int? { + return processor.optionalCount + } + + @JS func setProcessorOptionalCount(_ count: Int?) { + processor.optionalCount = count + } + + @JS func getProcessorDirection() -> Direction? { + return processor.direction + } + + @JS func setProcessorDirection(_ direction: Direction?) { + processor.direction = direction + } + + @JS func getProcessorTheme() -> Theme? { + return processor.optionalTheme + } + + @JS func setProcessorTheme(_ theme: Theme?) { + processor.optionalTheme = theme + } + + @JS func getProcessorHttpStatus() -> HttpStatus? { + return processor.httpStatus + } + + @JS func setProcessorHttpStatus(_ status: HttpStatus?) { + processor.httpStatus = status + } + + @JS func getProcessorAPIResult() -> APIResult? { + return processor.getAPIResult() + } + + @JS func setProcessorAPIResult(_ apiResult: APIResult?) { + processor.handleAPIResult(apiResult) + } } @JS class SwiftDataProcessor: DataProcessor { @JS var count: Int = 0 @JS let name: String = "SwiftDataProcessor" @JS var optionalTag: String? = nil + @JS var optionalCount: Int? = nil + @JS var direction: Direction? = nil + @JS var optionalTheme: Theme? = nil + @JS var httpStatus: HttpStatus? = nil @JS var apiResult: APIResult? = nil + @JS var helper: Greeter = Greeter(name: "DefaultHelper") + @JS var optionalHelper: Greeter? = nil private var label: String = "" @JS init() {} @@ -970,12 +1030,12 @@ enum APIOptionalResult { return Greeter(name: "OptionalProcessorGreeter") } - @JS func handleAPIResult(_ result: APIResult) { + @JS func handleAPIResult(_ result: APIResult?) { self.apiResult = result } - @JS func getAPIResult() -> APIResult { - return apiResult ?? .failure(0) + @JS func getAPIResult() -> APIResult? { + return apiResult } } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index 58938a945..350ef7ae6 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -19,11 +19,7 @@ struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getValue") func _extern_getValue(this: Int32) -> Int32 let ret = _extern_getValue(this: Int32(bitPattern: jsObject.id)) -<<<<<<< HEAD return Int.bridgeJSLiftReturn(ret) -======= - return Int.bridgeJSLiftReturn(ret) ->>>>>>> f19c8b06 (WIP: Initial protocol support) } func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) { @@ -36,11 +32,7 @@ struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getLabel") func _extern_getLabel(this: Int32) -> Int32 let ret = _extern_getLabel(this: Int32(bitPattern: jsObject.id)) -<<<<<<< HEAD return String.bridgeJSLiftReturn(ret) -======= - return String.bridgeJSLiftReturn(ret) ->>>>>>> f19c8b06 (WIP: Initial protocol support) } func isEven() -> Bool { @@ -66,8 +58,9 @@ struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { func processOptionalGreeter(_ greeter: Optional) -> String { @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processOptionalGreeter") - func _extern_processOptionalGreeter(this: Int32, greeter: UnsafeMutableRawPointer) -> Int32 - let ret = _extern_processOptionalGreeter(this: Int32(bitPattern: jsObject.id), greeter: greeter.bridgeJSLowerParameter()) + func _extern_processOptionalGreeter(this: Int32, greeterIsSome: Int32, greeterPointer: UnsafeMutableRawPointer) -> Int32 + let (greeterIsSome, greeterPointer) = greeter.bridgeJSLowerParameterWithPresence() + let ret = _extern_processOptionalGreeter(this: Int32(bitPattern: jsObject.id), greeterIsSome: greeterIsSome, greeterPointer: greeterPointer) return String.bridgeJSLiftReturn(ret) } @@ -78,17 +71,18 @@ struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { return Optional.bridgeJSLiftReturn(ret) } - func handleAPIResult(_ result: APIResult) { + func handleAPIResult(_ result: Optional) { @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_handleAPIResult") - func _extern_handleAPIResult(this: Int32, result: Int32) - _extern_handleAPIResult(this: Int32(bitPattern: jsObject.id), result: result.bridgeJSLowerParameter()) + func _extern_handleAPIResult(this: Int32, resultIsSome: Int32, resultCaseId: Int32) + let (resultIsSome, resultCaseId) = result.bridgeJSLowerParameterWithPresence() + _extern_handleAPIResult(this: Int32(bitPattern: jsObject.id), resultIsSome: resultIsSome, resultCaseId: resultCaseId) } - func getAPIResult() -> APIResult { + func getAPIResult() -> Optional { @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getAPIResult") - func _extern_getAPIResult(this: Int32) - _extern_getAPIResult(this: Int32(bitPattern: jsObject.id)) - return APIResult.bridgeJSLiftReturn() + func _extern_getAPIResult(this: Int32) -> Int32 + let ret = _extern_getAPIResult(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturn(ret) } var count: Int { @@ -117,28 +111,119 @@ struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { var optionalTag: Optional { get { @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_get") + func _extern_get(this: Int32) + _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturnFromSideChannel() + } + set { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_set") + func _extern_set(this: Int32, isSome: Int32, value: Int32) + let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() + _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + } + } + + var optionalCount: Optional { + get { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_get") + func _extern_get(this: Int32) + _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturnFromSideChannel() + } + set { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_set") + func _extern_set(this: Int32, isSome: Int32, value: Int32) + let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() + _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + } + } + + var direction: Optional { + get { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_get") func _extern_get(this: Int32) -> Int32 let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) - return Optional.bridgeJSLiftReturn(ret) + return Optional.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_set") - func _extern_set(this: Int32, value: Int32) - _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_set") + func _extern_set(this: Int32, isSome: Int32, value: Int32) + let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() + _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) } } - var apiResult: Optional { + var optionalTheme: Optional { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_get") + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_get") func _extern_get(this: Int32) _extern_get(this: Int32(bitPattern: jsObject.id)) - return Optional.bridgeJSLiftReturn() + return Optional.bridgeJSLiftReturnFromSideChannel() + } + set { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_set") + func _extern_set(this: Int32, isSome: Int32, value: Int32) + let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() + _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + } + } + + var httpStatus: Optional { + get { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_get") + func _extern_get(this: Int32) + _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturnFromSideChannel() + } + set { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_set") + func _extern_set(this: Int32, isSome: Int32, value: Int32) + let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() + _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + } + } + + var apiResult: Optional { + get { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturn(ret) } set { @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_set") - func _extern_set(this: Int32, value: Int32) - _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + func _extern_set(this: Int32, isSome: Int32, caseId: Int32) + let (isSome, caseId) = newValue.bridgeJSLowerParameterWithPresence() + _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, caseId: caseId) + } + } + + var helper: Greeter { + get { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_get") + func _extern_get(this: Int32) -> UnsafeMutableRawPointer + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Greeter.bridgeJSLiftReturn(ret) + } + set { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_set") + func _extern_set(this: Int32, pointer: UnsafeMutableRawPointer) + _extern_set(this: Int32(bitPattern: jsObject.id), pointer: newValue.bridgeJSLowerParameter()) + } + } + + var optionalHelper: Optional { + get { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_get") + func _extern_get(this: Int32) -> UnsafeMutableRawPointer + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Optional.bridgeJSLiftReturn(ret) + } + set { + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_set") + func _extern_set(this: Int32, isSome: Int32, pointer: UnsafeMutableRawPointer) + let (isSome, pointer) = newValue.bridgeJSLowerParameterWithPresence() + _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, pointer: pointer) } } @@ -412,8 +497,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> APIResult { - let caseId = _swift_js_pop_param_int32() + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIResult { return _bridgeJSLiftFromCaseId(caseId) } @@ -534,8 +618,7 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> ComplexResult { - let caseId = _swift_js_pop_param_int32() + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> ComplexResult { return _bridgeJSLiftFromCaseId(caseId) } @@ -649,8 +732,7 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> Utilities.Result { - let caseId = _swift_js_pop_param_int32() + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> Utilities.Result { return _bridgeJSLiftFromCaseId(caseId) } @@ -719,8 +801,7 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> API.NetworkingResult { - let caseId = _swift_js_pop_param_int32() + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> API.NetworkingResult { return _bridgeJSLiftFromCaseId(caseId) } @@ -812,8 +893,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn() -> APIOptionalResult { - let caseId = _swift_js_pop_param_int32() + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIOptionalResult { return _bridgeJSLiftFromCaseId(caseId) } @@ -3723,6 +3803,132 @@ public func _bjs_DataProcessorManager_hasBackup(_self: UnsafeMutableRawPointer) #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 { @@ -3897,9 +4103,9 @@ public func _bjs_SwiftDataProcessor_createOptionalGreeter(_self: UnsafeMutableRa @_expose(wasm, "bjs_SwiftDataProcessor_handleAPIResult") @_cdecl("bjs_SwiftDataProcessor_handleAPIResult") -public func _bjs_SwiftDataProcessor_handleAPIResult(_self: UnsafeMutableRawPointer, result: Int32) -> Void { +public func _bjs_SwiftDataProcessor_handleAPIResult(_self: UnsafeMutableRawPointer, resultIsSome: Int32, resultCaseId: Int32) -> Void { #if arch(wasm32) - SwiftDataProcessor.bridgeJSLiftParameter(_self).handleAPIResult(_: APIResult.bridgeJSLiftParameter(result)) + SwiftDataProcessor.bridgeJSLiftParameter(_self).handleAPIResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) #else fatalError("Only available on WebAssembly") #endif @@ -3969,6 +4175,90 @@ public func _bjs_SwiftDataProcessor_optionalTag_set(_self: UnsafeMutableRawPoint #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 { @@ -3990,6 +4280,48 @@ public func _bjs_SwiftDataProcessor_apiResult_set(_self: UnsafeMutableRawPointer #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) { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index cc3807494..c0e0a4a80 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -1346,6 +1346,310 @@ "returnType" : { "bool" : { + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorOptionalTag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorOptionalTag", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorOptionalTag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorOptionalTag", + "parameters" : [ + { + "label" : "_", + "name" : "tag", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorOptionalCount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorOptionalCount", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorOptionalCount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorOptionalCount", + "parameters" : [ + { + "label" : "_", + "name" : "count", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorDirection", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorDirection", + "parameters" : [ + { + "label" : "_", + "name" : "direction", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorTheme", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorTheme", + "parameters" : [ + { + "label" : "_", + "name" : "theme", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorHttpStatus", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "status", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorAPIResult", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "apiResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "returnType" : { + "void" : { + } } } @@ -1607,8 +1911,12 @@ "label" : "_", "name" : "result", "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } } } } @@ -1631,8 +1939,12 @@ ], "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } } } } @@ -1673,6 +1985,64 @@ } } }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalCount", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "direction", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalTheme", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "httpStatus", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, { "isReadonly" : false, "isStatic" : false, @@ -1686,6 +2056,30 @@ } } } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "helper", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalHelper", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } } ], "swiftCallName" : "SwiftDataProcessor" @@ -6181,8 +6575,12 @@ "label" : "_", "name" : "result", "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } } } } @@ -6205,8 +6603,12 @@ ], "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } } } } @@ -6244,6 +6646,60 @@ } } }, + { + "isReadonly" : false, + "name" : "optionalCount", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "direction", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "optionalTheme", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "httpStatus", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, { "isReadonly" : false, "name" : "apiResult", @@ -6256,6 +6712,28 @@ } } } + }, + { + "isReadonly" : false, + "name" : "helper", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "isReadonly" : false, + "name" : "optionalHelper", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } } ] } diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index cb67a6a70..10c390af8 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -811,12 +811,19 @@ function setupTestGlobals(global) { function testProtocolSupport(exports) { let processorValue = 0; let processorLabel = ""; - let apiResultValue = null; + let lastAPIResult = null; const jsProcessor = { count: 0, name: "JSProcessor", optionalTag: null, - apiResult: null, + direction: null, + optionalTheme: null, + httpStatus: null, + get apiResult() { return lastAPIResult; }, + set apiResult(value) { lastAPIResult = value; }, + helper: new exports.Greeter("JSHelper"), + optionalHelper: null, + optionalCount: null, increment(amount) { processorValue += amount; this.count += amount; }, getValue() { return processorValue; }, setLabelElements(labelPrefix, labelSuffix) { processorLabel = labelPrefix + labelSuffix; }, @@ -828,154 +835,213 @@ function testProtocolSupport(exports) { return greeter ? `JSProcessor processed optional: ${greeter.greet()}` : "JSProcessor received null"; }, createOptionalGreeter() { return new exports.Greeter("JSOptionalGreeter"); }, - handleAPIResult(result) { apiResultValue = result; }, - getAPIResult() { return apiResultValue; } + handleAPIResult(result) { lastAPIResult = result; }, + getAPIResult() { return lastAPIResult; } }; - const manager = new exports.DataProcessorManager(jsProcessor); - - assert.equal(jsProcessor.count, 0); - assert.equal(jsProcessor.name, "JSProcessor"); - - manager.incrementByAmount(4); - assert.equal(manager.getCurrentValue(), 4); + const successResult = { tag: exports.Result.Tag.Success, param0: "Operation completed" }; + const failureResult = { tag: exports.Result.Tag.Failure, param0: 500 }; + + const jsManager = new exports.DataProcessorManager(jsProcessor); + + jsManager.incrementByAmount(4); + assert.equal(jsManager.getCurrentValue(), 4); assert.equal(jsProcessor.count, 4); - manager.setProcessorLabel("Test", "Label"); - assert.equal(manager.getProcessorLabel(), "TestLabel"); - assert.equal(jsProcessor.getLabel(), "TestLabel"); + jsManager.setProcessorLabel("Test", "Label"); + assert.equal(jsManager.getProcessorLabel(), "TestLabel"); + + assert.equal(jsManager.isProcessorEven(), true); + jsManager.incrementByAmount(1); + assert.equal(jsManager.isProcessorEven(), false); + + assert.equal(jsManager.getProcessorOptionalTag(), null); + jsManager.setProcessorOptionalTag("test-tag"); + assert.equal(jsManager.getProcessorOptionalTag(), "test-tag"); + jsManager.setProcessorOptionalTag("another-tag"); + assert.equal(jsManager.getProcessorOptionalTag(), "another-tag"); + jsManager.setProcessorOptionalTag(null); + assert.equal(jsManager.getProcessorOptionalTag(), null); + + // Test direct property access for optionalTag + jsProcessor.optionalTag = "direct-tag"; + assert.equal(jsManager.getProcessorOptionalTag(), "direct-tag"); + assert.equal(jsProcessor.optionalTag, "direct-tag"); + jsProcessor.optionalTag = null; + assert.equal(jsManager.getProcessorOptionalTag(), null); + assert.equal(jsProcessor.optionalTag, null); - assert.equal(manager.isProcessorEven(), true); - manager.incrementByAmount(1); - assert.equal(manager.isProcessorEven(), false); - assert.equal(jsProcessor.isEven(), false); + assert.equal(jsManager.getProcessorDirection(), null); + jsManager.setProcessorDirection(exports.Direction.North); + assert.equal(jsManager.getProcessorDirection(), exports.Direction.North); + jsManager.setProcessorDirection(exports.Direction.East); + assert.equal(jsManager.getProcessorDirection(), exports.Direction.East); + jsManager.setProcessorDirection(null); + assert.equal(jsManager.getProcessorDirection(), null); + + assert.equal(jsManager.getProcessorTheme(), null); + jsManager.setProcessorTheme(exports.Theme.Light); + assert.equal(jsManager.getProcessorTheme(), exports.Theme.Light); + jsManager.setProcessorTheme(exports.Theme.Dark); + assert.equal(jsManager.getProcessorTheme(), exports.Theme.Dark); + jsManager.setProcessorTheme(null); + assert.equal(jsManager.getProcessorTheme(), null); + + assert.equal(jsManager.getProcessorHttpStatus(), null); + jsManager.setProcessorHttpStatus(exports.HttpStatus.Ok); + assert.equal(jsManager.getProcessorHttpStatus(), exports.HttpStatus.Ok); + jsManager.setProcessorHttpStatus(exports.HttpStatus.NotFound); + assert.equal(jsManager.getProcessorHttpStatus(), exports.HttpStatus.NotFound); + jsManager.setProcessorHttpStatus(null); + assert.equal(jsManager.getProcessorHttpStatus(), null); - jsProcessor.increment(3); - assert.equal(jsProcessor.getValue(), 8); - manager.release(); + jsProcessor.handleAPIResult(successResult); + assert.deepEqual(jsProcessor.getAPIResult(), successResult); + + jsProcessor.handleAPIResult(failureResult); + assert.deepEqual(jsProcessor.getAPIResult(), failureResult); + + jsProcessor.apiResult = successResult; + assert.deepEqual(jsProcessor.apiResult, successResult); + jsProcessor.apiResult = null; + assert.equal(jsProcessor.apiResult, null); + assert.equal(jsManager.getProcessorAPIResult(), null); + + assert.equal(jsProcessor.helper.name, "JSHelper"); + const newHelper = new exports.Greeter("UpdatedHelper"); + jsProcessor.helper = newHelper; + assert.equal(jsProcessor.helper.name, "UpdatedHelper"); + assert.equal(jsProcessor.helper.greet(), "Hello, UpdatedHelper!"); + + assert.equal(jsProcessor.optionalHelper, null); + const optHelper = new exports.Greeter("OptHelper"); + jsProcessor.optionalHelper = optHelper; + assert.equal(jsProcessor.optionalHelper.name, "OptHelper"); + assert.equal(jsProcessor.optionalHelper.greet(), "Hello, OptHelper!"); + jsProcessor.optionalHelper = null; + assert.equal(jsProcessor.optionalHelper, null); + + assert.equal(jsManager.getProcessorOptionalCount(), null); + jsManager.setProcessorOptionalCount(42); + assert.equal(jsManager.getProcessorOptionalCount(), 42); + jsManager.setProcessorOptionalCount(0); + assert.equal(jsManager.getProcessorOptionalCount(), 0); + jsManager.setProcessorOptionalCount(-100); + assert.equal(jsManager.getProcessorOptionalCount(), -100); + jsManager.setProcessorOptionalCount(null); + assert.equal(jsManager.getProcessorOptionalCount(), null); + + assert.equal(jsProcessor.optionalCount, null); + jsProcessor.optionalCount = 42; + assert.equal(jsProcessor.optionalCount, 42); + assert.equal(jsManager.getProcessorOptionalCount(), 42); + jsProcessor.optionalCount = 0; + assert.equal(jsProcessor.optionalCount, 0); + jsProcessor.optionalCount = null; + assert.equal(jsProcessor.optionalCount, null); + + newHelper.release(); + optHelper.release(); + jsManager.release(); const swiftProcessor = new exports.SwiftDataProcessor(); const swiftManager = new exports.DataProcessorManager(swiftProcessor); - assert.equal(swiftProcessor.count, 0); - assert.equal(swiftProcessor.name, "SwiftDataProcessor"); - swiftManager.incrementByAmount(10); assert.equal(swiftManager.getCurrentValue(), 10); - assert.equal(swiftProcessor.count, 10); swiftManager.setProcessorLabel("Swift", "Label"); assert.equal(swiftManager.getProcessorLabel(), "SwiftLabel"); - swiftProcessor.increment(5); - assert.equal(swiftProcessor.getValue(), 15); - assert.equal(swiftProcessor.count, 15); - - swiftProcessor.count = 100; - assert.equal(swiftProcessor.count, 100); - assert.equal(swiftProcessor.getValue(), 100); - - const testGreeter = new exports.Greeter("TestUser"); - const jsResult = jsProcessor.processGreeter(testGreeter); - assert.equal(jsResult, "JSProcessor processed: Hello, TestUser!"); - - const swiftResult = swiftProcessor.processGreeter(testGreeter); - assert.equal(swiftResult, "SwiftProcessor processed: Hello, TestUser!"); - - // Test swiftHeapObject return from protocol methods - const jsCreatedGreeter = jsProcessor.createGreeter(); - assert.equal(jsCreatedGreeter.name, "JSProcessorGreeter"); - assert.equal(jsCreatedGreeter.greet(), "Hello, JSProcessorGreeter!"); - jsCreatedGreeter.release(); - - const swiftCreatedGreeter = swiftProcessor.createGreeter(); - assert.equal(swiftCreatedGreeter.name, "ProcessorGreeter"); - assert.equal(swiftCreatedGreeter.greet(), "Hello, ProcessorGreeter!"); - swiftCreatedGreeter.release(); - - const optGreeterTest = new exports.Greeter("OptionalTest"); - assert.equal(jsProcessor.processOptionalGreeter(optGreeterTest), "JSProcessor processed optional: Hello, OptionalTest!"); - assert.equal(jsProcessor.processOptionalGreeter(null), "JSProcessor received null"); - assert.equal(swiftProcessor.processOptionalGreeter(optGreeterTest), "SwiftProcessor processed optional: Hello, OptionalTest!"); - assert.equal(swiftProcessor.processOptionalGreeter(null), "SwiftProcessor received nil"); - optGreeterTest.release(); - - const jsOptGreeter = jsProcessor.createOptionalGreeter(); - assert.notEqual(jsOptGreeter, null); - assert.equal(jsOptGreeter.name, "JSOptionalGreeter"); - jsOptGreeter.release(); - - const swiftOptGreeter = swiftProcessor.createOptionalGreeter(); - assert.notEqual(swiftOptGreeter, null); - assert.equal(swiftOptGreeter.name, "OptionalProcessorGreeter"); - swiftOptGreeter.release(); - - assert.equal(jsProcessor.optionalTag, null); - jsProcessor.optionalTag = "test-tag"; - assert.equal(jsProcessor.optionalTag, "test-tag"); - jsProcessor.optionalTag = null; - assert.equal(jsProcessor.optionalTag, null); - - const successResult = { tag: exports.Result.Tag.Success, param0: "Operation completed" }; - const failureResult = { tag: exports.Result.Tag.Failure, param0: 500 }; - - jsProcessor.handleAPIResult(successResult); - assert.deepEqual(jsProcessor.getAPIResult(), successResult); - - jsProcessor.handleAPIResult(failureResult); - assert.deepEqual(jsProcessor.getAPIResult(), failureResult); - - assert.equal(jsProcessor.apiResult, null); - jsProcessor.apiResult = successResult; - assert.deepEqual(jsProcessor.apiResult, successResult); - jsProcessor.apiResult = null; - assert.equal(jsProcessor.apiResult, null); - - testGreeter.release(); - + assert.equal(swiftManager.isProcessorEven(), true); + swiftManager.incrementByAmount(1); + assert.equal(swiftManager.isProcessorEven(), false); + + assert.equal(swiftManager.getProcessorDirection(), null); + swiftManager.setProcessorDirection(exports.Direction.South); + assert.equal(swiftManager.getProcessorDirection(), exports.Direction.South); + swiftManager.setProcessorDirection(exports.Direction.West); + assert.equal(swiftManager.getProcessorDirection(), exports.Direction.West); + swiftManager.setProcessorDirection(null); + assert.equal(swiftManager.getProcessorDirection(), null); + + assert.equal(swiftManager.getProcessorTheme(), null); + swiftProcessor.optionalTheme = exports.Theme.Light; + assert.equal(swiftManager.getProcessorTheme(), exports.Theme.Light); + swiftManager.setProcessorTheme(exports.Theme.Auto); + assert.equal(swiftManager.getProcessorTheme(), exports.Theme.Auto); + swiftManager.setProcessorTheme(exports.Theme.Light); + assert.equal(swiftManager.getProcessorTheme(), exports.Theme.Light); + swiftManager.setProcessorTheme(null); + assert.equal(swiftManager.getProcessorTheme(), null); + + assert.equal(swiftManager.getProcessorHttpStatus(), null); + swiftManager.setProcessorHttpStatus(exports.HttpStatus.ServerError); + assert.equal(swiftManager.getProcessorHttpStatus(), exports.HttpStatus.ServerError); + swiftManager.setProcessorHttpStatus(exports.HttpStatus.Ok); + assert.equal(swiftManager.getProcessorHttpStatus(), exports.HttpStatus.Ok); + swiftManager.setProcessorHttpStatus(null); + assert.equal(swiftManager.getProcessorHttpStatus(), null); + + swiftProcessor.handleAPIResult(successResult); + assert.deepEqual(swiftProcessor.getAPIResult(), successResult); + assert.deepEqual(swiftManager.getProcessorAPIResult(), successResult); + + swiftProcessor.handleAPIResult(failureResult); + assert.deepEqual(swiftProcessor.getAPIResult(), failureResult); + assert.deepEqual(swiftManager.getProcessorAPIResult(), failureResult); + swiftManager.setProcessorAPIResult(successResult); + assert.deepEqual(swiftProcessor.getAPIResult(), successResult); + swiftManager.release(); swiftProcessor.release(); - let optionalProcessorValue = 100; - let optionalProcessorLabel = "optional"; - const optionalProcessor = { + let backupValue = 100; + const backupProcessor = { count: 100, - name: "OptionalProcessor", - optionalTag: "optional-tag", + name: "BackupProcessor", + optionalTag: null, + direction: null, + optionalTheme: null, + httpStatus: null, apiResult: null, - increment(amount) { optionalProcessorValue += amount; this.count += amount; }, - getValue() { return optionalProcessorValue; }, - setLabelElements(labelPrefix, labelSuffix) { optionalProcessorLabel = labelPrefix + labelSuffix; }, - getLabel() { return optionalProcessorLabel; }, - isEven() { return optionalProcessorValue % 2 === 0; }, - processGreeter(greeter) { return `OptionalProcessor processed: ${greeter.greet()}`; }, - createGreeter() { return new exports.Greeter("OptionalProcessorGreeter"); }, - processOptionalGreeter(greeter) { - return greeter ? `OptionalProcessor processed optional: ${greeter.greet()}` : "OptionalProcessor received null"; - }, + helper: new exports.Greeter("BackupHelper"), + optionalHelper: null, + optionalCount: null, + increment(amount) { backupValue += amount; this.count += amount; }, + getValue() { return backupValue; }, + setLabelElements(labelPrefix, labelSuffix) { }, + getLabel() { return "backup"; }, + isEven() { return backupValue % 2 === 0; }, + processGreeter(greeter) { return ""; }, + createGreeter() { return new exports.Greeter("BackupGreeter"); }, + processOptionalGreeter(greeter) { return ""; }, createOptionalGreeter() { return null; }, handleAPIResult(result) { }, getAPIResult() { return { tag: exports.APIResult.Tag.Info }; } }; - let mainProcessorValue = 0; - let mainProcessorLabel = "main"; + let mainValue = 0; const mainProcessor = { count: 0, name: "MainProcessor", optionalTag: null, + direction: null, + optionalTheme: null, + httpStatus: null, apiResult: null, - increment(amount) { mainProcessorValue += amount; this.count += amount; }, - getValue() { return mainProcessorValue; }, - setLabelElements(labelPrefix, labelSuffix) { mainProcessorLabel = labelPrefix + labelSuffix; }, - getLabel() { return mainProcessorLabel; }, - isEven() { return mainProcessorValue % 2 === 0; }, - processGreeter(greeter) { return `MainProcessor processed: ${greeter.greet()}`; }, - createGreeter() { return new exports.Greeter("MainProcessorGreeter"); }, - processOptionalGreeter(greeter) { - return greeter ? `MainProcessor processed optional: ${greeter.greet()}` : "MainProcessor received null"; - }, - createOptionalGreeter() { return new exports.Greeter("MainOptionalGreeter"); }, + helper: new exports.Greeter("MainHelper"), + optionalHelper: null, + optionalCount: null, + increment(amount) { mainValue += amount; this.count += amount; }, + getValue() { return mainValue; }, + setLabelElements(labelPrefix, labelSuffix) { }, + getLabel() { return "main"; }, + isEven() { return mainValue % 2 === 0; }, + processGreeter(greeter) { return ""; }, + createGreeter() { return new exports.Greeter("MainGreeter"); }, + processOptionalGreeter(greeter) { return ""; }, + createOptionalGreeter() { return null; }, handleAPIResult(result) { }, getAPIResult() { return { tag: exports.APIResult.Tag.Info }; } }; @@ -986,7 +1052,7 @@ function testProtocolSupport(exports) { assert.equal(managerWithOptional.hasBackup(), false); assert.equal(managerWithOptional.getBackupValue(), null); - managerWithOptional.backupProcessor = optionalProcessor; + managerWithOptional.backupProcessor = backupProcessor; assert.notEqual(managerWithOptional.backupProcessor, null); assert.equal(managerWithOptional.hasBackup(), true); @@ -1006,15 +1072,16 @@ function testProtocolSupport(exports) { assert.equal(managerWithOptional.getCurrentValue(), 3); assert.equal(managerWithOptional.getBackupValue(), null); - const swiftBackupProcessor = new exports.SwiftDataProcessor(); - swiftBackupProcessor.increment(1); - managerWithOptional.backupProcessor = swiftBackupProcessor; + const swiftBackup = new exports.SwiftDataProcessor(); + managerWithOptional.backupProcessor = swiftBackup; assert.equal(managerWithOptional.hasBackup(), true); + assert.equal(managerWithOptional.getBackupValue(), 0); + + managerWithOptional.incrementBoth(); + assert.equal(managerWithOptional.getCurrentValue(), 4); assert.equal(managerWithOptional.getBackupValue(), 1); - assert.equal(swiftBackupProcessor.count, 1); - assert.equal(swiftBackupProcessor.name, "SwiftDataProcessor"); managerWithOptional.release(); - swiftBackupProcessor.release(); + swiftBackup.release(); } From 617110edf7c63fbc45810c2ed21b3822d2ff1840 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 24 Oct 2025 15:01:34 +0900 Subject: [PATCH 018/252] PackageToJS: Rename `--platform` to `--default-platform` and fix tests --- Makefile | 1 - Plugins/PackageToJS/Sources/PackageToJS.swift | 5 +- .../Sources/PackageToJSPlugin.swift | 4 +- Plugins/PackageToJS/Templates/index.d.ts | 16 +--- Plugins/PackageToJS/Templates/index.js | 41 ++++++--- .../PackageToJS/Templates/package-lock.json | 41 --------- Plugins/PackageToJS/Templates/package.json | 3 - .../PackageToJS/Templates/platforms/node.d.ts | 2 +- .../PackageToJS/Templates/platforms/node.js | 2 +- Plugins/PackageToJS/Templates/tsconfig.json | 1 + .../PackageToJS/Tests/TemplatesTests.swift | 84 +++++++++++-------- .../Tests/TemporaryDirectory.swift | 7 +- .../planBuild_debug.json | 24 +++--- .../planBuild_release.json | 24 +++--- .../planBuild_release_dwarf.json | 24 +++--- .../planBuild_release_name.json | 24 +++--- .../planBuild_release_no_optimize.json | 24 +++--- .../PackagingPlannerTests/planTestBuild.json | 32 +++---- 18 files changed, 166 insertions(+), 193 deletions(-) delete mode 100644 Plugins/PackageToJS/Templates/package-lock.json diff --git a/Makefile b/Makefile index 4ae7ccaf6..5ac35ea57 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ SWIFT_SDK_ID ?= wasm32-unknown-wasi .PHONY: bootstrap bootstrap: npm ci - cd Plugins/PackageToJS/Templates && npm ci .PHONY: unittest unittest: diff --git a/Plugins/PackageToJS/Sources/PackageToJS.swift b/Plugins/PackageToJS/Sources/PackageToJS.swift index a9fe6489e..cec51cfb2 100644 --- a/Plugins/PackageToJS/Sources/PackageToJS.swift +++ b/Plugins/PackageToJS/Sources/PackageToJS.swift @@ -14,7 +14,7 @@ struct PackageToJS { /// Name of the package (default: lowercased Package.swift name) var packageName: String? /// Target platform for the generated JavaScript (default: browser) - var platform: Platform = .browser + var defaultPlatform: Platform = .browser /// Whether to explain the build plan (default: false) var explain: Bool = false /// Whether to print verbose output @@ -724,7 +724,8 @@ struct PackagingPlanner { "USE_WASI_CDN": options.useCDN, "HAS_BRIDGE": exportedSkeletons.count > 0 || importedSkeletons.count > 0, "HAS_IMPORTS": importedSkeletons.count > 0, - "TARGET_PLATFORM_NODE": options.platform == .node, + "TARGET_DEFAULT_PLATFORM_NODE": options.defaultPlatform == .node, + "TARGET_DEFAULT_PLATFORM_BROWSER": options.defaultPlatform == .browser, ] let constantSubstitutions: [String: String] = [ "PACKAGE_TO_JS_MODULE_PATH": wasmFilename, diff --git a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift index e934279f6..9a35322f8 100644 --- a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift +++ b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift @@ -461,7 +461,7 @@ extension PackageToJS.PackageOptions { let configuration: String? = (extractor.extractOption(named: "configuration") + extractor.extractSingleDashOption(named: "c")).last let packageName = extractor.extractOption(named: "package-name").last - let platform = try extractor.extractPlatformOption(named: "platform") + let defaultPlatform = try extractor.extractPlatformOption(named: "default-platform") let explain = extractor.extractFlag(named: "explain") let useCDN = extractor.extractFlag(named: "use-cdn") let verbose = extractor.extractFlag(named: "verbose") @@ -470,7 +470,7 @@ extension PackageToJS.PackageOptions { outputPath: outputPath, configuration: configuration, packageName: packageName, - platform: platform, + defaultPlatform: defaultPlatform, explain: explain != 0, verbose: verbose != 0, useCDN: useCDN != 0, diff --git a/Plugins/PackageToJS/Templates/index.d.ts b/Plugins/PackageToJS/Templates/index.d.ts index 601f354be..fb063f0ab 100644 --- a/Plugins/PackageToJS/Templates/index.d.ts +++ b/Plugins/PackageToJS/Templates/index.d.ts @@ -1,15 +1,14 @@ import type { Exports, Imports, ModuleSource } from './instantiate.js' -/* #if TARGET_PLATFORM_NODE */ -import type { DefaultNodeSetupOptions } from './platforms/node.js' -/* #endif */ export type Options = { +/* #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 */ /** * The imports to use for the module @@ -21,21 +20,10 @@ export type Options = { /** * Instantiate and initialize the module * -/* #if TARGET_PLATFORM_NODE */ - * This is a convenience function for Node.js environments. -/* #else */ * This is a convenience function for browser environments. -/* #endif */ * If you need a more flexible API, see `instantiate`. */ -/* #if TARGET_PLATFORM_NODE */ -export declare function init(options?: DefaultNodeSetupOptions): Promise<{ - instance: WebAssembly.Instance, - exports: Exports -}> -/* #else */ export declare function init(options?: Options): Promise<{ instance: WebAssembly.Instance, exports: Exports }> -/* #endif */ diff --git a/Plugins/PackageToJS/Templates/index.js b/Plugins/PackageToJS/Templates/index.js index e482b8d4c..7cde8edc9 100644 --- a/Plugins/PackageToJS/Templates/index.js +++ b/Plugins/PackageToJS/Templates/index.js @@ -1,24 +1,29 @@ // @ts-check import { instantiate } from './instantiate.js'; -/* #if TARGET_PLATFORM_NODE */ -import { defaultNodeSetup /* #if USE_SHARED_MEMORY */, createDefaultWorkerFactory /* #endif */} from './platforms/node.js'; +/* #if TARGET_DEFAULT_PLATFORM_NODE */ +import { defaultNodeSetup /* #if USE_SHARED_MEMORY */, createDefaultWorkerFactory as createDefaultWorkerFactoryForNode /* #endif */} from './platforms/node.js'; /* #else */ -import { defaultBrowserSetup /* #if USE_SHARED_MEMORY */, createDefaultWorkerFactory /* #endif */} from './platforms/browser.js'; +import { defaultBrowserSetup /* #if USE_SHARED_MEMORY */, createDefaultWorkerFactory as createDefaultWorkerFactoryForBrowser /* #endif */} from './platforms/browser.js'; /* #endif */ +/* #if TARGET_DEFAULT_PLATFORM_NODE */ /** @type {import('./index.d').init} */ -export async function init(_options) { -/* #if TARGET_PLATFORM_NODE */ +async function initNode(_options) { /** @type {import('./platforms/node.d.ts').DefaultNodeSetupOptions} */ - const options = _options || {}; - const instantiateOptions = await defaultNodeSetup({ - args: options.args, - onExit: options.onExit, + const options = { + ...(_options || {}), /* #if USE_SHARED_MEMORY */ - spawnWorker: options.spawnWorker || createDefaultWorkerFactory() + spawnWorker: createDefaultWorkerFactoryForNode(), /* #endif */ - }); + }; + const instantiateOptions = await defaultNodeSetup(options); + return await instantiate(instantiateOptions); +} + /* #else */ + +/** @type {import('./index.d').init} */ +async function initBrowser(_options) { /** @type {import('./index.d').Options} */ const options = _options || { /* #if HAS_IMPORTS */ @@ -36,9 +41,19 @@ export async function init(_options) { getImports: () => options.getImports(), /* #endif */ /* #if USE_SHARED_MEMORY */ - spawnWorker: createDefaultWorkerFactory() + spawnWorker: createDefaultWorkerFactoryForBrowser() /* #endif */ }) -/* #endif */ return await instantiate(instantiateOptions); } + +/* #endif */ + +/** @type {import('./index.d').init} */ +export async function init(options) { + /* #if TARGET_DEFAULT_PLATFORM_NODE */ + return initNode(options); + /* #else */ + return initBrowser(options); + /* #endif */ +} \ No newline at end of file diff --git a/Plugins/PackageToJS/Templates/package-lock.json b/Plugins/PackageToJS/Templates/package-lock.json deleted file mode 100644 index a0a1b13a8..000000000 --- a/Plugins/PackageToJS/Templates/package-lock.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@PACKAGE_TO_JS_PACKAGE_NAME@", - "version": "0.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "@PACKAGE_TO_JS_PACKAGE_NAME@", - "version": "0.0.0", - "dependencies": { - "@bjorn3/browser_wasi_shim": "0.3.0" - }, - "devDependencies": { - "@types/node": "^22.0.0" - } - }, - "node_modules/@bjorn3/browser_wasi_shim": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@bjorn3/browser_wasi_shim/-/browser_wasi_shim-0.3.0.tgz", - "integrity": "sha512-FlRBYttPRLcWORzBe6g8nmYTafBkOEFeOqMYM4tAHJzFsQy4+xJA94z85a9BCs8S+Uzfh9LrkpII7DXr2iUVFg==", - "license": "MIT OR Apache-2.0" - }, - "node_modules/@types/node": { - "version": "22.18.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.18.11.tgz", - "integrity": "sha512-Gd33J2XIrXurb+eT2ktze3rJAfAp9ZNjlBdh4SVgyrKEOADwCbdUDaK7QgJno8Ue4kcajscsKqu6n8OBG3hhCQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~6.21.0" - } - }, - "node_modules/undici-types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", - "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", - "dev": true, - "license": "MIT" - } - } -} diff --git a/Plugins/PackageToJS/Templates/package.json b/Plugins/PackageToJS/Templates/package.json index 0566b0b5e..a3e7074bb 100644 --- a/Plugins/PackageToJS/Templates/package.json +++ b/Plugins/PackageToJS/Templates/package.json @@ -9,8 +9,5 @@ }, "dependencies": { "@bjorn3/browser_wasi_shim": "0.3.0" - }, - "devDependencies": { - "@types/node": "^22.0.0" } } diff --git a/Plugins/PackageToJS/Templates/platforms/node.d.ts b/Plugins/PackageToJS/Templates/platforms/node.d.ts index f756c8efc..ca0e826c4 100644 --- a/Plugins/PackageToJS/Templates/platforms/node.d.ts +++ b/Plugins/PackageToJS/Templates/platforms/node.d.ts @@ -13,4 +13,4 @@ export type DefaultNodeSetupOptions = { export function defaultNodeSetup(options: DefaultNodeSetupOptions): Promise -export function createDefaultWorkerFactory(preludeScript: string): (module: WebAssembly.Module, memory: WebAssembly.Memory, startArg: any) => Worker +export function createDefaultWorkerFactory(preludeScript?: string): (module: WebAssembly.Module, memory: WebAssembly.Memory, startArg: any) => Worker diff --git a/Plugins/PackageToJS/Templates/platforms/node.js b/Plugins/PackageToJS/Templates/platforms/node.js index ddd017154..2fc0e8d15 100644 --- a/Plugins/PackageToJS/Templates/platforms/node.js +++ b/Plugins/PackageToJS/Templates/platforms/node.js @@ -131,7 +131,7 @@ export async function defaultNodeSetup(options) { new PreopenDirectory("/", rootFs), ], { debug: false }) const pkgDir = path.dirname(path.dirname(fileURLToPath(import.meta.url))) - const module = await WebAssembly.compile(await readFile(path.join(pkgDir, MODULE_PATH))) + const module = await WebAssembly.compile(new Uint8Array(await readFile(path.join(pkgDir, MODULE_PATH)))) /* #if USE_SHARED_MEMORY */ const memory = new WebAssembly.Memory(MEMORY_TYPE); const threadChannel = new DefaultNodeThreadRegistry(options.spawnWorker) diff --git a/Plugins/PackageToJS/Templates/tsconfig.json b/Plugins/PackageToJS/Templates/tsconfig.json index ac3a2b01e..91fe8516f 100644 --- a/Plugins/PackageToJS/Templates/tsconfig.json +++ b/Plugins/PackageToJS/Templates/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "module": "esnext", + "lib": ["es2017", "dom"], "noEmit": true, "allowJs": true, "skipLibCheck": true, diff --git a/Plugins/PackageToJS/Tests/TemplatesTests.swift b/Plugins/PackageToJS/Tests/TemplatesTests.swift index c7b1ba6fb..5a27259c3 100644 --- a/Plugins/PackageToJS/Tests/TemplatesTests.swift +++ b/Plugins/PackageToJS/Tests/TemplatesTests.swift @@ -3,56 +3,66 @@ import Foundation @testable import PackageToJS @Suite struct TemplatesTests { - static let templatesPath = URL(fileURLWithPath: #filePath) + static let pluginPackagePath = URL(fileURLWithPath: #filePath) .deletingLastPathComponent() .deletingLastPathComponent() + static let templatesPath = + pluginPackagePath .appendingPathComponent("Templates") + static let localTemporaryDirectory = + pluginPackagePath + .appendingPathComponent("Tests") + .appendingPathComponent("TemporaryDirectory") /// `npx tsc -p Templates/tsconfig.json` /// Test both node and browser platform variants @Test(arguments: ["node", "browser"]) func tscCheck(platform: String) throws { - // Create a temporary directory for preprocessed files - let tempDir = FileManager.default.temporaryDirectory - .appendingPathComponent("JavaScriptKit-tsc-\(platform)-\(UUID().uuidString)") - defer { - try? FileManager.default.removeItem(at: tempDir) - } + // Use a local temporary directory to place instantiated templates so that + // they can reference repo-root node_modules packages like @types/node. + try FileManager.default.createDirectory( + at: Self.localTemporaryDirectory, + withIntermediateDirectories: true, + attributes: nil + ) + try withTemporaryDirectory(prefixDirectory: Self.localTemporaryDirectory) { tempDir, _ in + let destination = tempDir.appending(path: Self.templatesPath.lastPathComponent) + // Copy entire templates folder to temp location + try FileManager.default.copyItem(at: Self.templatesPath, to: destination) - // Copy entire templates folder to temp location - try FileManager.default.copyItem(at: Self.templatesPath, to: tempDir) + // Setup preprocessing conditions + let conditions: [String: Bool] = [ + "USE_SHARED_MEMORY": false, + "IS_WASI": true, + "USE_WASI_CDN": false, + "HAS_BRIDGE": false, + "HAS_IMPORTS": false, + "TARGET_DEFAULT_PLATFORM_NODE": platform == "node", + "TARGET_DEFAULT_PLATFORM_BROWSER": platform == "browser", + ] + let preprocessOptions = PreprocessOptions(conditions: conditions, substitutions: [:]) - // Setup preprocessing conditions - let conditions: [String: Bool] = [ - "USE_SHARED_MEMORY": false, - "IS_WASI": true, - "USE_WASI_CDN": false, - "HAS_BRIDGE": false, - "HAS_IMPORTS": platform == "browser", - "TARGET_PLATFORM_NODE": platform == "node", - ] - let preprocessOptions = PreprocessOptions(conditions: conditions, substitutions: [:]) + // Preprocess all JS and TS files in-place + let enumerator = FileManager.default.enumerator(at: destination, includingPropertiesForKeys: nil) + while let fileURL = enumerator?.nextObject() as? URL { + guard !fileURL.hasDirectoryPath, + fileURL.pathExtension == "js" || fileURL.pathExtension == "ts" + else { + continue + } - // Preprocess all JS and TS files in-place - let enumerator = FileManager.default.enumerator(at: tempDir, includingPropertiesForKeys: nil) - while let fileURL = enumerator?.nextObject() as? URL { - guard !fileURL.hasDirectoryPath, - fileURL.pathExtension == "js" || fileURL.pathExtension == "ts" - else { - continue + let content = try String(contentsOf: fileURL, encoding: .utf8) + let preprocessed = try preprocess(source: content, file: fileURL.path, options: preprocessOptions) + try preprocessed.write(to: fileURL, atomically: true, encoding: .utf8) } - let content = try String(contentsOf: fileURL, encoding: .utf8) - let preprocessed = try preprocess(source: content, file: fileURL.path, options: preprocessOptions) - try preprocessed.write(to: fileURL, atomically: true, encoding: .utf8) + // Run TypeScript on the preprocessed files + let tsc = Process() + tsc.executableURL = try which("npx") + tsc.arguments = ["tsc", "-p", destination.appending(path: "tsconfig.json").path] + try tsc.run() + tsc.waitUntilExit() + #expect(tsc.terminationStatus == 0) } - - // Run TypeScript on the preprocessed files - let tsc = Process() - tsc.executableURL = try which("npx") - tsc.arguments = ["tsc", "-p", tempDir.appending(path: "tsconfig.json").path] - try tsc.run() - tsc.waitUntilExit() - #expect(tsc.terminationStatus == 0) } } diff --git a/Plugins/PackageToJS/Tests/TemporaryDirectory.swift b/Plugins/PackageToJS/Tests/TemporaryDirectory.swift index 199380fac..c08b044f1 100644 --- a/Plugins/PackageToJS/Tests/TemporaryDirectory.swift +++ b/Plugins/PackageToJS/Tests/TemporaryDirectory.swift @@ -4,9 +4,12 @@ struct MakeTemporaryDirectoryError: Error { let error: CInt } -internal func withTemporaryDirectory(body: (URL, _ retain: inout Bool) throws -> T) throws -> T { +internal func withTemporaryDirectory( + prefixDirectory: URL = FileManager.default.temporaryDirectory, + body: (URL, _ retain: inout Bool) throws -> T +) throws -> T { // Create a temporary directory using mkdtemp - var template = FileManager.default.temporaryDirectory.appendingPathComponent("PackageToJSTests.XXXXXX").path + var template = prefixDirectory.appendingPathComponent("PackageToJSTests.XXXXXX").path return try template.withUTF8 { template in let copy = UnsafeMutableBufferPointer.allocate(capacity: template.count + 1) template.copyBytes(to: copy) diff --git a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_debug.json b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_debug.json index f09b0b44f..49cee1f90 100644 --- a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_debug.json +++ b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_debug.json @@ -48,7 +48,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -65,7 +65,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -82,7 +82,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -99,7 +99,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -128,7 +128,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/package.json" ], "output" : "$OUTPUT\/package.json", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT" ] @@ -155,7 +155,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -172,7 +172,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -189,7 +189,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.worker.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -206,7 +206,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -223,7 +223,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXR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dWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -257,7 +257,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", diff --git a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release.json b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release.json index 71801d180..6b1e1090c 100644 --- a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release.json +++ b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release.json @@ -62,7 +62,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -79,7 +79,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6Zm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N0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -113,7 +113,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -143,7 +143,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/package.json" ], "output" : "$OUTPUT\/package.json", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT" ] @@ -170,7 +170,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -187,7 +187,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -204,7 +204,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.worker.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -221,7 +221,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -238,7 +238,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -255,7 +255,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -272,7 +272,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", diff --git a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_dwarf.json b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_dwarf.json index f09b0b44f..49cee1f90 100644 --- a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_dwarf.json +++ b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_dwarf.json @@ -48,7 +48,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1B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FNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -82,7 +82,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -99,7 +99,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -128,7 +128,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/package.json" ], "output" : "$OUTPUT\/package.json", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLC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fTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -172,7 +172,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -189,7 +189,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.worker.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -206,7 +206,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -223,7 +223,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -240,7 +240,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -257,7 +257,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", diff --git a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_name.json b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_name.json index 71801d180..6b1e1090c 100644 --- a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_name.json +++ b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_name.json @@ -62,7 +62,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.d.ts", - "salt" : "eyJjb25kaXRpb25zIj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EFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -96,7 +96,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -113,7 +113,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -143,7 +143,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/package.json" ], "output" : "$OUTPUT\/package.json", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT" ] @@ -170,7 +170,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -187,7 +187,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -204,7 +204,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.worker.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -221,7 +221,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -238,7 +238,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -255,7 +255,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1Q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VUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", diff --git a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_no_optimize.json b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_no_optimize.json index f09b0b44f..49cee1f90 100644 --- a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_no_optimize.json +++ b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planBuild_release_no_optimize.json @@ -48,7 +48,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -65,7 +65,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/index.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -82,7 +82,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -99,7 +99,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -128,7 +128,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/package.json" ], "output" : "$OUTPUT\/package.json", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT" ] @@ -155,7 +155,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -172,7 +172,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -189,7 +189,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.worker.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -206,7 +206,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -223,7 +223,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -240,7 +240,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -257,7 +257,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", diff --git a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planTestBuild.json b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planTestBuild.json index 475f6726e..5f16f6e8e 100644 --- a/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planTestBuild.json +++ b/Plugins/PackageToJS/Tests/__Snapshots__/PackagingPlannerTests/planTestBuild.json @@ -73,7 +73,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/bin\/test.js" ], "output" : "$OUTPUT\/bin\/test.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdH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wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -123,7 +123,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -140,7 +140,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/instantiate.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -169,7 +169,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/package.json" ], "output" : "$OUTPUT\/package.json", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6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iJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -213,7 +213,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -230,7 +230,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/browser.worker.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -247,7 +247,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -264,7 +264,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/platforms\/node.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -281,7 +281,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -298,7 +298,7 @@ "$INTERMEDIATES\/wasm-imports.json" ], "output" : "$OUTPUT\/runtime.js", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/platforms", @@ -314,7 +314,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/test.browser.html" ], "output" : "$OUTPUT\/test.browser.html", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX05PREUiOmZhbHNlLCJVU0VfU0hBUkVEX01FTU9SWSI6ZmFsc2UsIlVTRV9XQVNJX0NETiI6ZmFsc2V9LCJzdWJzdGl0dXRpb25zIjp7IlBBQ0tBR0VfVE9fSlNfTU9EVUxFX1BBVEgiOiJtYWluLndhc20iLCJQQUNLQUdFX1RPX0pTX1BBQ0tBR0VfTkFNRSI6InRlc3QifX0=", "wants" : [ "$OUTPUT", "$OUTPUT\/bin" @@ -329,7 +329,7 @@ "$SELF_PACKAGE\/Plugins\/PackageToJS\/Templates\/test.d.ts" ], "output" : "$OUTPUT\/test.d.ts", - "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9QTEFURk9STV9OT0RFIjpmYWxzZSwiVVNFX1NIQVJFRF9NRU1PUlkiOmZhbHNlLCJVU0VfV0FTSV9DRE4iOmZhbHNlfSwic3Vic3RpdHV0aW9ucyI6eyJQQUNLQUdFX1RPX0pTX01PRFVMRV9QQVRIIjoibWFpbi53YXNtIiwiUEFDS0FHRV9UT19KU19QQUNLQUdFX05BTUUiOiJ0ZXN0In19", + "salt" : "eyJjb25kaXRpb25zIjp7IkhBU19CUklER0UiOmZhbHNlLCJIQVNfSU1QT1JUUyI6ZmFsc2UsIklTX1dBU0kiOnRydWUsIlRBUkdFVF9ERUZBVUxUX1BMQVRGT1JNX0JST1dTRVIiOnRydWUsIlRBUkd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" : [ "$OUTPUT", "$OUTPUT\/bin" From eb1f0e3883af4ac86e239094809cec68572e3089 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 24 Oct 2025 10:03:41 +0200 Subject: [PATCH 019/252] BridgeJS: Update PackageToJS template and add short instruction --- CONTRIBUTING.md | 4 ++++ Plugins/PackageToJS/Templates/instantiate.js | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 666b62d24..9ca71ef13 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -112,5 +112,9 @@ Run this script when you've made changes to: These changes require updating the pre-generated Swift bindings committed to the repository. +**Adding new BridgeJS intrinsics:** + +If you add new `@_extern(wasm, module: "bjs")` functions to [`BridgeJSInstrincics.swift`](Sources/JavaScriptKit/BridgeJSInstrincics.swift), also add corresponding stub entries to [`Plugins/PackageToJS/Templates/instantiate.js`](Plugins/PackageToJS/Templates/instantiate.js) in the `importObject["bjs"]` object. This allows packages without BridgeJS-generated code to instantiate successfully. + ## Support If you have any questions or need assistance, feel free to reach out via [GitHub Issues](https://github.com/swiftwasm/JavaScriptKit/issues) or [Discord](https://discord.gg/ashJW8T8yp). diff --git a/Plugins/PackageToJS/Templates/instantiate.js b/Plugins/PackageToJS/Templates/instantiate.js index 236b7020b..5d74cc7eb 100644 --- a/Plugins/PackageToJS/Templates/instantiate.js +++ b/Plugins/PackageToJS/Templates/instantiate.js @@ -54,6 +54,13 @@ async function createInstantiator(options, swift) { swift_js_return_optional_float: unexpectedBjsCall, swift_js_return_optional_heap_object: unexpectedBjsCall, swift_js_return_optional_object: unexpectedBjsCall, + swift_js_get_optional_int_presence: unexpectedBjsCall, + swift_js_get_optional_int_value: unexpectedBjsCall, + swift_js_get_optional_string: unexpectedBjsCall, + swift_js_get_optional_float_presence: unexpectedBjsCall, + swift_js_get_optional_float_value: unexpectedBjsCall, + swift_js_get_optional_double_presence: unexpectedBjsCall, + swift_js_get_optional_double_value: unexpectedBjsCall, } }, /** @param {WebAssembly.Instance} instance */ From 3d17fda4c0ad9d109e4b1fe9922cda8389f30b52 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 24 Oct 2025 10:42:53 +0200 Subject: [PATCH 020/252] BridgeJS: Swift closure support --- .../Sources/BridgeJSCore/ExportSwift.swift | 364 ++++- .../Sources/BridgeJSCore/ImportTS.swift | 24 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 349 ++++- .../Sources/BridgeJSLink/JSGlueGen.swift | 664 ++++++++- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 82 +- .../Inputs/SwiftClosure.swift | 75 + .../ArrayParameter.Import.js | 14 +- .../BridgeJSLinkTests/Async.Export.js | 14 +- .../BridgeJSLinkTests/Async.Import.js | 14 +- .../DefaultParameters.Export.js | 14 +- .../EnumAssociatedValue.Export.js | 11 +- .../BridgeJSLinkTests/EnumCase.Export.js | 14 +- .../BridgeJSLinkTests/EnumNamespace.Export.js | 11 +- .../BridgeJSLinkTests/EnumRawType.Export.js | 14 +- .../BridgeJSLinkTests/Interface.Import.js | 14 +- .../InvalidPropertyNames.Import.js | 14 +- .../MultipleImportedTypes.Import.js | 14 +- .../BridgeJSLinkTests/Namespaces.Export.js | 11 +- .../BridgeJSLinkTests/Optionals.Export.js | 14 +- .../PrimitiveParameters.Export.js | 14 +- .../PrimitiveParameters.Import.js | 14 +- .../PrimitiveReturn.Export.js | 14 +- .../PrimitiveReturn.Import.js | 14 +- .../BridgeJSLinkTests/PropertyTypes.Export.js | 14 +- .../BridgeJSLinkTests/Protocol.Export.js | 14 +- .../StaticFunctions.Export.js | 11 +- .../StaticProperties.Export.js | 14 +- .../StringParameter.Export.js | 14 +- .../StringParameter.Import.js | 14 +- .../BridgeJSLinkTests/StringReturn.Export.js | 14 +- .../BridgeJSLinkTests/StringReturn.Import.js | 14 +- .../BridgeJSLinkTests/SwiftClass.Export.js | 14 +- .../SwiftClosure.Export.d.ts | 100 ++ .../BridgeJSLinkTests/SwiftClosure.Export.js | 942 +++++++++++++ .../TS2SkeletonLike.Import.js | 14 +- .../BridgeJSLinkTests/Throws.Export.js | 14 +- .../BridgeJSLinkTests/TypeAlias.Import.js | 14 +- .../TypeScriptClass.Import.js | 14 +- .../VoidParameterVoidReturn.Export.js | 14 +- .../VoidParameterVoidReturn.Import.js | 14 +- .../ExportSwiftTests/SwiftClosure.json | 1048 ++++++++++++++ .../ExportSwiftTests/SwiftClosure.swift | 915 ++++++++++++ Plugins/PackageToJS/Templates/instantiate.js | 2 + .../JavaScriptKit/BridgeJSInstrincics.swift | 114 +- .../BridgeJS/Exporting-Swift-to-JavaScript.md | 1 + .../Exporting-Swift-Closure.md | 114 ++ .../BridgeJSRuntimeTests/ExportAPITests.swift | 178 ++- .../Generated/BridgeJS.ExportSwift.swift | 1056 +++++++++++++- .../JavaScript/BridgeJS.ExportSwift.json | 1255 ++++++++++++++++- Tests/prelude.mjs | 195 +++ 50 files changed, 7683 insertions(+), 231 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftClosure.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 4cdc8a3bc..508894629 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -28,6 +28,7 @@ public class ExportSwift { private var exportedProtocolNameByKey: [String: String] = [:] private var typeDeclResolver: TypeDeclResolver = TypeDeclResolver() private let enumCodegen: EnumCodegen = EnumCodegen() + private lazy var closureCodegen = ClosureCodegen(moduleName: moduleName) public init(progress: ProgressReporting, moduleName: String) { self.progress = progress @@ -421,7 +422,26 @@ public class ExportSwift { for param in parameterClause.parameters { let resolvedType = self.parent.lookupType(for: param.type) - + if let type = resolvedType, case .closure(let signature) = type { + if signature.isAsync { + diagnose( + node: param.type, + message: "Async is not supported for Swift closures yet." + ) + continue + } + if signature.isThrows { + diagnose( + node: param.type, + message: "Throws is not supported for Swift closures yet." + ) + continue + } + } + if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { + diagnoseNestedOptional(node: param.type, type: param.type.trimmedDescription) + continue + } if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { diagnoseNestedOptional(node: param.type, type: param.type.trimmedDescription) continue @@ -1309,6 +1329,37 @@ public class ExportSwift { } func lookupType(for type: TypeSyntax) -> BridgeType? { + if let attributedType = type.as(AttributedTypeSyntax.self) { + return lookupType(for: attributedType.baseType) + } + + // (T1, T2, ...) -> R + if let functionType = type.as(FunctionTypeSyntax.self) { + var parameters: [BridgeType] = [] + for param in functionType.parameters { + guard let paramType = lookupType(for: param.type) else { + return nil + } + parameters.append(paramType) + } + + guard let returnType = lookupType(for: functionType.returnClause.type) else { + return nil + } + + let isAsync = functionType.effectSpecifiers?.asyncSpecifier != nil + let isThrows = functionType.effectSpecifiers?.throwsClause != nil + + return .closure( + ClosureSignature( + parameters: parameters, + returnType: returnType, + isAsync: isAsync, + isThrows: isThrows + ) + ) + } + // T? if let optionalType = type.as(OptionalTypeSyntax.self) { let wrappedType = optionalType.wrappedType @@ -1426,6 +1477,30 @@ public class ExportSwift { } decls.append(Self.prelude) + // Collect all unique closure signatures + var closureSignatures: Set = [] + for function in exportedFunctions { + collectClosureSignatures(from: function.parameters, into: &closureSignatures) + collectClosureSignatures(from: function.returnType, into: &closureSignatures) + } + for klass in exportedClasses { + if let constructor = klass.constructor { + collectClosureSignatures(from: constructor.parameters, into: &closureSignatures) + } + for method in klass.methods { + collectClosureSignatures(from: method.parameters, into: &closureSignatures) + collectClosureSignatures(from: method.returnType, into: &closureSignatures) + } + for property in klass.properties { + collectClosureSignatures(from: property.type, into: &closureSignatures) + } + } + + for signature in closureSignatures.sorted(by: { $0.mangleName < $1.mangleName }) { + decls.append(try closureCodegen.renderClosureHelper(signature: signature)) + decls.append(try closureCodegen.renderClosureInvokeHandler(signature: signature)) + } + for proto in exportedProtocols { decls.append(try renderProtocolWrapper(protocol: proto)) } @@ -1498,18 +1573,25 @@ public class ExportSwift { } let typeNameForIntrinsic: String + let liftingExpr: ExprSyntax + switch param.type { + case .closure(let signature): + typeNameForIntrinsic = param.type.swiftType + liftingExpr = ExprSyntax("_BJS_Closure_\(raw: signature.mangleName).bridgeJSLift(\(raw: param.name))") case .optional(let wrappedType): typeNameForIntrinsic = "Optional<\(wrappedType.swiftType)>" + liftingExpr = ExprSyntax( + "\(raw: typeNameForIntrinsic).bridgeJSLiftParameter(\(raw: argumentsToLift.joined(separator: ", ")))" + ) default: typeNameForIntrinsic = param.type.swiftType - } - - liftedParameterExprs.append( - ExprSyntax( + liftingExpr = ExprSyntax( "\(raw: typeNameForIntrinsic).bridgeJSLiftParameter(\(raw: argumentsToLift.joined(separator: ", ")))" ) - ) + } + + liftedParameterExprs.append(liftingExpr) for (name, type) in zip(argumentsToLift, liftingInfo.parameters.map { $0.type }) { abiParameterSignatures.append((name, type)) } @@ -1660,7 +1742,11 @@ public class ExportSwift { return } - append("return ret.bridgeJSLowerReturn()") + if case .closure(let signature) = returnType { + append("return _BJS_Closure_\(raw: signature.mangleName).bridgeJSLower(ret)") + } else { + append("return ret.bridgeJSLowerReturn()") + } } func render(abiName: String) -> DeclSyntax { @@ -1730,6 +1816,204 @@ public class ExportSwift { } } + private struct ClosureCodegen { + let moduleName: String + + func generateOptionalParameterLowering(signature: ClosureSignature) throws -> String { + var lines: [String] = [] + + for (index, paramType) in signature.parameters.enumerated() { + guard case .optional(let wrappedType) = paramType else { + continue + } + + let paramName = "param\(index)" + + // Use bridgeJSLowerParameterWithRetain for heap objects in escaping closures + // to ensure proper ownership transfer + if case .swiftHeapObject = wrappedType { + lines.append( + "let (\(paramName)IsSome, \(paramName)Value) = \(paramName).bridgeJSLowerParameterWithRetain()" + ) + } else { + lines.append( + "let (\(paramName)IsSome, \(paramName)Value) = \(paramName).bridgeJSLowerParameterWithPresence()" + ) + } + } + + return lines.isEmpty ? "" : lines.joined(separator: "\n") + "\n" + } + + func renderClosureHelper(signature: ClosureSignature) throws -> DeclSyntax { + let mangledName = signature.mangleName + let helperName = "_BJS_Closure_\(mangledName)" + let boxClassName = "_BJS_ClosureBox_\(mangledName)" + + let closureParams = signature.parameters.enumerated().map { index, type in + "\(type.swiftType)" + }.joined(separator: ", ") + + let swiftEffects = (signature.isAsync ? " async" : "") + (signature.isThrows ? " throws" : "") + let swiftReturnType = signature.returnType.swiftType + let closureType = "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)" + + var invokeParams: [(name: String, type: String)] = [("_", "Int32")] + var invokeCallArgs: [String] = ["owner.callbackId"] + + for (index, paramType) in signature.parameters.enumerated() { + let paramName = "param\(index)" + + if case .optional(let wrappedType) = paramType { + invokeParams.append(("_", "Int32")) + + switch wrappedType { + case .swiftHeapObject: + invokeParams.append(("_", "UnsafeMutableRawPointer")) + case .string, .rawValueEnum(_, .string): + invokeParams.append(("_", "Int32")) + default: + let lowerInfo = try wrappedType.loweringReturnInfo() + if let wasmType = lowerInfo.returnType { + invokeParams.append(("_", wasmType.swiftType)) + } else { + invokeParams.append(("_", "Int32")) + } + } + + invokeCallArgs.append("\(paramName)IsSome") + invokeCallArgs.append("\(paramName)Value") + } else { + let lowerInfo = try paramType.loweringReturnInfo() + if let wasmType = lowerInfo.returnType { + invokeParams.append(("_", wasmType.swiftType)) + invokeCallArgs.append("\(paramName).bridgeJSLowerParameter()") + } else { + invokeParams.append(("_", "Int32")) + invokeCallArgs.append("\(paramName).bridgeJSLowerParameter()") + } + } + } + + let invokeSignature = invokeParams.map { "\($0.name): \($0.type)" }.joined(separator: ", ") + let invokeReturnType: String + if case .optional = signature.returnType { + invokeReturnType = "Void" + } else if let wasmType = try signature.returnType.liftingReturnInfo(context: .exportSwift).valueToLift { + invokeReturnType = wasmType.swiftType + } else { + invokeReturnType = "Void" + } + + let returnLifting: String + if signature.returnType == .void { + returnLifting = "_invoke(\(invokeCallArgs.joined(separator: ", ")))" + } else if case .optional = signature.returnType { + returnLifting = """ + _invoke(\(invokeCallArgs.joined(separator: ", "))) + return \(signature.returnType.swiftType).bridgeJSLiftReturnFromSideChannel() + """ + } else { + returnLifting = """ + let resultId = _invoke(\(invokeCallArgs.joined(separator: ", "))) + return \(signature.returnType.swiftType).bridgeJSLiftReturn(resultId) + """ + } + + let externName = "invoke_js_callback_\(mangledName.lowercased())" + let optionalLoweringCode = try generateOptionalParameterLowering(signature: signature) + + return """ + private final class \(raw: boxClassName): _BridgedSwiftClosureBox { + let closure: \(raw: closureType) + init(_ closure: @escaping \(raw: closureType)) { + self.closure = closure + } + } + + private enum \(raw: helperName) { + static func bridgeJSLower(_ closure: @escaping \(raw: closureType)) -> UnsafeMutableRawPointer { + let box = \(raw: boxClassName)(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> \(raw: closureType) { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] \(raw: signature.parameters.indices.map { "param\($0)" }.joined(separator: ", ")) in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "\(raw: externName)") + func _invoke(\(raw: invokeSignature)) -> \(raw: invokeReturnType) + \(raw: optionalLoweringCode)\(raw: returnLifting) + #else + fatalError("Only available on WebAssembly") + #endif + } + } + } + """ + } + + func renderClosureInvokeHandler(signature: ClosureSignature) throws -> DeclSyntax { + let boxClassName = "_BJS_ClosureBox_\(signature.mangleName)" + let abiName = "invoke_swift_closure_\(signature.mangleName.lowercased())" + + var abiParams: [(name: String, type: String)] = [("boxPtr", "UnsafeMutableRawPointer")] + var liftedParams: [String] = [] + + for (index, paramType) in signature.parameters.enumerated() { + let paramName = "param\(index)" + let liftInfo = try paramType.liftParameterInfo() + + for (argName, wasmType) in liftInfo.parameters { + let fullName = + liftInfo.parameters.count > 1 ? "\(paramName)\(argName.capitalizedFirstLetter)" : paramName + abiParams.append((fullName, wasmType.swiftType)) + } + + let argNames = liftInfo.parameters.map { (argName, _) in + liftInfo.parameters.count > 1 ? "\(paramName)\(argName.capitalizedFirstLetter)" : paramName + } + liftedParams.append("\(paramType.swiftType).bridgeJSLiftParameter(\(argNames.joined(separator: ", ")))") + } + + let paramSignature = abiParams.map { "\($0.name): \($0.type)" }.joined(separator: ", ") + let closureCall = "box.closure(\(liftedParams.joined(separator: ", ")))" + + let returnCode: String + if signature.returnType == .void { + returnCode = closureCall + } else { + returnCode = """ + let result = \(closureCall) + return result.bridgeJSLowerReturn() + """ + } + + let abiReturnType: String + if signature.returnType == .void { + abiReturnType = "Void" + } else if let wasmType = try signature.returnType.loweringReturnInfo().returnType { + abiReturnType = wasmType.swiftType + } else { + abiReturnType = "Void" + } + + return """ + @_expose(wasm, "\(raw: abiName)") + @_cdecl("\(raw: abiName)") + public func _\(raw: abiName)(\(raw: paramSignature)) -> \(raw: abiReturnType) { + #if arch(wasm32) + let box = Unmanaged<\(raw: boxClassName)>.fromOpaque(boxPtr).takeUnretainedValue() + \(raw: returnCode) + #else + fatalError("Only available on WebAssembly") + #endif + } + """ + } + + } + private struct EnumCodegen { func renderCaseEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { let typeName = enumDef.swiftCallName @@ -2187,6 +2471,29 @@ public class ExportSwift { return decls } + /// Collects all closure signatures from function parameters + private func collectClosureSignatures(from parameters: [Parameter], into signatures: inout Set) { + for param in parameters { + collectClosureSignatures(from: param.type, into: &signatures) + } + } + + /// Collects all closure signatures from a bridge type + private func collectClosureSignatures(from type: BridgeType, into signatures: inout Set) { + switch type { + case .closure(let signature): + signatures.insert(signature) + for paramType in signature.parameters { + collectClosureSignatures(from: paramType, into: &signatures) + } + collectClosureSignatures(from: signature.returnType, into: &signatures) + case .optional(let wrapped): + collectClosureSignatures(from: wrapped, into: &signatures) + default: + break + } + } + /// Generates a ConvertibleToJSValue extension for the exported class /// /// # Example @@ -2246,7 +2553,7 @@ public class ExportSwift { var externParams: [String] = ["this: Int32"] for param in method.parameters { - let loweringInfo = try param.type.loweringParameterInfo(context: .protocolExport) + let loweringInfo = try param.type.loweringParameterInfo(context: .exportSwift) for (paramName, wasmType) in loweringInfo.loweredParameters { let fullParamName = loweringInfo.loweredParameters.count > 1 @@ -2258,7 +2565,7 @@ public class ExportSwift { var preCallStatements: [String] = [] var callArgs: [String] = ["this: Int32(bitPattern: jsObject.id)"] for param in method.parameters { - let loweringInfo = try param.type.loweringParameterInfo(context: .protocolExport) + let loweringInfo = try param.type.loweringParameterInfo(context: .exportSwift) if case .optional = param.type, loweringInfo.loweredParameters.count > 1 { let isSomeName = "\(param.name)\(loweringInfo.loweredParameters[0].name.capitalizedFirstLetter)" let wrappedName = "\(param.name)\(loweringInfo.loweredParameters[1].name.capitalizedFirstLetter)" @@ -2287,7 +2594,7 @@ public class ExportSwift { } else { returnTypeStr = " -> \(method.returnType.swiftType)" let liftingInfo = try method.returnType.liftingReturnInfo( - context: .protocolExport + context: .exportSwift ) if case .optional = method.returnType { @@ -2371,30 +2678,8 @@ public class ExportSwift { className: protocolName ) - let usesSideChannel: Bool - if case .optional(let wrappedType) = property.type { - switch wrappedType { - case .string: - usesSideChannel = true - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - usesSideChannel = true - default: - usesSideChannel = true - } - case .int, .float, .double: - usesSideChannel = true - case .bool, .caseEnum, .associatedValueEnum, .swiftHeapObject: - usesSideChannel = false - default: - usesSideChannel = false - } - } else { - usesSideChannel = false - } - - let liftingInfo = try property.type.liftingReturnInfo(context: .protocolExport) + let usesSideChannel = property.type.usesSideChannelForOptionalReturn() + let liftingInfo = try property.type.liftingReturnInfo(context: .exportSwift) let getterReturnType: String let getterBody: String @@ -2430,7 +2715,7 @@ public class ExportSwift { } """ } else { - let loweringInfo = try property.type.loweringParameterInfo(context: .protocolExport) + let loweringInfo = try property.type.loweringParameterInfo(context: .exportSwift) let setterParams = (["this: Int32"] + loweringInfo.loweredParameters.map { "\($0.name): \($0.type.swiftType)" }).joined( @@ -2538,6 +2823,10 @@ extension BridgeType { case .rawValueEnum(let name, _): return name case .associatedValueEnum(let name): return name case .namespaceEnum(let name): return name + case .closure(let signature): + let paramTypes = signature.parameters.map { $0.swiftType }.joined(separator: ", ") + let effectsStr = (signature.isAsync ? " async" : "") + (signature.isThrows ? " throws" : "") + return "(\(paramTypes))\(effectsStr) -> \(signature.returnType.swiftType)" } } @@ -2591,6 +2880,8 @@ extension BridgeType { return .associatedValueEnum case .namespaceEnum: throw BridgeJSCoreError("Namespace enums are not supported to pass as parameters") + case .closure: + return LiftingIntrinsicInfo(parameters: [("callbackId", .i32)]) } } @@ -2641,6 +2932,9 @@ extension BridgeType { return .associatedValueEnum case .namespaceEnum: throw BridgeJSCoreError("Namespace enums are not supported to pass as parameters") + case .closure: + // Closures are returned as UnsafeMutableRawPointer (box pointer) + return .swiftHeapObject } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 4589817d1..af4a59c97 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -433,6 +433,8 @@ extension BridgeType { case .string: return .string case .jsObject: return .jsObject case .void: return .void + case .closure: + throw BridgeJSCoreError("Closure types are not yet supported in TypeScript imports") case .swiftHeapObject(let className): switch context { case .importTS: @@ -442,7 +444,7 @@ extension BridgeType { Swift classes can only be used in @JS protocols where Swift owns the instance. """ ) - case .protocolExport: + case .exportSwift: return LoweringParameterInfo(loweredParameters: [("pointer", .pointer)]) } case .swiftProtocol: @@ -451,14 +453,14 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .protocolExport: + case .exportSwift: return LoweringParameterInfo(loweredParameters: [("value", .i32)]) } case .rawValueEnum(_, let rawType): switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .protocolExport: + case .exportSwift: // For protocol export we return .i32 for String raw value type instead of nil return LoweringParameterInfo(loweredParameters: [("value", rawType.wasmCoreType ?? .i32)]) } @@ -466,7 +468,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .protocolExport: + case .exportSwift: return LoweringParameterInfo(loweredParameters: [("caseId", .i32)]) } case .namespaceEnum: @@ -475,7 +477,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") - case .protocolExport: + case .exportSwift: let wrappedInfo = try wrappedType.loweringParameterInfo(context: context) var params = [("isSome", WasmCoreType.i32)] params.append(contentsOf: wrappedInfo.loweredParameters) @@ -507,6 +509,8 @@ extension BridgeType { case .string: return .string case .jsObject: return .jsObject case .void: return .void + case .closure: + throw BridgeJSCoreError("Closure types are not yet supported in TypeScript imports") case .swiftHeapObject(let className): switch context { case .importTS: @@ -516,7 +520,7 @@ extension BridgeType { JavaScript cannot create Swift heap objects. """ ) - case .protocolExport: + case .exportSwift: return LiftingReturnInfo(valueToLift: .pointer) } case .swiftProtocol: @@ -525,14 +529,14 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .protocolExport: + case .exportSwift: return LiftingReturnInfo(valueToLift: .i32) } case .rawValueEnum(_, let rawType): switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .protocolExport: + case .exportSwift: // For protocol export we return .i32 for String raw value type instead of nil return LiftingReturnInfo(valueToLift: rawType.wasmCoreType ?? .i32) } @@ -540,7 +544,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .protocolExport: + case .exportSwift: return LiftingReturnInfo(valueToLift: .i32) } case .namespaceEnum: @@ -549,7 +553,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") - case .protocolExport: + case .exportSwift: let wrappedInfo = try wrappedType.liftingReturnInfo(context: context) return LiftingReturnInfo(valueToLift: wrappedInfo.valueToLift) } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 6abfd3057..eef3f31d8 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -368,9 +368,53 @@ struct BridgeJSLink { declarations.append("const enumHelpers = {};") } + declarations.append("") + declarations.append("let _exports = null;") + declarations.append("let bjs = null;") + return declarations } + /// Checks if a skeleton contains any closure types + private func hasClosureTypes(in skeleton: ExportedSkeleton) -> Bool { + for function in skeleton.functions { + if containsClosureType(in: function.parameters) || containsClosureType(in: function.returnType) { + return true + } + } + for klass in skeleton.classes { + if let constructor = klass.constructor, containsClosureType(in: constructor.parameters) { + return true + } + for method in klass.methods { + if containsClosureType(in: method.parameters) || containsClosureType(in: method.returnType) { + return true + } + } + for property in klass.properties { + if containsClosureType(in: property.type) { + return true + } + } + } + return false + } + + private func containsClosureType(in parameters: [Parameter]) -> Bool { + parameters.contains { containsClosureType(in: $0.type) } + } + + private func containsClosureType(in type: BridgeType) -> Bool { + switch type { + case .closure: + return true + case .optional(let wrapped): + return containsClosureType(in: wrapped) + default: + return false + } + } + private func generateAddImports() -> CodeFragmentPrinter { let printer = CodeFragmentPrinter() printer.write("return {") @@ -384,7 +428,7 @@ struct BridgeJSLink { printer.indent { printer.write(lines: [ - "const bjs = {};", + "bjs = {};", "importObject[\"bjs\"] = bjs;", "const imports = options.getImports(importsContext);", ]) @@ -644,11 +688,231 @@ struct BridgeJSLink { printer.write("return value;") } printer.write("}") + printer.write("bjs[\"swift_js_get_optional_heap_object_pointer\"] = function() {") + printer.indent { + printer.write("const pointer = \(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject);") + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject) = undefined;") + printer.write("return pointer || 0;") + } + printer.write("}") + + var closureSignatures: Set = [] + for skeleton in exportedSkeletons { + collectClosureSignatures(from: skeleton, into: &closureSignatures) + } + + var classToModule: [String: String] = [:] + for skeleton in exportedSkeletons { + for klass in skeleton.classes { + classToModule[klass.name] = skeleton.moduleName + } + } + + for signature in closureSignatures.sorted(by: { $0.mangleName < $1.mangleName }) { + let invokeFuncName = "invoke_js_callback_\(signature.mangleName.lowercased())" + printer.write( + lines: generateInvokeFunction( + signature: signature, + functionName: invokeFuncName, + classToModule: classToModule + ) + ) + + let lowerFuncName = "lower_closure_\(signature.mangleName.lowercased())" + printer.write( + lines: generateLowerClosureFunction( + signature: signature, + functionName: lowerFuncName + ) + ) + } + + if !closureSignatures.isEmpty { + printer.nextLine() + printer.write("bjs[\"release_js_callback\"] = function(id) {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(id);") + } + printer.write("};") + + printer.nextLine() + printer.write("bjs[\"release_swift_closure\"] = function(boxPtr) {") + printer.indent { + printer.write( + "\(JSGlueVariableScope.reservedInstance).exports._release_swift_closure(boxPtr);" + ) + } + printer.write("};") + } } } + return printer } + private func collectClosureSignatures(from skeleton: ExportedSkeleton, into signatures: inout Set) + { + for function in skeleton.functions { + collectClosureSignatures(from: function.parameters, into: &signatures) + collectClosureSignatures(from: function.returnType, into: &signatures) + } + for klass in skeleton.classes { + if let constructor = klass.constructor { + collectClosureSignatures(from: constructor.parameters, into: &signatures) + } + for method in klass.methods { + collectClosureSignatures(from: method.parameters, into: &signatures) + collectClosureSignatures(from: method.returnType, into: &signatures) + } + for property in klass.properties { + collectClosureSignatures(from: property.type, into: &signatures) + } + } + } + + private func collectClosureSignatures(from parameters: [Parameter], into signatures: inout Set) { + for param in parameters { + collectClosureSignatures(from: param.type, into: &signatures) + } + } + + private func collectClosureSignatures(from type: BridgeType, into signatures: inout Set) { + switch type { + case .closure(let signature): + signatures.insert(signature) + for paramType in signature.parameters { + collectClosureSignatures(from: paramType, into: &signatures) + } + collectClosureSignatures(from: signature.returnType, into: &signatures) + case .optional(let wrapped): + collectClosureSignatures(from: wrapped, into: &signatures) + default: + break + } + } + + private func generateInvokeFunction( + signature: ClosureSignature, + functionName: String, + classToModule: [String: String] + ) -> [String] { + let printer = CodeFragmentPrinter() + let scope = JSGlueVariableScope() + let cleanupCode = CodeFragmentPrinter() + + // Build parameter list for invoke function + var invokeParams: [String] = ["callbackId"] + for (index, paramType) in signature.parameters.enumerated() { + if case .optional = paramType { + invokeParams.append("param\(index)IsSome") + invokeParams.append("param\(index)Value") + } else { + invokeParams.append("param\(index)Id") + } + } + + printer.nextLine() + printer.write("bjs[\"\(functionName)\"] = function(\(invokeParams.joined(separator: ", "))) {") + printer.indent { + printer.write("try {") + printer.indent { + printer.write("const callback = \(JSGlueVariableScope.reservedSwift).memory.getObject(callbackId);") + + for (index, paramType) in signature.parameters.enumerated() { + let fragment = try! IntrinsicJSFragment.closureLiftParameter(type: paramType) + let args: [String] + if case .optional = paramType { + args = ["param\(index)IsSome", "param\(index)Value", "param\(index)"] + } else { + args = ["param\(index)Id", "param\(index)"] + } + _ = fragment.printCode(args, scope, printer, cleanupCode) + } + + let callbackParams = signature.parameters.indices.map { "param\($0)" }.joined(separator: ", ") + printer.write("const result = callback(\(callbackParams));") + + // Type check if needed (for example, formatName requires string return) + switch signature.returnType { + case .string: + printer.write("if (typeof result !== \"string\") {") + printer.indent { + printer.write("throw new TypeError(\"Callback must return a string\");") + } + printer.write("}") + default: + break + } + + let returnFragment = try! IntrinsicJSFragment.closureLowerReturn(type: signature.returnType) + _ = returnFragment.printCode(["result"], scope, printer, cleanupCode) + } + printer.write("} catch (error) {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedSetException)?.(error);") + let errorFragment = IntrinsicJSFragment.closureErrorReturn(type: signature.returnType) + _ = errorFragment.printCode([], scope, printer, cleanupCode) + } + printer.write("}") + } + printer.write("};") + + return printer.lines + } + + /// Generates a lower_closure_* function that wraps a Swift closure for JavaScript + private func generateLowerClosureFunction( + signature: ClosureSignature, + functionName: String + ) -> [String] { + let printer = CodeFragmentPrinter() + let scope = JSGlueVariableScope() + let cleanupCode = CodeFragmentPrinter() + + printer.nextLine() + printer.write("bjs[\"\(functionName)\"] = function(closurePtr) {") + printer.indent { + printer.write( + "return function(\(signature.parameters.indices.map { "param\($0)" }.joined(separator: ", "))) {" + ) + printer.indent { + printer.write("try {") + printer.indent { + var invokeArgs: [String] = ["closurePtr"] + + for (index, paramType) in signature.parameters.enumerated() { + let paramName = "param\(index)" + let fragment = try! IntrinsicJSFragment.lowerParameter(type: paramType) + let lowered = fragment.printCode([paramName], scope, printer, cleanupCode) + invokeArgs.append(contentsOf: lowered) + } + + // Call the Swift invoke function + let invokeCall = + "\(JSGlueVariableScope.reservedInstance).exports.invoke_swift_closure_\(signature.mangleName.lowercased())(\(invokeArgs.joined(separator: ", ")))" + + let returnFragment = try! IntrinsicJSFragment.closureLiftReturn(type: signature.returnType) + _ = returnFragment.printCode([invokeCall], scope, printer, cleanupCode) + } + printer.write("} catch (error) {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedSetException)?.(error);") + switch signature.returnType { + case .void: + printer.write("return;") + default: + printer.write("throw error;") + } + } + printer.write("}") + } + printer.write("};") + } + printer.write("};") + + return printer.lines + } + private func generateTypeScript(data: LinkData) -> String { let header = """ // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, @@ -988,36 +1252,29 @@ struct BridgeJSLink { } /// Generates JavaScript code for assigning namespaced items to globalThis - private func generateNamespacePropertyAssignments(data: LinkData, hasAnyNamespacedItems: Bool) -> [String] { + private func generateNamespacePropertyAssignments( + data: LinkData, + hasAnyNamespacedItems: Bool + ) -> [String] { let printer = CodeFragmentPrinter() - printer.write(lines: data.enumStaticAssignments) - + printer.write("const exports = {") + printer.indent() + printer.write(lines: data.exportsLines.map { "\($0)" }) + printer.unindent() + printer.write("};") + printer.write("_exports = exports;") if hasAnyNamespacedItems { - printer.write("const exports = {") - printer.indent() - printer.write(lines: data.exportsLines.map { "\($0)" }) - printer.unindent() - printer.write("};") - data.namespacedClasses.forEach { klass in let namespacePath: String = klass.namespace?.joined(separator: ".") ?? "" printer.write("globalThis.\(namespacePath).\(klass.name) = exports.\(klass.name);") } - data.namespacedFunctions.forEach { function in let namespacePath: String = function.namespace?.joined(separator: ".") ?? "" printer.write("globalThis.\(namespacePath).\(function.name) = exports.\(function.name);") } - - printer.write("return exports;") - } else { - printer.write("return {") - printer.indent() - printer.write(lines: data.exportsLines.map { "\($0)" }) - printer.unindent() - printer.write("};") } + printer.write("return exports;") return printer.lines } @@ -2017,41 +2274,20 @@ extension BridgeJSLink { } func callPropertyGetter(name: String, returnType: BridgeType) throws -> String? { - if context == .protocolExport, case .optional(let wrappedType) = returnType { - let usesSideChannel: Bool - switch wrappedType { - case .string, .int, .float, .double, .jsObject, .swiftProtocol: - usesSideChannel = true - case .rawValueEnum: - usesSideChannel = true - case .bool, .caseEnum, .swiftHeapObject, .associatedValueEnum: - usesSideChannel = false - default: - usesSideChannel = false + if context == .exportSwift, returnType.usesSideChannelForOptionalReturn() { + guard case .optional(let wrappedType) = returnType else { + fatalError("usesSideChannelForOptionalReturn returned true for non-optional type") } - if usesSideChannel { - let resultVar = scope.variable("ret") - body.write( - "let \(resultVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(self).\(name);" - ) + let resultVar = scope.variable("ret") + body.write( + "let \(resultVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(self).\(name);" + ) - switch wrappedType { - case .string, .rawValueEnum(_, .string): - body.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(resultVar);") - case .int, .rawValueEnum(_, .int): - body.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(resultVar);") - case .float, .rawValueEnum(_, .float): - body.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalFloat) = \(resultVar);") - case .double, .rawValueEnum(_, .double): - body.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalDouble) = \(resultVar);") - case .jsObject, .swiftProtocol: - body.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(resultVar);") - default: - break - } - return nil // Side-channel types return nil (no direct return value) - } + let fragment = try IntrinsicJSFragment.protocolPropertyOptionalToSideChannel(wrappedType: wrappedType) + _ = fragment.printCode([resultVar], scope, body, cleanupCode) + + return nil // Side-channel types return nil (no direct return value) } return try call( @@ -2539,7 +2775,7 @@ extension BridgeJSLink { className: `protocol`.name ) - let getterThunkBuilder = ImportedThunkBuilder(context: .protocolExport) + let getterThunkBuilder = ImportedThunkBuilder(context: .exportSwift) getterThunkBuilder.liftSelf() let returnExpr = try getterThunkBuilder.callPropertyGetter(name: property.name, returnType: property.type) let getterLines = getterThunkBuilder.renderFunction( @@ -2557,7 +2793,7 @@ extension BridgeJSLink { operation: "set", className: `protocol`.name ) - let setterThunkBuilder = ImportedThunkBuilder(context: .protocolExport) + let setterThunkBuilder = ImportedThunkBuilder(context: .exportSwift) setterThunkBuilder.liftSelf() try setterThunkBuilder.liftParameter( param: Parameter(label: nil, name: "value", type: property.type) @@ -2577,7 +2813,7 @@ extension BridgeJSLink { protocol: ExportedProtocol, method: ExportedFunction ) throws { - let thunkBuilder = ImportedThunkBuilder(context: .protocolExport) + let thunkBuilder = ImportedThunkBuilder(context: .exportSwift) thunkBuilder.liftSelf() for param in method.parameters { try thunkBuilder.liftParameter(param: param) @@ -2627,6 +2863,11 @@ extension BridgeType { return name case .swiftProtocol(let name): return name + case .closure(let signature): + let paramTypes = signature.parameters.enumerated().map { index, param in + "arg\(index): \(param.tsType)" + }.joined(separator: ", ") + return "(\(paramTypes)) => \(signature.returnType.tsType)" } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 9cdf9d72b..6ba378de5 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -411,7 +411,10 @@ struct IntrinsicJSFragment: Sendable { ) } - static func optionalLiftReturn(wrappedType: BridgeType) -> IntrinsicJSFragment { + static func optionalLiftReturn( + wrappedType: BridgeType, + context: BridgeContext = .exportSwift + ) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: [], printCode: { arguments, scope, printer, cleanupCode in @@ -441,8 +444,12 @@ struct IntrinsicJSFragment: Sendable { "const \(pointerVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject);" ) printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject) = undefined;") + let constructExpr = + context == .exportSwift + ? "\(className).__construct(\(pointerVar))" + : "_exports['\(className)'].__construct(\(pointerVar))" printer.write( - "const \(resultVar) = \(pointerVar) === null ? null : \(className).__construct(\(pointerVar));" + "const \(resultVar) = \(pointerVar) === null ? null : \(constructExpr);" ) case .caseEnum: printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalInt);") @@ -498,7 +505,7 @@ struct IntrinsicJSFragment: Sendable { static func optionalLowerReturn(wrappedType: BridgeType) throws -> IntrinsicJSFragment { switch wrappedType { - case .void, .optional, .namespaceEnum: + case .void, .optional, .namespaceEnum, .closure: throw BridgeJSLinkError(message: "Unsupported optional wrapped type for protocol export: \(wrappedType)") default: break } @@ -618,6 +625,617 @@ struct IntrinsicJSFragment: Sendable { ) } + // MARK: - Protocol Support + + static func protocolPropertyOptionalToSideChannel(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + switch wrappedType { + case .string, .int, .float, .double, .jsObject, .swiftProtocol: + break + case .rawValueEnum(_, let rawType): + switch rawType { + case .string, .int, .float, .double: + break + default: + throw BridgeJSLinkError( + message: "Unsupported raw value enum type for protocol property side channel: \(rawType)" + ) + } + default: + throw BridgeJSLinkError( + message: "Type \(wrappedType) does not use side channel for protocol property returns" + ) + } + + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanupCode in + let value = arguments[0] + + switch wrappedType { + case .string, .rawValueEnum(_, .string): + printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(value);") + case .int, .rawValueEnum(_, .int): + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(value);") + case .float, .rawValueEnum(_, .float): + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalFloat) = \(value);") + case .double, .rawValueEnum(_, .double): + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalDouble) = \(value);") + case .jsObject, .swiftProtocol: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(value);") + default: + fatalError("Unsupported type in protocolPropertyOptionalToSideChannel: \(wrappedType)") + } + + return [] + } + ) + } + + // MARK: - Closure Support + + /// Lifts a WASM parameter to JS for passing to a JS callback (invoke_js_callback_*) + static func closureLiftParameter(type: BridgeType) throws -> IntrinsicJSFragment { + switch type { + case .int, .float, .double, .caseEnum: + return IntrinsicJSFragment( + parameters: ["value", "targetVar"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("let \(arguments[1]) = \(arguments[0]);") + return [] + } + ) + case .bool: + return IntrinsicJSFragment( + parameters: ["value", "targetVar"], + printCode: { arguments, scope, printer, cleanupCode in + let baseFragment = boolLiftParameter + let lifted = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + printer.write("let \(arguments[1]) = \(lifted[0]);") + return [] + } + ) + case .string: + return IntrinsicJSFragment( + parameters: ["objectId", "targetVar"], + printCode: { arguments, scope, printer, cleanupCode in + let baseFragment = stringLiftParameter + let lifted = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + printer.write("let \(arguments[1]) = String(\(lifted[0]));") + return [] + } + ) + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + return IntrinsicJSFragment( + parameters: ["objectId", "targetVar"], + printCode: { arguments, scope, printer, cleanupCode in + let baseFragment = stringLiftParameter + let lifted = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + printer.write("let \(arguments[1]) = String(\(lifted[0]));") + return [] + } + ) + case .bool: + return IntrinsicJSFragment( + parameters: ["value", "targetVar"], + printCode: { arguments, scope, printer, cleanupCode in + let baseFragment = boolLiftParameter + let lifted = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + printer.write("let \(arguments[1]) = \(lifted[0]);") + return [] + } + ) + default: + return IntrinsicJSFragment( + parameters: ["value", "targetVar"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("let \(arguments[1]) = \(arguments[0]);") + return [] + } + ) + } + case .jsObject: + return IntrinsicJSFragment( + parameters: ["objectId", "targetVar"], + printCode: { arguments, scope, printer, cleanupCode in + let objectId = arguments[0] + let targetVar = arguments[1] + printer.write( + "let \(targetVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(objectId));" + ) + printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(objectId));") + return [] + } + ) + case .swiftHeapObject(let name): + return IntrinsicJSFragment( + parameters: ["pointer", "targetVar"], + printCode: { arguments, scope, printer, cleanupCode in + let pointer = arguments[0] + let targetVar = arguments[1] + printer.write("let \(targetVar) = _exports['\(name)'].__construct(\(pointer));") + return [] + } + ) + case .associatedValueEnum(let fullName): + return IntrinsicJSFragment( + parameters: ["caseId", "targetVar"], + printCode: { arguments, scope, printer, cleanupCode in + let caseId = arguments[0] + let targetVar = arguments[1] + let base = fullName.components(separatedBy: ".").last ?? fullName + printer.write( + "let \(targetVar) = enumHelpers.\(base).raise(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + ) + return [] + } + ) + case .optional(let wrappedType): + return try closureOptionalLiftParameter(wrappedType: wrappedType) + default: + throw BridgeJSLinkError(message: "Unsupported closure parameter type for lifting: \(type)") + } + } + + /// Handles optional parameter lifting for closure invocation + private static func closureOptionalLiftParameter(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + switch wrappedType { + case .string, .rawValueEnum, .int, .bool, .double, .float, .jsObject, .swiftHeapObject, .caseEnum, + .associatedValueEnum: + break + default: + throw BridgeJSLinkError( + message: "Unsupported optional wrapped type in closure parameter lifting: \(wrappedType)" + ) + } + + return IntrinsicJSFragment( + parameters: ["isSome", "value", "targetVar"], + printCode: { arguments, scope, printer, cleanupCode in + let isSome = arguments[0] + let value = arguments[1] + let targetVar = arguments[2] + + printer.write("let \(targetVar);") + printer.write("if (\(isSome)) {") + printer.indent() + switch wrappedType { + case .string, .rawValueEnum(_, .string): + let objectLabel = scope.variable("\(targetVar)Object") + printer.write( + "const \(objectLabel) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(value));" + ) + printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(value));") + printer.write("\(targetVar) = String(\(objectLabel));") + case .int: + printer.write("\(targetVar) = \(value) | 0;") + case .bool: + printer.write("\(targetVar) = \(value) !== 0;") + case .double: + printer.write("\(targetVar) = \(value);") + case .float: + printer.write("\(targetVar) = Math.fround(\(value));") + case .jsObject: + printer.write("\(targetVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(value));") + printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(value));") + case .swiftHeapObject(let typeName): + printer.write("\(targetVar) = _exports['\(typeName)'].__construct(\(value));") + case .caseEnum: + printer.write("\(targetVar) = \(value);") + case .rawValueEnum(_, let rawType): + switch rawType { + case .bool: + printer.write("\(targetVar) = \(value) !== 0;") + default: + printer.write("\(targetVar) = \(value);") + } + case .associatedValueEnum(let fullName): + let base = fullName.components(separatedBy: ".").last ?? fullName + printer.write( + "\(targetVar) = enumHelpers.\(base).raise(\(value), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + ) + default: + fatalError("Unsupported optional wrapped type in closure parameter lifting: \(wrappedType)") + } + printer.unindent() + printer.write("} else {") + printer.indent() + printer.write("\(targetVar) = null;") + printer.unindent() + printer.write("}") + + return [] + } + ) + } + + /// Lowers a JS return value to WASM for returning from callback (invoke_js_callback_*) + static func closureLowerReturn(type: BridgeType) throws -> IntrinsicJSFragment { + switch type { + case .void: + return IntrinsicJSFragment( + parameters: ["result"], + printCode: { _, _, printer, _ in + printer.write("return;") + return [] + } + ) + case .int, .caseEnum: + return IntrinsicJSFragment( + parameters: ["result"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("return \(arguments[0]) | 0;") + return [] + } + ) + case .bool: + return IntrinsicJSFragment( + parameters: ["result"], + printCode: { arguments, scope, printer, cleanupCode in + let baseFragment = boolLowerReturn + let lowered = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + printer.write("return \(lowered[0]);") + return [] + } + ) + case .float: + return IntrinsicJSFragment( + parameters: ["result"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("return Math.fround(\(arguments[0]));") + return [] + } + ) + case .double: + return IntrinsicJSFragment( + parameters: ["result"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("return \(arguments[0]);") + return [] + } + ) + case .string: + return IntrinsicJSFragment( + parameters: ["result"], + printCode: { arguments, scope, printer, cleanupCode in + let baseFragment = stringLowerReturn + let lowered = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + printer.write("return \(lowered[0]);") + return [] + } + ) + case .jsObject: + return IntrinsicJSFragment( + parameters: ["result"], + printCode: { arguments, scope, printer, cleanupCode in + let baseFragment = jsObjectLowerReturn + let lowered = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + printer.write("return \(lowered[0]);") + return [] + } + ) + case .swiftHeapObject: + return IntrinsicJSFragment( + parameters: ["result"], + printCode: { arguments, scope, printer, cleanupCode in + let baseFragment = swiftHeapObjectLowerReturn + let lowered = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + printer.write("return \(lowered[0]);") + return [] + } + ) + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + return IntrinsicJSFragment( + parameters: ["result"], + printCode: { arguments, scope, printer, cleanupCode in + let baseFragment = stringLowerReturn + let lowered = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + printer.write("return \(lowered[0]);") + return [] + } + ) + case .bool: + return IntrinsicJSFragment( + parameters: ["result"], + printCode: { arguments, scope, printer, cleanupCode in + let baseFragment = boolLowerReturn + let lowered = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + printer.write("return \(lowered[0]);") + return [] + } + ) + default: + return IntrinsicJSFragment( + parameters: ["result"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("return \(arguments[0]) | 0;") + return [] + } + ) + } + case .associatedValueEnum(let fullName): + return IntrinsicJSFragment( + parameters: ["result"], + printCode: { arguments, scope, printer, cleanupCode in + let result = arguments[0] + let base = fullName.components(separatedBy: ".").last ?? fullName + let caseIdVar = scope.variable("caseId") + let cleanupVar = scope.variable("cleanup") + printer.write( + "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(result));" + ) + cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") + printer.write("return \(caseIdVar);") + return [] + } + ) + case .optional(let wrappedType): + return try closureOptionalLowerReturn(wrappedType: wrappedType) + default: + throw BridgeJSLinkError(message: "Unsupported closure return type for lowering: \(type)") + } + } + + /// Handles optional return lowering for closure invocation + private static func closureOptionalLowerReturn(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: ["result"], + printCode: { arguments, scope, printer, cleanupCode in + let result = arguments[0] + + switch wrappedType { + case .swiftHeapObject: + printer.write("return \(result) ? \(result).pointer : 0;") + case .string: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(result);") + printer.write("return;") + case .int: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(result);") + printer.write("return;") + case .bool: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalBool) = \(result);") + printer.write("return;") + case .float: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalFloat) = \(result);") + printer.write("return;") + case .double: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalDouble) = \(result);") + printer.write("return;") + case .caseEnum: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(result);") + printer.write("return;") + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(result);") + printer.write("return;") + case .bool: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalBool) = \(result);") + printer.write("return;") + case .float: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalFloat) = \(result);") + printer.write("return;") + case .double: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalDouble) = \(result);") + printer.write("return;") + default: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(result);") + printer.write("return;") + } + case .associatedValueEnum(let fullName): + let base = fullName.components(separatedBy: ".").last ?? fullName + let caseIdVar = scope.variable("caseId") + let cleanupVar = scope.variable("cleanup") + printer.write("if (\(result)) {") + printer.indent() + printer.write( + "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(result));" + ) + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(caseIdVar);") + cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") + printer.unindent() + printer.write("} else {") + printer.indent() + printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = null;") + printer.unindent() + printer.write("}") + printer.write("return;") + default: + fatalError("Unsupported optional wrapped type in closure return lowering: \(wrappedType)") + } + + return [] + } + ) + } + + /// Lifts a WASM return value to JS from Swift closure (lower_closure_*) + static func closureLiftReturn(type: BridgeType) throws -> IntrinsicJSFragment { + switch type { + case .void: + return IntrinsicJSFragment( + parameters: ["invokeCall"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("\(arguments[0]);") + printer.write("return;") + return [] + } + ) + case .int, .caseEnum: + return IntrinsicJSFragment( + parameters: ["invokeCall"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("return \(arguments[0]) | 0;") + return [] + } + ) + case .bool: + return IntrinsicJSFragment( + parameters: ["invokeCall"], + printCode: { arguments, scope, printer, cleanupCode in + let baseFragment = boolLiftReturn + let lifted = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + printer.write("return \(lifted[0]);") + return [] + } + ) + case .float, .double: + return IntrinsicJSFragment( + parameters: ["invokeCall"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("return \(arguments[0]);") + return [] + } + ) + case .string: + return IntrinsicJSFragment( + parameters: ["invokeCall"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("const resultLen = \(arguments[0]);") + let baseFragment = stringLiftReturn + let lifted = baseFragment.printCode([], scope, printer, cleanupCode) + printer.write("return \(lifted[0]);") + return [] + } + ) + case .jsObject: + return IntrinsicJSFragment( + parameters: ["invokeCall"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("const resultId = \(arguments[0]);") + let baseFragment = jsObjectLiftReturn + let lifted = baseFragment.printCode(["resultId"], scope, printer, cleanupCode) + printer.write("return \(lifted[0]);") + return [] + } + ) + case .swiftHeapObject(let className): + return IntrinsicJSFragment( + parameters: ["invokeCall"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("const resultPtr = \(arguments[0]);") + printer.write("return _exports['\(className)'].__construct(resultPtr);") + return [] + } + ) + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + return IntrinsicJSFragment( + parameters: ["invokeCall"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("const resultLen = \(arguments[0]);") + let baseFragment = stringLiftReturn + let lifted = baseFragment.printCode([], scope, printer, cleanupCode) + printer.write("return \(lifted[0]);") + return [] + } + ) + case .bool: + return IntrinsicJSFragment( + parameters: ["invokeCall"], + printCode: { arguments, scope, printer, cleanupCode in + let baseFragment = boolLiftReturn + let lifted = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + printer.write("return \(lifted[0]);") + return [] + } + ) + default: + return IntrinsicJSFragment( + parameters: ["invokeCall"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("return \(arguments[0]) | 0;") + return [] + } + ) + } + case .associatedValueEnum(let fullName): + return IntrinsicJSFragment( + parameters: ["invokeCall"], + printCode: { arguments, scope, printer, cleanupCode in + printer.write("\(arguments[0]);") + let base = fullName.components(separatedBy: ".").last ?? fullName + let resultVar = scope.variable("result") + printer.write( + "const \(resultVar) = enumHelpers.\(base).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + ) + printer.write("return \(resultVar);") + return [] + } + ) + case .optional(let wrappedType): + return try closureOptionalLiftReturn(wrappedType: wrappedType) + default: + throw BridgeJSLinkError(message: "Unsupported closure return type for lifting: \(type)") + } + } + + /// Handles optional return lifting for Swift closure returns + private static func closureOptionalLiftReturn(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: ["invokeCall"], + printCode: { arguments, scope, printer, cleanupCode in + let invokeCall = arguments[0] + printer.write("\(invokeCall);") + let baseFragment = optionalLiftReturn(wrappedType: wrappedType, context: .importTS) + let lifted = baseFragment.printCode([], scope, printer, cleanupCode) + if !lifted.isEmpty { + printer.write("return \(lifted[0]);") + } + return [] + } + ) + } + + /// Provides appropriate default values for error cases in closure invocation + static func closureErrorReturn(type: BridgeType) -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanupCode in + switch type { + case .void: + printer.write("return;") + case .string: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnBytes) = new Uint8Array(0);") + printer.write("return 0;") + case .int, .bool, .caseEnum: + printer.write("return 0;") + case .float, .double: + printer.write("return 0.0;") + case .jsObject, .swiftHeapObject: + printer.write("return 0;") + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + printer.write("\(JSGlueVariableScope.reservedStorageToReturnBytes) = new Uint8Array(0);") + printer.write("return 0;") + case .bool, .int, .int32, .int64, .uint, .uint32, .uint64: + printer.write("return 0;") + case .float, .double: + printer.write("return 0.0;") + } + case .associatedValueEnum: + printer.write("return;") + case .optional(let wrappedType): + switch wrappedType { + case .swiftHeapObject: + printer.write("return 0;") + default: + printer.write("return;") + } + default: + printer.write("return 0;") + } + + return [] + } + ) + } + // MARK: - ExportSwift /// Returns a fragment that lowers a JS value to Wasm core values for parameters @@ -641,6 +1259,18 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName return .associatedEnumLowerParameter(enumBase: base) + case .closure: + return IntrinsicJSFragment( + parameters: ["closure"], + printCode: { arguments, scope, printer, cleanupCode in + let closure = arguments[0] + let callbackIdVar = scope.variable("callbackId") + printer.write( + "const \(callbackIdVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(closure));" + ) + return [callbackIdVar] + } + ) case .namespaceEnum(let string): throw BridgeJSLinkError(message: "Namespace enums are not supported to be passed as parameters: \(string)") } @@ -667,6 +1297,17 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName return .associatedEnumLiftReturn(enumBase: base) + case .closure(let signature): + return IntrinsicJSFragment( + parameters: ["closurePtr"], + printCode: { arguments, scope, printer, cleanupCode in + let closurePtr = arguments[0] + let lowerFuncName = "lower_closure_\(signature.mangleName.lowercased())" + let resultVar = scope.variable("closure") + printer.write("const \(resultVar) = bjs[\"\(lowerFuncName)\"](\(closurePtr));") + return [resultVar] + } + ) case .namespaceEnum(let string): throw BridgeJSLinkError( message: "Namespace enums are not supported to be returned from functions: \(string)" @@ -689,7 +1330,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "swiftHeapObject '\(name)' can only be used in protocol exports, not in \(context)" ) - case .protocolExport: + case .exportSwift: return .swiftHeapObjectLiftParameter(name) } case .swiftProtocol: return .jsObjectLiftParameter @@ -703,7 +1344,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Optional types are not supported for imported JS functions: \(wrappedType)" ) - case .protocolExport: + case .exportSwift: return try .optionalLiftParameter(wrappedType: wrappedType) } case .caseEnum: return .identity @@ -720,7 +1361,7 @@ struct IntrinsicJSFragment: Sendable { message: "Associated value enums are not supported to be passed as parameters to imported JS functions: \(fullName)" ) - case .protocolExport: + case .exportSwift: let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( parameters: ["caseId"], @@ -734,6 +1375,8 @@ struct IntrinsicJSFragment: Sendable { } ) } + case .closure: + throw BridgeJSLinkError(message: "Closure parameters not yet implemented for imported JS functions") case .namespaceEnum(let string): throw BridgeJSLinkError( message: @@ -755,7 +1398,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "swiftHeapObject '\(name)' can only be used in protocol exports, not in \(context)" ) - case .protocolExport: + case .exportSwift: return .swiftHeapObjectLowerReturn } case .swiftProtocol: return .jsObjectLowerReturn @@ -766,8 +1409,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Optional types are not supported for imported JS functions: \(wrappedType)" ) - case .protocolExport: - // Protocol exports support Optional - use side channel approach for return values + case .exportSwift: return try .optionalLowerReturn(wrappedType: wrappedType) } case .caseEnum: return .identity @@ -784,9 +1426,11 @@ struct IntrinsicJSFragment: Sendable { message: "Associated value enums are not supported to be returned from imported JS functions: \(fullName)" ) - case .protocolExport: + case .exportSwift: return associatedValueLowerReturn(fullName: fullName) } + case .closure: + throw BridgeJSLinkError(message: "Closure return values not yet implemented for imported JS functions") case .namespaceEnum(let string): throw BridgeJSLinkError( message: "Namespace enums are not supported to be returned from imported JS functions: \(string)" diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index c9a602751..325ace7b2 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -70,10 +70,32 @@ public struct ABINameGenerator { /// Context for bridge operations that determines which types are valid public enum BridgeContext: Sendable { case importTS - case protocolExport + case exportSwift } -public enum BridgeType: Codable, Equatable, Sendable { +public struct ClosureSignature: Codable, Equatable, Hashable, Sendable { + public let parameters: [BridgeType] + public let returnType: BridgeType + public let isAsync: Bool + public let isThrows: Bool + public let mangleName: String + + public init(parameters: [BridgeType], returnType: BridgeType, isAsync: Bool = false, isThrows: Bool = false) { + self.parameters = parameters + self.returnType = returnType + self.isAsync = isAsync + self.isThrows = isThrows + + let paramPart = + parameters.isEmpty + ? "Void" + : parameters.map { $0.mangleTypeName }.joined(separator: "_") + let returnPart = returnType.mangleTypeName + self.mangleName = "\(paramPart)_To_\(returnPart)" + } +} + +public enum BridgeType: Codable, Equatable, Hashable, Sendable { case int, float, double, string, bool, jsObject(String?), swiftHeapObject(String), void indirect case optional(BridgeType) case caseEnum(String) @@ -81,6 +103,7 @@ public enum BridgeType: Codable, Equatable, Sendable { case associatedValueEnum(String) case namespaceEnum(String) case swiftProtocol(String) + indirect case closure(ClosureSignature) } public enum WasmCoreType: String, Codable, Sendable { @@ -567,6 +590,9 @@ extension BridgeType { case .swiftProtocol: // Protocols pass JSObject IDs as Int32 return .i32 + case .closure: + // Closures pass callback ID as Int32 + return .i32 } } @@ -575,4 +601,56 @@ extension BridgeType { if case .optional = self { return true } return false } + + /// Generates a mangled name for use in closure type names + /// Examples: "String", "Int", "MyClass", "Bool" + public var mangleTypeName: String { + switch self { + case .int: return "Int" + case .float: return "Float" + case .double: return "Double" + case .string: return "String" + case .bool: return "Bool" + case .void: return "Void" + case .jsObject(let name): + return name ?? "JSObject" + case .swiftHeapObject(let name): + return name + case .optional(let wrapped): + return "Optional\(wrapped.mangleTypeName)" + case .caseEnum(let name), + .rawValueEnum(let name, _), + .associatedValueEnum(let name), + .namespaceEnum(let name): + return name + case .swiftProtocol(let name): + return name + case .closure(let signature): + return "Closure_\(signature.mangleName)" + } + } + + /// Determines if an optional type requires side-channel communication for protocol property returns + /// + /// Side channels are needed when the wrapped type cannot be directly returned via WASM, + /// or when we need to distinguish null from absent value for certain primitives. + public func usesSideChannelForOptionalReturn() -> Bool { + guard case .optional(let wrappedType) = self else { return false } + + switch wrappedType { + case .string, .int, .float, .double, .jsObject, .swiftProtocol: + return true + case .rawValueEnum(_, let rawType): + switch rawType { + case .string, .int, .float, .double: + return true + default: + return false + } + case .bool, .caseEnum, .swiftHeapObject, .associatedValueEnum: + return false + default: + return false + } + } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftClosure.swift new file mode 100644 index 000000000..129f53b50 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftClosure.swift @@ -0,0 +1,75 @@ +import JavaScriptKit + +@JS public class Person { + public let name: String + + @JS public init(name: String) { + self.name = name + } +} + +@JS class TestProcessor { + private var transform: (String) -> String + + @JS init(transform: @escaping (String) -> String) { + self.transform = transform + } + + @JS func getTransform() -> (String) -> String + + @JS func processWithCustom(_ text: String, customTransform: (String) -> String) -> String + + @JS func printTogether( + person: Person, + name: String, + ratio: Double, + customTransform: (Person?, String?, Double?) -> String + ) -> String + + @JS func roundtrip(_ personClosure: (Person) -> String) -> (Person) -> String + @JS func roundtripOptional(_ personClosure: (Person?) -> String) -> (Person?) -> String + + @JS func processDirection(_ callback: (Direction) -> String) -> String + @JS func processTheme(_ callback: (Theme) -> String) -> String + @JS func processHttpStatus(_ callback: (HttpStatus) -> Int) -> Int + @JS func processAPIResult(_ callback: (APIResult) -> String) -> String + + @JS func makeDirectionChecker() -> (Direction) -> Bool + @JS func makeThemeValidator() -> (Theme) -> Bool + @JS func makeStatusCodeExtractor() -> (HttpStatus) -> Int + @JS func makeAPIResultHandler() -> (APIResult) -> String + + @JS func processOptionalDirection(_ callback: (Direction?) -> String) -> String + @JS func processOptionalTheme(_ callback: (Theme?) -> String) -> String + @JS func processOptionalAPIResult(_ callback: (APIResult?) -> String) -> String + @JS func makeOptionalDirectionFormatter() -> (Direction?) -> String +} + +@JS enum Direction { + case north + case south + case east + case west +} + +@JS enum Theme: String { + case light = "light" + case dark = "dark" + case auto = "auto" +} + +@JS enum HttpStatus: Int { + case ok = 200 + case notFound = 404 + case serverError = 500 + case unknown = -1 +} + +@JS enum APIResult { + case success(String) + case failure(Int) + case flag(Bool) + case rate(Float) + case precise(Double) + case info +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js index c9485c396..227093668 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_checkArray"] = function bjs_checkArray(a) { try { @@ -207,8 +215,10 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js index a763e45f5..372de6ec3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } }, setInstance: (i) => { instance = i; @@ -185,7 +193,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { asyncReturnVoid: function bjs_asyncReturnVoid() { const ret = instance.exports.bjs_asyncReturnVoid(); const ret1 = swift.memory.getObject(ret); @@ -232,6 +240,8 @@ export async function createInstantiator(options, swift) { return ret1; }, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js index b5537ddcb..873c9d697 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_asyncReturnVoid"] = function bjs_asyncReturnVoid() { try { @@ -251,8 +259,10 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index a2b070028..9f56215d7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -32,13 +32,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -179,6 +182,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; @@ -340,7 +348,7 @@ export async function createInstantiator(options, swift) { } } } - return { + const exports = { DefaultGreeter, EmptyGreeter, ConstructorDefaults, @@ -422,6 +430,8 @@ export async function createInstantiator(options, swift) { }, Status: StatusValues, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index b6518d71f..658361df1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -510,13 +510,16 @@ export async function createInstantiator(options, swift) { let tmpParamF32s = []; let tmpParamF64s = []; const enumHelpers = {}; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -657,6 +660,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } }, setInstance: (i) => { instance = i; @@ -826,6 +834,7 @@ export async function createInstantiator(options, swift) { NetworkingResult: NetworkingResultValues, APIOptionalResult: APIOptionalResultValues, }; + _exports = exports; return exports; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js index 04eda0631..526e2fc91 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js @@ -50,13 +50,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -197,6 +200,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } }, setInstance: (i) => { instance = i; @@ -209,7 +217,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { setDirection: function bjs_setDirection(direction) { instance.exports.bjs_setDirection(direction); }, @@ -246,6 +254,8 @@ export async function createInstantiator(options, swift) { Status: StatusValues, PublicStatus: PublicStatusValues, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index 9e645a67d..a788abf5a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -70,13 +70,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -217,6 +220,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; @@ -333,6 +341,7 @@ export async function createInstantiator(options, swift) { Port: PortValues, SupportedMethod: SupportedMethodValues, }; + _exports = exports; globalThis.Utils.Converter = exports.Converter; globalThis.Networking.API.HTTPServer = exports.HTTPServer; globalThis.Networking.APIV2.Internal.TestServer = exports.TestServer; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js index 15b03a4b0..9daa221b2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js @@ -101,13 +101,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -248,6 +251,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } }, setInstance: (i) => { instance = i; @@ -260,7 +268,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { setTheme: function bjs_setTheme(theme) { const themeBytes = textEncoder.encode(theme); const themeId = swift.memory.retain(themeBytes); @@ -483,6 +491,8 @@ export async function createInstantiator(options, swift) { Precision: PrecisionValues, Ratio: RatioValues, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js index 51921ddc3..6e5461190 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_returnAnimatable"] = function bjs_returnAnimatable() { try { @@ -213,8 +221,10 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index b6694c06b..9336edc6d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_createArrayBuffer"] = function bjs_createArrayBuffer() { try { @@ -283,8 +291,10 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index 3253d17d5..380f1a721 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_createDatabaseConnection"] = function bjs_createDatabaseConnection(config) { try { @@ -317,8 +325,10 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index 89dd90235..395b97f12 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; @@ -302,6 +310,7 @@ export async function createInstantiator(options, swift) { return ret; }, }; + _exports = exports; globalThis.__Swift.Foundation.Greeter = exports.Greeter; globalThis.Utils.Converters.Converter = exports.Converter; globalThis.__Swift.Foundation.UUID = exports.UUID; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js index 319556b90..f9c60e068 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; @@ -320,7 +328,7 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_OptionalPropertyHolder_optionalGreeter_set(this.pointer, +isSome, isSome ? value.pointer : 0); } } - return { + const exports = { Greeter, OptionalPropertyHolder, roundTripOptionalClass: function bjs_roundTripOptionalClass(value) { @@ -497,6 +505,8 @@ export async function createInstantiator(options, swift) { return optResult; }, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js index 17e1a1e5f..c8bd621df 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } }, setInstance: (i) => { instance = i; @@ -185,11 +193,13 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { check: function bjs_check(a, b, c, d) { instance.exports.bjs_check(a, b, c, d); }, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js index e8d18b98e..32f5e36f9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_check"] = function bjs_check(a, b) { try { @@ -193,8 +201,10 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js index c7efcf0d7..605a13ea6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } }, setInstance: (i) => { instance = i; @@ -185,7 +193,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { checkInt: function bjs_checkInt() { const ret = instance.exports.bjs_checkInt(); return ret; @@ -203,6 +211,8 @@ export async function createInstantiator(options, swift) { return ret !== 0; }, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js index 24fa28a0e..62122a832 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_checkNumber"] = function bjs_checkNumber() { try { @@ -204,8 +212,10 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js index bc9748d8f..e37af60c9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; @@ -344,7 +352,7 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_PropertyHolder_observedProperty_set(this.pointer, value); } } - return { + const exports = { PropertyHolder, createPropertyHolder: function bjs_createPropertyHolder(intValue, floatValue, doubleValue, boolValue, stringValue, jsObject) { const stringValueBytes = textEncoder.encode(stringValue); @@ -360,6 +368,8 @@ export async function createInstantiator(options, swift) { return ret; }, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index 2740c7c20..58f32ea96 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -91,13 +91,16 @@ export async function createInstantiator(options, swift) { let tmpParamF32s = []; let tmpParamF64s = []; const enumHelpers = {}; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -238,6 +241,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; @@ -653,7 +661,7 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_MyViewController_secondDelegate_set(this.pointer, +isSome, isSome ? swift.memory.retain(value) : 0); } } - return { + const exports = { Helper, MyViewController, Direction: DirectionValues, @@ -661,6 +669,8 @@ export async function createInstantiator(options, swift) { Result: ResultValues, Priority: PriorityValues, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index 6fa84a4fc..14f114697 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -78,13 +78,16 @@ export async function createInstantiator(options, swift) { let tmpParamF32s = []; let tmpParamF64s = []; const enumHelpers = {}; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -225,6 +228,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; @@ -324,6 +332,7 @@ export async function createInstantiator(options, swift) { } }, }; + _exports = exports; globalThis.Utils.String.uppercase = exports.uppercase; return exports; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js index 29060b938..3577228e8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js @@ -31,13 +31,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -178,6 +181,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; @@ -330,7 +338,7 @@ export async function createInstantiator(options, swift) { }, set: function(value) { instance.exports.bjs_PropertyNamespace_Nested_static_nestedDouble_set(value); } }); - return { + const exports = { PropertyClass, PropertyEnum: { ...PropertyEnumValues, @@ -364,6 +372,8 @@ export async function createInstantiator(options, swift) { } }, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js index a9f4bcd7b..a668639d4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } }, setInstance: (i) => { instance = i; @@ -185,7 +193,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { checkString: function bjs_checkString(a) { const aBytes = textEncoder.encode(a); const aId = swift.memory.retain(aBytes); @@ -202,6 +210,8 @@ export async function createInstantiator(options, swift) { return ret; }, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js index 4f6e1dae4..e13404bbf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_checkString"] = function bjs_checkString(a) { try { @@ -204,8 +212,10 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js index 2d9a848f9..f31ef1403 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } }, setInstance: (i) => { instance = i; @@ -185,7 +193,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { checkString: function bjs_checkString() { instance.exports.bjs_checkString(); const ret = tmpRetString; @@ -193,6 +201,8 @@ export async function createInstantiator(options, swift) { return ret; }, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js index 80d4fcd90..ae86fd8f1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_checkString"] = function bjs_checkString() { try { @@ -195,8 +203,10 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js index 395057d81..9a5eec432 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; @@ -269,7 +277,7 @@ export async function createInstantiator(options, swift) { } } - return { + const exports = { Greeter, PublicGreeter, PackageGreeter, @@ -277,6 +285,8 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_takeGreeter(greeter.pointer); }, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.d.ts new file mode 100644 index 000000000..942b18269 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.d.ts @@ -0,0 +1,100 @@ +// 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 const DirectionValues: { + readonly North: 0; + readonly South: 1; + readonly East: 2; + readonly West: 3; +}; +export type DirectionTag = typeof DirectionValues[keyof typeof DirectionValues]; + +export const ThemeValues: { + readonly Light: "light"; + readonly Dark: "dark"; + readonly Auto: "auto"; +}; +export type ThemeTag = typeof ThemeValues[keyof typeof ThemeValues]; + +export const HttpStatusValues: { + readonly Ok: 200; + readonly NotFound: 404; + readonly ServerError: 500; + readonly Unknown: -1; +}; +export type HttpStatusTag = typeof HttpStatusValues[keyof typeof HttpStatusValues]; + +export const APIResultValues: { + readonly Tag: { + readonly Success: 0; + readonly Failure: 1; + readonly Flag: 2; + readonly Rate: 3; + readonly Precise: 4; + readonly Info: 5; + }; +}; + +export type APIResultTag = + { tag: typeof APIResultValues.Tag.Success; param0: string } | { tag: typeof APIResultValues.Tag.Failure; param0: number } | { tag: typeof APIResultValues.Tag.Flag; param0: boolean } | { tag: typeof APIResultValues.Tag.Rate; param0: number } | { tag: typeof APIResultValues.Tag.Precise; param0: number } | { tag: typeof APIResultValues.Tag.Info } + +export type DirectionObject = typeof DirectionValues; + +export type ThemeObject = typeof ThemeValues; + +export type HttpStatusObject = typeof HttpStatusValues; + +export type APIResultObject = typeof APIResultValues; + +/// 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 Person extends SwiftHeapObject { +} +export interface TestProcessor extends SwiftHeapObject { + getTransform(): (arg0: string) => string; + processWithCustom(text: string, customTransform: (arg0: string) => string): string; + printTogether(person: Person, name: string, ratio: number, customTransform: (arg0: Person | null, arg1: string | null, arg2: number | null) => string): string; + roundtrip(personClosure: (arg0: Person) => string): (arg0: Person) => string; + roundtripOptional(personClosure: (arg0: Person | null) => string): (arg0: Person | null) => string; + processDirection(callback: (arg0: DirectionTag) => string): string; + processTheme(callback: (arg0: ThemeTag) => string): string; + processHttpStatus(callback: (arg0: HttpStatusTag) => number): number; + processAPIResult(callback: (arg0: APIResultTag) => string): string; + makeDirectionChecker(): (arg0: DirectionTag) => boolean; + makeThemeValidator(): (arg0: ThemeTag) => boolean; + makeStatusCodeExtractor(): (arg0: HttpStatusTag) => number; + makeAPIResultHandler(): (arg0: APIResultTag) => string; + processOptionalDirection(callback: (arg0: DirectionTag | null) => string): string; + processOptionalTheme(callback: (arg0: ThemeTag | null) => string): string; + processOptionalAPIResult(callback: (arg0: APIResultTag | null) => string): string; + makeOptionalDirectionFormatter(): (arg0: DirectionTag | null) => string; +} +export type Exports = { + Person: { + new(name: string): Person; + } + TestProcessor: { + new(transform: (arg0: string) => string): TestProcessor; + } + Direction: DirectionObject + Theme: ThemeObject + HttpStatus: HttpStatusObject + APIResult: APIResultObject +} +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/SwiftClosure.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js new file mode 100644 index 000000000..4d0a3ab29 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js @@ -0,0 +1,942 @@ +// 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 const DirectionValues = { + North: 0, + South: 1, + East: 2, + West: 3, +}; + +export const ThemeValues = { + Light: "light", + Dark: "dark", + Auto: "auto", +}; + +export const HttpStatusValues = { + Ok: 200, + NotFound: 404, + ServerError: 500, + Unknown: -1, +}; + +export const APIResultValues = { + Tag: { + Success: 0, + Failure: 1, + Flag: 2, + Rate: 3, + Precise: 4, + Info: 5, + }, +}; + +const __bjs_createAPIResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case APIResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: APIResultValues.Tag.Success, cleanup }; + } + case APIResultValues.Tag.Failure: { + tmpParamInts.push((value.param0 | 0)); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Failure, cleanup }; + } + case APIResultValues.Tag.Flag: { + tmpParamInts.push(value.param0 ? 1 : 0); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Flag, cleanup }; + } + case APIResultValues.Tag.Rate: { + tmpParamF32s.push(Math.fround(value.param0)); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Rate, cleanup }; + } + case APIResultValues.Tag.Precise: { + tmpParamF64s.push(value.param0); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Precise, cleanup }; + } + case APIResultValues.Tag.Info: { + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Info, cleanup }; + } + default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); + } + }, + raise: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { + const tag = tmpRetTag | 0; + switch (tag) { + case APIResultValues.Tag.Success: { + const string = tmpRetStrings.pop(); + return { tag: APIResultValues.Tag.Success, param0: string }; + } + case APIResultValues.Tag.Failure: { + const int = tmpRetInts.pop(); + return { tag: APIResultValues.Tag.Failure, param0: int }; + } + case APIResultValues.Tag.Flag: { + const bool = tmpRetInts.pop(); + return { tag: APIResultValues.Tag.Flag, param0: bool }; + } + case APIResultValues.Tag.Rate: { + const f32 = tmpRetF32s.pop(); + return { tag: APIResultValues.Tag.Rate, param0: f32 }; + } + case APIResultValues.Tag.Precise: { + const f64 = tmpRetF64s.pop(); + return { tag: APIResultValues.Tag.Precise, param0: f64 }; + } + case APIResultValues.Tag.Info: return { tag: APIResultValues.Tag.Info }; + default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); + } + } + }); +}; +export async function createInstantiator(options, swift) { + let instance; + let memory; + let setException; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + const enumHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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["invoke_js_callback_apiresult_to_string"] = function(callbackId, param0Id) { + try { + const callback = swift.memory.getObject(callbackId); + let param0 = enumHelpers.APIResult.raise(param0Id, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const result = callback(param0); + if (typeof result !== "string") { + throw new TypeError("Callback must return a string"); + } + tmpRetBytes = textEncoder.encode(result); + return tmpRetBytes.length; + } catch (error) { + setException?.(error); + tmpRetBytes = new Uint8Array(0); + return 0; + } + }; + + bjs["lower_closure_apiresult_to_string"] = function(closurePtr) { + return function(param0) { + try { + const { caseId: param0CaseId, cleanup: param0Cleanup } = enumHelpers.APIResult.lower(param0); + const resultLen = instance.exports.invoke_swift_closure_apiresult_to_string(closurePtr, param0CaseId); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + + bjs["invoke_js_callback_direction_to_bool"] = function(callbackId, param0Id) { + try { + const callback = swift.memory.getObject(callbackId); + let param0 = param0Id; + const result = callback(param0); + return result ? 1 : 0; + } catch (error) { + setException?.(error); + return 0; + } + }; + + bjs["lower_closure_direction_to_bool"] = function(closurePtr) { + return function(param0) { + try { + return instance.exports.invoke_swift_closure_direction_to_bool(closurePtr, param0) !== 0; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + + bjs["invoke_js_callback_direction_to_string"] = function(callbackId, param0Id) { + try { + const callback = swift.memory.getObject(callbackId); + let param0 = param0Id; + const result = callback(param0); + if (typeof result !== "string") { + throw new TypeError("Callback must return a string"); + } + tmpRetBytes = textEncoder.encode(result); + return tmpRetBytes.length; + } catch (error) { + setException?.(error); + tmpRetBytes = new Uint8Array(0); + return 0; + } + }; + + bjs["lower_closure_direction_to_string"] = function(closurePtr) { + return function(param0) { + try { + const resultLen = instance.exports.invoke_swift_closure_direction_to_string(closurePtr, param0); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + + bjs["invoke_js_callback_httpstatus_to_int"] = function(callbackId, param0Id) { + try { + const callback = swift.memory.getObject(callbackId); + let param0 = param0Id; + const result = callback(param0); + return result | 0; + } catch (error) { + setException?.(error); + return 0; + } + }; + + bjs["lower_closure_httpstatus_to_int"] = function(closurePtr) { + return function(param0) { + try { + return instance.exports.invoke_swift_closure_httpstatus_to_int(closurePtr, param0) | 0; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + + bjs["invoke_js_callback_optionalapiresult_to_string"] = function(callbackId, param0IsSome, param0Value) { + try { + const callback = swift.memory.getObject(callbackId); + let param0; + if (param0IsSome) { + param0 = enumHelpers.APIResult.raise(param0Value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + } else { + param0 = null; + } + const result = callback(param0); + if (typeof result !== "string") { + throw new TypeError("Callback must return a string"); + } + tmpRetBytes = textEncoder.encode(result); + return tmpRetBytes.length; + } catch (error) { + setException?.(error); + tmpRetBytes = new Uint8Array(0); + return 0; + } + }; + + bjs["lower_closure_optionalapiresult_to_string"] = function(closurePtr) { + return function(param0) { + try { + const isSome = param0 != null; + let param0CaseId, param0Cleanup; + if (isSome) { + const enumResult = enumHelpers.APIResult.lower(param0); + param0CaseId = enumResult.caseId; + param0Cleanup = enumResult.cleanup; + } + const resultLen = instance.exports.invoke_swift_closure_optionalapiresult_to_string(closurePtr, +isSome, isSome ? param0CaseId : 0); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + + bjs["invoke_js_callback_optionaldirection_to_string"] = function(callbackId, param0IsSome, param0Value) { + try { + const callback = swift.memory.getObject(callbackId); + let param0; + if (param0IsSome) { + param0 = param0Value; + } else { + param0 = null; + } + const result = callback(param0); + if (typeof result !== "string") { + throw new TypeError("Callback must return a string"); + } + tmpRetBytes = textEncoder.encode(result); + return tmpRetBytes.length; + } catch (error) { + setException?.(error); + tmpRetBytes = new Uint8Array(0); + return 0; + } + }; + + bjs["lower_closure_optionaldirection_to_string"] = function(closurePtr) { + return function(param0) { + try { + const isSome = param0 != null; + const resultLen = instance.exports.invoke_swift_closure_optionaldirection_to_string(closurePtr, +isSome, isSome ? param0 : 0); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + + bjs["invoke_js_callback_optionalperson_optionalstring_optionaldouble_to_string"] = function(callbackId, param0IsSome, param0Value, param1IsSome, param1Value, param2IsSome, param2Value) { + try { + const callback = swift.memory.getObject(callbackId); + let param0; + if (param0IsSome) { + param0 = _exports['Person'].__construct(param0Value); + } else { + param0 = null; + } + let param1; + if (param1IsSome) { + const param1Object = swift.memory.getObject(param1Value); + swift.memory.release(param1Value); + param1 = String(param1Object); + } else { + param1 = null; + } + let param2; + if (param2IsSome) { + param2 = param2Value; + } else { + param2 = null; + } + const result = callback(param0, param1, param2); + if (typeof result !== "string") { + throw new TypeError("Callback must return a string"); + } + tmpRetBytes = textEncoder.encode(result); + return tmpRetBytes.length; + } catch (error) { + setException?.(error); + tmpRetBytes = new Uint8Array(0); + return 0; + } + }; + + bjs["lower_closure_optionalperson_optionalstring_optionaldouble_to_string"] = function(closurePtr) { + return function(param0, param1, param2) { + try { + const isSome = param0 != null; + const isSome1 = param1 != null; + let param1Id, param1Bytes; + if (isSome1) { + param1Bytes = textEncoder.encode(param1); + param1Id = swift.memory.retain(param1Bytes); + } + const isSome2 = param2 != null; + const resultLen = instance.exports.invoke_swift_closure_optionalperson_optionalstring_optionaldouble_to_string(closurePtr, +isSome, isSome ? param0.pointer : 0, +isSome1, isSome1 ? param1Id : 0, isSome1 ? param1Bytes.length : 0, +isSome2, isSome2 ? param2 : 0); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + + bjs["invoke_js_callback_optionalperson_to_string"] = function(callbackId, param0IsSome, param0Value) { + try { + const callback = swift.memory.getObject(callbackId); + let param0; + if (param0IsSome) { + param0 = _exports['Person'].__construct(param0Value); + } else { + param0 = null; + } + const result = callback(param0); + if (typeof result !== "string") { + throw new TypeError("Callback must return a string"); + } + tmpRetBytes = textEncoder.encode(result); + return tmpRetBytes.length; + } catch (error) { + setException?.(error); + tmpRetBytes = new Uint8Array(0); + return 0; + } + }; + + bjs["lower_closure_optionalperson_to_string"] = function(closurePtr) { + return function(param0) { + try { + const isSome = param0 != null; + const resultLen = instance.exports.invoke_swift_closure_optionalperson_to_string(closurePtr, +isSome, isSome ? param0.pointer : 0); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + + bjs["invoke_js_callback_optionaltheme_to_string"] = function(callbackId, param0IsSome, param0Value) { + try { + const callback = swift.memory.getObject(callbackId); + let param0; + if (param0IsSome) { + const param0Object = swift.memory.getObject(param0Value); + swift.memory.release(param0Value); + param0 = String(param0Object); + } else { + param0 = null; + } + const result = callback(param0); + if (typeof result !== "string") { + throw new TypeError("Callback must return a string"); + } + tmpRetBytes = textEncoder.encode(result); + return tmpRetBytes.length; + } catch (error) { + setException?.(error); + tmpRetBytes = new Uint8Array(0); + return 0; + } + }; + + bjs["lower_closure_optionaltheme_to_string"] = function(closurePtr) { + return function(param0) { + try { + const isSome = param0 != null; + let param0Id, param0Bytes; + if (isSome) { + param0Bytes = textEncoder.encode(param0); + param0Id = swift.memory.retain(param0Bytes); + } + const resultLen = instance.exports.invoke_swift_closure_optionaltheme_to_string(closurePtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + + bjs["invoke_js_callback_person_to_string"] = function(callbackId, param0Id) { + try { + const callback = swift.memory.getObject(callbackId); + let param0 = _exports['Person'].__construct(param0Id); + const result = callback(param0); + if (typeof result !== "string") { + throw new TypeError("Callback must return a string"); + } + tmpRetBytes = textEncoder.encode(result); + return tmpRetBytes.length; + } catch (error) { + setException?.(error); + tmpRetBytes = new Uint8Array(0); + return 0; + } + }; + + bjs["lower_closure_person_to_string"] = function(closurePtr) { + return function(param0) { + try { + const resultLen = instance.exports.invoke_swift_closure_person_to_string(closurePtr, param0.pointer); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + + bjs["invoke_js_callback_string_to_string"] = function(callbackId, param0Id) { + try { + const callback = swift.memory.getObject(callbackId); + const param0IdObject = swift.memory.getObject(param0Id); + swift.memory.release(param0Id); + let param0 = String(param0IdObject); + const result = callback(param0); + if (typeof result !== "string") { + throw new TypeError("Callback must return a string"); + } + tmpRetBytes = textEncoder.encode(result); + return tmpRetBytes.length; + } catch (error) { + setException?.(error); + tmpRetBytes = new Uint8Array(0); + return 0; + } + }; + + bjs["lower_closure_string_to_string"] = function(closurePtr) { + return function(param0) { + try { + const param0Bytes = textEncoder.encode(param0); + const param0Id = swift.memory.retain(param0Bytes); + const resultLen = instance.exports.invoke_swift_closure_string_to_string(closurePtr, param0Id, param0Bytes.length); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + + bjs["invoke_js_callback_theme_to_bool"] = function(callbackId, param0Id) { + try { + const callback = swift.memory.getObject(callbackId); + const param0IdObject = swift.memory.getObject(param0Id); + swift.memory.release(param0Id); + let param0 = String(param0IdObject); + const result = callback(param0); + return result ? 1 : 0; + } catch (error) { + setException?.(error); + return 0; + } + }; + + bjs["lower_closure_theme_to_bool"] = function(closurePtr) { + return function(param0) { + try { + const param0Bytes = textEncoder.encode(param0); + const param0Id = swift.memory.retain(param0Bytes); + return instance.exports.invoke_swift_closure_theme_to_bool(closurePtr, param0Id, param0Bytes.length) !== 0; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + + bjs["invoke_js_callback_theme_to_string"] = function(callbackId, param0Id) { + try { + const callback = swift.memory.getObject(callbackId); + const param0IdObject = swift.memory.getObject(param0Id); + swift.memory.release(param0Id); + let param0 = String(param0IdObject); + const result = callback(param0); + if (typeof result !== "string") { + throw new TypeError("Callback must return a string"); + } + tmpRetBytes = textEncoder.encode(result); + return tmpRetBytes.length; + } catch (error) { + setException?.(error); + tmpRetBytes = new Uint8Array(0); + return 0; + } + }; + + bjs["lower_closure_theme_to_string"] = function(closurePtr) { + return function(param0) { + try { + const param0Bytes = textEncoder.encode(param0); + const param0Id = swift.memory.retain(param0Bytes); + const resultLen = instance.exports.invoke_swift_closure_theme_to_string(closurePtr, param0Id, param0Bytes.length); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + + bjs["release_js_callback"] = function(id) { + swift.memory.release(id); + }; + + bjs["release_swift_closure"] = function(boxPtr) { + instance.exports._release_swift_closure(boxPtr); + }; + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_Person_wrap"] = function(pointer) { + const obj = Person.__construct(pointer); + return swift.memory.retain(obj); + }; + importObject["TestModule"]["bjs_TestProcessor_wrap"] = function(pointer) { + const obj = TestProcessor.__construct(pointer); + return swift.memory.retain(obj); + }; + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); + enumHelpers.APIResult = APIResultHelpers; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class Person extends SwiftHeapObject { + 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); + const ret = instance.exports.bjs_Person_init(nameId, nameBytes.length); + swift.memory.release(nameId); + return Person.__construct(ret); + } + } + class TestProcessor extends SwiftHeapObject { + 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); + return TestProcessor.__construct(ret); + } + getTransform() { + const ret = instance.exports.bjs_TestProcessor_getTransform(this.pointer); + const closure = bjs["lower_closure_string_to_string"](ret); + return closure; + } + processWithCustom(text, customTransform) { + const textBytes = textEncoder.encode(text); + const textId = swift.memory.retain(textBytes); + const callbackId = swift.memory.retain(customTransform); + instance.exports.bjs_TestProcessor_processWithCustom(this.pointer, textId, textBytes.length, callbackId); + const ret = tmpRetString; + tmpRetString = undefined; + swift.memory.release(textId); + return ret; + } + printTogether(person, name, ratio, customTransform) { + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + const callbackId = swift.memory.retain(customTransform); + instance.exports.bjs_TestProcessor_printTogether(this.pointer, person.pointer, nameId, nameBytes.length, ratio, callbackId); + const ret = tmpRetString; + tmpRetString = undefined; + swift.memory.release(nameId); + return ret; + } + roundtrip(personClosure) { + const callbackId = swift.memory.retain(personClosure); + const ret = instance.exports.bjs_TestProcessor_roundtrip(this.pointer, callbackId); + const closure = bjs["lower_closure_person_to_string"](ret); + return closure; + } + roundtripOptional(personClosure) { + const callbackId = swift.memory.retain(personClosure); + const ret = instance.exports.bjs_TestProcessor_roundtripOptional(this.pointer, callbackId); + const closure = bjs["lower_closure_optionalperson_to_string"](ret); + return closure; + } + processDirection(callback) { + const callbackId = swift.memory.retain(callback); + instance.exports.bjs_TestProcessor_processDirection(this.pointer, callbackId); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + processTheme(callback) { + const callbackId = swift.memory.retain(callback); + instance.exports.bjs_TestProcessor_processTheme(this.pointer, callbackId); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + processHttpStatus(callback) { + const callbackId = swift.memory.retain(callback); + const ret = instance.exports.bjs_TestProcessor_processHttpStatus(this.pointer, callbackId); + return ret; + } + processAPIResult(callback) { + const callbackId = swift.memory.retain(callback); + instance.exports.bjs_TestProcessor_processAPIResult(this.pointer, callbackId); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + makeDirectionChecker() { + const ret = instance.exports.bjs_TestProcessor_makeDirectionChecker(this.pointer); + const closure = bjs["lower_closure_direction_to_bool"](ret); + return closure; + } + makeThemeValidator() { + const ret = instance.exports.bjs_TestProcessor_makeThemeValidator(this.pointer); + const closure = bjs["lower_closure_theme_to_bool"](ret); + return closure; + } + makeStatusCodeExtractor() { + const ret = instance.exports.bjs_TestProcessor_makeStatusCodeExtractor(this.pointer); + const closure = bjs["lower_closure_httpstatus_to_int"](ret); + return closure; + } + makeAPIResultHandler() { + const ret = instance.exports.bjs_TestProcessor_makeAPIResultHandler(this.pointer); + const closure = bjs["lower_closure_apiresult_to_string"](ret); + return closure; + } + processOptionalDirection(callback) { + const callbackId = swift.memory.retain(callback); + instance.exports.bjs_TestProcessor_processOptionalDirection(this.pointer, callbackId); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + processOptionalTheme(callback) { + const callbackId = swift.memory.retain(callback); + instance.exports.bjs_TestProcessor_processOptionalTheme(this.pointer, callbackId); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + processOptionalAPIResult(callback) { + const callbackId = swift.memory.retain(callback); + instance.exports.bjs_TestProcessor_processOptionalAPIResult(this.pointer, callbackId); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + makeOptionalDirectionFormatter() { + const ret = instance.exports.bjs_TestProcessor_makeOptionalDirectionFormatter(this.pointer); + const closure = bjs["lower_closure_optionaldirection_to_string"](ret); + return closure; + } + } + const exports = { + Person, + TestProcessor, + Direction: DirectionValues, + Theme: ThemeValues, + HttpStatus: HttpStatusValues, + APIResult: APIResultValues, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js index a1d39cd28..4c3cbc213 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_createTS2Skeleton"] = function bjs_createTS2Skeleton() { try { @@ -255,8 +263,10 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js index f2e0bfc9c..059c93157 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } }, setInstance: (i) => { instance = i; @@ -185,7 +193,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { throwsSomething: function bjs_throwsSomething() { instance.exports.bjs_throwsSomething(); if (tmpRetException) { @@ -196,6 +204,8 @@ export async function createInstantiator(options, swift) { } }, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js index 7c4438b08..320609e1c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_checkSimple"] = function bjs_checkSimple(a) { try { @@ -193,8 +201,10 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index 49b0b3310..783884efb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_Greeter_init"] = function bjs_Greeter_init(name) { try { @@ -241,8 +249,10 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js index a0f6f0dd4..b6d7a4ea3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } }, setInstance: (i) => { instance = i; @@ -185,11 +193,13 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { check: function bjs_check() { instance.exports.bjs_check(); }, }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js index bd1d9bfba..627dd140c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js @@ -26,13 +26,16 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + + let _exports = null; + let bjs = null; return { /** * @param {WebAssembly.Imports} importObject */ addImports: (importObject, importsContext) => { - const bjs = {}; + bjs = {}; importObject["bjs"] = bjs; const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { @@ -173,6 +176,11 @@ export async function createInstantiator(options, swift) { tmpRetOptionalDouble = undefined; return value; } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_check"] = function bjs_check() { try { @@ -193,8 +201,10 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - return { + const exports = { }; + _exports = exports; + return exports; }, } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json new file mode 100644 index 000000000..2354469c8 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json @@ -0,0 +1,1048 @@ +{ + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Person_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + "explicitAccessControl" : "public", + "methods" : [ + + ], + "name" : "Person", + "properties" : [ + + ], + "swiftCallName" : "Person" + }, + { + "constructor" : { + "abiName" : "bjs_TestProcessor_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "transform", + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "String_To_String", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_TestProcessor_getTransform", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTransform", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "String_To_String", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_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" : "String_To_String", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_printTogether", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "printTogether", + "parameters" : [ + { + "label" : "person", + "name" : "person", + "type" : { + "swiftHeapObject" : { + "_0" : "Person" + } + } + }, + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "label" : "ratio", + "name" : "ratio", + "type" : { + "double" : { + + } + } + }, + { + "label" : "customTransform", + "name" : "customTransform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "OptionalPerson_OptionalString_OptionalDouble_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Person" + } + } + } + }, + { + "optional" : { + "_0" : { + "string" : { + + } + } + } + }, + { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtrip", + "parameters" : [ + { + "label" : "_", + "name" : "personClosure", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "Person_To_String", + "parameters" : [ + { + "swiftHeapObject" : { + "_0" : "Person" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "Person_To_String", + "parameters" : [ + { + "swiftHeapObject" : { + "_0" : "Person" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_roundtripOptional", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptional", + "parameters" : [ + { + "label" : "_", + "name" : "personClosure", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "OptionalPerson_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Person" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "OptionalPerson_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Person" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_processDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDirection", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "Direction_To_String", + "parameters" : [ + { + "caseEnum" : { + "_0" : "Direction" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_processTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processTheme", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "Theme_To_String", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_processHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "HttpStatus_To_Int", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_processAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "APIResult_To_String", + "parameters" : [ + { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_makeDirectionChecker", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeDirectionChecker", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "Direction_To_Bool", + "parameters" : [ + { + "caseEnum" : { + "_0" : "Direction" + } + } + ], + "returnType" : { + "bool" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_makeThemeValidator", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeThemeValidator", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "Theme_To_Bool", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + ], + "returnType" : { + "bool" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_makeStatusCodeExtractor", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeStatusCodeExtractor", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "HttpStatus_To_Int", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_makeAPIResultHandler", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultHandler", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "APIResult_To_String", + "parameters" : [ + { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_processOptionalDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalDirection", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "OptionalDirection_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_processOptionalTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalTheme", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "OptionalTheme_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_processOptionalAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "OptionalAPIResult_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_makeOptionalDirectionFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalDirectionFormatter", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "OptionalDirection_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "name" : "TestProcessor", + "properties" : [ + + ], + "swiftCallName" : "TestProcessor" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "north" + }, + { + "associatedValues" : [ + + ], + "name" : "south" + }, + { + "associatedValues" : [ + + ], + "name" : "east" + }, + { + "associatedValues" : [ + + ], + "name" : "west" + } + ], + "emitStyle" : "const", + "name" : "Direction", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Direction" + }, + { + "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" + }, + { + "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" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "int" : { + + } + } + } + ], + "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" + } + ], + "functions" : [ + + ], + "moduleName" : "TestModule", + "protocols" : [ + + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift new file mode 100644 index 000000000..888dc5150 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift @@ -0,0 +1,915 @@ +// 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 + +private final class _BJS_ClosureBox_APIResult_To_String: _BridgedSwiftClosureBox { + let closure: (APIResult) -> String + init(_ closure: @escaping (APIResult) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_APIResult_To_String { + static func bridgeJSLower(_ closure: @escaping (APIResult) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_APIResult_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_apiresult_to_string") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_apiresult_to_string") +@_cdecl("invoke_swift_closure_apiresult_to_string") +public func _invoke_swift_closure_apiresult_to_string(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_APIResult_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(APIResult.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_Direction_To_Bool: _BridgedSwiftClosureBox { + let closure: (Direction) -> Bool + init(_ closure: @escaping (Direction) -> Bool) { + self.closure = closure + } +} + +private enum _BJS_Closure_Direction_To_Bool { + static func bridgeJSLower(_ closure: @escaping (Direction) -> Bool) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_Direction_To_Bool(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Bool { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_direction_to_bool") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return Bool.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_direction_to_bool") +@_cdecl("invoke_swift_closure_direction_to_bool") +public func _invoke_swift_closure_direction_to_bool(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_Direction_To_Bool>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Direction.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_Direction_To_String: _BridgedSwiftClosureBox { + let closure: (Direction) -> String + init(_ closure: @escaping (Direction) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_Direction_To_String { + static func bridgeJSLower(_ closure: @escaping (Direction) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_Direction_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_direction_to_string") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_direction_to_string") +@_cdecl("invoke_swift_closure_direction_to_string") +public func _invoke_swift_closure_direction_to_string(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_Direction_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Direction.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_HttpStatus_To_Int: _BridgedSwiftClosureBox { + let closure: (HttpStatus) -> Int + init(_ closure: @escaping (HttpStatus) -> Int) { + self.closure = closure + } +} + +private enum _BJS_Closure_HttpStatus_To_Int { + static func bridgeJSLower(_ closure: @escaping (HttpStatus) -> Int) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_HttpStatus_To_Int(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> Int { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_httpstatus_to_int") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return Int.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_httpstatus_to_int") +@_cdecl("invoke_swift_closure_httpstatus_to_int") +public func _invoke_swift_closure_httpstatus_to_int(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_HttpStatus_To_Int>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(HttpStatus.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_OptionalAPIResult_To_String: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_OptionalAPIResult_To_String { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_OptionalAPIResult_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalapiresult_to_string") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_optionalapiresult_to_string") +@_cdecl("invoke_swift_closure_optionalapiresult_to_string") +public func _invoke_swift_closure_optionalapiresult_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0CaseId: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_OptionalAPIResult_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0CaseId)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_OptionalDirection_To_String: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_OptionalDirection_To_String { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_OptionalDirection_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionaldirection_to_string") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_optionaldirection_to_string") +@_cdecl("invoke_swift_closure_optionaldirection_to_string") +public func _invoke_swift_closure_optionaldirection_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_OptionalDirection_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_OptionalPerson_OptionalString_OptionalDouble_To_String: _BridgedSwiftClosureBox { + let closure: (Optional, Optional, Optional) -> String + init(_ closure: @escaping (Optional, Optional, Optional) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_OptionalPerson_OptionalString_OptionalDouble_To_String { + static func bridgeJSLower(_ closure: @escaping (Optional, Optional, Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_OptionalPerson_OptionalString_OptionalDouble_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Optional, Optional, Optional) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0, param1, param2 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalperson_optionalstring_optionaldouble_to_string") + func _invoke(_: Int32, _: Int32, _: UnsafeMutableRawPointer, _: Int32, _: Int32, _: Int32, _: Float64) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() +let (param1IsSome, param1Value) = param1.bridgeJSLowerParameterWithPresence() +let (param2IsSome, param2Value) = param2.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(owner.callbackId, param0IsSome, param0Value, param1IsSome, param1Value, param2IsSome, param2Value) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_optionalperson_optionalstring_optionaldouble_to_string") +@_cdecl("invoke_swift_closure_optionalperson_optionalstring_optionaldouble_to_string") +public func _invoke_swift_closure_optionalperson_optionalstring_optionaldouble_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: UnsafeMutableRawPointer, param1IsSome: Int32, param1Bytes: Int32, param1Length: Int32, param2IsSome: Int32, param2Value: Float64) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_OptionalPerson_OptionalString_OptionalDouble_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value), Optional.bridgeJSLiftParameter(param1IsSome, param1Bytes, param1Length), Optional.bridgeJSLiftParameter(param2IsSome, param2Value)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_OptionalPerson_To_String: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_OptionalPerson_To_String { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_OptionalPerson_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalperson_to_string") + func _invoke(_: Int32, _: Int32, _: UnsafeMutableRawPointer) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() +let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_optionalperson_to_string") +@_cdecl("invoke_swift_closure_optionalperson_to_string") +public func _invoke_swift_closure_optionalperson_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_OptionalPerson_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_OptionalTheme_To_String: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_OptionalTheme_To_String { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_OptionalTheme_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionaltheme_to_string") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_optionaltheme_to_string") +@_cdecl("invoke_swift_closure_optionaltheme_to_string") +public func _invoke_swift_closure_optionaltheme_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Bytes: Int32, param0Length: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_OptionalTheme_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_Person_To_String: _BridgedSwiftClosureBox { + let closure: (Person) -> String + init(_ closure: @escaping (Person) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_Person_To_String { + static func bridgeJSLower(_ closure: @escaping (Person) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_Person_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Person) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_person_to_string") + func _invoke(_: Int32, _: UnsafeMutableRawPointer) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_person_to_string") +@_cdecl("invoke_swift_closure_person_to_string") +public func _invoke_swift_closure_person_to_string(boxPtr: UnsafeMutableRawPointer, param0: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_Person_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Person.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_String_To_String: _BridgedSwiftClosureBox { + let closure: (String) -> String + init(_ closure: @escaping (String) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_String_To_String { + static func bridgeJSLower(_ closure: @escaping (String) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_String_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_string_to_string") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_string_to_string") +@_cdecl("invoke_swift_closure_string_to_string") +public func _invoke_swift_closure_string_to_string(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_String_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_Theme_To_Bool: _BridgedSwiftClosureBox { + let closure: (Theme) -> Bool + init(_ closure: @escaping (Theme) -> Bool) { + self.closure = closure + } +} + +private enum _BJS_Closure_Theme_To_Bool { + static func bridgeJSLower(_ closure: @escaping (Theme) -> Bool) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_Theme_To_Bool(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Bool { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_theme_to_bool") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return Bool.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_theme_to_bool") +@_cdecl("invoke_swift_closure_theme_to_bool") +public func _invoke_swift_closure_theme_to_bool(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Int32 { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_Theme_To_Bool>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_Theme_To_String: _BridgedSwiftClosureBox { + let closure: (Theme) -> String + init(_ closure: @escaping (Theme) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_Theme_To_String { + static func bridgeJSLower(_ closure: @escaping (Theme) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_Theme_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_theme_to_string") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_theme_to_string") +@_cdecl("invoke_swift_closure_theme_to_string") +public func _invoke_swift_closure_theme_to_string(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_Theme_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + return result.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 Theme: _BridgedSwiftEnumNoPayload { +} + +extension HttpStatus: _BridgedSwiftEnumNoPayload { +} + +extension APIResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { + switch caseId { + case 0: + return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + case 1: + return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + case 2: + return .flag(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + case 3: + return .rate(Float.bridgeJSLiftParameter(_swift_js_pop_param_f32())) + case 4: + return .precise(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + case 5: + return .info + default: + fatalError("Unknown APIResult case ID: \(caseId)") + } + } + + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .failure(let param0): + _swift_js_push_int(Int32(param0)) + return Int32(1) + case .flag(let param0): + _swift_js_push_int(param0 ? 1 : 0) + return Int32(2) + case .rate(let param0): + _swift_js_push_f32(param0) + return Int32(3) + case .precise(let param0): + _swift_js_push_f64(param0) + return Int32(4) + case .info: + return Int32(5) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + switch self { + case .success(let param0): + _swift_js_push_tag(Int32(0)) + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + case .failure(let param0): + _swift_js_push_tag(Int32(1)) + _swift_js_push_int(Int32(param0)) + case .flag(let param0): + _swift_js_push_tag(Int32(2)) + _swift_js_push_int(param0 ? 1 : 0) + case .rate(let param0): + _swift_js_push_tag(Int32(3)) + _swift_js_push_f32(param0) + case .precise(let param0): + _swift_js_push_tag(Int32(4)) + _swift_js_push_f64(param0) + case .info: + _swift_js_push_tag(Int32(5)) + } + } +} + +@_expose(wasm, "bjs_Person_init") +@_cdecl("bjs_Person_init") +public func _bjs_Person_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Person(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Person_deinit") +@_cdecl("bjs_Person_deinit") +public func _bjs_Person_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension Person: ConvertibleToJSValue, _BridgedSwiftHeapObject { + public var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "TestModule", name: "bjs_Person_wrap") + func _bjs_Person_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_Person_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_Person_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +@_expose(wasm, "bjs_TestProcessor_init") +@_cdecl("bjs_TestProcessor_init") +public func _bjs_TestProcessor_init(transform: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TestProcessor(transform: _BJS_Closure_String_To_String.bridgeJSLift(transform)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_getTransform") +@_cdecl("bjs_TestProcessor_getTransform") +public func _bjs_TestProcessor_getTransform(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).getTransform() + return _BJS_Closure_String_To_String.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_processWithCustom") +@_cdecl("bjs_TestProcessor_processWithCustom") +public func _bjs_TestProcessor_processWithCustom(_self: UnsafeMutableRawPointer, textBytes: Int32, textLength: Int32, customTransform: Int32) -> Void { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processWithCustom(_: String.bridgeJSLiftParameter(textBytes, textLength), customTransform: _BJS_Closure_String_To_String.bridgeJSLift(customTransform)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_printTogether") +@_cdecl("bjs_TestProcessor_printTogether") +public func _bjs_TestProcessor_printTogether(_self: UnsafeMutableRawPointer, person: UnsafeMutableRawPointer, nameBytes: Int32, nameLength: Int32, ratio: Float64, customTransform: Int32) -> Void { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).printTogether(person: Person.bridgeJSLiftParameter(person), name: String.bridgeJSLiftParameter(nameBytes, nameLength), ratio: Double.bridgeJSLiftParameter(ratio), customTransform: _BJS_Closure_OptionalPerson_OptionalString_OptionalDouble_To_String.bridgeJSLift(customTransform)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_roundtrip") +@_cdecl("bjs_TestProcessor_roundtrip") +public func _bjs_TestProcessor_roundtrip(_self: UnsafeMutableRawPointer, personClosure: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).roundtrip(_: _BJS_Closure_Person_To_String.bridgeJSLift(personClosure)) + return _BJS_Closure_Person_To_String.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_roundtripOptional") +@_cdecl("bjs_TestProcessor_roundtripOptional") +public func _bjs_TestProcessor_roundtripOptional(_self: UnsafeMutableRawPointer, personClosure: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).roundtripOptional(_: _BJS_Closure_OptionalPerson_To_String.bridgeJSLift(personClosure)) + return _BJS_Closure_OptionalPerson_To_String.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_processDirection") +@_cdecl("bjs_TestProcessor_processDirection") +public func _bjs_TestProcessor_processDirection(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processDirection(_: _BJS_Closure_Direction_To_String.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_processTheme") +@_cdecl("bjs_TestProcessor_processTheme") +public func _bjs_TestProcessor_processTheme(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processTheme(_: _BJS_Closure_Theme_To_String.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_processHttpStatus") +@_cdecl("bjs_TestProcessor_processHttpStatus") +public func _bjs_TestProcessor_processHttpStatus(_self: UnsafeMutableRawPointer, callback: Int32) -> Int32 { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processHttpStatus(_: _BJS_Closure_HttpStatus_To_Int.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_processAPIResult") +@_cdecl("bjs_TestProcessor_processAPIResult") +public func _bjs_TestProcessor_processAPIResult(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processAPIResult(_: _BJS_Closure_APIResult_To_String.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_makeDirectionChecker") +@_cdecl("bjs_TestProcessor_makeDirectionChecker") +public func _bjs_TestProcessor_makeDirectionChecker(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() + return _BJS_Closure_Direction_To_Bool.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_makeThemeValidator") +@_cdecl("bjs_TestProcessor_makeThemeValidator") +public func _bjs_TestProcessor_makeThemeValidator(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() + return _BJS_Closure_Theme_To_Bool.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_makeStatusCodeExtractor") +@_cdecl("bjs_TestProcessor_makeStatusCodeExtractor") +public func _bjs_TestProcessor_makeStatusCodeExtractor(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() + return _BJS_Closure_HttpStatus_To_Int.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_makeAPIResultHandler") +@_cdecl("bjs_TestProcessor_makeAPIResultHandler") +public func _bjs_TestProcessor_makeAPIResultHandler(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() + return _BJS_Closure_APIResult_To_String.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_processOptionalDirection") +@_cdecl("bjs_TestProcessor_processOptionalDirection") +public func _bjs_TestProcessor_processOptionalDirection(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalDirection(_: _BJS_Closure_OptionalDirection_To_String.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_processOptionalTheme") +@_cdecl("bjs_TestProcessor_processOptionalTheme") +public func _bjs_TestProcessor_processOptionalTheme(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalTheme(_: _BJS_Closure_OptionalTheme_To_String.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_processOptionalAPIResult") +@_cdecl("bjs_TestProcessor_processOptionalAPIResult") +public func _bjs_TestProcessor_processOptionalAPIResult(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalAPIResult(_: _BJS_Closure_OptionalAPIResult_To_String.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_makeOptionalDirectionFormatter") +@_cdecl("bjs_TestProcessor_makeOptionalDirectionFormatter") +public func _bjs_TestProcessor_makeOptionalDirectionFormatter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TestProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() + return _BJS_Closure_OptionalDirection_To_String.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestProcessor_deinit") +@_cdecl("bjs_TestProcessor_deinit") +public func _bjs_TestProcessor_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension TestProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "TestModule", name: "bjs_TestProcessor_wrap") + func _bjs_TestProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_TestProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_TestProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} \ No newline at end of file diff --git a/Plugins/PackageToJS/Templates/instantiate.js b/Plugins/PackageToJS/Templates/instantiate.js index 5d74cc7eb..dca50d086 100644 --- a/Plugins/PackageToJS/Templates/instantiate.js +++ b/Plugins/PackageToJS/Templates/instantiate.js @@ -61,6 +61,8 @@ async function createInstantiator(options, swift) { swift_js_get_optional_float_value: unexpectedBjsCall, swift_js_get_optional_double_presence: unexpectedBjsCall, swift_js_get_optional_double_value: unexpectedBjsCall, + swift_js_get_optional_heap_object_pointer: unexpectedBjsCall, + release_js_callback: unexpectedBjsCall, } }, /** @param {WebAssembly.Instance} instance */ diff --git a/Sources/JavaScriptKit/BridgeJSInstrincics.swift b/Sources/JavaScriptKit/BridgeJSInstrincics.swift index 9c97583cb..5b160f779 100644 --- a/Sources/JavaScriptKit/BridgeJSInstrincics.swift +++ b/Sources/JavaScriptKit/BridgeJSInstrincics.swift @@ -29,6 +29,48 @@ import _CJavaScriptKit } #endif +// MARK: Closure Callback Management + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "release_js_callback") +@_spi(BridgeJS) public func _swift_js_release_callback(_ id: Int32) +#else +/// Releases a JavaScript callback registered from JavaScript side. +/// +/// This function is called by BridgeJS-generated code after consuming a closure +/// parameter to ensure the JavaScript callback is properly cleaned up and can be +/// garbage collected. +/// +/// - Parameter id: The callback ID to release +@_spi(BridgeJS) public func _swift_js_release_callback(_ id: Int32) { + _onlyAvailableOnWasm() +} +#endif + +/// Owns a JavaScript callback and automatically releases it on deinit. +/// This ensures the callback lives exactly as long as the Swift closure that uses it. +/// +/// When a JavaScript function is passed to Swift as a closure parameter, the callback +/// is stored in `swift.memory` with an ID. This owner class captures that ID and ensures +/// it's released when the Swift closure is deallocated, preventing memory leaks while +/// supporting both @escaping and non-escaping closures. +@_spi(BridgeJS) public final class _JSCallbackOwner { + public let callbackId: Int32 + private var isReleased: Bool = false + + public init(callbackId: Int32) { + self.callbackId = callbackId + } + + deinit { + guard !isReleased else { return } + #if arch(wasm32) + _swift_js_release_callback(callbackId) + #endif + isReleased = true + } +} + /// Retrieves and clears any pending JavaScript exception. /// /// This function checks for any JavaScript exceptions that were thrown during @@ -78,7 +120,8 @@ import _CJavaScriptKit // - `func bridgeJSLowerReturn() -> <#WasmCoreType#>`: lower the given higher-level return value to a Wasm core type // // Optional types (ExportSwift only) additionally define: -// - `func bridgeJSLowerParameterWithPresence()`: lower optional as (isSome, value) tuple for protocol setters/parameters +// - `func bridgeJSLowerParameterWithPresence()`: lower optional as (isSome, value) tuple for protocol setters/parameters (borrows object) +// - `func bridgeJSLowerParameterWithRetain()`: lower optional heap object with ownership transfer for escaping closures // - `func bridgeJSLiftReturnFromSideChannel()`: lift optional from side-channel storage for protocol property getters // // See JSGlueGen.swift in BridgeJSLink for JS-side lowering/lifting implementation. @@ -290,6 +333,26 @@ extension _BridgedSwiftHeapObject { return Unmanaged.passRetained(self).toOpaque() } } +// MARK: Closure Box Protocol + +/// A protocol that Swift closure box types must conform to. +/// +/// The conformance is automatically synthesized by the BridgeJS code generator. +@_spi(BridgeJS) public protocol _BridgedSwiftClosureBox: AnyObject {} + +/// Release function for closure boxes +/// - Parameter boxPtr: Opaque pointer to a closure box conforming to _BridgedSwiftClosureBox +#if arch(wasm32) +@_expose(wasm, "release_swift_closure") +@_cdecl("release_swift_closure") +public func _release_swift_closure(boxPtr: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(boxPtr).release() +} +#else +@_spi(BridgeJS) public func _release_swift_closure(boxPtr: UnsafeMutableRawPointer) { + _onlyAvailableOnWasm() +} +#endif extension _JSBridgedClass { // MARK: ImportTS @@ -748,17 +811,46 @@ extension Optional where Wrapped: _BridgedSwiftHeapObject { } } + /// Lowers optional Swift heap object as (isSome, pointer) tuple for protocol parameters. + /// + /// This method uses `passUnretained()` because the caller (JavaScript protocol implementation) + /// already owns the object and will not retain it. The pointer is only valid for the + /// duration of the call. + /// + /// - Returns: A tuple containing presence flag (0 for nil, 1 for some) and unretained pointer @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( isSome: Int32, pointer: UnsafeMutableRawPointer ) { switch consume self { case .none: - return (isSome: 0, pointer: UnsafeMutableRawPointer(bitPattern: 0)!) + return (isSome: 0, pointer: UnsafeMutableRawPointer(bitPattern: 1)!) case .some(let value): return (isSome: 1, pointer: value.bridgeJSLowerParameter()) } } + /// Lowers optional Swift heap object with ownership transfer for escaping closures. + /// + /// This method uses `passRetained()` to transfer ownership to JavaScript, ensuring the + /// object remains valid even if the JavaScript closure escapes and stores the parameter. + /// JavaScript must wrap the pointer with `__construct()` to create a managed reference + /// that will be cleaned up via FinalizationRegistry. + /// + /// Use this method when passing heap objects to @escaping closures that may outlive + /// the original call context. + /// + /// - Returns: A tuple containing presence flag (0 for nil, 1 for some) and retained pointer + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithRetain() -> ( + isSome: Int32, pointer: UnsafeMutableRawPointer + ) { + switch consume self { + case .none: + return (isSome: 0, pointer: UnsafeMutableRawPointer(bitPattern: 1)!) + case .some(let value): + return (isSome: 1, pointer: Unmanaged.passRetained(value).toOpaque()) + } + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ pointer: UnsafeMutableRawPointer) -> Wrapped? { if pointer == UnsafeMutableRawPointer(bitPattern: 0) { @@ -781,6 +873,24 @@ extension Optional where Wrapped: _BridgedSwiftHeapObject { } } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "swift_js_get_optional_heap_object_pointer") + func _swift_js_get_optional_heap_object_pointer() -> UnsafeMutableRawPointer + #else + func _swift_js_get_optional_heap_object_pointer() -> UnsafeMutableRawPointer { + _onlyAvailableOnWasm() + } + #endif + + let pointer = _swift_js_get_optional_heap_object_pointer() + if pointer == UnsafeMutableRawPointer(bitPattern: 0) { + return nil + } else { + return Wrapped.bridgeJSLiftReturn(pointer) + } + } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_return_optional_heap_object") diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md index dbdfba785..44019bf6d 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md @@ -66,6 +66,7 @@ This command will: - - - +- - - - diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md new file mode 100644 index 000000000..83a1d9f4c --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md @@ -0,0 +1,114 @@ +# Exporting Swift Closures + +Learn how to use closure/function types as parameters and return values in BridgeJS. + +## Overview + +> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). + +BridgeJS supports typed closure parameters and return values, allowing you to pass functions between Swift and JavaScript with full type safety. This enables functional programming patterns like callbacks, higher-order functions, and function composition across the language boundary. + +## Example + +```swift +import JavaScriptKit + +@JS class TextProcessor { + private var transform: (String) -> String + + @JS init(transform: @escaping (String) -> String) { + self.transform = transform + } + + @JS func processWithPerson(_ person: Person, formatter: (Person) -> String) -> String { + return formatter(person) + } + + @JS func makePersonCreator(defaultName: String) -> (String) -> Person { + return { name in + let fullName = name.isEmpty ? defaultName : name + return Person(name: fullName) + } + } + + @JS func getTransform() -> (String) -> String { + return transform + } +} +``` + +In JavaScript: + +```javascript +import { init } from "./.build/plugins/PackageToJS/outputs/Package/index.js"; +const { exports } = await init({}); + +// Pass closure to initializer +const processor = new exports.TextProcessor((text) => text.toUpperCase()); +console.log(processor.getTransform()("hello")); // "HELLO" + +// Pass closure with Swift class parameter +const person = new exports.Person("Alice"); +const result = processor.processWithPerson(person, (p) => { + return `${p.name}: ${p.greet()}`; +}); +console.log(result); // "Alice: Hello, Alice!" + +// Call returned closure +const creator = processor.makePersonCreator("Default"); +const p1 = creator("Bob"); +console.log(p1.greet()); // "Hello, Bob!" +p1.release(); + +const p2 = creator(""); // Empty uses default +console.log(p2.greet()); // "Hello, Default!" +p2.release(); + +person.release(); +processor.release(); +``` + +The generated TypeScript declarations: + +```typescript +export interface TextProcessor extends SwiftHeapObject { + processWithPerson( + person: Person, + formatter: (arg0: Person) => string + ): string; + makePersonCreator( + defaultName: string + ): (arg0: string) => Person; + getTransform(): (arg0: string) => string; +} + +export type Exports = { + TextProcessor: { + new(transform: (arg0: string) => string): TextProcessor + }; +} +``` + +## Memory Management + +When JavaScript passes a function to Swift, it's automatically stored in `swift.memory` with reference counting. When Swift's closure wrapper is deallocated by ARC, the JavaScript function is released. + +When Swift returns a closure to JavaScript, the Swift closure is boxed and automatically released when the JavaScript function is garbage collected. + +Both directions use automatic memory management - no manual cleanup required. + +## Supported Features + +| Feature | Status | +|:--------|:-------| +| Closure Parameters with Supported Types `(String, Int) -> Person` | ✅ | +| Closure Return Value with Supported Types `() -> Person` | ✅ | +| `@escaping` closures | ✅ | +| Optional types in closures | ✅ | +| Closure-typed `@JS` properties | ❌ | +| Async closures | ❌ | +| Throwing closures | ❌ | + +## See Also + +- - Complete list of supported types across BridgeJS diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 97ebcfd2e..3875d37e7 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -59,7 +59,7 @@ struct TestError: Error { @JS func asyncRoundTripSwiftHeapObject(v: Greeter) async -> Greeter { return v } @JS func asyncRoundTripJSObject(v: JSObject) async -> JSObject { return v } -@JS class Greeter { +@JS public class Greeter { @JS var name: String @JS let prefix: String = "Hello" @@ -76,6 +76,27 @@ struct TestError: Error { self.name = name } + @JS func greetWith(greeter: Greeter, customGreeting: (Greeter) -> String) -> String { + return customGreeting(greeter) + } + + @JS func makeFormatter(suffix: String) -> (String) -> String { + return { value in "\(self.greet()) - \(value) - \(suffix)" } + } + + @JS static func makeCreator(defaultName: String) -> (String) -> Greeter { + return { name in + let fullName = name.isEmpty ? defaultName : name + return Greeter(name: fullName) + } + } + + @JS func makeCustomGreeter() -> (Greeter) -> String { + return { otherGreeter in + return "\(self.name) greets \(otherGreeter.name): \(otherGreeter.greet())" + } + } + deinit { Self.onDeinit() } @@ -1039,6 +1060,161 @@ enum APIOptionalResult { } } +// MARK: - Closure Tests + +// @JS func makeFormatter(prefix: String) -> (String) -> String { +// return { value in "\(prefix) \(value)" } +// } + +@JS func formatName(_ name: String, transform: (String) -> String) -> String { + return transform(name) +} + +@JS func makeFormatter(prefix: String) -> (String) -> String { + return { value in "\(prefix) \(value)" } +} + +@JS func makeAdder(base: Int) -> (Int) -> Int { + return { value in base + value } +} + +@JS class TextProcessor { + private var transform: (String) -> String + + @JS init(transform: @escaping (String) -> String) { + self.transform = transform + } + + @JS func process(_ text: String) -> String { + return transform(text) + } + + @JS func processWithCustom(_ text: String, customTransform: (Int, String, Double) -> String) -> String { + return customTransform(42, text, 3.14) + } + + @JS func getTransform() -> (String) -> String { + return transform + } + + // Optional parameter in closure + @JS func processOptionalString(_ callback: (String?) -> String) -> String { + return callback("test") + " | " + callback(nil) + } + + @JS func processOptionalInt(_ callback: (Int?) -> String) -> String { + return callback(42) + " | " + callback(nil) + } + + @JS func processOptionalGreeter(_ callback: (Greeter?) -> String) -> String { + let greeter = Greeter(name: "Alice") + return callback(greeter) + " | " + callback(nil) + } + + // Return closure with optional parameter + @JS func makeOptionalStringFormatter() -> (String?) -> String { + return { value in + if let value = value { + return "Got: \(value)" + } else { + return "Got: nil" + } + } + } + + // Return closure with optional return type + @JS func makeOptionalGreeterCreator() -> () -> Greeter? { + var count = 0 + return { + count += 1 + if count % 2 == 0 { + return Greeter(name: "Greeter\(count)") + } else { + return nil + } + } + } + + @JS func processDirection(_ callback: (Direction) -> String) -> String { + return callback(.north) + } + + @JS func processTheme(_ callback: (Theme) -> String) -> String { + return callback(.dark) + } + + @JS func processHttpStatus(_ callback: (HttpStatus) -> Int) -> Int { + return callback(.ok) + } + + @JS func processAPIResult(_ callback: (APIResult) -> String) -> String { + return callback(.success("test")) + } + + @JS func makeDirectionChecker() -> (Direction) -> Bool { + return { direction in + direction == .north || direction == .south + } + } + + @JS func makeThemeValidator() -> (Theme) -> Bool { + return { theme in + theme == .dark + } + } + + @JS func makeStatusCodeExtractor() -> (HttpStatus) -> Int { + return { status in + switch status { + case .ok: return 200 + case .notFound: return 404 + case .serverError: return 500 + case .unknown: return -1 + } + } + } + + @JS func makeAPIResultHandler() -> (APIResult) -> String { + return { result in + switch result { + case .success(let message): return "Success: \(message)" + case .failure(let code): return "Failure: \(code)" + case .info: return "Info" + case .flag(let value): return "Flag: \(value)" + case .rate(let value): return "Rate: \(value)" + case .precise(let value): return "Precise: \(value)" + } + } + } + + @JS func processOptionalDirection(_ callback: (Direction?) -> String) -> String { + return callback(.north) + " | " + callback(nil) + } + + @JS func processOptionalTheme(_ callback: (Theme?) -> String) -> String { + return callback(.light) + " | " + callback(nil) + } + + @JS func processOptionalAPIResult(_ callback: (APIResult?) -> String) -> String { + return callback(.success("ok")) + " | " + callback(nil) + } + + @JS func makeOptionalDirectionFormatter() -> (Direction?) -> String { + return { direction in + if let direction = direction { + switch direction { + case .north: return "N" + case .south: return "S" + case .east: return "E" + case .west: return "W" + } + } else { + return "nil" + } + } + } +} + class ExportAPITests: XCTestCase { func testAll() { var hasDeinitGreeter = false diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index 350ef7ae6..67f05fde2 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -6,6 +6,732 @@ @_spi(BridgeJS) import JavaScriptKit +private final class _BJS_ClosureBox_APIResult_To_String: _BridgedSwiftClosureBox { + let closure: (APIResult) -> String + init(_ closure: @escaping (APIResult) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_APIResult_To_String { + static func bridgeJSLower(_ closure: @escaping (APIResult) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_APIResult_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_apiresult_to_string") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_apiresult_to_string") +@_cdecl("invoke_swift_closure_apiresult_to_string") +public func _invoke_swift_closure_apiresult_to_string(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_APIResult_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(APIResult.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_Direction_To_Bool: _BridgedSwiftClosureBox { + let closure: (Direction) -> Bool + init(_ closure: @escaping (Direction) -> Bool) { + self.closure = closure + } +} + +private enum _BJS_Closure_Direction_To_Bool { + static func bridgeJSLower(_ closure: @escaping (Direction) -> Bool) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_Direction_To_Bool(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Bool { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_direction_to_bool") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return Bool.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_direction_to_bool") +@_cdecl("invoke_swift_closure_direction_to_bool") +public func _invoke_swift_closure_direction_to_bool(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_Direction_To_Bool>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Direction.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_Direction_To_String: _BridgedSwiftClosureBox { + let closure: (Direction) -> String + init(_ closure: @escaping (Direction) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_Direction_To_String { + static func bridgeJSLower(_ closure: @escaping (Direction) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_Direction_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_direction_to_string") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_direction_to_string") +@_cdecl("invoke_swift_closure_direction_to_string") +public func _invoke_swift_closure_direction_to_string(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_Direction_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Direction.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_Greeter_To_String: _BridgedSwiftClosureBox { + let closure: (Greeter) -> String + init(_ closure: @escaping (Greeter) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_Greeter_To_String { + static func bridgeJSLower(_ closure: @escaping (Greeter) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_Greeter_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Greeter) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_greeter_to_string") + func _invoke(_: Int32, _: UnsafeMutableRawPointer) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_greeter_to_string") +@_cdecl("invoke_swift_closure_greeter_to_string") +public func _invoke_swift_closure_greeter_to_string(boxPtr: UnsafeMutableRawPointer, param0: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_Greeter_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Greeter.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_HttpStatus_To_Int: _BridgedSwiftClosureBox { + let closure: (HttpStatus) -> Int + init(_ closure: @escaping (HttpStatus) -> Int) { + self.closure = closure + } +} + +private enum _BJS_Closure_HttpStatus_To_Int { + static func bridgeJSLower(_ closure: @escaping (HttpStatus) -> Int) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_HttpStatus_To_Int(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> Int { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_httpstatus_to_int") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return Int.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_httpstatus_to_int") +@_cdecl("invoke_swift_closure_httpstatus_to_int") +public func _invoke_swift_closure_httpstatus_to_int(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_HttpStatus_To_Int>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(HttpStatus.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_Int_String_Double_To_String: _BridgedSwiftClosureBox { + let closure: (Int, String, Double) -> String + init(_ closure: @escaping (Int, String, Double) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_Int_String_Double_To_String { + static func bridgeJSLower(_ closure: @escaping (Int, String, Double) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_Int_String_Double_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Int, String, Double) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0, param1, param2 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_int_string_double_to_string") + func _invoke(_: Int32, _: Int32, _: Int32, _: Float64) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter(), param1.bridgeJSLowerParameter(), param2.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_int_string_double_to_string") +@_cdecl("invoke_swift_closure_int_string_double_to_string") +public func _invoke_swift_closure_int_string_double_to_string(boxPtr: UnsafeMutableRawPointer, param0: Int32, param1Bytes: Int32, param1Length: Int32, param2: Float64) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_Int_String_Double_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Int.bridgeJSLiftParameter(param0), String.bridgeJSLiftParameter(param1Bytes, param1Length), Double.bridgeJSLiftParameter(param2)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_Int_To_Int: _BridgedSwiftClosureBox { + let closure: (Int) -> Int + init(_ closure: @escaping (Int) -> Int) { + self.closure = closure + } +} + +private enum _BJS_Closure_Int_To_Int { + static func bridgeJSLower(_ closure: @escaping (Int) -> Int) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_Int_To_Int(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Int { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_int_to_int") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return Int.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_int_to_int") +@_cdecl("invoke_swift_closure_int_to_int") +public func _invoke_swift_closure_int_to_int(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_Int_To_Int>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Int.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_OptionalAPIResult_To_String: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_OptionalAPIResult_To_String { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_OptionalAPIResult_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalapiresult_to_string") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_optionalapiresult_to_string") +@_cdecl("invoke_swift_closure_optionalapiresult_to_string") +public func _invoke_swift_closure_optionalapiresult_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0CaseId: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_OptionalAPIResult_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0CaseId)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_OptionalDirection_To_String: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_OptionalDirection_To_String { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_OptionalDirection_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionaldirection_to_string") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_optionaldirection_to_string") +@_cdecl("invoke_swift_closure_optionaldirection_to_string") +public func _invoke_swift_closure_optionaldirection_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_OptionalDirection_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_OptionalGreeter_To_String: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_OptionalGreeter_To_String { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_OptionalGreeter_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalgreeter_to_string") + func _invoke(_: Int32, _: Int32, _: UnsafeMutableRawPointer) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() +let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_optionalgreeter_to_string") +@_cdecl("invoke_swift_closure_optionalgreeter_to_string") +public func _invoke_swift_closure_optionalgreeter_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_OptionalGreeter_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_OptionalInt_To_String: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_OptionalInt_To_String { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_OptionalInt_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalint_to_string") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_optionalint_to_string") +@_cdecl("invoke_swift_closure_optionalint_to_string") +public func _invoke_swift_closure_optionalint_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_OptionalInt_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_OptionalString_To_String: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_OptionalString_To_String { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_OptionalString_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalstring_to_string") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_optionalstring_to_string") +@_cdecl("invoke_swift_closure_optionalstring_to_string") +public func _invoke_swift_closure_optionalstring_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Bytes: Int32, param0Length: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_OptionalString_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_OptionalTheme_To_String: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_OptionalTheme_To_String { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_OptionalTheme_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionaltheme_to_string") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_optionaltheme_to_string") +@_cdecl("invoke_swift_closure_optionaltheme_to_string") +public func _invoke_swift_closure_optionaltheme_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Bytes: Int32, param0Length: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_OptionalTheme_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_String_To_Greeter: _BridgedSwiftClosureBox { + let closure: (String) -> Greeter + init(_ closure: @escaping (String) -> Greeter) { + self.closure = closure + } +} + +private enum _BJS_Closure_String_To_Greeter { + static func bridgeJSLower(_ closure: @escaping (String) -> Greeter) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_String_To_Greeter(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (String) -> Greeter { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_string_to_greeter") + func _invoke(_: Int32, _: Int32) -> UnsafeMutableRawPointer + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return Greeter.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_string_to_greeter") +@_cdecl("invoke_swift_closure_string_to_greeter") +public func _invoke_swift_closure_string_to_greeter(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_String_To_Greeter>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_String_To_String: _BridgedSwiftClosureBox { + let closure: (String) -> String + init(_ closure: @escaping (String) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_String_To_String { + static func bridgeJSLower(_ closure: @escaping (String) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_String_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_string_to_string") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_string_to_string") +@_cdecl("invoke_swift_closure_string_to_string") +public func _invoke_swift_closure_string_to_string(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_String_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_Theme_To_Bool: _BridgedSwiftClosureBox { + let closure: (Theme) -> Bool + init(_ closure: @escaping (Theme) -> Bool) { + self.closure = closure + } +} + +private enum _BJS_Closure_Theme_To_Bool { + static func bridgeJSLower(_ closure: @escaping (Theme) -> Bool) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_Theme_To_Bool(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Bool { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_theme_to_bool") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return Bool.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_theme_to_bool") +@_cdecl("invoke_swift_closure_theme_to_bool") +public func _invoke_swift_closure_theme_to_bool(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Int32 { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_Theme_To_Bool>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_Theme_To_String: _BridgedSwiftClosureBox { + let closure: (Theme) -> String + init(_ closure: @escaping (Theme) -> String) { + self.closure = closure + } +} + +private enum _BJS_Closure_Theme_To_String { + static func bridgeJSLower(_ closure: @escaping (Theme) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_Theme_To_String(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> String { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] param0 in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_theme_to_string") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_theme_to_string") +@_cdecl("invoke_swift_closure_theme_to_string") +public func _invoke_swift_closure_theme_to_string(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_Theme_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +private final class _BJS_ClosureBox_Void_To_OptionalGreeter: _BridgedSwiftClosureBox { + let closure: () -> Optional + init(_ closure: @escaping () -> Optional) { + self.closure = closure + } +} + +private enum _BJS_Closure_Void_To_OptionalGreeter { + static func bridgeJSLower(_ closure: @escaping () -> Optional) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_Void_To_OptionalGreeter(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> () -> Optional { + let owner = _JSCallbackOwner(callbackId: callbackId) + return { [owner] in + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_void_to_optionalgreeter") + func _invoke(_: Int32) -> Void + _invoke(owner.callbackId) + return Optional.bridgeJSLiftReturnFromSideChannel() + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_void_to_optionalgreeter") +@_cdecl("invoke_swift_closure_void_to_optionalgreeter") +public func _invoke_swift_closure_void_to_optionalgreeter(boxPtr: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_Void_To_OptionalGreeter>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure() + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { let jsObject: JSObject @@ -2502,6 +3228,39 @@ public func _bjs_getAllStaticPropertyValues() -> Void { #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_String_To_String.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) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = makeFormatter(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) + return _BJS_Closure_String_To_String.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeAdder") +@_cdecl("bjs_makeAdder") +public func _bjs_makeAdder(base: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = makeAdder(base: Int.bridgeJSLiftParameter(base)) + return _BJS_Closure_Int_To_Int.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_Greeter_init") @_cdecl("bjs_Greeter_init") public func _bjs_Greeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMutableRawPointer { @@ -2534,6 +3293,50 @@ public func _bjs_Greeter_changeName(_self: UnsafeMutableRawPointer, nameBytes: I #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_Greeter_To_String.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) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Greeter.bridgeJSLiftParameter(_self).makeFormatter(suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) + return _BJS_Closure_String_To_String.bridgeJSLower(ret) + #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) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Greeter.makeCreator(defaultName: String.bridgeJSLiftParameter(defaultNameBytes, defaultNameLength)) + return _BJS_Closure_String_To_Greeter.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_makeCustomGreeter") +@_cdecl("bjs_Greeter_makeCustomGreeter") +public func _bjs_Greeter_makeCustomGreeter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Greeter.bridgeJSLiftParameter(_self).makeCustomGreeter() + return _BJS_Closure_Greeter_To_String.bridgeJSLower(ret) + #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 { @@ -2573,7 +3376,7 @@ public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { } extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { - var jsValue: JSValue { + public var jsValue: JSValue { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Greeter_wrap") func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 @@ -4340,4 +5143,255 @@ extension SwiftDataProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_SwiftDataProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) } +} + +@_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_String_To_String.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_Int_String_Double_To_String.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) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).getTransform() + return _BJS_Closure_String_To_String.bridgeJSLower(ret) + #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_OptionalString_To_String.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_OptionalInt_To_String.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_OptionalGreeter_To_String.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) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalStringFormatter() + return _BJS_Closure_OptionalString_To_String.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeOptionalGreeterCreator") +@_cdecl("bjs_TextProcessor_makeOptionalGreeterCreator") +public func _bjs_TextProcessor_makeOptionalGreeterCreator(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalGreeterCreator() + return _BJS_Closure_Void_To_OptionalGreeter.bridgeJSLower(ret) + #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_Direction_To_String.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_Theme_To_String.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_HttpStatus_To_Int.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_APIResult_To_String.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) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() + return _BJS_Closure_Direction_To_Bool.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeThemeValidator") +@_cdecl("bjs_TextProcessor_makeThemeValidator") +public func _bjs_TextProcessor_makeThemeValidator(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() + return _BJS_Closure_Theme_To_Bool.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeStatusCodeExtractor") +@_cdecl("bjs_TextProcessor_makeStatusCodeExtractor") +public func _bjs_TextProcessor_makeStatusCodeExtractor(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() + return _BJS_Closure_HttpStatus_To_Int.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeAPIResultHandler") +@_cdecl("bjs_TextProcessor_makeAPIResultHandler") +public func _bjs_TextProcessor_makeAPIResultHandler(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() + return _BJS_Closure_APIResult_To_String.bridgeJSLower(ret) + #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_OptionalDirection_To_String.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_OptionalTheme_To_String.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_OptionalAPIResult_To_String.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) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() + return _BJS_Closure_OptionalDirection_To_String.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_deinit") +@_cdecl("bjs_TextProcessor_deinit") +public func _bjs_TextProcessor_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension TextProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TextProcessor_wrap") + func _bjs_TextProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_TextProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_TextProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) + } } \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index c0e0a4a80..23d2afdc4 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -20,6 +20,7 @@ } ] }, + "explicitAccessControl" : "public", "methods" : [ { "abiName" : "bjs_Greeter_greet", @@ -62,6 +63,176 @@ } } + }, + { + "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" : "Greeter_To_String", + "parameters" : [ + { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "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" : "String_To_String", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "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" : "String_To_Greeter", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + "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" : "Greeter_To_String", + "parameters" : [ + { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } } ], "name" : "Greeter", @@ -1986,103 +2157,943 @@ } }, { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalCount", - "type" : { - "optional" : { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalCount", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "direction", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalTheme", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "httpStatus", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "apiResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "helper", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalHelper", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "swiftCallName" : "SwiftDataProcessor" + }, + { + "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" : "String_To_String", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ] + }, + "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" : "Int_String_Double_To_String", + "parameters" : [ + { + "int" : { + + } + }, + { + "string" : { + + } + }, + { + "double" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_getTransform", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTransform", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "String_To_String", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "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" : "OptionalString_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "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" : "OptionalInt_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "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" : "OptionalGreeter_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeOptionalStringFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalStringFormatter", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "OptionalString_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeOptionalGreeterCreator", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalGreeterCreator", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "Void_To_OptionalGreeter", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + } + } + }, + { + "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" : "Direction_To_String", + "parameters" : [ + { + "caseEnum" : { + "_0" : "Direction" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "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" : "Theme_To_String", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "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" : "HttpStatus_To_Int", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "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" : "APIResult_To_String", + "parameters" : [ + { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeDirectionChecker", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeDirectionChecker", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "Direction_To_Bool", + "parameters" : [ + { + "caseEnum" : { + "_0" : "Direction" + } + } + ], + "returnType" : { + "bool" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeThemeValidator", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeThemeValidator", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "Theme_To_Bool", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + ], + "returnType" : { + "bool" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeStatusCodeExtractor", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeStatusCodeExtractor", + "parameters" : [ + + ], + "returnType" : { + "closure" : { "_0" : { - "int" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "HttpStatus_To_Int", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + ], + "returnType" : { + "int" : { + } } } } } }, { - "isReadonly" : false, - "isStatic" : false, - "name" : "direction", - "type" : { - "optional" : { + "abiName" : "bjs_TextProcessor_makeAPIResultHandler", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultHandler", + "parameters" : [ + + ], + "returnType" : { + "closure" : { "_0" : { - "caseEnum" : { - "_0" : "Direction" + "isAsync" : false, + "isThrows" : false, + "mangleName" : "APIResult_To_String", + "parameters" : [ + { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + ], + "returnType" : { + "string" : { + + } } } } } }, { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalTheme", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "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" : "OptionalDirection_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } } } } + ], + "returnType" : { + "string" : { + + } } }, { - "isReadonly" : false, - "isStatic" : false, - "name" : "httpStatus", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "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" : "OptionalTheme_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } } } } + ], + "returnType" : { + "string" : { + + } } }, { - "isReadonly" : false, - "isStatic" : false, - "name" : "apiResult", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "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" : "OptionalAPIResult_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } } } } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "helper", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" + ], + "returnType" : { + "string" : { + } } }, { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalHelper", - "type" : { - "optional" : { + "abiName" : "bjs_TextProcessor_makeOptionalDirectionFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalDirectionFormatter", + "parameters" : [ + + ], + "returnType" : { + "closure" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "isAsync" : false, + "isThrows" : false, + "mangleName" : "OptionalDirection_To_String", + "parameters" : [ + { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + ], + "returnType" : { + "string" : { + + } } } } } } ], - "swiftCallName" : "SwiftDataProcessor" + "name" : "TextProcessor", + "properties" : [ + + ], + "swiftCallName" : "TextProcessor" } ], "enums" : [ @@ -6354,6 +7365,138 @@ } } + }, + { + "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" : "String_To_String", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "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" : "String_To_String", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_makeAdder", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAdder", + "parameters" : [ + { + "label" : "base", + "name" : "base", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "Int_To_Int", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } } ], "moduleName" : "BridgeJSRuntimeTests", diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 10c390af8..f6e9cb85a 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -707,7 +707,202 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { cd5.release(); testProtocolSupport(exports); + testClosureSupport(exports); } +/** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ +function testClosureSupport(exports) { + const upperTransform = (text) => text.toUpperCase(); + const processor = new exports.TextProcessor(upperTransform); + + assert.equal(processor.process("hello"), "HELLO"); + + const multiParamTransform = (count, text, ratio) => { + return `${text.toUpperCase()}-${count}-${ratio.toFixed(2)}`; + }; + assert.equal(processor.processWithCustom("world", multiParamTransform), "WORLD-42-3.14"); + assert.equal(processor.process("test"), "TEST"); + + const greeterForClosure = new exports.Greeter("World"); + const greeterCaller = new exports.Greeter("Caller"); + const customGreeting = (greeter) => `Custom greeting for ${greeter.name}: ${greeter.greet()}`; + const greetResult = greeterCaller.greetWith(greeterForClosure, customGreeting); + assert.equal(greetResult, "Custom greeting for World: Hello, World!"); + greeterForClosure.release(); + greeterCaller.release(); + + assert.equal(exports.formatName("ada", (name) => name.toUpperCase()), "ADA"); + assert.equal(exports.formatName("grace", (name) => `Dr. ${name}`), "Dr. grace"); + + const addDr = exports.makeFormatter("Dr."); + assert.equal(addDr("Ada"), "Dr. Ada"); + assert.equal(addDr("Grace"), "Dr. Grace"); + + const addProf = exports.makeFormatter("Prof."); + assert.equal(addProf("Hopper"), "Prof. Hopper"); + + const add10 = exports.makeAdder(10); + assert.equal(add10(5), 15); + assert.equal(add10(32), 42); + + const add100 = exports.makeAdder(100); + assert.equal(add100(23), 123); + + const storedTransform = processor.getTransform(); + assert.equal(storedTransform("hello"), "HELLO"); + assert.equal(storedTransform("world"), "WORLD"); + + const greeterForFormatter = new exports.Greeter("Formatter"); + const greeterFormatter = greeterForFormatter.makeFormatter(" [suffix]"); + assert.equal(greeterFormatter("test"), "Hello, Formatter! - test - [suffix]"); + assert.equal(greeterFormatter("data"), "Hello, Formatter! - data - [suffix]"); + greeterForFormatter.release(); + + const greeterCreator = exports.Greeter.makeCreator("Default"); + const createdG1 = greeterCreator("Alice"); + assert.equal(createdG1.name, "Alice"); + assert.equal(createdG1.greet(), "Hello, Alice!"); + const createdG2 = greeterCreator(""); + assert.equal(createdG2.name, "Default"); + assert.equal(createdG2.greet(), "Hello, Default!"); + createdG1.release(); + createdG2.release(); + + const greeterHost = new exports.Greeter("Host"); + const greeterGreeter = greeterHost.makeCustomGreeter(); + const guest1 = new exports.Greeter("Guest1"); + const guest2 = new exports.Greeter("Guest2"); + assert.equal(greeterGreeter(guest1), "Host greets Guest1: Hello, Guest1!"); + assert.equal(greeterGreeter(guest2), "Host greets Guest2: Hello, Guest2!"); + greeterHost.release(); + guest1.release(); + guest2.release(); + + const greeterForMethod = new exports.Greeter("Method"); + const greeterParam = new exports.Greeter("Param"); + const methodResult = greeterForMethod.greetWith(greeterParam, (g) => { + return `Custom: ${g.name} says ${g.greet()}`; + }); + assert.equal(methodResult, "Custom: Param says Hello, Param!"); + greeterForMethod.release(); + greeterParam.release(); + + const optResult1 = processor.processOptionalString((value) => { + return value !== null ? `Got: ${value}` : `Got: null`; + }); + assert.equal(optResult1, "Got: test | Got: null"); + + const optResult2 = processor.processOptionalInt((value) => { + return value !== null ? `Number: ${value}` : `Number: null`; + }); + assert.equal(optResult2, "Number: 42 | Number: null"); + + const optResult3 = processor.processOptionalGreeter((greeter) => { + return greeter !== null ? `Greeter: ${greeter.name}` : `Greeter: null`; + }); + assert.equal(optResult3, "Greeter: Alice | Greeter: null"); + + const optFormatter = processor.makeOptionalStringFormatter(); + assert.equal(optFormatter("world"), "Got: world"); + assert.equal(optFormatter(null), "Got: nil"); + + const optCreator = processor.makeOptionalGreeterCreator(); + const opt1 = optCreator(); + assert.equal(opt1, null); + const opt2 = optCreator(); + assert.notEqual(opt2, null); + assert.equal(opt2.name, "Greeter2"); + assert.equal(opt2.greet(), "Hello, Greeter2!"); + opt2.release(); + const opt3 = optCreator(); + assert.equal(opt3, null); + const opt4 = optCreator(); + assert.notEqual(opt4, null); + assert.equal(opt4.name, "Greeter4"); + opt4.release(); + + const dirResult = processor.processDirection((dir) => { + switch (dir) { + case exports.Direction.North: return "Going North"; + case exports.Direction.South: return "Going South"; + case exports.Direction.East: return "Going East"; + case exports.Direction.West: return "Going West"; + default: return "Unknown"; + } + }); + assert.equal(dirResult, "Going North"); + + const themeResult = processor.processTheme((theme) => { + return theme === exports.Theme.Dark ? "Dark mode" : "Light mode"; + }); + assert.equal(themeResult, "Dark mode"); + + const statusResult = processor.processHttpStatus((status) => { + return status; + }); + assert.equal(statusResult, exports.HttpStatus.Ok); + + const apiResult = processor.processAPIResult((result) => { + if (result.tag === exports.APIResult.Tag.Success) { + return `API Success: ${result.param0}`; + } + return "API Other"; + }); + assert.equal(apiResult, "API Success: test"); + + const dirChecker = processor.makeDirectionChecker(); + assert.equal(dirChecker(exports.Direction.North), true); + assert.equal(dirChecker(exports.Direction.South), true); + assert.equal(dirChecker(exports.Direction.East), false); + assert.equal(dirChecker(exports.Direction.West), false); + + const themeValidator = processor.makeThemeValidator(); + assert.equal(themeValidator(exports.Theme.Dark), true); + assert.equal(themeValidator(exports.Theme.Light), false); + assert.equal(themeValidator(exports.Theme.Auto), false); + + const statusExtractor = processor.makeStatusCodeExtractor(); + assert.equal(statusExtractor(exports.HttpStatus.Ok), 200); + assert.equal(statusExtractor(exports.HttpStatus.NotFound), 404); + assert.equal(statusExtractor(exports.HttpStatus.ServerError), 500); + assert.equal(statusExtractor(exports.HttpStatus.Unknown), -1); + + const apiHandler = processor.makeAPIResultHandler(); + assert.equal(apiHandler({ tag: exports.APIResult.Tag.Success, param0: "done" }), "Success: done"); + assert.equal(apiHandler({ tag: exports.APIResult.Tag.Failure, param0: 500 }), "Failure: 500"); + assert.equal(apiHandler({ tag: exports.APIResult.Tag.Info }), "Info"); + assert.equal(apiHandler({ tag: exports.APIResult.Tag.Flag, param0: true }), "Flag: true"); + assert.equal(apiHandler({ tag: exports.APIResult.Tag.Rate, param0: 1.5 }), "Rate: 1.5"); + assert.equal(apiHandler({ tag: exports.APIResult.Tag.Precise, param0: 3.14159 }), "Precise: 3.14159"); + + const optDirResult = processor.processOptionalDirection((dir) => { + return dir !== null ? `Dir: ${dir}` : "Dir: null"; + }); + assert.equal(optDirResult, `Dir: ${exports.Direction.North} | Dir: null`); + + const optThemeResult = processor.processOptionalTheme((theme) => { + return theme !== null ? `Theme: ${theme}` : "Theme: null"; + }); + assert.equal(optThemeResult, `Theme: ${exports.Theme.Light} | Theme: null`); + + const optApiResult = processor.processOptionalAPIResult((result) => { + if (result === null) return "Result: null"; + if (result.tag === exports.APIResult.Tag.Success) { + return `Result: Success(${result.param0})`; + } + return "Result: other"; + }); + assert.equal(optApiResult, "Result: Success(ok) | Result: null"); + + const optDirFormatter = processor.makeOptionalDirectionFormatter(); + assert.equal(optDirFormatter(exports.Direction.North), "N"); + assert.equal(optDirFormatter(exports.Direction.South), "S"); + assert.equal(optDirFormatter(exports.Direction.East), "E"); + assert.equal(optDirFormatter(exports.Direction.West), "W"); + assert.equal(optDirFormatter(null), "nil"); + + processor.release(); +} + /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ async function BridgeJSRuntimeTests_runAsyncWorks(exports) { From de9e8a07252f4c2a8c1f290c7585f0cf67612e14 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Mon, 27 Oct 2025 10:04:51 +0100 Subject: [PATCH 021/252] Implement onPageLoad for playwright --- .../PlaywrightOnPageLoadTest/README.md | 156 ++++++++++++++++++ .../SwiftTesting/Package.swift | 17 ++ .../SwiftTesting/Tests/CheckTests.swift | 25 +++ .../XCTest/Package.swift | 17 ++ .../XCTest/Tests/CheckTests.swift | 41 +++++ .../PlaywrightOnPageLoadTest/expose.js | 49 ++++++ Plugins/PackageToJS/Sources/PackageToJS.swift | 10 ++ .../Sources/PackageToJSPlugin.swift | 3 + Plugins/PackageToJS/Templates/bin/test.js | 43 ++++- Plugins/PackageToJS/Templates/test.d.ts | 18 ++ Plugins/PackageToJS/Templates/test.js | 7 +- Plugins/PackageToJS/Tests/ExampleTests.swift | 53 ++++++ 12 files changed, 436 insertions(+), 3 deletions(-) create mode 100644 Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/README.md create mode 100644 Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/SwiftTesting/Package.swift create mode 100644 Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/SwiftTesting/Tests/CheckTests.swift create mode 100644 Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/XCTest/Package.swift create mode 100644 Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/XCTest/Tests/CheckTests.swift create mode 100644 Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/expose.js diff --git a/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/README.md b/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/README.md new file mode 100644 index 000000000..3266c0c3d --- /dev/null +++ b/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/README.md @@ -0,0 +1,156 @@ +# Playwright OnPageLoad Test + +This example demonstrates how to expose JavaScript functions to your Swift/WebAssembly tests using Playwright's `page.exposeFunction` API. + +## How it works + +1. **Expose Script**: A JavaScript file that exports functions to be exposed in the browser context +2. **Swift Tests**: Call these exposed functions using JavaScriptKit's `JSObject.global` API +3. **Test Runner**: The `--playwright-expose` flag loads the script and exposes the functions before running tests + +## Usage + +### Define exposed functions in a JavaScript file + +**Important:** All functions exposed via Playwright's `page.exposeFunction` are async from the browser's perspective, meaning they always return Promises. Define them as `async` for clarity. + +#### Option 1: Function with Page Access (Recommended) + +Export a function that receives the Playwright `page` object. This allows your exposed functions to interact with the browser page: + +```javascript +/** + * @param {import('playwright').Page} page - The Playwright Page object + */ +export async function exposedFunctions(page) { + return { + expectToBeTrue: async () => { + return true; + }, + + // Use the page object to interact with the browser + getTitle: async () => { + return await page.title(); + }, + + clickButton: async (selector) => { + await page.click(selector); + return true; + }, + + evaluate: async (script) => { + return await page.evaluate(script); + }, + + screenshot: async () => { + const buffer = await page.screenshot(); + return buffer.toString('base64'); + } + }; +} +``` + +#### Option 2: Static Object (Simple Cases) + +For simple functions that don't need page access: + +```javascript +export const exposedFunctions = { + expectToBeTrue: async () => { + return true; + }, + + addNumbers: async (a, b) => { + return a + b; + } +}; +``` + +### Use the functions in Swift tests + +```swift +import XCTest +import JavaScriptKit +import JavaScriptEventLoop + +final class CheckTests: XCTestCase { + func testExpectToBeTrue() async throws { + guard let expectToBeTrue = JSObject.global.expectToBeTrue.function + else { return XCTFail("Function expectToBeTrue not found") } + + // Functions exposed via Playwright return Promises + guard let promiseObject = expectToBeTrue().object + else { return XCTFail("expectToBeTrue() did not return an object") } + + guard let promise = JSPromise(promiseObject) + else { return XCTFail("expectToBeTrue() did not return a Promise") } + + let resultValue = try await promise.value + guard let result = resultValue.boolean + else { return XCTFail("expectToBeTrue() returned nil") } + + XCTAssertTrue(result) + } +} +``` + +### Run tests with the expose script + +```bash +swift package js test --environment browser --playwright-expose path/to/expose.js +``` + +### Backward Compatibility + +You can also use `--prelude` to define exposed functions, which allows combining WASM setup options (`setupOptions`) and Playwright exposed functions in one file: + +```bash +swift package js test --environment browser --prelude path/to/prelude.js +``` + +However, using `--playwright-expose` is recommended for clarity and separation of concerns. + +## Advanced Usage + +### Access to Page Context + +When you export a function (as shown in Option 1), you receive the Playwright `page` object, which gives you full access to the browser page. This is powerful because you can: + +- **Query the DOM**: `await page.$('selector')` +- **Execute JavaScript**: `await page.evaluate('...')` +- **Take screenshots**: `await page.screenshot()` +- **Navigate**: `await page.goto('...')` +- **Handle events**: `page.on('console', ...)` + +### Async Initialization + +You can perform async initialization before returning your functions: + +```javascript +export async function exposedFunctions(page) { + // Perform async setup + const config = await loadConfiguration(); + + // Navigate to a specific page if needed + await page.goto('http://example.com'); + + return { + expectToBeTrue: async () => true, + + getConfig: async () => config, + + // Function that uses both page and initialization data + checkElement: async (selector) => { + const element = await page.$(selector); + return element !== null; + } + }; +} +``` + +### Best Practices + +1. **Always use `async` functions**: All exposed functions are async from the browser's perspective +2. **Capture `page` in closures**: Functions returned from `exposedFunctions(page)` can access `page` via closure +3. **Handle errors**: Wrap page interactions in try-catch blocks +4. **Return serializable data**: Functions can only return JSON-serializable values diff --git a/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/SwiftTesting/Package.swift b/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/SwiftTesting/Package.swift new file mode 100644 index 000000000..84130401a --- /dev/null +++ b/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/SwiftTesting/Package.swift @@ -0,0 +1,17 @@ +// swift-tools-version: 6.0 +import PackageDescription + +let package = Package( + name: "Check", + dependencies: [.package(name: "JavaScriptKit", path: "../../../../../")], + targets: [ + .testTarget( + name: "CheckTests", + dependencies: [ + "JavaScriptKit", + .product(name: "JavaScriptEventLoopTestSupport", package: "JavaScriptKit"), + ], + path: "Tests" + ) + ] +) diff --git a/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/SwiftTesting/Tests/CheckTests.swift b/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/SwiftTesting/Tests/CheckTests.swift new file mode 100644 index 000000000..e9b2f935c --- /dev/null +++ b/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/SwiftTesting/Tests/CheckTests.swift @@ -0,0 +1,25 @@ +import Testing +import JavaScriptKit +import JavaScriptEventLoop + +@Test func expectToBeTrue() async throws { + let expectToBeTrue = try #require(JSObject.global.expectToBeTrue.function) + + // expectToBeTrue returns a Promise, so we need to await it + let promiseObject = try #require(expectToBeTrue.callAsFunction().object) + let promise = try #require(JSPromise(promiseObject)) + + let resultValue = try await promise.value + #expect(resultValue.boolean == true) +} + +@Test func getTitleOfPage() async throws { + let getTitle = try #require(JSObject.global.getTitle.function) + + // getTitle returns a Promise, so we need to await it + let promiseObject = try #require(getTitle.callAsFunction().object) + let promise = try #require(JSPromise(promiseObject)) + + let resultValue = try await promise.value + #expect(resultValue.string == "") +} diff --git a/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/XCTest/Package.swift b/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/XCTest/Package.swift new file mode 100644 index 000000000..84130401a --- /dev/null +++ b/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/XCTest/Package.swift @@ -0,0 +1,17 @@ +// swift-tools-version: 6.0 +import PackageDescription + +let package = Package( + name: "Check", + dependencies: [.package(name: "JavaScriptKit", path: "../../../../../")], + targets: [ + .testTarget( + name: "CheckTests", + dependencies: [ + "JavaScriptKit", + .product(name: "JavaScriptEventLoopTestSupport", package: "JavaScriptKit"), + ], + path: "Tests" + ) + ] +) diff --git a/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/XCTest/Tests/CheckTests.swift b/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/XCTest/Tests/CheckTests.swift new file mode 100644 index 000000000..49d0a741e --- /dev/null +++ b/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/XCTest/Tests/CheckTests.swift @@ -0,0 +1,41 @@ +import XCTest +import JavaScriptKit +import JavaScriptEventLoop + +final class CheckTests: XCTestCase { + func testExpectToBeTrue() async throws { + guard let expectToBeTrue = JSObject.global.expectToBeTrue.function + else { return XCTFail("Function expectToBeTrue not found") } + + // expectToBeTrue returns a Promise, so we need to await it + guard let promiseObject = expectToBeTrue().object + else { return XCTFail("expectToBeTrue() did not return an object") } + + guard let promise = JSPromise(promiseObject) + else { return XCTFail("expectToBeTrue() did not return a Promise") } + + let resultValue = try await promise.value + guard let result = resultValue.boolean + else { return XCTFail("expectToBeTrue() returned nil") } + + XCTAssertTrue(result) + } + + func testTileOfPage() async throws { + guard let getTitle = JSObject.global.getTitle.function + else { return XCTFail("Function getTitle not found") } + + // getTitle returns a Promise, so we need to await it + guard let promiseObject = getTitle().object + else { return XCTFail("getTitle() did not return an object") } + + guard let promise = JSPromise(promiseObject) + else { return XCTFail("expectToBeTrue() did not return a Promise") } + + let resultValue = try await promise.value + guard let title = resultValue.string + else { return XCTFail("expectToBeTrue() returned nil") } + + XCTAssertTrue(title == "") + } +} diff --git a/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/expose.js b/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/expose.js new file mode 100644 index 000000000..22f760a14 --- /dev/null +++ b/Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/expose.js @@ -0,0 +1,49 @@ +/** + * Playwright exposed functions for PlaywrightOnPageLoadTest + * These functions will be exposed to the browser context and available as global functions + * in the WASM environment (accessible via JSObject.global) + * + * IMPORTANT: All exposed functions are async from the browser's perspective. + * Playwright's page.exposeFunction automatically wraps them to return Promises. + * Therefore, you must use JSPromise to await them in Swift. + */ + +/** + * Export a function that receives the Playwright Page object and returns the exposed functions. + * This allows your functions to interact with the page (click, query DOM, etc.) + * + * @param {import('playwright').Page} page - The Playwright Page object + * @returns {Object} An object mapping function names to async functions + */ +export async function exposedFunctions(page) { + return { + expectToBeTrue: async () => { + return true; + }, + + getTitle: async () => { + return await page.title(); + }, + + // clickButton: async (selector) => { + // await page.click(selector); + // return true; + // }, + + // screenshot: async () => { + // const buffer = await page.screenshot(); + // return buffer.toString('base64'); + // } + }; +} + +/** + * Alternative: Export a static object if you don't need page access + * (Note: This approach doesn't have access to the page object) + */ +// export const exposedFunctions = { +// expectToBeTrue: async () => { +// return true; +// }, +// addNumbers: async (a, b) => a + b, +// }; diff --git a/Plugins/PackageToJS/Sources/PackageToJS.swift b/Plugins/PackageToJS/Sources/PackageToJS.swift index cec51cfb2..ec9840439 100644 --- a/Plugins/PackageToJS/Sources/PackageToJS.swift +++ b/Plugins/PackageToJS/Sources/PackageToJS.swift @@ -58,6 +58,8 @@ struct PackageToJS { var environment: String? /// Whether to run tests in the browser with inspector enabled var inspect: Bool + /// The script defining Playwright exposed functions + var playwrightExpose: String? /// The extra arguments to pass to node var extraNodeArguments: [String] /// The options for packaging @@ -89,6 +91,14 @@ struct PackageToJS { testJsArguments.append("--prelude") testJsArguments.append(preludeURL.path) } + if let playwrightExpose = testOptions.playwrightExpose { + let playwrightExposeURL = URL( + fileURLWithPath: playwrightExpose, + relativeTo: URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + ) + testJsArguments.append("--playwright-expose") + testJsArguments.append(playwrightExposeURL.path) + } if let environment = testOptions.environment { testJsArguments.append("--environment") testJsArguments.append(environment) diff --git a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift index 9a35322f8..709dc8f3a 100644 --- a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift +++ b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift @@ -551,6 +551,7 @@ extension PackageToJS.TestOptions { let prelude = extractor.extractOption(named: "prelude").last let environment = extractor.extractOption(named: "environment").last let inspect = extractor.extractFlag(named: "inspect") + let playwrightExpose = extractor.extractOption(named: "playwright-expose").last let extraNodeArguments = extractor.extractSingleDashOption(named: "Xnode") let packageOptions = try PackageToJS.PackageOptions.parse(from: &extractor) var options = PackageToJS.TestOptions( @@ -560,6 +561,7 @@ extension PackageToJS.TestOptions { prelude: prelude, environment: environment, inspect: inspect != 0, + playwrightExpose: playwrightExpose, extraNodeArguments: extraNodeArguments, packageOptions: packageOptions ) @@ -582,6 +584,7 @@ extension PackageToJS.TestOptions { --prelude Path to the prelude script --environment The environment to use for the tests (values: node, browser; default: node) --inspect Whether to run tests in the browser with inspector enabled + --playwright-expose Path to script defining Playwright exposed functions -Xnode Extra arguments to pass to Node.js \(PackageToJS.PackageOptions.optionsHelp()) diff --git a/Plugins/PackageToJS/Templates/bin/test.js b/Plugins/PackageToJS/Templates/bin/test.js index e7444e901..1d48b6853 100644 --- a/Plugins/PackageToJS/Templates/bin/test.js +++ b/Plugins/PackageToJS/Templates/bin/test.js @@ -33,6 +33,7 @@ const args = parseArgs({ environment: { type: "string" }, inspect: { type: "boolean" }, "coverage-file": { type: "string" }, + "playwright-expose": { type: "string" }, }, }) @@ -95,7 +96,47 @@ Hint: This typically means that a continuation leak occurred. } }, browser: async ({ preludeScript }) => { - process.exit(await testBrowser({ preludeScript, inspect: args.values.inspect, args: testFrameworkArgs })); + let onPageLoad = undefined; + + // Load exposed functions from playwright-expose flag + if (args.values["playwright-expose"]) { + const exposeScript = path.resolve(process.cwd(), args.values["playwright-expose"]); + try { + const exposeModule = await import(exposeScript); + const exposedFunctions = exposeModule.exposedFunctions; + + if (exposedFunctions) { + onPageLoad = async (page) => { + // If exposedFunctions is a function, call it with the page object + // This allows the functions to capture the page in their closure + const functions = typeof exposedFunctions === 'function' + ? await exposedFunctions(page) + : exposedFunctions; + + for (const [name, fn] of Object.entries(functions)) { + // Bind the page context to each function if needed + // The function can optionally use the page from its closure + page.exposeFunction(name, fn); + } + }; + } + } catch (e) { + // If --playwright-expose is specified but file doesn't exist or has no exposedFunctions, that's an error + if (args.values["playwright-expose"]) { + throw e; + } + } + } + + const exitCode = await testBrowser({ + preludeScript, + inspect: args.values.inspect, + args: testFrameworkArgs, + playwright: { + onPageLoad + } + }); + process.exit(exitCode); } } diff --git a/Plugins/PackageToJS/Templates/test.d.ts b/Plugins/PackageToJS/Templates/test.d.ts index 03a064f28..4c6741a75 100644 --- a/Plugins/PackageToJS/Templates/test.d.ts +++ b/Plugins/PackageToJS/Templates/test.d.ts @@ -7,6 +7,23 @@ export type SetupOptionsFn = ( } ) => Promise +/** + * Functions to be exposed to the browser context via Playwright's page.exposeFunction. + * Note: All functions are treated as async from the browser's perspective and will + * return Promises when called from Swift/WebAssembly via JavaScriptKit. + */ +export type ExposedFunctions = Record Promise> + +/** + * A function that receives the Playwright Page object and returns exposed functions. + * This allows the exposed functions to interact with the browser page (click, query DOM, etc.) + * Can also be used for async initialization before returning the functions. + * + * @param page - The Playwright Page object for browser interaction + * @returns An object mapping function names to async functions, or a Promise resolving to such an object + */ +export type ExposedFunctionsFn = (page: import('playwright').Page) => ExposedFunctions | Promise + export function testBrowser( options: { /** Path to the prelude script to be injected before tests run */ @@ -17,6 +34,7 @@ export function testBrowser( playwright?: { browser?: string, launchOptions?: import("playwright").LaunchOptions + onPageLoad?: (page: import("playwright").Page) => Promise } } ): Promise diff --git a/Plugins/PackageToJS/Templates/test.js b/Plugins/PackageToJS/Templates/test.js index 19a1deac6..5b7090300 100644 --- a/Plugins/PackageToJS/Templates/test.js +++ b/Plugins/PackageToJS/Templates/test.js @@ -99,13 +99,16 @@ Please run the following command to install it: const browser = await playwright[options.playwright?.browser ?? "chromium"].launch(options.playwright?.launchOptions ?? {}); const context = await browser.newContext(); const page = await context.newPage(); - + // Allow the user to customize the page before it's loaded, for defining custom export functions + if (options.playwright?.onPageLoad) { + await options.playwright.onPageLoad(page); + } // Forward console messages in the page to the Node.js console page.on("console", (message) => { console.log(message.text()); }); - + const onExit = new Promise((resolve) => { page.exposeFunction("exitTest", resolve); }); diff --git a/Plugins/PackageToJS/Tests/ExampleTests.swift b/Plugins/PackageToJS/Tests/ExampleTests.swift index e1a103f41..70a0b7556 100644 --- a/Plugins/PackageToJS/Tests/ExampleTests.swift +++ b/Plugins/PackageToJS/Tests/ExampleTests.swift @@ -232,6 +232,16 @@ extension Trait where Self == ConditionTrait { } } + /// FIXME: swift-testing uses too much stack space, so we need to increase the stack size for tests using swift-testing. + static var stackSizeLinkerFlags: [String] { + [ + "-Xlinker", "--stack-first", + "-Xlinker", "-z", + "-Xlinker", "stack-size=524288", + "-Xlinker", "--global-base=524288", + ] + } + @Test(.requireSwiftSDK) func basic() throws { let swiftSDKID = try #require(Self.getSwiftSDKID()) @@ -394,4 +404,47 @@ extension Trait where Self == ConditionTrait { } } #endif + + @Test(.requireSwiftSDK) + func playwrightOnPageLoad_XCTest() throws { + let swiftSDKID = try #require(Self.getSwiftSDKID()) + try withPackage( + at: "Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/XCTest", + assertTerminationStatus: { $0 == 0 } + ) { packageDir, runProcess, runSwift in + try runProcess(which("npm"), ["install"], [:]) + try runProcess(which("npx"), ["playwright", "install", "chromium-headless-shell"], [:]) + + try runSwift( + ["package", "--disable-sandbox"] + Self.stackSizeLinkerFlags + [ + "--swift-sdk", swiftSDKID, "js", "test", "--environment", "browser", + "--playwright-expose", "../expose.js", + ], + [:] + ) + } + } + + #if compiler(>=6.1) + // TODO: Remove triple restriction once swift-testing is shipped in p1-threads SDK + @Test(.requireSwiftSDK(triple: "wasm32-unknown-wasi")) + func playwrightOnPageLoad_SwiftTesting() throws { + let swiftSDKID = try #require(Self.getSwiftSDKID()) + try withPackage( + at: "Plugins/PackageToJS/Fixtures/PlaywrightOnPageLoadTest/SwiftTesting", + assertTerminationStatus: { $0 == 0 } + ) { packageDir, runProcess, runSwift in + try runProcess(which("npm"), ["install"], [:]) + try runProcess(which("npx"), ["playwright", "install", "chromium-headless-shell"], [:]) + + try runSwift( + [ + "package", "--disable-sandbox", "--swift-sdk", swiftSDKID, "js", "test", "--environment", "browser", + "--playwright-expose", "../expose.js", + ], + [:] + ) + } + } + #endif } From 623cda09c34f2cc0b544295e73a55fb1513abbf2 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Fri, 7 Nov 2025 21:31:57 +0100 Subject: [PATCH 022/252] Add missing protocols on generated --- .../Sources/Generated/JavaScript/BridgeJS.ImportTS.json | 5 ++++- .../PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json | 5 ++++- .../Generated/JavaScript/BridgeJS.ImportTS.json | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json index 366342bbc..c00d16169 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json @@ -63,5 +63,8 @@ ] } ], - "moduleName" : "Benchmarks" + "moduleName" : "Benchmarks", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json index f1a567cde..f73620223 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json @@ -44,5 +44,8 @@ ] } ], - "moduleName" : "PlayBridgeJS" + "moduleName" : "PlayBridgeJS", + "protocols" : [ + + ] } \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json index 82515fecb..31ffbcee0 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json @@ -229,5 +229,8 @@ ] } ], - "moduleName" : "BridgeJSRuntimeTests" + "moduleName" : "BridgeJSRuntimeTests", + "protocols" : [ + + ] } \ No newline at end of file From 2619cb54ed56a2f4bb5d4c7a6ec60dcbefa0cf1f Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 8 Nov 2025 02:10:29 +0000 Subject: [PATCH 023/252] Revert "Add missing protocols on generated" This reverts commit 623cda09c34f2cc0b544295e73a55fb1513abbf2. --- .../Sources/Generated/JavaScript/BridgeJS.ImportTS.json | 5 +---- .../PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json | 5 +---- .../Generated/JavaScript/BridgeJS.ImportTS.json | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json index c00d16169..366342bbc 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json @@ -63,8 +63,5 @@ ] } ], - "moduleName" : "Benchmarks", - "protocols" : [ - - ] + "moduleName" : "Benchmarks" } \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json index f73620223..f1a567cde 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json @@ -44,8 +44,5 @@ ] } ], - "moduleName" : "PlayBridgeJS", - "protocols" : [ - - ] + "moduleName" : "PlayBridgeJS" } \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json index 31ffbcee0..82515fecb 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json @@ -229,8 +229,5 @@ ] } ], - "moduleName" : "BridgeJSRuntimeTests", - "protocols" : [ - - ] + "moduleName" : "BridgeJSRuntimeTests" } \ No newline at end of file From 6514efb47f476a444f12c504b8903d652efea738 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 8 Nov 2025 03:32:46 +0000 Subject: [PATCH 024/252] Exclude Tests/TemporaryDirectory from file copying --- Plugins/PackageToJS/Tests/ExampleTests.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/PackageToJS/Tests/ExampleTests.swift b/Plugins/PackageToJS/Tests/ExampleTests.swift index 70a0b7556..e673e6630 100644 --- a/Plugins/PackageToJS/Tests/ExampleTests.swift +++ b/Plugins/PackageToJS/Tests/ExampleTests.swift @@ -127,6 +127,7 @@ extension Trait where Self == ConditionTrait { ".vscode", ".build", "node_modules", + "Tests/TemporaryDirectory", ] let enumerator = FileManager.default.enumerator(atPath: repoPath.path)! From f3485f9bad290acdb31121538b53489f9825bc75 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sun, 9 Nov 2025 06:06:18 +0000 Subject: [PATCH 025/252] Tests: Reduce usage of Xlinker flags in Makefile --- Makefile | 4 ---- Package.swift | 27 +++++++++++++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 5ac35ea57..c46431dd1 100644 --- a/Makefile +++ b/Makefile @@ -9,10 +9,6 @@ unittest: @echo Running unit tests env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --swift-sdk "$(SWIFT_SDK_ID)" \ --disable-sandbox \ - -Xlinker --stack-first \ - -Xlinker --global-base=524288 \ - -Xlinker -z \ - -Xlinker stack-size=524288 \ js test --prelude ./Tests/prelude.mjs -Xnode --expose-gc .PHONY: regenerate_swiftpm_resources diff --git a/Package.swift b/Package.swift index cf3055c31..a8518a5a1 100644 --- a/Package.swift +++ b/Package.swift @@ -8,6 +8,15 @@ let shouldBuildForEmbedded = Context.environment["JAVASCRIPTKIT_EXPERIMENTAL_EMB let useLegacyResourceBundling = Context.environment["JAVASCRIPTKIT_USE_LEGACY_RESOURCE_BUNDLING"].flatMap(Bool.init) ?? false +let testingLinkerFlags: [LinkerSetting] = [ + .unsafeFlags([ + "-Xlinker", "--stack-first", + "-Xlinker", "--global-base=524288", + "-Xlinker", "-z", + "-Xlinker", "stack-size=524288", + ]) +] + let package = Package( name: "JavaScriptKit", platforms: [ @@ -55,7 +64,8 @@ let package = Package( dependencies: ["JavaScriptKit"], swiftSettings: [ .enableExperimentalFeature("Extern") - ] + ], + linkerSettings: testingLinkerFlags ), .target( @@ -70,7 +80,8 @@ let package = Package( .target(name: "_CJavaScriptBigIntSupport", dependencies: ["_CJavaScriptKit"]), .testTarget( name: "JavaScriptBigIntSupportTests", - dependencies: ["JavaScriptBigIntSupport", "JavaScriptKit"] + dependencies: ["JavaScriptBigIntSupport", "JavaScriptKit"], + linkerSettings: testingLinkerFlags ), .target( @@ -92,7 +103,8 @@ let package = Package( ], swiftSettings: [ .enableExperimentalFeature("Extern") - ] + ], + linkerSettings: testingLinkerFlags ), .target( name: "JavaScriptEventLoopTestSupport", @@ -107,7 +119,8 @@ let package = Package( dependencies: [ "JavaScriptKit", "JavaScriptEventLoopTestSupport", - ] + ], + linkerSettings: testingLinkerFlags ), .target( name: "JavaScriptFoundationCompat", @@ -119,7 +132,8 @@ let package = Package( name: "JavaScriptFoundationCompatTests", dependencies: [ "JavaScriptFoundationCompat" - ] + ], + linkerSettings: testingLinkerFlags ), .plugin( name: "PackageToJS", @@ -163,7 +177,8 @@ let package = Package( ], swiftSettings: [ .enableExperimentalFeature("Extern") - ] + ], + linkerSettings: testingLinkerFlags ), ] ) From d283e4351392bcbd36f731d97568d794181a1b03 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 10 Nov 2025 14:09:59 +0900 Subject: [PATCH 026/252] CI: Fix documentation redirect for "https://swiftwasm.org/JavaScriptKit" (#467) --- .github/workflows/test.yml | 3 ++- .gitignore | 1 + Utilities/prepare-gh-pages.sh | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 Utilities/prepare-gh-pages.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a07d73915..5df11d0aa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -123,11 +123,12 @@ jobs: env: SWIFT_SDK_ID_wasm32_unknown_wasip1_threads: ${{ steps.setup-wasm32-unknown-wasip1-threads.outputs.swift-sdk-id }} SWIFT_SDK_ID_wasm32_unknown_wasip1: ${{ steps.setup-wasm32-unknown-wasip1.outputs.swift-sdk-id }} + - run: ./Utilities/prepare-gh-pages.sh - name: Upload static files as artifact id: deployment uses: actions/upload-pages-artifact@v4 with: - path: Examples/ + path: ./_site deploy-examples: runs-on: ubuntu-latest if: github.event_name == 'push' && github.ref == 'refs/heads/main' diff --git a/.gitignore b/.gitignore index a62100fde..8dba07278 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ Package.resolved Plugins/BridgeJS/Sources/JavaScript/package-lock.json Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/**/*.actual bridge-js.config.local.json +_site/ diff --git a/Utilities/prepare-gh-pages.sh b/Utilities/prepare-gh-pages.sh new file mode 100755 index 000000000..7260717a6 --- /dev/null +++ b/Utilities/prepare-gh-pages.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +mkdir -p ./_site +# Copy all files from ./Examples to ./_site, excluding specified path patterns +rsync -av --progress ./Examples/ ./_site/ --exclude=".build" +cat < _site/index.html + + + + + Redirecting... + + +

If you are not redirected automatically, follow this link to JavaScriptKit documentation.

+ + +EOF + From d628d2d627b78a3d90813089215b193eef366a32 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 14 Nov 2025 08:57:48 +0100 Subject: [PATCH 027/252] BridgeJS: Closure support review comments --- .../Sources/BridgeJSCore/ExportSwift.swift | 23 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 57 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 11 +- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 59 +- .../BridgeJSLinkTests/SwiftClosure.Export.js | 326 +++++---- .../ExportSwiftTests/SwiftClosure.json | 60 +- .../ExportSwiftTests/SwiftClosure.swift | 488 ++++++------- Plugins/PackageToJS/Templates/instantiate.js | 1 - .../JavaScriptKit/BridgeJSInstrincics.swift | 59 -- .../BridgeJSRuntimeTests/ExportAPITests.swift | 3 - .../Generated/BridgeJS.ExportSwift.swift | 658 +++++++++--------- .../JavaScript/BridgeJS.ExportSwift.json | 81 ++- 12 files changed, 888 insertions(+), 938 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 508894629..07b103b6f 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -28,7 +28,7 @@ public class ExportSwift { private var exportedProtocolNameByKey: [String: String] = [:] private var typeDeclResolver: TypeDeclResolver = TypeDeclResolver() private let enumCodegen: EnumCodegen = EnumCodegen() - private lazy var closureCodegen = ClosureCodegen(moduleName: moduleName) + private let closureCodegen = ClosureCodegen() public init(progress: ProgressReporting, moduleName: String) { self.progress = progress @@ -1354,6 +1354,7 @@ public class ExportSwift { ClosureSignature( parameters: parameters, returnType: returnType, + moduleName: moduleName, isAsync: isAsync, isThrows: isThrows ) @@ -1477,7 +1478,6 @@ public class ExportSwift { } decls.append(Self.prelude) - // Collect all unique closure signatures var closureSignatures: Set = [] for function in exportedFunctions { collectClosureSignatures(from: function.parameters, into: &closureSignatures) @@ -1817,8 +1817,6 @@ public class ExportSwift { } private struct ClosureCodegen { - let moduleName: String - func generateOptionalParameterLowering(signature: ClosureSignature) throws -> String { var lines: [String] = [] @@ -1826,11 +1824,7 @@ public class ExportSwift { guard case .optional(let wrappedType) = paramType else { continue } - let paramName = "param\(index)" - - // Use bridgeJSLowerParameterWithRetain for heap objects in escaping closures - // to ensure proper ownership transfer if case .swiftHeapObject = wrappedType { lines.append( "let (\(paramName)IsSome, \(paramName)Value) = \(paramName).bridgeJSLowerParameterWithRetain()" @@ -1859,7 +1853,7 @@ public class ExportSwift { let closureType = "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)" var invokeParams: [(name: String, type: String)] = [("_", "Int32")] - var invokeCallArgs: [String] = ["owner.callbackId"] + var invokeCallArgs: [String] = ["callback.bridgeJSLowerParameter()"] for (index, paramType) in signature.parameters.enumerated() { let paramName = "param\(index)" @@ -1920,7 +1914,7 @@ public class ExportSwift { """ } - let externName = "invoke_js_callback_\(mangledName.lowercased())" + let externName = "invoke_js_callback_\(signature.moduleName)_\(mangledName)" let optionalLoweringCode = try generateOptionalParameterLowering(signature: signature) return """ @@ -1938,8 +1932,8 @@ public class ExportSwift { } static func bridgeJSLift(_ callbackId: Int32) -> \(raw: closureType) { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] \(raw: signature.parameters.indices.map { "param\($0)" }.joined(separator: ", ")) in + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] \(raw: signature.parameters.indices.map { "param\($0)" }.joined(separator: ", ")) in #if arch(wasm32) @_extern(wasm, module: "bjs", name: "\(raw: externName)") func _invoke(\(raw: invokeSignature)) -> \(raw: invokeReturnType) @@ -1955,7 +1949,7 @@ public class ExportSwift { func renderClosureInvokeHandler(signature: ClosureSignature) throws -> DeclSyntax { let boxClassName = "_BJS_ClosureBox_\(signature.mangleName)" - let abiName = "invoke_swift_closure_\(signature.mangleName.lowercased())" + let abiName = "invoke_swift_closure_\(signature.moduleName)_\(signature.mangleName)" var abiParams: [(name: String, type: String)] = [("boxPtr", "UnsafeMutableRawPointer")] var liftedParams: [String] = [] @@ -2471,14 +2465,12 @@ public class ExportSwift { return decls } - /// Collects all closure signatures from function parameters private func collectClosureSignatures(from parameters: [Parameter], into signatures: inout Set) { for param in parameters { collectClosureSignatures(from: param.type, into: &signatures) } } - /// Collects all closure signatures from a bridge type private func collectClosureSignatures(from type: BridgeType, into signatures: inout Set) { switch type { case .closure(let signature): @@ -2933,7 +2925,6 @@ extension BridgeType { case .namespaceEnum: throw BridgeJSCoreError("Namespace enums are not supported to pass as parameters") case .closure: - // Closures are returned as UnsafeMutableRawPointer (box pointer) return .swiftHeapObject } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index eef3f31d8..5a7245aa6 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -696,53 +696,29 @@ struct BridgeJSLink { } printer.write("}") - var closureSignatures: Set = [] for skeleton in exportedSkeletons { + var closureSignatures: Set = [] collectClosureSignatures(from: skeleton, into: &closureSignatures) - } - var classToModule: [String: String] = [:] - for skeleton in exportedSkeletons { - for klass in skeleton.classes { - classToModule[klass.name] = skeleton.moduleName - } - } + guard !closureSignatures.isEmpty else { continue } - for signature in closureSignatures.sorted(by: { $0.mangleName < $1.mangleName }) { - let invokeFuncName = "invoke_js_callback_\(signature.mangleName.lowercased())" - printer.write( - lines: generateInvokeFunction( - signature: signature, - functionName: invokeFuncName, - classToModule: classToModule + for signature in closureSignatures.sorted(by: { $0.mangleName < $1.mangleName }) { + let invokeFuncName = "invoke_js_callback_\(skeleton.moduleName)_\(signature.mangleName)" + printer.write( + lines: generateInvokeFunction( + signature: signature, + functionName: invokeFuncName + ) ) - ) - let lowerFuncName = "lower_closure_\(signature.mangleName.lowercased())" - printer.write( - lines: generateLowerClosureFunction( - signature: signature, - functionName: lowerFuncName - ) - ) - } - - if !closureSignatures.isEmpty { - printer.nextLine() - printer.write("bjs[\"release_js_callback\"] = function(id) {") - printer.indent { - printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(id);") - } - printer.write("};") - - printer.nextLine() - printer.write("bjs[\"release_swift_closure\"] = function(boxPtr) {") - printer.indent { + let lowerFuncName = "lower_closure_\(skeleton.moduleName)_\(signature.mangleName)" printer.write( - "\(JSGlueVariableScope.reservedInstance).exports._release_swift_closure(boxPtr);" + lines: generateLowerClosureFunction( + signature: signature, + functionName: lowerFuncName + ) ) } - printer.write("};") } } } @@ -793,8 +769,7 @@ struct BridgeJSLink { private func generateInvokeFunction( signature: ClosureSignature, - functionName: String, - classToModule: [String: String] + functionName: String ) -> [String] { let printer = CodeFragmentPrinter() let scope = JSGlueVariableScope() @@ -889,7 +864,7 @@ struct BridgeJSLink { // Call the Swift invoke function let invokeCall = - "\(JSGlueVariableScope.reservedInstance).exports.invoke_swift_closure_\(signature.mangleName.lowercased())(\(invokeArgs.joined(separator: ", ")))" + "\(JSGlueVariableScope.reservedInstance).exports.invoke_swift_closure_\(signature.moduleName)_\(signature.mangleName)(\(invokeArgs.joined(separator: ", ")))" let returnFragment = try! IntrinsicJSFragment.closureLiftReturn(type: signature.returnType) _ = returnFragment.printCode([invokeCall], scope, printer, cleanupCode) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 6ba378de5..0be72f6c6 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -1298,14 +1298,13 @@ struct IntrinsicJSFragment: Sendable { let base = fullName.components(separatedBy: ".").last ?? fullName return .associatedEnumLiftReturn(enumBase: base) case .closure(let signature): + let lowerFuncName = "lower_closure_\(signature.moduleName)_\(signature.mangleName)" return IntrinsicJSFragment( - parameters: ["closurePtr"], + parameters: ["boxPtr"], printCode: { arguments, scope, printer, cleanupCode in - let closurePtr = arguments[0] - let lowerFuncName = "lower_closure_\(signature.mangleName.lowercased())" - let resultVar = scope.variable("closure") - printer.write("const \(resultVar) = bjs[\"\(lowerFuncName)\"](\(closurePtr));") - return [resultVar] + let boxPtr = arguments[0] + printer.write("return bjs[\"\(lowerFuncName)\"](\(boxPtr));") + return [] } ) case .namespaceEnum(let string): diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 325ace7b2..b019e4d91 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -76,22 +76,34 @@ public enum BridgeContext: Sendable { public struct ClosureSignature: Codable, Equatable, Hashable, Sendable { public let parameters: [BridgeType] public let returnType: BridgeType + /// Simplified Swift ABI-style mangling with module prefix + // + params + _ + return + // Examples: + // - 4MainSS_Si (Main module, String->Int) + // - 6MyAppSiSi_y (MyApp module, Int,Int->Void) + public let mangleName: String public let isAsync: Bool public let isThrows: Bool - public let mangleName: String + public let moduleName: String - public init(parameters: [BridgeType], returnType: BridgeType, isAsync: Bool = false, isThrows: Bool = false) { + public init( + parameters: [BridgeType], + returnType: BridgeType, + moduleName: String, + isAsync: Bool = false, + isThrows: Bool = false + ) { self.parameters = parameters self.returnType = returnType + self.moduleName = moduleName self.isAsync = isAsync self.isThrows = isThrows - let paramPart = parameters.isEmpty - ? "Void" - : parameters.map { $0.mangleTypeName }.joined(separator: "_") - let returnPart = returnType.mangleTypeName - self.mangleName = "\(paramPart)_To_\(returnPart)" + ? "y" + : parameters.map { $0.mangleTypeName }.joined() + let signaturePart = "\(paramPart)_\(returnType.mangleTypeName)" + self.mangleName = "\(moduleName.count)\(moduleName)\(signaturePart)" } } @@ -602,31 +614,36 @@ extension BridgeType { return false } - /// Generates a mangled name for use in closure type names - /// Examples: "String", "Int", "MyClass", "Bool" + /// Simplified Swift ABI-style mangled name + /// https://github.com/swiftlang/swift/blob/main/docs/ABI/Mangling.rst#types public var mangleTypeName: String { switch self { - case .int: return "Int" - case .float: return "Float" - case .double: return "Double" - case .string: return "String" - case .bool: return "Bool" - case .void: return "Void" + case .int: return "Si" + case .float: return "Sf" + case .double: return "Sd" + case .string: return "SS" + case .bool: return "Sb" + case .void: return "y" case .jsObject(let name): - return name ?? "JSObject" + let typeName = name ?? "JSObject" + return "\(typeName.count)\(typeName)C" case .swiftHeapObject(let name): - return name + return "\(name.count)\(name)C" case .optional(let wrapped): - return "Optional\(wrapped.mangleTypeName)" + return "Sq\(wrapped.mangleTypeName)" case .caseEnum(let name), .rawValueEnum(let name, _), .associatedValueEnum(let name), .namespaceEnum(let name): - return name + return "\(name.count)\(name)O" case .swiftProtocol(let name): - return name + return "\(name.count)\(name)P" case .closure(let signature): - return "Closure_\(signature.mangleName)" + let params = + signature.parameters.isEmpty + ? "y" + : signature.parameters.map { $0.mangleTypeName }.joined() + return "K\(params)_\(signature.returnType.mangleTypeName)" } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js index 4d0a3ab29..755d98fd6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js @@ -285,54 +285,22 @@ export async function createInstantiator(options, swift) { return pointer || 0; } - bjs["invoke_js_callback_apiresult_to_string"] = function(callbackId, param0Id) { - try { - const callback = swift.memory.getObject(callbackId); - let param0 = enumHelpers.APIResult.raise(param0Id, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); - const result = callback(param0); - if (typeof result !== "string") { - throw new TypeError("Callback must return a string"); - } - tmpRetBytes = textEncoder.encode(result); - return tmpRetBytes.length; - } catch (error) { - setException?.(error); - tmpRetBytes = new Uint8Array(0); - return 0; - } - }; - - bjs["lower_closure_apiresult_to_string"] = function(closurePtr) { - return function(param0) { - try { - const { caseId: param0CaseId, cleanup: param0Cleanup } = enumHelpers.APIResult.lower(param0); - const resultLen = instance.exports.invoke_swift_closure_apiresult_to_string(closurePtr, param0CaseId); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } catch (error) { - setException?.(error); - throw error; - } - }; - }; - - bjs["invoke_js_callback_direction_to_bool"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); let param0 = param0Id; const result = callback(param0); - return result ? 1 : 0; + return result | 0; } catch (error) { setException?.(error); return 0; } }; - bjs["lower_closure_direction_to_bool"] = function(closurePtr) { + bjs["lower_closure_TestModule_10TestModule10HttpStatusO_Si"] = function(closurePtr) { return function(param0) { try { - return instance.exports.invoke_swift_closure_direction_to_bool(closurePtr, param0) !== 0; + return instance.exports.invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si(closurePtr, param0) | 0; } catch (error) { setException?.(error); throw error; @@ -340,10 +308,12 @@ export async function createInstantiator(options, swift) { }; }; - bjs["invoke_js_callback_direction_to_string"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModule5ThemeO_SS"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - let param0 = param0Id; + const param0IdObject = swift.memory.getObject(param0Id); + swift.memory.release(param0Id); + let param0 = String(param0IdObject); const result = callback(param0); if (typeof result !== "string") { throw new TypeError("Callback must return a string"); @@ -357,10 +327,12 @@ export async function createInstantiator(options, swift) { } }; - bjs["lower_closure_direction_to_string"] = function(closurePtr) { + bjs["lower_closure_TestModule_10TestModule5ThemeO_SS"] = function(closurePtr) { return function(param0) { try { - const resultLen = instance.exports.invoke_swift_closure_direction_to_string(closurePtr, param0); + const param0Bytes = textEncoder.encode(param0); + const param0Id = swift.memory.retain(param0Bytes); + const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModule5ThemeO_SS(closurePtr, param0Id, param0Bytes.length); const ret = tmpRetString; tmpRetString = undefined; return ret; @@ -371,22 +343,26 @@ export async function createInstantiator(options, swift) { }; }; - bjs["invoke_js_callback_httpstatus_to_int"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModule5ThemeO_Sb"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - let param0 = param0Id; + const param0IdObject = swift.memory.getObject(param0Id); + swift.memory.release(param0Id); + let param0 = String(param0IdObject); const result = callback(param0); - return result | 0; + return result ? 1 : 0; } catch (error) { setException?.(error); return 0; } }; - bjs["lower_closure_httpstatus_to_int"] = function(closurePtr) { + bjs["lower_closure_TestModule_10TestModule5ThemeO_Sb"] = function(closurePtr) { return function(param0) { try { - return instance.exports.invoke_swift_closure_httpstatus_to_int(closurePtr, param0) | 0; + const param0Bytes = textEncoder.encode(param0); + const param0Id = swift.memory.retain(param0Bytes); + return instance.exports.invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb(closurePtr, param0Id, param0Bytes.length) !== 0; } catch (error) { setException?.(error); throw error; @@ -394,15 +370,10 @@ export async function createInstantiator(options, swift) { }; }; - bjs["invoke_js_callback_optionalapiresult_to_string"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModule6PersonC_SS"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - let param0; - if (param0IsSome) { - param0 = enumHelpers.APIResult.raise(param0Value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); - } else { - param0 = null; - } + let param0 = _exports['Person'].__construct(param0Id); const result = callback(param0); if (typeof result !== "string") { throw new TypeError("Callback must return a string"); @@ -416,17 +387,10 @@ export async function createInstantiator(options, swift) { } }; - bjs["lower_closure_optionalapiresult_to_string"] = function(closurePtr) { + bjs["lower_closure_TestModule_10TestModule6PersonC_SS"] = function(closurePtr) { return function(param0) { try { - const isSome = param0 != null; - let param0CaseId, param0Cleanup; - if (isSome) { - const enumResult = enumHelpers.APIResult.lower(param0); - param0CaseId = enumResult.caseId; - param0Cleanup = enumResult.cleanup; - } - const resultLen = instance.exports.invoke_swift_closure_optionalapiresult_to_string(closurePtr, +isSome, isSome ? param0CaseId : 0); + const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModule6PersonC_SS(closurePtr, param0.pointer); const ret = tmpRetString; tmpRetString = undefined; return ret; @@ -437,15 +401,10 @@ export async function createInstantiator(options, swift) { }; }; - bjs["invoke_js_callback_optionaldirection_to_string"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModule9APIResultO_SS"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - let param0; - if (param0IsSome) { - param0 = param0Value; - } else { - param0 = null; - } + let param0 = enumHelpers.APIResult.raise(param0Id, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); const result = callback(param0); if (typeof result !== "string") { throw new TypeError("Callback must return a string"); @@ -459,11 +418,11 @@ export async function createInstantiator(options, swift) { } }; - bjs["lower_closure_optionaldirection_to_string"] = function(closurePtr) { + bjs["lower_closure_TestModule_10TestModule9APIResultO_SS"] = function(closurePtr) { return function(param0) { try { - const isSome = param0 != null; - const resultLen = instance.exports.invoke_swift_closure_optionaldirection_to_string(closurePtr, +isSome, isSome ? param0 : 0); + const { caseId: param0CaseId, cleanup: param0Cleanup } = enumHelpers.APIResult.lower(param0); + const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModule9APIResultO_SS(closurePtr, param0CaseId); const ret = tmpRetString; tmpRetString = undefined; return ret; @@ -474,30 +433,11 @@ export async function createInstantiator(options, swift) { }; }; - bjs["invoke_js_callback_optionalperson_optionalstring_optionaldouble_to_string"] = function(callbackId, param0IsSome, param0Value, param1IsSome, param1Value, param2IsSome, param2Value) { + bjs["invoke_js_callback_TestModule_10TestModule9DirectionO_SS"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - let param0; - if (param0IsSome) { - param0 = _exports['Person'].__construct(param0Value); - } else { - param0 = null; - } - let param1; - if (param1IsSome) { - const param1Object = swift.memory.getObject(param1Value); - swift.memory.release(param1Value); - param1 = String(param1Object); - } else { - param1 = null; - } - let param2; - if (param2IsSome) { - param2 = param2Value; - } else { - param2 = null; - } - const result = callback(param0, param1, param2); + let param0 = param0Id; + const result = callback(param0); if (typeof result !== "string") { throw new TypeError("Callback must return a string"); } @@ -510,18 +450,10 @@ export async function createInstantiator(options, swift) { } }; - bjs["lower_closure_optionalperson_optionalstring_optionaldouble_to_string"] = function(closurePtr) { - return function(param0, param1, param2) { + bjs["lower_closure_TestModule_10TestModule9DirectionO_SS"] = function(closurePtr) { + return function(param0) { try { - const isSome = param0 != null; - const isSome1 = param1 != null; - let param1Id, param1Bytes; - if (isSome1) { - param1Bytes = textEncoder.encode(param1); - param1Id = swift.memory.retain(param1Bytes); - } - const isSome2 = param2 != null; - const resultLen = instance.exports.invoke_swift_closure_optionalperson_optionalstring_optionaldouble_to_string(closurePtr, +isSome, isSome ? param0.pointer : 0, +isSome1, isSome1 ? param1Id : 0, isSome1 ? param1Bytes.length : 0, +isSome2, isSome2 ? param2 : 0); + const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModule9DirectionO_SS(closurePtr, param0); const ret = tmpRetString; tmpRetString = undefined; return ret; @@ -532,15 +464,35 @@ export async function createInstantiator(options, swift) { }; }; - bjs["invoke_js_callback_optionalperson_to_string"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModule9DirectionO_Sb"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - let param0; - if (param0IsSome) { - param0 = _exports['Person'].__construct(param0Value); - } else { - param0 = null; + let param0 = param0Id; + const result = callback(param0); + return result ? 1 : 0; + } catch (error) { + setException?.(error); + return 0; + } + }; + + bjs["lower_closure_TestModule_10TestModule9DirectionO_Sb"] = function(closurePtr) { + return function(param0) { + try { + return instance.exports.invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb(closurePtr, param0) !== 0; + } catch (error) { + setException?.(error); + throw error; } + }; + }; + + bjs["invoke_js_callback_TestModule_10TestModuleSS_SS"] = function(callbackId, param0Id) { + try { + const callback = swift.memory.getObject(callbackId); + const param0IdObject = swift.memory.getObject(param0Id); + swift.memory.release(param0Id); + let param0 = String(param0IdObject); const result = callback(param0); if (typeof result !== "string") { throw new TypeError("Callback must return a string"); @@ -554,11 +506,12 @@ export async function createInstantiator(options, swift) { } }; - bjs["lower_closure_optionalperson_to_string"] = function(closurePtr) { + bjs["lower_closure_TestModule_10TestModuleSS_SS"] = function(closurePtr) { return function(param0) { try { - const isSome = param0 != null; - const resultLen = instance.exports.invoke_swift_closure_optionalperson_to_string(closurePtr, +isSome, isSome ? param0.pointer : 0); + const param0Bytes = textEncoder.encode(param0); + const param0Id = swift.memory.retain(param0Bytes); + const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModuleSS_SS(closurePtr, param0Id, param0Bytes.length); const ret = tmpRetString; tmpRetString = undefined; return ret; @@ -569,7 +522,7 @@ export async function createInstantiator(options, swift) { }; }; - bjs["invoke_js_callback_optionaltheme_to_string"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS"] = function(callbackId, param0IsSome, param0Value) { try { const callback = swift.memory.getObject(callbackId); let param0; @@ -593,7 +546,7 @@ export async function createInstantiator(options, swift) { } }; - bjs["lower_closure_optionaltheme_to_string"] = function(closurePtr) { + bjs["lower_closure_TestModule_10TestModuleSq5ThemeO_SS"] = function(closurePtr) { return function(param0) { try { const isSome = param0 != null; @@ -602,7 +555,7 @@ export async function createInstantiator(options, swift) { param0Bytes = textEncoder.encode(param0); param0Id = swift.memory.retain(param0Bytes); } - const resultLen = instance.exports.invoke_swift_closure_optionaltheme_to_string(closurePtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); + const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(closurePtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); const ret = tmpRetString; tmpRetString = undefined; return ret; @@ -613,11 +566,30 @@ export async function createInstantiator(options, swift) { }; }; - bjs["invoke_js_callback_person_to_string"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS"] = function(callbackId, param0IsSome, param0Value, param1IsSome, param1Value, param2IsSome, param2Value) { try { const callback = swift.memory.getObject(callbackId); - let param0 = _exports['Person'].__construct(param0Id); - const result = callback(param0); + let param0; + if (param0IsSome) { + param0 = _exports['Person'].__construct(param0Value); + } else { + param0 = null; + } + let param1; + if (param1IsSome) { + const param1Object = swift.memory.getObject(param1Value); + swift.memory.release(param1Value); + param1 = String(param1Object); + } else { + param1 = null; + } + let param2; + if (param2IsSome) { + param2 = param2Value; + } else { + param2 = null; + } + const result = callback(param0, param1, param2); if (typeof result !== "string") { throw new TypeError("Callback must return a string"); } @@ -630,10 +602,18 @@ export async function createInstantiator(options, swift) { } }; - bjs["lower_closure_person_to_string"] = function(closurePtr) { - return function(param0) { + bjs["lower_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS"] = function(closurePtr) { + return function(param0, param1, param2) { try { - const resultLen = instance.exports.invoke_swift_closure_person_to_string(closurePtr, param0.pointer); + const isSome = param0 != null; + const isSome1 = param1 != null; + let param1Id, param1Bytes; + if (isSome1) { + param1Bytes = textEncoder.encode(param1); + param1Id = swift.memory.retain(param1Bytes); + } + const isSome2 = param2 != null; + const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(closurePtr, +isSome, isSome ? param0.pointer : 0, +isSome1, isSome1 ? param1Id : 0, isSome1 ? param1Bytes.length : 0, +isSome2, isSome2 ? param2 : 0); const ret = tmpRetString; tmpRetString = undefined; return ret; @@ -644,12 +624,15 @@ export async function createInstantiator(options, swift) { }; }; - bjs["invoke_js_callback_string_to_string"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS"] = function(callbackId, param0IsSome, param0Value) { try { const callback = swift.memory.getObject(callbackId); - const param0IdObject = swift.memory.getObject(param0Id); - swift.memory.release(param0Id); - let param0 = String(param0IdObject); + let param0; + if (param0IsSome) { + param0 = _exports['Person'].__construct(param0Value); + } else { + param0 = null; + } const result = callback(param0); if (typeof result !== "string") { throw new TypeError("Callback must return a string"); @@ -663,12 +646,11 @@ export async function createInstantiator(options, swift) { } }; - bjs["lower_closure_string_to_string"] = function(closurePtr) { + bjs["lower_closure_TestModule_10TestModuleSq6PersonC_SS"] = function(closurePtr) { return function(param0) { try { - const param0Bytes = textEncoder.encode(param0); - const param0Id = swift.memory.retain(param0Bytes); - const resultLen = instance.exports.invoke_swift_closure_string_to_string(closurePtr, param0Id, param0Bytes.length); + const isSome = param0 != null; + const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS(closurePtr, +isSome, isSome ? param0.pointer : 0); const ret = tmpRetString; tmpRetString = undefined; return ret; @@ -679,26 +661,42 @@ export async function createInstantiator(options, swift) { }; }; - bjs["invoke_js_callback_theme_to_bool"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS"] = function(callbackId, param0IsSome, param0Value) { try { const callback = swift.memory.getObject(callbackId); - const param0IdObject = swift.memory.getObject(param0Id); - swift.memory.release(param0Id); - let param0 = String(param0IdObject); + let param0; + if (param0IsSome) { + param0 = enumHelpers.APIResult.raise(param0Value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + } else { + param0 = null; + } const result = callback(param0); - return result ? 1 : 0; + if (typeof result !== "string") { + throw new TypeError("Callback must return a string"); + } + tmpRetBytes = textEncoder.encode(result); + return tmpRetBytes.length; } catch (error) { setException?.(error); + tmpRetBytes = new Uint8Array(0); return 0; } }; - bjs["lower_closure_theme_to_bool"] = function(closurePtr) { + bjs["lower_closure_TestModule_10TestModuleSq9APIResultO_SS"] = function(closurePtr) { return function(param0) { try { - const param0Bytes = textEncoder.encode(param0); - const param0Id = swift.memory.retain(param0Bytes); - return instance.exports.invoke_swift_closure_theme_to_bool(closurePtr, param0Id, param0Bytes.length) !== 0; + const isSome = param0 != null; + let param0CaseId, param0Cleanup; + if (isSome) { + const enumResult = enumHelpers.APIResult.lower(param0); + param0CaseId = enumResult.caseId; + param0Cleanup = enumResult.cleanup; + } + const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(closurePtr, +isSome, isSome ? param0CaseId : 0); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; } catch (error) { setException?.(error); throw error; @@ -706,12 +704,15 @@ export async function createInstantiator(options, swift) { }; }; - bjs["invoke_js_callback_theme_to_string"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS"] = function(callbackId, param0IsSome, param0Value) { try { const callback = swift.memory.getObject(callbackId); - const param0IdObject = swift.memory.getObject(param0Id); - swift.memory.release(param0Id); - let param0 = String(param0IdObject); + let param0; + if (param0IsSome) { + param0 = param0Value; + } else { + param0 = null; + } const result = callback(param0); if (typeof result !== "string") { throw new TypeError("Callback must return a string"); @@ -725,12 +726,11 @@ export async function createInstantiator(options, swift) { } }; - bjs["lower_closure_theme_to_string"] = function(closurePtr) { + bjs["lower_closure_TestModule_10TestModuleSq9DirectionO_SS"] = function(closurePtr) { return function(param0) { try { - const param0Bytes = textEncoder.encode(param0); - const param0Id = swift.memory.retain(param0Bytes); - const resultLen = instance.exports.invoke_swift_closure_theme_to_string(closurePtr, param0Id, param0Bytes.length); + const isSome = param0 != null; + const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(closurePtr, +isSome, isSome ? param0 : 0); const ret = tmpRetString; tmpRetString = undefined; return ret; @@ -740,14 +740,6 @@ export async function createInstantiator(options, swift) { } }; }; - - bjs["release_js_callback"] = function(id) { - swift.memory.release(id); - }; - - bjs["release_swift_closure"] = function(boxPtr) { - instance.exports._release_swift_closure(boxPtr); - }; // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; @@ -819,8 +811,7 @@ export async function createInstantiator(options, swift) { } getTransform() { const ret = instance.exports.bjs_TestProcessor_getTransform(this.pointer); - const closure = bjs["lower_closure_string_to_string"](ret); - return closure; + return bjs["lower_closure_TestModule_10TestModuleSS_SS"](ret); } processWithCustom(text, customTransform) { const textBytes = textEncoder.encode(text); @@ -845,14 +836,12 @@ export async function createInstantiator(options, swift) { roundtrip(personClosure) { const callbackId = swift.memory.retain(personClosure); const ret = instance.exports.bjs_TestProcessor_roundtrip(this.pointer, callbackId); - const closure = bjs["lower_closure_person_to_string"](ret); - return closure; + return bjs["lower_closure_TestModule_10TestModule6PersonC_SS"](ret); } roundtripOptional(personClosure) { const callbackId = swift.memory.retain(personClosure); const ret = instance.exports.bjs_TestProcessor_roundtripOptional(this.pointer, callbackId); - const closure = bjs["lower_closure_optionalperson_to_string"](ret); - return closure; + return bjs["lower_closure_TestModule_10TestModuleSq6PersonC_SS"](ret); } processDirection(callback) { const callbackId = swift.memory.retain(callback); @@ -882,23 +871,19 @@ export async function createInstantiator(options, swift) { } makeDirectionChecker() { const ret = instance.exports.bjs_TestProcessor_makeDirectionChecker(this.pointer); - const closure = bjs["lower_closure_direction_to_bool"](ret); - return closure; + return bjs["lower_closure_TestModule_10TestModule9DirectionO_Sb"](ret); } makeThemeValidator() { const ret = instance.exports.bjs_TestProcessor_makeThemeValidator(this.pointer); - const closure = bjs["lower_closure_theme_to_bool"](ret); - return closure; + return bjs["lower_closure_TestModule_10TestModule5ThemeO_Sb"](ret); } makeStatusCodeExtractor() { const ret = instance.exports.bjs_TestProcessor_makeStatusCodeExtractor(this.pointer); - const closure = bjs["lower_closure_httpstatus_to_int"](ret); - return closure; + return bjs["lower_closure_TestModule_10TestModule10HttpStatusO_Si"](ret); } makeAPIResultHandler() { const ret = instance.exports.bjs_TestProcessor_makeAPIResultHandler(this.pointer); - const closure = bjs["lower_closure_apiresult_to_string"](ret); - return closure; + return bjs["lower_closure_TestModule_10TestModule9APIResultO_SS"](ret); } processOptionalDirection(callback) { const callbackId = swift.memory.retain(callback); @@ -923,8 +908,7 @@ export async function createInstantiator(options, swift) { } makeOptionalDirectionFormatter() { const ret = instance.exports.bjs_TestProcessor_makeOptionalDirectionFormatter(this.pointer); - const closure = bjs["lower_closure_optionaldirection_to_string"](ret); - return closure; + return bjs["lower_closure_TestModule_10TestModuleSq9DirectionO_SS"](ret); } } const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json index 2354469c8..acb1c8949 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json @@ -47,7 +47,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "String_To_String", + "mangleName" : "10TestModuleSS_SS", + "moduleName" : "TestModule", "parameters" : [ { "string" : { @@ -83,7 +84,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "String_To_String", + "mangleName" : "10TestModuleSS_SS", + "moduleName" : "TestModule", "parameters" : [ { "string" : { @@ -126,7 +128,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "String_To_String", + "mangleName" : "10TestModuleSS_SS", + "moduleName" : "TestModule", "parameters" : [ { "string" : { @@ -194,7 +197,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalPerson_OptionalString_OptionalDouble_To_String", + "mangleName" : "10TestModuleSq6PersonCSqSSSqSd_SS", + "moduleName" : "TestModule", "parameters" : [ { "optional" : { @@ -257,7 +261,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Person_To_String", + "mangleName" : "10TestModule6PersonC_SS", + "moduleName" : "TestModule", "parameters" : [ { "swiftHeapObject" : { @@ -280,7 +285,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Person_To_String", + "mangleName" : "10TestModule6PersonC_SS", + "moduleName" : "TestModule", "parameters" : [ { "swiftHeapObject" : { @@ -314,7 +320,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalPerson_To_String", + "mangleName" : "10TestModuleSq6PersonC_SS", + "moduleName" : "TestModule", "parameters" : [ { "optional" : { @@ -341,7 +348,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalPerson_To_String", + "mangleName" : "10TestModuleSq6PersonC_SS", + "moduleName" : "TestModule", "parameters" : [ { "optional" : { @@ -379,7 +387,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Direction_To_String", + "mangleName" : "10TestModule9DirectionO_SS", + "moduleName" : "TestModule", "parameters" : [ { "caseEnum" : { @@ -420,7 +429,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Theme_To_String", + "mangleName" : "10TestModule5ThemeO_SS", + "moduleName" : "TestModule", "parameters" : [ { "rawValueEnum" : { @@ -462,7 +472,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "HttpStatus_To_Int", + "mangleName" : "10TestModule10HttpStatusO_Si", + "moduleName" : "TestModule", "parameters" : [ { "rawValueEnum" : { @@ -504,7 +515,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "APIResult_To_String", + "mangleName" : "10TestModule9APIResultO_SS", + "moduleName" : "TestModule", "parameters" : [ { "associatedValueEnum" : { @@ -544,7 +556,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Direction_To_Bool", + "mangleName" : "10TestModule9DirectionO_Sb", + "moduleName" : "TestModule", "parameters" : [ { "caseEnum" : { @@ -577,7 +590,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Theme_To_Bool", + "mangleName" : "10TestModule5ThemeO_Sb", + "moduleName" : "TestModule", "parameters" : [ { "rawValueEnum" : { @@ -611,7 +625,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "HttpStatus_To_Int", + "mangleName" : "10TestModule10HttpStatusO_Si", + "moduleName" : "TestModule", "parameters" : [ { "rawValueEnum" : { @@ -645,7 +660,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "APIResult_To_String", + "mangleName" : "10TestModule9APIResultO_SS", + "moduleName" : "TestModule", "parameters" : [ { "associatedValueEnum" : { @@ -679,7 +695,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalDirection_To_String", + "mangleName" : "10TestModuleSq9DirectionO_SS", + "moduleName" : "TestModule", "parameters" : [ { "optional" : { @@ -724,7 +741,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalTheme_To_String", + "mangleName" : "10TestModuleSq5ThemeO_SS", + "moduleName" : "TestModule", "parameters" : [ { "optional" : { @@ -770,7 +788,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalAPIResult_To_String", + "mangleName" : "10TestModuleSq9APIResultO_SS", + "moduleName" : "TestModule", "parameters" : [ { "optional" : { @@ -814,7 +833,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalDirection_To_String", + "mangleName" : "10TestModuleSq9DirectionO_SS", + "moduleName" : "TestModule", "parameters" : [ { "optional" : { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift index 888dc5150..4b1b404fc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift @@ -6,27 +6,27 @@ @_spi(BridgeJS) import JavaScriptKit -private final class _BJS_ClosureBox_APIResult_To_String: _BridgedSwiftClosureBox { - let closure: (APIResult) -> String - init(_ closure: @escaping (APIResult) -> String) { +private final class _BJS_ClosureBox_10TestModule10HttpStatusO_Si: _BridgedSwiftClosureBox { + let closure: (HttpStatus) -> Int + init(_ closure: @escaping (HttpStatus) -> Int) { self.closure = closure } } -private enum _BJS_Closure_APIResult_To_String { - static func bridgeJSLower(_ closure: @escaping (APIResult) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_APIResult_To_String(closure) +private enum _BJS_Closure_10TestModule10HttpStatusO_Si { + static func bridgeJSLower(_ closure: @escaping (HttpStatus) -> Int) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_10TestModule10HttpStatusO_Si(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> Int { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_apiresult_to_string") + @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si") func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + return Int.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -34,39 +34,39 @@ private enum _BJS_Closure_APIResult_To_String { } } -@_expose(wasm, "invoke_swift_closure_apiresult_to_string") -@_cdecl("invoke_swift_closure_apiresult_to_string") -public func _invoke_swift_closure_apiresult_to_string(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si") +@_cdecl("invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si") +public func _invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_APIResult_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(APIResult.bridgeJSLiftParameter(param0)) + let box = Unmanaged<_BJS_ClosureBox_10TestModule10HttpStatusO_Si>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(HttpStatus.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_Direction_To_Bool: _BridgedSwiftClosureBox { - let closure: (Direction) -> Bool - init(_ closure: @escaping (Direction) -> Bool) { +private final class _BJS_ClosureBox_10TestModule5ThemeO_SS: _BridgedSwiftClosureBox { + let closure: (Theme) -> String + init(_ closure: @escaping (Theme) -> String) { self.closure = closure } } -private enum _BJS_Closure_Direction_To_Bool { - static func bridgeJSLower(_ closure: @escaping (Direction) -> Bool) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_Direction_To_Bool(closure) +private enum _BJS_Closure_10TestModule5ThemeO_SS { + static func bridgeJSLower(_ closure: @escaping (Theme) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_10TestModule5ThemeO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Bool { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_direction_to_bool") + @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule5ThemeO_SS") func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) - return Bool.bridgeJSLiftReturn(resultId) + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -74,39 +74,39 @@ private enum _BJS_Closure_Direction_To_Bool { } } -@_expose(wasm, "invoke_swift_closure_direction_to_bool") -@_cdecl("invoke_swift_closure_direction_to_bool") -public func _invoke_swift_closure_direction_to_bool(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule5ThemeO_SS") +@_cdecl("invoke_swift_closure_TestModule_10TestModule5ThemeO_SS") +public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_SS(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_Direction_To_Bool>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Direction.bridgeJSLiftParameter(param0)) + let box = Unmanaged<_BJS_ClosureBox_10TestModule5ThemeO_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_Direction_To_String: _BridgedSwiftClosureBox { - let closure: (Direction) -> String - init(_ closure: @escaping (Direction) -> String) { +private final class _BJS_ClosureBox_10TestModule5ThemeO_Sb: _BridgedSwiftClosureBox { + let closure: (Theme) -> Bool + init(_ closure: @escaping (Theme) -> Bool) { self.closure = closure } } -private enum _BJS_Closure_Direction_To_String { - static func bridgeJSLower(_ closure: @escaping (Direction) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_Direction_To_String(closure) +private enum _BJS_Closure_10TestModule5ThemeO_Sb { + static func bridgeJSLower(_ closure: @escaping (Theme) -> Bool) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_10TestModule5ThemeO_Sb(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Bool { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_direction_to_string") + @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule5ThemeO_Sb") func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + return Bool.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -114,39 +114,39 @@ private enum _BJS_Closure_Direction_To_String { } } -@_expose(wasm, "invoke_swift_closure_direction_to_string") -@_cdecl("invoke_swift_closure_direction_to_string") -public func _invoke_swift_closure_direction_to_string(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb") +@_cdecl("invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb") +public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Int32 { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_Direction_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Direction.bridgeJSLiftParameter(param0)) + let box = Unmanaged<_BJS_ClosureBox_10TestModule5ThemeO_Sb>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_HttpStatus_To_Int: _BridgedSwiftClosureBox { - let closure: (HttpStatus) -> Int - init(_ closure: @escaping (HttpStatus) -> Int) { +private final class _BJS_ClosureBox_10TestModule6PersonC_SS: _BridgedSwiftClosureBox { + let closure: (Person) -> String + init(_ closure: @escaping (Person) -> String) { self.closure = closure } } -private enum _BJS_Closure_HttpStatus_To_Int { - static func bridgeJSLower(_ closure: @escaping (HttpStatus) -> Int) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_HttpStatus_To_Int(closure) +private enum _BJS_Closure_10TestModule6PersonC_SS { + static func bridgeJSLower(_ closure: @escaping (Person) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_10TestModule6PersonC_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> Int { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Person) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_httpstatus_to_int") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) - return Int.bridgeJSLiftReturn(resultId) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule6PersonC_SS") + func _invoke(_: Int32, _: UnsafeMutableRawPointer) -> Int32 + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -154,39 +154,38 @@ private enum _BJS_Closure_HttpStatus_To_Int { } } -@_expose(wasm, "invoke_swift_closure_httpstatus_to_int") -@_cdecl("invoke_swift_closure_httpstatus_to_int") -public func _invoke_swift_closure_httpstatus_to_int(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule6PersonC_SS") +@_cdecl("invoke_swift_closure_TestModule_10TestModule6PersonC_SS") +public func _invoke_swift_closure_TestModule_10TestModule6PersonC_SS(boxPtr: UnsafeMutableRawPointer, param0: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_HttpStatus_To_Int>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(HttpStatus.bridgeJSLiftParameter(param0)) + let box = Unmanaged<_BJS_ClosureBox_10TestModule6PersonC_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Person.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_OptionalAPIResult_To_String: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { +private final class _BJS_ClosureBox_10TestModule9APIResultO_SS: _BridgedSwiftClosureBox { + let closure: (APIResult) -> String + init(_ closure: @escaping (APIResult) -> String) { self.closure = closure } } -private enum _BJS_Closure_OptionalAPIResult_To_String { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_OptionalAPIResult_To_String(closure) +private enum _BJS_Closure_10TestModule9APIResultO_SS { + static func bridgeJSLower(_ closure: @escaping (APIResult) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_10TestModule9APIResultO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalapiresult_to_string") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9APIResultO_SS") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -195,39 +194,38 @@ let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) } } -@_expose(wasm, "invoke_swift_closure_optionalapiresult_to_string") -@_cdecl("invoke_swift_closure_optionalapiresult_to_string") -public func _invoke_swift_closure_optionalapiresult_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0CaseId: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9APIResultO_SS") +@_cdecl("invoke_swift_closure_TestModule_10TestModule9APIResultO_SS") +public func _invoke_swift_closure_TestModule_10TestModule9APIResultO_SS(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_OptionalAPIResult_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0CaseId)) + let box = Unmanaged<_BJS_ClosureBox_10TestModule9APIResultO_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(APIResult.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_OptionalDirection_To_String: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { +private final class _BJS_ClosureBox_10TestModule9DirectionO_SS: _BridgedSwiftClosureBox { + let closure: (Direction) -> String + init(_ closure: @escaping (Direction) -> String) { self.closure = closure } } -private enum _BJS_Closure_OptionalDirection_To_String { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_OptionalDirection_To_String(closure) +private enum _BJS_Closure_10TestModule9DirectionO_SS { + static func bridgeJSLower(_ closure: @escaping (Direction) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_10TestModule9DirectionO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionaldirection_to_string") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9DirectionO_SS") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -236,42 +234,39 @@ let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) } } -@_expose(wasm, "invoke_swift_closure_optionaldirection_to_string") -@_cdecl("invoke_swift_closure_optionaldirection_to_string") -public func _invoke_swift_closure_optionaldirection_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9DirectionO_SS") +@_cdecl("invoke_swift_closure_TestModule_10TestModule9DirectionO_SS") +public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_SS(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_OptionalDirection_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + let box = Unmanaged<_BJS_ClosureBox_10TestModule9DirectionO_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Direction.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_OptionalPerson_OptionalString_OptionalDouble_To_String: _BridgedSwiftClosureBox { - let closure: (Optional, Optional, Optional) -> String - init(_ closure: @escaping (Optional, Optional, Optional) -> String) { +private final class _BJS_ClosureBox_10TestModule9DirectionO_Sb: _BridgedSwiftClosureBox { + let closure: (Direction) -> Bool + init(_ closure: @escaping (Direction) -> Bool) { self.closure = closure } } -private enum _BJS_Closure_OptionalPerson_OptionalString_OptionalDouble_To_String { - static func bridgeJSLower(_ closure: @escaping (Optional, Optional, Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_OptionalPerson_OptionalString_OptionalDouble_To_String(closure) +private enum _BJS_Closure_10TestModule9DirectionO_Sb { + static func bridgeJSLower(_ closure: @escaping (Direction) -> Bool) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_10TestModule9DirectionO_Sb(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional, Optional, Optional) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0, param1, param2 in + static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Bool { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalperson_optionalstring_optionaldouble_to_string") - func _invoke(_: Int32, _: Int32, _: UnsafeMutableRawPointer, _: Int32, _: Int32, _: Int32, _: Float64) -> Int32 - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() -let (param1IsSome, param1Value) = param1.bridgeJSLowerParameterWithPresence() -let (param2IsSome, param2Value) = param2.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(owner.callbackId, param0IsSome, param0Value, param1IsSome, param1Value, param2IsSome, param2Value) - return String.bridgeJSLiftReturn(resultId) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9DirectionO_Sb") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + return Bool.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -279,39 +274,38 @@ let resultId = _invoke(owner.callbackId, param0IsSome, param0Value, param1IsSome } } -@_expose(wasm, "invoke_swift_closure_optionalperson_optionalstring_optionaldouble_to_string") -@_cdecl("invoke_swift_closure_optionalperson_optionalstring_optionaldouble_to_string") -public func _invoke_swift_closure_optionalperson_optionalstring_optionaldouble_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: UnsafeMutableRawPointer, param1IsSome: Int32, param1Bytes: Int32, param1Length: Int32, param2IsSome: Int32, param2Value: Float64) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb") +@_cdecl("invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb") +public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_OptionalPerson_OptionalString_OptionalDouble_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value), Optional.bridgeJSLiftParameter(param1IsSome, param1Bytes, param1Length), Optional.bridgeJSLiftParameter(param2IsSome, param2Value)) + let box = Unmanaged<_BJS_ClosureBox_10TestModule9DirectionO_Sb>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Direction.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_OptionalPerson_To_String: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { +private final class _BJS_ClosureBox_10TestModuleSS_SS: _BridgedSwiftClosureBox { + let closure: (String) -> String + init(_ closure: @escaping (String) -> String) { self.closure = closure } } -private enum _BJS_Closure_OptionalPerson_To_String { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_OptionalPerson_To_String(closure) +private enum _BJS_Closure_10TestModuleSS_SS { + static func bridgeJSLower(_ closure: @escaping (String) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_10TestModuleSS_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalperson_to_string") - func _invoke(_: Int32, _: Int32, _: UnsafeMutableRawPointer) -> Int32 - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() -let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSS_SS") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -320,39 +314,39 @@ let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) } } -@_expose(wasm, "invoke_swift_closure_optionalperson_to_string") -@_cdecl("invoke_swift_closure_optionalperson_to_string") -public func _invoke_swift_closure_optionalperson_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSS_SS") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSS_SS") +public func _invoke_swift_closure_TestModule_10TestModuleSS_SS(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_OptionalPerson_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + let box = Unmanaged<_BJS_ClosureBox_10TestModuleSS_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_OptionalTheme_To_String: _BridgedSwiftClosureBox { +private final class _BJS_ClosureBox_10TestModuleSq5ThemeO_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String init(_ closure: @escaping (Optional) -> String) { self.closure = closure } } -private enum _BJS_Closure_OptionalTheme_To_String { +private enum _BJS_Closure_10TestModuleSq5ThemeO_SS { static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_OptionalTheme_To_String(closure) + let box = _BJS_ClosureBox_10TestModuleSq5ThemeO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionaltheme_to_string") + @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS") func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) +let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -361,11 +355,11 @@ let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) } } -@_expose(wasm, "invoke_swift_closure_optionaltheme_to_string") -@_cdecl("invoke_swift_closure_optionaltheme_to_string") -public func _invoke_swift_closure_optionaltheme_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Bytes: Int32, param0Length: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS") +public func _invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Bytes: Int32, param0Length: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_OptionalTheme_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq5ThemeO_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) return result.bridgeJSLowerReturn() #else @@ -373,26 +367,29 @@ public func _invoke_swift_closure_optionaltheme_to_string(boxPtr: UnsafeMutableR #endif } -private final class _BJS_ClosureBox_Person_To_String: _BridgedSwiftClosureBox { - let closure: (Person) -> String - init(_ closure: @escaping (Person) -> String) { +private final class _BJS_ClosureBox_10TestModuleSq6PersonCSqSSSqSd_SS: _BridgedSwiftClosureBox { + let closure: (Optional, Optional, Optional) -> String + init(_ closure: @escaping (Optional, Optional, Optional) -> String) { self.closure = closure } } -private enum _BJS_Closure_Person_To_String { - static func bridgeJSLower(_ closure: @escaping (Person) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_Person_To_String(closure) +private enum _BJS_Closure_10TestModuleSq6PersonCSqSSSqSd_SS { + static func bridgeJSLower(_ closure: @escaping (Optional, Optional, Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_10TestModuleSq6PersonCSqSSSqSd_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Person) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Optional, Optional, Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0, param1, param2 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_person_to_string") - func _invoke(_: Int32, _: UnsafeMutableRawPointer) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") + func _invoke(_: Int32, _: Int32, _: UnsafeMutableRawPointer, _: Int32, _: Int32, _: Int32, _: Float64) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() +let (param1IsSome, param1Value) = param1.bridgeJSLowerParameterWithPresence() +let (param2IsSome, param2Value) = param2.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value, param1IsSome, param1Value, param2IsSome, param2Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -401,38 +398,39 @@ private enum _BJS_Closure_Person_To_String { } } -@_expose(wasm, "invoke_swift_closure_person_to_string") -@_cdecl("invoke_swift_closure_person_to_string") -public func _invoke_swift_closure_person_to_string(boxPtr: UnsafeMutableRawPointer, param0: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") +public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: UnsafeMutableRawPointer, param1IsSome: Int32, param1Bytes: Int32, param1Length: Int32, param2IsSome: Int32, param2Value: Float64) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_Person_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Person.bridgeJSLiftParameter(param0)) + let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq6PersonCSqSSSqSd_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value), Optional.bridgeJSLiftParameter(param1IsSome, param1Bytes, param1Length), Optional.bridgeJSLiftParameter(param2IsSome, param2Value)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_String_To_String: _BridgedSwiftClosureBox { - let closure: (String) -> String - init(_ closure: @escaping (String) -> String) { +private final class _BJS_ClosureBox_10TestModuleSq6PersonC_SS: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { self.closure = closure } } -private enum _BJS_Closure_String_To_String { - static func bridgeJSLower(_ closure: @escaping (String) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_String_To_String(closure) +private enum _BJS_Closure_10TestModuleSq6PersonC_SS { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_10TestModuleSq6PersonC_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_string_to_string") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS") + func _invoke(_: Int32, _: Int32, _: UnsafeMutableRawPointer) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() +let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -441,39 +439,40 @@ private enum _BJS_Closure_String_To_String { } } -@_expose(wasm, "invoke_swift_closure_string_to_string") -@_cdecl("invoke_swift_closure_string_to_string") -public func _invoke_swift_closure_string_to_string(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS") +public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_String_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) + let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq6PersonC_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_Theme_To_Bool: _BridgedSwiftClosureBox { - let closure: (Theme) -> Bool - init(_ closure: @escaping (Theme) -> Bool) { +private final class _BJS_ClosureBox_10TestModuleSq9APIResultO_SS: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { self.closure = closure } } -private enum _BJS_Closure_Theme_To_Bool { - static func bridgeJSLower(_ closure: @escaping (Theme) -> Bool) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_Theme_To_Bool(closure) +private enum _BJS_Closure_10TestModuleSq9APIResultO_SS { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_10TestModuleSq9APIResultO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Bool { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_theme_to_bool") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) - return Bool.bridgeJSLiftReturn(resultId) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) + return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -481,38 +480,39 @@ private enum _BJS_Closure_Theme_To_Bool { } } -@_expose(wasm, "invoke_swift_closure_theme_to_bool") -@_cdecl("invoke_swift_closure_theme_to_bool") -public func _invoke_swift_closure_theme_to_bool(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Int32 { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS") +public func _invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0CaseId: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_Theme_To_Bool>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq9APIResultO_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0CaseId)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_Theme_To_String: _BridgedSwiftClosureBox { - let closure: (Theme) -> String - init(_ closure: @escaping (Theme) -> String) { +private final class _BJS_ClosureBox_10TestModuleSq9DirectionO_SS: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { self.closure = closure } } -private enum _BJS_Closure_Theme_To_String { - static func bridgeJSLower(_ closure: @escaping (Theme) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_Theme_To_String(closure) +private enum _BJS_Closure_10TestModuleSq9DirectionO_SS { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_10TestModuleSq9DirectionO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_theme_to_string") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -521,12 +521,12 @@ private enum _BJS_Closure_Theme_To_String { } } -@_expose(wasm, "invoke_swift_closure_theme_to_string") -@_cdecl("invoke_swift_closure_theme_to_string") -public func _invoke_swift_closure_theme_to_string(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS") +public func _invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_Theme_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq9DirectionO_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -700,7 +700,7 @@ extension Person: ConvertibleToJSValue, _BridgedSwiftHeapObject { @_cdecl("bjs_TestProcessor_init") public func _bjs_TestProcessor_init(transform: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = TestProcessor(transform: _BJS_Closure_String_To_String.bridgeJSLift(transform)) + let ret = TestProcessor(transform: _BJS_Closure_10TestModuleSS_SS.bridgeJSLift(transform)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -712,7 +712,7 @@ public func _bjs_TestProcessor_init(transform: Int32) -> UnsafeMutableRawPointer public func _bjs_TestProcessor_getTransform(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).getTransform() - return _BJS_Closure_String_To_String.bridgeJSLower(ret) + return _BJS_Closure_10TestModuleSS_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -722,7 +722,7 @@ public func _bjs_TestProcessor_getTransform(_self: UnsafeMutableRawPointer) -> U @_cdecl("bjs_TestProcessor_processWithCustom") public func _bjs_TestProcessor_processWithCustom(_self: UnsafeMutableRawPointer, textBytes: Int32, textLength: Int32, customTransform: Int32) -> Void { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processWithCustom(_: String.bridgeJSLiftParameter(textBytes, textLength), customTransform: _BJS_Closure_String_To_String.bridgeJSLift(customTransform)) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processWithCustom(_: String.bridgeJSLiftParameter(textBytes, textLength), customTransform: _BJS_Closure_10TestModuleSS_SS.bridgeJSLift(customTransform)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -733,7 +733,7 @@ public func _bjs_TestProcessor_processWithCustom(_self: UnsafeMutableRawPointer, @_cdecl("bjs_TestProcessor_printTogether") public func _bjs_TestProcessor_printTogether(_self: UnsafeMutableRawPointer, person: UnsafeMutableRawPointer, nameBytes: Int32, nameLength: Int32, ratio: Float64, customTransform: Int32) -> Void { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).printTogether(person: Person.bridgeJSLiftParameter(person), name: String.bridgeJSLiftParameter(nameBytes, nameLength), ratio: Double.bridgeJSLiftParameter(ratio), customTransform: _BJS_Closure_OptionalPerson_OptionalString_OptionalDouble_To_String.bridgeJSLift(customTransform)) + let ret = TestProcessor.bridgeJSLiftParameter(_self).printTogether(person: Person.bridgeJSLiftParameter(person), name: String.bridgeJSLiftParameter(nameBytes, nameLength), ratio: Double.bridgeJSLiftParameter(ratio), customTransform: _BJS_Closure_10TestModuleSq6PersonCSqSSSqSd_SS.bridgeJSLift(customTransform)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -744,8 +744,8 @@ public func _bjs_TestProcessor_printTogether(_self: UnsafeMutableRawPointer, per @_cdecl("bjs_TestProcessor_roundtrip") public func _bjs_TestProcessor_roundtrip(_self: UnsafeMutableRawPointer, personClosure: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).roundtrip(_: _BJS_Closure_Person_To_String.bridgeJSLift(personClosure)) - return _BJS_Closure_Person_To_String.bridgeJSLower(ret) + let ret = TestProcessor.bridgeJSLiftParameter(_self).roundtrip(_: _BJS_Closure_10TestModule6PersonC_SS.bridgeJSLift(personClosure)) + return _BJS_Closure_10TestModule6PersonC_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -755,8 +755,8 @@ public func _bjs_TestProcessor_roundtrip(_self: UnsafeMutableRawPointer, personC @_cdecl("bjs_TestProcessor_roundtripOptional") public func _bjs_TestProcessor_roundtripOptional(_self: UnsafeMutableRawPointer, personClosure: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).roundtripOptional(_: _BJS_Closure_OptionalPerson_To_String.bridgeJSLift(personClosure)) - return _BJS_Closure_OptionalPerson_To_String.bridgeJSLower(ret) + let ret = TestProcessor.bridgeJSLiftParameter(_self).roundtripOptional(_: _BJS_Closure_10TestModuleSq6PersonC_SS.bridgeJSLift(personClosure)) + return _BJS_Closure_10TestModuleSq6PersonC_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -766,7 +766,7 @@ public func _bjs_TestProcessor_roundtripOptional(_self: UnsafeMutableRawPointer, @_cdecl("bjs_TestProcessor_processDirection") public func _bjs_TestProcessor_processDirection(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processDirection(_: _BJS_Closure_Direction_To_String.bridgeJSLift(callback)) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processDirection(_: _BJS_Closure_10TestModule9DirectionO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -777,7 +777,7 @@ public func _bjs_TestProcessor_processDirection(_self: UnsafeMutableRawPointer, @_cdecl("bjs_TestProcessor_processTheme") public func _bjs_TestProcessor_processTheme(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processTheme(_: _BJS_Closure_Theme_To_String.bridgeJSLift(callback)) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processTheme(_: _BJS_Closure_10TestModule5ThemeO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -788,7 +788,7 @@ public func _bjs_TestProcessor_processTheme(_self: UnsafeMutableRawPointer, call @_cdecl("bjs_TestProcessor_processHttpStatus") public func _bjs_TestProcessor_processHttpStatus(_self: UnsafeMutableRawPointer, callback: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processHttpStatus(_: _BJS_Closure_HttpStatus_To_Int.bridgeJSLift(callback)) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processHttpStatus(_: _BJS_Closure_10TestModule10HttpStatusO_Si.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -799,7 +799,7 @@ public func _bjs_TestProcessor_processHttpStatus(_self: UnsafeMutableRawPointer, @_cdecl("bjs_TestProcessor_processAPIResult") public func _bjs_TestProcessor_processAPIResult(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processAPIResult(_: _BJS_Closure_APIResult_To_String.bridgeJSLift(callback)) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processAPIResult(_: _BJS_Closure_10TestModule9APIResultO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -811,7 +811,7 @@ public func _bjs_TestProcessor_processAPIResult(_self: UnsafeMutableRawPointer, public func _bjs_TestProcessor_makeDirectionChecker(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() - return _BJS_Closure_Direction_To_Bool.bridgeJSLower(ret) + return _BJS_Closure_10TestModule9DirectionO_Sb.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -822,7 +822,7 @@ public func _bjs_TestProcessor_makeDirectionChecker(_self: UnsafeMutableRawPoint public func _bjs_TestProcessor_makeThemeValidator(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() - return _BJS_Closure_Theme_To_Bool.bridgeJSLower(ret) + return _BJS_Closure_10TestModule5ThemeO_Sb.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -833,7 +833,7 @@ public func _bjs_TestProcessor_makeThemeValidator(_self: UnsafeMutableRawPointer public func _bjs_TestProcessor_makeStatusCodeExtractor(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() - return _BJS_Closure_HttpStatus_To_Int.bridgeJSLower(ret) + return _BJS_Closure_10TestModule10HttpStatusO_Si.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -844,7 +844,7 @@ public func _bjs_TestProcessor_makeStatusCodeExtractor(_self: UnsafeMutableRawPo public func _bjs_TestProcessor_makeAPIResultHandler(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() - return _BJS_Closure_APIResult_To_String.bridgeJSLower(ret) + return _BJS_Closure_10TestModule9APIResultO_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -854,7 +854,7 @@ public func _bjs_TestProcessor_makeAPIResultHandler(_self: UnsafeMutableRawPoint @_cdecl("bjs_TestProcessor_processOptionalDirection") public func _bjs_TestProcessor_processOptionalDirection(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalDirection(_: _BJS_Closure_OptionalDirection_To_String.bridgeJSLift(callback)) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalDirection(_: _BJS_Closure_10TestModuleSq9DirectionO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -865,7 +865,7 @@ public func _bjs_TestProcessor_processOptionalDirection(_self: UnsafeMutableRawP @_cdecl("bjs_TestProcessor_processOptionalTheme") public func _bjs_TestProcessor_processOptionalTheme(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalTheme(_: _BJS_Closure_OptionalTheme_To_String.bridgeJSLift(callback)) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalTheme(_: _BJS_Closure_10TestModuleSq5ThemeO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -876,7 +876,7 @@ public func _bjs_TestProcessor_processOptionalTheme(_self: UnsafeMutableRawPoint @_cdecl("bjs_TestProcessor_processOptionalAPIResult") public func _bjs_TestProcessor_processOptionalAPIResult(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalAPIResult(_: _BJS_Closure_OptionalAPIResult_To_String.bridgeJSLift(callback)) + let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalAPIResult(_: _BJS_Closure_10TestModuleSq9APIResultO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -888,7 +888,7 @@ public func _bjs_TestProcessor_processOptionalAPIResult(_self: UnsafeMutableRawP public func _bjs_TestProcessor_makeOptionalDirectionFormatter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() - return _BJS_Closure_OptionalDirection_To_String.bridgeJSLower(ret) + return _BJS_Closure_10TestModuleSq9DirectionO_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/PackageToJS/Templates/instantiate.js b/Plugins/PackageToJS/Templates/instantiate.js index dca50d086..1ab35de35 100644 --- a/Plugins/PackageToJS/Templates/instantiate.js +++ b/Plugins/PackageToJS/Templates/instantiate.js @@ -62,7 +62,6 @@ async function createInstantiator(options, swift) { swift_js_get_optional_double_presence: unexpectedBjsCall, swift_js_get_optional_double_value: unexpectedBjsCall, swift_js_get_optional_heap_object_pointer: unexpectedBjsCall, - release_js_callback: unexpectedBjsCall, } }, /** @param {WebAssembly.Instance} instance */ diff --git a/Sources/JavaScriptKit/BridgeJSInstrincics.swift b/Sources/JavaScriptKit/BridgeJSInstrincics.swift index 5b160f779..0db1cd2ed 100644 --- a/Sources/JavaScriptKit/BridgeJSInstrincics.swift +++ b/Sources/JavaScriptKit/BridgeJSInstrincics.swift @@ -29,48 +29,6 @@ import _CJavaScriptKit } #endif -// MARK: Closure Callback Management - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "release_js_callback") -@_spi(BridgeJS) public func _swift_js_release_callback(_ id: Int32) -#else -/// Releases a JavaScript callback registered from JavaScript side. -/// -/// This function is called by BridgeJS-generated code after consuming a closure -/// parameter to ensure the JavaScript callback is properly cleaned up and can be -/// garbage collected. -/// -/// - Parameter id: The callback ID to release -@_spi(BridgeJS) public func _swift_js_release_callback(_ id: Int32) { - _onlyAvailableOnWasm() -} -#endif - -/// Owns a JavaScript callback and automatically releases it on deinit. -/// This ensures the callback lives exactly as long as the Swift closure that uses it. -/// -/// When a JavaScript function is passed to Swift as a closure parameter, the callback -/// is stored in `swift.memory` with an ID. This owner class captures that ID and ensures -/// it's released when the Swift closure is deallocated, preventing memory leaks while -/// supporting both @escaping and non-escaping closures. -@_spi(BridgeJS) public final class _JSCallbackOwner { - public let callbackId: Int32 - private var isReleased: Bool = false - - public init(callbackId: Int32) { - self.callbackId = callbackId - } - - deinit { - guard !isReleased else { return } - #if arch(wasm32) - _swift_js_release_callback(callbackId) - #endif - isReleased = true - } -} - /// Retrieves and clears any pending JavaScript exception. /// /// This function checks for any JavaScript exceptions that were thrown during @@ -340,20 +298,6 @@ extension _BridgedSwiftHeapObject { /// The conformance is automatically synthesized by the BridgeJS code generator. @_spi(BridgeJS) public protocol _BridgedSwiftClosureBox: AnyObject {} -/// Release function for closure boxes -/// - Parameter boxPtr: Opaque pointer to a closure box conforming to _BridgedSwiftClosureBox -#if arch(wasm32) -@_expose(wasm, "release_swift_closure") -@_cdecl("release_swift_closure") -public func _release_swift_closure(boxPtr: UnsafeMutableRawPointer) { - Unmanaged.fromOpaque(boxPtr).release() -} -#else -@_spi(BridgeJS) public func _release_swift_closure(boxPtr: UnsafeMutableRawPointer) { - _onlyAvailableOnWasm() -} -#endif - extension _JSBridgedClass { // MARK: ImportTS @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { jsObject.bridgeJSLowerParameter() } @@ -836,9 +780,6 @@ extension Optional where Wrapped: _BridgedSwiftHeapObject { /// JavaScript must wrap the pointer with `__construct()` to create a managed reference /// that will be cleaned up via FinalizationRegistry. /// - /// Use this method when passing heap objects to @escaping closures that may outlive - /// the original call context. - /// /// - Returns: A tuple containing presence flag (0 for nil, 1 for some) and retained pointer @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithRetain() -> ( isSome: Int32, pointer: UnsafeMutableRawPointer diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 3875d37e7..f5268b4ee 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -1097,7 +1097,6 @@ enum APIOptionalResult { return transform } - // Optional parameter in closure @JS func processOptionalString(_ callback: (String?) -> String) -> String { return callback("test") + " | " + callback(nil) } @@ -1111,7 +1110,6 @@ enum APIOptionalResult { return callback(greeter) + " | " + callback(nil) } - // Return closure with optional parameter @JS func makeOptionalStringFormatter() -> (String?) -> String { return { value in if let value = value { @@ -1122,7 +1120,6 @@ enum APIOptionalResult { } } - // Return closure with optional return type @JS func makeOptionalGreeterCreator() -> () -> Greeter? { var count = 0 return { diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index 67f05fde2..2e7394999 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -6,27 +6,27 @@ @_spi(BridgeJS) import JavaScriptKit -private final class _BJS_ClosureBox_APIResult_To_String: _BridgedSwiftClosureBox { - let closure: (APIResult) -> String - init(_ closure: @escaping (APIResult) -> String) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTests10HttpStatusO_Si: _BridgedSwiftClosureBox { + let closure: (HttpStatus) -> Int + init(_ closure: @escaping (HttpStatus) -> Int) { self.closure = closure } } -private enum _BJS_Closure_APIResult_To_String { - static func bridgeJSLower(_ closure: @escaping (APIResult) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_APIResult_To_String(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si { + static func bridgeJSLower(_ closure: @escaping (HttpStatus) -> Int) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTests10HttpStatusO_Si(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> Int { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_apiresult_to_string") + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + return Int.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -34,39 +34,39 @@ private enum _BJS_Closure_APIResult_To_String { } } -@_expose(wasm, "invoke_swift_closure_apiresult_to_string") -@_cdecl("invoke_swift_closure_apiresult_to_string") -public func _invoke_swift_closure_apiresult_to_string(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Void { +@_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 box = Unmanaged<_BJS_ClosureBox_APIResult_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(APIResult.bridgeJSLiftParameter(param0)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests10HttpStatusO_Si>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(HttpStatus.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_Direction_To_Bool: _BridgedSwiftClosureBox { - let closure: (Direction) -> Bool - init(_ closure: @escaping (Direction) -> Bool) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_SS: _BridgedSwiftClosureBox { + let closure: (Theme) -> String + init(_ closure: @escaping (Theme) -> String) { self.closure = closure } } -private enum _BJS_Closure_Direction_To_Bool { - static func bridgeJSLower(_ closure: @escaping (Direction) -> Bool) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_Direction_To_Bool(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_SS { + static func bridgeJSLower(_ closure: @escaping (Theme) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Bool { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_direction_to_bool") + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) - return Bool.bridgeJSLiftReturn(resultId) + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -74,39 +74,39 @@ private enum _BJS_Closure_Direction_To_Bool { } } -@_expose(wasm, "invoke_swift_closure_direction_to_bool") -@_cdecl("invoke_swift_closure_direction_to_bool") -public func _invoke_swift_closure_direction_to_bool(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { +@_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 box = Unmanaged<_BJS_ClosureBox_Direction_To_Bool>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Direction.bridgeJSLiftParameter(param0)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_Direction_To_String: _BridgedSwiftClosureBox { - let closure: (Direction) -> String - init(_ closure: @escaping (Direction) -> String) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_Sb: _BridgedSwiftClosureBox { + let closure: (Theme) -> Bool + init(_ closure: @escaping (Theme) -> Bool) { self.closure = closure } } -private enum _BJS_Closure_Direction_To_String { - static func bridgeJSLower(_ closure: @escaping (Direction) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_Direction_To_String(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb { + static func bridgeJSLower(_ closure: @escaping (Theme) -> Bool) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_Sb(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Bool { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_direction_to_string") + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + return Bool.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -114,38 +114,38 @@ private enum _BJS_Closure_Direction_To_String { } } -@_expose(wasm, "invoke_swift_closure_direction_to_string") -@_cdecl("invoke_swift_closure_direction_to_string") -public func _invoke_swift_closure_direction_to_string(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Void { +@_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 box = Unmanaged<_BJS_ClosureBox_Direction_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Direction.bridgeJSLiftParameter(param0)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_Sb>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_Greeter_To_String: _BridgedSwiftClosureBox { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTests7GreeterC_SS: _BridgedSwiftClosureBox { let closure: (Greeter) -> String init(_ closure: @escaping (Greeter) -> String) { self.closure = closure } } -private enum _BJS_Closure_Greeter_To_String { +private enum _BJS_Closure_20BridgeJSRuntimeTests7GreeterC_SS { static func bridgeJSLower(_ closure: @escaping (Greeter) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_Greeter_To_String(closure) + let box = _BJS_ClosureBox_20BridgeJSRuntimeTests7GreeterC_SS(closure) return Unmanaged.passRetained(box).toOpaque() } static func bridgeJSLift(_ callbackId: Int32) -> (Greeter) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_greeter_to_string") + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") func _invoke(_: Int32, _: UnsafeMutableRawPointer) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -154,11 +154,11 @@ private enum _BJS_Closure_Greeter_To_String { } } -@_expose(wasm, "invoke_swift_closure_greeter_to_string") -@_cdecl("invoke_swift_closure_greeter_to_string") -public func _invoke_swift_closure_greeter_to_string(boxPtr: UnsafeMutableRawPointer, param0: UnsafeMutableRawPointer) -> Void { +@_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 box = Unmanaged<_BJS_ClosureBox_Greeter_To_String>.fromOpaque(boxPtr).takeUnretainedValue() + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests7GreeterC_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Greeter.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else @@ -166,27 +166,27 @@ public func _invoke_swift_closure_greeter_to_string(boxPtr: UnsafeMutableRawPoin #endif } -private final class _BJS_ClosureBox_HttpStatus_To_Int: _BridgedSwiftClosureBox { - let closure: (HttpStatus) -> Int - init(_ closure: @escaping (HttpStatus) -> Int) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTests9APIResultO_SS: _BridgedSwiftClosureBox { + let closure: (APIResult) -> String + init(_ closure: @escaping (APIResult) -> String) { self.closure = closure } } -private enum _BJS_Closure_HttpStatus_To_Int { - static func bridgeJSLower(_ closure: @escaping (HttpStatus) -> Int) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_HttpStatus_To_Int(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS { + static func bridgeJSLower(_ closure: @escaping (APIResult) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTests9APIResultO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> Int { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_httpstatus_to_int") + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) - return Int.bridgeJSLiftReturn(resultId) + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -194,38 +194,38 @@ private enum _BJS_Closure_HttpStatus_To_Int { } } -@_expose(wasm, "invoke_swift_closure_httpstatus_to_int") -@_cdecl("invoke_swift_closure_httpstatus_to_int") -public func _invoke_swift_closure_httpstatus_to_int(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { +@_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 box = Unmanaged<_BJS_ClosureBox_HttpStatus_To_Int>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(HttpStatus.bridgeJSLiftParameter(param0)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests9APIResultO_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(APIResult.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_Int_String_Double_To_String: _BridgedSwiftClosureBox { - let closure: (Int, String, Double) -> String - init(_ closure: @escaping (Int, String, Double) -> String) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_SS: _BridgedSwiftClosureBox { + let closure: (Direction) -> String + init(_ closure: @escaping (Direction) -> String) { self.closure = closure } } -private enum _BJS_Closure_Int_String_Double_To_String { - static func bridgeJSLower(_ closure: @escaping (Int, String, Double) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_Int_String_Double_To_String(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_SS { + static func bridgeJSLower(_ closure: @escaping (Direction) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Int, String, Double) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0, param1, param2 in + static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_int_string_double_to_string") - func _invoke(_: Int32, _: Int32, _: Int32, _: Float64) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter(), param1.bridgeJSLowerParameter(), param2.bridgeJSLowerParameter()) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -234,39 +234,39 @@ private enum _BJS_Closure_Int_String_Double_To_String { } } -@_expose(wasm, "invoke_swift_closure_int_string_double_to_string") -@_cdecl("invoke_swift_closure_int_string_double_to_string") -public func _invoke_swift_closure_int_string_double_to_string(boxPtr: UnsafeMutableRawPointer, param0: Int32, param1Bytes: Int32, param1Length: Int32, param2: Float64) -> Void { +@_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 box = Unmanaged<_BJS_ClosureBox_Int_String_Double_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Int.bridgeJSLiftParameter(param0), String.bridgeJSLiftParameter(param1Bytes, param1Length), Double.bridgeJSLiftParameter(param2)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Direction.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_Int_To_Int: _BridgedSwiftClosureBox { - let closure: (Int) -> Int - init(_ closure: @escaping (Int) -> Int) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_Sb: _BridgedSwiftClosureBox { + let closure: (Direction) -> Bool + init(_ closure: @escaping (Direction) -> Bool) { self.closure = closure } } -private enum _BJS_Closure_Int_To_Int { - static func bridgeJSLower(_ closure: @escaping (Int) -> Int) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_Int_To_Int(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb { + static func bridgeJSLower(_ closure: @escaping (Direction) -> Bool) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_Sb(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Int { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Bool { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_int_to_int") + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) - return Int.bridgeJSLiftReturn(resultId) + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + return Bool.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -274,40 +274,39 @@ private enum _BJS_Closure_Int_To_Int { } } -@_expose(wasm, "invoke_swift_closure_int_to_int") -@_cdecl("invoke_swift_closure_int_to_int") -public func _invoke_swift_closure_int_to_int(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { +@_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 box = Unmanaged<_BJS_ClosureBox_Int_To_Int>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Int.bridgeJSLiftParameter(param0)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_Sb>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Direction.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_OptionalAPIResult_To_String: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_7GreeterC: _BridgedSwiftClosureBox { + let closure: (String) -> Greeter + init(_ closure: @escaping (String) -> Greeter) { self.closure = closure } } -private enum _BJS_Closure_OptionalAPIResult_To_String { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_OptionalAPIResult_To_String(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_7GreeterC { + static func bridgeJSLower(_ closure: @escaping (String) -> Greeter) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_7GreeterC(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (String) -> Greeter { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalapiresult_to_string") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) - return String.bridgeJSLiftReturn(resultId) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") + func _invoke(_: Int32, _: Int32) -> UnsafeMutableRawPointer + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + return Greeter.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -315,39 +314,38 @@ let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) } } -@_expose(wasm, "invoke_swift_closure_optionalapiresult_to_string") -@_cdecl("invoke_swift_closure_optionalapiresult_to_string") -public func _invoke_swift_closure_optionalapiresult_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0CaseId: Int32) -> Void { +@_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 box = Unmanaged<_BJS_ClosureBox_OptionalAPIResult_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0CaseId)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSS_7GreeterC>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_OptionalDirection_To_String: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_SS: _BridgedSwiftClosureBox { + let closure: (String) -> String + init(_ closure: @escaping (String) -> String) { self.closure = closure } } -private enum _BJS_Closure_OptionalDirection_To_String { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_OptionalDirection_To_String(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_SS { + static func bridgeJSLower(_ closure: @escaping (String) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionaldirection_to_string") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -356,39 +354,38 @@ let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) } } -@_expose(wasm, "invoke_swift_closure_optionaldirection_to_string") -@_cdecl("invoke_swift_closure_optionaldirection_to_string") -public func _invoke_swift_closure_optionaldirection_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: Int32) -> Void { +@_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 box = Unmanaged<_BJS_ClosureBox_OptionalDirection_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSS_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_OptionalGreeter_To_String: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSiSSSd_SS: _BridgedSwiftClosureBox { + let closure: (Int, String, Double) -> String + init(_ closure: @escaping (Int, String, Double) -> String) { self.closure = closure } } -private enum _BJS_Closure_OptionalGreeter_To_String { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_OptionalGreeter_To_String(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTestsSiSSSd_SS { + static func bridgeJSLower(_ closure: @escaping (Int, String, Double) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSiSSSd_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Int, String, Double) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0, param1, param2 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalgreeter_to_string") - func _invoke(_: Int32, _: Int32, _: UnsafeMutableRawPointer) -> Int32 - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() -let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") + func _invoke(_: Int32, _: Int32, _: Int32, _: Float64) -> Int32 + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter(), param1.bridgeJSLowerParameter(), param2.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -397,40 +394,39 @@ let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) } } -@_expose(wasm, "invoke_swift_closure_optionalgreeter_to_string") -@_cdecl("invoke_swift_closure_optionalgreeter_to_string") -public func _invoke_swift_closure_optionalgreeter_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: UnsafeMutableRawPointer) -> Void { +@_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 box = Unmanaged<_BJS_ClosureBox_OptionalGreeter_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSiSSSd_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Int.bridgeJSLiftParameter(param0), String.bridgeJSLiftParameter(param1Bytes, param1Length), Double.bridgeJSLiftParameter(param2)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_OptionalInt_To_String: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSi_Si: _BridgedSwiftClosureBox { + let closure: (Int) -> Int + init(_ closure: @escaping (Int) -> Int) { self.closure = closure } } -private enum _BJS_Closure_OptionalInt_To_String { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_OptionalInt_To_String(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTestsSi_Si { + static func bridgeJSLower(_ closure: @escaping (Int) -> Int) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSi_Si(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Int { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalint_to_string") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) - return String.bridgeJSLiftReturn(resultId) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") + func _invoke(_: Int32, _: Int32) -> Int32 + let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + return Int.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -438,39 +434,39 @@ let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) } } -@_expose(wasm, "invoke_swift_closure_optionalint_to_string") -@_cdecl("invoke_swift_closure_optionalint_to_string") -public func _invoke_swift_closure_optionalint_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: Int32) -> Void { +@_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 box = Unmanaged<_BJS_ClosureBox_OptionalInt_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSi_Si>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Int.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_OptionalString_To_String: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq5ThemeO_SS: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { self.closure = closure } } -private enum _BJS_Closure_OptionalString_To_String { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_OptionalString_To_String(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTestsSq5ThemeO_SS { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq5ThemeO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionalstring_to_string") + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) +let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -479,39 +475,39 @@ let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) } } -@_expose(wasm, "invoke_swift_closure_optionalstring_to_string") -@_cdecl("invoke_swift_closure_optionalstring_to_string") -public func _invoke_swift_closure_optionalstring_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Bytes: Int32, param0Length: Int32) -> Void { +@_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 box = Unmanaged<_BJS_ClosureBox_OptionalString_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq5ThemeO_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_OptionalTheme_To_String: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_SS: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { self.closure = closure } } -private enum _BJS_Closure_OptionalTheme_To_String { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_OptionalTheme_To_String(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_SS { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_optionaltheme_to_string") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") + func _invoke(_: Int32, _: Int32, _: UnsafeMutableRawPointer) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() +let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -520,39 +516,40 @@ let resultId = _invoke(owner.callbackId, param0IsSome, param0Value) } } -@_expose(wasm, "invoke_swift_closure_optionaltheme_to_string") -@_cdecl("invoke_swift_closure_optionaltheme_to_string") -public func _invoke_swift_closure_optionaltheme_to_string(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Bytes: Int32, param0Length: Int32) -> Void { +@_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 box = Unmanaged<_BJS_ClosureBox_OptionalTheme_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_String_To_Greeter: _BridgedSwiftClosureBox { - let closure: (String) -> Greeter - init(_ closure: @escaping (String) -> Greeter) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9APIResultO_SS: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { self.closure = closure } } -private enum _BJS_Closure_String_To_Greeter { - static func bridgeJSLower(_ closure: @escaping (String) -> Greeter) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_String_To_Greeter(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9APIResultO_SS { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9APIResultO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (String) -> Greeter { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_string_to_greeter") - func _invoke(_: Int32, _: Int32) -> UnsafeMutableRawPointer - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) - return Greeter.bridgeJSLiftReturn(resultId) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) + return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -560,38 +557,39 @@ private enum _BJS_Closure_String_To_Greeter { } } -@_expose(wasm, "invoke_swift_closure_string_to_greeter") -@_cdecl("invoke_swift_closure_string_to_greeter") -public func _invoke_swift_closure_string_to_greeter(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> UnsafeMutableRawPointer { +@_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 box = Unmanaged<_BJS_ClosureBox_String_To_Greeter>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq9APIResultO_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0CaseId)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_String_To_String: _BridgedSwiftClosureBox { - let closure: (String) -> String - init(_ closure: @escaping (String) -> String) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9DirectionO_SS: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { self.closure = closure } } -private enum _BJS_Closure_String_To_String { - static func bridgeJSLower(_ closure: @escaping (String) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_String_To_String(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9DirectionO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_string_to_string") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -600,39 +598,40 @@ private enum _BJS_Closure_String_To_String { } } -@_expose(wasm, "invoke_swift_closure_string_to_string") -@_cdecl("invoke_swift_closure_string_to_string") -public func _invoke_swift_closure_string_to_string(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Void { +@_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 box = Unmanaged<_BJS_ClosureBox_String_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq9DirectionO_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_Theme_To_Bool: _BridgedSwiftClosureBox { - let closure: (Theme) -> Bool - init(_ closure: @escaping (Theme) -> Bool) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSS_SS: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { self.closure = closure } } -private enum _BJS_Closure_Theme_To_Bool { - static func bridgeJSLower(_ closure: @escaping (Theme) -> Bool) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_Theme_To_Bool(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSS_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Bool { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_theme_to_bool") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) - return Bool.bridgeJSLiftReturn(resultId) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) + return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") #endif @@ -640,38 +639,39 @@ private enum _BJS_Closure_Theme_To_Bool { } } -@_expose(wasm, "invoke_swift_closure_theme_to_bool") -@_cdecl("invoke_swift_closure_theme_to_bool") -public func _invoke_swift_closure_theme_to_bool(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Int32 { +@_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 box = Unmanaged<_BJS_ClosureBox_Theme_To_Bool>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSqSS_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_Theme_To_String: _BridgedSwiftClosureBox { - let closure: (Theme) -> String - init(_ closure: @escaping (Theme) -> String) { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSi_SS: _BridgedSwiftClosureBox { + let closure: (Optional) -> String + init(_ closure: @escaping (Optional) -> String) { self.closure = closure } } -private enum _BJS_Closure_Theme_To_String { - static func bridgeJSLower(_ closure: @escaping (Theme) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_Theme_To_String(closure) +private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSi_SS { + static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSi_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> String { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] param0 in + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_theme_to_string") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(owner.callbackId, param0.bridgeJSLowerParameter()) + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") + func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() +let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") @@ -680,38 +680,38 @@ private enum _BJS_Closure_Theme_To_String { } } -@_expose(wasm, "invoke_swift_closure_theme_to_string") -@_cdecl("invoke_swift_closure_theme_to_string") -public func _invoke_swift_closure_theme_to_string(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Void { +@_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 box = Unmanaged<_BJS_ClosureBox_Theme_To_String>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSqSi_SS>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -private final class _BJS_ClosureBox_Void_To_OptionalGreeter: _BridgedSwiftClosureBox { +private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsy_Sq7GreeterC: _BridgedSwiftClosureBox { let closure: () -> Optional init(_ closure: @escaping () -> Optional) { self.closure = closure } } -private enum _BJS_Closure_Void_To_OptionalGreeter { +private enum _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC { static func bridgeJSLower(_ closure: @escaping () -> Optional) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_Void_To_OptionalGreeter(closure) + let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsy_Sq7GreeterC(closure) return Unmanaged.passRetained(box).toOpaque() } static func bridgeJSLift(_ callbackId: Int32) -> () -> Optional { - let owner = _JSCallbackOwner(callbackId: callbackId) - return { [owner] in + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_void_to_optionalgreeter") + @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") func _invoke(_: Int32) -> Void - _invoke(owner.callbackId) + _invoke(callback.bridgeJSLowerParameter()) return Optional.bridgeJSLiftReturnFromSideChannel() #else fatalError("Only available on WebAssembly") @@ -720,11 +720,11 @@ private enum _BJS_Closure_Void_To_OptionalGreeter { } } -@_expose(wasm, "invoke_swift_closure_void_to_optionalgreeter") -@_cdecl("invoke_swift_closure_void_to_optionalgreeter") -public func _invoke_swift_closure_void_to_optionalgreeter(boxPtr: UnsafeMutableRawPointer) -> Void { +@_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 box = Unmanaged<_BJS_ClosureBox_Void_To_OptionalGreeter>.fromOpaque(boxPtr).takeUnretainedValue() + let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsy_Sq7GreeterC>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure() return result.bridgeJSLowerReturn() #else @@ -3232,7 +3232,7 @@ public func _bjs_getAllStaticPropertyValues() -> Void { @_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_String_To_String.bridgeJSLift(transform)) + let ret = formatName(_: String.bridgeJSLiftParameter(nameBytes, nameLength), transform: _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(transform)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -3244,7 +3244,7 @@ public func _bjs_formatName(nameBytes: Int32, nameLength: Int32, transform: Int3 public func _bjs_makeFormatter(prefixBytes: Int32, prefixLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = makeFormatter(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) - return _BJS_Closure_String_To_String.bridgeJSLower(ret) + return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -3255,7 +3255,7 @@ public func _bjs_makeFormatter(prefixBytes: Int32, prefixLength: Int32) -> Unsaf public func _bjs_makeAdder(base: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = makeAdder(base: Int.bridgeJSLiftParameter(base)) - return _BJS_Closure_Int_To_Int.bridgeJSLower(ret) + return _BJS_Closure_20BridgeJSRuntimeTestsSi_Si.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -3297,7 +3297,7 @@ public func _bjs_Greeter_changeName(_self: UnsafeMutableRawPointer, nameBytes: I @_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_Greeter_To_String.bridgeJSLift(customGreeting)) + 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") @@ -3309,7 +3309,7 @@ public func _bjs_Greeter_greetWith(_self: UnsafeMutableRawPointer, greeter: Unsa public func _bjs_Greeter_makeFormatter(_self: UnsafeMutableRawPointer, suffixBytes: Int32, suffixLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).makeFormatter(suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) - return _BJS_Closure_String_To_String.bridgeJSLower(ret) + return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -3320,7 +3320,7 @@ public func _bjs_Greeter_makeFormatter(_self: UnsafeMutableRawPointer, suffixByt public func _bjs_Greeter_static_makeCreator(defaultNameBytes: Int32, defaultNameLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Greeter.makeCreator(defaultName: String.bridgeJSLiftParameter(defaultNameBytes, defaultNameLength)) - return _BJS_Closure_String_To_Greeter.bridgeJSLower(ret) + return _BJS_Closure_20BridgeJSRuntimeTestsSS_7GreeterC.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -3331,7 +3331,7 @@ public func _bjs_Greeter_static_makeCreator(defaultNameBytes: Int32, defaultName public func _bjs_Greeter_makeCustomGreeter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).makeCustomGreeter() - return _BJS_Closure_Greeter_To_String.bridgeJSLower(ret) + return _BJS_Closure_20BridgeJSRuntimeTests7GreeterC_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -5149,7 +5149,7 @@ extension SwiftDataProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { @_cdecl("bjs_TextProcessor_init") public func _bjs_TextProcessor_init(transform: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = TextProcessor(transform: _BJS_Closure_String_To_String.bridgeJSLift(transform)) + let ret = TextProcessor(transform: _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(transform)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5171,7 +5171,7 @@ public func _bjs_TextProcessor_process(_self: UnsafeMutableRawPointer, textBytes @_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_Int_String_Double_To_String.bridgeJSLift(customTransform)) + 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") @@ -5183,7 +5183,7 @@ public func _bjs_TextProcessor_processWithCustom(_self: UnsafeMutableRawPointer, public func _bjs_TextProcessor_getTransform(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).getTransform() - return _BJS_Closure_String_To_String.bridgeJSLower(ret) + return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -5193,7 +5193,7 @@ public func _bjs_TextProcessor_getTransform(_self: UnsafeMutableRawPointer) -> U @_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_OptionalString_To_String.bridgeJSLift(callback)) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalString(_: _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5204,7 +5204,7 @@ public func _bjs_TextProcessor_processOptionalString(_self: UnsafeMutableRawPoin @_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_OptionalInt_To_String.bridgeJSLift(callback)) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalInt(_: _BJS_Closure_20BridgeJSRuntimeTestsSqSi_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5215,7 +5215,7 @@ public func _bjs_TextProcessor_processOptionalInt(_self: UnsafeMutableRawPointer @_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_OptionalGreeter_To_String.bridgeJSLift(callback)) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalGreeter(_: _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5227,7 +5227,7 @@ public func _bjs_TextProcessor_processOptionalGreeter(_self: UnsafeMutableRawPoi public func _bjs_TextProcessor_makeOptionalStringFormatter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalStringFormatter() - return _BJS_Closure_OptionalString_To_String.bridgeJSLower(ret) + return _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -5238,7 +5238,7 @@ public func _bjs_TextProcessor_makeOptionalStringFormatter(_self: UnsafeMutableR public func _bjs_TextProcessor_makeOptionalGreeterCreator(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalGreeterCreator() - return _BJS_Closure_Void_To_OptionalGreeter.bridgeJSLower(ret) + return _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -5248,7 +5248,7 @@ public func _bjs_TextProcessor_makeOptionalGreeterCreator(_self: UnsafeMutableRa @_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_Direction_To_String.bridgeJSLift(callback)) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processDirection(_: _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5259,7 +5259,7 @@ public func _bjs_TextProcessor_processDirection(_self: UnsafeMutableRawPointer, @_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_Theme_To_String.bridgeJSLift(callback)) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processTheme(_: _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5270,7 +5270,7 @@ public func _bjs_TextProcessor_processTheme(_self: UnsafeMutableRawPointer, call @_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_HttpStatus_To_Int.bridgeJSLift(callback)) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processHttpStatus(_: _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5281,7 +5281,7 @@ public func _bjs_TextProcessor_processHttpStatus(_self: UnsafeMutableRawPointer, @_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_APIResult_To_String.bridgeJSLift(callback)) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processAPIResult(_: _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5293,7 +5293,7 @@ public func _bjs_TextProcessor_processAPIResult(_self: UnsafeMutableRawPointer, public func _bjs_TextProcessor_makeDirectionChecker(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() - return _BJS_Closure_Direction_To_Bool.bridgeJSLower(ret) + return _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -5304,7 +5304,7 @@ public func _bjs_TextProcessor_makeDirectionChecker(_self: UnsafeMutableRawPoint public func _bjs_TextProcessor_makeThemeValidator(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() - return _BJS_Closure_Theme_To_Bool.bridgeJSLower(ret) + return _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -5315,7 +5315,7 @@ public func _bjs_TextProcessor_makeThemeValidator(_self: UnsafeMutableRawPointer public func _bjs_TextProcessor_makeStatusCodeExtractor(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() - return _BJS_Closure_HttpStatus_To_Int.bridgeJSLower(ret) + return _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -5326,7 +5326,7 @@ public func _bjs_TextProcessor_makeStatusCodeExtractor(_self: UnsafeMutableRawPo public func _bjs_TextProcessor_makeAPIResultHandler(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() - return _BJS_Closure_APIResult_To_String.bridgeJSLower(ret) + return _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif @@ -5336,7 +5336,7 @@ public func _bjs_TextProcessor_makeAPIResultHandler(_self: UnsafeMutableRawPoint @_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_OptionalDirection_To_String.bridgeJSLift(callback)) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalDirection(_: _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5347,7 +5347,7 @@ public func _bjs_TextProcessor_processOptionalDirection(_self: UnsafeMutableRawP @_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_OptionalTheme_To_String.bridgeJSLift(callback)) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalTheme(_: _BJS_Closure_20BridgeJSRuntimeTestsSq5ThemeO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5358,7 +5358,7 @@ public func _bjs_TextProcessor_processOptionalTheme(_self: UnsafeMutableRawPoint @_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_OptionalAPIResult_To_String.bridgeJSLift(callback)) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalAPIResult(_: _BJS_Closure_20BridgeJSRuntimeTestsSq9APIResultO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5370,7 +5370,7 @@ public func _bjs_TextProcessor_processOptionalAPIResult(_self: UnsafeMutableRawP public func _bjs_TextProcessor_makeOptionalDirectionFormatter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() - return _BJS_Closure_OptionalDirection_To_String.bridgeJSLower(ret) + return _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index 23d2afdc4..c5ac3294d 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -90,7 +90,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Greeter_To_String", + "mangleName" : "20BridgeJSRuntimeTests7GreeterC_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "swiftHeapObject" : { @@ -138,7 +139,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "String_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "string" : { @@ -179,7 +181,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "String_To_Greeter", + "mangleName" : "20BridgeJSRuntimeTestsSS_7GreeterC", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "string" : { @@ -217,7 +220,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Greeter_To_String", + "mangleName" : "20BridgeJSRuntimeTests7GreeterC_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "swiftHeapObject" : { @@ -2272,7 +2276,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "String_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "string" : { @@ -2343,7 +2348,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Int_String_Double_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSiSSSd_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "int" : { @@ -2393,7 +2399,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "String_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "string" : { @@ -2427,7 +2434,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalString_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSqSS_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "optional" : { @@ -2472,7 +2480,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalInt_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSqSi_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "optional" : { @@ -2517,7 +2526,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalGreeter_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSq7GreeterC_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "optional" : { @@ -2561,7 +2571,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalString_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSqSS_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "optional" : { @@ -2598,7 +2609,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Void_To_OptionalGreeter", + "mangleName" : "20BridgeJSRuntimeTestsy_Sq7GreeterC", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ ], @@ -2632,7 +2644,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Direction_To_String", + "mangleName" : "20BridgeJSRuntimeTests9DirectionO_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "caseEnum" : { @@ -2673,7 +2686,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Theme_To_String", + "mangleName" : "20BridgeJSRuntimeTests5ThemeO_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "rawValueEnum" : { @@ -2715,7 +2729,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "HttpStatus_To_Int", + "mangleName" : "20BridgeJSRuntimeTests10HttpStatusO_Si", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "rawValueEnum" : { @@ -2757,7 +2772,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "APIResult_To_String", + "mangleName" : "20BridgeJSRuntimeTests9APIResultO_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "associatedValueEnum" : { @@ -2797,7 +2813,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Direction_To_Bool", + "mangleName" : "20BridgeJSRuntimeTests9DirectionO_Sb", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "caseEnum" : { @@ -2830,7 +2847,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Theme_To_Bool", + "mangleName" : "20BridgeJSRuntimeTests5ThemeO_Sb", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "rawValueEnum" : { @@ -2864,7 +2882,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "HttpStatus_To_Int", + "mangleName" : "20BridgeJSRuntimeTests10HttpStatusO_Si", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "rawValueEnum" : { @@ -2898,7 +2917,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "APIResult_To_String", + "mangleName" : "20BridgeJSRuntimeTests9APIResultO_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "associatedValueEnum" : { @@ -2932,7 +2952,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalDirection_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSq9DirectionO_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "optional" : { @@ -2977,7 +2998,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalTheme_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSq5ThemeO_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "optional" : { @@ -3023,7 +3045,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalAPIResult_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSq9APIResultO_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "optional" : { @@ -3067,7 +3090,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "OptionalDirection_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSq9DirectionO_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "optional" : { @@ -7392,7 +7416,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "String_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "string" : { @@ -7440,7 +7465,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "String_To_String", + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "string" : { @@ -7481,7 +7507,8 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "Int_To_Int", + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { "int" : { From 09c1e2a248149fa6a3843574aebf402afb6f06c0 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 19 Nov 2025 08:52:09 +0100 Subject: [PATCH 028/252] BridgeJS: Namespaced elements in Exports --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 756 +++++++++++------- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 11 + .../EnumAssociatedValue.Export.d.ts | 8 +- .../EnumAssociatedValue.Export.js | 8 +- .../EnumNamespace.Export.d.ts | 38 +- .../BridgeJSLinkTests/EnumNamespace.Export.js | 32 +- .../BridgeJSLinkTests/Namespaces.Export.d.ts | 30 +- .../BridgeJSLinkTests/Namespaces.Export.js | 36 +- .../StaticFunctions.Export.d.ts | 5 + .../StaticFunctions.Export.js | 24 +- .../StaticProperties.Export.d.ts | 9 + .../StaticProperties.Export.js | 101 ++- .../Exporting-Swift/Using-Namespace.md | 30 +- Tests/prelude.mjs | 41 +- 14 files changed, 723 insertions(+), 406 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 5a7245aa6..478ba15dd 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -12,6 +12,7 @@ struct BridgeJSLink { var exportedSkeletons: [ExportedSkeleton] = [] var importedSkeletons: [ImportedModuleSkeleton] = [] let sharedMemory: Bool + private let namespaceBuilder = NamespaceBuilder() init( exportedSkeletons: [ExportedSkeleton] = [], @@ -65,14 +66,11 @@ struct BridgeJSLink { } """ - private struct LinkData { + fileprivate struct LinkData { var exportsLines: [String] = [] var classLines: [String] = [] var dtsExportLines: [String] = [] var dtsClassLines: [String] = [] - var namespacedFunctions: [ExportedFunction] = [] - var namespacedClasses: [ExportedClass] = [] - var namespacedEnums: [ExportedEnum] = [] var topLevelEnumLines: [String] = [] var topLevelDtsEnumLines: [String] = [] var importObjectBuilders: [ImportObjectBuilder] = [] @@ -102,13 +100,13 @@ struct BridgeJSLink { for klass in skeleton.classes { let (jsType, dtsType, dtsExportEntry) = try renderExportedClass(klass) data.classLines.append(contentsOf: jsType) - data.exportsLines.append("\(klass.name),") - data.dtsExportLines.append(contentsOf: dtsExportEntry) - data.dtsClassLines.append(contentsOf: dtsType) - if klass.namespace != nil { - data.namespacedClasses.append(klass) + if klass.namespace == nil { + data.exportsLines.append("\(klass.name),") + data.dtsExportLines.append(contentsOf: dtsExportEntry) } + + data.dtsClassLines.append(contentsOf: dtsType) } // Process enums @@ -126,10 +124,6 @@ struct BridgeJSLink { } data.topLevelEnumLines.append(contentsOf: exportedJsEnum) data.topLevelDtsEnumLines.append(contentsOf: dtsEnum) - - if enumDefinition.namespace != nil { - data.namespacedEnums.append(enumDefinition) - } case .associatedValue: var exportedJsEnum = jsEnum if !exportedJsEnum.isEmpty && exportedJsEnum[0].hasPrefix("const ") { @@ -137,61 +131,29 @@ struct BridgeJSLink { } data.topLevelEnumLines.append(contentsOf: exportedJsEnum) data.topLevelDtsEnumLines.append(contentsOf: dtsEnum) - if enumDefinition.namespace != nil { - data.namespacedEnums.append(enumDefinition) - } } } } // Process functions for function in skeleton.functions { - var (js, dts) = try renderExportedFunction(function: function) - - if function.effects.isStatic, - case .namespaceEnum = function.staticContext - { - data.namespacedFunctions.append(function) - } else if function.namespace != nil { - data.namespacedFunctions.append(function) - } - - js[0] = "\(function.name): " + js[0] - js[js.count - 1] += "," - data.exportsLines.append(contentsOf: js) - data.dtsExportLines.append(contentsOf: dts) - } - - for enumDefinition in skeleton.enums where enumDefinition.enumType == .namespace { - for function in enumDefinition.staticMethods { - // Create namespace function with full namespace path (parent namespace + enum name) - var functionWithNamespace = function - let fullNamespace = (enumDefinition.namespace ?? []) + [enumDefinition.name] - functionWithNamespace.namespace = fullNamespace - data.namespacedFunctions.append(functionWithNamespace) - - var (js, dts) = try renderExportedFunction(function: functionWithNamespace) - js[0] = "\(functionWithNamespace.name): " + js[0] + if function.namespace == nil { + var (js, dts) = try renderExportedFunction(function: function) + js[0] = "\(function.name): " + js[0] js[js.count - 1] += "," data.exportsLines.append(contentsOf: js) data.dtsExportLines.append(contentsOf: dts) } - - for property in enumDefinition.staticProperties { - let fullNamespace = (enumDefinition.namespace ?? []) + [enumDefinition.name] - let namespacePath = fullNamespace.joined(separator: ".") - let (propJs, _) = try renderNamespaceStaticProperty( - property: property, - namespacePath: namespacePath - ) - data.enumStaticAssignments.append(contentsOf: propJs) - } } for enumDefinition in skeleton.enums where enumDefinition.enumType != .namespace && enumDefinition.emitStyle != .tsEnum { + if enumDefinition.namespace != nil { + continue + } + let enumExportPrinter = CodeFragmentPrinter() - let enumValuesName = "\(enumDefinition.name)Values" + let enumValuesName = enumDefinition.valuesName for function in enumDefinition.staticMethods { let thunkBuilder = ExportedThunkBuilder(effects: function.effects) @@ -281,7 +243,7 @@ struct BridgeJSLink { exportsPrinter.write("\(enumDefinition.name): \(enumValuesName),") } - dtsExportsPrinter.write("\(enumDefinition.name): \(enumDefinition.name)Object") + dtsExportsPrinter.write("\(enumDefinition.name): \(enumDefinition.objectTypeName)") data.exportsLines.append(contentsOf: exportsPrinter.lines) data.dtsExportLines.append(contentsOf: dtsExportsPrinter.lines) @@ -927,8 +889,8 @@ struct BridgeJSLink { for skeleton in exportedSkeletons { for enumDefinition in skeleton.enums where enumDefinition.enumType != .namespace && enumDefinition.emitStyle != .tsEnum { - let enumValuesName = "\(enumDefinition.name)Values" - let enumObjectName = "\(enumDefinition.name)Object" + let enumValuesName = enumDefinition.valuesName + let enumObjectName = enumDefinition.objectTypeName if !enumDefinition.staticMethods.isEmpty || !enumDefinition.staticProperties.isEmpty { printer.write("export type \(enumObjectName) = typeof \(enumValuesName) & {") @@ -952,7 +914,6 @@ struct BridgeJSLink { } // Type definitions section (namespace declarations, class definitions, imported types) - let namespaceBuilder = NamespaceBuilder() let namespaceDeclarationsLines = namespaceBuilder.namespaceDeclarations( exportedSkeletons: exportedSkeletons, renderTSSignatureCallback: { parameters, returnType, effects in @@ -969,7 +930,30 @@ struct BridgeJSLink { // Exports type printer.write("export type Exports = {") printer.indent { + // Add non-namespaced items printer.write(lines: data.dtsExportLines) + + // Add hierarchical namespaced items + let hierarchicalLines = namespaceBuilder.buildHierarchicalExportsType( + exportedSkeletons: exportedSkeletons, + renderClassEntry: { klass in + let printer = CodeFragmentPrinter() + printer.write("\(klass.name): {") + printer.indent { + if let constructor = klass.constructor { + printer.write( + "new\(self.renderTSSignature(parameters: constructor.parameters, returnType: .swiftHeapObject(klass.name), effects: constructor.effects));" + ) + } + } + printer.write("}") + return printer.lines + }, + renderFunctionSignature: { function in + "\(function.name)\(self.renderTSSignature(parameters: function.parameters, returnType: function.returnType, effects: function.effects));" + } + ) + printer.write(lines: hierarchicalLines) } printer.write("}") @@ -999,7 +983,7 @@ struct BridgeJSLink { } /// Generates JavaScript output using CodeFragmentPrinter for better maintainability - private func generateJavaScript(data: LinkData) -> String { + private func generateJavaScript(data: LinkData) throws -> String { let header = """ // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. @@ -1013,21 +997,11 @@ struct BridgeJSLink { // Top-level enums section printer.write(lines: data.topLevelEnumLines) - // Namespace assignments section - let topLevelNamespaceCode = generateNamespaceInitializationCode( - namespacePaths: Set(data.namespacedEnums.compactMap { $0.namespace }) + let topLevelNamespaceCode = namespaceBuilder.buildTopLevelNamespaceInitialization( + exportedSkeletons: exportedSkeletons ) printer.write(lines: topLevelNamespaceCode) - // Add enum assignments to global namespace - for enumDef in data.namespacedEnums { - if enumDef.enumType != .namespace { - let namespacePath = enumDef.namespace?.joined(separator: ".") ?? "" - let enumValuesName = enumDef.emitStyle == .tsEnum ? enumDef.name : "\(enumDef.name)Values" - printer.write("globalThis.\(namespacePath).\(enumValuesName) = \(enumValuesName);") - } - } - // Main function declaration printer.write("export async function createInstantiator(options, \(JSGlueVariableScope.reservedSwift)) {") @@ -1076,33 +1050,25 @@ struct BridgeJSLink { } // createExports method - printer.indent { + try printer.indent { printer.write(lines: [ "/** @param {WebAssembly.Instance} instance */", "createExports: (instance) => {", ]) - printer.indent { + try printer.indent { printer.write("const js = \(JSGlueVariableScope.reservedSwift).memory.heap;") - // Exports / return section - let hasNamespacedItems = !data.namespacedFunctions.isEmpty || !data.namespacedClasses.isEmpty - let hasNamespacedEnums = !data.namespacedEnums.isEmpty - let hasAnyNamespacedItems = hasNamespacedItems || hasNamespacedEnums - printer.write(lines: data.classLines) - // Initialize all namespaces before property assignments - if hasAnyNamespacedItems { - let allNamespacePaths = collectAllNamespacePaths(data: data) - let namespaceInitializationCode = generateNamespaceInitializationCode( - namespacePaths: allNamespacePaths - ) - printer.write(lines: namespaceInitializationCode) - } + let namespaceInitCode = namespaceBuilder.buildNamespaceInitialization( + exportedSkeletons: exportedSkeletons + ) + printer.write(lines: namespaceInitCode) - let propertyAssignments = generateNamespacePropertyAssignments( + let propertyAssignments = try generateNamespacePropertyAssignments( data: data, - hasAnyNamespacedItems: hasAnyNamespacedItems + exportedSkeletons: exportedSkeletons, + namespaceBuilder: namespaceBuilder ) printer.write(lines: propertyAssignments) } @@ -1117,7 +1083,7 @@ struct BridgeJSLink { func link() throws -> (outputJs: String, outputDts: String) { let data = try collectLinkData() - let outputJs = generateJavaScript(data: data) + let outputJs = try generateJavaScript(data: data) let outputDts = generateTypeScript(data: data) return (outputJs, outputDts) } @@ -1127,12 +1093,10 @@ struct BridgeJSLink { for skeleton in exportedSkeletons { for enumDef in skeleton.enums where enumDef.enumType == .associatedValue { - let base = enumDef.name - let baseValues = "\(base)Values" printer.write( - "const \(base)Helpers = __bjs_create\(baseValues)Helpers()(\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTextEncoder), \(JSGlueVariableScope.reservedSwift));" + "const \(enumDef.name)Helpers = __bjs_create\(enumDef.valuesName)Helpers()(\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTextEncoder), \(JSGlueVariableScope.reservedSwift));" ) - printer.write("enumHelpers.\(base) = \(base)Helpers;") + printer.write("enumHelpers.\(enumDef.name) = \(enumDef.name)Helpers;") printer.nextLine() } } @@ -1173,82 +1137,33 @@ struct BridgeJSLink { return wrapperLines } - /// Collects all unique namespace paths from functions, classes, enums, and static properties - private func collectAllNamespacePaths(data: LinkData) -> Set<[String]> { - let functionNamespacePaths: Set<[String]> = Set( - data.namespacedFunctions.compactMap { $0.namespace } - ) - let classNamespacePaths: Set<[String]> = Set( - data.namespacedClasses.compactMap { $0.namespace } - ) - let allRegularNamespacePaths = functionNamespacePaths.union(classNamespacePaths) - - let enumNamespacePaths: Set<[String]> = Set( - data.namespacedEnums.compactMap { $0.namespace } - ) - var staticPropertyNamespacePaths: Set<[String]> = Set() - for skeleton in exportedSkeletons { - for enumDefinition in skeleton.enums { - for property in enumDefinition.staticProperties { - if let namespace = property.namespace, !namespace.isEmpty { - staticPropertyNamespacePaths.insert(namespace) - } - } - } - } - - return allRegularNamespacePaths.union(enumNamespacePaths).union(staticPropertyNamespacePaths) - } - - /// Generates JavaScript code lines for initializing namespace objects on globalThis - private func generateNamespaceInitializationCode(namespacePaths: Set<[String]>) -> [String] { - let printer = CodeFragmentPrinter() - var allUniqueNamespaces: [String] = [] - var seen = Set() - - namespacePaths.forEach { namespacePath in - namespacePath.enumerated().forEach { (index, _) in - let path = namespacePath[0...index].joined(separator: ".") - if seen.insert(path).inserted { - allUniqueNamespaces.append(path) - } - } - } - - allUniqueNamespaces.sorted().forEach { namespace in - printer.write("if (typeof globalThis.\(namespace) === 'undefined') {") - printer.indent { - printer.write("globalThis.\(namespace) = {};") - } - printer.write("}") - } - - return printer.lines - } - - /// Generates JavaScript code for assigning namespaced items to globalThis private func generateNamespacePropertyAssignments( data: LinkData, - hasAnyNamespacedItems: Bool - ) -> [String] { + exportedSkeletons: [ExportedSkeleton], + namespaceBuilder: NamespaceBuilder + ) throws -> [String] { let printer = CodeFragmentPrinter() printer.write(lines: data.enumStaticAssignments) + printer.write("const exports = {") - printer.indent() - printer.write(lines: data.exportsLines.map { "\($0)" }) - printer.unindent() + try printer.indent { + printer.write(lines: data.exportsLines.map { "\($0)" }) + + let hierarchicalLines = try namespaceBuilder.buildHierarchicalExportsObject( + exportedSkeletons: exportedSkeletons, + renderFunctionImpl: { function in + let (js, _) = try self.renderExportedFunction(function: function) + return js + } + ) + printer.write(lines: hierarchicalLines) + } printer.write("};") printer.write("_exports = exports;") - if hasAnyNamespacedItems { - data.namespacedClasses.forEach { klass in - let namespacePath: String = klass.namespace?.joined(separator: ".") ?? "" - printer.write("globalThis.\(namespacePath).\(klass.name) = exports.\(klass.name);") - } - data.namespacedFunctions.forEach { function in - let namespacePath: String = function.namespace?.joined(separator: ".") ?? "" - printer.write("globalThis.\(namespacePath).\(function.name) = exports.\(function.name);") - } - } + + let globalThisLines = namespaceBuilder.buildGlobalThisAssignments(exportedSkeletons: exportedSkeletons) + printer.write(lines: globalThisLines) + printer.write("return exports;") return printer.lines @@ -1453,7 +1368,7 @@ struct BridgeJSLink { return "null" case .enumCase(let enumName, let caseName): let simpleName = enumName.components(separatedBy: ".").last ?? enumName - let jsEnumName = format == .javascript ? "\(simpleName)Values" : simpleName + let jsEnumName = format == .javascript ? "\(simpleName)\(ExportedEnum.valuesSuffix)" : simpleName return "\(jsEnumName).\(caseName.capitalizedFirstLetter)" case .object(let className): return "new \(className)()" @@ -1497,7 +1412,7 @@ struct BridgeJSLink { let scope = JSGlueVariableScope() let cleanup = CodeFragmentPrinter() let printer = CodeFragmentPrinter() - let enumValuesName = enumDefinition.emitStyle == .tsEnum ? enumDefinition.name : "\(enumDefinition.name)Values" + let enumValuesName = enumDefinition.valuesName switch enumDefinition.enumType { case .simple: @@ -1529,7 +1444,7 @@ struct BridgeJSLink { private func generateDeclarations(enumDefinition: ExportedEnum) -> [String] { let printer = CodeFragmentPrinter() - let enumValuesName = enumDefinition.emitStyle == .tsEnum ? enumDefinition.name : "\(enumDefinition.name)Values" + let enumValuesName = enumDefinition.valuesName switch enumDefinition.emitStyle { case .tsEnum: @@ -1848,80 +1763,6 @@ extension BridgeJSLink { return (jsLines, dtsLines) } - /// Renders a namespace static property as getter/setter assignments on the namespace object - private func renderNamespaceStaticProperty( - property: ExportedProperty, - namespacePath: String - ) throws -> (js: [String], dts: [String]) { - var jsLines: [String] = [] - - // Generate getter assignment - let getterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) - let getterReturnExpr = try getterThunkBuilder.call( - abiName: property.getterAbiName(), - returnType: property.type - ) - - let getterLines = getterThunkBuilder.renderFunction( - name: property.name, - parameters: [], - returnExpr: getterReturnExpr, - declarationPrefixKeyword: nil - ) - - // Build Object.defineProperty call for namespace - var definePropertyLines: [String] = [] - definePropertyLines.append( - "Object.defineProperty(globalThis.\(namespacePath), '\(property.name)', { get: function() {" - ) - - // Add getter body (skip function declaration and closing brace) - if getterLines.count > 2 { - let bodyLines = Array(getterLines[1.. 2 { - let bodyLines = Array(setterLines[1.. (js: [String], dtsType: [String], dtsExportEntry: [String]) { @@ -2320,11 +2161,129 @@ extension BridgeJSLink { } struct NamespaceBuilder { + func collectAllNamespacePaths(exportedSkeletons: [ExportedSkeleton]) -> Set<[String]> { + return Set( + exportedSkeletons.flatMap { skeleton in + let itemNamespaces = + (skeleton.functions.compactMap(\.namespace) + skeleton.classes.compactMap(\.namespace) + + skeleton.enums.filter { $0.namespace != nil && $0.enumType != .namespace } + .compactMap(\.namespace)) + + let namespaceEnumPaths = skeleton.enums + .filter { $0.enumType == .namespace } + .filter { !$0.staticProperties.isEmpty || !$0.staticMethods.isEmpty } + .map { ($0.namespace ?? []) + [$0.name] } + + return itemNamespaces + namespaceEnumPaths + } + ) + } + + func buildNamespaceInitialization(exportedSkeletons: [ExportedSkeleton]) -> [String] { + let allNamespacePaths = collectAllNamespacePaths(exportedSkeletons: exportedSkeletons) + return generateNamespaceInitializationCode(namespacePaths: allNamespacePaths) + } + + func buildTopLevelNamespaceInitialization(exportedSkeletons: [ExportedSkeleton]) -> [String] { + var namespacedEnumPaths: Set<[String]> = [] + for skeleton in exportedSkeletons { + for enumDef in skeleton.enums where enumDef.namespace != nil && enumDef.enumType != .namespace { + namespacedEnumPaths.insert(enumDef.namespace!) + } + } + + let initCode = generateNamespaceInitializationCode(namespacePaths: namespacedEnumPaths) + + let printer = CodeFragmentPrinter() + printer.write(lines: initCode) + + for skeleton in exportedSkeletons { + for enumDef in skeleton.enums where enumDef.namespace != nil && enumDef.enumType != .namespace { + let namespacePath = enumDef.namespace!.joined(separator: ".") + printer.write("globalThis.\(namespacePath).\(enumDef.valuesName) = \(enumDef.valuesName);") + } + } + + return printer.lines + } + + func buildGlobalThisAssignments(exportedSkeletons: [ExportedSkeleton]) -> [String] { + let printer = CodeFragmentPrinter() + + for skeleton in exportedSkeletons { + for klass in skeleton.classes where klass.namespace != nil { + let namespacePath = klass.namespace!.joined(separator: ".") + printer.write("globalThis.\(namespacePath).\(klass.name) = exports.\(namespacePath).\(klass.name);") + } + for function in skeleton.functions where function.namespace != nil { + let namespacePath = function.namespace!.joined(separator: ".") + printer.write( + "globalThis.\(namespacePath).\(function.name) = exports.\(namespacePath).\(function.name);" + ) + } + for enumDef in skeleton.enums where enumDef.enumType == .namespace { + for function in enumDef.staticMethods { + let fullNamespace = (enumDef.namespace ?? []) + [enumDef.name] + let namespacePath = fullNamespace.joined(separator: ".") + printer.write( + "globalThis.\(namespacePath).\(function.name) = exports.\(namespacePath).\(function.name);" + ) + } + for property in enumDef.staticProperties { + let fullNamespace = (enumDef.namespace ?? []) + [enumDef.name] + let namespacePath = fullNamespace.joined(separator: ".") + let exportsPath = "exports.\(namespacePath)" + + printer.write("Object.defineProperty(globalThis.\(namespacePath), '\(property.name)', {") + printer.indent { + printer.write("get: () => \(exportsPath).\(property.name),") + if !property.isReadonly { + printer.write("set: (value) => { \(exportsPath).\(property.name) = value; }") + } + } + printer.write("});") + } + } + } + + return printer.lines + } + + private func generateNamespaceInitializationCode(namespacePaths: Set<[String]>) -> [String] { + let printer = CodeFragmentPrinter() + var allUniqueNamespaces: [String] = [] + var seen = Set() + + namespacePaths.forEach { namespacePath in + namespacePath.enumerated().forEach { (index, _) in + let path = namespacePath[0...index].joined(separator: ".") + if seen.insert(path).inserted { + allUniqueNamespaces.append(path) + } + } + } + + allUniqueNamespaces.sorted().forEach { namespace in + printer.write("if (typeof globalThis.\(namespace) === 'undefined') {") + printer.indent { + printer.write("globalThis.\(namespace) = {};") + } + printer.write("}") + } + + return printer.lines + } + private struct NamespaceContent { var functions: [ExportedFunction] = [] var classes: [ExportedClass] = [] var enums: [ExportedEnum] = [] var staticProperties: [ExportedProperty] = [] + var functionJsLines: [(name: String, lines: [String])] = [] + var functionDtsLines: [(name: String, lines: [String])] = [] + var classDtsLines: [(name: String, lines: [String])] = [] + var enumDtsLines: [(name: String, line: String)] = [] + var propertyJsLines: [String] = [] } private final class NamespaceNode { @@ -2346,6 +2305,259 @@ extension BridgeJSLink { } } + private func buildExportsTree( + rootNode: NamespaceNode, + exportedSkeletons: [ExportedSkeleton] + ) { + for skeleton in exportedSkeletons { + for function in skeleton.functions where function.namespace != nil { + var currentNode = rootNode + for part in function.namespace! { + currentNode = currentNode.addChild(part) + } + currentNode.content.functions.append(function) + } + + for klass in skeleton.classes where klass.namespace != nil { + var currentNode = rootNode + for part in klass.namespace! { + currentNode = currentNode.addChild(part) + } + currentNode.content.classes.append(klass) + } + + for enumDef in skeleton.enums where enumDef.namespace != nil && enumDef.enumType != .namespace { + var currentNode = rootNode + for part in enumDef.namespace! { + currentNode = currentNode.addChild(part) + } + currentNode.content.enums.append(enumDef) + } + + for enumDef in skeleton.enums where enumDef.enumType == .namespace { + for property in enumDef.staticProperties { + let fullNamespace = (enumDef.namespace ?? []) + [enumDef.name] + var currentNode = rootNode + for part in fullNamespace { + currentNode = currentNode.addChild(part) + } + currentNode.content.staticProperties.append(property) + } + for function in enumDef.staticMethods { + let fullNamespace = (enumDef.namespace ?? []) + [enumDef.name] + var currentNode = rootNode + for part in fullNamespace { + currentNode = currentNode.addChild(part) + } + currentNode.content.functions.append(function) + } + } + } + } + + fileprivate func buildHierarchicalExportsType( + exportedSkeletons: [ExportedSkeleton], + renderClassEntry: (ExportedClass) -> [String], + renderFunctionSignature: (ExportedFunction) -> String + ) -> [String] { + let printer = CodeFragmentPrinter() + let rootNode = NamespaceNode(name: "") + + buildExportsTree(rootNode: rootNode, exportedSkeletons: exportedSkeletons) + + for (_, node) in rootNode.children { + populateTypeScriptExportLines( + node: node, + renderClassEntry: renderClassEntry, + renderFunctionSignature: renderFunctionSignature + ) + } + + printExportsTypeHierarchy(node: rootNode, printer: printer) + + return printer.lines + } + + private func populateTypeScriptExportLines( + node: NamespaceNode, + renderClassEntry: (ExportedClass) -> [String], + renderFunctionSignature: (ExportedFunction) -> String + ) { + for function in node.content.functions { + let signature = renderFunctionSignature(function) + node.content.functionDtsLines.append((function.name, [signature])) + } + + for klass in node.content.classes { + let entry = renderClassEntry(klass) + node.content.classDtsLines.append((klass.name, entry)) + } + + for enumDef in node.content.enums { + node.content.enumDtsLines.append((enumDef.name, "\(enumDef.name): \(enumDef.objectTypeName)")) + } + + for (_, childNode) in node.children { + populateTypeScriptExportLines( + node: childNode, + renderClassEntry: renderClassEntry, + renderFunctionSignature: renderFunctionSignature + ) + } + } + + fileprivate func buildHierarchicalExportsObject( + exportedSkeletons: [ExportedSkeleton], + renderFunctionImpl: (ExportedFunction) throws -> [String] + ) throws -> [String] { + let printer = CodeFragmentPrinter() + let rootNode = NamespaceNode(name: "") + + buildExportsTree(rootNode: rootNode, exportedSkeletons: exportedSkeletons) + + try populateJavaScriptExportLines(node: rootNode, renderFunctionImpl: renderFunctionImpl) + + try populatePropertyImplementations(node: rootNode) + + printExportsObjectHierarchy(node: rootNode, printer: printer, currentPath: []) + + return printer.lines + } + + private func populateJavaScriptExportLines( + node: NamespaceNode, + renderFunctionImpl: (ExportedFunction) throws -> [String] + ) throws { + for function in node.content.functions { + let impl = try renderFunctionImpl(function) + node.content.functionJsLines.append((function.name, impl)) + } + + for (_, childNode) in node.children { + try populateJavaScriptExportLines(node: childNode, renderFunctionImpl: renderFunctionImpl) + } + } + + private func populatePropertyImplementations(node: NamespaceNode) throws { + for property in node.content.staticProperties { + // Generate getter + let getterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) + let getterReturnExpr = try getterThunkBuilder.call( + abiName: property.getterAbiName(), + returnType: property.type + ) + + let getterPrinter = CodeFragmentPrinter() + getterPrinter.write("get \(property.name)() {") + getterPrinter.indent { + getterPrinter.write(contentsOf: getterThunkBuilder.body) + getterPrinter.write(contentsOf: getterThunkBuilder.cleanupCode) + getterPrinter.write(lines: getterThunkBuilder.checkExceptionLines()) + if let returnExpr = getterReturnExpr { + getterPrinter.write("return \(returnExpr);") + } + } + getterPrinter.write("},") + + var propertyLines = getterPrinter.lines + + // Generate setter if not readonly + if !property.isReadonly { + let setterThunkBuilder = ExportedThunkBuilder( + effects: Effects(isAsync: false, isThrows: false) + ) + try setterThunkBuilder.lowerParameter( + param: Parameter(label: "value", name: "value", type: property.type) + ) + _ = try setterThunkBuilder.call( + abiName: property.setterAbiName(), + returnType: .void + ) + + let setterPrinter = CodeFragmentPrinter() + setterPrinter.write("set \(property.name)(value) {") + setterPrinter.indent { + setterPrinter.write(contentsOf: setterThunkBuilder.body) + setterPrinter.write(contentsOf: setterThunkBuilder.cleanupCode) + setterPrinter.write(lines: setterThunkBuilder.checkExceptionLines()) + } + setterPrinter.write("},") + + propertyLines.append(contentsOf: setterPrinter.lines) + } + + node.content.propertyJsLines.append(contentsOf: propertyLines) + } + + // Recursively process child nodes + for (_, childNode) in node.children { + try populatePropertyImplementations(node: childNode) + } + } + + private func printExportsTypeHierarchy(node: NamespaceNode, printer: CodeFragmentPrinter) { + for (childName, childNode) in node.children.sorted(by: { $0.key < $1.key }) { + printer.write("\(childName): {") + printer.indent { + for (_, lines) in childNode.content.classDtsLines.sorted(by: { $0.name < $1.name }) { + printer.write(lines: lines) + } + + for (_, line) in childNode.content.enumDtsLines.sorted(by: { $0.name < $1.name }) { + printer.write(line) + } + + for property in childNode.content.staticProperties.sorted(by: { $0.name < $1.name }) { + let readonly = property.isReadonly ? "readonly " : "" + printer.write("\(readonly)\(property.name): \(property.type.tsType);") + } + + for (_, lines) in childNode.content.functionDtsLines.sorted(by: { $0.name < $1.name }) { + for line in lines { + printer.write(line) + } + } + + printExportsTypeHierarchy(node: childNode, printer: printer) + } + printer.write("},") + } + } + + private func printExportsObjectHierarchy( + node: NamespaceNode, + printer: CodeFragmentPrinter, + currentPath: [String] = [] + ) { + for (childName, childNode) in node.children.sorted(by: { $0.key < $1.key }) { + let newPath = currentPath + [childName] + printer.write("\(childName): {") + printer.indent { + for klass in childNode.content.classes.sorted(by: { $0.name < $1.name }) { + printer.write("\(klass.name),") + } + + for enumDef in childNode.content.enums.sorted(by: { $0.name < $1.name }) { + printer.write("\(enumDef.name): \(enumDef.valuesName),") + } + + // Print function and property implementations + printer.write(lines: childNode.content.propertyJsLines) + for (name, lines) in childNode.content.functionJsLines.sorted(by: { $0.name < $1.name }) { + var modifiedLines = lines + if !modifiedLines.isEmpty { + modifiedLines[0] = "\(name): " + modifiedLines[0] + modifiedLines[modifiedLines.count - 1] += "," + } + printer.write(lines: modifiedLines) + } + + printExportsObjectHierarchy(node: childNode, printer: printer, currentPath: newPath) + } + printer.write("},") + } + } + /// Generates TypeScript declarations for all namespaces /// /// This function enables properly grouping all Swift code within given namespaces @@ -2368,70 +2580,7 @@ extension BridgeJSLink { let printer = CodeFragmentPrinter() let rootNode = NamespaceNode(name: "") - for skeleton in exportedSkeletons { - for function in skeleton.functions { - if function.effects.isStatic, - case .namespaceEnum = function.staticContext - { - // Use the function's namespace property instead of enumName - if let namespace = function.namespace { - var currentNode = rootNode - for part in namespace { - currentNode = currentNode.addChild(part) - } - currentNode.content.functions.append(function) - } - } else if let namespace = function.namespace { - var currentNode = rootNode - for part in namespace { - currentNode = currentNode.addChild(part) - } - currentNode.content.functions.append(function) - } - } - for klass in skeleton.classes { - if let classNamespace = klass.namespace { - var currentNode = rootNode - for part in classNamespace { - currentNode = currentNode.addChild(part) - } - currentNode.content.classes.append(klass) - } - } - for enumDefinition in skeleton.enums { - if let enumNamespace = enumDefinition.namespace, enumDefinition.enumType != .namespace { - var currentNode = rootNode - for part in enumNamespace { - currentNode = currentNode.addChild(part) - } - currentNode.content.enums.append(enumDefinition) - } - - if enumDefinition.enumType == .namespace { - for function in enumDefinition.staticMethods { - var currentNode = rootNode - // Build full namespace path: parent namespace + enum name - let fullNamespace = (enumDefinition.namespace ?? []) + [enumDefinition.name] - for part in fullNamespace { - currentNode = currentNode.addChild(part) - } - currentNode.content.functions.append(function) - } - - // Add static properties to namespace content for TypeScript declarations - for property in enumDefinition.staticProperties { - var currentNode = rootNode - let fullNamespace = (enumDefinition.namespace ?? []) + [enumDefinition.name] - for part in fullNamespace { - currentNode = currentNode.addChild(part) - } - if !currentNode.content.staticProperties.contains(where: { $0.name == property.name }) { - currentNode.content.staticProperties.append(property) - } - } - } - } - } + buildExportsTree(rootNode: rootNode, exportedSkeletons: exportedSkeletons) guard !rootNode.children.isEmpty else { return printer.lines @@ -2471,8 +2620,7 @@ extension BridgeJSLink { let sortedEnums = childNode.content.enums.sorted { $0.name < $1.name } for enumDefinition in sortedEnums { let style: EnumEmitStyle = enumDefinition.emitStyle - let enumValuesName = - enumDefinition.emitStyle == .tsEnum ? enumDefinition.name : "\(enumDefinition.name)Values" + let enumValuesName = enumDefinition.valuesName switch enumDefinition.enumType { case .simple: switch style { diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index b019e4d91..1b59ddfc3 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -260,6 +260,9 @@ public enum EnumEmitStyle: String, Codable, Sendable { } public struct ExportedEnum: Codable, Equatable, Sendable { + public static let valuesSuffix = "Values" + public static let objectSuffix = "Object" + public let name: String public let swiftCallName: String public let explicitAccessControl: String? @@ -279,6 +282,14 @@ public struct ExportedEnum: Codable, Equatable, Sendable { } } + public var valuesName: String { + emitStyle == .tsEnum ? name : "\(name)\(Self.valuesSuffix)" + } + + public var objectTypeName: String { + "\(name)\(Self.objectSuffix)" + } + public init( name: String, swiftCallName: String, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts index aac40514d..e79f4119e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts @@ -93,9 +93,13 @@ export type Exports = { roundTripOptionalAPIOptionalResult(result: APIOptionalResultTag | null): APIOptionalResultTag | null; APIResult: APIResultObject ComplexResult: ComplexResultObject - Result: ResultObject - NetworkingResult: NetworkingResultObject APIOptionalResult: APIOptionalResultObject + API: { + NetworkingResult: NetworkingResultObject + }, + Utilities: { + Result: ResultObject + }, } export type Imports = { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index 658361df1..14c150e51 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -830,9 +830,13 @@ export async function createInstantiator(options, swift) { }, APIResult: APIResultValues, ComplexResult: ComplexResultValues, - Result: ResultValues, - NetworkingResult: NetworkingResultValues, APIOptionalResult: APIOptionalResultValues, + API: { + NetworkingResult: NetworkingResultValues, + }, + Utilities: { + Result: ResultValues, + }, }; _exports = exports; return exports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts index 7c05f1714..b7c1549a0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts @@ -83,19 +83,31 @@ export interface TestServer extends SwiftHeapObject { call(method: Internal.SupportedMethodTag): void; } export type Exports = { - Converter: { - new(): Converter; - } - HTTPServer: { - new(): HTTPServer; - } - TestServer: { - new(): TestServer; - } - Method: MethodObject - LogLevel: LogLevelObject - Port: PortObject - SupportedMethod: SupportedMethodObject + Configuration: { + LogLevel: LogLevelObject + Port: PortObject + }, + Networking: { + API: { + HTTPServer: { + new(): HTTPServer; + } + Method: MethodObject + }, + APIV2: { + Internal: { + TestServer: { + new(): TestServer; + } + SupportedMethod: SupportedMethodObject + }, + }, + }, + Utils: { + Converter: { + new(): Converter; + } + }, } export type Imports = { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index a788abf5a..a38b50933 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -333,18 +333,30 @@ export async function createInstantiator(options, swift) { globalThis.Utils = {}; } const exports = { - Converter, - HTTPServer, - TestServer, - Method: MethodValues, - LogLevel: LogLevelValues, - Port: PortValues, - SupportedMethod: SupportedMethodValues, + Configuration: { + LogLevel: LogLevelValues, + Port: PortValues, + }, + Networking: { + API: { + HTTPServer, + Method: MethodValues, + }, + APIV2: { + Internal: { + TestServer, + SupportedMethod: SupportedMethodValues, + }, + }, + }, + Utils: { + Converter, + }, }; _exports = exports; - globalThis.Utils.Converter = exports.Converter; - globalThis.Networking.API.HTTPServer = exports.HTTPServer; - globalThis.Networking.APIV2.Internal.TestServer = exports.TestServer; + globalThis.Utils.Converter = exports.Utils.Converter; + globalThis.Networking.API.HTTPServer = exports.Networking.API.HTTPServer; + globalThis.Networking.APIV2.Internal.TestServer = exports.Networking.APIV2.Internal.TestServer; return exports; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.d.ts index c6e403998..cdf83f36d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.d.ts @@ -50,16 +50,28 @@ export interface UUID extends SwiftHeapObject { uuidString(): string; } export type Exports = { - Greeter: { - new(name: string): Greeter; - } - Converter: { - new(): Converter; - } - UUID: { - } plainFunction(): string; - namespacedFunction(): string; + MyModule: { + Utils: { + namespacedFunction(): string; + }, + }, + Utils: { + Converters: { + Converter: { + new(): Converter; + } + }, + }, + __Swift: { + Foundation: { + Greeter: { + new(name: string): Greeter; + } + UUID: { + } + }, + }, } export type Imports = { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index 395b97f12..67670d204 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -294,27 +294,39 @@ export async function createInstantiator(options, swift) { globalThis.__Swift.Foundation = {}; } const exports = { - Greeter, - Converter, - UUID, plainFunction: function bjs_plainFunction() { instance.exports.bjs_plainFunction(); const ret = tmpRetString; tmpRetString = undefined; return ret; }, - namespacedFunction: function bjs_MyModule_Utils_namespacedFunction() { - instance.exports.bjs_MyModule_Utils_namespacedFunction(); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; + MyModule: { + Utils: { + namespacedFunction: function bjs_MyModule_Utils_namespacedFunction() { + instance.exports.bjs_MyModule_Utils_namespacedFunction(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + }, + }, + Utils: { + Converters: { + Converter, + }, + }, + __Swift: { + Foundation: { + Greeter, + UUID, + }, }, }; _exports = exports; - globalThis.__Swift.Foundation.Greeter = exports.Greeter; - globalThis.Utils.Converters.Converter = exports.Converter; - globalThis.__Swift.Foundation.UUID = exports.UUID; - globalThis.MyModule.Utils.namespacedFunction = exports.namespacedFunction; + globalThis.__Swift.Foundation.Greeter = exports.__Swift.Foundation.Greeter; + globalThis.Utils.Converters.Converter = exports.Utils.Converters.Converter; + globalThis.__Swift.Foundation.UUID = exports.__Swift.Foundation.UUID; + globalThis.MyModule.Utils.namespacedFunction = exports.MyModule.Utils.namespacedFunction; return exports; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.d.ts index 9622891a8..069c1628c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.d.ts @@ -56,6 +56,11 @@ export type Exports = { } Calculator: CalculatorObject APIResult: APIResultObject + Utils: { + String: { + uppercase(text: string): string; + }, + }, } export type Imports = { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index 14f114697..3e445992e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -305,15 +305,6 @@ export async function createInstantiator(options, swift) { } const exports = { MathUtils, - uppercase: function bjs_Utils_String_static_uppercase(text) { - const textBytes = textEncoder.encode(text); - const textId = swift.memory.retain(textBytes); - instance.exports.bjs_Utils_String_static_uppercase(textId, textBytes.length); - const ret = tmpRetString; - tmpRetString = undefined; - swift.memory.release(textId); - return ret; - }, Calculator: { ...CalculatorValues, square: function(value) { @@ -331,9 +322,22 @@ export async function createInstantiator(options, swift) { return ret; } }, + Utils: { + String: { + uppercase: function bjs_Utils_String_static_uppercase(text) { + const textBytes = textEncoder.encode(text); + const textId = swift.memory.retain(textBytes); + instance.exports.bjs_Utils_String_static_uppercase(textId, textBytes.length); + const ret = tmpRetString; + tmpRetString = undefined; + swift.memory.release(textId); + return ret; + }, + }, + }, }; _exports = exports; - globalThis.Utils.String.uppercase = exports.uppercase; + globalThis.Utils.String.uppercase = exports.Utils.String.uppercase; return exports; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.d.ts index 40e28718e..fea3c4b59 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.d.ts @@ -51,6 +51,15 @@ export type Exports = { optionalProperty: string | null; } PropertyEnum: PropertyEnumObject + PropertyNamespace: { + readonly namespaceConstant: string; + namespaceProperty: string; + Nested: { + readonly nestedConstant: string; + nestedDouble: number; + nestedProperty: number; + }, + }, } export type Imports = { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js index 3577228e8..09a2b0de9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js @@ -303,41 +303,12 @@ export async function createInstantiator(options, swift) { } } } - Object.defineProperty(globalThis.PropertyNamespace, 'namespaceProperty', { get: function() { - instance.exports.bjs_PropertyNamespace_static_namespaceProperty_get(); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - }, set: function(value) { - const valueBytes = textEncoder.encode(value); - const valueId = swift.memory.retain(valueBytes); - instance.exports.bjs_PropertyNamespace_static_namespaceProperty_set(valueId, valueBytes.length); - swift.memory.release(valueId); - } }); - Object.defineProperty(globalThis.PropertyNamespace, 'namespaceConstant', { get: function() { - instance.exports.bjs_PropertyNamespace_static_namespaceConstant_get(); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } }); - Object.defineProperty(globalThis.PropertyNamespace.Nested, 'nestedProperty', { get: function() { - const ret = instance.exports.bjs_PropertyNamespace_Nested_static_nestedProperty_get(); - return ret; - }, set: function(value) { - instance.exports.bjs_PropertyNamespace_Nested_static_nestedProperty_set(value); - } }); - Object.defineProperty(globalThis.PropertyNamespace.Nested, 'nestedConstant', { get: function() { - instance.exports.bjs_PropertyNamespace_Nested_static_nestedConstant_get(); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } }); - Object.defineProperty(globalThis.PropertyNamespace.Nested, 'nestedDouble', { get: function() { - const ret = instance.exports.bjs_PropertyNamespace_Nested_static_nestedDouble_get(); - return ret; - }, set: function(value) { - instance.exports.bjs_PropertyNamespace_Nested_static_nestedDouble_set(value); - } }); + if (typeof globalThis.PropertyNamespace === 'undefined') { + globalThis.PropertyNamespace = {}; + } + if (typeof globalThis.PropertyNamespace.Nested === 'undefined') { + globalThis.PropertyNamespace.Nested = {}; + } const exports = { PropertyClass, PropertyEnum: { @@ -371,8 +342,68 @@ export async function createInstantiator(options, swift) { swift.memory.release(valueId); } }, + PropertyNamespace: { + get namespaceProperty() { + instance.exports.bjs_PropertyNamespace_static_namespaceProperty_get(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + set namespaceProperty(value) { + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + instance.exports.bjs_PropertyNamespace_static_namespaceProperty_set(valueId, valueBytes.length); + swift.memory.release(valueId); + }, + get namespaceConstant() { + instance.exports.bjs_PropertyNamespace_static_namespaceConstant_get(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + Nested: { + get nestedProperty() { + const ret = instance.exports.bjs_PropertyNamespace_Nested_static_nestedProperty_get(); + return ret; + }, + set nestedProperty(value) { + instance.exports.bjs_PropertyNamespace_Nested_static_nestedProperty_set(value); + }, + get nestedConstant() { + instance.exports.bjs_PropertyNamespace_Nested_static_nestedConstant_get(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + get nestedDouble() { + const ret = instance.exports.bjs_PropertyNamespace_Nested_static_nestedDouble_get(); + return ret; + }, + set nestedDouble(value) { + instance.exports.bjs_PropertyNamespace_Nested_static_nestedDouble_set(value); + }, + }, + }, }; _exports = exports; + Object.defineProperty(globalThis.PropertyNamespace, 'namespaceProperty', { + get: () => exports.PropertyNamespace.namespaceProperty, + set: (value) => { exports.PropertyNamespace.namespaceProperty = value; } + }); + Object.defineProperty(globalThis.PropertyNamespace, 'namespaceConstant', { + get: () => exports.PropertyNamespace.namespaceConstant, + }); + Object.defineProperty(globalThis.PropertyNamespace.Nested, 'nestedProperty', { + get: () => exports.PropertyNamespace.Nested.nestedProperty, + set: (value) => { exports.PropertyNamespace.Nested.nestedProperty = value; } + }); + Object.defineProperty(globalThis.PropertyNamespace.Nested, 'nestedConstant', { + get: () => exports.PropertyNamespace.Nested.nestedConstant, + }); + Object.defineProperty(globalThis.PropertyNamespace.Nested, 'nestedDouble', { + get: () => exports.PropertyNamespace.Nested.nestedDouble, + set: (value) => { exports.PropertyNamespace.Nested.nestedDouble = value; } + }); return exports; }, } diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md index 2026c6a2b..427dd5971 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md @@ -21,10 +21,18 @@ import JavaScriptKit } ``` -This function will be accessible in JavaScript through its namespace hierarchy: +This function will be accessible in JavaScript through its namespace hierarchy in two ways: ```javascript -// Access the function through its namespace +// Recommended: Access via the exports object (supports multiple WASM instances) +const { createInstantiator } = await import('./path/to/bridge-js.js'); +const instantiator = await createInstantiator(options, swift); +const exports = instantiator.createExports(instance); + +const result = exports.MyModule.Utils.namespacedFunction(); +console.log(result); // "namespaced" + +// Alternative: Access via globalThis const result = globalThis.MyModule.Utils.namespacedFunction(); console.log(result); // "namespaced" ``` @@ -65,10 +73,14 @@ import JavaScriptKit } ``` -In JavaScript, this class is accessible through its namespace: +In JavaScript, this class is accessible through its namespace in two ways: ```javascript -// Create instances through namespaced constructors +// Recommended: Access via the exports object (supports multiple WASM instances) +const greeter = new exports.__Swift.Foundation.Greeter("World"); +console.log(greeter.greet()); // "Hello, World!" + +// Alternative: Access via globalThis and through its namespace const greeter = new globalThis.__Swift.Foundation.Greeter("World"); console.log(greeter.greet()); // "Hello, World!" ``` @@ -87,6 +99,16 @@ declare global { } } +export type Exports = { + __Swift: { + Foundation: { + Greeter: { + new(name: string): Greeter; + } + } + } +} + export interface Greeter extends SwiftHeapObject { greet(): string; } diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index f6e9cb85a..77123fec1 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -356,6 +356,22 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty, 1000); assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedDouble, 2.828); + assert.equal(exports.StaticPropertyNamespace.namespaceProperty, "modified namespace"); + assert.equal(exports.StaticPropertyNamespace.namespaceConstant, "constant"); + exports.StaticPropertyNamespace.namespaceProperty = "exports modified"; + assert.equal(exports.StaticPropertyNamespace.namespaceProperty, "exports modified"); + assert.equal(globalThis.StaticPropertyNamespace.namespaceProperty, "exports modified"); + + assert.equal(exports.StaticPropertyNamespace.NestedProperties.nestedProperty, 1000); + assert.equal(exports.StaticPropertyNamespace.NestedProperties.nestedConstant, "nested"); + assert.equal(exports.StaticPropertyNamespace.NestedProperties.nestedDouble, 2.828); + exports.StaticPropertyNamespace.NestedProperties.nestedProperty = 2000; + exports.StaticPropertyNamespace.NestedProperties.nestedDouble = 3.14; + assert.equal(exports.StaticPropertyNamespace.NestedProperties.nestedProperty, 2000); + assert.equal(exports.StaticPropertyNamespace.NestedProperties.nestedDouble, 3.14); + assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty, 2000); + assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedDouble, 3.14); + // Test class without @JS init constructor const calc = exports.createCalculator(); assert.equal(calc.square(5), 25); @@ -428,6 +444,10 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(globalThis.Networking.API.MethodValues.Post, 1); assert.equal(globalThis.Networking.API.MethodValues.Put, 2); assert.equal(globalThis.Networking.API.MethodValues.Delete, 3); + assert.equal(exports.Networking.API.Method.Get, 0); + assert.equal(exports.Networking.API.Method.Post, 1); + assert.equal(exports.Networking.API.Method.Put, 2); + assert.equal(exports.Networking.API.Method.Delete, 3); assert.equal(globalThis.Configuration.LogLevelValues.Debug, "debug"); assert.equal(globalThis.Configuration.LogLevelValues.Info, "info"); assert.equal(globalThis.Configuration.LogLevelValues.Warning, "warning"); @@ -435,8 +455,17 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(globalThis.Configuration.PortValues.Http, 80); assert.equal(globalThis.Configuration.PortValues.Https, 443); assert.equal(globalThis.Configuration.PortValues.Development, 3000); + assert.equal(exports.Configuration.LogLevel.Debug, "debug"); + assert.equal(exports.Configuration.LogLevel.Info, "info"); + assert.equal(exports.Configuration.LogLevel.Warning, "warning"); + assert.equal(exports.Configuration.LogLevel.Error, "error"); + assert.equal(exports.Configuration.Port.Http, 80); + assert.equal(exports.Configuration.Port.Https, 443); + assert.equal(exports.Configuration.Port.Development, 3000); assert.equal(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Get, 0); assert.equal(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Post, 1); + assert.equal(exports.Networking.APIV2.Internal.SupportedMethod.Get, 0); + assert.equal(exports.Networking.APIV2.Internal.SupportedMethod.Post, 1); assert.equal(exports.roundtripNetworkingAPIMethod(globalThis.Networking.API.MethodValues.Get), globalThis.Networking.API.MethodValues.Get); assert.equal(exports.roundtripConfigurationLogLevel(globalThis.Configuration.LogLevelValues.Debug), globalThis.Configuration.LogLevelValues.Debug); @@ -447,17 +476,17 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(exports.processConfigurationLogLevel(globalThis.Configuration.LogLevelValues.Error), globalThis.Configuration.PortValues.Development); assert.equal(exports.roundtripInternalSupportedMethod(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Get), globalThis.Networking.APIV2.Internal.SupportedMethodValues.Get); - const converter = new exports.Converter(); + const converter = new exports.Utils.Converter(); assert.equal(converter.toString(42), "42"); assert.equal(converter.toString(123), "123"); converter.release(); - const httpServer = new exports.HTTPServer(); + const httpServer = new exports.Networking.API.HTTPServer(); httpServer.call(globalThis.Networking.API.MethodValues.Get); httpServer.call(globalThis.Networking.API.MethodValues.Post); httpServer.release(); - const testServer = new exports.TestServer(); + const testServer = new exports.Networking.APIV2.Internal.TestServer(); testServer.call(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Get); testServer.call(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Post); testServer.release(); @@ -643,6 +672,8 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(StaticCalculatorValues.Scientific, exports.StaticCalculator.Scientific); assert.equal(StaticCalculatorValues.Basic, exports.StaticCalculator.Basic); assert.equal(globalThis.StaticUtils.Nested.roundtrip("hello world"), "hello world"); + assert.equal(exports.StaticUtils.Nested.roundtrip("test"), "test"); + assert.equal(exports.StaticUtils.Nested.roundtrip("exports api"), "exports api"); // Test default parameters assert.equal(exports.testStringDefault(), "Hello World"); @@ -1034,8 +1065,8 @@ function testProtocolSupport(exports) { getAPIResult() { return lastAPIResult; } }; - const successResult = { tag: exports.Result.Tag.Success, param0: "Operation completed" }; - const failureResult = { tag: exports.Result.Tag.Failure, param0: 500 }; + const successResult = { tag: exports.Utilities.Result.Tag.Success, param0: "Operation completed" }; + const failureResult = { tag: exports.Utilities.Result.Tag.Failure, param0: 500 }; const jsManager = new exports.DataProcessorManager(jsProcessor); From d7610c895bc0fa2b9fc32888dc4b48f5dc25d98b Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 19 Nov 2025 12:52:24 +0000 Subject: [PATCH 029/252] BridgeJS: Move extern decls in BridgeJSIntrinsics.swift to top-level --- .../JavaScriptKit/BridgeJSInstrincics.swift | 442 ++++++++---------- 1 file changed, 188 insertions(+), 254 deletions(-) diff --git a/Sources/JavaScriptKit/BridgeJSInstrincics.swift b/Sources/JavaScriptKit/BridgeJSInstrincics.swift index 0db1cd2ed..b0e5ec395 100644 --- a/Sources/JavaScriptKit/BridgeJSInstrincics.swift +++ b/Sources/JavaScriptKit/BridgeJSInstrincics.swift @@ -167,29 +167,13 @@ extension String { // MARK: ImportTS @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_make_js_string") - func _swift_js_make_js_string(_ ptr: UnsafePointer?, _ len: Int32) -> Int32 - #else - /// Creates a JavaScript string from UTF-8 data in WebAssembly memory - func _swift_js_make_js_string(_ ptr: UnsafePointer?, _ len: Int32) -> Int32 { - _onlyAvailableOnWasm() - } - #endif return self.withUTF8 { b in _swift_js_make_js_string(b.baseAddress.unsafelyUnwrapped, Int32(b.count)) } } @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ bytesCount: Int32) -> String { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_init_memory_with_result") - func _swift_js_init_memory_with_result(_ ptr: UnsafePointer?, _ len: Int32) - #else - /// Initializes WebAssembly memory with result data of JavaScript function call - func _swift_js_init_memory_with_result(_ ptr: UnsafePointer?, _ len: Int32) { - _onlyAvailableOnWasm() - } + #if !arch(wasm32) guard #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *) else { _onlyAvailableOnWasm() } #endif return String(unsafeUninitializedCapacity: Int(bytesCount)) { b in @@ -201,14 +185,7 @@ extension String { // MARK: ExportSwift @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ bytes: Int32, _ count: Int32) -> String { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_init_memory") - func _swift_js_init_memory(_ sourceId: Int32, _ ptr: UnsafeMutablePointer?) - #else - /// Initializes a part of WebAssembly memory with Uint8Array a JavaScript object - func _swift_js_init_memory(_ sourceId: Int32, _ ptr: UnsafeMutablePointer?) { - _onlyAvailableOnWasm() - } + #if !arch(wasm32) guard #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *) else { _onlyAvailableOnWasm() } #endif return String(unsafeUninitializedCapacity: Int(count)) { b in @@ -218,15 +195,6 @@ extension String { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_return_string") - func _swift_js_return_string(_ ptr: UnsafePointer?, _ len: Int32) - #else - /// Write a string to reserved string storage to be returned to JavaScript - func _swift_js_return_string(_ ptr: UnsafePointer?, _ len: Int32) { - _onlyAvailableOnWasm() - } - #endif return self.withUTF8 { ptr in _swift_js_return_string(ptr.baseAddress, Int32(ptr.count)) } @@ -250,16 +218,6 @@ extension JSObject { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Int32 { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_retain") - func _swift_js_retain(_ id: Int32) -> Int32 - #else - /// Retains a JavaScript object reference to ensure the object id - /// remains valid after the function returns - func _swift_js_retain(_ id: Int32) -> Int32 { - _onlyAvailableOnWasm() - } - #endif return _swift_js_retain(Int32(bitPattern: self.id)) } } @@ -475,6 +433,191 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo } #endif +// MARK: Wasm externs used by type lowering/lifting + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_make_js_string") +func _swift_js_make_js_string(_ ptr: UnsafePointer?, _ len: Int32) -> Int32 +#else +/// Creates a JavaScript string from UTF-8 data in WebAssembly memory +func _swift_js_make_js_string(_ ptr: UnsafePointer?, _ len: Int32) -> Int32 { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_init_memory_with_result") +func _swift_js_init_memory_with_result(_ ptr: UnsafePointer?, _ len: Int32) +#else +/// Initializes WebAssembly memory with result data of JavaScript function call +func _swift_js_init_memory_with_result(_ ptr: UnsafePointer?, _ len: Int32) { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_return_string") +func _swift_js_return_string(_ ptr: UnsafePointer?, _ len: Int32) +#else +/// Write a string to reserved string storage to be returned to JavaScript +func _swift_js_return_string(_ ptr: UnsafePointer?, _ len: Int32) { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_retain") +func _swift_js_retain(_ id: Int32) -> Int32 +#else +/// Retains a JavaScript object reference to ensure the object id +/// remains valid after the function returns +func _swift_js_retain(_ id: Int32) -> Int32 { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_return_optional_bool") +func _swift_js_return_optional_bool(_ isSome: Int32, _ value: Int32) +#else +/// Sets the optional bool for return value storage +func _swift_js_return_optional_bool(_ isSome: Int32, _ value: Int32) { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_get_optional_int_presence") +func _swift_js_get_optional_int_presence() -> Int32 +#else +func _swift_js_get_optional_int_presence() -> Int32 { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_get_optional_int_value") +func _swift_js_get_optional_int_value() -> Int32 +#else +func _swift_js_get_optional_int_value() -> Int32 { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_return_optional_int") +func _swift_js_return_optional_int(_ isSome: Int32, _ value: Int32) +#else +/// Sets the optional int for return value storage +func _swift_js_return_optional_int(_ isSome: Int32, _ value: Int32) { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_get_optional_string") +func _swift_js_get_optional_string() -> Int32 +#else +func _swift_js_get_optional_string() -> Int32 { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_return_optional_string") +func _swift_js_return_optional_string(_ isSome: Int32, _ ptr: UnsafePointer?, _ len: Int32) +#else +/// Write an optional string to reserved string storage to be returned to JavaScript +func _swift_js_return_optional_string(_ isSome: Int32, _ ptr: UnsafePointer?, _ len: Int32) { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_return_optional_object") +func _swift_js_return_optional_object(_ isSome: Int32, _ objectId: Int32) +#else +/// Write an optional JSObject to reserved storage to be returned to JavaScript +func _swift_js_return_optional_object(_ isSome: Int32, _ objectId: Int32) { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_get_optional_heap_object_pointer") +func _swift_js_get_optional_heap_object_pointer() -> UnsafeMutableRawPointer +#else +func _swift_js_get_optional_heap_object_pointer() -> UnsafeMutableRawPointer { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_return_optional_heap_object") +func _swift_js_return_optional_heap_object(_ isSome: Int32, _ pointer: UnsafeMutableRawPointer?) +#else +/// Write an optional Swift heap object to reserved storage to be returned to JavaScript +func _swift_js_return_optional_heap_object(_ isSome: Int32, _ pointer: UnsafeMutableRawPointer?) { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_get_optional_float_presence") +func _swift_js_get_optional_float_presence() -> Int32 +#else +func _swift_js_get_optional_float_presence() -> Int32 { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_get_optional_float_value") +func _swift_js_get_optional_float_value() -> Float32 +#else +func _swift_js_get_optional_float_value() -> Float32 { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_return_optional_float") +func _swift_js_return_optional_float(_ isSome: Int32, _ value: Float32) +#else +/// Sets the optional float for return value storage +func _swift_js_return_optional_float(_ isSome: Int32, _ value: Float32) { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_get_optional_double_presence") +func _swift_js_get_optional_double_presence() -> Int32 +#else +func _swift_js_get_optional_double_presence() -> Int32 { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_get_optional_double_value") +func _swift_js_get_optional_double_value() -> Float64 +#else +func _swift_js_get_optional_double_value() -> Float64 { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_return_optional_double") +func _swift_js_return_optional_double(_ isSome: Int32, _ value: Float64) +#else +/// Sets the optional double for return value storage +func _swift_js_return_optional_double(_ isSome: Int32, _ value: Float64) { + _onlyAvailableOnWasm() +} +#endif + extension Optional where Wrapped == Bool { // MARK: ImportTS @@ -516,16 +659,6 @@ extension Optional where Wrapped == Bool { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_return_optional_bool") - func _swift_js_return_optional_bool(_ isSome: Int32, _ value: Int32) - #else - /// Sets the optional bool for return value storage - func _swift_js_return_optional_bool(_ isSome: Int32, _ value: Int32) { - _onlyAvailableOnWasm() - } - #endif - switch consume self { case .none: _swift_js_return_optional_bool(0, 0) @@ -563,20 +696,6 @@ extension Optional where Wrapped == Int { } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Int? { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_int_presence") - func _swift_js_get_optional_int_presence() -> Int32 - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_int_value") - func _swift_js_get_optional_int_value() -> Int32 - #else - func _swift_js_get_optional_int_presence() -> Int32 { - _onlyAvailableOnWasm() - } - func _swift_js_get_optional_int_value() -> Int32 { - _onlyAvailableOnWasm() - } - #endif - let isSome = _swift_js_get_optional_int_presence() if isSome == 0 { return nil @@ -586,16 +705,6 @@ extension Optional where Wrapped == Int { } @_spi(BridgeJS) public func bridgeJSLowerReturn() -> Void { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_return_optional_int") - func _swift_js_return_optional_int(_ isSome: Int32, _ value: Int32) - #else - /// Sets the optional int for return value storage - func _swift_js_return_optional_int(_ isSome: Int32, _ value: Int32) { - _onlyAvailableOnWasm() - } - #endif - switch self { case .none: _swift_js_return_optional_int(0, 0) @@ -628,15 +737,6 @@ extension Optional where Wrapped == String { } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> String? { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_string") - func _swift_js_get_optional_string() -> Int32 - #else - func _swift_js_get_optional_string() -> Int32 { - _onlyAvailableOnWasm() - } - #endif - let length = _swift_js_get_optional_string() if length < 0 { return nil @@ -646,16 +746,6 @@ extension Optional where Wrapped == String { } @_spi(BridgeJS) public func bridgeJSLowerReturn() -> Void { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_return_optional_string") - func _swift_js_return_optional_string(_ isSome: Int32, _ ptr: UnsafePointer?, _ len: Int32) - #else - /// Write an optional string to reserved string storage to be returned to JavaScript - func _swift_js_return_optional_string(_ isSome: Int32, _ ptr: UnsafePointer?, _ len: Int32) { - _onlyAvailableOnWasm() - } - #endif - switch self { case .none: _swift_js_return_optional_string(0, nil, 0) @@ -689,16 +779,6 @@ extension Optional where Wrapped == JSObject { } @_spi(BridgeJS) public func bridgeJSLowerReturn() -> Void { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_return_optional_object") - func _swift_js_return_optional_object(_ isSome: Int32, _ objectId: Int32) - #else - /// Write an optional JSObject to reserved storage to be returned to JavaScript - func _swift_js_return_optional_object(_ isSome: Int32, _ objectId: Int32) { - _onlyAvailableOnWasm() - } - #endif - switch self { case .none: _swift_js_return_optional_object(0, 0) @@ -721,16 +801,6 @@ extension Optional where Wrapped: _BridgedSwiftProtocolWrapper { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_return_optional_object") - func _swift_js_return_optional_object(_ isSome: Int32, _ objectId: Int32) - #else - /// Write an optional protocol wrapper to reserved storage to be returned to JavaScript - func _swift_js_return_optional_object(_ isSome: Int32, _ objectId: Int32) { - _onlyAvailableOnWasm() - } - #endif - switch consume self { case .none: _swift_js_return_optional_object(0, 0) @@ -815,15 +885,6 @@ extension Optional where Wrapped: _BridgedSwiftHeapObject { } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_heap_object_pointer") - func _swift_js_get_optional_heap_object_pointer() -> UnsafeMutableRawPointer - #else - func _swift_js_get_optional_heap_object_pointer() -> UnsafeMutableRawPointer { - _onlyAvailableOnWasm() - } - #endif - let pointer = _swift_js_get_optional_heap_object_pointer() if pointer == UnsafeMutableRawPointer(bitPattern: 0) { return nil @@ -833,16 +894,6 @@ extension Optional where Wrapped: _BridgedSwiftHeapObject { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_return_optional_heap_object") - func _swift_js_return_optional_heap_object(_ isSome: Int32, _ pointer: UnsafeMutableRawPointer?) - #else - /// Write an optional Swift heap object to reserved storage to be returned to JavaScript - func _swift_js_return_optional_heap_object(_ isSome: Int32, _ pointer: UnsafeMutableRawPointer?) { - _onlyAvailableOnWasm() - } - #endif - switch consume self { case .none: _swift_js_return_optional_heap_object(0, nil) @@ -869,20 +920,6 @@ extension Optional where Wrapped == Float { } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Float? { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_float_presence") - func _swift_js_get_optional_float_presence() -> Int32 - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_float_value") - func _swift_js_get_optional_float_value() -> Float32 - #else - func _swift_js_get_optional_float_presence() -> Int32 { - _onlyAvailableOnWasm() - } - func _swift_js_get_optional_float_value() -> Float32 { - _onlyAvailableOnWasm() - } - #endif - let isSome = _swift_js_get_optional_float_presence() if isSome == 0 { return nil @@ -892,16 +929,6 @@ extension Optional where Wrapped == Float { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_return_optional_float") - func _swift_js_return_optional_float(_ isSome: Int32, _ value: Float32) - #else - /// Sets the optional float for return value storage - func _swift_js_return_optional_float(_ isSome: Int32, _ value: Float32) { - _onlyAvailableOnWasm() - } - #endif - switch consume self { case .none: _swift_js_return_optional_float(0, 0.0) @@ -929,20 +956,6 @@ extension Optional where Wrapped == Double { } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Double? { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_double_presence") - func _swift_js_get_optional_double_presence() -> Int32 - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_double_value") - func _swift_js_get_optional_double_value() -> Float64 - #else - func _swift_js_get_optional_double_presence() -> Int32 { - _onlyAvailableOnWasm() - } - func _swift_js_get_optional_double_value() -> Float64 { - _onlyAvailableOnWasm() - } - #endif - let isSome = _swift_js_get_optional_double_presence() if isSome == 0 { return nil @@ -952,16 +965,6 @@ extension Optional where Wrapped == Double { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_return_optional_double") - func _swift_js_return_optional_double(_ isSome: Int32, _ value: Float64) - #else - /// Sets the optional double for return value storage - func _swift_js_return_optional_double(_ isSome: Int32, _ value: Float64) { - _onlyAvailableOnWasm() - } - #endif - switch consume self { case .none: _swift_js_return_optional_double(0, 0.0) @@ -1001,16 +1004,6 @@ extension Optional where Wrapped: _BridgedSwiftCaseEnum { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_return_optional_int") - func _swift_js_return_optional_int(_ isSome: Int32, _ value: Int32) - #else - /// Sets the optional int for return value storage - func _swift_js_return_optional_int(_ isSome: Int32, _ value: Int32) { - _onlyAvailableOnWasm() - } - #endif - switch consume self { case .none: _swift_js_return_optional_int(0, 0) @@ -1062,15 +1055,6 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_string") - func _swift_js_get_optional_string() -> Int32 - #else - func _swift_js_get_optional_string() -> Int32 { - _onlyAvailableOnWasm() - } - #endif - let length = _swift_js_get_optional_string() if length < 0 { return nil @@ -1103,20 +1087,6 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_int_presence") - func _swift_js_get_optional_int_presence() -> Int32 - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_int_value") - func _swift_js_get_optional_int_value() -> Int32 - #else - func _swift_js_get_optional_int_presence() -> Int32 { - _onlyAvailableOnWasm() - } - func _swift_js_get_optional_int_value() -> Int32 { - _onlyAvailableOnWasm() - } - #endif - let isSome = _swift_js_get_optional_int_presence() if isSome == 0 { return nil @@ -1164,21 +1134,8 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres let optionalRawValue = Float?.bridgeJSLiftParameter(isSome, wrappedValue) return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_float_presence") - func _swift_js_get_optional_float_presence() -> Int32 - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_float_value") - func _swift_js_get_optional_float_value() -> Float32 - #else - func _swift_js_get_optional_float_presence() -> Int32 { - _onlyAvailableOnWasm() - } - func _swift_js_get_optional_float_value() -> Float32 { - _onlyAvailableOnWasm() - } - #endif + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { let isSome = _swift_js_get_optional_float_presence() if isSome == 0 { return nil @@ -1214,20 +1171,6 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_double_presence") - func _swift_js_get_optional_double_presence() -> Int32 - @_extern(wasm, module: "bjs", name: "swift_js_get_optional_double_value") - func _swift_js_get_optional_double_value() -> Float64 - #else - func _swift_js_get_optional_double_presence() -> Int32 { - _onlyAvailableOnWasm() - } - func _swift_js_get_optional_double_value() -> Float64 { - _onlyAvailableOnWasm() - } - #endif - let isSome = _swift_js_get_optional_double_presence() if isSome == 0 { return nil @@ -1274,15 +1217,6 @@ extension Optional where Wrapped: _BridgedSwiftAssociatedValueEnum { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "swift_js_push_tag") - func _swift_js_push_tag(_ tag: Int32) - #else - func _swift_js_push_tag(_ tag: Int32) { - _onlyAvailableOnWasm() - } - #endif - switch consume self { case .none: _swift_js_push_tag(-1) // Use -1 as sentinel for null From 734ec3c7e2301ac4ffe0830babaeec6c3b202ed8 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 22 Nov 2025 17:52:29 +0900 Subject: [PATCH 030/252] Documentation: Update Hello World tutorial prerequisites for Swift 6.2.1 --- .../Hello-World/Hello-World.tutorial | 30 ++++++++++++++----- .../hello-world-0-0-install-swiftly.txt | 9 ++++++ .../hello-world-0-1-install-toolchain.txt | 14 +++++++++ .../hello-world-0-1-swift-version.txt | 7 ----- .../Resources/hello-world-0-2-install-sdk.txt | 6 ++++ .../Resources/hello-world-0-2-select-sdk.txt | 9 ------ .../Resources/hello-world-0-3-verify-sdk.txt | 8 +++++ .../hello-world-1-2-add-dependency.txt | 2 +- .../hello-world-1-3-add-target-dependency.txt | 2 +- 9 files changed, 62 insertions(+), 25 deletions(-) create mode 100644 Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-0-install-swiftly.txt create mode 100644 Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-1-install-toolchain.txt delete mode 100644 Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-1-swift-version.txt create mode 100644 Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-2-install-sdk.txt delete mode 100644 Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-2-select-sdk.txt create mode 100644 Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-3-verify-sdk.txt diff --git a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Hello-World.tutorial b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Hello-World.tutorial index c054e3a48..d8fa16aad 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Hello-World.tutorial +++ b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Hello-World.tutorial @@ -6,19 +6,35 @@ } @Section(title: "Prerequisites") { - Visit the [installation guide](https://book.swiftwasm.org/getting-started/setup.html) to install the Swift SDK for WebAssembly before starting this tutorial. - This tutorial assumes you have the Swift SDK for WebAssembly installed. Please check your Swift installation. + This tutorial requires the OSS Swift Toolchain and Swift SDK for WebAssembly to be installed. Follow these steps to set up your development environment for building web applications with JavaScriptKit. @Steps { @Step { - Check your Swift toolchain version. If you see different - @Code(name: "Console", file: "hello-world-0-1-swift-version.txt") + Install `swiftly`, the Swift toolchain installer, per the [instructions on swift.org](https://www.swift.org/install/) for your platform. + + `swiftly` is the recommended way to install and manage OSS Swift toolchains. You cannot use toolchains bundled with Xcode for WebAssembly development. + @Code(name: "Console", file: "hello-world-0-0-install-swiftly.txt") + } + + @Step { + Install the latest Swift 6.2 development snapshot using `swiftly`: + + @Code(name: "Console", file: "hello-world-0-1-install-toolchain.txt") } + + @Step { + Install the Swift SDK for WASI that matches your toolchain version: + + Navigate to [the downloads page](https://www.swift.org/download/) and find the "Swift SDK for WASI" section. Find a version that **exactly** matches the toolchain version from step 2. + + @Code(name: "Console", file: "hello-world-0-2-install-sdk.txt") + } + @Step { - Select a Swift SDK for WebAssembly version that matches the version of the Swift toolchain you have installed. + Verify the Swift SDK installation and set up your environment: The following sections of this tutorial assume you have set the `SWIFT_SDK_ID` environment variable. - @Code(name: "Console", file: "hello-world-0-2-select-sdk.txt") + @Code(name: "Console", file: "hello-world-0-3-verify-sdk.txt") } } } @@ -98,4 +114,4 @@ } } } -} +} diff --git a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-0-install-swiftly.txt b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-0-install-swiftly.txt new file mode 100644 index 000000000..96abdfc4f --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-0-install-swiftly.txt @@ -0,0 +1,9 @@ +# Install swiftly per the instructions for your platform +# Visit https://www.swift.org/install/ for platform-specific instructions + +# Example for macOS: +$ curl -O https://download.swift.org/swiftly/darwin/swiftly.pkg && \ +installer -pkg swiftly.pkg -target CurrentUserHomeDirectory && \ +~/.swiftly/bin/swiftly init --quiet-shell-followup && \ +. "${SWIFTLY_HOME_DIR:-$HOME/.swiftly}/env.sh" && \ +hash -r diff --git a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-1-install-toolchain.txt b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-1-install-toolchain.txt new file mode 100644 index 000000000..8e2941014 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-1-install-toolchain.txt @@ -0,0 +1,14 @@ +# Install latest 6.2 development snapshot +$ swiftly install 6.2.1 +Installing Swift 6.2.1... +Swift 6.2.1 installed successfully. + +# Select the installed toolchain +$ swiftly use 6.2.1 +Using Swift 6.2.1 + +# Verify the toolchain is active +$ swift --version +Apple Swift version 6.2.1 (swift-6.2.1-RELEASE) +or +Swift version 6.2.1 (swift-6.2.1-RELEASE) diff --git a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-1-swift-version.txt b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-1-swift-version.txt deleted file mode 100644 index 5d5ad28df..000000000 --- a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-1-swift-version.txt +++ /dev/null @@ -1,7 +0,0 @@ -$ swift --version -Apple Swift version 6.0.3 (swift-6.0.3-RELEASE) -or -Swift version 6.0.3 (swift-6.0.3-RELEASE) - -$ swift sdk list -6.0.3-RELEASE-wasm32-unknown-wasi diff --git a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-2-install-sdk.txt b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-2-install-sdk.txt new file mode 100644 index 000000000..7127316d1 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-2-install-sdk.txt @@ -0,0 +1,6 @@ +# Navigate to https://www.swift.org/download/ and find the "Swift SDK for WASI" section +# Find a URL that exactly matches your toolchain version from the previous step +# Press "Copy install command" to get the installation command + +# Example installation command (replace with the exact command from swift.org): +$ swift sdk install https://download.swift.org/swift-6.2.1-release/wasm-sdk/swift-6.2.1-RELEASE/swift-6.2.1-RELEASE_wasm.artifactbundle.tar.gz --checksum 482b9f95462b87bedfafca94a092cf9ec4496671ca13b43745097122d20f18af diff --git a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-2-select-sdk.txt b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-2-select-sdk.txt deleted file mode 100644 index b5fc2c620..000000000 --- a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-2-select-sdk.txt +++ /dev/null @@ -1,9 +0,0 @@ -$ swift --version -Apple Swift version 6.0.3 (swift-6.0.3-RELEASE) -or -Swift version 6.0.3 (swift-6.0.3-RELEASE) - -$ swift sdk list -6.0.3-RELEASE-wasm32-unknown-wasi - -$ export SWIFT_SDK_ID=6.0.3-RELEASE-wasm32-unknown-wasi diff --git a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-3-verify-sdk.txt b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-3-verify-sdk.txt new file mode 100644 index 000000000..10d256ec1 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-0-3-verify-sdk.txt @@ -0,0 +1,8 @@ +# Verify the Swift SDK was installed +$ swift sdk list +swift-6.2.1-RELEASE_wasm +swift-6.2.1-RELEASE_wasm-embedded + +# In this tutorial, we use non-embedded SDK. +# Set the SDK ID as an environment variable for convenience +$ export SWIFT_SDK_ID=swift-6.2.1-RELEASE_wasm diff --git a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-2-add-dependency.txt b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-2-add-dependency.txt index 358629d0c..5c31a9349 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-2-add-dependency.txt +++ b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-2-add-dependency.txt @@ -5,5 +5,5 @@ Creating .gitignore Creating Sources/ Creating Sources/main.swift -$ swift package add-dependency https://github.com/swiftwasm/JavaScriptKit.git --branch main +$ swift package add-dependency https://github.com/swiftwasm/JavaScriptKit.git --from 0.36.0 Updating package manifest at Package.swift... done. diff --git a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-3-add-target-dependency.txt b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-3-add-target-dependency.txt index 317690412..1cee1ca37 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-3-add-target-dependency.txt +++ b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-3-add-target-dependency.txt @@ -5,7 +5,7 @@ Creating .gitignore Creating Sources/ Creating Sources/main.swift -$ swift package add-dependency https://github.com/swiftwasm/JavaScriptKit.git --branch main +$ swift package add-dependency https://github.com/swiftwasm/JavaScriptKit.git --from 0.36.0 Updating package manifest at Package.swift... done. $ swift package add-target-dependency --package JavaScriptKit JavaScriptKit Hello From 199fd749ddafe485bb333fcb11e9e69c9d359c44 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 22 Nov 2025 18:17:22 +0900 Subject: [PATCH 031/252] Documentation: Update estimated time --- .../Tutorials/Hello-World/Hello-World.tutorial | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Hello-World.tutorial b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Hello-World.tutorial index d8fa16aad..021960501 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Hello-World.tutorial +++ b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Hello-World.tutorial @@ -1,4 +1,4 @@ -@Tutorial(time: 5) { +@Tutorial(time: 30) { @Intro(title: "Quick Start: Hello World") { This tutorial walks you through creating a simple web application using JavaScriptKit. You'll learn how to set up a Swift package, add JavaScriptKit as a dependency, write code to manipulate the DOM, and build and run your web application. From c1829425e50729999d022dcc0f41a3b10865ae94 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 22 Nov 2025 18:18:41 +0900 Subject: [PATCH 032/252] Documentation: Leave `--from` version as `` in tutorial files --- .../Hello-World/Resources/hello-world-1-2-add-dependency.txt | 2 +- .../Resources/hello-world-1-3-add-target-dependency.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-2-add-dependency.txt b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-2-add-dependency.txt index 5c31a9349..f5b88a17a 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-2-add-dependency.txt +++ b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-2-add-dependency.txt @@ -5,5 +5,5 @@ Creating .gitignore Creating Sources/ Creating Sources/main.swift -$ swift package add-dependency https://github.com/swiftwasm/JavaScriptKit.git --from 0.36.0 +$ swift package add-dependency https://github.com/swiftwasm/JavaScriptKit.git --from Updating package manifest at Package.swift... done. diff --git a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-3-add-target-dependency.txt b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-3-add-target-dependency.txt index 1cee1ca37..02dda64cb 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-3-add-target-dependency.txt +++ b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-1-3-add-target-dependency.txt @@ -5,7 +5,7 @@ Creating .gitignore Creating Sources/ Creating Sources/main.swift -$ swift package add-dependency https://github.com/swiftwasm/JavaScriptKit.git --from 0.36.0 +$ swift package add-dependency https://github.com/swiftwasm/JavaScriptKit.git --from Updating package manifest at Package.swift... done. $ swift package add-target-dependency --package JavaScriptKit JavaScriptKit Hello From ad8e34a6222da01fae516d07607a962b49dc4e20 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 27 Nov 2025 03:18:59 +0000 Subject: [PATCH 033/252] BridgeJS: Move all `@_extern(wasm)` declarations to top-level When generating `@_extern(wasm)` function declarations in the BridgeJS plugin, we now need to ensure that they are placed at the top level of the module, rather than nested within other declarations because of the restrictions of the main branch Swift compiler. --- .../Sources/BridgeJSCore/ExportSwift.swift | 130 +++++++++++------- .../Sources/BridgeJSCore/ImportTS.swift | 8 +- 2 files changed, 84 insertions(+), 54 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 07b103b6f..b061716dc 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1497,12 +1497,12 @@ public class ExportSwift { } for signature in closureSignatures.sorted(by: { $0.mangleName < $1.mangleName }) { - decls.append(try closureCodegen.renderClosureHelper(signature: signature)) + decls.append(contentsOf: try closureCodegen.renderClosureHelper(signature: signature)) decls.append(try closureCodegen.renderClosureInvokeHandler(signature: signature)) } for proto in exportedProtocols { - decls.append(try renderProtocolWrapper(protocol: proto)) + decls.append(contentsOf: try renderProtocolWrapper(protocol: proto)) } for enumDef in exportedEnums { @@ -1547,6 +1547,7 @@ public class ExportSwift { var parameters: [Parameter] = [] var abiParameterSignatures: [(name: String, type: WasmCoreType)] = [] var abiReturnType: WasmCoreType? + var externDecls: [DeclSyntax] = [] let effects: Effects init(effects: Effects) { @@ -1839,7 +1840,7 @@ public class ExportSwift { return lines.isEmpty ? "" : lines.joined(separator: "\n") + "\n" } - func renderClosureHelper(signature: ClosureSignature) throws -> DeclSyntax { + func renderClosureHelper(signature: ClosureSignature) throws -> [DeclSyntax] { let mangledName = signature.mangleName let helperName = "_BJS_Closure_\(mangledName)" let boxClassName = "_BJS_ClosureBox_\(mangledName)" @@ -1899,25 +1900,31 @@ public class ExportSwift { invokeReturnType = "Void" } + let externName = "invoke_js_callback_\(signature.moduleName)_\(mangledName)" + let returnLifting: String if signature.returnType == .void { - returnLifting = "_invoke(\(invokeCallArgs.joined(separator: ", ")))" + returnLifting = "\(externName)(\(invokeCallArgs.joined(separator: ", ")))" } else if case .optional = signature.returnType { returnLifting = """ - _invoke(\(invokeCallArgs.joined(separator: ", "))) + \(externName)(\(invokeCallArgs.joined(separator: ", "))) return \(signature.returnType.swiftType).bridgeJSLiftReturnFromSideChannel() """ } else { returnLifting = """ - let resultId = _invoke(\(invokeCallArgs.joined(separator: ", "))) + let resultId = \(externName)(\(invokeCallArgs.joined(separator: ", "))) return \(signature.returnType.swiftType).bridgeJSLiftReturn(resultId) """ } - let externName = "invoke_js_callback_\(signature.moduleName)_\(mangledName)" let optionalLoweringCode = try generateOptionalParameterLowering(signature: signature) - return """ + let externDecl: DeclSyntax = """ + @_extern(wasm, module: "bjs", name: "\(raw: externName)") + fileprivate func \(raw: externName)(\(raw: invokeSignature)) -> \(raw: invokeReturnType) + """ + + let boxDecl: DeclSyntax = """ private final class \(raw: boxClassName): _BridgedSwiftClosureBox { let closure: \(raw: closureType) init(_ closure: @escaping \(raw: closureType)) { @@ -1935,16 +1942,15 @@ public class ExportSwift { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] \(raw: signature.parameters.indices.map { "param\($0)" }.joined(separator: ", ")) in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "\(raw: externName)") - func _invoke(\(raw: invokeSignature)) -> \(raw: invokeReturnType) \(raw: optionalLoweringCode)\(raw: returnLifting) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } """ + return [externDecl, boxDecl] } func renderClosureInvokeHandler(signature: ClosureSignature) throws -> DeclSyntax { @@ -2051,28 +2057,28 @@ public class ExportSwift { func renderAssociatedValueEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { let typeName = enumDef.swiftCallName return """ - extension \(raw: typeName): _BridgedSwiftAssociatedValueEnum { + extension \(raw: typeName): _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> \(raw: typeName) { switch caseId { \(raw: generateStackLiftSwitchCases(enumDef: enumDef).joined(separator: "\n")) default: fatalError("Unknown \(raw: typeName) case ID: \\(caseId)") } } - + // MARK: Protocol Export - + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { \(raw: generateLowerParameterSwitchCases(enumDef: enumDef).joined(separator: "\n")) } } - + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> \(raw: typeName) { return _bridgeJSLiftFromCaseId(caseId) } - + // MARK: ExportSwift - + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> \(raw: typeName) { return _bridgeJSLiftFromCaseId(caseId) } @@ -2460,7 +2466,7 @@ public class ExportSwift { } // Generate ConvertibleToJSValue extension - decls.append(renderConvertibleToJSValueExtension(klass: klass)) + decls.append(contentsOf: renderConvertibleToJSValueExtension(klass: klass)) return decls } @@ -2501,36 +2507,40 @@ public class ExportSwift { /// } /// } /// ``` - func renderConvertibleToJSValueExtension(klass: ExportedClass) -> DeclSyntax { + func renderConvertibleToJSValueExtension(klass: ExportedClass) -> [DeclSyntax] { let wrapFunctionName = "_bjs_\(klass.name)_wrap" let externFunctionName = "bjs_\(klass.name)_wrap" // If the class has an explicit access control, we need to add it to the extension declaration. let accessControl = klass.explicitAccessControl.map { "\($0) " } ?? "" - return """ + let extensionDecl: DeclSyntax = """ extension \(raw: klass.swiftCallName): ConvertibleToJSValue, _BridgedSwiftHeapObject { \(raw: accessControl)var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: externFunctionName)") - func \(raw: wrapFunctionName)(_: UnsafeMutableRawPointer) -> Int32 - #else - func \(raw: wrapFunctionName)(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: \(raw: wrapFunctionName)(Unmanaged.passRetained(self).toOpaque())))) } } """ + let externDecl: DeclSyntax = """ + #if arch(wasm32) + @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: externFunctionName)") + fileprivate func \(raw: wrapFunctionName)(_: UnsafeMutableRawPointer) -> Int32 + #else + fileprivate func \(raw: wrapFunctionName)(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + """ + return [extensionDecl, externDecl] } /// Creates a struct that wraps a JSObject and implements protocol methods /// by calling `@_extern(wasm)` functions that forward to JavaScript via JSObject ID - func renderProtocolWrapper(protocol proto: ExportedProtocol) throws -> DeclSyntax { + func renderProtocolWrapper(protocol proto: ExportedProtocol) throws -> [DeclSyntax] { let wrapperName = "Any\(proto.name)" let protocolName = proto.name var methodDecls: [DeclSyntax] = [] + var externDecls: [DeclSyntax] = [] for method in proto.methods { var swiftParams: [String] = [] @@ -2617,10 +2627,16 @@ public class ExportSwift { """ } } + + externDecls.append( + """ + @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: method.abiName)") + fileprivate func _extern_\(raw: method.name)(\(raw: externParams.joined(separator: ", ")))\(raw: externReturnType) + """ + ) + let methodImplementation: DeclSyntax = """ func \(raw: method.name)(\(raw: swiftParams.joined(separator: ", ")))\(raw: returnTypeStr) { - @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: method.abiName)") - func _extern_\(raw: method.name)(\(raw: externParams.joined(separator: ", ")))\(raw: externReturnType) \(raw: callCode) } """ @@ -2631,34 +2647,36 @@ public class ExportSwift { var propertyDecls: [DeclSyntax] = [] for property in proto.properties { - let propertyImpl = try renderProtocolProperty( + let (propertyImpl, propertyExternDecls) = try renderProtocolProperty( property: property, protocolName: protocolName, moduleName: moduleName ) propertyDecls.append(propertyImpl) + externDecls.append(contentsOf: propertyExternDecls) } let allDecls = (methodDecls + propertyDecls).map { $0.description }.joined(separator: "\n\n") - return """ + let structDecl: DeclSyntax = """ struct \(raw: wrapperName): \(raw: protocolName), _BridgedSwiftProtocolWrapper { let jsObject: JSObject - + \(raw: allDecls) - + static func bridgeJSLiftParameter(_ value: Int32) -> Self { return \(raw: wrapperName)(jsObject: JSObject(id: UInt32(bitPattern: value))) } } """ + return [structDecl] + externDecls } private func renderProtocolProperty( property: ExportedProtocolProperty, protocolName: String, moduleName: String - ) throws -> DeclSyntax { + ) throws -> (propertyDecl: DeclSyntax, externDecls: [DeclSyntax]) { let getterAbiName = ABINameGenerator.generateABIName( baseName: property.name, operation: "get", @@ -2679,33 +2697,39 @@ public class ExportSwift { // Optional case/raw enums use side-channel reading (Void return) getterReturnType = "" getterBody = """ - _extern_get(this: Int32(bitPattern: jsObject.id)) + \(getterAbiName)(this: Int32(bitPattern: jsObject.id)) return \(property.type.swiftType).bridgeJSLiftReturnFromSideChannel() """ } else if let abiType = liftingInfo.valueToLift { getterReturnType = " -> \(abiType.swiftType)" getterBody = """ - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = \(getterAbiName)(this: Int32(bitPattern: jsObject.id)) return \(property.type.swiftType).bridgeJSLiftReturn(ret) """ } else { getterReturnType = "" getterBody = """ - _extern_get(this: Int32(bitPattern: jsObject.id)) + \(getterAbiName)(this: Int32(bitPattern: jsObject.id)) return \(property.type.swiftType).bridgeJSLiftReturn() """ } + let getterExternDecl: DeclSyntax = """ + @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: getterAbiName)") + fileprivate func \(raw: getterAbiName)(this: Int32)\(raw: getterReturnType) + """ + if property.isReadonly { - return """ + return ( + """ var \(raw: property.name): \(raw: property.type.swiftType) { get { - @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: getterAbiName)") - func _extern_get(this: Int32)\(raw: getterReturnType) \(raw: getterBody) } } - """ + """, + [getterExternDecl] + ) } else { let loweringInfo = try property.type.loweringParameterInfo(context: .exportSwift) @@ -2720,28 +2744,32 @@ public class ExportSwift { let wrappedParam = loweringInfo.loweredParameters[1].name setterBody = """ let (\(isSomeParam), \(wrappedParam)) = newValue.bridgeJSLowerParameterWithPresence() - _extern_set(this: Int32(bitPattern: jsObject.id), \(isSomeParam): \(isSomeParam), \(wrappedParam): \(wrappedParam)) + \(setterAbiName)(this: Int32(bitPattern: jsObject.id), \(isSomeParam): \(isSomeParam), \(wrappedParam): \(wrappedParam)) """ } else { let paramName = loweringInfo.loweredParameters[0].name setterBody = - "_extern_set(this: Int32(bitPattern: jsObject.id), \(paramName): newValue.bridgeJSLowerParameter())" + "\(setterAbiName)(this: Int32(bitPattern: jsObject.id), \(paramName): newValue.bridgeJSLowerParameter())" } - return """ + let setterExternDecl: DeclSyntax = """ + @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: setterAbiName)") + fileprivate func \(raw: setterAbiName)(\(raw: setterParams)) + """ + + return ( + """ var \(raw: property.name): \(raw: property.type.swiftType) { get { - @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: getterAbiName)") - func _extern_get(this: Int32)\(raw: getterReturnType) \(raw: getterBody) } set { - @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: setterAbiName)") - func _extern_set(\(raw: setterParams)) \(raw: setterBody) } } - """ + """, + [getterExternDecl, setterExternDecl] + ) } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index af4a59c97..39a735f06 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -175,7 +175,6 @@ public struct ImportTS { ) ), body: CodeBlockSyntax { - self.renderImportDecl() body } ) @@ -200,7 +199,6 @@ public struct ImportTS { effectSpecifiers: ImportTS.buildFunctionEffect(throws: true, async: false) ), bodyBuilder: { - self.renderImportDecl() body } ) @@ -228,6 +226,7 @@ public struct ImportTS { } builder.call(returnType: function.returnType) try builder.liftReturnValue(returnType: function.returnType) + topLevelDecls.append(builder.renderImportDecl()) return [ builder.renderThunkDecl( name: function.name, @@ -249,6 +248,7 @@ public struct ImportTS { } builder.call(returnType: method.returnType) try builder.liftReturnValue(returnType: method.returnType) + topLevelDecls.append(builder.renderImportDecl()) return [ builder.renderThunkDecl( name: method.name, @@ -266,6 +266,7 @@ public struct ImportTS { } builder.call(returnType: .jsObject(name)) builder.assignThis(returnType: .jsObject(name)) + topLevelDecls.append(builder.renderImportDecl()) return [ builder.renderConstructorDecl(parameters: constructor.parameters) ] @@ -279,11 +280,11 @@ public struct ImportTS { try builder.lowerParameter(param: Parameter(label: nil, name: "self", type: .jsObject(name))) builder.call(returnType: property.type) try builder.liftReturnValue(returnType: property.type) + topLevelDecls.append(builder.renderImportDecl()) return AccessorDeclSyntax( accessorSpecifier: .keyword(.get), effectSpecifiers: Self.buildAccessorEffect(throws: true, async: false), body: CodeBlockSyntax { - builder.renderImportDecl() builder.body } ) @@ -298,6 +299,7 @@ public struct ImportTS { try builder.lowerParameter(param: Parameter(label: nil, name: "self", type: .jsObject(name))) try builder.lowerParameter(param: newValue) builder.call(returnType: .void) + topLevelDecls.append(builder.renderImportDecl()) return builder.renderThunkDecl( name: "set\(property.name.capitalizedFirstLetter)", parameters: [newValue], From c4c3ad8a490796decb9853c992a6670ed1853c68 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 27 Nov 2025 03:29:03 +0000 Subject: [PATCH 034/252] BridgeJS: Update snapshot tests --- .../ExportSwiftTests/DefaultParameters.swift | 53 ++-- .../ExportSwiftTests/EnumNamespace.swift | 53 ++-- .../ExportSwiftTests/Namespaces.swift | 53 ++-- .../ExportSwiftTests/Optionals.swift | 36 +-- .../ExportSwiftTests/PropertyTypes.swift | 19 +- .../ExportSwiftTests/Protocol.swift | 243 ++++++++++-------- .../ExportSwiftTests/StaticFunctions.swift | 19 +- .../ExportSwiftTests/StaticProperties.swift | 19 +- .../ExportSwiftTests/SwiftClass.swift | 53 ++-- .../ExportSwiftTests/SwiftClosure.swift | 153 ++++++----- .../ImportTSTests/ArrayParameter.swift | 51 ++-- .../__Snapshots__/ImportTSTests/Async.swift | 119 +++++---- .../ImportTSTests/Interface.swift | 51 ++-- .../ImportTSTests/InvalidPropertyNames.swift | 187 +++++++------- .../ImportTSTests/MultipleImportedTypes.swift | 238 +++++++++-------- .../ImportTSTests/PrimitiveParameters.swift | 17 +- .../ImportTSTests/PrimitiveReturn.swift | 34 +-- .../ImportTSTests/StringParameter.swift | 34 +-- .../ImportTSTests/StringReturn.swift | 17 +- .../ImportTSTests/TS2SkeletonLike.swift | 119 +++++---- .../ImportTSTests/TypeAlias.swift | 17 +- .../ImportTSTests/TypeScriptClass.swift | 102 ++++---- .../VoidParameterVoidReturn.swift | 17 +- 23 files changed, 915 insertions(+), 789 deletions(-) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index 675f7bfb0..525782c4f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -206,18 +206,19 @@ public func _bjs_DefaultGreeter_deinit(pointer: UnsafeMutableRawPointer) { extension DefaultGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_DefaultGreeter_wrap") - func _bjs_DefaultGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_DefaultGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_DefaultGreeter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_DefaultGreeter_wrap") +fileprivate func _bjs_DefaultGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_DefaultGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_EmptyGreeter_init") @_cdecl("bjs_EmptyGreeter_init") public func _bjs_EmptyGreeter_init() -> UnsafeMutableRawPointer { @@ -237,18 +238,19 @@ public func _bjs_EmptyGreeter_deinit(pointer: UnsafeMutableRawPointer) { extension EmptyGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_EmptyGreeter_wrap") - func _bjs_EmptyGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_EmptyGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_EmptyGreeter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_EmptyGreeter_wrap") +fileprivate func _bjs_EmptyGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_EmptyGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_ConstructorDefaults_init") @_cdecl("bjs_ConstructorDefaults_init") public func _bjs_ConstructorDefaults_init(nameBytes: Int32, nameLength: Int32, count: Int32, enabled: Int32, status: Int32, tagIsSome: Int32, tagBytes: Int32, tagLength: Int32) -> UnsafeMutableRawPointer { @@ -384,14 +386,15 @@ public func _bjs_ConstructorDefaults_deinit(pointer: UnsafeMutableRawPointer) { extension ConstructorDefaults: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_ConstructorDefaults_wrap") - func _bjs_ConstructorDefaults_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_ConstructorDefaults_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_ConstructorDefaults_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_ConstructorDefaults_wrap") +fileprivate func _bjs_ConstructorDefaults_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ConstructorDefaults_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift index ca201f3d9..cf4977501 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift @@ -120,18 +120,19 @@ public func _bjs_Converter_deinit(pointer: UnsafeMutableRawPointer) { extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") - func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_Converter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") +fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_HTTPServer_init") @_cdecl("bjs_HTTPServer_init") public func _bjs_HTTPServer_init() -> UnsafeMutableRawPointer { @@ -161,18 +162,19 @@ public func _bjs_HTTPServer_deinit(pointer: UnsafeMutableRawPointer) { extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_HTTPServer_wrap") - func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_HTTPServer_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_HTTPServer_wrap") +fileprivate func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_TestServer_init") @_cdecl("bjs_TestServer_init") public func _bjs_TestServer_init() -> UnsafeMutableRawPointer { @@ -202,14 +204,15 @@ public func _bjs_TestServer_deinit(pointer: UnsafeMutableRawPointer) { extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_TestServer_wrap") - func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_TestServer_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_TestServer_wrap") +fileprivate func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift index f868fa111..3e7714464 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift @@ -58,18 +58,19 @@ public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") - func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_Greeter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") +fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_Converter_init") @_cdecl("bjs_Converter_init") public func _bjs_Converter_init() -> UnsafeMutableRawPointer { @@ -100,18 +101,19 @@ public func _bjs_Converter_deinit(pointer: UnsafeMutableRawPointer) { extension Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") - func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_Converter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") +fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_UUID_uuidString") @_cdecl("bjs_UUID_uuidString") public func _bjs_UUID_uuidString(_self: UnsafeMutableRawPointer) -> Void { @@ -131,14 +133,15 @@ public func _bjs_UUID_deinit(pointer: UnsafeMutableRawPointer) { extension UUID: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_UUID_wrap") - func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_UUID_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_UUID_wrap") +fileprivate func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift index 9cd9e1f69..0834943eb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift @@ -232,18 +232,19 @@ public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") - func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_Greeter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") +fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_OptionalPropertyHolder_init") @_cdecl("bjs_OptionalPropertyHolder_init") public func _bjs_OptionalPropertyHolder_init() -> UnsafeMutableRawPointer { @@ -326,14 +327,15 @@ public func _bjs_OptionalPropertyHolder_deinit(pointer: UnsafeMutableRawPointer) extension OptionalPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_OptionalPropertyHolder_wrap") - func _bjs_OptionalPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_OptionalPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_OptionalPropertyHolder_wrap") +fileprivate func _bjs_OptionalPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_OptionalPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift index 822e58467..f622e3ac6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift @@ -334,14 +334,15 @@ public func _bjs_PropertyHolder_deinit(pointer: UnsafeMutableRawPointer) { extension PropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_PropertyHolder_wrap") - func _bjs_PropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_PropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_PropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_PropertyHolder_wrap") +fileprivate func _bjs_PropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index d68ef81d0..ef6160d28 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -10,235 +10,169 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto let jsObject: JSObject func onSomethingHappened() { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onSomethingHappened") - func _extern_onSomethingHappened(this: Int32) _extern_onSomethingHappened(this: Int32(bitPattern: jsObject.id)) } func onValueChanged(_ value: String) { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onValueChanged") - func _extern_onValueChanged(this: Int32, value: Int32) _extern_onValueChanged(this: Int32(bitPattern: jsObject.id), value: value.bridgeJSLowerParameter()) } func onCountUpdated(count: Int) -> Bool { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onCountUpdated") - func _extern_onCountUpdated(this: Int32, count: Int32) -> Int32 let ret = _extern_onCountUpdated(this: Int32(bitPattern: jsObject.id), count: count.bridgeJSLowerParameter()) return Bool.bridgeJSLiftReturn(ret) } func onLabelUpdated(_ prefix: String, _ suffix: String) { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onLabelUpdated") - func _extern_onLabelUpdated(this: Int32, prefix: Int32, suffix: Int32) _extern_onLabelUpdated(this: Int32(bitPattern: jsObject.id), prefix: prefix.bridgeJSLowerParameter(), suffix: suffix.bridgeJSLowerParameter()) } func isCountEven() -> Bool { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_isCountEven") - func _extern_isCountEven(this: Int32) -> Int32 let ret = _extern_isCountEven(this: Int32(bitPattern: jsObject.id)) return Bool.bridgeJSLiftReturn(ret) } func onHelperUpdated(_ helper: Helper) { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onHelperUpdated") - func _extern_onHelperUpdated(this: Int32, helper: UnsafeMutableRawPointer) _extern_onHelperUpdated(this: Int32(bitPattern: jsObject.id), helper: helper.bridgeJSLowerParameter()) } func createHelper() -> Helper { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createHelper") - func _extern_createHelper(this: Int32) -> UnsafeMutableRawPointer let ret = _extern_createHelper(this: Int32(bitPattern: jsObject.id)) return Helper.bridgeJSLiftReturn(ret) } func onOptionalHelperUpdated(_ helper: Optional) { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onOptionalHelperUpdated") - func _extern_onOptionalHelperUpdated(this: Int32, helperIsSome: Int32, helperPointer: UnsafeMutableRawPointer) let (helperIsSome, helperPointer) = helper.bridgeJSLowerParameterWithPresence() _extern_onOptionalHelperUpdated(this: Int32(bitPattern: jsObject.id), helperIsSome: helperIsSome, helperPointer: helperPointer) } func createOptionalHelper() -> Optional { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createOptionalHelper") - func _extern_createOptionalHelper(this: Int32) -> UnsafeMutableRawPointer let ret = _extern_createOptionalHelper(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturn(ret) } func createEnum() -> ExampleEnum { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createEnum") - func _extern_createEnum(this: Int32) -> Int32 let ret = _extern_createEnum(this: Int32(bitPattern: jsObject.id)) return ExampleEnum.bridgeJSLiftReturn(ret) } func handleResult(_ result: Result) { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_handleResult") - func _extern_handleResult(this: Int32, result: Int32) _extern_handleResult(this: Int32(bitPattern: jsObject.id), result: result.bridgeJSLowerParameter()) } func getResult() -> Result { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_getResult") - func _extern_getResult(this: Int32) -> Int32 let ret = _extern_getResult(this: Int32(bitPattern: jsObject.id)) return Result.bridgeJSLiftReturn(ret) } var eventCount: Int { get { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_MyViewControllerDelegate_eventCount_get(this: Int32(bitPattern: jsObject.id)) return Int.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_set") - func _extern_set(this: Int32, value: Int32) - _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + bjs_MyViewControllerDelegate_eventCount_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) } } var delegateName: String { get { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_delegateName_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_MyViewControllerDelegate_delegateName_get(this: Int32(bitPattern: jsObject.id)) return String.bridgeJSLiftReturn(ret) } } var optionalName: Optional { get { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_get") - func _extern_get(this: Int32) - _extern_get(this: Int32(bitPattern: jsObject.id)) + bjs_MyViewControllerDelegate_optionalName_get(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_set") - func _extern_set(this: Int32, isSome: Int32, value: Int32) let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + bjs_MyViewControllerDelegate_optionalName_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) } } var optionalRawEnum: Optional { get { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalRawEnum_get") - func _extern_get(this: Int32) - _extern_get(this: Int32(bitPattern: jsObject.id)) + bjs_MyViewControllerDelegate_optionalRawEnum_get(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalRawEnum_set") - func _extern_set(this: Int32, isSome: Int32, value: Int32) let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + bjs_MyViewControllerDelegate_optionalRawEnum_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) } } var rawStringEnum: ExampleEnum { get { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_rawStringEnum_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_MyViewControllerDelegate_rawStringEnum_get(this: Int32(bitPattern: jsObject.id)) return ExampleEnum.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_rawStringEnum_set") - func _extern_set(this: Int32, value: Int32) - _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + bjs_MyViewControllerDelegate_rawStringEnum_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) } } var result: Result { get { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_MyViewControllerDelegate_result_get(this: Int32(bitPattern: jsObject.id)) return Result.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_set") - func _extern_set(this: Int32, caseId: Int32) - _extern_set(this: Int32(bitPattern: jsObject.id), caseId: newValue.bridgeJSLowerParameter()) + bjs_MyViewControllerDelegate_result_set(this: Int32(bitPattern: jsObject.id), caseId: newValue.bridgeJSLowerParameter()) } } var optionalResult: Optional { get { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalResult_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_MyViewControllerDelegate_optionalResult_get(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalResult_set") - func _extern_set(this: Int32, isSome: Int32, caseId: Int32) let (isSome, caseId) = newValue.bridgeJSLowerParameterWithPresence() - _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, caseId: caseId) + bjs_MyViewControllerDelegate_optionalResult_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, caseId: caseId) } } var direction: Direction { get { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_direction_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_MyViewControllerDelegate_direction_get(this: Int32(bitPattern: jsObject.id)) return Direction.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_direction_set") - func _extern_set(this: Int32, value: Int32) - _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + bjs_MyViewControllerDelegate_direction_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) } } var directionOptional: Optional { get { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_directionOptional_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_MyViewControllerDelegate_directionOptional_get(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_directionOptional_set") - func _extern_set(this: Int32, isSome: Int32, value: Int32) let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + bjs_MyViewControllerDelegate_directionOptional_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) } } var priority: Priority { get { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priority_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_MyViewControllerDelegate_priority_get(this: Int32(bitPattern: jsObject.id)) return Priority.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priority_set") - func _extern_set(this: Int32, value: Int32) - _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + bjs_MyViewControllerDelegate_priority_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) } } var priorityOptional: Optional { get { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priorityOptional_get") - func _extern_get(this: Int32) - _extern_get(this: Int32(bitPattern: jsObject.id)) + bjs_MyViewControllerDelegate_priorityOptional_get(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priorityOptional_set") - func _extern_set(this: Int32, isSome: Int32, value: Int32) let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + bjs_MyViewControllerDelegate_priorityOptional_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) } } @@ -247,6 +181,105 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto } } +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onSomethingHappened") +fileprivate func _extern_onSomethingHappened(this: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onValueChanged") +fileprivate func _extern_onValueChanged(this: Int32, value: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onCountUpdated") +fileprivate func _extern_onCountUpdated(this: Int32, count: Int32) -> Int32 + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onLabelUpdated") +fileprivate func _extern_onLabelUpdated(this: Int32, prefix: Int32, suffix: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_isCountEven") +fileprivate func _extern_isCountEven(this: Int32) -> Int32 + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onHelperUpdated") +fileprivate func _extern_onHelperUpdated(this: Int32, helper: UnsafeMutableRawPointer) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createHelper") +fileprivate func _extern_createHelper(this: Int32) -> UnsafeMutableRawPointer + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onOptionalHelperUpdated") +fileprivate func _extern_onOptionalHelperUpdated(this: Int32, helperIsSome: Int32, helperPointer: UnsafeMutableRawPointer) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createOptionalHelper") +fileprivate func _extern_createOptionalHelper(this: Int32) -> UnsafeMutableRawPointer + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createEnum") +fileprivate func _extern_createEnum(this: Int32) -> Int32 + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_handleResult") +fileprivate func _extern_handleResult(this: Int32, result: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_getResult") +fileprivate func _extern_getResult(this: Int32) -> Int32 + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_get") +fileprivate func bjs_MyViewControllerDelegate_eventCount_get(this: Int32) -> Int32 + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_set") +fileprivate func bjs_MyViewControllerDelegate_eventCount_set(this: Int32, value: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_delegateName_get") +fileprivate func bjs_MyViewControllerDelegate_delegateName_get(this: Int32) -> Int32 + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_get") +fileprivate func bjs_MyViewControllerDelegate_optionalName_get(this: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_set") +fileprivate func bjs_MyViewControllerDelegate_optionalName_set(this: Int32, isSome: Int32, value: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalRawEnum_get") +fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_get(this: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalRawEnum_set") +fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_set(this: Int32, isSome: Int32, value: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_rawStringEnum_get") +fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_get(this: Int32) -> Int32 + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_rawStringEnum_set") +fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_set(this: Int32, value: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_get") +fileprivate func bjs_MyViewControllerDelegate_result_get(this: Int32) -> Int32 + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_set") +fileprivate func bjs_MyViewControllerDelegate_result_set(this: Int32, caseId: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalResult_get") +fileprivate func bjs_MyViewControllerDelegate_optionalResult_get(this: Int32) -> Int32 + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalResult_set") +fileprivate func bjs_MyViewControllerDelegate_optionalResult_set(this: Int32, isSome: Int32, caseId: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_direction_get") +fileprivate func bjs_MyViewControllerDelegate_direction_get(this: Int32) -> Int32 + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_direction_set") +fileprivate func bjs_MyViewControllerDelegate_direction_set(this: Int32, value: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_directionOptional_get") +fileprivate func bjs_MyViewControllerDelegate_directionOptional_get(this: Int32) -> Int32 + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_directionOptional_set") +fileprivate func bjs_MyViewControllerDelegate_directionOptional_set(this: Int32, isSome: Int32, value: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priority_get") +fileprivate func bjs_MyViewControllerDelegate_priority_get(this: Int32) -> Int32 + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priority_set") +fileprivate func bjs_MyViewControllerDelegate_priority_set(this: Int32, value: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priorityOptional_get") +fileprivate func bjs_MyViewControllerDelegate_priorityOptional_get(this: Int32) + +@_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priorityOptional_set") +fileprivate func bjs_MyViewControllerDelegate_priorityOptional_set(this: Int32, isSome: Int32, value: Int32) + extension Direction: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { return bridgeJSRawValue @@ -399,18 +432,19 @@ public func _bjs_Helper_deinit(pointer: UnsafeMutableRawPointer) { extension Helper: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_Helper_wrap") - func _bjs_Helper_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_Helper_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_Helper_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Helper_wrap") +fileprivate func _bjs_Helper_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Helper_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_MyViewController_init") @_cdecl("bjs_MyViewController_init") public func _bjs_MyViewController_init(delegate: Int32) -> UnsafeMutableRawPointer { @@ -536,14 +570,15 @@ public func _bjs_MyViewController_deinit(pointer: UnsafeMutableRawPointer) { extension MyViewController: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_MyViewController_wrap") - func _bjs_MyViewController_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_MyViewController_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_MyViewController_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_MyViewController_wrap") +fileprivate func _bjs_MyViewController_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_MyViewController_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift index 7aa91b915..81ea282fe 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift @@ -179,14 +179,15 @@ public func _bjs_MathUtils_deinit(pointer: UnsafeMutableRawPointer) { extension MathUtils: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_MathUtils_wrap") - func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_MathUtils_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_MathUtils_wrap") +fileprivate func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift index 72d561a00..e34f26f8c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift @@ -325,14 +325,15 @@ public func _bjs_PropertyClass_deinit(pointer: UnsafeMutableRawPointer) { extension PropertyClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_PropertyClass_wrap") - func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_PropertyClass_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_PropertyClass_wrap") +fileprivate func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift index 81f5ccf47..097f73a97 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift @@ -77,18 +77,19 @@ public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") - func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_Greeter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") +fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_PublicGreeter_deinit") @_cdecl("bjs_PublicGreeter_deinit") public func _bjs_PublicGreeter_deinit(pointer: UnsafeMutableRawPointer) { @@ -97,18 +98,19 @@ public func _bjs_PublicGreeter_deinit(pointer: UnsafeMutableRawPointer) { extension PublicGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { public var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_PublicGreeter_wrap") - func _bjs_PublicGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_PublicGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_PublicGreeter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_PublicGreeter_wrap") +fileprivate func _bjs_PublicGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PublicGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_PackageGreeter_deinit") @_cdecl("bjs_PackageGreeter_deinit") public func _bjs_PackageGreeter_deinit(pointer: UnsafeMutableRawPointer) { @@ -117,14 +119,15 @@ public func _bjs_PackageGreeter_deinit(pointer: UnsafeMutableRawPointer) { extension PackageGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { package var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_PackageGreeter_wrap") - func _bjs_PackageGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_PackageGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_PackageGreeter_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_PackageGreeter_wrap") +fileprivate func _bjs_PackageGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PackageGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift index 4b1b404fc..c036a7973 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift @@ -6,6 +6,9 @@ @_spi(BridgeJS) import JavaScriptKit +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si") +fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_10TestModule10HttpStatusO_Si: _BridgedSwiftClosureBox { let closure: (HttpStatus) -> Int init(_ closure: @escaping (HttpStatus) -> Int) { @@ -23,13 +26,11 @@ private enum _BJS_Closure_10TestModule10HttpStatusO_Si { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return Int.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -46,6 +47,9 @@ public func _invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si(boxPtr #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule5ThemeO_SS") +fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_SS(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_10TestModule5ThemeO_SS: _BridgedSwiftClosureBox { let closure: (Theme) -> String init(_ closure: @escaping (Theme) -> String) { @@ -63,13 +67,11 @@ private enum _BJS_Closure_10TestModule5ThemeO_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule5ThemeO_SS") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_TestModule_10TestModule5ThemeO_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -86,6 +88,9 @@ public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_SS(boxPtr: Unsa #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule5ThemeO_Sb") +fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_Sb(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_10TestModule5ThemeO_Sb: _BridgedSwiftClosureBox { let closure: (Theme) -> Bool init(_ closure: @escaping (Theme) -> Bool) { @@ -103,13 +108,11 @@ private enum _BJS_Closure_10TestModule5ThemeO_Sb { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule5ThemeO_Sb") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_TestModule_10TestModule5ThemeO_Sb(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return Bool.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -126,6 +129,9 @@ public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb(boxPtr: Unsa #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule6PersonC_SS") +fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_SS(_: Int32, _: UnsafeMutableRawPointer) -> Int32 + private final class _BJS_ClosureBox_10TestModule6PersonC_SS: _BridgedSwiftClosureBox { let closure: (Person) -> String init(_ closure: @escaping (Person) -> String) { @@ -143,13 +149,11 @@ private enum _BJS_Closure_10TestModule6PersonC_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule6PersonC_SS") - func _invoke(_: Int32, _: UnsafeMutableRawPointer) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_TestModule_10TestModule6PersonC_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -166,6 +170,9 @@ public func _invoke_swift_closure_TestModule_10TestModule6PersonC_SS(boxPtr: Uns #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9APIResultO_SS") +fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_SS(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_10TestModule9APIResultO_SS: _BridgedSwiftClosureBox { let closure: (APIResult) -> String init(_ closure: @escaping (APIResult) -> String) { @@ -183,13 +190,11 @@ private enum _BJS_Closure_10TestModule9APIResultO_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9APIResultO_SS") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_TestModule_10TestModule9APIResultO_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -206,6 +211,9 @@ public func _invoke_swift_closure_TestModule_10TestModule9APIResultO_SS(boxPtr: #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9DirectionO_SS") +fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_SS(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_10TestModule9DirectionO_SS: _BridgedSwiftClosureBox { let closure: (Direction) -> String init(_ closure: @escaping (Direction) -> String) { @@ -223,13 +231,11 @@ private enum _BJS_Closure_10TestModule9DirectionO_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9DirectionO_SS") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_TestModule_10TestModule9DirectionO_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -246,6 +252,9 @@ public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_SS(boxPtr: #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9DirectionO_Sb") +fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_Sb(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_10TestModule9DirectionO_Sb: _BridgedSwiftClosureBox { let closure: (Direction) -> Bool init(_ closure: @escaping (Direction) -> Bool) { @@ -263,13 +272,11 @@ private enum _BJS_Closure_10TestModule9DirectionO_Sb { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9DirectionO_Sb") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_TestModule_10TestModule9DirectionO_Sb(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return Bool.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -286,6 +293,9 @@ public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb(boxPtr: #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSS_SS") +fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_10TestModuleSS_SS: _BridgedSwiftClosureBox { let closure: (String) -> String init(_ closure: @escaping (String) -> String) { @@ -303,13 +313,11 @@ private enum _BJS_Closure_10TestModuleSS_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSS_SS") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_TestModule_10TestModuleSS_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -326,6 +334,9 @@ public func _invoke_swift_closure_TestModule_10TestModuleSS_SS(boxPtr: UnsafeMut #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS") +fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS(_: Int32, _: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_10TestModuleSq5ThemeO_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String init(_ closure: @escaping (Optional) -> String) { @@ -343,14 +354,12 @@ private enum _BJS_Closure_10TestModuleSq5ThemeO_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) +let resultId = invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -367,6 +376,9 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(boxPtr: Un #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") +fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_: Int32, _: Int32, _: UnsafeMutableRawPointer, _: Int32, _: Int32, _: Int32, _: Float64) -> Int32 + private final class _BJS_ClosureBox_10TestModuleSq6PersonCSqSSSqSd_SS: _BridgedSwiftClosureBox { let closure: (Optional, Optional, Optional) -> String init(_ closure: @escaping (Optional, Optional, Optional) -> String) { @@ -384,16 +396,14 @@ private enum _BJS_Closure_10TestModuleSq6PersonCSqSSSqSd_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0, param1, param2 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") - func _invoke(_: Int32, _: Int32, _: UnsafeMutableRawPointer, _: Int32, _: Int32, _: Int32, _: Float64) -> Int32 let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() let (param1IsSome, param1Value) = param1.bridgeJSLowerParameterWithPresence() let (param2IsSome, param2Value) = param2.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value, param1IsSome, param1Value, param2IsSome, param2Value) +let resultId = invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value, param1IsSome, param1Value, param2IsSome, param2Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -410,6 +420,9 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(b #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS") +fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS(_: Int32, _: Int32, _: UnsafeMutableRawPointer) -> Int32 + private final class _BJS_ClosureBox_10TestModuleSq6PersonC_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String init(_ closure: @escaping (Optional) -> String) { @@ -427,14 +440,12 @@ private enum _BJS_Closure_10TestModuleSq6PersonC_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS") - func _invoke(_: Int32, _: Int32, _: UnsafeMutableRawPointer) -> Int32 let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() -let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) +let resultId = invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -451,6 +462,9 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS(boxPtr: U #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS") +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS(_: Int32, _: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_10TestModuleSq9APIResultO_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String init(_ closure: @escaping (Optional) -> String) { @@ -468,14 +482,12 @@ private enum _BJS_Closure_10TestModuleSq9APIResultO_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) +let resultId = invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -492,6 +504,9 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(boxPtr #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS") +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS(_: Int32, _: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_10TestModuleSq9DirectionO_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String init(_ closure: @escaping (Optional) -> String) { @@ -509,14 +524,12 @@ private enum _BJS_Closure_10TestModuleSq9DirectionO_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) +let resultId = invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -684,18 +697,19 @@ public func _bjs_Person_deinit(pointer: UnsafeMutableRawPointer) { extension Person: ConvertibleToJSValue, _BridgedSwiftHeapObject { public var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_Person_wrap") - func _bjs_Person_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_Person_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_Person_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Person_wrap") +fileprivate func _bjs_Person_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Person_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_TestProcessor_init") @_cdecl("bjs_TestProcessor_init") public func _bjs_TestProcessor_init(transform: Int32) -> UnsafeMutableRawPointer { @@ -902,14 +916,15 @@ public func _bjs_TestProcessor_deinit(pointer: UnsafeMutableRawPointer) { extension TestProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_TestProcessor_wrap") - func _bjs_TestProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_TestProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_TestProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_TestProcessor_wrap") +fileprivate func _bjs_TestProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_TestProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift index 96fac13d6..6a624246e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift @@ -6,45 +6,48 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_checkArray") +func bjs_checkArray(_ a: Int32) -> Void +#else +func bjs_checkArray(_ a: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func checkArray(_ a: JSObject) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_checkArray") - func bjs_checkArray(_ a: Int32) -> Void - #else - func bjs_checkArray(_ a: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_checkArray(a.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error } } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_checkArrayWithLength") +func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void +#else +func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_checkArrayWithLength") - func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void - #else - func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_checkArrayWithLength(a.bridgeJSLowerParameter(), b.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error } } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_checkArray") +func bjs_checkArray(_ a: Int32) -> Void +#else +func bjs_checkArray(_ a: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func checkArray(_ a: JSObject) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_checkArray") - func bjs_checkArray(_ a: Int32) -> Void - #else - func bjs_checkArray(_ a: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_checkArray(a.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift index a8ecf8d57..36ad4cd30 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift @@ -6,15 +6,16 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_asyncReturnVoid") +func bjs_asyncReturnVoid() -> Int32 +#else +func bjs_asyncReturnVoid() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func asyncReturnVoid() throws(JSException) -> JSPromise { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_asyncReturnVoid") - func bjs_asyncReturnVoid() -> Int32 - #else - func bjs_asyncReturnVoid() -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_asyncReturnVoid() if let error = _swift_js_take_exception() { throw error @@ -22,15 +23,16 @@ func asyncReturnVoid() throws(JSException) -> JSPromise { return JSPromise.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_asyncRoundTripInt") +func bjs_asyncRoundTripInt(_ v: Float64) -> Int32 +#else +func bjs_asyncRoundTripInt(_ v: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func asyncRoundTripInt(_ v: Double) throws(JSException) -> JSPromise { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_asyncRoundTripInt") - func bjs_asyncRoundTripInt(_ v: Float64) -> Int32 - #else - func bjs_asyncRoundTripInt(_ v: Float64) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_asyncRoundTripInt(v.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -38,15 +40,16 @@ func asyncRoundTripInt(_ v: Double) throws(JSException) -> JSPromise { return JSPromise.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_asyncRoundTripString") +func bjs_asyncRoundTripString(_ v: Int32) -> Int32 +#else +func bjs_asyncRoundTripString(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func asyncRoundTripString(_ v: String) throws(JSException) -> JSPromise { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_asyncRoundTripString") - func bjs_asyncRoundTripString(_ v: Int32) -> Int32 - #else - func bjs_asyncRoundTripString(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_asyncRoundTripString(v.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -54,15 +57,16 @@ func asyncRoundTripString(_ v: String) throws(JSException) -> JSPromise { return JSPromise.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_asyncRoundTripBool") +func bjs_asyncRoundTripBool(_ v: Int32) -> Int32 +#else +func bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func asyncRoundTripBool(_ v: Bool) throws(JSException) -> JSPromise { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_asyncRoundTripBool") - func bjs_asyncRoundTripBool(_ v: Int32) -> Int32 - #else - func bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_asyncRoundTripBool(v.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -70,15 +74,16 @@ func asyncRoundTripBool(_ v: Bool) throws(JSException) -> JSPromise { return JSPromise.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_asyncRoundTripFloat") +func bjs_asyncRoundTripFloat(_ v: Float64) -> Int32 +#else +func bjs_asyncRoundTripFloat(_ v: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func asyncRoundTripFloat(_ v: Double) throws(JSException) -> JSPromise { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_asyncRoundTripFloat") - func bjs_asyncRoundTripFloat(_ v: Float64) -> Int32 - #else - func bjs_asyncRoundTripFloat(_ v: Float64) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_asyncRoundTripFloat(v.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -86,15 +91,16 @@ func asyncRoundTripFloat(_ v: Double) throws(JSException) -> JSPromise { return JSPromise.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_asyncRoundTripDouble") +func bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 +#else +func bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func asyncRoundTripDouble(_ v: Double) throws(JSException) -> JSPromise { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_asyncRoundTripDouble") - func bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 - #else - func bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_asyncRoundTripDouble(v.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -102,15 +108,16 @@ func asyncRoundTripDouble(_ v: Double) throws(JSException) -> JSPromise { return JSPromise.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_asyncRoundTripJSObject") +func bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 +#else +func bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func asyncRoundTripJSObject(_ v: JSObject) throws(JSException) -> JSPromise { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_asyncRoundTripJSObject") - func bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 - #else - func bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_asyncRoundTripJSObject(v.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift index 68f148085..e0571d5f1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift @@ -6,15 +6,16 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_returnAnimatable") +func bjs_returnAnimatable() -> Int32 +#else +func bjs_returnAnimatable() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func returnAnimatable() throws(JSException) -> Animatable { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_returnAnimatable") - func bjs_returnAnimatable() -> Int32 - #else - func bjs_returnAnimatable() -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_returnAnimatable() if let error = _swift_js_take_exception() { throw error @@ -22,6 +23,24 @@ func returnAnimatable() throws(JSException) -> Animatable { return Animatable.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Animatable_animate") +func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 +#else +func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Animatable_getAnimations") +func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 +#else +func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + struct Animatable: _JSBridgedClass { let jsObject: JSObject @@ -30,14 +49,6 @@ struct Animatable: _JSBridgedClass { } func animate(_ keyframes: JSObject, _ options: JSObject) throws(JSException) -> JSObject { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_Animatable_animate") - func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 - #else - func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_Animatable_animate(self.bridgeJSLowerParameter(), keyframes.bridgeJSLowerParameter(), options.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -46,14 +57,6 @@ struct Animatable: _JSBridgedClass { } func getAnimations(_ options: JSObject) throws(JSException) -> JSObject { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_Animatable_getAnimations") - func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 - #else - func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_Animatable_getAnimations(self.bridgeJSLowerParameter(), options.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift index 7e35f9215..2d04f47e6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift @@ -6,15 +6,16 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_createArrayBuffer") +func bjs_createArrayBuffer() -> Int32 +#else +func bjs_createArrayBuffer() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func createArrayBuffer() throws(JSException) -> ArrayBufferLike { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_createArrayBuffer") - func bjs_createArrayBuffer() -> Int32 - #else - func bjs_createArrayBuffer() -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_createArrayBuffer() if let error = _swift_js_take_exception() { throw error @@ -22,15 +23,16 @@ func createArrayBuffer() throws(JSException) -> ArrayBufferLike { return ArrayBufferLike.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_createWeirdObject") +func bjs_createWeirdObject() -> Int32 +#else +func bjs_createWeirdObject() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func createWeirdObject() throws(JSException) -> WeirdNaming { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_createWeirdObject") - func bjs_createWeirdObject() -> Int32 - #else - func bjs_createWeirdObject() -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_createWeirdObject() if let error = _swift_js_take_exception() { throw error @@ -38,6 +40,24 @@ func createWeirdObject() throws(JSException) -> WeirdNaming { return WeirdNaming.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_ArrayBufferLike_byteLength_get") +func bjs_ArrayBufferLike_byteLength_get(_ self: Int32) -> Float64 +#else +func bjs_ArrayBufferLike_byteLength_get(_ self: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_ArrayBufferLike_slice") +func bjs_ArrayBufferLike_slice(_ self: Int32, _ begin: Float64, _ end: Float64) -> Int32 +#else +func bjs_ArrayBufferLike_slice(_ self: Int32, _ begin: Float64, _ end: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + struct ArrayBufferLike: _JSBridgedClass { let jsObject: JSObject @@ -47,14 +67,6 @@ struct ArrayBufferLike: _JSBridgedClass { var byteLength: Double { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_ArrayBufferLike_byteLength_get") - func bjs_ArrayBufferLike_byteLength_get(_ self: Int32) -> Float64 - #else - func bjs_ArrayBufferLike_byteLength_get(_ self: Int32) -> Float64 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_ArrayBufferLike_byteLength_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -64,14 +76,6 @@ struct ArrayBufferLike: _JSBridgedClass { } func slice(_ begin: Double, _ end: Double) throws(JSException) -> ArrayBufferLike { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_ArrayBufferLike_slice") - func bjs_ArrayBufferLike_slice(_ self: Int32, _ begin: Float64, _ end: Float64) -> Int32 - #else - func bjs_ArrayBufferLike_slice(_ self: Int32, _ begin: Float64, _ end: Float64) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_ArrayBufferLike_slice(self.bridgeJSLowerParameter(), begin.bridgeJSLowerParameter(), end.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -81,6 +85,69 @@ struct ArrayBufferLike: _JSBridgedClass { } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_normalProperty_get") +func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 +#else +func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_normalProperty_set") +func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void +#else +func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_get") +func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 +#else +func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_set") +func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void +#else +func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_Any_get") +func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 +#else +func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_Any_set") +func bjs_WeirdNaming_Any_set(_ self: Int32, _ newValue: Int32) -> Void +#else +func bjs_WeirdNaming_Any_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_as") +func bjs_WeirdNaming_as(_ self: Int32) -> Void +#else +func bjs_WeirdNaming_as(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + struct WeirdNaming: _JSBridgedClass { let jsObject: JSObject @@ -90,14 +157,6 @@ struct WeirdNaming: _JSBridgedClass { var normalProperty: String { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_normalProperty_get") - func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 - #else - func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_WeirdNaming_normalProperty_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -107,14 +166,6 @@ struct WeirdNaming: _JSBridgedClass { } func setNormalProperty(_ newValue: String) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_normalProperty_set") - func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void - #else - func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_WeirdNaming_normalProperty_set(self.bridgeJSLowerParameter(), newValue.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -123,14 +174,6 @@ struct WeirdNaming: _JSBridgedClass { var `for`: String { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_get") - func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 - #else - func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_WeirdNaming_for_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -140,14 +183,6 @@ struct WeirdNaming: _JSBridgedClass { } func setFor(_ newValue: String) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_set") - func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void - #else - func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_WeirdNaming_for_set(self.bridgeJSLowerParameter(), newValue.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -156,14 +191,6 @@ struct WeirdNaming: _JSBridgedClass { var `Any`: String { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_Any_get") - func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 - #else - func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_WeirdNaming_Any_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -173,14 +200,6 @@ struct WeirdNaming: _JSBridgedClass { } func setAny(_ newValue: String) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_Any_set") - func bjs_WeirdNaming_Any_set(_ self: Int32, _ newValue: Int32) -> Void - #else - func bjs_WeirdNaming_Any_set(_ self: Int32, _ newValue: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_WeirdNaming_Any_set(self.bridgeJSLowerParameter(), newValue.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -188,14 +207,6 @@ struct WeirdNaming: _JSBridgedClass { } func `as`() throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_as") - func bjs_WeirdNaming_as(_ self: Int32) -> Void - #else - func bjs_WeirdNaming_as(_ self: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_WeirdNaming_as(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift index 810df3683..288382150 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift @@ -6,15 +6,16 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_createDatabaseConnection") +func bjs_createDatabaseConnection(_ config: Int32) -> Int32 +#else +func bjs_createDatabaseConnection(_ config: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func createDatabaseConnection(_ config: JSObject) throws(JSException) -> DatabaseConnection { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_createDatabaseConnection") - func bjs_createDatabaseConnection(_ config: Int32) -> Int32 - #else - func bjs_createDatabaseConnection(_ config: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_createDatabaseConnection(config.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -22,15 +23,16 @@ func createDatabaseConnection(_ config: JSObject) throws(JSException) -> Databas return DatabaseConnection.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_createLogger") +func bjs_createLogger(_ level: Int32) -> Int32 +#else +func bjs_createLogger(_ level: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func createLogger(_ level: String) throws(JSException) -> Logger { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_createLogger") - func bjs_createLogger(_ level: Int32) -> Int32 - #else - func bjs_createLogger(_ level: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_createLogger(level.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -38,15 +40,16 @@ func createLogger(_ level: String) throws(JSException) -> Logger { return Logger.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_getConfigManager") +func bjs_getConfigManager() -> Int32 +#else +func bjs_getConfigManager() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func getConfigManager() throws(JSException) -> ConfigManager { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_getConfigManager") - func bjs_getConfigManager() -> Int32 - #else - func bjs_getConfigManager() -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_getConfigManager() if let error = _swift_js_take_exception() { throw error @@ -54,6 +57,51 @@ func getConfigManager() throws(JSException) -> ConfigManager { return ConfigManager.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_isConnected_get") +func bjs_DatabaseConnection_isConnected_get(_ self: Int32) -> Int32 +#else +func bjs_DatabaseConnection_isConnected_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connectionTimeout_get") +func bjs_DatabaseConnection_connectionTimeout_get(_ self: Int32) -> Float64 +#else +func bjs_DatabaseConnection_connectionTimeout_get(_ self: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connectionTimeout_set") +func bjs_DatabaseConnection_connectionTimeout_set(_ self: Int32, _ newValue: Float64) -> Void +#else +func bjs_DatabaseConnection_connectionTimeout_set(_ self: Int32, _ newValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connect") +func bjs_DatabaseConnection_connect(_ self: Int32, _ url: Int32) -> Void +#else +func bjs_DatabaseConnection_connect(_ self: Int32, _ url: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_execute") +func bjs_DatabaseConnection_execute(_ self: Int32, _ query: Int32) -> Int32 +#else +func bjs_DatabaseConnection_execute(_ self: Int32, _ query: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + struct DatabaseConnection: _JSBridgedClass { let jsObject: JSObject @@ -63,14 +111,6 @@ struct DatabaseConnection: _JSBridgedClass { var isConnected: Bool { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_isConnected_get") - func bjs_DatabaseConnection_isConnected_get(_ self: Int32) -> Int32 - #else - func bjs_DatabaseConnection_isConnected_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_DatabaseConnection_isConnected_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -81,14 +121,6 @@ struct DatabaseConnection: _JSBridgedClass { var connectionTimeout: Double { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connectionTimeout_get") - func bjs_DatabaseConnection_connectionTimeout_get(_ self: Int32) -> Float64 - #else - func bjs_DatabaseConnection_connectionTimeout_get(_ self: Int32) -> Float64 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_DatabaseConnection_connectionTimeout_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -98,14 +130,6 @@ struct DatabaseConnection: _JSBridgedClass { } func setConnectionTimeout(_ newValue: Double) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connectionTimeout_set") - func bjs_DatabaseConnection_connectionTimeout_set(_ self: Int32, _ newValue: Float64) -> Void - #else - func bjs_DatabaseConnection_connectionTimeout_set(_ self: Int32, _ newValue: Float64) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_DatabaseConnection_connectionTimeout_set(self.bridgeJSLowerParameter(), newValue.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -113,14 +137,6 @@ struct DatabaseConnection: _JSBridgedClass { } func connect(_ url: String) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connect") - func bjs_DatabaseConnection_connect(_ self: Int32, _ url: Int32) -> Void - #else - func bjs_DatabaseConnection_connect(_ self: Int32, _ url: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_DatabaseConnection_connect(self.bridgeJSLowerParameter(), url.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -128,14 +144,6 @@ struct DatabaseConnection: _JSBridgedClass { } func execute(_ query: String) throws(JSException) -> JSObject { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_execute") - func bjs_DatabaseConnection_execute(_ self: Int32, _ query: Int32) -> Int32 - #else - func bjs_DatabaseConnection_execute(_ self: Int32, _ query: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_DatabaseConnection_execute(self.bridgeJSLowerParameter(), query.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -145,6 +153,33 @@ struct DatabaseConnection: _JSBridgedClass { } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Logger_level_get") +func bjs_Logger_level_get(_ self: Int32) -> Int32 +#else +func bjs_Logger_level_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Logger_log") +func bjs_Logger_log(_ self: Int32, _ message: Int32) -> Void +#else +func bjs_Logger_log(_ self: Int32, _ message: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Logger_error") +func bjs_Logger_error(_ self: Int32, _ message: Int32, _ error: Int32) -> Void +#else +func bjs_Logger_error(_ self: Int32, _ message: Int32, _ error: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + struct Logger: _JSBridgedClass { let jsObject: JSObject @@ -154,14 +189,6 @@ struct Logger: _JSBridgedClass { var level: String { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_Logger_level_get") - func bjs_Logger_level_get(_ self: Int32) -> Int32 - #else - func bjs_Logger_level_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_Logger_level_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -171,14 +198,6 @@ struct Logger: _JSBridgedClass { } func log(_ message: String) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_Logger_log") - func bjs_Logger_log(_ self: Int32, _ message: Int32) -> Void - #else - func bjs_Logger_log(_ self: Int32, _ message: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_Logger_log(self.bridgeJSLowerParameter(), message.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -186,14 +205,6 @@ struct Logger: _JSBridgedClass { } func error(_ message: String, _ error: JSObject) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_Logger_error") - func bjs_Logger_error(_ self: Int32, _ message: Int32, _ error: Int32) -> Void - #else - func bjs_Logger_error(_ self: Int32, _ message: Int32, _ error: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_Logger_error(self.bridgeJSLowerParameter(), message.bridgeJSLowerParameter(), error.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -202,6 +213,33 @@ struct Logger: _JSBridgedClass { } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_ConfigManager_configPath_get") +func bjs_ConfigManager_configPath_get(_ self: Int32) -> Int32 +#else +func bjs_ConfigManager_configPath_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_ConfigManager_get") +func bjs_ConfigManager_get(_ self: Int32, _ key: Int32) -> Int32 +#else +func bjs_ConfigManager_get(_ self: Int32, _ key: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_ConfigManager_set") +func bjs_ConfigManager_set(_ self: Int32, _ key: Int32, _ value: Int32) -> Void +#else +func bjs_ConfigManager_set(_ self: Int32, _ key: Int32, _ value: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + struct ConfigManager: _JSBridgedClass { let jsObject: JSObject @@ -211,14 +249,6 @@ struct ConfigManager: _JSBridgedClass { var configPath: String { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_ConfigManager_configPath_get") - func bjs_ConfigManager_configPath_get(_ self: Int32) -> Int32 - #else - func bjs_ConfigManager_configPath_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_ConfigManager_configPath_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -228,14 +258,6 @@ struct ConfigManager: _JSBridgedClass { } func get(_ key: String) throws(JSException) -> JSObject { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_ConfigManager_get") - func bjs_ConfigManager_get(_ self: Int32, _ key: Int32) -> Int32 - #else - func bjs_ConfigManager_get(_ self: Int32, _ key: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_ConfigManager_get(self.bridgeJSLowerParameter(), key.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -244,14 +266,6 @@ struct ConfigManager: _JSBridgedClass { } func set(_ key: String, _ value: JSObject) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_ConfigManager_set") - func bjs_ConfigManager_set(_ self: Int32, _ key: Int32, _ value: Int32) -> Void - #else - func bjs_ConfigManager_set(_ self: Int32, _ key: Int32, _ value: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_ConfigManager_set(self.bridgeJSLowerParameter(), key.bridgeJSLowerParameter(), value.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift index 30f66a265..00d220eab 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift @@ -6,15 +6,16 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_check") +func bjs_check(_ a: Float64, _ b: Int32) -> Void +#else +func bjs_check(_ a: Float64, _ b: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func check(_ a: Double, _ b: Bool) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_check") - func bjs_check(_ a: Float64, _ b: Int32) -> Void - #else - func bjs_check(_ a: Float64, _ b: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_check(a.bridgeJSLowerParameter(), b.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift index 29ba81c62..b33250625 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift @@ -6,15 +6,16 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_checkNumber") +func bjs_checkNumber() -> Float64 +#else +func bjs_checkNumber() -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + func checkNumber() throws(JSException) -> Double { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_checkNumber") - func bjs_checkNumber() -> Float64 - #else - func bjs_checkNumber() -> Float64 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_checkNumber() if let error = _swift_js_take_exception() { throw error @@ -22,15 +23,16 @@ func checkNumber() throws(JSException) -> Double { return Double.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_checkBoolean") +func bjs_checkBoolean() -> Int32 +#else +func bjs_checkBoolean() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func checkBoolean() throws(JSException) -> Bool { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_checkBoolean") - func bjs_checkBoolean() -> Int32 - #else - func bjs_checkBoolean() -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_checkBoolean() if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift index 99215a30c..fdaf7c49d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift @@ -6,30 +6,32 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_checkString") +func bjs_checkString(_ a: Int32) -> Void +#else +func bjs_checkString(_ a: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func checkString(_ a: String) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_checkString") - func bjs_checkString(_ a: Int32) -> Void - #else - func bjs_checkString(_ a: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_checkString(a.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error } } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_checkStringWithLength") +func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void +#else +func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func checkStringWithLength(_ a: String, _ b: Double) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_checkStringWithLength") - func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void - #else - func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_checkStringWithLength(a.bridgeJSLowerParameter(), b.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift index 05bb8aeab..9edc42cf8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift @@ -6,15 +6,16 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_checkString") +func bjs_checkString() -> Int32 +#else +func bjs_checkString() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func checkString() throws(JSException) -> String { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_checkString") - func bjs_checkString() -> Int32 - #else - func bjs_checkString() -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_checkString() if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift index 0b17f13ba..23e8ea7df 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift @@ -6,15 +6,16 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_createTS2Skeleton") +func bjs_createTS2Skeleton() -> Int32 +#else +func bjs_createTS2Skeleton() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func createTS2Skeleton() throws(JSException) -> TypeScriptProcessor { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_createTS2Skeleton") - func bjs_createTS2Skeleton() -> Int32 - #else - func bjs_createTS2Skeleton() -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_createTS2Skeleton() if let error = _swift_js_take_exception() { throw error @@ -22,15 +23,16 @@ func createTS2Skeleton() throws(JSException) -> TypeScriptProcessor { return TypeScriptProcessor.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_createCodeGenerator") +func bjs_createCodeGenerator(_ format: Int32) -> Int32 +#else +func bjs_createCodeGenerator(_ format: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func createCodeGenerator(_ format: String) throws(JSException) -> CodeGenerator { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_createCodeGenerator") - func bjs_createCodeGenerator(_ format: Int32) -> Int32 - #else - func bjs_createCodeGenerator(_ format: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_createCodeGenerator(format.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -38,6 +40,33 @@ func createCodeGenerator(_ format: String) throws(JSException) -> CodeGenerator return CodeGenerator.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_version_get") +func bjs_TypeScriptProcessor_version_get(_ self: Int32) -> Int32 +#else +func bjs_TypeScriptProcessor_version_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_convert") +func bjs_TypeScriptProcessor_convert(_ self: Int32, _ ts: Int32) -> Int32 +#else +func bjs_TypeScriptProcessor_convert(_ self: Int32, _ ts: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_validate") +func bjs_TypeScriptProcessor_validate(_ self: Int32, _ ts: Int32) -> Int32 +#else +func bjs_TypeScriptProcessor_validate(_ self: Int32, _ ts: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + struct TypeScriptProcessor: _JSBridgedClass { let jsObject: JSObject @@ -47,14 +76,6 @@ struct TypeScriptProcessor: _JSBridgedClass { var version: String { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_version_get") - func bjs_TypeScriptProcessor_version_get(_ self: Int32) -> Int32 - #else - func bjs_TypeScriptProcessor_version_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_TypeScriptProcessor_version_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -64,14 +85,6 @@ struct TypeScriptProcessor: _JSBridgedClass { } func convert(_ ts: String) throws(JSException) -> String { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_convert") - func bjs_TypeScriptProcessor_convert(_ self: Int32, _ ts: Int32) -> Int32 - #else - func bjs_TypeScriptProcessor_convert(_ self: Int32, _ ts: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_TypeScriptProcessor_convert(self.bridgeJSLowerParameter(), ts.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -80,14 +93,6 @@ struct TypeScriptProcessor: _JSBridgedClass { } func validate(_ ts: String) throws(JSException) -> Bool { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_validate") - func bjs_TypeScriptProcessor_validate(_ self: Int32, _ ts: Int32) -> Int32 - #else - func bjs_TypeScriptProcessor_validate(_ self: Int32, _ ts: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_TypeScriptProcessor_validate(self.bridgeJSLowerParameter(), ts.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -97,6 +102,24 @@ struct TypeScriptProcessor: _JSBridgedClass { } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_CodeGenerator_outputFormat_get") +func bjs_CodeGenerator_outputFormat_get(_ self: Int32) -> Int32 +#else +func bjs_CodeGenerator_outputFormat_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_CodeGenerator_generate") +func bjs_CodeGenerator_generate(_ self: Int32, _ input: Int32) -> Int32 +#else +func bjs_CodeGenerator_generate(_ self: Int32, _ input: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + struct CodeGenerator: _JSBridgedClass { let jsObject: JSObject @@ -106,14 +129,6 @@ struct CodeGenerator: _JSBridgedClass { var outputFormat: String { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_CodeGenerator_outputFormat_get") - func bjs_CodeGenerator_outputFormat_get(_ self: Int32) -> Int32 - #else - func bjs_CodeGenerator_outputFormat_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_CodeGenerator_outputFormat_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -123,14 +138,6 @@ struct CodeGenerator: _JSBridgedClass { } func generate(_ input: JSObject) throws(JSException) -> String { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_CodeGenerator_generate") - func bjs_CodeGenerator_generate(_ self: Int32, _ input: Int32) -> Int32 - #else - func bjs_CodeGenerator_generate(_ self: Int32, _ input: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_CodeGenerator_generate(self.bridgeJSLowerParameter(), input.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift index d8b184638..d007caf63 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift @@ -6,15 +6,16 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_checkSimple") +func bjs_checkSimple(_ a: Float64) -> Void +#else +func bjs_checkSimple(_ a: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func checkSimple(_ a: Double) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_checkSimple") - func bjs_checkSimple(_ a: Float64) -> Void - #else - func bjs_checkSimple(_ a: Float64) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_checkSimple(a.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift index 455b38bc5..7fe7133db 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift @@ -6,6 +6,60 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Greeter_init") +func bjs_Greeter_init(_ name: Int32) -> Int32 +#else +func bjs_Greeter_init(_ name: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Greeter_name_get") +func bjs_Greeter_name_get(_ self: Int32) -> Int32 +#else +func bjs_Greeter_name_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Greeter_name_set") +func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void +#else +func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Greeter_age_get") +func bjs_Greeter_age_get(_ self: Int32) -> Float64 +#else +func bjs_Greeter_age_get(_ self: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Greeter_greet") +func bjs_Greeter_greet(_ self: Int32) -> Int32 +#else +func bjs_Greeter_greet(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Greeter_changeName") +func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void +#else +func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + struct Greeter: _JSBridgedClass { let jsObject: JSObject @@ -14,14 +68,6 @@ struct Greeter: _JSBridgedClass { } init(_ name: String) throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_Greeter_init") - func bjs_Greeter_init(_ name: Int32) -> Int32 - #else - func bjs_Greeter_init(_ name: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_Greeter_init(name.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -31,14 +77,6 @@ struct Greeter: _JSBridgedClass { var name: String { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_Greeter_name_get") - func bjs_Greeter_name_get(_ self: Int32) -> Int32 - #else - func bjs_Greeter_name_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_Greeter_name_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -48,14 +86,6 @@ struct Greeter: _JSBridgedClass { } func setName(_ newValue: String) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_Greeter_name_set") - func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void - #else - func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_Greeter_name_set(self.bridgeJSLowerParameter(), newValue.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -64,14 +94,6 @@ struct Greeter: _JSBridgedClass { var age: Double { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_Greeter_age_get") - func bjs_Greeter_age_get(_ self: Int32) -> Float64 - #else - func bjs_Greeter_age_get(_ self: Int32) -> Float64 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_Greeter_age_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -81,14 +103,6 @@ struct Greeter: _JSBridgedClass { } func greet() throws(JSException) -> String { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_Greeter_greet") - func bjs_Greeter_greet(_ self: Int32) -> Int32 - #else - func bjs_Greeter_greet(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_Greeter_greet(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -97,14 +111,6 @@ struct Greeter: _JSBridgedClass { } func changeName(_ name: String) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_Greeter_changeName") - func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void - #else - func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_Greeter_changeName(self.bridgeJSLowerParameter(), name.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift index ae7ae0e8e..a5ac5afc4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift @@ -6,15 +6,16 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_check") +func bjs_check() -> Void +#else +func bjs_check() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func check() throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Check", name: "bjs_check") - func bjs_check() -> Void - #else - func bjs_check() -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_check() if let error = _swift_js_take_exception() { throw error From eddc81f3ba8b8096b10f4c67342fb64a8820837f Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 27 Nov 2025 03:29:16 +0000 Subject: [PATCH 035/252] BridgeJS: Utilities/bridge-js-generate.sh --- .../Generated/BridgeJS.ExportSwift.swift | 53 +- .../Sources/Generated/BridgeJS.ImportTS.swift | 51 +- .../Generated/BridgeJS.ExportSwift.swift | 36 +- .../Generated/BridgeJS.ImportTS.swift | 34 +- .../Generated/BridgeJS.ExportSwift.swift | 641 ++++++++++-------- .../Generated/BridgeJS.ImportTS.swift | 255 +++---- 6 files changed, 580 insertions(+), 490 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift b/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift index ab0cbb197..8fb5c97d7 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift @@ -362,18 +362,19 @@ public func _bjs_EnumRoundtrip_deinit(pointer: UnsafeMutableRawPointer) { extension EnumRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "Benchmarks", name: "bjs_EnumRoundtrip_wrap") - func _bjs_EnumRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_EnumRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_EnumRoundtrip_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_EnumRoundtrip_wrap") +fileprivate func _bjs_EnumRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_EnumRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_ComplexResultRoundtrip_init") @_cdecl("bjs_ComplexResultRoundtrip_init") public func _bjs_ComplexResultRoundtrip_init() -> UnsafeMutableRawPointer { @@ -491,18 +492,19 @@ public func _bjs_ComplexResultRoundtrip_deinit(pointer: UnsafeMutableRawPointer) extension ComplexResultRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "Benchmarks", name: "bjs_ComplexResultRoundtrip_wrap") - func _bjs_ComplexResultRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_ComplexResultRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_ComplexResultRoundtrip_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_ComplexResultRoundtrip_wrap") +fileprivate func _bjs_ComplexResultRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ComplexResultRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_StringRoundtrip_init") @_cdecl("bjs_StringRoundtrip_init") public func _bjs_StringRoundtrip_init() -> UnsafeMutableRawPointer { @@ -543,14 +545,15 @@ public func _bjs_StringRoundtrip_deinit(pointer: UnsafeMutableRawPointer) { extension StringRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "Benchmarks", name: "bjs_StringRoundtrip_wrap") - func _bjs_StringRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_StringRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_StringRoundtrip_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_StringRoundtrip_wrap") +fileprivate func _bjs_StringRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_StringRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift b/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift index bc7f0b172..721f089d8 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift @@ -6,45 +6,48 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoop") +func bjs_benchmarkHelperNoop() -> Void +#else +func bjs_benchmarkHelperNoop() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func benchmarkHelperNoop() throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoop") - func bjs_benchmarkHelperNoop() -> Void - #else - func bjs_benchmarkHelperNoop() -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_benchmarkHelperNoop() if let error = _swift_js_take_exception() { throw error } } +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoopWithNumber") +func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void +#else +func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func benchmarkHelperNoopWithNumber(_ n: Double) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoopWithNumber") - func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void - #else - func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_benchmarkHelperNoopWithNumber(n.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error } } +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkRunner") +func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void +#else +func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func benchmarkRunner(_ name: String, _ body: JSObject) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkRunner") - func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void - #else - func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_benchmarkRunner(name.bridgeJSLowerParameter(), body.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift index 9e4515f57..be683415c 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift @@ -50,18 +50,19 @@ public func _bjs_PlayBridgeJS_deinit(pointer: UnsafeMutableRawPointer) { extension PlayBridgeJS: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJS_wrap") - func _bjs_PlayBridgeJS_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_PlayBridgeJS_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_PlayBridgeJS_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJS_wrap") +fileprivate func _bjs_PlayBridgeJS_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PlayBridgeJS_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_PlayBridgeJSOutput_outputJs") @_cdecl("bjs_PlayBridgeJSOutput_outputJs") public func _bjs_PlayBridgeJSOutput_outputJs(_self: UnsafeMutableRawPointer) -> Void { @@ -114,14 +115,15 @@ public func _bjs_PlayBridgeJSOutput_deinit(pointer: UnsafeMutableRawPointer) { extension PlayBridgeJSOutput: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJSOutput_wrap") - func _bjs_PlayBridgeJSOutput_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_PlayBridgeJSOutput_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_PlayBridgeJSOutput_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJSOutput_wrap") +fileprivate func _bjs_PlayBridgeJSOutput_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PlayBridgeJSOutput_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift index 4d35ef745..5864feb5d 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift @@ -6,15 +6,16 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_createTS2Skeleton") +func bjs_createTS2Skeleton() -> Int32 +#else +func bjs_createTS2Skeleton() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func createTS2Skeleton() throws(JSException) -> TS2Skeleton { - #if arch(wasm32) - @_extern(wasm, module: "PlayBridgeJS", name: "bjs_createTS2Skeleton") - func bjs_createTS2Skeleton() -> Int32 - #else - func bjs_createTS2Skeleton() -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_createTS2Skeleton() if let error = _swift_js_take_exception() { throw error @@ -22,6 +23,15 @@ func createTS2Skeleton() throws(JSException) -> TS2Skeleton { return TS2Skeleton.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_TS2Skeleton_convert") +func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 +#else +func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + struct TS2Skeleton: _JSBridgedClass { let jsObject: JSObject @@ -30,14 +40,6 @@ struct TS2Skeleton: _JSBridgedClass { } func convert(_ ts: String) throws(JSException) -> String { - #if arch(wasm32) - @_extern(wasm, module: "PlayBridgeJS", name: "bjs_TS2Skeleton_convert") - func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 - #else - func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_TS2Skeleton_convert(self.bridgeJSLowerParameter(), ts.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index 2e7394999..572890b0f 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -6,6 +6,9 @@ @_spi(BridgeJS) import JavaScriptKit +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTests10HttpStatusO_Si: _BridgedSwiftClosureBox { let closure: (HttpStatus) -> Int init(_ closure: @escaping (HttpStatus) -> Int) { @@ -23,13 +26,11 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return Int.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -46,6 +47,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10H #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_SS: _BridgedSwiftClosureBox { let closure: (Theme) -> String init(_ closure: @escaping (Theme) -> String) { @@ -63,13 +67,11 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -86,6 +88,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5Th #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_Sb: _BridgedSwiftClosureBox { let closure: (Theme) -> Bool init(_ closure: @escaping (Theme) -> Bool) { @@ -103,13 +108,11 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return Bool.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -126,6 +129,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5Th #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_: Int32, _: UnsafeMutableRawPointer) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTests7GreeterC_SS: _BridgedSwiftClosureBox { let closure: (Greeter) -> String init(_ closure: @escaping (Greeter) -> String) { @@ -143,13 +149,11 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests7GreeterC_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") - func _invoke(_: Int32, _: UnsafeMutableRawPointer) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -166,6 +170,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7Gr #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTests9APIResultO_SS: _BridgedSwiftClosureBox { let closure: (APIResult) -> String init(_ closure: @escaping (APIResult) -> String) { @@ -183,13 +190,11 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -206,6 +211,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9AP #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_SS: _BridgedSwiftClosureBox { let closure: (Direction) -> String init(_ closure: @escaping (Direction) -> String) { @@ -223,13 +231,11 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -246,6 +252,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9Di #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_Sb: _BridgedSwiftClosureBox { let closure: (Direction) -> Bool init(_ closure: @escaping (Direction) -> Bool) { @@ -263,13 +272,11 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return Bool.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -286,6 +293,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9Di #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_: Int32, _: Int32) -> UnsafeMutableRawPointer + private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_7GreeterC: _BridgedSwiftClosureBox { let closure: (String) -> Greeter init(_ closure: @escaping (String) -> Greeter) { @@ -303,13 +313,11 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_7GreeterC { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") - func _invoke(_: Int32, _: Int32) -> UnsafeMutableRawPointer - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return Greeter.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -326,6 +334,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_ #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_SS: _BridgedSwiftClosureBox { let closure: (String) -> String init(_ closure: @escaping (String) -> String) { @@ -343,13 +354,11 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -366,6 +375,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_ #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_: Int32, _: Int32, _: Int32, _: Float64) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSiSSSd_SS: _BridgedSwiftClosureBox { let closure: (Int, String, Double) -> String init(_ closure: @escaping (Int, String, Double) -> String) { @@ -383,13 +395,11 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSiSSSd_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0, param1, param2 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") - func _invoke(_: Int32, _: Int32, _: Int32, _: Float64) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter(), param1.bridgeJSLowerParameter(), param2.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter(), param1.bridgeJSLowerParameter(), param2.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -406,6 +416,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiS #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSi_Si: _BridgedSwiftClosureBox { let closure: (Int) -> Int init(_ closure: @escaping (Int) -> Int) { @@ -423,13 +436,11 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSi_Si { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") - func _invoke(_: Int32, _: Int32) -> Int32 - let resultId = _invoke(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) + let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) return Int.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -446,6 +457,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_ #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_: Int32, _: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq5ThemeO_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String init(_ closure: @escaping (Optional) -> String) { @@ -463,14 +477,12 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSq5ThemeO_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) +let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -487,6 +499,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5 #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_: Int32, _: Int32, _: UnsafeMutableRawPointer) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String init(_ closure: @escaping (Optional) -> String) { @@ -504,14 +519,12 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") - func _invoke(_: Int32, _: Int32, _: UnsafeMutableRawPointer) -> Int32 let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() -let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) +let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -528,6 +541,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7 #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_: Int32, _: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9APIResultO_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String init(_ closure: @escaping (Optional) -> String) { @@ -545,14 +561,12 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9APIResultO_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) +let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -569,6 +583,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9 #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_: Int32, _: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9DirectionO_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String init(_ closure: @escaping (Optional) -> String) { @@ -586,14 +603,12 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) +let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -610,6 +625,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9 #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_: Int32, _: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSS_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String init(_ closure: @escaping (Optional) -> String) { @@ -627,14 +645,12 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) +let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -651,6 +667,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqS #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_: Int32, _: Int32, _: Int32) -> Int32 + private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSi_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String init(_ closure: @escaping (Optional) -> String) { @@ -668,14 +687,12 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSi_SS { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") - func _invoke(_: Int32, _: Int32, _: Int32) -> Int32 let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = _invoke(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) +let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) return String.bridgeJSLiftReturn(resultId) #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -692,6 +709,9 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqS #endif } +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_: Int32) -> Void + private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsy_Sq7GreeterC: _BridgedSwiftClosureBox { let closure: () -> Optional init(_ closure: @escaping () -> Optional) { @@ -709,13 +729,11 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] in #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") - func _invoke(_: Int32) -> Void - _invoke(callback.bridgeJSLowerParameter()) + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(callback.bridgeJSLowerParameter()) return Optional.bridgeJSLiftReturnFromSideChannel() #else fatalError("Only available on WebAssembly") - #endif + #endif } } } @@ -736,220 +754,160 @@ struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { let jsObject: JSObject func increment(by amount: Int) { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_increment") - func _extern_increment(this: Int32, amount: Int32) _extern_increment(this: Int32(bitPattern: jsObject.id), amount: amount.bridgeJSLowerParameter()) } func getValue() -> Int { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getValue") - func _extern_getValue(this: Int32) -> Int32 let ret = _extern_getValue(this: Int32(bitPattern: jsObject.id)) return Int.bridgeJSLiftReturn(ret) } func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_setLabelElements") - func _extern_setLabelElements(this: Int32, labelPrefix: Int32, labelSuffix: Int32) _extern_setLabelElements(this: Int32(bitPattern: jsObject.id), labelPrefix: labelPrefix.bridgeJSLowerParameter(), labelSuffix: labelSuffix.bridgeJSLowerParameter()) } func getLabel() -> String { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getLabel") - func _extern_getLabel(this: Int32) -> Int32 let ret = _extern_getLabel(this: Int32(bitPattern: jsObject.id)) return String.bridgeJSLiftReturn(ret) } func isEven() -> Bool { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_isEven") - func _extern_isEven(this: Int32) -> Int32 let ret = _extern_isEven(this: Int32(bitPattern: jsObject.id)) return Bool.bridgeJSLiftReturn(ret) } func processGreeter(_ greeter: Greeter) -> String { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processGreeter") - func _extern_processGreeter(this: Int32, greeter: UnsafeMutableRawPointer) -> Int32 let ret = _extern_processGreeter(this: Int32(bitPattern: jsObject.id), greeter: greeter.bridgeJSLowerParameter()) return String.bridgeJSLiftReturn(ret) } func createGreeter() -> Greeter { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createGreeter") - func _extern_createGreeter(this: Int32) -> UnsafeMutableRawPointer let ret = _extern_createGreeter(this: Int32(bitPattern: jsObject.id)) return Greeter.bridgeJSLiftReturn(ret) } func processOptionalGreeter(_ greeter: Optional) -> String { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processOptionalGreeter") - func _extern_processOptionalGreeter(this: Int32, greeterIsSome: Int32, greeterPointer: UnsafeMutableRawPointer) -> Int32 let (greeterIsSome, greeterPointer) = greeter.bridgeJSLowerParameterWithPresence() let ret = _extern_processOptionalGreeter(this: Int32(bitPattern: jsObject.id), greeterIsSome: greeterIsSome, greeterPointer: greeterPointer) return String.bridgeJSLiftReturn(ret) } func createOptionalGreeter() -> Optional { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createOptionalGreeter") - func _extern_createOptionalGreeter(this: Int32) -> UnsafeMutableRawPointer let ret = _extern_createOptionalGreeter(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturn(ret) } func handleAPIResult(_ result: Optional) { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_handleAPIResult") - func _extern_handleAPIResult(this: Int32, resultIsSome: Int32, resultCaseId: Int32) let (resultIsSome, resultCaseId) = result.bridgeJSLowerParameterWithPresence() _extern_handleAPIResult(this: Int32(bitPattern: jsObject.id), resultIsSome: resultIsSome, resultCaseId: resultCaseId) } func getAPIResult() -> Optional { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getAPIResult") - func _extern_getAPIResult(this: Int32) -> Int32 let ret = _extern_getAPIResult(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturn(ret) } var count: Int { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_DataProcessor_count_get(this: Int32(bitPattern: jsObject.id)) return Int.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_set") - func _extern_set(this: Int32, value: Int32) - _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + bjs_DataProcessor_count_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) } } var name: String { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_name_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_DataProcessor_name_get(this: Int32(bitPattern: jsObject.id)) return String.bridgeJSLiftReturn(ret) } } var optionalTag: Optional { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_get") - func _extern_get(this: Int32) - _extern_get(this: Int32(bitPattern: jsObject.id)) + bjs_DataProcessor_optionalTag_get(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_set") - func _extern_set(this: Int32, isSome: Int32, value: Int32) let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + bjs_DataProcessor_optionalTag_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) } } var optionalCount: Optional { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_get") - func _extern_get(this: Int32) - _extern_get(this: Int32(bitPattern: jsObject.id)) + bjs_DataProcessor_optionalCount_get(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_set") - func _extern_set(this: Int32, isSome: Int32, value: Int32) let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + bjs_DataProcessor_optionalCount_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) } } var direction: Optional { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_DataProcessor_direction_get(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_set") - func _extern_set(this: Int32, isSome: Int32, value: Int32) let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + bjs_DataProcessor_direction_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) } } var optionalTheme: Optional { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_get") - func _extern_get(this: Int32) - _extern_get(this: Int32(bitPattern: jsObject.id)) + bjs_DataProcessor_optionalTheme_get(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_set") - func _extern_set(this: Int32, isSome: Int32, value: Int32) let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + bjs_DataProcessor_optionalTheme_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) } } var httpStatus: Optional { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_get") - func _extern_get(this: Int32) - _extern_get(this: Int32(bitPattern: jsObject.id)) + bjs_DataProcessor_httpStatus_get(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_set") - func _extern_set(this: Int32, isSome: Int32, value: Int32) let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + bjs_DataProcessor_httpStatus_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) } } var apiResult: Optional { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_DataProcessor_apiResult_get(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_set") - func _extern_set(this: Int32, isSome: Int32, caseId: Int32) let (isSome, caseId) = newValue.bridgeJSLowerParameterWithPresence() - _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, caseId: caseId) + bjs_DataProcessor_apiResult_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, caseId: caseId) } } var helper: Greeter { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_get") - func _extern_get(this: Int32) -> UnsafeMutableRawPointer - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_DataProcessor_helper_get(this: Int32(bitPattern: jsObject.id)) return Greeter.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_set") - func _extern_set(this: Int32, pointer: UnsafeMutableRawPointer) - _extern_set(this: Int32(bitPattern: jsObject.id), pointer: newValue.bridgeJSLowerParameter()) + bjs_DataProcessor_helper_set(this: Int32(bitPattern: jsObject.id), pointer: newValue.bridgeJSLowerParameter()) } } var optionalHelper: Optional { get { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_get") - func _extern_get(this: Int32) -> UnsafeMutableRawPointer - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + let ret = bjs_DataProcessor_optionalHelper_get(this: Int32(bitPattern: jsObject.id)) return Optional.bridgeJSLiftReturn(ret) } set { - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_set") - func _extern_set(this: Int32, isSome: Int32, pointer: UnsafeMutableRawPointer) let (isSome, pointer) = newValue.bridgeJSLowerParameterWithPresence() - _extern_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, pointer: pointer) + bjs_DataProcessor_optionalHelper_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, pointer: pointer) } } @@ -958,6 +916,96 @@ struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { } } +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_increment") +fileprivate func _extern_increment(this: Int32, amount: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getValue") +fileprivate func _extern_getValue(this: Int32) -> Int32 + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_setLabelElements") +fileprivate func _extern_setLabelElements(this: Int32, labelPrefix: Int32, labelSuffix: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getLabel") +fileprivate func _extern_getLabel(this: Int32) -> Int32 + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_isEven") +fileprivate func _extern_isEven(this: Int32) -> Int32 + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processGreeter") +fileprivate func _extern_processGreeter(this: Int32, greeter: UnsafeMutableRawPointer) -> Int32 + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createGreeter") +fileprivate func _extern_createGreeter(this: Int32) -> UnsafeMutableRawPointer + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processOptionalGreeter") +fileprivate func _extern_processOptionalGreeter(this: Int32, greeterIsSome: Int32, greeterPointer: UnsafeMutableRawPointer) -> Int32 + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createOptionalGreeter") +fileprivate func _extern_createOptionalGreeter(this: Int32) -> UnsafeMutableRawPointer + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_handleAPIResult") +fileprivate func _extern_handleAPIResult(this: Int32, resultIsSome: Int32, resultCaseId: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getAPIResult") +fileprivate func _extern_getAPIResult(this: Int32) -> Int32 + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_get") +fileprivate func bjs_DataProcessor_count_get(this: Int32) -> Int32 + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_set") +fileprivate func bjs_DataProcessor_count_set(this: Int32, value: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_name_get") +fileprivate func bjs_DataProcessor_name_get(this: Int32) -> Int32 + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_get") +fileprivate func bjs_DataProcessor_optionalTag_get(this: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_set") +fileprivate func bjs_DataProcessor_optionalTag_set(this: Int32, isSome: Int32, value: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_get") +fileprivate func bjs_DataProcessor_optionalCount_get(this: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_set") +fileprivate func bjs_DataProcessor_optionalCount_set(this: Int32, isSome: Int32, value: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_get") +fileprivate func bjs_DataProcessor_direction_get(this: Int32) -> Int32 + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_set") +fileprivate func bjs_DataProcessor_direction_set(this: Int32, isSome: Int32, value: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_get") +fileprivate func bjs_DataProcessor_optionalTheme_get(this: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_set") +fileprivate func bjs_DataProcessor_optionalTheme_set(this: Int32, isSome: Int32, value: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_get") +fileprivate func bjs_DataProcessor_httpStatus_get(this: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_set") +fileprivate func bjs_DataProcessor_httpStatus_set(this: Int32, isSome: Int32, value: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_get") +fileprivate func bjs_DataProcessor_apiResult_get(this: Int32) -> Int32 + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_set") +fileprivate func bjs_DataProcessor_apiResult_set(this: Int32, isSome: Int32, caseId: Int32) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_get") +fileprivate func bjs_DataProcessor_helper_get(this: Int32) -> UnsafeMutableRawPointer + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_set") +fileprivate func bjs_DataProcessor_helper_set(this: Int32, pointer: UnsafeMutableRawPointer) + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_get") +fileprivate func bjs_DataProcessor_optionalHelper_get(this: Int32) -> UnsafeMutableRawPointer + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_set") +fileprivate func bjs_DataProcessor_optionalHelper_set(this: Int32, isSome: Int32, pointer: UnsafeMutableRawPointer) + extension Direction: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { return bridgeJSRawValue @@ -3377,18 +3425,19 @@ public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { public var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Greeter_wrap") - func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_Greeter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Greeter_wrap") +fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_Calculator_square") @_cdecl("bjs_Calculator_square") public func _bjs_Calculator_square(_self: UnsafeMutableRawPointer, value: Int32) -> Int32 { @@ -3419,18 +3468,19 @@ public func _bjs_Calculator_deinit(pointer: UnsafeMutableRawPointer) { extension Calculator: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Calculator_wrap") - func _bjs_Calculator_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_Calculator_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_Calculator_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Calculator_wrap") +fileprivate func _bjs_Calculator_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Calculator_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_InternalGreeter_deinit") @_cdecl("bjs_InternalGreeter_deinit") public func _bjs_InternalGreeter_deinit(pointer: UnsafeMutableRawPointer) { @@ -3439,18 +3489,19 @@ public func _bjs_InternalGreeter_deinit(pointer: UnsafeMutableRawPointer) { extension InternalGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { internal var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_InternalGreeter_wrap") - func _bjs_InternalGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_InternalGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_InternalGreeter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_InternalGreeter_wrap") +fileprivate func _bjs_InternalGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_InternalGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_PublicGreeter_deinit") @_cdecl("bjs_PublicGreeter_deinit") public func _bjs_PublicGreeter_deinit(pointer: UnsafeMutableRawPointer) { @@ -3459,18 +3510,19 @@ public func _bjs_PublicGreeter_deinit(pointer: UnsafeMutableRawPointer) { extension PublicGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { public var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PublicGreeter_wrap") - func _bjs_PublicGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_PublicGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_PublicGreeter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PublicGreeter_wrap") +fileprivate func _bjs_PublicGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PublicGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_PackageGreeter_deinit") @_cdecl("bjs_PackageGreeter_deinit") public func _bjs_PackageGreeter_deinit(pointer: UnsafeMutableRawPointer) { @@ -3479,18 +3531,19 @@ public func _bjs_PackageGreeter_deinit(pointer: UnsafeMutableRawPointer) { extension PackageGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { package var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PackageGreeter_wrap") - func _bjs_PackageGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_PackageGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_PackageGreeter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PackageGreeter_wrap") +fileprivate func _bjs_PackageGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PackageGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_Converter_init") @_cdecl("bjs_Converter_init") public func _bjs_Converter_init() -> UnsafeMutableRawPointer { @@ -3521,18 +3574,19 @@ public func _bjs_Converter_deinit(pointer: UnsafeMutableRawPointer) { extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Converter_wrap") - func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_Converter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Converter_wrap") +fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_HTTPServer_init") @_cdecl("bjs_HTTPServer_init") public func _bjs_HTTPServer_init() -> UnsafeMutableRawPointer { @@ -3562,18 +3616,19 @@ public func _bjs_HTTPServer_deinit(pointer: UnsafeMutableRawPointer) { extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_HTTPServer_wrap") - func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_HTTPServer_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_HTTPServer_wrap") +fileprivate func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_TestServer_init") @_cdecl("bjs_TestServer_init") public func _bjs_TestServer_init() -> UnsafeMutableRawPointer { @@ -3603,18 +3658,19 @@ public func _bjs_TestServer_deinit(pointer: UnsafeMutableRawPointer) { extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TestServer_wrap") - func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_TestServer_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TestServer_wrap") +fileprivate func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_OptionalPropertyHolder_init") @_cdecl("bjs_OptionalPropertyHolder_init") public func _bjs_OptionalPropertyHolder_init(optionalNameIsSome: Int32, optionalNameBytes: Int32, optionalNameLength: Int32) -> UnsafeMutableRawPointer { @@ -3697,18 +3753,19 @@ public func _bjs_OptionalPropertyHolder_deinit(pointer: UnsafeMutableRawPointer) extension OptionalPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalPropertyHolder_wrap") - func _bjs_OptionalPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_OptionalPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalPropertyHolder_wrap") +fileprivate func _bjs_OptionalPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_OptionalPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_SimplePropertyHolder_init") @_cdecl("bjs_SimplePropertyHolder_init") public func _bjs_SimplePropertyHolder_init(value: Int32) -> UnsafeMutableRawPointer { @@ -3749,18 +3806,19 @@ public func _bjs_SimplePropertyHolder_deinit(pointer: UnsafeMutableRawPointer) { extension SimplePropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SimplePropertyHolder_wrap") - func _bjs_SimplePropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_SimplePropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_SimplePropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SimplePropertyHolder_wrap") +fileprivate func _bjs_SimplePropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_SimplePropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_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 { @@ -4067,18 +4125,19 @@ public func _bjs_PropertyHolder_deinit(pointer: UnsafeMutableRawPointer) { extension PropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PropertyHolder_wrap") - func _bjs_PropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_PropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_PropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PropertyHolder_wrap") +fileprivate func _bjs_PropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_MathUtils_static_add") @_cdecl("bjs_MathUtils_static_add") public func _bjs_MathUtils_static_add(a: Int32, b: Int32) -> Int32 { @@ -4109,18 +4168,19 @@ public func _bjs_MathUtils_deinit(pointer: UnsafeMutableRawPointer) { extension MathUtils: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MathUtils_wrap") - func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_MathUtils_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MathUtils_wrap") +fileprivate func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_ConstructorDefaults_init") @_cdecl("bjs_ConstructorDefaults_init") public func _bjs_ConstructorDefaults_init(nameBytes: Int32, nameLength: Int32, count: Int32, enabled: Int32, status: Int32, tagIsSome: Int32, tagBytes: Int32, tagLength: Int32) -> UnsafeMutableRawPointer { @@ -4256,18 +4316,19 @@ public func _bjs_ConstructorDefaults_deinit(pointer: UnsafeMutableRawPointer) { extension ConstructorDefaults: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ConstructorDefaults_wrap") - func _bjs_ConstructorDefaults_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_ConstructorDefaults_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_ConstructorDefaults_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ConstructorDefaults_wrap") +fileprivate func _bjs_ConstructorDefaults_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ConstructorDefaults_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_StaticPropertyHolder_init") @_cdecl("bjs_StaticPropertyHolder_init") public func _bjs_StaticPropertyHolder_init() -> UnsafeMutableRawPointer { @@ -4498,18 +4559,19 @@ public func _bjs_StaticPropertyHolder_deinit(pointer: UnsafeMutableRawPointer) { extension StaticPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticPropertyHolder_wrap") - func _bjs_StaticPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_StaticPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_StaticPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticPropertyHolder_wrap") +fileprivate func _bjs_StaticPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_StaticPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_DataProcessorManager_init") @_cdecl("bjs_DataProcessorManager_init") public func _bjs_DataProcessorManager_init(processor: Int32) -> UnsafeMutableRawPointer { @@ -4784,18 +4846,19 @@ public func _bjs_DataProcessorManager_deinit(pointer: UnsafeMutableRawPointer) { extension DataProcessorManager: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessorManager_wrap") - func _bjs_DataProcessorManager_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_DataProcessorManager_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_DataProcessorManager_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessorManager_wrap") +fileprivate func _bjs_DataProcessorManager_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_DataProcessorManager_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_SwiftDataProcessor_init") @_cdecl("bjs_SwiftDataProcessor_init") public func _bjs_SwiftDataProcessor_init() -> UnsafeMutableRawPointer { @@ -5133,18 +5196,19 @@ public func _bjs_SwiftDataProcessor_deinit(pointer: UnsafeMutableRawPointer) { extension SwiftDataProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftDataProcessor_wrap") - func _bjs_SwiftDataProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_SwiftDataProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_SwiftDataProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftDataProcessor_wrap") +fileprivate func _bjs_SwiftDataProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_SwiftDataProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_TextProcessor_init") @_cdecl("bjs_TextProcessor_init") public func _bjs_TextProcessor_init(transform: Int32) -> UnsafeMutableRawPointer { @@ -5384,14 +5448,15 @@ public func _bjs_TextProcessor_deinit(pointer: UnsafeMutableRawPointer) { extension TextProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TextProcessor_wrap") - func _bjs_TextProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_TextProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_TextProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TextProcessor_wrap") +fileprivate func _bjs_TextProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_TextProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift index 19bc82fcb..0936983e7 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift @@ -6,30 +6,32 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripVoid") +func bjs_jsRoundTripVoid() -> Void +#else +func bjs_jsRoundTripVoid() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func jsRoundTripVoid() throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripVoid") - func bjs_jsRoundTripVoid() -> Void - #else - func bjs_jsRoundTripVoid() -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_jsRoundTripVoid() if let error = _swift_js_take_exception() { throw error } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripNumber") +func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 +#else +func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + func jsRoundTripNumber(_ v: Double) throws(JSException) -> Double { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripNumber") - func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 - #else - func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_jsRoundTripNumber(v.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -37,15 +39,16 @@ func jsRoundTripNumber(_ v: Double) throws(JSException) -> Double { return Double.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripBool") +func bjs_jsRoundTripBool(_ v: Int32) -> Int32 +#else +func bjs_jsRoundTripBool(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func jsRoundTripBool(_ v: Bool) throws(JSException) -> Bool { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripBool") - func bjs_jsRoundTripBool(_ v: Int32) -> Int32 - #else - func bjs_jsRoundTripBool(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_jsRoundTripBool(v.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -53,15 +56,16 @@ func jsRoundTripBool(_ v: Bool) throws(JSException) -> Bool { return Bool.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripString") +func bjs_jsRoundTripString(_ v: Int32) -> Int32 +#else +func bjs_jsRoundTripString(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func jsRoundTripString(_ v: String) throws(JSException) -> String { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripString") - func bjs_jsRoundTripString(_ v: Int32) -> Int32 - #else - func bjs_jsRoundTripString(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_jsRoundTripString(v.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -69,30 +73,32 @@ func jsRoundTripString(_ v: String) throws(JSException) -> String { return String.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrVoid") +func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void +#else +func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrVoid") - func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void - #else - func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_jsThrowOrVoid(shouldThrow.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrNumber") +func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 +#else +func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + func jsThrowOrNumber(_ shouldThrow: Bool) throws(JSException) -> Double { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrNumber") - func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 - #else - func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_jsThrowOrNumber(shouldThrow.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -100,15 +106,16 @@ func jsThrowOrNumber(_ shouldThrow: Bool) throws(JSException) -> Double { return Double.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrBool") +func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 +#else +func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func jsThrowOrBool(_ shouldThrow: Bool) throws(JSException) -> Bool { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrBool") - func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 - #else - func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_jsThrowOrBool(shouldThrow.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -116,15 +123,16 @@ func jsThrowOrBool(_ shouldThrow: Bool) throws(JSException) -> Bool { return Bool.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrString") +func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 +#else +func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func jsThrowOrString(_ shouldThrow: Bool) throws(JSException) -> String { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrString") - func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 - #else - func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_jsThrowOrString(shouldThrow.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -132,15 +140,16 @@ func jsThrowOrString(_ shouldThrow: Bool) throws(JSException) -> String { return String.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_runAsyncWorks") +func bjs_runAsyncWorks() -> Int32 +#else +func bjs_runAsyncWorks() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + func runAsyncWorks() throws(JSException) -> JSPromise { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_runAsyncWorks") - func bjs_runAsyncWorks() -> Int32 - #else - func bjs_runAsyncWorks() -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_runAsyncWorks() if let error = _swift_js_take_exception() { throw error @@ -148,6 +157,60 @@ func runAsyncWorks() throws(JSException) -> JSPromise { return JSPromise.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_init") +func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 +#else +func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_get") +func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 +#else +func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_set") +func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void +#else +func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_prefix_get") +func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 +#else +func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_greet") +func bjs_JsGreeter_greet(_ self: Int32) -> Int32 +#else +func bjs_JsGreeter_greet(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_changeName") +func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void +#else +func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + struct JsGreeter: _JSBridgedClass { let jsObject: JSObject @@ -156,14 +219,6 @@ struct JsGreeter: _JSBridgedClass { } init(_ name: String, _ prefix: String) throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_init") - func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 - #else - func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_JsGreeter_init(name.bridgeJSLowerParameter(), prefix.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -173,14 +228,6 @@ struct JsGreeter: _JSBridgedClass { var name: String { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_get") - func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 - #else - func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_JsGreeter_name_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -190,14 +237,6 @@ struct JsGreeter: _JSBridgedClass { } func setName(_ newValue: String) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_set") - func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void - #else - func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_JsGreeter_name_set(self.bridgeJSLowerParameter(), newValue.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -206,14 +245,6 @@ struct JsGreeter: _JSBridgedClass { var prefix: String { get throws(JSException) { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_prefix_get") - func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 - #else - func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_JsGreeter_prefix_get(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -223,14 +254,6 @@ struct JsGreeter: _JSBridgedClass { } func greet() throws(JSException) -> String { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_greet") - func bjs_JsGreeter_greet(_ self: Int32) -> Int32 - #else - func bjs_JsGreeter_greet(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif let ret = bjs_JsGreeter_greet(self.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error @@ -239,14 +262,6 @@ struct JsGreeter: _JSBridgedClass { } func changeName(_ name: String) throws(JSException) -> Void { - #if arch(wasm32) - @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_changeName") - func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void - #else - func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void { - fatalError("Only available on WebAssembly") - } - #endif bjs_JsGreeter_changeName(self.bridgeJSLowerParameter(), name.bridgeJSLowerParameter()) if let error = _swift_js_take_exception() { throw error From 6716b0789720c7f4be6fbef0c3e838f63fca818d Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 27 Nov 2025 03:46:12 +0000 Subject: [PATCH 036/252] BridgeJS: Ensure extern func decl won't be visible outside of the generated file --- .../Sources/Generated/BridgeJS.ImportTS.swift | 12 ++-- .../Generated/BridgeJS.ImportTS.swift | 8 +-- .../Sources/BridgeJSCore/ExportSwift.swift | 4 +- .../Sources/BridgeJSCore/ImportTS.swift | 3 + .../ImportTSTests/ArrayParameter.swift | 12 ++-- .../__Snapshots__/ImportTSTests/Async.swift | 28 ++++----- .../ImportTSTests/Interface.swift | 12 ++-- .../ImportTSTests/InvalidPropertyNames.swift | 44 +++++++------- .../ImportTSTests/MultipleImportedTypes.swift | 56 ++++++++--------- .../ImportTSTests/PrimitiveParameters.swift | 4 +- .../ImportTSTests/PrimitiveReturn.swift | 8 +-- .../ImportTSTests/StringParameter.swift | 8 +-- .../ImportTSTests/StringReturn.swift | 4 +- .../ImportTSTests/TS2SkeletonLike.swift | 28 ++++----- .../ImportTSTests/TypeAlias.swift | 4 +- .../ImportTSTests/TypeScriptClass.swift | 24 ++++---- .../VoidParameterVoidReturn.swift | 4 +- .../Generated/BridgeJS.ImportTS.swift | 60 +++++++++---------- 18 files changed, 163 insertions(+), 160 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift b/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift index 721f089d8..e885569de 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoop") -func bjs_benchmarkHelperNoop() -> Void +fileprivate func bjs_benchmarkHelperNoop() -> Void #else -func bjs_benchmarkHelperNoop() -> Void { +fileprivate func bjs_benchmarkHelperNoop() -> Void { fatalError("Only available on WebAssembly") } #endif @@ -24,9 +24,9 @@ func benchmarkHelperNoop() throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoopWithNumber") -func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void +fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void #else -func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void { +fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -40,9 +40,9 @@ func benchmarkHelperNoopWithNumber(_ n: Double) throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkRunner") -func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void +fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void #else -func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void { +fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift index 5864feb5d..fca5dcb20 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "PlayBridgeJS", name: "bjs_createTS2Skeleton") -func bjs_createTS2Skeleton() -> Int32 +fileprivate func bjs_createTS2Skeleton() -> Int32 #else -func bjs_createTS2Skeleton() -> Int32 { +fileprivate func bjs_createTS2Skeleton() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -25,9 +25,9 @@ func createTS2Skeleton() throws(JSException) -> TS2Skeleton { #if arch(wasm32) @_extern(wasm, module: "PlayBridgeJS", name: "bjs_TS2Skeleton_convert") -func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 +fileprivate func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 #else -func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 { +fileprivate func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index b061716dc..0938bfcf3 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -2501,11 +2501,11 @@ public class ExportSwift { /// ```swift /// extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { /// var jsValue: JSValue { - /// @_extern(wasm, module: "MyModule", name: "bjs_Greeter_wrap") - /// func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 /// return JSObject(id: UInt32(bitPattern: _bjs_Greeter_wrap(Unmanaged.passRetained(self).toOpaque()))) /// } /// } + /// @_extern(wasm, module: "MyModule", name: "bjs_Greeter_wrap") + /// fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 /// ``` func renderConvertibleToJSValueExtension(klass: ExportedClass) -> [DeclSyntax] { let wrapFunctionName = "_bjs_\(klass.name)_wrap" diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 39a735f06..00ef5399b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -116,6 +116,9 @@ public struct ImportTS { func renderImportDecl() -> DeclSyntax { let baseDecl = FunctionDeclSyntax( + modifiers: DeclModifierListSyntax(itemsBuilder: { + DeclModifierSyntax(name: .keyword(.fileprivate)).with(\.trailingTrivia, .space) + }), funcKeyword: .keyword(.func).with(\.trailingTrivia, .space), name: .identifier(abiName), signature: FunctionSignatureSyntax( diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift index 6a624246e..1806d8aad 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_checkArray") -func bjs_checkArray(_ a: Int32) -> Void +fileprivate func bjs_checkArray(_ a: Int32) -> Void #else -func bjs_checkArray(_ a: Int32) -> Void { +fileprivate func bjs_checkArray(_ a: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -24,9 +24,9 @@ func checkArray(_ a: JSObject) throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_checkArrayWithLength") -func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void +fileprivate func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void #else -func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void { +fileprivate func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -40,9 +40,9 @@ func checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Voi #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_checkArray") -func bjs_checkArray(_ a: Int32) -> Void +fileprivate func bjs_checkArray(_ a: Int32) -> Void #else -func bjs_checkArray(_ a: Int32) -> Void { +fileprivate func bjs_checkArray(_ a: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift index 36ad4cd30..5e564aa3a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_asyncReturnVoid") -func bjs_asyncReturnVoid() -> Int32 +fileprivate func bjs_asyncReturnVoid() -> Int32 #else -func bjs_asyncReturnVoid() -> Int32 { +fileprivate func bjs_asyncReturnVoid() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -25,9 +25,9 @@ func asyncReturnVoid() throws(JSException) -> JSPromise { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_asyncRoundTripInt") -func bjs_asyncRoundTripInt(_ v: Float64) -> Int32 +fileprivate func bjs_asyncRoundTripInt(_ v: Float64) -> Int32 #else -func bjs_asyncRoundTripInt(_ v: Float64) -> Int32 { +fileprivate func bjs_asyncRoundTripInt(_ v: Float64) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -42,9 +42,9 @@ func asyncRoundTripInt(_ v: Double) throws(JSException) -> JSPromise { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_asyncRoundTripString") -func bjs_asyncRoundTripString(_ v: Int32) -> Int32 +fileprivate func bjs_asyncRoundTripString(_ v: Int32) -> Int32 #else -func bjs_asyncRoundTripString(_ v: Int32) -> Int32 { +fileprivate func bjs_asyncRoundTripString(_ v: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -59,9 +59,9 @@ func asyncRoundTripString(_ v: String) throws(JSException) -> JSPromise { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_asyncRoundTripBool") -func bjs_asyncRoundTripBool(_ v: Int32) -> Int32 +fileprivate func bjs_asyncRoundTripBool(_ v: Int32) -> Int32 #else -func bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { +fileprivate func bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -76,9 +76,9 @@ func asyncRoundTripBool(_ v: Bool) throws(JSException) -> JSPromise { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_asyncRoundTripFloat") -func bjs_asyncRoundTripFloat(_ v: Float64) -> Int32 +fileprivate func bjs_asyncRoundTripFloat(_ v: Float64) -> Int32 #else -func bjs_asyncRoundTripFloat(_ v: Float64) -> Int32 { +fileprivate func bjs_asyncRoundTripFloat(_ v: Float64) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -93,9 +93,9 @@ func asyncRoundTripFloat(_ v: Double) throws(JSException) -> JSPromise { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_asyncRoundTripDouble") -func bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 +fileprivate func bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 #else -func bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { +fileprivate func bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -110,9 +110,9 @@ func asyncRoundTripDouble(_ v: Double) throws(JSException) -> JSPromise { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_asyncRoundTripJSObject") -func bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 +fileprivate func bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 #else -func bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { +fileprivate func bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift index e0571d5f1..12e04e054 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_returnAnimatable") -func bjs_returnAnimatable() -> Int32 +fileprivate func bjs_returnAnimatable() -> Int32 #else -func bjs_returnAnimatable() -> Int32 { +fileprivate func bjs_returnAnimatable() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -25,18 +25,18 @@ func returnAnimatable() throws(JSException) -> Animatable { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_Animatable_animate") -func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 +fileprivate func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 #else -func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 { +fileprivate func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_Animatable_getAnimations") -func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 +fileprivate func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 #else -func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 { +fileprivate func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift index 2d04f47e6..9fa2feafb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_createArrayBuffer") -func bjs_createArrayBuffer() -> Int32 +fileprivate func bjs_createArrayBuffer() -> Int32 #else -func bjs_createArrayBuffer() -> Int32 { +fileprivate func bjs_createArrayBuffer() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -25,9 +25,9 @@ func createArrayBuffer() throws(JSException) -> ArrayBufferLike { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_createWeirdObject") -func bjs_createWeirdObject() -> Int32 +fileprivate func bjs_createWeirdObject() -> Int32 #else -func bjs_createWeirdObject() -> Int32 { +fileprivate func bjs_createWeirdObject() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -42,18 +42,18 @@ func createWeirdObject() throws(JSException) -> WeirdNaming { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_ArrayBufferLike_byteLength_get") -func bjs_ArrayBufferLike_byteLength_get(_ self: Int32) -> Float64 +fileprivate func bjs_ArrayBufferLike_byteLength_get(_ self: Int32) -> Float64 #else -func bjs_ArrayBufferLike_byteLength_get(_ self: Int32) -> Float64 { +fileprivate func bjs_ArrayBufferLike_byteLength_get(_ self: Int32) -> Float64 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_ArrayBufferLike_slice") -func bjs_ArrayBufferLike_slice(_ self: Int32, _ begin: Float64, _ end: Float64) -> Int32 +fileprivate func bjs_ArrayBufferLike_slice(_ self: Int32, _ begin: Float64, _ end: Float64) -> Int32 #else -func bjs_ArrayBufferLike_slice(_ self: Int32, _ begin: Float64, _ end: Float64) -> Int32 { +fileprivate func bjs_ArrayBufferLike_slice(_ self: Int32, _ begin: Float64, _ end: Float64) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -87,63 +87,63 @@ struct ArrayBufferLike: _JSBridgedClass { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_normalProperty_get") -func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 +fileprivate func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 #else -func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_normalProperty_set") -func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void #else -func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_get") -func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 +fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 #else -func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_set") -func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void #else -func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_Any_get") -func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 +fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 #else -func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_Any_set") -func bjs_WeirdNaming_Any_set(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_WeirdNaming_Any_set(_ self: Int32, _ newValue: Int32) -> Void #else -func bjs_WeirdNaming_Any_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_WeirdNaming_Any_set(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_as") -func bjs_WeirdNaming_as(_ self: Int32) -> Void +fileprivate func bjs_WeirdNaming_as(_ self: Int32) -> Void #else -func bjs_WeirdNaming_as(_ self: Int32) -> Void { +fileprivate func bjs_WeirdNaming_as(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift index 288382150..3102cd6e8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_createDatabaseConnection") -func bjs_createDatabaseConnection(_ config: Int32) -> Int32 +fileprivate func bjs_createDatabaseConnection(_ config: Int32) -> Int32 #else -func bjs_createDatabaseConnection(_ config: Int32) -> Int32 { +fileprivate func bjs_createDatabaseConnection(_ config: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -25,9 +25,9 @@ func createDatabaseConnection(_ config: JSObject) throws(JSException) -> Databas #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_createLogger") -func bjs_createLogger(_ level: Int32) -> Int32 +fileprivate func bjs_createLogger(_ level: Int32) -> Int32 #else -func bjs_createLogger(_ level: Int32) -> Int32 { +fileprivate func bjs_createLogger(_ level: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -42,9 +42,9 @@ func createLogger(_ level: String) throws(JSException) -> Logger { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_getConfigManager") -func bjs_getConfigManager() -> Int32 +fileprivate func bjs_getConfigManager() -> Int32 #else -func bjs_getConfigManager() -> Int32 { +fileprivate func bjs_getConfigManager() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -59,45 +59,45 @@ func getConfigManager() throws(JSException) -> ConfigManager { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_isConnected_get") -func bjs_DatabaseConnection_isConnected_get(_ self: Int32) -> Int32 +fileprivate func bjs_DatabaseConnection_isConnected_get(_ self: Int32) -> Int32 #else -func bjs_DatabaseConnection_isConnected_get(_ self: Int32) -> Int32 { +fileprivate func bjs_DatabaseConnection_isConnected_get(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connectionTimeout_get") -func bjs_DatabaseConnection_connectionTimeout_get(_ self: Int32) -> Float64 +fileprivate func bjs_DatabaseConnection_connectionTimeout_get(_ self: Int32) -> Float64 #else -func bjs_DatabaseConnection_connectionTimeout_get(_ self: Int32) -> Float64 { +fileprivate func bjs_DatabaseConnection_connectionTimeout_get(_ self: Int32) -> Float64 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connectionTimeout_set") -func bjs_DatabaseConnection_connectionTimeout_set(_ self: Int32, _ newValue: Float64) -> Void +fileprivate func bjs_DatabaseConnection_connectionTimeout_set(_ self: Int32, _ newValue: Float64) -> Void #else -func bjs_DatabaseConnection_connectionTimeout_set(_ self: Int32, _ newValue: Float64) -> Void { +fileprivate func bjs_DatabaseConnection_connectionTimeout_set(_ self: Int32, _ newValue: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connect") -func bjs_DatabaseConnection_connect(_ self: Int32, _ url: Int32) -> Void +fileprivate func bjs_DatabaseConnection_connect(_ self: Int32, _ url: Int32) -> Void #else -func bjs_DatabaseConnection_connect(_ self: Int32, _ url: Int32) -> Void { +fileprivate func bjs_DatabaseConnection_connect(_ self: Int32, _ url: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_execute") -func bjs_DatabaseConnection_execute(_ self: Int32, _ query: Int32) -> Int32 +fileprivate func bjs_DatabaseConnection_execute(_ self: Int32, _ query: Int32) -> Int32 #else -func bjs_DatabaseConnection_execute(_ self: Int32, _ query: Int32) -> Int32 { +fileprivate func bjs_DatabaseConnection_execute(_ self: Int32, _ query: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -155,27 +155,27 @@ struct DatabaseConnection: _JSBridgedClass { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_Logger_level_get") -func bjs_Logger_level_get(_ self: Int32) -> Int32 +fileprivate func bjs_Logger_level_get(_ self: Int32) -> Int32 #else -func bjs_Logger_level_get(_ self: Int32) -> Int32 { +fileprivate func bjs_Logger_level_get(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_Logger_log") -func bjs_Logger_log(_ self: Int32, _ message: Int32) -> Void +fileprivate func bjs_Logger_log(_ self: Int32, _ message: Int32) -> Void #else -func bjs_Logger_log(_ self: Int32, _ message: Int32) -> Void { +fileprivate func bjs_Logger_log(_ self: Int32, _ message: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_Logger_error") -func bjs_Logger_error(_ self: Int32, _ message: Int32, _ error: Int32) -> Void +fileprivate func bjs_Logger_error(_ self: Int32, _ message: Int32, _ error: Int32) -> Void #else -func bjs_Logger_error(_ self: Int32, _ message: Int32, _ error: Int32) -> Void { +fileprivate func bjs_Logger_error(_ self: Int32, _ message: Int32, _ error: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -215,27 +215,27 @@ struct Logger: _JSBridgedClass { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_ConfigManager_configPath_get") -func bjs_ConfigManager_configPath_get(_ self: Int32) -> Int32 +fileprivate func bjs_ConfigManager_configPath_get(_ self: Int32) -> Int32 #else -func bjs_ConfigManager_configPath_get(_ self: Int32) -> Int32 { +fileprivate func bjs_ConfigManager_configPath_get(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_ConfigManager_get") -func bjs_ConfigManager_get(_ self: Int32, _ key: Int32) -> Int32 +fileprivate func bjs_ConfigManager_get(_ self: Int32, _ key: Int32) -> Int32 #else -func bjs_ConfigManager_get(_ self: Int32, _ key: Int32) -> Int32 { +fileprivate func bjs_ConfigManager_get(_ self: Int32, _ key: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_ConfigManager_set") -func bjs_ConfigManager_set(_ self: Int32, _ key: Int32, _ value: Int32) -> Void +fileprivate func bjs_ConfigManager_set(_ self: Int32, _ key: Int32, _ value: Int32) -> Void #else -func bjs_ConfigManager_set(_ self: Int32, _ key: Int32, _ value: Int32) -> Void { +fileprivate func bjs_ConfigManager_set(_ self: Int32, _ key: Int32, _ value: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift index 00d220eab..2643eaa08 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_check") -func bjs_check(_ a: Float64, _ b: Int32) -> Void +fileprivate func bjs_check(_ a: Float64, _ b: Int32) -> Void #else -func bjs_check(_ a: Float64, _ b: Int32) -> Void { +fileprivate func bjs_check(_ a: Float64, _ b: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift index b33250625..6424329b5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_checkNumber") -func bjs_checkNumber() -> Float64 +fileprivate func bjs_checkNumber() -> Float64 #else -func bjs_checkNumber() -> Float64 { +fileprivate func bjs_checkNumber() -> Float64 { fatalError("Only available on WebAssembly") } #endif @@ -25,9 +25,9 @@ func checkNumber() throws(JSException) -> Double { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_checkBoolean") -func bjs_checkBoolean() -> Int32 +fileprivate func bjs_checkBoolean() -> Int32 #else -func bjs_checkBoolean() -> Int32 { +fileprivate func bjs_checkBoolean() -> Int32 { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift index fdaf7c49d..68b341ca7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_checkString") -func bjs_checkString(_ a: Int32) -> Void +fileprivate func bjs_checkString(_ a: Int32) -> Void #else -func bjs_checkString(_ a: Int32) -> Void { +fileprivate func bjs_checkString(_ a: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -24,9 +24,9 @@ func checkString(_ a: String) throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_checkStringWithLength") -func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void +fileprivate func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void #else -func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void { +fileprivate func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift index 9edc42cf8..638eedb05 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_checkString") -func bjs_checkString() -> Int32 +fileprivate func bjs_checkString() -> Int32 #else -func bjs_checkString() -> Int32 { +fileprivate func bjs_checkString() -> Int32 { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift index 23e8ea7df..2e4331c78 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_createTS2Skeleton") -func bjs_createTS2Skeleton() -> Int32 +fileprivate func bjs_createTS2Skeleton() -> Int32 #else -func bjs_createTS2Skeleton() -> Int32 { +fileprivate func bjs_createTS2Skeleton() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -25,9 +25,9 @@ func createTS2Skeleton() throws(JSException) -> TypeScriptProcessor { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_createCodeGenerator") -func bjs_createCodeGenerator(_ format: Int32) -> Int32 +fileprivate func bjs_createCodeGenerator(_ format: Int32) -> Int32 #else -func bjs_createCodeGenerator(_ format: Int32) -> Int32 { +fileprivate func bjs_createCodeGenerator(_ format: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -42,27 +42,27 @@ func createCodeGenerator(_ format: String) throws(JSException) -> CodeGenerator #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_version_get") -func bjs_TypeScriptProcessor_version_get(_ self: Int32) -> Int32 +fileprivate func bjs_TypeScriptProcessor_version_get(_ self: Int32) -> Int32 #else -func bjs_TypeScriptProcessor_version_get(_ self: Int32) -> Int32 { +fileprivate func bjs_TypeScriptProcessor_version_get(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_convert") -func bjs_TypeScriptProcessor_convert(_ self: Int32, _ ts: Int32) -> Int32 +fileprivate func bjs_TypeScriptProcessor_convert(_ self: Int32, _ ts: Int32) -> Int32 #else -func bjs_TypeScriptProcessor_convert(_ self: Int32, _ ts: Int32) -> Int32 { +fileprivate func bjs_TypeScriptProcessor_convert(_ self: Int32, _ ts: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_validate") -func bjs_TypeScriptProcessor_validate(_ self: Int32, _ ts: Int32) -> Int32 +fileprivate func bjs_TypeScriptProcessor_validate(_ self: Int32, _ ts: Int32) -> Int32 #else -func bjs_TypeScriptProcessor_validate(_ self: Int32, _ ts: Int32) -> Int32 { +fileprivate func bjs_TypeScriptProcessor_validate(_ self: Int32, _ ts: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -104,18 +104,18 @@ struct TypeScriptProcessor: _JSBridgedClass { #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_CodeGenerator_outputFormat_get") -func bjs_CodeGenerator_outputFormat_get(_ self: Int32) -> Int32 +fileprivate func bjs_CodeGenerator_outputFormat_get(_ self: Int32) -> Int32 #else -func bjs_CodeGenerator_outputFormat_get(_ self: Int32) -> Int32 { +fileprivate func bjs_CodeGenerator_outputFormat_get(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_CodeGenerator_generate") -func bjs_CodeGenerator_generate(_ self: Int32, _ input: Int32) -> Int32 +fileprivate func bjs_CodeGenerator_generate(_ self: Int32, _ input: Int32) -> Int32 #else -func bjs_CodeGenerator_generate(_ self: Int32, _ input: Int32) -> Int32 { +fileprivate func bjs_CodeGenerator_generate(_ self: Int32, _ input: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift index d007caf63..e539e65df 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_checkSimple") -func bjs_checkSimple(_ a: Float64) -> Void +fileprivate func bjs_checkSimple(_ a: Float64) -> Void #else -func bjs_checkSimple(_ a: Float64) -> Void { +fileprivate func bjs_checkSimple(_ a: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift index 7fe7133db..148419de2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift @@ -8,54 +8,54 @@ #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_Greeter_init") -func bjs_Greeter_init(_ name: Int32) -> Int32 +fileprivate func bjs_Greeter_init(_ name: Int32) -> Int32 #else -func bjs_Greeter_init(_ name: Int32) -> Int32 { +fileprivate func bjs_Greeter_init(_ name: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_Greeter_name_get") -func bjs_Greeter_name_get(_ self: Int32) -> Int32 +fileprivate func bjs_Greeter_name_get(_ self: Int32) -> Int32 #else -func bjs_Greeter_name_get(_ self: Int32) -> Int32 { +fileprivate func bjs_Greeter_name_get(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_Greeter_name_set") -func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void #else -func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_Greeter_age_get") -func bjs_Greeter_age_get(_ self: Int32) -> Float64 +fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 #else -func bjs_Greeter_age_get(_ self: Int32) -> Float64 { +fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_Greeter_greet") -func bjs_Greeter_greet(_ self: Int32) -> Int32 +fileprivate func bjs_Greeter_greet(_ self: Int32) -> Int32 #else -func bjs_Greeter_greet(_ self: Int32) -> Int32 { +fileprivate func bjs_Greeter_greet(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_Greeter_changeName") -func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void +fileprivate func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void #else -func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void { +fileprivate func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift index a5ac5afc4..511678471 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_check") -func bjs_check() -> Void +fileprivate func bjs_check() -> Void #else -func bjs_check() -> Void { +fileprivate func bjs_check() -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift index 0936983e7..e75febb86 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift @@ -8,9 +8,9 @@ #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripVoid") -func bjs_jsRoundTripVoid() -> Void +fileprivate func bjs_jsRoundTripVoid() -> Void #else -func bjs_jsRoundTripVoid() -> Void { +fileprivate func bjs_jsRoundTripVoid() -> Void { fatalError("Only available on WebAssembly") } #endif @@ -24,9 +24,9 @@ func jsRoundTripVoid() throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripNumber") -func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 +fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 #else -func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 { +fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 { fatalError("Only available on WebAssembly") } #endif @@ -41,9 +41,9 @@ func jsRoundTripNumber(_ v: Double) throws(JSException) -> Double { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripBool") -func bjs_jsRoundTripBool(_ v: Int32) -> Int32 +fileprivate func bjs_jsRoundTripBool(_ v: Int32) -> Int32 #else -func bjs_jsRoundTripBool(_ v: Int32) -> Int32 { +fileprivate func bjs_jsRoundTripBool(_ v: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -58,9 +58,9 @@ func jsRoundTripBool(_ v: Bool) throws(JSException) -> Bool { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripString") -func bjs_jsRoundTripString(_ v: Int32) -> Int32 +fileprivate func bjs_jsRoundTripString(_ v: Int32) -> Int32 #else -func bjs_jsRoundTripString(_ v: Int32) -> Int32 { +fileprivate func bjs_jsRoundTripString(_ v: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -75,9 +75,9 @@ func jsRoundTripString(_ v: String) throws(JSException) -> String { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrVoid") -func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void +fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void #else -func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void { +fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -91,9 +91,9 @@ func jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrNumber") -func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 +fileprivate func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 #else -func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 { +fileprivate func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 { fatalError("Only available on WebAssembly") } #endif @@ -108,9 +108,9 @@ func jsThrowOrNumber(_ shouldThrow: Bool) throws(JSException) -> Double { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrBool") -func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 +fileprivate func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 #else -func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 { +fileprivate func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -125,9 +125,9 @@ func jsThrowOrBool(_ shouldThrow: Bool) throws(JSException) -> Bool { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrString") -func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 +fileprivate func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 #else -func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 { +fileprivate func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -142,9 +142,9 @@ func jsThrowOrString(_ shouldThrow: Bool) throws(JSException) -> String { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_runAsyncWorks") -func bjs_runAsyncWorks() -> Int32 +fileprivate func bjs_runAsyncWorks() -> Int32 #else -func bjs_runAsyncWorks() -> Int32 { +fileprivate func bjs_runAsyncWorks() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -159,54 +159,54 @@ func runAsyncWorks() throws(JSException) -> JSPromise { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_init") -func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 +fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 #else -func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 { +fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_get") -func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 +fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 #else -func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 { +fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_set") -func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void #else -func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_prefix_get") -func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 +fileprivate func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 #else -func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 { +fileprivate func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_greet") -func bjs_JsGreeter_greet(_ self: Int32) -> Int32 +fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 #else -func bjs_JsGreeter_greet(_ self: Int32) -> Int32 { +fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_changeName") -func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void +fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void #else -func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void { +fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif From 3c1481514a8b94ceb05af201c058bf05d87e9a99 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Nov 2025 12:51:04 +0900 Subject: [PATCH 037/252] Bump actions/checkout from 5 to 6 (#470) Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5df11d0aa..487b008e2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: JAVASCRIPTKIT_WASI_BACKEND: ${{ matrix.entry.wasi-backend }} steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - uses: ./.github/actions/install-swift with: download-url: ${{ matrix.entry.toolchain.download-url }} @@ -69,7 +69,7 @@ jobs: xcode: Xcode_16.4 runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - run: swift build --package-path ./Examples/Basic env: DEVELOPER_DIR: /Applications/${{ matrix.xcode }}.app/Contents/Developer/ @@ -79,7 +79,7 @@ jobs: container: image: swift:6.1.2 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - run: ./Utilities/format.swift - name: Check for formatting changes run: | @@ -92,7 +92,7 @@ jobs: check-bridgejs-generated: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: ./.github/actions/install-swift with: download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a-ubuntu22.04.tar.gz @@ -109,7 +109,7 @@ jobs: build-examples: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: ./.github/actions/install-swift with: download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a-ubuntu22.04.tar.gz From 30ae01a8a99e4ce6381c8dd022351314a162f246 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 20 Nov 2025 13:40:49 +0200 Subject: [PATCH 038/252] BridgeJS: Optional global namespace generation --- .../Sources/PlayBridgeJS/main.swift | 3 +- .../Sources/BridgeJSCore/ExportSwift.swift | 8 + .../Sources/BridgeJSLink/BridgeJSLink.swift | 231 ++++++++--- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 3 + .../BridgeJSToolTests/BridgeJSLinkTests.swift | 50 ++- .../EnumAssociatedValue.Export.d.ts | 6 +- .../EnumNamespace.Export.d.ts | 12 +- .../EnumNamespace_NoGlobal.Export.d.ts | 101 +++++ .../EnumNamespace_NoGlobal.Export.js | 323 +++++++++++++++ .../Namespaces_NoGlobal.Export.d.ts | 55 +++ .../Namespaces_NoGlobal.Export.js | 311 ++++++++++++++ .../StaticFunctions_NoGlobal.Export.d.ts | 63 +++ .../StaticFunctions_NoGlobal.Export.js | 337 +++++++++++++++ .../StaticProperties_NoGlobal.Export.d.ts | 58 +++ .../StaticProperties_NoGlobal.Export.js | 386 ++++++++++++++++++ .../ExportSwiftTests/DefaultParameters.json | 3 +- .../ExportSwiftTests/EnumAssociatedValue.json | 18 +- .../ExportSwiftTests/EnumCase.json | 12 +- .../ExportSwiftTests/EnumNamespace.json | 27 +- .../ExportSwiftTests/EnumRawType.json | 36 +- .../ExportSwiftTests/Protocol.json | 12 +- .../ExportSwiftTests/StaticFunctions.json | 12 +- .../ExportSwiftTests/StaticProperties.json | 9 +- .../ExportSwiftTests/SwiftClosure.json | 12 +- Plugins/PackageToJS/Sources/PackageToJS.swift | 3 +- .../JavaScript/BridgeJS.ExportSwift.json | 84 ++-- 26 files changed, 2029 insertions(+), 146 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace_NoGlobal.Export.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace_NoGlobal.Export.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces_NoGlobal.Export.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces_NoGlobal.Export.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions_NoGlobal.Export.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions_NoGlobal.Export.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties_NoGlobal.Export.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties_NoGlobal.Export.js diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift index 35d2340d2..2be8626e1 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift @@ -40,7 +40,8 @@ import class Foundation.JSONDecoder children: [importSkeleton] ) ], - sharedMemory: false + sharedMemory: false, + exposeToGlobal: true ) let linked = try linker.link() diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 0938bfcf3..4859ba6d9 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -882,10 +882,18 @@ public class ExportSwift { message: "Enum visibility must be at least internal" ) + let tsFullPath: String + if let namespace = namespaceResult.namespace, !namespace.isEmpty { + tsFullPath = namespace.joined(separator: ".") + "." + name + } else { + tsFullPath = name + } + // Create enum directly in dictionary let exportedEnum = ExportedEnum( name: name, swiftCallName: swiftCallName, + tsFullPath: tsFullPath, explicitAccessControl: explicitAccessControl, cases: [], // Will be populated in visit(EnumCaseDeclSyntax) rawType: SwiftEnumRawType(rawType), diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 478ba15dd..98b572029 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -12,16 +12,19 @@ struct BridgeJSLink { var exportedSkeletons: [ExportedSkeleton] = [] var importedSkeletons: [ImportedModuleSkeleton] = [] let sharedMemory: Bool + let exposeToGlobal: Bool private let namespaceBuilder = NamespaceBuilder() init( exportedSkeletons: [ExportedSkeleton] = [], importedSkeletons: [ImportedModuleSkeleton] = [], - sharedMemory: Bool + sharedMemory: Bool, + exposeToGlobal: Bool = true ) { self.exportedSkeletons = exportedSkeletons self.importedSkeletons = importedSkeletons self.sharedMemory = sharedMemory + self.exposeToGlobal = exposeToGlobal } mutating func addExportedSkeletonFile(data: Data) throws { @@ -77,7 +80,7 @@ struct BridgeJSLink { var enumStaticAssignments: [String] = [] } - private func collectLinkData() throws -> LinkData { + private func collectLinkData(exposeToGlobal: Bool) throws -> LinkData { var data = LinkData() // Swift heap object class definitions @@ -873,8 +876,8 @@ struct BridgeJSLink { for property in proto.properties { let propertySignature = property.isReadonly - ? "readonly \(property.name): \(property.type.tsType);" - : "\(property.name): \(property.type.tsType);" + ? "readonly \(property.name): \(resolveTypeScriptType(property.type));" + : "\(property.name): \(resolveTypeScriptType(property.type));" printer.write(propertySignature) } } @@ -892,8 +895,16 @@ struct BridgeJSLink { let enumValuesName = enumDefinition.valuesName let enumObjectName = enumDefinition.objectTypeName + // Use fully-qualified path for namespaced enums + let fullEnumValuesPath: String + if let namespace = enumDefinition.namespace, !namespace.isEmpty { + fullEnumValuesPath = namespace.joined(separator: ".") + "." + enumValuesName + } else { + fullEnumValuesPath = enumValuesName + } + if !enumDefinition.staticMethods.isEmpty || !enumDefinition.staticProperties.isEmpty { - printer.write("export type \(enumObjectName) = typeof \(enumValuesName) & {") + printer.write("export type \(enumObjectName) = typeof \(fullEnumValuesPath) & {") printer.indent { for function in enumDefinition.staticMethods { printer.write( @@ -902,12 +913,12 @@ struct BridgeJSLink { } for property in enumDefinition.staticProperties { let readonly = property.isReadonly ? "readonly " : "" - printer.write("\(readonly)\(property.name): \(property.type.tsType);") + printer.write("\(readonly)\(property.name): \(resolveTypeScriptType(property.type));") } } printer.write("};") } else { - printer.write("export type \(enumObjectName) = typeof \(enumValuesName);") + printer.write("export type \(enumObjectName) = typeof \(fullEnumValuesPath);") } printer.nextLine() } @@ -916,6 +927,7 @@ struct BridgeJSLink { // Type definitions section (namespace declarations, class definitions, imported types) let namespaceDeclarationsLines = namespaceBuilder.namespaceDeclarations( exportedSkeletons: exportedSkeletons, + exposeToGlobal: exposeToGlobal, renderTSSignatureCallback: { parameters, returnType, effects in self.renderTSSignature(parameters: parameters, returnType: returnType, effects: effects) } @@ -998,7 +1010,8 @@ struct BridgeJSLink { printer.write(lines: data.topLevelEnumLines) let topLevelNamespaceCode = namespaceBuilder.buildTopLevelNamespaceInitialization( - exportedSkeletons: exportedSkeletons + exportedSkeletons: exportedSkeletons, + exposeToGlobal: exposeToGlobal ) printer.write(lines: topLevelNamespaceCode) @@ -1061,14 +1074,16 @@ struct BridgeJSLink { printer.write(lines: data.classLines) let namespaceInitCode = namespaceBuilder.buildNamespaceInitialization( - exportedSkeletons: exportedSkeletons + exportedSkeletons: exportedSkeletons, + exposeToGlobal: exposeToGlobal ) printer.write(lines: namespaceInitCode) - let propertyAssignments = try generateNamespacePropertyAssignments( - data: data, - exportedSkeletons: exportedSkeletons, - namespaceBuilder: namespaceBuilder + let propertyAssignments = try generateNamespacePropertyAssignments( + data: data, + exportedSkeletons: exportedSkeletons, + namespaceBuilder: namespaceBuilder, + exposeToGlobal: exposeToGlobal ) printer.write(lines: propertyAssignments) } @@ -1082,7 +1097,7 @@ struct BridgeJSLink { } func link() throws -> (outputJs: String, outputDts: String) { - let data = try collectLinkData() + let data = try collectLinkData(exposeToGlobal: exposeToGlobal) let outputJs = try generateJavaScript(data: data) let outputDts = generateTypeScript(data: data) return (outputJs, outputDts) @@ -1140,10 +1155,15 @@ struct BridgeJSLink { private func generateNamespacePropertyAssignments( data: LinkData, exportedSkeletons: [ExportedSkeleton], - namespaceBuilder: NamespaceBuilder + namespaceBuilder: NamespaceBuilder, + exposeToGlobal: Bool ) throws -> [String] { let printer = CodeFragmentPrinter() - printer.write(lines: data.enumStaticAssignments) + + // Only write globalThis property assignments when exposeToGlobal is true + if exposeToGlobal { + printer.write(lines: data.enumStaticAssignments) + } printer.write("const exports = {") try printer.indent { @@ -1151,6 +1171,7 @@ struct BridgeJSLink { let hierarchicalLines = try namespaceBuilder.buildHierarchicalExportsObject( exportedSkeletons: exportedSkeletons, + exposeToGlobal: exposeToGlobal, renderFunctionImpl: { function in let (js, _) = try self.renderExportedFunction(function: function) return js @@ -1161,8 +1182,10 @@ struct BridgeJSLink { printer.write("};") printer.write("_exports = exports;") - let globalThisLines = namespaceBuilder.buildGlobalThisAssignments(exportedSkeletons: exportedSkeletons) - printer.write(lines: globalThisLines) + if exposeToGlobal { + let globalThisLines = namespaceBuilder.buildGlobalThisAssignments(exportedSkeletons: exportedSkeletons) + printer.write(lines: globalThisLines) + } printer.write("return exports;") @@ -1189,8 +1212,8 @@ struct BridgeJSLink { for property in type.properties { let propertySignature = property.isReadonly - ? "readonly \(property.name): \(property.type.tsType);" - : "\(property.name): \(property.type.tsType);" + ? "readonly \(property.name): \(resolveTypeScriptType(property.type));" + : "\(property.name): \(resolveTypeScriptType(property.type));" printer.write(propertySignature) } @@ -1320,16 +1343,57 @@ struct BridgeJSLink { } } + /// Returns TypeScript type string for a BridgeType, using full paths for enums + /// If the type is an enum, looks up the ExportedEnum and uses its tsFullPath + /// Otherwise, uses the default tsType property + private func resolveTypeScriptType(_ type: BridgeType) -> String { + return Self.resolveTypeScriptType(type, exportedSkeletons: exportedSkeletons) + } + + /// Static helper for resolving TypeScript types with full enum paths + /// Can be used by both BridgeJSLink and NamespaceBuilder + fileprivate static func resolveTypeScriptType(_ type: BridgeType, exportedSkeletons: [ExportedSkeleton]) -> String { + switch type { + case .caseEnum(let name), .rawValueEnum(let name, _), + .associatedValueEnum(let name), .namespaceEnum(let name): + // Look up the enum to get its tsFullPath + for skeleton in exportedSkeletons { + for enumDef in skeleton.enums { + if enumDef.name == name || enumDef.swiftCallName == name { + // Use the stored tsFullPath which has the full namespace + switch type { + case .caseEnum: + return "\(enumDef.tsFullPath)Tag" + case .rawValueEnum: + return "\(enumDef.tsFullPath)Tag" + case .associatedValueEnum: + return "\(enumDef.tsFullPath)Tag" + case .namespaceEnum: + return enumDef.tsFullPath + default: + return type.tsType + } + } + } + } + return type.tsType + case .optional(let wrapped): + return "\(resolveTypeScriptType(wrapped, exportedSkeletons: exportedSkeletons)) | null" + default: + return type.tsType + } + } + private func renderTSSignature(parameters: [Parameter], returnType: BridgeType, effects: Effects) -> String { let returnTypeWithEffect: String if effects.isAsync { - returnTypeWithEffect = "Promise<\(returnType.tsType)>" + returnTypeWithEffect = "Promise<\(resolveTypeScriptType(returnType))>" } else { - returnTypeWithEffect = returnType.tsType + returnTypeWithEffect = resolveTypeScriptType(returnType) } let parameterSignatures = parameters.map { param in let optional = param.hasDefault ? "?" : "" - return "\(param.name)\(optional): \(param.type.tsType)" + return "\(param.name)\(optional): \(resolveTypeScriptType(param.type))" } return "(\(parameterSignatures.joined(separator: ", "))): \(returnTypeWithEffect)" } @@ -2179,12 +2243,18 @@ extension BridgeJSLink { ) } - func buildNamespaceInitialization(exportedSkeletons: [ExportedSkeleton]) -> [String] { + func buildNamespaceInitialization(exportedSkeletons: [ExportedSkeleton], exposeToGlobal: Bool) -> [String] { + guard exposeToGlobal else { return [] } let allNamespacePaths = collectAllNamespacePaths(exportedSkeletons: exportedSkeletons) return generateNamespaceInitializationCode(namespacePaths: allNamespacePaths) } - func buildTopLevelNamespaceInitialization(exportedSkeletons: [ExportedSkeleton]) -> [String] { + func buildTopLevelNamespaceInitialization( + exportedSkeletons: [ExportedSkeleton], + exposeToGlobal: Bool + ) -> [String] { + guard exposeToGlobal else { return [] } + var namespacedEnumPaths: Set<[String]> = [] for skeleton in exportedSkeletons { for enumDef in skeleton.enums where enumDef.namespace != nil && enumDef.enumType != .namespace { @@ -2408,6 +2478,7 @@ extension BridgeJSLink { fileprivate func buildHierarchicalExportsObject( exportedSkeletons: [ExportedSkeleton], + exposeToGlobal: Bool, renderFunctionImpl: (ExportedFunction) throws -> [String] ) throws -> [String] { let printer = CodeFragmentPrinter() @@ -2575,6 +2646,7 @@ extension BridgeJSLink { /// - Returns: Array of TypeScript declaration lines defining the global namespace structure func namespaceDeclarations( exportedSkeletons: [ExportedSkeleton], + exposeToGlobal: Bool, renderTSSignatureCallback: @escaping ([Parameter], BridgeType, Effects) -> String ) -> [String] { let printer = CodeFragmentPrinter() @@ -2585,38 +2657,76 @@ extension BridgeJSLink { guard !rootNode.children.isEmpty else { return printer.lines } - printer.write("export {};") - printer.nextLine() - printer.write("declare global {") - printer.indent() + + if exposeToGlobal { + printer.write("export {};") + printer.nextLine() + printer.write("declare global {") + printer.indent() + } + + func hasContent(node: NamespaceNode) -> Bool { + // Enums are always included + if !node.content.enums.isEmpty { + return true + } + + // When exposeToGlobal is true, classes, functions, and properties are included + if exposeToGlobal { + if !node.content.classes.isEmpty || !node.content.functions.isEmpty + || !node.content.staticProperties.isEmpty + { + return true + } + } + + // Check if any child has content + for (_, childNode) in node.children { + if hasContent(node: childNode) { + return true + } + } + + return false + } func generateNamespaceDeclarations(node: NamespaceNode, depth: Int) { let sortedChildren = node.children.sorted { $0.key < $1.key } for (childName, childNode) in sortedChildren { - printer.write("namespace \(childName) {") + // Skip empty namespaces + guard hasContent(node: childNode) else { + continue + } + + let exportKeyword = exposeToGlobal ? "" : "export " + printer.write("\(exportKeyword)namespace \(childName) {") printer.indent() - let sortedClasses = childNode.content.classes.sorted { $0.name < $1.name } - for klass in sortedClasses { - printer.write("class \(klass.name) {") - printer.indent { - if let constructor = klass.constructor { - let constructorSignature = - "constructor(\(constructor.parameters.map { "\($0.name): \($0.type.tsType)" }.joined(separator: ", ")));" - printer.write(constructorSignature) - } + // Only include classes when exposeToGlobal is true + if exposeToGlobal { + let sortedClasses = childNode.content.classes.sorted { $0.name < $1.name } + for klass in sortedClasses { + printer.write("class \(klass.name) {") + printer.indent { + if let constructor = klass.constructor { + let constructorSignature = + "constructor(\(constructor.parameters.map { "\($0.name): \($0.type.tsType)" }.joined(separator: ", ")));" + printer.write(constructorSignature) + } - let sortedMethods = klass.methods.sorted { $0.name < $1.name } - for method in sortedMethods { - let methodSignature = - "\(method.name)\(renderTSSignatureCallback(method.parameters, method.returnType, method.effects));" - printer.write(methodSignature) + let sortedMethods = klass.methods.sorted { $0.name < $1.name } + for method in sortedMethods { + let methodSignature = + "\(method.name)\(renderTSSignatureCallback(method.parameters, method.returnType, method.effects));" + printer.write(methodSignature) + } } + printer.write("}") } - printer.write("}") } + // Generate enum definitions within declare global namespace let sortedEnums = childNode.content.enums.sorted { $0.name < $1.name } for enumDefinition in sortedEnums { let style: EnumEmitStyle = enumDefinition.emitStyle @@ -2721,16 +2831,19 @@ extension BridgeJSLink { } } - let sortedFunctions = childNode.content.functions.sorted { $0.name < $1.name } - for function in sortedFunctions { - let signature = - "\(function.name)\(renderTSSignatureCallback(function.parameters, function.returnType, function.effects));" - printer.write(signature) - } - let sortedProperties = childNode.content.staticProperties.sorted { $0.name < $1.name } - for property in sortedProperties { - let readonly = property.isReadonly ? "var " : "let " - printer.write("\(readonly)\(property.name): \(property.type.tsType);") + // Only include functions and properties when exposeToGlobal is true + if exposeToGlobal { + let sortedFunctions = childNode.content.functions.sorted { $0.name < $1.name } + for function in sortedFunctions { + let signature = + "\(function.name)\(renderTSSignatureCallback(function.parameters, function.returnType, function.effects));" + printer.write(signature) + } + let sortedProperties = childNode.content.staticProperties.sorted { $0.name < $1.name } + for property in sortedProperties { + let readonly = property.isReadonly ? "var " : "let " + printer.write("\(readonly)\(property.name): \(property.type.tsType);") + } } generateNamespaceDeclarations(node: childNode, depth: depth + 1) @@ -2742,9 +2855,11 @@ extension BridgeJSLink { generateNamespaceDeclarations(node: rootNode, depth: 1) - printer.unindent() - printer.write("}") - printer.nextLine() + if exposeToGlobal { + printer.unindent() + printer.write("}") + printer.nextLine() + } return printer.lines } diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 1b59ddfc3..a862f3c3b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -265,6 +265,7 @@ public struct ExportedEnum: Codable, Equatable, Sendable { public let name: String public let swiftCallName: String + public let tsFullPath: String public let explicitAccessControl: String? public var cases: [EnumCase] public let rawType: SwiftEnumRawType? @@ -293,6 +294,7 @@ public struct ExportedEnum: Codable, Equatable, Sendable { public init( name: String, swiftCallName: String, + tsFullPath: String, explicitAccessControl: String?, cases: [EnumCase], rawType: SwiftEnumRawType?, @@ -303,6 +305,7 @@ public struct ExportedEnum: Codable, Equatable, Sendable { ) { self.name = name self.swiftCallName = swiftCallName + self.tsFullPath = tsFullPath self.explicitAccessControl = explicitAccessControl self.cases = cases self.rawType = rawType diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift index 37edf8308..b837451db 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift @@ -55,7 +55,7 @@ import Testing let encoder = JSONEncoder() encoder.outputFormatting = [.prettyPrinted, .sortedKeys] let outputSkeletonData = try encoder.encode(outputSkeleton) - var bridgeJSLink = BridgeJSLink(sharedMemory: false) + var bridgeJSLink = BridgeJSLink(sharedMemory: false, exposeToGlobal: true) try bridgeJSLink.addExportedSkeletonFile(data: outputSkeletonData) try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Export") } @@ -74,8 +74,54 @@ import Testing encoder.outputFormatting = [.prettyPrinted, .sortedKeys] let outputSkeletonData = try encoder.encode(importTS.skeleton) - var bridgeJSLink = BridgeJSLink(sharedMemory: false) + var bridgeJSLink = BridgeJSLink(sharedMemory: false, exposeToGlobal: true) try bridgeJSLink.addImportedSkeletonFile(data: outputSkeletonData) try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Import") } + + @Test(arguments: [ + "Namespaces.swift", + "StaticFunctions.swift", + "StaticProperties.swift", + "EnumNamespace.swift" + ]) + func testWithoutGlobal(inputFile: String) throws { + let url = Self.inputsDirectory.appendingPathComponent(inputFile) + let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) + let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule") + try swiftAPI.addSourceFile(sourceFile, inputFile) + + let (_, outputSkeleton) = try #require(try swiftAPI.finalize()) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys] + let outputSkeletonData = try encoder.encode(outputSkeleton) + + var bridgeJSLink = BridgeJSLink(sharedMemory: false, exposeToGlobal: false) + try bridgeJSLink.addExportedSkeletonFile(data: outputSkeletonData) + + let (outputJs, outputDts) = try bridgeJSLink.link() + + // Verify no global declarations + #expect(!outputDts.contains("declare global")) + #expect(!outputJs.contains("globalThis.")) + + // Save snapshots + let name = url.deletingPathExtension().lastPathComponent + "_NoGlobal.Export" + try assertSnapshot( + name: name, + filePath: #filePath, + function: #function, + sourceLocation: #_sourceLocation, + input: outputJs.data(using: .utf8)!, + fileExtension: "js" + ) + try assertSnapshot( + name: name, + filePath: #filePath, + function: #function, + sourceLocation: #_sourceLocation, + input: outputDts.data(using: .utf8)!, + fileExtension: "d.ts" + ) + } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts index e79f4119e..5523b89ec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts @@ -47,9 +47,9 @@ export type APIResultObject = typeof APIResultValues; export type ComplexResultObject = typeof ComplexResultValues; -export type ResultObject = typeof ResultValues; +export type ResultObject = typeof Utilities.ResultValues; -export type NetworkingResultObject = typeof NetworkingResultValues; +export type NetworkingResultObject = typeof API.NetworkingResultValues; export type APIOptionalResultObject = typeof APIOptionalResultValues; @@ -89,7 +89,7 @@ export type Exports = { roundtripComplexResult(result: ComplexResultTag): ComplexResultTag; roundTripOptionalComplexResult(result: ComplexResultTag | null): ComplexResultTag | null; roundTripOptionalUtilitiesResult(result: Utilities.ResultTag | null): Utilities.ResultTag | null; - roundTripOptionalNetworkingResult(result: NetworkingResultTag | null): NetworkingResultTag | null; + roundTripOptionalNetworkingResult(result: API.NetworkingResultTag | null): API.NetworkingResultTag | null; roundTripOptionalAPIOptionalResult(result: APIOptionalResultTag | null): APIOptionalResultTag | null; APIResult: APIResultObject ComplexResult: ComplexResultObject diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts index b7c1549a0..4261ca3bb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts @@ -4,13 +4,13 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -export type MethodObject = typeof MethodValues; +export type MethodObject = typeof Networking.API.MethodValues; -export type LogLevelObject = typeof LogLevelValues; +export type LogLevelObject = typeof Configuration.LogLevelValues; -export type PortObject = typeof PortValues; +export type PortObject = typeof Configuration.PortValues; -export type SupportedMethodObject = typeof SupportedMethodValues; +export type SupportedMethodObject = typeof Networking.APIV2.Internal.SupportedMethodValues; export {}; @@ -48,7 +48,7 @@ declare global { namespace Internal { class TestServer { constructor(); - call(method: Internal.SupportedMethodTag): void; + call(method: Networking.APIV2.Internal.SupportedMethodTag): void; } const SupportedMethodValues: { readonly Get: 0; @@ -80,7 +80,7 @@ export interface HTTPServer extends SwiftHeapObject { call(method: Networking.API.MethodTag): void; } export interface TestServer extends SwiftHeapObject { - call(method: Internal.SupportedMethodTag): void; + call(method: Networking.APIV2.Internal.SupportedMethodTag): void; } export type Exports = { Configuration: { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace_NoGlobal.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace_NoGlobal.Export.d.ts new file mode 100644 index 000000000..b8b92d14e --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace_NoGlobal.Export.d.ts @@ -0,0 +1,101 @@ +// 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 type MethodObject = typeof Networking.API.MethodValues; + +export type LogLevelObject = typeof Configuration.LogLevelValues; + +export type PortObject = typeof Configuration.PortValues; + +export type SupportedMethodObject = typeof Networking.APIV2.Internal.SupportedMethodValues; + +export namespace Configuration { + const LogLevelValues: { + readonly Debug: "debug"; + readonly Info: "info"; + readonly Warning: "warning"; + readonly Error: "error"; + }; + type LogLevelTag = typeof LogLevelValues[keyof typeof LogLevelValues]; + const PortValues: { + readonly Http: 80; + readonly Https: 443; + readonly Development: 3000; + }; + type PortTag = typeof PortValues[keyof typeof PortValues]; +} +export namespace Networking { + export namespace API { + const MethodValues: { + readonly Get: 0; + readonly Post: 1; + readonly Put: 2; + readonly Delete: 3; + }; + type MethodTag = typeof MethodValues[keyof typeof MethodValues]; + } + export namespace APIV2 { + export namespace Internal { + const SupportedMethodValues: { + readonly Get: 0; + readonly Post: 1; + }; + type SupportedMethodTag = typeof SupportedMethodValues[keyof typeof SupportedMethodValues]; + } + } +} +/// 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 Converter extends SwiftHeapObject { + toString(value: number): string; +} +export interface HTTPServer extends SwiftHeapObject { + call(method: Networking.API.MethodTag): void; +} +export interface TestServer extends SwiftHeapObject { + call(method: Networking.APIV2.Internal.SupportedMethodTag): void; +} +export type Exports = { + Configuration: { + LogLevel: LogLevelObject + Port: PortObject + }, + Networking: { + API: { + HTTPServer: { + new(): HTTPServer; + } + Method: MethodObject + }, + APIV2: { + Internal: { + TestServer: { + new(): TestServer; + } + SupportedMethod: SupportedMethodObject + }, + }, + }, + Utils: { + Converter: { + new(): Converter; + } + }, +} +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/EnumNamespace_NoGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace_NoGlobal.Export.js new file mode 100644 index 000000000..9fed226d9 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace_NoGlobal.Export.js @@ -0,0 +1,323 @@ +// 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 const MethodValues = { + Get: 0, + Post: 1, + Put: 2, + Delete: 3, +}; + +export const LogLevelValues = { + Debug: "debug", + Info: "info", + Warning: "warning", + Error: "error", +}; + +export const PortValues = { + Http: 80, + Https: 443, + Development: 3000, +}; + +export const SupportedMethodValues = { + Get: 0, + Post: 1, +}; + +export async function createInstantiator(options, swift) { + let instance; + let memory; + let setException; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_Converter_wrap"] = function(pointer) { + const obj = Converter.__construct(pointer); + return swift.memory.retain(obj); + }; + importObject["TestModule"]["bjs_HTTPServer_wrap"] = function(pointer) { + const obj = HTTPServer.__construct(pointer); + return swift.memory.retain(obj); + }; + importObject["TestModule"]["bjs_TestServer_wrap"] = function(pointer) { + const obj = TestServer.__construct(pointer); + return swift.memory.retain(obj); + }; + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class Converter extends SwiftHeapObject { + 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); + } + toString(value) { + instance.exports.bjs_Converter_toString(this.pointer, value); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + } + class HTTPServer extends SwiftHeapObject { + 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); + } + call(method) { + instance.exports.bjs_HTTPServer_call(this.pointer, method); + } + } + class TestServer extends SwiftHeapObject { + 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); + } + call(method) { + instance.exports.bjs_TestServer_call(this.pointer, method); + } + } + const exports = { + Configuration: { + LogLevel: LogLevelValues, + Port: PortValues, + }, + Networking: { + API: { + HTTPServer, + Method: MethodValues, + }, + APIV2: { + Internal: { + TestServer, + SupportedMethod: SupportedMethodValues, + }, + }, + }, + Utils: { + Converter, + }, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces_NoGlobal.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces_NoGlobal.Export.d.ts new file mode 100644 index 000000000..67a89533a --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces_NoGlobal.Export.d.ts @@ -0,0 +1,55 @@ +// 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 Greeter extends SwiftHeapObject { + greet(): string; +} +export interface Converter extends SwiftHeapObject { + toString(value: number): string; +} +export interface UUID extends SwiftHeapObject { + uuidString(): string; +} +export type Exports = { + plainFunction(): string; + MyModule: { + Utils: { + namespacedFunction(): string; + }, + }, + Utils: { + Converters: { + Converter: { + new(): Converter; + } + }, + }, + __Swift: { + Foundation: { + Greeter: { + new(name: string): Greeter; + } + UUID: { + } + }, + }, +} +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/Namespaces_NoGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces_NoGlobal.Export.js new file mode 100644 index 000000000..08601bd50 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces_NoGlobal.Export.js @@ -0,0 +1,311 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_Greeter_wrap"] = function(pointer) { + const obj = Greeter.__construct(pointer); + return swift.memory.retain(obj); + }; + importObject["TestModule"]["bjs_Converter_wrap"] = function(pointer) { + const obj = Converter.__construct(pointer); + return swift.memory.retain(obj); + }; + importObject["TestModule"]["bjs_UUID_wrap"] = function(pointer) { + const obj = UUID.__construct(pointer); + return swift.memory.retain(obj); + }; + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class Greeter extends SwiftHeapObject { + 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); + const ret = instance.exports.bjs_Greeter_init(nameId, nameBytes.length); + swift.memory.release(nameId); + return Greeter.__construct(ret); + } + greet() { + instance.exports.bjs_Greeter_greet(this.pointer); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + } + class Converter extends SwiftHeapObject { + 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); + } + toString(value) { + instance.exports.bjs_Converter_toString(this.pointer, value); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + } + class UUID extends SwiftHeapObject { + 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; + tmpRetString = undefined; + return ret; + } + } + const exports = { + plainFunction: function bjs_plainFunction() { + instance.exports.bjs_plainFunction(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + MyModule: { + Utils: { + namespacedFunction: function bjs_MyModule_Utils_namespacedFunction() { + instance.exports.bjs_MyModule_Utils_namespacedFunction(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + }, + }, + Utils: { + Converters: { + Converter, + }, + }, + __Swift: { + Foundation: { + Greeter, + UUID, + }, + }, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions_NoGlobal.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions_NoGlobal.Export.d.ts new file mode 100644 index 000000000..e938ddb9a --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions_NoGlobal.Export.d.ts @@ -0,0 +1,63 @@ +// 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 const CalculatorValues: { + readonly Scientific: 0; + readonly Basic: 1; +}; +export type CalculatorTag = typeof CalculatorValues[keyof typeof CalculatorValues]; + +export const APIResultValues: { + readonly Tag: { + readonly Success: 0; + readonly Failure: 1; + }; +}; + +export type APIResultTag = + { tag: typeof APIResultValues.Tag.Success; param0: string } | { tag: typeof APIResultValues.Tag.Failure; param0: number } + +export type CalculatorObject = typeof CalculatorValues & { + square(value: number): number; +}; + +export type APIResultObject = typeof APIResultValues & { + roundtrip(value: APIResultTag): APIResultTag; +}; + +/// 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 MathUtils extends SwiftHeapObject { + multiply(x: number, y: number): number; +} +export type Exports = { + MathUtils: { + new(): MathUtils; + subtract(a: number, b: number): number; + add(a: number, b: number): number; + } + Calculator: CalculatorObject + APIResult: APIResultObject + Utils: { + String: { + uppercase(text: string): string; + }, + }, +} +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/StaticFunctions_NoGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions_NoGlobal.Export.js new file mode 100644 index 000000000..8522168f2 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions_NoGlobal.Export.js @@ -0,0 +1,337 @@ +// 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 const CalculatorValues = { + Scientific: 0, + Basic: 1, +}; + +export const APIResultValues = { + Tag: { + Success: 0, + Failure: 1, + }, +}; + +const __bjs_createAPIResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case APIResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: APIResultValues.Tag.Success, cleanup }; + } + case APIResultValues.Tag.Failure: { + tmpParamInts.push((value.param0 | 0)); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Failure, cleanup }; + } + default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); + } + }, + raise: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { + const tag = tmpRetTag | 0; + switch (tag) { + case APIResultValues.Tag.Success: { + const string = tmpRetStrings.pop(); + return { tag: APIResultValues.Tag.Success, param0: string }; + } + case APIResultValues.Tag.Failure: { + const int = tmpRetInts.pop(); + return { tag: APIResultValues.Tag.Failure, param0: int }; + } + default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); + } + } + }); +}; +export async function createInstantiator(options, swift) { + let instance; + let memory; + let setException; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + const enumHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_MathUtils_wrap"] = function(pointer) { + const obj = MathUtils.__construct(pointer); + return swift.memory.retain(obj); + }; + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); + enumHelpers.APIResult = APIResultHelpers; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class MathUtils extends SwiftHeapObject { + 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); + } + static subtract(a, b) { + const ret = instance.exports.bjs_MathUtils_static_subtract(a, b); + return ret; + } + static add(a, b) { + const ret = instance.exports.bjs_MathUtils_static_add(a, b); + return ret; + } + multiply(x, y) { + const ret = instance.exports.bjs_MathUtils_multiply(this.pointer, x, y); + return ret; + } + } + const exports = { + MathUtils, + Calculator: { + ...CalculatorValues, + square: function(value) { + const ret = instance.exports.bjs_Calculator_static_square(value); + return ret; + } + }, + APIResult: { + ...APIResultValues, + roundtrip: function(value) { + const { caseId: valueCaseId, cleanup: valueCleanup } = enumHelpers.APIResult.lower(value); + instance.exports.bjs_APIResult_static_roundtrip(valueCaseId); + const ret = enumHelpers.APIResult.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + if (valueCleanup) { valueCleanup(); } + return ret; + } + }, + Utils: { + String: { + uppercase: function bjs_Utils_String_static_uppercase(text) { + const textBytes = textEncoder.encode(text); + const textId = swift.memory.retain(textBytes); + instance.exports.bjs_Utils_String_static_uppercase(textId, textBytes.length); + const ret = tmpRetString; + tmpRetString = undefined; + swift.memory.release(textId); + return ret; + }, + }, + }, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties_NoGlobal.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties_NoGlobal.Export.d.ts new file mode 100644 index 000000000..4ce689edb --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties_NoGlobal.Export.d.ts @@ -0,0 +1,58 @@ +// 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 const PropertyEnumValues: { + readonly Value1: 0; + readonly Value2: 1; +}; +export type PropertyEnumTag = typeof PropertyEnumValues[keyof typeof PropertyEnumValues]; + +export type PropertyEnumObject = typeof PropertyEnumValues & { + enumProperty: string; + readonly enumConstant: number; + computedEnum: string; +}; + +/// 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 PropertyClass extends SwiftHeapObject { +} +export type Exports = { + PropertyClass: { + new(): PropertyClass; + readonly staticConstant: string; + staticVariable: number; + jsObjectProperty: any; + classVariable: string; + computedProperty: string; + readonly readOnlyComputed: number; + optionalProperty: string | null; + } + PropertyEnum: PropertyEnumObject + PropertyNamespace: { + readonly namespaceConstant: string; + namespaceProperty: string; + Nested: { + readonly nestedConstant: string; + nestedDouble: number; + nestedProperty: number; + }, + }, +} +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/StaticProperties_NoGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties_NoGlobal.Export.js new file mode 100644 index 000000000..5d70c39b1 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties_NoGlobal.Export.js @@ -0,0 +1,386 @@ +// 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 const PropertyEnumValues = { + Value1: 0, + Value2: 1, +}; + +export async function createInstantiator(options, swift) { + let instance; + let memory; + let setException; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_PropertyClass_wrap"] = function(pointer) { + const obj = PropertyClass.__construct(pointer); + return swift.memory.retain(obj); + }; + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class PropertyClass extends SwiftHeapObject { + 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); + } + static get staticConstant() { + instance.exports.bjs_PropertyClass_static_staticConstant_get(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + static get staticVariable() { + const ret = instance.exports.bjs_PropertyClass_static_staticVariable_get(); + return ret; + } + static set staticVariable(value) { + instance.exports.bjs_PropertyClass_static_staticVariable_set(value); + } + static get jsObjectProperty() { + const ret = instance.exports.bjs_PropertyClass_static_jsObjectProperty_get(); + const ret1 = swift.memory.getObject(ret); + swift.memory.release(ret); + return ret1; + } + static set jsObjectProperty(value) { + instance.exports.bjs_PropertyClass_static_jsObjectProperty_set(swift.memory.retain(value)); + } + static get classVariable() { + instance.exports.bjs_PropertyClass_static_classVariable_get(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + static set classVariable(value) { + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + instance.exports.bjs_PropertyClass_static_classVariable_set(valueId, valueBytes.length); + swift.memory.release(valueId); + } + static get computedProperty() { + instance.exports.bjs_PropertyClass_static_computedProperty_get(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + static set computedProperty(value) { + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + instance.exports.bjs_PropertyClass_static_computedProperty_set(valueId, valueBytes.length); + swift.memory.release(valueId); + } + static get readOnlyComputed() { + const ret = instance.exports.bjs_PropertyClass_static_readOnlyComputed_get(); + return ret; + } + static get optionalProperty() { + instance.exports.bjs_PropertyClass_static_optionalProperty_get(); + const optResult = tmpRetString; + tmpRetString = undefined; + return optResult; + } + static set optionalProperty(value) { + const isSome = value != null; + let valueId, valueBytes; + if (isSome) { + valueBytes = textEncoder.encode(value); + valueId = swift.memory.retain(valueBytes); + } + instance.exports.bjs_PropertyClass_static_optionalProperty_set(+isSome, isSome ? valueId : 0, isSome ? valueBytes.length : 0); + if (valueId != undefined) { + swift.memory.release(valueId); + } + } + } + const exports = { + PropertyClass, + PropertyEnum: { + ...PropertyEnumValues, + get enumProperty() { + instance.exports.bjs_PropertyEnum_static_enumProperty_get(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + set enumProperty(value) { + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + instance.exports.bjs_PropertyEnum_static_enumProperty_set(valueId, valueBytes.length); + swift.memory.release(valueId); + }, + get enumConstant() { + const ret = instance.exports.bjs_PropertyEnum_static_enumConstant_get(); + return ret; + }, + get computedEnum() { + instance.exports.bjs_PropertyEnum_static_computedEnum_get(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + set computedEnum(value) { + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + instance.exports.bjs_PropertyEnum_static_computedEnum_set(valueId, valueBytes.length); + swift.memory.release(valueId); + } + }, + PropertyNamespace: { + get namespaceProperty() { + instance.exports.bjs_PropertyNamespace_static_namespaceProperty_get(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + set namespaceProperty(value) { + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + instance.exports.bjs_PropertyNamespace_static_namespaceProperty_set(valueId, valueBytes.length); + swift.memory.release(valueId); + }, + get namespaceConstant() { + instance.exports.bjs_PropertyNamespace_static_namespaceConstant_get(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + Nested: { + get nestedProperty() { + const ret = instance.exports.bjs_PropertyNamespace_Nested_static_nestedProperty_get(); + return ret; + }, + set nestedProperty(value) { + instance.exports.bjs_PropertyNamespace_Nested_static_nestedProperty_set(value); + }, + get nestedConstant() { + instance.exports.bjs_PropertyNamespace_Nested_static_nestedConstant_get(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + get nestedDouble() { + const ret = instance.exports.bjs_PropertyNamespace_Nested_static_nestedDouble_get(); + return ret; + }, + set nestedDouble(value) { + instance.exports.bjs_PropertyNamespace_Nested_static_nestedDouble_set(value); + }, + }, + }, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json index 05d71b5f8..98c09bef0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json @@ -255,7 +255,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Status" + "swiftCallName" : "Status", + "tsFullPath" : "Status" } ], "functions" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json index c75e7d856..d2ab06d42 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json @@ -80,7 +80,8 @@ "staticProperties" : [ ], - "swiftCallName" : "APIResult" + "swiftCallName" : "APIResult", + "tsFullPath" : "APIResult" }, { "cases" : [ @@ -250,7 +251,8 @@ "staticProperties" : [ ], - "swiftCallName" : "ComplexResult" + "swiftCallName" : "ComplexResult", + "tsFullPath" : "ComplexResult" }, { "cases" : [ @@ -264,7 +266,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Utilities" + "swiftCallName" : "Utilities", + "tsFullPath" : "Utilities" }, { "cases" : [ @@ -337,7 +340,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Utilities.Result" + "swiftCallName" : "Utilities.Result", + "tsFullPath" : "Utilities.Result" }, { "cases" : [ @@ -384,7 +388,8 @@ "staticProperties" : [ ], - "swiftCallName" : "NetworkingResult" + "swiftCallName" : "NetworkingResult", + "tsFullPath" : "API.NetworkingResult" }, { "cases" : [ @@ -478,7 +483,8 @@ "staticProperties" : [ ], - "swiftCallName" : "APIOptionalResult" + "swiftCallName" : "APIOptionalResult", + "tsFullPath" : "APIOptionalResult" } ], "functions" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json index 825b41050..3e738dd2b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json @@ -38,7 +38,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Direction" + "swiftCallName" : "Direction", + "tsFullPath" : "Direction" }, { "cases" : [ @@ -69,7 +70,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Status" + "swiftCallName" : "Status", + "tsFullPath" : "Status" }, { "cases" : [ @@ -106,7 +108,8 @@ "staticProperties" : [ ], - "swiftCallName" : "TSDirection" + "swiftCallName" : "TSDirection", + "tsFullPath" : "TSDirection" }, { "cases" : [ @@ -126,7 +129,8 @@ "staticProperties" : [ ], - "swiftCallName" : "PublicStatus" + "swiftCallName" : "PublicStatus", + "tsFullPath" : "PublicStatus" } ], "functions" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json index 0b94c1c5d..1ba8279e4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json @@ -173,7 +173,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Utils" + "swiftCallName" : "Utils", + "tsFullPath" : "Utils" }, { "cases" : [ @@ -187,7 +188,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Networking" + "swiftCallName" : "Networking", + "tsFullPath" : "Networking" }, { "cases" : [ @@ -204,7 +206,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Networking.API" + "swiftCallName" : "Networking.API", + "tsFullPath" : "Networking.API" }, { "cases" : [ @@ -245,7 +248,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Networking.API.Method" + "swiftCallName" : "Networking.API.Method", + "tsFullPath" : "Networking.API.Method" }, { "cases" : [ @@ -259,7 +263,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Configuration" + "swiftCallName" : "Configuration", + "tsFullPath" : "Configuration" }, { "cases" : [ @@ -304,7 +309,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Configuration.LogLevel" + "swiftCallName" : "Configuration.LogLevel", + "tsFullPath" : "Configuration.LogLevel" }, { "cases" : [ @@ -342,7 +348,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Configuration.Port" + "swiftCallName" : "Configuration.Port", + "tsFullPath" : "Configuration.Port" }, { "cases" : [ @@ -360,7 +367,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Internal" + "swiftCallName" : "Internal", + "tsFullPath" : "Networking.APIV2.Internal" }, { "cases" : [ @@ -390,7 +398,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Internal.SupportedMethod" + "swiftCallName" : "Internal.SupportedMethod", + "tsFullPath" : "Networking.APIV2.Internal.SupportedMethod" } ], "functions" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json index b5da17265..30ec6a35d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json @@ -36,7 +36,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Theme" + "swiftCallName" : "Theme", + "tsFullPath" : "Theme" }, { "cases" : [ @@ -71,7 +72,8 @@ "staticProperties" : [ ], - "swiftCallName" : "TSTheme" + "swiftCallName" : "TSTheme", + "tsFullPath" : "TSTheme" }, { "cases" : [ @@ -99,7 +101,8 @@ "staticProperties" : [ ], - "swiftCallName" : "FeatureFlag" + "swiftCallName" : "FeatureFlag", + "tsFullPath" : "FeatureFlag" }, { "cases" : [ @@ -134,7 +137,8 @@ "staticProperties" : [ ], - "swiftCallName" : "HttpStatus" + "swiftCallName" : "HttpStatus", + "tsFullPath" : "HttpStatus" }, { "cases" : [ @@ -169,7 +173,8 @@ "staticProperties" : [ ], - "swiftCallName" : "TSHttpStatus" + "swiftCallName" : "TSHttpStatus", + "tsFullPath" : "TSHttpStatus" }, { "cases" : [ @@ -218,7 +223,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Priority" + "swiftCallName" : "Priority", + "tsFullPath" : "Priority" }, { "cases" : [ @@ -260,7 +266,8 @@ "staticProperties" : [ ], - "swiftCallName" : "FileSize" + "swiftCallName" : "FileSize", + "tsFullPath" : "FileSize" }, { "cases" : [ @@ -295,7 +302,8 @@ "staticProperties" : [ ], - "swiftCallName" : "UserId" + "swiftCallName" : "UserId", + "tsFullPath" : "UserId" }, { "cases" : [ @@ -330,7 +338,8 @@ "staticProperties" : [ ], - "swiftCallName" : "TokenId" + "swiftCallName" : "TokenId", + "tsFullPath" : "TokenId" }, { "cases" : [ @@ -365,7 +374,8 @@ "staticProperties" : [ ], - "swiftCallName" : "SessionId" + "swiftCallName" : "SessionId", + "tsFullPath" : "SessionId" }, { "cases" : [ @@ -400,7 +410,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Precision" + "swiftCallName" : "Precision", + "tsFullPath" : "Precision" }, { "cases" : [ @@ -442,7 +453,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Ratio" + "swiftCallName" : "Ratio", + "tsFullPath" : "Ratio" } ], "functions" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json index 46b96429d..efda4d145 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json @@ -285,7 +285,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Direction" + "swiftCallName" : "Direction", + "tsFullPath" : "Direction" }, { "cases" : [ @@ -313,7 +314,8 @@ "staticProperties" : [ ], - "swiftCallName" : "ExampleEnum" + "swiftCallName" : "ExampleEnum", + "tsFullPath" : "ExampleEnum" }, { "cases" : [ @@ -350,7 +352,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Result" + "swiftCallName" : "Result", + "tsFullPath" : "Result" }, { "cases" : [ @@ -385,7 +388,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Priority" + "swiftCallName" : "Priority", + "tsFullPath" : "Priority" } ], "functions" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json index cbd0fa2b8..705de9378 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json @@ -186,7 +186,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Calculator" + "swiftCallName" : "Calculator", + "tsFullPath" : "Calculator" }, { "cases" : [ @@ -252,7 +253,8 @@ "staticProperties" : [ ], - "swiftCallName" : "APIResult" + "swiftCallName" : "APIResult", + "tsFullPath" : "APIResult" }, { "cases" : [ @@ -266,7 +268,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Utils" + "swiftCallName" : "Utils", + "tsFullPath" : "Utils" }, { "cases" : [ @@ -316,7 +319,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Utils.String" + "swiftCallName" : "Utils.String", + "tsFullPath" : "Utils.String" } ], "functions" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json index 63de88b99..1c5cdd6a4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json @@ -198,7 +198,8 @@ } } ], - "swiftCallName" : "PropertyEnum" + "swiftCallName" : "PropertyEnum", + "tsFullPath" : "PropertyEnum" }, { "cases" : [ @@ -247,7 +248,8 @@ } } ], - "swiftCallName" : "PropertyNamespace" + "swiftCallName" : "PropertyNamespace", + "tsFullPath" : "PropertyNamespace" }, { "cases" : [ @@ -320,7 +322,8 @@ } } ], - "swiftCallName" : "PropertyNamespace.Nested" + "swiftCallName" : "PropertyNamespace.Nested", + "tsFullPath" : "PropertyNamespace.Nested" } ], "functions" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json index acb1c8949..d6518fc69 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json @@ -899,7 +899,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Direction" + "swiftCallName" : "Direction", + "tsFullPath" : "Direction" }, { "cases" : [ @@ -934,7 +935,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Theme" + "swiftCallName" : "Theme", + "tsFullPath" : "Theme" }, { "cases" : [ @@ -976,7 +978,8 @@ "staticProperties" : [ ], - "swiftCallName" : "HttpStatus" + "swiftCallName" : "HttpStatus", + "tsFullPath" : "HttpStatus" }, { "cases" : [ @@ -1055,7 +1058,8 @@ "staticProperties" : [ ], - "swiftCallName" : "APIResult" + "swiftCallName" : "APIResult", + "tsFullPath" : "APIResult" } ], "functions" : [ diff --git a/Plugins/PackageToJS/Sources/PackageToJS.swift b/Plugins/PackageToJS/Sources/PackageToJS.swift index ec9840439..9576c2b76 100644 --- a/Plugins/PackageToJS/Sources/PackageToJS.swift +++ b/Plugins/PackageToJS/Sources/PackageToJS.swift @@ -613,7 +613,8 @@ struct PackagingPlanner { let data = try Data(contentsOf: URL(fileURLWithPath: scope.resolve(path: $0).path)) return try decoder.decode(ImportedModuleSkeleton.self, from: data) }, - sharedMemory: Self.isSharedMemoryEnabled(triple: triple) + sharedMemory: Self.isSharedMemoryEnabled(triple: triple), + exposeToGlobal: true ) let (outputJs, outputDts) = try link.link() try system.writeFile(atPath: scope.resolve(path: bridgeJs).path, content: Data(outputJs.utf8)) diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index c5ac3294d..c1877ab35 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -3156,7 +3156,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Direction" + "swiftCallName" : "Direction", + "tsFullPath" : "Direction" }, { "cases" : [ @@ -3187,7 +3188,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Status" + "swiftCallName" : "Status", + "tsFullPath" : "Status" }, { "cases" : [ @@ -3222,7 +3224,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Theme" + "swiftCallName" : "Theme", + "tsFullPath" : "Theme" }, { "cases" : [ @@ -3264,7 +3267,8 @@ "staticProperties" : [ ], - "swiftCallName" : "HttpStatus" + "swiftCallName" : "HttpStatus", + "tsFullPath" : "HttpStatus" }, { "cases" : [ @@ -3301,7 +3305,8 @@ "staticProperties" : [ ], - "swiftCallName" : "TSDirection" + "swiftCallName" : "TSDirection", + "tsFullPath" : "TSDirection" }, { "cases" : [ @@ -3336,7 +3341,8 @@ "staticProperties" : [ ], - "swiftCallName" : "TSTheme" + "swiftCallName" : "TSTheme", + "tsFullPath" : "TSTheme" }, { "cases" : [ @@ -3350,7 +3356,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Utils" + "swiftCallName" : "Utils", + "tsFullPath" : "Utils" }, { "cases" : [ @@ -3364,7 +3371,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Networking" + "swiftCallName" : "Networking", + "tsFullPath" : "Networking" }, { "cases" : [ @@ -3381,7 +3389,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Networking.API" + "swiftCallName" : "Networking.API", + "tsFullPath" : "Networking.API" }, { "cases" : [ @@ -3422,7 +3431,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Networking.API.Method" + "swiftCallName" : "Networking.API.Method", + "tsFullPath" : "Networking.API.Method" }, { "cases" : [ @@ -3436,7 +3446,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Configuration" + "swiftCallName" : "Configuration", + "tsFullPath" : "Configuration" }, { "cases" : [ @@ -3481,7 +3492,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Configuration.LogLevel" + "swiftCallName" : "Configuration.LogLevel", + "tsFullPath" : "Configuration.LogLevel" }, { "cases" : [ @@ -3519,7 +3531,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Configuration.Port" + "swiftCallName" : "Configuration.Port", + "tsFullPath" : "Configuration.Port" }, { "cases" : [ @@ -3537,7 +3550,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Internal" + "swiftCallName" : "Internal", + "tsFullPath" : "Networking.APIV2.Internal" }, { "cases" : [ @@ -3567,7 +3581,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Internal.SupportedMethod" + "swiftCallName" : "Internal.SupportedMethod", + "tsFullPath" : "Networking.APIV2.Internal.SupportedMethod" }, { "cases" : [ @@ -3646,7 +3661,8 @@ "staticProperties" : [ ], - "swiftCallName" : "APIResult" + "swiftCallName" : "APIResult", + "tsFullPath" : "APIResult" }, { "cases" : [ @@ -3842,7 +3858,8 @@ "staticProperties" : [ ], - "swiftCallName" : "ComplexResult" + "swiftCallName" : "ComplexResult", + "tsFullPath" : "ComplexResult" }, { "cases" : [ @@ -3856,7 +3873,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Utilities" + "swiftCallName" : "Utilities", + "tsFullPath" : "Utilities" }, { "cases" : [ @@ -3929,7 +3947,8 @@ "staticProperties" : [ ], - "swiftCallName" : "Utilities.Result" + "swiftCallName" : "Utilities.Result", + "tsFullPath" : "Utilities.Result" }, { "cases" : [ @@ -3943,7 +3962,8 @@ "staticProperties" : [ ], - "swiftCallName" : "API" + "swiftCallName" : "API", + "tsFullPath" : "API" }, { "cases" : [ @@ -3990,7 +4010,8 @@ "staticProperties" : [ ], - "swiftCallName" : "API.NetworkingResult" + "swiftCallName" : "API.NetworkingResult", + "tsFullPath" : "API.NetworkingResult" }, { "cases" : [ @@ -4084,7 +4105,8 @@ "staticProperties" : [ ], - "swiftCallName" : "APIOptionalResult" + "swiftCallName" : "APIOptionalResult", + "tsFullPath" : "APIOptionalResult" }, { "cases" : [ @@ -4138,7 +4160,8 @@ "staticProperties" : [ ], - "swiftCallName" : "StaticCalculator" + "swiftCallName" : "StaticCalculator", + "tsFullPath" : "StaticCalculator" }, { "cases" : [ @@ -4152,7 +4175,8 @@ "staticProperties" : [ ], - "swiftCallName" : "StaticUtils" + "swiftCallName" : "StaticUtils", + "tsFullPath" : "StaticUtils" }, { "cases" : [ @@ -4202,7 +4226,8 @@ "staticProperties" : [ ], - "swiftCallName" : "StaticUtils.Nested" + "swiftCallName" : "StaticUtils.Nested", + "tsFullPath" : "StaticUtils.Nested" }, { "cases" : [ @@ -4316,7 +4341,8 @@ } } ], - "swiftCallName" : "StaticPropertyEnum" + "swiftCallName" : "StaticPropertyEnum", + "tsFullPath" : "StaticPropertyEnum" }, { "cases" : [ @@ -4365,7 +4391,8 @@ } } ], - "swiftCallName" : "StaticPropertyNamespace" + "swiftCallName" : "StaticPropertyNamespace", + "tsFullPath" : "StaticPropertyNamespace" }, { "cases" : [ @@ -4438,7 +4465,8 @@ } } ], - "swiftCallName" : "StaticPropertyNamespace.NestedProperties" + "swiftCallName" : "StaticPropertyNamespace.NestedProperties", + "tsFullPath" : "StaticPropertyNamespace.NestedProperties" } ], "functions" : [ From afe86fcc9f77e68a44c30eb48f7bc750758aac46 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 21 Nov 2025 12:16:45 +0200 Subject: [PATCH 039/252] BridgeJS: Global namespace configuration and tests --- .../JavaScript/BridgeJS.ExportSwift.json | 7 +- .../JavaScript/BridgeJS.ExportSwift.json | 1 + .../Sources/PlayBridgeJS/main.swift | 5 +- Makefile | 10 + .../BridgeJSBuildPlugin.swift | 2 + .../BridgeJSCommandPlugin.swift | 2 + .../Sources/BridgeJSCore/BridgeJSConfig.swift | 28 +- .../Sources/BridgeJSCore/ExportSwift.swift | 10 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 29 +- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 10 +- .../Sources/BridgeJSTool/BridgeJSTool.swift | 12 +- .../BridgeJSToolTests/BridgeJSLinkTests.swift | 51 +-- .../BridgeJSToolTests/ExportSwiftTests.swift | 17 +- .../EnumAssociatedValue.Export.d.ts | 41 +- .../EnumAssociatedValue.Export.js | 14 - .../EnumNamespace.Export.d.ts | 73 ++-- .../BridgeJSLinkTests/EnumNamespace.Export.js | 40 -- ....d.ts => EnumNamespace.Global.Export.d.ts} | 73 ++-- ...port.js => EnumNamespace.Global.Export.js} | 40 ++ .../BridgeJSLinkTests/Namespaces.Export.d.ts | 29 -- .../BridgeJSLinkTests/Namespaces.Export.js | 22 - ...ort.d.ts => Namespaces.Global.Export.d.ts} | 29 ++ ....Export.js => Namespaces.Global.Export.js} | 22 + .../StaticFunctions.Export.d.ts | 10 - .../StaticFunctions.Export.js | 7 - ....ts => StaticFunctions.Global.Export.d.ts} | 10 + ...rt.js => StaticFunctions.Global.Export.js} | 7 + .../StaticProperties.Export.d.ts | 14 - .../StaticProperties.Export.js | 24 - ...ts => StaticProperties.Global.Export.d.ts} | 14 + ...t.js => StaticProperties.Global.Export.js} | 24 + .../__Snapshots__/ExportSwiftTests/Async.json | 1 + .../ExportSwiftTests/DefaultParameters.json | 1 + .../ExportSwiftTests/EnumAssociatedValue.json | 1 + .../ExportSwiftTests/EnumCase.json | 1 + .../EnumNamespace.Global.json | 413 ++++++++++++++++++ .../EnumNamespace.Global.swift | 215 +++++++++ .../ExportSwiftTests/EnumNamespace.json | 1 + .../ExportSwiftTests/EnumRawType.json | 1 + .../ExportSwiftTests/Namespaces.Global.json | 180 ++++++++ .../ExportSwiftTests/Namespaces.Global.swift | 144 ++++++ .../ExportSwiftTests/Namespaces.json | 1 + .../ExportSwiftTests/Optionals.json | 1 + .../ExportSwiftTests/PrimitiveParameters.json | 1 + .../ExportSwiftTests/PrimitiveReturn.json | 1 + .../ExportSwiftTests/PropertyTypes.json | 1 + .../ExportSwiftTests/Protocol.json | 1 + .../StaticFunctions.Global.json | 334 ++++++++++++++ .../StaticFunctions.Global.swift | 192 ++++++++ .../ExportSwiftTests/StaticFunctions.json | 1 + .../StaticProperties.Global.json | 337 ++++++++++++++ .../StaticProperties.Global.swift | 338 ++++++++++++++ .../ExportSwiftTests/StaticProperties.json | 1 + .../ExportSwiftTests/StringParameter.json | 1 + .../ExportSwiftTests/StringReturn.json | 1 + .../ExportSwiftTests/SwiftClass.json | 1 + .../ExportSwiftTests/SwiftClosure.json | 1 + .../ExportSwiftTests/Throws.json | 1 + .../VoidParameterVoidReturn.json | 1 + Plugins/PackageToJS/Sources/PackageToJS.swift | 3 +- .../BridgeJS/BridgeJS-Configuration.md | 38 +- .../Exporting-Swift/Using-Namespace.md | 10 +- .../JavaScript/BridgeJS.ExportSwift.json | 1 + .../bridge-js.config.exposeToGlobal.json | 3 + .../bridge-js.config.json | 4 +- Tests/prelude.exposeToGlobal.mjs | 248 +++++++++++ Tests/prelude.mjs | 121 ++--- 67 files changed, 2863 insertions(+), 415 deletions(-) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{EnumNamespace_NoGlobal.Export.d.ts => EnumNamespace.Global.Export.d.ts} (57%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{EnumNamespace_NoGlobal.Export.js => EnumNamespace.Global.Export.js} (87%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Namespaces_NoGlobal.Export.d.ts => Namespaces.Global.Export.d.ts} (70%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Namespaces_NoGlobal.Export.js => Namespaces.Global.Export.js} (91%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StaticFunctions_NoGlobal.Export.d.ts => StaticFunctions.Global.Export.d.ts} (92%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StaticFunctions_NoGlobal.Export.js => StaticFunctions.Global.Export.js} (97%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StaticProperties_NoGlobal.Export.d.ts => StaticProperties.Global.Export.d.ts} (85%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StaticProperties_NoGlobal.Export.js => StaticProperties.Global.Export.js} (92%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift create mode 100644 Tests/BridgeJSRuntimeTests/bridge-js.config.exposeToGlobal.json create mode 100644 Tests/prelude.exposeToGlobal.mjs diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json index cfec1d468..9094df267 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -502,7 +502,8 @@ "staticProperties" : [ ], - "swiftCallName" : "APIResult" + "swiftCallName" : "APIResult", + "tsFullPath" : "APIResult" }, { "cases" : [ @@ -698,9 +699,11 @@ "staticProperties" : [ ], - "swiftCallName" : "ComplexResult" + "swiftCallName" : "ComplexResult", + "tsFullPath" : "ComplexResult" } ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_run", diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json index 3e00433ef..f48970689 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -135,6 +135,7 @@ "enums" : [ ], + "exposeToGlobal" : false, "functions" : [ ], diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift index 2be8626e1..52cb0cc27 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift @@ -17,7 +17,7 @@ import class Foundation.JSONDecoder } func _update(swiftSource: String, dtsSource: String) throws -> PlayBridgeJSOutput { - let exportSwift = ExportSwift(progress: .silent, moduleName: "Playground") + let exportSwift = ExportSwift(progress: .silent, moduleName: "Playground", exposeToGlobal: false) let sourceFile = Parser.parse(source: swiftSource) try exportSwift.addSourceFile(sourceFile, "Playground.swift") let exportResult = try exportSwift.finalize() @@ -40,8 +40,7 @@ import class Foundation.JSONDecoder children: [importSkeleton] ) ], - sharedMemory: false, - exposeToGlobal: true + sharedMemory: false ) let linked = try linker.link() diff --git a/Makefile b/Makefile index c46431dd1..453b0b648 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,16 @@ unittest: --disable-sandbox \ js test --prelude ./Tests/prelude.mjs -Xnode --expose-gc +.PHONY: unittest-with-global +unittest-with-global: + cp Tests/BridgeJSRuntimeTests/bridge-js.config.exposeToGlobal.json Tests/BridgeJSRuntimeTests/bridge-js.config.local.json + swift package --allow-writing-to-directory Tests/BridgeJSRuntimeTests \ + bridge-js --package-path Tests/BridgeJSRuntimeTests + rm -f Tests/BridgeJSRuntimeTests/bridge-js.config.local.json + env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --swift-sdk "$(SWIFT_SDK_ID)" \ + --disable-sandbox \ + js test --prelude ./Tests/prelude.exposeToGlobal.mjs -Xnode --expose-gc + .PHONY: regenerate_swiftpm_resources regenerate_swiftpm_resources: npm run build diff --git a/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift b/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift index 9ea095205..47487bfc2 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift @@ -44,6 +44,8 @@ struct BridgeJSBuildPlugin: BuildToolPlugin { "export", "--module-name", target.name, + "--target-dir", + target.directoryURL.path, "--output-skeleton", outputSkeletonPath.path, "--output-swift", diff --git a/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift b/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift index a4a2fcf1e..26a0d0ef9 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift @@ -107,6 +107,8 @@ extension BridgeJSCommandPlugin.Context { "export", "--module-name", target.name, + "--target-dir", + target.directoryURL.path, "--output-skeleton", generatedJavaScriptDirectory.appending(path: "BridgeJS.ExportSwift.json").path, "--output-swift", diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSConfig.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSConfig.swift index cf6f881e6..56646b59c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSConfig.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSConfig.swift @@ -10,6 +10,31 @@ public struct BridgeJSConfig: Codable { /// If not present, the tool will be searched for in the system PATH. public var tools: [String: String]? + /// Whether to expose exported Swift APIs to the global namespace. + /// + /// When `true`, exported functions, classes, and namespaces are available + /// via `globalThis` in JavaScript. When `false`, they are only available + /// through the exports object returned by `createExports()`. + /// + /// Default: `false` + public var exposeToGlobal: Bool + + public init(tools: [String: String]? = nil, exposeToGlobal: Bool = false) { + self.tools = tools + self.exposeToGlobal = exposeToGlobal + } + + enum CodingKeys: String, CodingKey { + case tools + case exposeToGlobal + } + + 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 + } + /// Load the configuration file from the SwiftPM package target directory. /// /// Files are loaded **in this order** and merged (later files override earlier ones): @@ -49,7 +74,8 @@ public struct BridgeJSConfig: Codable { /// Merge the current configuration with the overrides. func merging(overrides: BridgeJSConfig) -> BridgeJSConfig { return BridgeJSConfig( - tools: (tools ?? [:]).merging(overrides.tools ?? [:], uniquingKeysWith: { $1 }) + tools: (tools ?? [:]).merging(overrides.tools ?? [:], uniquingKeysWith: { $1 }), + exposeToGlobal: overrides.exposeToGlobal ) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 4859ba6d9..d4ea770a3 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -20,7 +20,7 @@ import BridgeJSUtilities public class ExportSwift { let progress: ProgressReporting let moduleName: String - + private let exposeToGlobal: Bool private var exportedFunctions: [ExportedFunction] = [] private var exportedClasses: [ExportedClass] = [] private var exportedEnums: [ExportedEnum] = [] @@ -30,9 +30,10 @@ public class ExportSwift { private let enumCodegen: EnumCodegen = EnumCodegen() private let closureCodegen = ClosureCodegen() - public init(progress: ProgressReporting, moduleName: String) { + public init(progress: ProgressReporting, moduleName: String, exposeToGlobal: Bool) { self.progress = progress self.moduleName = moduleName + self.exposeToGlobal = exposeToGlobal } /// Processes a Swift source file to find declarations marked with @JS @@ -55,6 +56,8 @@ public class ExportSwift { /// Finalizes the export process and generates the bridge code /// + /// - Parameters: + /// - exposeToGlobal: Whether to expose exported APIs to the global namespace (default: false) /// - Returns: A tuple containing the generated Swift code and a skeleton /// describing the exported APIs public func finalize() throws -> (outputSwift: String, outputSkeleton: ExportedSkeleton)? { @@ -68,7 +71,8 @@ public class ExportSwift { functions: exportedFunctions, classes: exportedClasses, enums: exportedEnums, - protocols: exportedProtocols + protocols: exportedProtocols, + exposeToGlobal: exposeToGlobal ) ) } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 98b572029..23884608a 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -12,24 +12,26 @@ struct BridgeJSLink { var exportedSkeletons: [ExportedSkeleton] = [] var importedSkeletons: [ImportedModuleSkeleton] = [] let sharedMemory: Bool - let exposeToGlobal: Bool + var exposeToGlobal: Bool private let namespaceBuilder = NamespaceBuilder() init( exportedSkeletons: [ExportedSkeleton] = [], importedSkeletons: [ImportedModuleSkeleton] = [], - sharedMemory: Bool, - exposeToGlobal: Bool = true + sharedMemory: Bool ) { self.exportedSkeletons = exportedSkeletons self.importedSkeletons = importedSkeletons self.sharedMemory = sharedMemory - self.exposeToGlobal = exposeToGlobal + self.exposeToGlobal = exportedSkeletons.contains { $0.exposeToGlobal } } mutating func addExportedSkeletonFile(data: Data) throws { let skeleton = try JSONDecoder().decode(ExportedSkeleton.self, from: data) exportedSkeletons.append(skeleton) + if skeleton.exposeToGlobal { + exposeToGlobal = true + } } mutating func addImportedSkeletonFile(data: Data) throws { @@ -80,7 +82,7 @@ struct BridgeJSLink { var enumStaticAssignments: [String] = [] } - private func collectLinkData(exposeToGlobal: Bool) throws -> LinkData { + private func collectLinkData() throws -> LinkData { var data = LinkData() // Swift heap object class definitions @@ -1079,11 +1081,11 @@ struct BridgeJSLink { ) printer.write(lines: namespaceInitCode) - let propertyAssignments = try generateNamespacePropertyAssignments( - data: data, - exportedSkeletons: exportedSkeletons, - namespaceBuilder: namespaceBuilder, - exposeToGlobal: exposeToGlobal + let propertyAssignments = try generateNamespacePropertyAssignments( + data: data, + exportedSkeletons: exportedSkeletons, + namespaceBuilder: namespaceBuilder, + exposeToGlobal: exposeToGlobal ) printer.write(lines: propertyAssignments) } @@ -1097,7 +1099,7 @@ struct BridgeJSLink { } func link() throws -> (outputJs: String, outputDts: String) { - let data = try collectLinkData(exposeToGlobal: exposeToGlobal) + let data = try collectLinkData() let outputJs = try generateJavaScript(data: data) let outputDts = generateTypeScript(data: data) return (outputJs, outputDts) @@ -1160,7 +1162,6 @@ struct BridgeJSLink { ) throws -> [String] { let printer = CodeFragmentPrinter() - // Only write globalThis property assignments when exposeToGlobal is true if exposeToGlobal { printer.write(lines: data.enumStaticAssignments) } @@ -1171,7 +1172,6 @@ struct BridgeJSLink { let hierarchicalLines = try namespaceBuilder.buildHierarchicalExportsObject( exportedSkeletons: exportedSkeletons, - exposeToGlobal: exposeToGlobal, renderFunctionImpl: { function in let (js, _) = try self.renderExportedFunction(function: function) return js @@ -2478,7 +2478,6 @@ extension BridgeJSLink { fileprivate func buildHierarchicalExportsObject( exportedSkeletons: [ExportedSkeleton], - exposeToGlobal: Bool, renderFunctionImpl: (ExportedFunction) throws -> [String] ) throws -> [String] { let printer = CodeFragmentPrinter() @@ -2698,7 +2697,7 @@ extension BridgeJSLink { guard hasContent(node: childNode) else { continue } - + let exportKeyword = exposeToGlobal ? "" : "export " printer.write("\(exportKeyword)namespace \(childName) {") printer.indent() diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index a862f3c3b..12970b505 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -499,19 +499,27 @@ public struct ExportedSkeleton: Codable { public let classes: [ExportedClass] public let enums: [ExportedEnum] public let protocols: [ExportedProtocol] + /// Whether to expose exported APIs to the global namespace. + /// + /// When `true`, exported functions, classes, and namespaces are available + /// via `globalThis` in JavaScript. When `false`, they are only available + /// through the exports object. + public var exposeToGlobal: Bool public init( moduleName: String, functions: [ExportedFunction], classes: [ExportedClass], enums: [ExportedEnum], - protocols: [ExportedProtocol] = [] + protocols: [ExportedProtocol] = [], + exposeToGlobal: Bool ) { self.moduleName = moduleName self.functions = functions self.classes = classes self.enums = enums self.protocols = protocols + self.exposeToGlobal = exposeToGlobal } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index dba6fe47c..d5a58aba9 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -162,6 +162,10 @@ import TS2Skeleton help: "The name of the module for external function references", required: true ), + "target-dir": OptionRule( + help: "The SwiftPM package target directory", + required: true + ), "output-skeleton": OptionRule( help: "The output file path for the skeleton of the exported Swift APIs", required: true @@ -181,7 +185,13 @@ import TS2Skeleton arguments: Array(arguments.dropFirst()) ) let progress = ProgressReporting(verbose: doubleDashOptions["verbose"] == "true") - let exporter = ExportSwift(progress: progress, moduleName: doubleDashOptions["module-name"]!) + let targetDirectory = URL(fileURLWithPath: doubleDashOptions["target-dir"]!) + let config = try BridgeJSConfig.load(targetDirectory: targetDirectory) + let exporter = ExportSwift( + progress: progress, + moduleName: doubleDashOptions["module-name"]!, + exposeToGlobal: config.exposeToGlobal + ) for inputFile in positionalArguments.sorted() { let sourceURL = URL(fileURLWithPath: inputFile) guard sourceURL.pathExtension == "swift" else { continue } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift index b837451db..989d05e2f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift @@ -47,16 +47,12 @@ import Testing func snapshotExport(input: String) throws { let url = Self.inputsDirectory.appendingPathComponent(input) let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) - let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule") + let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) try swiftAPI.addSourceFile(sourceFile, input) let name = url.deletingPathExtension().lastPathComponent let (_, outputSkeleton) = try #require(try swiftAPI.finalize()) - let encoder = JSONEncoder() - encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - let outputSkeletonData = try encoder.encode(outputSkeleton) - var bridgeJSLink = BridgeJSLink(sharedMemory: false, exposeToGlobal: true) - try bridgeJSLink.addExportedSkeletonFile(data: outputSkeletonData) + let bridgeJSLink: BridgeJSLink = BridgeJSLink(exportedSkeletons: [outputSkeleton], sharedMemory: false) try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Export") } @@ -74,7 +70,7 @@ import Testing encoder.outputFormatting = [.prettyPrinted, .sortedKeys] let outputSkeletonData = try encoder.encode(importTS.skeleton) - var bridgeJSLink = BridgeJSLink(sharedMemory: false, exposeToGlobal: true) + var bridgeJSLink = BridgeJSLink(sharedMemory: false) try bridgeJSLink.addImportedSkeletonFile(data: outputSkeletonData) try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Import") } @@ -83,45 +79,16 @@ import Testing "Namespaces.swift", "StaticFunctions.swift", "StaticProperties.swift", - "EnumNamespace.swift" + "EnumNamespace.swift", ]) - func testWithoutGlobal(inputFile: String) throws { + func snapshotExportWithGlobal(inputFile: String) throws { let url = Self.inputsDirectory.appendingPathComponent(inputFile) let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) - let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule") + let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: true) try swiftAPI.addSourceFile(sourceFile, inputFile) - + let name = url.deletingPathExtension().lastPathComponent let (_, outputSkeleton) = try #require(try swiftAPI.finalize()) - let encoder = JSONEncoder() - encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - let outputSkeletonData = try encoder.encode(outputSkeleton) - - var bridgeJSLink = BridgeJSLink(sharedMemory: false, exposeToGlobal: false) - try bridgeJSLink.addExportedSkeletonFile(data: outputSkeletonData) - - let (outputJs, outputDts) = try bridgeJSLink.link() - - // Verify no global declarations - #expect(!outputDts.contains("declare global")) - #expect(!outputJs.contains("globalThis.")) - - // Save snapshots - let name = url.deletingPathExtension().lastPathComponent + "_NoGlobal.Export" - try assertSnapshot( - name: name, - filePath: #filePath, - function: #function, - sourceLocation: #_sourceLocation, - input: outputJs.data(using: .utf8)!, - fileExtension: "js" - ) - try assertSnapshot( - name: name, - filePath: #filePath, - function: #function, - sourceLocation: #_sourceLocation, - input: outputDts.data(using: .utf8)!, - fileExtension: "d.ts" - ) + let bridgeJSLink: BridgeJSLink = BridgeJSLink(exportedSkeletons: [outputSkeleton], sharedMemory: false) + try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Global.Export") } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift index e184116fe..32c3aae73 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift @@ -47,11 +47,26 @@ import Testing @Test(arguments: collectInputs()) func snapshot(input: String) throws { - let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule") + let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) let url = Self.inputsDirectory.appendingPathComponent(input) let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) try swiftAPI.addSourceFile(sourceFile, input) let name = url.deletingPathExtension().lastPathComponent try snapshot(swiftAPI: swiftAPI, name: name) } + + @Test(arguments: [ + "Namespaces.swift", + "StaticFunctions.swift", + "StaticProperties.swift", + "EnumNamespace.swift", + ]) + func snapshotWithGlobal(input: String) throws { + let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: true) + let url = Self.inputsDirectory.appendingPathComponent(input) + let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) + try swiftAPI.addSourceFile(sourceFile, input) + let name = url.deletingPathExtension().lastPathComponent + try snapshot(swiftAPI: swiftAPI, name: name + ".Global") + } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts index 5523b89ec..9df9bbea3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts @@ -53,32 +53,27 @@ export type NetworkingResultObject = typeof API.NetworkingResultValues; export type APIOptionalResultObject = typeof APIOptionalResultValues; -export {}; - -declare global { - namespace API { - const NetworkingResultValues: { - readonly Tag: { - readonly Success: 0; - readonly Failure: 1; - }; +export namespace API { + const NetworkingResultValues: { + readonly Tag: { + readonly Success: 0; + readonly Failure: 1; }; - type NetworkingResultTag = - { tag: typeof NetworkingResultValues.Tag.Success; param0: string } | { tag: typeof NetworkingResultValues.Tag.Failure; param0: string; param1: number } - } - namespace Utilities { - const ResultValues: { - readonly Tag: { - readonly Success: 0; - readonly Failure: 1; - readonly Status: 2; - }; + }; + type NetworkingResultTag = + { tag: typeof NetworkingResultValues.Tag.Success; param0: string } | { tag: typeof NetworkingResultValues.Tag.Failure; param0: string; param1: number } +} +export namespace Utilities { + const ResultValues: { + readonly Tag: { + readonly Success: 0; + readonly Failure: 1; + readonly Status: 2; }; - type ResultTag = - { tag: typeof ResultValues.Tag.Success; param0: string } | { tag: typeof ResultValues.Tag.Failure; param0: string; param1: number } | { tag: typeof ResultValues.Tag.Status; param0: boolean; param1: number; param2: string } - } + }; + type ResultTag = + { tag: typeof ResultValues.Tag.Success; param0: string } | { tag: typeof ResultValues.Tag.Failure; param0: string; param1: number } | { tag: typeof ResultValues.Tag.Status; param0: boolean; param1: number; param2: string } } - export type Exports = { handle(result: APIResultTag): void; getResult(): APIResultTag; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index 14c150e51..c332a403e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -479,14 +479,6 @@ const __bjs_createAPIOptionalResultValuesHelpers = () => { } }); }; -if (typeof globalThis.API === 'undefined') { - globalThis.API = {}; -} -if (typeof globalThis.Utilities === 'undefined') { - globalThis.Utilities = {}; -} -globalThis.Utilities.ResultValues = ResultValues; -globalThis.API.NetworkingResultValues = NetworkingResultValues; export async function createInstantiator(options, swift) { let instance; let memory; @@ -692,12 +684,6 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - if (typeof globalThis.API === 'undefined') { - globalThis.API = {}; - } - if (typeof globalThis.Utilities === 'undefined') { - globalThis.Utilities = {}; - } const exports = { handle: function bjs_handle(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.APIResult.lower(result); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts index 4261ca3bb..b8b92d14e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts @@ -12,60 +12,41 @@ export type PortObject = typeof Configuration.PortValues; export type SupportedMethodObject = typeof Networking.APIV2.Internal.SupportedMethodValues; -export {}; - -declare global { - namespace Configuration { - const LogLevelValues: { - readonly Debug: "debug"; - readonly Info: "info"; - readonly Warning: "warning"; - readonly Error: "error"; - }; - type LogLevelTag = typeof LogLevelValues[keyof typeof LogLevelValues]; - const PortValues: { - readonly Http: 80; - readonly Https: 443; - readonly Development: 3000; +export namespace Configuration { + const LogLevelValues: { + readonly Debug: "debug"; + readonly Info: "info"; + readonly Warning: "warning"; + readonly Error: "error"; + }; + type LogLevelTag = typeof LogLevelValues[keyof typeof LogLevelValues]; + const PortValues: { + readonly Http: 80; + readonly Https: 443; + readonly Development: 3000; + }; + type PortTag = typeof PortValues[keyof typeof PortValues]; +} +export namespace Networking { + export namespace API { + const MethodValues: { + readonly Get: 0; + readonly Post: 1; + readonly Put: 2; + readonly Delete: 3; }; - type PortTag = typeof PortValues[keyof typeof PortValues]; + type MethodTag = typeof MethodValues[keyof typeof MethodValues]; } - namespace Networking { - namespace API { - class HTTPServer { - constructor(); - call(method: Networking.API.MethodTag): void; - } - const MethodValues: { + export namespace APIV2 { + export namespace Internal { + const SupportedMethodValues: { readonly Get: 0; readonly Post: 1; - readonly Put: 2; - readonly Delete: 3; }; - type MethodTag = typeof MethodValues[keyof typeof MethodValues]; - } - namespace APIV2 { - namespace Internal { - class TestServer { - constructor(); - call(method: Networking.APIV2.Internal.SupportedMethodTag): void; - } - const SupportedMethodValues: { - readonly Get: 0; - readonly Post: 1; - }; - type SupportedMethodTag = typeof SupportedMethodValues[keyof typeof SupportedMethodValues]; - } - } - } - namespace Utils { - class Converter { - constructor(); - toString(value: number): string; + type SupportedMethodTag = typeof SupportedMethodValues[keyof typeof SupportedMethodValues]; } } } - /// Represents a Swift heap object like a class instance or an actor instance. export interface SwiftHeapObject { /// Release the heap object. diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index a38b50933..9fed226d9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -29,25 +29,6 @@ export const SupportedMethodValues = { Post: 1, }; -if (typeof globalThis.Configuration === 'undefined') { - globalThis.Configuration = {}; -} -if (typeof globalThis.Networking === 'undefined') { - globalThis.Networking = {}; -} -if (typeof globalThis.Networking.API === 'undefined') { - globalThis.Networking.API = {}; -} -if (typeof globalThis.Networking.APIV2 === 'undefined') { - globalThis.Networking.APIV2 = {}; -} -if (typeof globalThis.Networking.APIV2.Internal === 'undefined') { - globalThis.Networking.APIV2.Internal = {}; -} -globalThis.Networking.API.MethodValues = MethodValues; -globalThis.Configuration.LogLevelValues = LogLevelValues; -globalThis.Configuration.PortValues = PortValues; -globalThis.Networking.APIV2.Internal.SupportedMethodValues = SupportedMethodValues; export async function createInstantiator(options, swift) { let instance; let memory; @@ -314,24 +295,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_TestServer_call(this.pointer, method); } } - if (typeof globalThis.Configuration === 'undefined') { - globalThis.Configuration = {}; - } - if (typeof globalThis.Networking === 'undefined') { - globalThis.Networking = {}; - } - if (typeof globalThis.Networking.API === 'undefined') { - globalThis.Networking.API = {}; - } - if (typeof globalThis.Networking.APIV2 === 'undefined') { - globalThis.Networking.APIV2 = {}; - } - if (typeof globalThis.Networking.APIV2.Internal === 'undefined') { - globalThis.Networking.APIV2.Internal = {}; - } - if (typeof globalThis.Utils === 'undefined') { - globalThis.Utils = {}; - } const exports = { Configuration: { LogLevel: LogLevelValues, @@ -354,9 +317,6 @@ export async function createInstantiator(options, swift) { }, }; _exports = exports; - globalThis.Utils.Converter = exports.Utils.Converter; - globalThis.Networking.API.HTTPServer = exports.Networking.API.HTTPServer; - globalThis.Networking.APIV2.Internal.TestServer = exports.Networking.APIV2.Internal.TestServer; return exports; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace_NoGlobal.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.d.ts similarity index 57% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace_NoGlobal.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.d.ts index b8b92d14e..4261ca3bb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace_NoGlobal.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.d.ts @@ -12,41 +12,60 @@ export type PortObject = typeof Configuration.PortValues; export type SupportedMethodObject = typeof Networking.APIV2.Internal.SupportedMethodValues; -export namespace Configuration { - const LogLevelValues: { - readonly Debug: "debug"; - readonly Info: "info"; - readonly Warning: "warning"; - readonly Error: "error"; - }; - type LogLevelTag = typeof LogLevelValues[keyof typeof LogLevelValues]; - const PortValues: { - readonly Http: 80; - readonly Https: 443; - readonly Development: 3000; - }; - type PortTag = typeof PortValues[keyof typeof PortValues]; -} -export namespace Networking { - export namespace API { - const MethodValues: { - readonly Get: 0; - readonly Post: 1; - readonly Put: 2; - readonly Delete: 3; +export {}; + +declare global { + namespace Configuration { + const LogLevelValues: { + readonly Debug: "debug"; + readonly Info: "info"; + readonly Warning: "warning"; + readonly Error: "error"; + }; + type LogLevelTag = typeof LogLevelValues[keyof typeof LogLevelValues]; + const PortValues: { + readonly Http: 80; + readonly Https: 443; + readonly Development: 3000; }; - type MethodTag = typeof MethodValues[keyof typeof MethodValues]; + type PortTag = typeof PortValues[keyof typeof PortValues]; } - export namespace APIV2 { - export namespace Internal { - const SupportedMethodValues: { + namespace Networking { + namespace API { + class HTTPServer { + constructor(); + call(method: Networking.API.MethodTag): void; + } + const MethodValues: { readonly Get: 0; readonly Post: 1; + readonly Put: 2; + readonly Delete: 3; }; - type SupportedMethodTag = typeof SupportedMethodValues[keyof typeof SupportedMethodValues]; + type MethodTag = typeof MethodValues[keyof typeof MethodValues]; + } + namespace APIV2 { + namespace Internal { + class TestServer { + constructor(); + call(method: Networking.APIV2.Internal.SupportedMethodTag): void; + } + const SupportedMethodValues: { + readonly Get: 0; + readonly Post: 1; + }; + type SupportedMethodTag = typeof SupportedMethodValues[keyof typeof SupportedMethodValues]; + } + } + } + namespace Utils { + class Converter { + constructor(); + toString(value: number): string; } } } + /// Represents a Swift heap object like a class instance or an actor instance. export interface SwiftHeapObject { /// Release the heap object. diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace_NoGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js similarity index 87% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace_NoGlobal.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js index 9fed226d9..a38b50933 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace_NoGlobal.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js @@ -29,6 +29,25 @@ export const SupportedMethodValues = { Post: 1, }; +if (typeof globalThis.Configuration === 'undefined') { + globalThis.Configuration = {}; +} +if (typeof globalThis.Networking === 'undefined') { + globalThis.Networking = {}; +} +if (typeof globalThis.Networking.API === 'undefined') { + globalThis.Networking.API = {}; +} +if (typeof globalThis.Networking.APIV2 === 'undefined') { + globalThis.Networking.APIV2 = {}; +} +if (typeof globalThis.Networking.APIV2.Internal === 'undefined') { + globalThis.Networking.APIV2.Internal = {}; +} +globalThis.Networking.API.MethodValues = MethodValues; +globalThis.Configuration.LogLevelValues = LogLevelValues; +globalThis.Configuration.PortValues = PortValues; +globalThis.Networking.APIV2.Internal.SupportedMethodValues = SupportedMethodValues; export async function createInstantiator(options, swift) { let instance; let memory; @@ -295,6 +314,24 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_TestServer_call(this.pointer, method); } } + if (typeof globalThis.Configuration === 'undefined') { + globalThis.Configuration = {}; + } + if (typeof globalThis.Networking === 'undefined') { + globalThis.Networking = {}; + } + if (typeof globalThis.Networking.API === 'undefined') { + globalThis.Networking.API = {}; + } + if (typeof globalThis.Networking.APIV2 === 'undefined') { + globalThis.Networking.APIV2 = {}; + } + if (typeof globalThis.Networking.APIV2.Internal === 'undefined') { + globalThis.Networking.APIV2.Internal = {}; + } + if (typeof globalThis.Utils === 'undefined') { + globalThis.Utils = {}; + } const exports = { Configuration: { LogLevel: LogLevelValues, @@ -317,6 +354,9 @@ export async function createInstantiator(options, swift) { }, }; _exports = exports; + globalThis.Utils.Converter = exports.Utils.Converter; + globalThis.Networking.API.HTTPServer = exports.Networking.API.HTTPServer; + globalThis.Networking.APIV2.Internal.TestServer = exports.Networking.APIV2.Internal.TestServer; return exports; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.d.ts index cdf83f36d..67a89533a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.d.ts @@ -4,35 +4,6 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -export {}; - -declare global { - namespace MyModule { - namespace Utils { - namespacedFunction(): string; - } - } - namespace Utils { - namespace Converters { - class Converter { - constructor(); - toString(value: number): string; - } - } - } - namespace __Swift { - namespace Foundation { - class Greeter { - constructor(name: string); - greet(): string; - } - class UUID { - uuidString(): string; - } - } - } -} - /// Represents a Swift heap object like a class instance or an actor instance. export interface SwiftHeapObject { /// Release the heap object. diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index 67670d204..08601bd50 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -275,24 +275,6 @@ export async function createInstantiator(options, swift) { return ret; } } - if (typeof globalThis.MyModule === 'undefined') { - globalThis.MyModule = {}; - } - if (typeof globalThis.MyModule.Utils === 'undefined') { - globalThis.MyModule.Utils = {}; - } - if (typeof globalThis.Utils === 'undefined') { - globalThis.Utils = {}; - } - if (typeof globalThis.Utils.Converters === 'undefined') { - globalThis.Utils.Converters = {}; - } - if (typeof globalThis.__Swift === 'undefined') { - globalThis.__Swift = {}; - } - if (typeof globalThis.__Swift.Foundation === 'undefined') { - globalThis.__Swift.Foundation = {}; - } const exports = { plainFunction: function bjs_plainFunction() { instance.exports.bjs_plainFunction(); @@ -323,10 +305,6 @@ export async function createInstantiator(options, swift) { }, }; _exports = exports; - globalThis.__Swift.Foundation.Greeter = exports.__Swift.Foundation.Greeter; - globalThis.Utils.Converters.Converter = exports.Utils.Converters.Converter; - globalThis.__Swift.Foundation.UUID = exports.__Swift.Foundation.UUID; - globalThis.MyModule.Utils.namespacedFunction = exports.MyModule.Utils.namespacedFunction; return exports; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces_NoGlobal.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.d.ts similarity index 70% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces_NoGlobal.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.d.ts index 67a89533a..cdf83f36d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces_NoGlobal.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.d.ts @@ -4,6 +4,35 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. +export {}; + +declare global { + namespace MyModule { + namespace Utils { + namespacedFunction(): string; + } + } + namespace Utils { + namespace Converters { + class Converter { + constructor(); + toString(value: number): string; + } + } + } + namespace __Swift { + namespace Foundation { + class Greeter { + constructor(name: string); + greet(): string; + } + class UUID { + uuidString(): string; + } + } + } +} + /// Represents a Swift heap object like a class instance or an actor instance. export interface SwiftHeapObject { /// Release the heap object. diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces_NoGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js similarity index 91% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces_NoGlobal.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js index 08601bd50..67670d204 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces_NoGlobal.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js @@ -275,6 +275,24 @@ export async function createInstantiator(options, swift) { return ret; } } + if (typeof globalThis.MyModule === 'undefined') { + globalThis.MyModule = {}; + } + if (typeof globalThis.MyModule.Utils === 'undefined') { + globalThis.MyModule.Utils = {}; + } + if (typeof globalThis.Utils === 'undefined') { + globalThis.Utils = {}; + } + if (typeof globalThis.Utils.Converters === 'undefined') { + globalThis.Utils.Converters = {}; + } + if (typeof globalThis.__Swift === 'undefined') { + globalThis.__Swift = {}; + } + if (typeof globalThis.__Swift.Foundation === 'undefined') { + globalThis.__Swift.Foundation = {}; + } const exports = { plainFunction: function bjs_plainFunction() { instance.exports.bjs_plainFunction(); @@ -305,6 +323,10 @@ export async function createInstantiator(options, swift) { }, }; _exports = exports; + globalThis.__Swift.Foundation.Greeter = exports.__Swift.Foundation.Greeter; + globalThis.Utils.Converters.Converter = exports.Utils.Converters.Converter; + globalThis.__Swift.Foundation.UUID = exports.__Swift.Foundation.UUID; + globalThis.MyModule.Utils.namespacedFunction = exports.MyModule.Utils.namespacedFunction; return exports; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.d.ts index 069c1628c..e938ddb9a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.d.ts @@ -28,16 +28,6 @@ export type APIResultObject = typeof APIResultValues & { roundtrip(value: APIResultTag): APIResultTag; }; -export {}; - -declare global { - namespace Utils { - namespace String { - uppercase(text: string): string; - } - } -} - /// Represents a Swift heap object like a class instance or an actor instance. export interface SwiftHeapObject { /// Release the heap object. diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index 3e445992e..8522168f2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -297,12 +297,6 @@ export async function createInstantiator(options, swift) { return ret; } } - if (typeof globalThis.Utils === 'undefined') { - globalThis.Utils = {}; - } - if (typeof globalThis.Utils.String === 'undefined') { - globalThis.Utils.String = {}; - } const exports = { MathUtils, Calculator: { @@ -337,7 +331,6 @@ export async function createInstantiator(options, swift) { }, }; _exports = exports; - globalThis.Utils.String.uppercase = exports.Utils.String.uppercase; return exports; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions_NoGlobal.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.d.ts similarity index 92% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions_NoGlobal.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.d.ts index e938ddb9a..069c1628c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions_NoGlobal.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.d.ts @@ -28,6 +28,16 @@ export type APIResultObject = typeof APIResultValues & { roundtrip(value: APIResultTag): APIResultTag; }; +export {}; + +declare global { + namespace Utils { + namespace String { + uppercase(text: string): string; + } + } +} + /// Represents a Swift heap object like a class instance or an actor instance. export interface SwiftHeapObject { /// Release the heap object. diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions_NoGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js similarity index 97% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions_NoGlobal.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js index 8522168f2..3e445992e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions_NoGlobal.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js @@ -297,6 +297,12 @@ export async function createInstantiator(options, swift) { return ret; } } + if (typeof globalThis.Utils === 'undefined') { + globalThis.Utils = {}; + } + if (typeof globalThis.Utils.String === 'undefined') { + globalThis.Utils.String = {}; + } const exports = { MathUtils, Calculator: { @@ -331,6 +337,7 @@ export async function createInstantiator(options, swift) { }, }; _exports = exports; + globalThis.Utils.String.uppercase = exports.Utils.String.uppercase; return exports; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.d.ts index fea3c4b59..4ce689edb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.d.ts @@ -16,20 +16,6 @@ export type PropertyEnumObject = typeof PropertyEnumValues & { computedEnum: string; }; -export {}; - -declare global { - namespace PropertyNamespace { - var namespaceConstant: string; - let namespaceProperty: string; - namespace Nested { - var nestedConstant: string; - let nestedDouble: number; - let nestedProperty: number; - } - } -} - /// Represents a Swift heap object like a class instance or an actor instance. export interface SwiftHeapObject { /// Release the heap object. diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js index 09a2b0de9..5d70c39b1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js @@ -303,12 +303,6 @@ export async function createInstantiator(options, swift) { } } } - if (typeof globalThis.PropertyNamespace === 'undefined') { - globalThis.PropertyNamespace = {}; - } - if (typeof globalThis.PropertyNamespace.Nested === 'undefined') { - globalThis.PropertyNamespace.Nested = {}; - } const exports = { PropertyClass, PropertyEnum: { @@ -386,24 +380,6 @@ export async function createInstantiator(options, swift) { }, }; _exports = exports; - Object.defineProperty(globalThis.PropertyNamespace, 'namespaceProperty', { - get: () => exports.PropertyNamespace.namespaceProperty, - set: (value) => { exports.PropertyNamespace.namespaceProperty = value; } - }); - Object.defineProperty(globalThis.PropertyNamespace, 'namespaceConstant', { - get: () => exports.PropertyNamespace.namespaceConstant, - }); - Object.defineProperty(globalThis.PropertyNamespace.Nested, 'nestedProperty', { - get: () => exports.PropertyNamespace.Nested.nestedProperty, - set: (value) => { exports.PropertyNamespace.Nested.nestedProperty = value; } - }); - Object.defineProperty(globalThis.PropertyNamespace.Nested, 'nestedConstant', { - get: () => exports.PropertyNamespace.Nested.nestedConstant, - }); - Object.defineProperty(globalThis.PropertyNamespace.Nested, 'nestedDouble', { - get: () => exports.PropertyNamespace.Nested.nestedDouble, - set: (value) => { exports.PropertyNamespace.Nested.nestedDouble = value; } - }); return exports; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties_NoGlobal.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.d.ts similarity index 85% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties_NoGlobal.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.d.ts index 4ce689edb..fea3c4b59 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties_NoGlobal.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.d.ts @@ -16,6 +16,20 @@ export type PropertyEnumObject = typeof PropertyEnumValues & { computedEnum: string; }; +export {}; + +declare global { + namespace PropertyNamespace { + var namespaceConstant: string; + let namespaceProperty: string; + namespace Nested { + var nestedConstant: string; + let nestedDouble: number; + let nestedProperty: number; + } + } +} + /// Represents a Swift heap object like a class instance or an actor instance. export interface SwiftHeapObject { /// Release the heap object. diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties_NoGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js similarity index 92% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties_NoGlobal.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js index 5d70c39b1..09a2b0de9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties_NoGlobal.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js @@ -303,6 +303,12 @@ export async function createInstantiator(options, swift) { } } } + if (typeof globalThis.PropertyNamespace === 'undefined') { + globalThis.PropertyNamespace = {}; + } + if (typeof globalThis.PropertyNamespace.Nested === 'undefined') { + globalThis.PropertyNamespace.Nested = {}; + } const exports = { PropertyClass, PropertyEnum: { @@ -380,6 +386,24 @@ export async function createInstantiator(options, swift) { }, }; _exports = exports; + Object.defineProperty(globalThis.PropertyNamespace, 'namespaceProperty', { + get: () => exports.PropertyNamespace.namespaceProperty, + set: (value) => { exports.PropertyNamespace.namespaceProperty = value; } + }); + Object.defineProperty(globalThis.PropertyNamespace, 'namespaceConstant', { + get: () => exports.PropertyNamespace.namespaceConstant, + }); + Object.defineProperty(globalThis.PropertyNamespace.Nested, 'nestedProperty', { + get: () => exports.PropertyNamespace.Nested.nestedProperty, + set: (value) => { exports.PropertyNamespace.Nested.nestedProperty = value; } + }); + Object.defineProperty(globalThis.PropertyNamespace.Nested, 'nestedConstant', { + get: () => exports.PropertyNamespace.Nested.nestedConstant, + }); + Object.defineProperty(globalThis.PropertyNamespace.Nested, 'nestedDouble', { + get: () => exports.PropertyNamespace.Nested.nestedDouble, + set: (value) => { exports.PropertyNamespace.Nested.nestedDouble = value; } + }); return exports; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json index 41696d635..2e295991b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json @@ -5,6 +5,7 @@ "enums" : [ ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_asyncReturnVoid", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json index 98c09bef0..ccb4cb289 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json @@ -259,6 +259,7 @@ "tsFullPath" : "Status" } ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_testStringDefault", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json index d2ab06d42..52279ce0d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json @@ -487,6 +487,7 @@ "tsFullPath" : "APIOptionalResult" } ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_handle", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json index 3e738dd2b..9effaaec7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json @@ -133,6 +133,7 @@ "tsFullPath" : "PublicStatus" } ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_setDirection", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json new file mode 100644 index 000000000..8aeb6c78c --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json @@ -0,0 +1,413 @@ +{ + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Converter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_Converter_toString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "toString", + "namespace" : [ + "Utils" + ], + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Converter", + "namespace" : [ + "Utils" + ], + "properties" : [ + + ], + "swiftCallName" : "Utils.Converter" + }, + { + "constructor" : { + "abiName" : "bjs_HTTPServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_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_TestServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_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" + } + ], + "enums" : [ + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Utils", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utils", + "tsFullPath" : "Utils" + }, + { + "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" + } + ], + "exposeToGlobal" : true, + "functions" : [ + + ], + "moduleName" : "TestModule", + "protocols" : [ + + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift new file mode 100644 index 000000000..ca201f3d9 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift @@ -0,0 +1,215 @@ +// 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 + +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 { +} + +extension Configuration.Port: _BridgedSwiftEnumNoPayload { +} + +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 + } + } +} + +@_expose(wasm, "bjs_Converter_init") +@_cdecl("bjs_Converter_init") +public func _bjs_Converter_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Utils.Converter() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Converter_toString") +@_cdecl("bjs_Converter_toString") +public func _bjs_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_Converter_deinit") +@_cdecl("bjs_Converter_deinit") +public func _bjs_Converter_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") + func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_Converter_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +@_expose(wasm, "bjs_HTTPServer_init") +@_cdecl("bjs_HTTPServer_init") +public func _bjs_HTTPServer_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Networking.API.HTTPServer() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_HTTPServer_call") +@_cdecl("bjs_HTTPServer_call") +public func _bjs_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_HTTPServer_deinit") +@_cdecl("bjs_HTTPServer_deinit") +public func _bjs_HTTPServer_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "TestModule", name: "bjs_HTTPServer_wrap") + func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_HTTPServer_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +@_expose(wasm, "bjs_TestServer_init") +@_cdecl("bjs_TestServer_init") +public func _bjs_TestServer_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Internal.TestServer() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestServer_call") +@_cdecl("bjs_TestServer_call") +public func _bjs_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_TestServer_deinit") +@_cdecl("bjs_TestServer_deinit") +public func _bjs_TestServer_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "TestModule", name: "bjs_TestServer_wrap") + func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_TestServer_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json index 1ba8279e4..94d1bb061 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json @@ -402,6 +402,7 @@ "tsFullPath" : "Networking.APIV2.Internal.SupportedMethod" } ], + "exposeToGlobal" : false, "functions" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json index 30ec6a35d..4bf1644c4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json @@ -457,6 +457,7 @@ "tsFullPath" : "Ratio" } ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_setTheme", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json new file mode 100644 index 000000000..bde86c44f --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json @@ -0,0 +1,180 @@ +{ + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Greeter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_Greeter_greet", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Greeter", + "namespace" : [ + "__Swift", + "Foundation" + ], + "properties" : [ + + ], + "swiftCallName" : "Greeter" + }, + { + "constructor" : { + "abiName" : "bjs_Converter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_Converter_toString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "toString", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Converter", + "namespace" : [ + "Utils", + "Converters" + ], + "properties" : [ + + ], + "swiftCallName" : "Converter" + }, + { + "methods" : [ + { + "abiName" : "bjs_UUID_uuidString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "uuidString", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "UUID", + "namespace" : [ + "__Swift", + "Foundation" + ], + "properties" : [ + + ], + "swiftCallName" : "UUID" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : true, + "functions" : [ + { + "abiName" : "bjs_plainFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "plainFunction", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_MyModule_Utils_namespacedFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "namespacedFunction", + "namespace" : [ + "MyModule", + "Utils" + ], + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "moduleName" : "TestModule", + "protocols" : [ + + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift new file mode 100644 index 000000000..f868fa111 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift @@ -0,0 +1,144 @@ +// 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 + +@_expose(wasm, "bjs_plainFunction") +@_cdecl("bjs_plainFunction") +public func _bjs_plainFunction() -> Void { + #if arch(wasm32) + let ret = plainFunction() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MyModule_Utils_namespacedFunction") +@_cdecl("bjs_MyModule_Utils_namespacedFunction") +public func _bjs_MyModule_Utils_namespacedFunction() -> Void { + #if arch(wasm32) + let ret = namespacedFunction() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_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_deinit") +@_cdecl("bjs_Greeter_deinit") +public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") + func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_Greeter_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +@_expose(wasm, "bjs_Converter_init") +@_cdecl("bjs_Converter_init") +public func _bjs_Converter_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Converter() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Converter_toString") +@_cdecl("bjs_Converter_toString") +public func _bjs_Converter_toString(_self: UnsafeMutableRawPointer, value: Int32) -> Void { + #if arch(wasm32) + let ret = Converter.bridgeJSLiftParameter(_self).toString(value: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Converter_deinit") +@_cdecl("bjs_Converter_deinit") +public func _bjs_Converter_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") + func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_Converter_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +@_expose(wasm, "bjs_UUID_uuidString") +@_cdecl("bjs_UUID_uuidString") +public func _bjs_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_UUID_deinit") +@_cdecl("bjs_UUID_deinit") +public func _bjs_UUID_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension UUID: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "TestModule", name: "bjs_UUID_wrap") + func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_UUID_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json index dc6134526..910fcfc2c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json @@ -132,6 +132,7 @@ "enums" : [ ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_plainFunction", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json index 104b11d5a..eb92b21d5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json @@ -157,6 +157,7 @@ "enums" : [ ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_roundTripOptionalClass", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json index e54d0ad53..ccd504f4d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json @@ -5,6 +5,7 @@ "enums" : [ ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_check", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json index 99c5aff05..6210c8663 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json @@ -5,6 +5,7 @@ "enums" : [ ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_checkInt", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json index 946411036..14f0cc0fd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json @@ -253,6 +253,7 @@ "enums" : [ ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_createPropertyHolder", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json index efda4d145..487533b38 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json @@ -392,6 +392,7 @@ "tsFullPath" : "Priority" } ], + "exposeToGlobal" : false, "functions" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json new file mode 100644 index 000000000..8a2923a02 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json @@ -0,0 +1,334 @@ +{ + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_MathUtils_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_MathUtils_static_subtract", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "subtract", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "int" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "className" : { + "_0" : "MathUtils" + } + } + }, + { + "abiName" : "bjs_MathUtils_static_add", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "add", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "int" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "className" : { + "_0" : "MathUtils" + } + } + }, + { + "abiName" : "bjs_MathUtils_multiply", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "multiply", + "parameters" : [ + { + "label" : "x", + "name" : "x", + "type" : { + "int" : { + + } + } + }, + { + "label" : "y", + "name" : "y", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + } + ], + "name" : "MathUtils", + "properties" : [ + + ], + "swiftCallName" : "MathUtils" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "scientific" + }, + { + "associatedValues" : [ + + ], + "name" : "basic" + } + ], + "emitStyle" : "const", + "name" : "Calculator", + "staticMethods" : [ + { + "abiName" : "bjs_Calculator_static_square", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "square", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "enumName" : { + "_0" : "Calculator" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Calculator", + "tsFullPath" : "Calculator" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "int" : { + + } + } + } + ], + "name" : "failure" + } + ], + "emitStyle" : "const", + "name" : "APIResult", + "staticMethods" : [ + { + "abiName" : "bjs_APIResult_static_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundtrip", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "staticContext" : { + "enumName" : { + "_0" : "APIResult" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "APIResult", + "tsFullPath" : "APIResult" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Utils", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utils", + "tsFullPath" : "Utils" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "String", + "namespace" : [ + "Utils" + ], + "staticMethods" : [ + { + "abiName" : "bjs_Utils_String_static_uppercase", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "uppercase", + "namespace" : [ + "Utils", + "String" + ], + "parameters" : [ + { + "label" : "_", + "name" : "text", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utils.String", + "tsFullPath" : "Utils.String" + } + ], + "exposeToGlobal" : true, + "functions" : [ + + ], + "moduleName" : "TestModule", + "protocols" : [ + + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift new file mode 100644 index 000000000..7aa91b915 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift @@ -0,0 +1,192 @@ +// 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 + +extension Calculator: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Calculator { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Calculator { + return Calculator(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_Calculator_static_square") +@_cdecl("bjs_Calculator_static_square") +public func _bjs_Calculator_static_square(value: Int32) -> Int32 { + #if arch(wasm32) + let ret = Calculator.square(value: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension APIResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { + switch caseId { + case 0: + return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + case 1: + return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + default: + fatalError("Unknown APIResult case ID: \(caseId)") + } + } + + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + return Int32(0) + case .failure(let param0): + _swift_js_push_int(Int32(param0)) + return Int32(1) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + switch self { + case .success(let param0): + _swift_js_push_tag(Int32(0)) + var __bjs_param0 = param0 + __bjs_param0.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + case .failure(let param0): + _swift_js_push_tag(Int32(1)) + _swift_js_push_int(Int32(param0)) + } + } +} + +@_expose(wasm, "bjs_APIResult_static_roundtrip") +@_cdecl("bjs_APIResult_static_roundtrip") +public func _bjs_APIResult_static_roundtrip(value: Int32) -> Void { + #if arch(wasm32) + let ret = APIResult.roundtrip(value: APIResult.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Utils_String_static_uppercase") +@_cdecl("bjs_Utils_String_static_uppercase") +public func _bjs_Utils_String_static_uppercase(textBytes: Int32, textLength: Int32) -> Void { + #if arch(wasm32) + let ret = Utils.String.uppercase(_: String.bridgeJSLiftParameter(textBytes, textLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MathUtils_init") +@_cdecl("bjs_MathUtils_init") +public func _bjs_MathUtils_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = MathUtils() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MathUtils_static_subtract") +@_cdecl("bjs_MathUtils_static_subtract") +public func _bjs_MathUtils_static_subtract(a: Int32, b: Int32) -> Int32 { + #if arch(wasm32) + let ret = MathUtils.subtract(a: Int.bridgeJSLiftParameter(a), b: Int.bridgeJSLiftParameter(b)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_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_multiply") +@_cdecl("bjs_MathUtils_multiply") +public func _bjs_MathUtils_multiply(_self: UnsafeMutableRawPointer, x: Int32, y: Int32) -> Int32 { + #if arch(wasm32) + let ret = MathUtils.bridgeJSLiftParameter(_self).multiply(x: Int.bridgeJSLiftParameter(x), y: Int.bridgeJSLiftParameter(y)) + 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) { + Unmanaged.fromOpaque(pointer).release() +} + +extension MathUtils: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "TestModule", name: "bjs_MathUtils_wrap") + func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_MathUtils_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json index 705de9378..13f707bda 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json @@ -323,6 +323,7 @@ "tsFullPath" : "Utils.String" } ], + "exposeToGlobal" : false, "functions" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json new file mode 100644 index 000000000..d7af99185 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json @@ -0,0 +1,337 @@ +{ + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_PropertyClass_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + + ], + "name" : "PropertyClass", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : true, + "name" : "staticConstant", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "staticVariable", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "jsObjectProperty", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "jsObject" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "classVariable", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "computedProperty", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "readOnlyComputed", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "optionalProperty", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "swiftCallName" : "PropertyClass" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "value1" + }, + { + "associatedValues" : [ + + ], + "name" : "value2" + } + ], + "emitStyle" : "const", + "name" : "PropertyEnum", + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "enumProperty", + "staticContext" : { + "enumName" : { + "_0" : "PropertyEnum" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "enumConstant", + "staticContext" : { + "enumName" : { + "_0" : "PropertyEnum" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "computedEnum", + "staticContext" : { + "enumName" : { + "_0" : "PropertyEnum" + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "PropertyEnum", + "tsFullPath" : "PropertyEnum" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "PropertyNamespace", + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "namespaceProperty", + "namespace" : [ + "PropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "namespaceConstant", + "namespace" : [ + "PropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "PropertyNamespace", + "tsFullPath" : "PropertyNamespace" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Nested", + "namespace" : [ + "PropertyNamespace" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedProperty", + "namespace" : [ + "PropertyNamespace", + "Nested" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "nestedConstant", + "namespace" : [ + "PropertyNamespace", + "Nested" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedDouble", + "namespace" : [ + "PropertyNamespace", + "Nested" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "PropertyNamespace.Nested", + "tsFullPath" : "PropertyNamespace.Nested" + } + ], + "exposeToGlobal" : true, + "functions" : [ + + ], + "moduleName" : "TestModule", + "protocols" : [ + + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift new file mode 100644 index 000000000..72d561a00 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift @@ -0,0 +1,338 @@ +// 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 + +extension PropertyEnum: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> PropertyEnum { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> PropertyEnum { + return PropertyEnum(bridgeJSRawValue: value)! + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { + return bridgeJSLowerParameter() + } + + private init?(bridgeJSRawValue: Int32) { + switch bridgeJSRawValue { + case 0: + self = .value1 + case 1: + self = .value2 + default: + return nil + } + } + + private var bridgeJSRawValue: Int32 { + switch self { + case .value1: + return 0 + case .value2: + return 1 + } + } +} + +@_expose(wasm, "bjs_PropertyEnum_static_enumProperty_get") +@_cdecl("bjs_PropertyEnum_static_enumProperty_get") +public func _bjs_PropertyEnum_static_enumProperty_get() -> Void { + #if arch(wasm32) + let ret = PropertyEnum.enumProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyEnum_static_enumProperty_set") +@_cdecl("bjs_PropertyEnum_static_enumProperty_set") +public func _bjs_PropertyEnum_static_enumProperty_set(valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + PropertyEnum.enumProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyEnum_static_enumConstant_get") +@_cdecl("bjs_PropertyEnum_static_enumConstant_get") +public func _bjs_PropertyEnum_static_enumConstant_get() -> Int32 { + #if arch(wasm32) + let ret = PropertyEnum.enumConstant + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyEnum_static_computedEnum_get") +@_cdecl("bjs_PropertyEnum_static_computedEnum_get") +public func _bjs_PropertyEnum_static_computedEnum_get() -> Void { + #if arch(wasm32) + let ret = PropertyEnum.computedEnum + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyEnum_static_computedEnum_set") +@_cdecl("bjs_PropertyEnum_static_computedEnum_set") +public func _bjs_PropertyEnum_static_computedEnum_set(valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + PropertyEnum.computedEnum = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyNamespace_static_namespaceProperty_get") +@_cdecl("bjs_PropertyNamespace_static_namespaceProperty_get") +public func _bjs_PropertyNamespace_static_namespaceProperty_get() -> Void { + #if arch(wasm32) + let ret = PropertyNamespace.namespaceProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyNamespace_static_namespaceProperty_set") +@_cdecl("bjs_PropertyNamespace_static_namespaceProperty_set") +public func _bjs_PropertyNamespace_static_namespaceProperty_set(valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + PropertyNamespace.namespaceProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyNamespace_static_namespaceConstant_get") +@_cdecl("bjs_PropertyNamespace_static_namespaceConstant_get") +public func _bjs_PropertyNamespace_static_namespaceConstant_get() -> Void { + #if arch(wasm32) + let ret = PropertyNamespace.namespaceConstant + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyNamespace_Nested_static_nestedProperty_get") +@_cdecl("bjs_PropertyNamespace_Nested_static_nestedProperty_get") +public func _bjs_PropertyNamespace_Nested_static_nestedProperty_get() -> Int32 { + #if arch(wasm32) + let ret = PropertyNamespace.Nested.nestedProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyNamespace_Nested_static_nestedProperty_set") +@_cdecl("bjs_PropertyNamespace_Nested_static_nestedProperty_set") +public func _bjs_PropertyNamespace_Nested_static_nestedProperty_set(value: Int32) -> Void { + #if arch(wasm32) + PropertyNamespace.Nested.nestedProperty = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyNamespace_Nested_static_nestedConstant_get") +@_cdecl("bjs_PropertyNamespace_Nested_static_nestedConstant_get") +public func _bjs_PropertyNamespace_Nested_static_nestedConstant_get() -> Void { + #if arch(wasm32) + let ret = PropertyNamespace.Nested.nestedConstant + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyNamespace_Nested_static_nestedDouble_get") +@_cdecl("bjs_PropertyNamespace_Nested_static_nestedDouble_get") +public func _bjs_PropertyNamespace_Nested_static_nestedDouble_get() -> Float64 { + #if arch(wasm32) + let ret = PropertyNamespace.Nested.nestedDouble + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyNamespace_Nested_static_nestedDouble_set") +@_cdecl("bjs_PropertyNamespace_Nested_static_nestedDouble_set") +public func _bjs_PropertyNamespace_Nested_static_nestedDouble_set(value: Float64) -> Void { + #if arch(wasm32) + PropertyNamespace.Nested.nestedDouble = Double.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_init") +@_cdecl("bjs_PropertyClass_init") +public func _bjs_PropertyClass_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = PropertyClass() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_static_staticConstant_get") +@_cdecl("bjs_PropertyClass_static_staticConstant_get") +public func _bjs_PropertyClass_static_staticConstant_get() -> Void { + #if arch(wasm32) + let ret = PropertyClass.staticConstant + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_static_staticVariable_get") +@_cdecl("bjs_PropertyClass_static_staticVariable_get") +public func _bjs_PropertyClass_static_staticVariable_get() -> Int32 { + #if arch(wasm32) + let ret = PropertyClass.staticVariable + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_static_staticVariable_set") +@_cdecl("bjs_PropertyClass_static_staticVariable_set") +public func _bjs_PropertyClass_static_staticVariable_set(value: Int32) -> Void { + #if arch(wasm32) + PropertyClass.staticVariable = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_static_jsObjectProperty_get") +@_cdecl("bjs_PropertyClass_static_jsObjectProperty_get") +public func _bjs_PropertyClass_static_jsObjectProperty_get() -> Int32 { + #if arch(wasm32) + let ret = PropertyClass.jsObjectProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_static_jsObjectProperty_set") +@_cdecl("bjs_PropertyClass_static_jsObjectProperty_set") +public func _bjs_PropertyClass_static_jsObjectProperty_set(value: Int32) -> Void { + #if arch(wasm32) + PropertyClass.jsObjectProperty = JSObject.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_static_classVariable_get") +@_cdecl("bjs_PropertyClass_static_classVariable_get") +public func _bjs_PropertyClass_static_classVariable_get() -> Void { + #if arch(wasm32) + let ret = PropertyClass.classVariable + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_static_classVariable_set") +@_cdecl("bjs_PropertyClass_static_classVariable_set") +public func _bjs_PropertyClass_static_classVariable_set(valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + PropertyClass.classVariable = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_static_computedProperty_get") +@_cdecl("bjs_PropertyClass_static_computedProperty_get") +public func _bjs_PropertyClass_static_computedProperty_get() -> Void { + #if arch(wasm32) + let ret = PropertyClass.computedProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_static_computedProperty_set") +@_cdecl("bjs_PropertyClass_static_computedProperty_set") +public func _bjs_PropertyClass_static_computedProperty_set(valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + PropertyClass.computedProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_static_readOnlyComputed_get") +@_cdecl("bjs_PropertyClass_static_readOnlyComputed_get") +public func _bjs_PropertyClass_static_readOnlyComputed_get() -> Int32 { + #if arch(wasm32) + let ret = PropertyClass.readOnlyComputed + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_static_optionalProperty_get") +@_cdecl("bjs_PropertyClass_static_optionalProperty_get") +public func _bjs_PropertyClass_static_optionalProperty_get() -> Void { + #if arch(wasm32) + let ret = PropertyClass.optionalProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_static_optionalProperty_set") +@_cdecl("bjs_PropertyClass_static_optionalProperty_set") +public func _bjs_PropertyClass_static_optionalProperty_set(valueIsSome: Int32, valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + PropertyClass.optionalProperty = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyClass_deinit") +@_cdecl("bjs_PropertyClass_deinit") +public func _bjs_PropertyClass_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension PropertyClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + #if arch(wasm32) + @_extern(wasm, module: "TestModule", name: "bjs_PropertyClass_wrap") + func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 + #else + func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") + } + #endif + return .object(JSObject(id: UInt32(bitPattern: _bjs_PropertyClass_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json index 1c5cdd6a4..fb3a12b6b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json @@ -326,6 +326,7 @@ "tsFullPath" : "PropertyNamespace.Nested" } ], + "exposeToGlobal" : false, "functions" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json index cf6b0025e..bec03d8fc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json @@ -5,6 +5,7 @@ "enums" : [ ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_checkString", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json index f34a04f9b..86221037d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json @@ -5,6 +5,7 @@ "enums" : [ ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_checkString", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json index fc99462b7..9f1f934ec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json @@ -105,6 +105,7 @@ "enums" : [ ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_takeGreeter", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json index d6518fc69..2a8a64040 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json @@ -1062,6 +1062,7 @@ "tsFullPath" : "APIResult" } ], + "exposeToGlobal" : false, "functions" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json index d85339150..9b2e61044 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json @@ -5,6 +5,7 @@ "enums" : [ ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_throwsSomething", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json index df3f5041f..508107ee6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json @@ -5,6 +5,7 @@ "enums" : [ ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_check", diff --git a/Plugins/PackageToJS/Sources/PackageToJS.swift b/Plugins/PackageToJS/Sources/PackageToJS.swift index 9576c2b76..ec9840439 100644 --- a/Plugins/PackageToJS/Sources/PackageToJS.swift +++ b/Plugins/PackageToJS/Sources/PackageToJS.swift @@ -613,8 +613,7 @@ struct PackagingPlanner { let data = try Data(contentsOf: URL(fileURLWithPath: scope.resolve(path: $0).path)) return try decoder.decode(ImportedModuleSkeleton.self, from: data) }, - sharedMemory: Self.isSharedMemoryEnabled(triple: triple), - exposeToGlobal: true + sharedMemory: Self.isSharedMemoryEnabled(triple: triple) ) let (outputJs, outputDts) = try link.link() try system.writeFile(atPath: scope.resolve(path: bridgeJs).path, content: Data(outputJs.utf8)) diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Configuration.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Configuration.md index 835cf6bef..78b5d2d37 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Configuration.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Configuration.md @@ -38,14 +38,51 @@ Later files override settings from earlier files. This allows teams to commit a ## Configuration Options +### `exposeToGlobal` + +Controls whether exported Swift APIs are exposed to the JavaScript global namespace (`globalThis`). + +When `true`, exported functions, classes, and namespaces are available via `globalThis` in JavaScript. When `false`, they are only available through the exports object returned by `createExports()`. +Using Exports provides better module isolation and support multiple WebAssembly instances in the same JavaScript context. + +Example: + +```json +{ + "exposeToGlobal": true +} +``` + +**With `exposeToGlobal: true`:** + +```javascript +// APIs available on globalThis +const greeter = new globalThis.MyModule.Greeter("World"); +console.log(greeter.greet()); // "Hello, World!" + +// Also available via exports +const greeter2 = new exports.MyModule.Greeter("Alice"); +``` + +**With `exposeToGlobal: false` (default):** + +```javascript +// APIs only available via exports +const greeter = new exports.MyModule.Greeter("World"); + +// globalThis.MyModule is undefined +``` + ### `tools` Specify custom paths for external executables. This is particularly useful when working in environments like Xcode where the system PATH may not be inherited, or when you need to use a specific version of tools for your project. Currently supported tools: + - `node` - Node.js runtime (required for TypeScript processing) Example: + ```json { "tools": { @@ -59,4 +96,3 @@ BridgeJS resolves tool paths in the following priority order: 1. **Configuration files** (`bridge-js.config.local.json` > `bridge-js.config.json`) 2. **Environment variables** (`JAVASCRIPTKIT_NODE_EXEC`) 3. **System PATH lookup** - diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md index 427dd5971..0c4027b77 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md @@ -73,18 +73,20 @@ import JavaScriptKit } ``` -In JavaScript, this class is accessible through its namespace in two ways: +In JavaScript, this class is accessible through its namespace: ```javascript -// Recommended: Access via the exports object (supports multiple WASM instances) +// Always available: Access via the exports object (supports multiple WASM instances) const greeter = new exports.__Swift.Foundation.Greeter("World"); console.log(greeter.greet()); // "Hello, World!" -// Alternative: Access via globalThis and through its namespace +// When exposeToGlobal: true - Also available via globalThis const greeter = new globalThis.__Swift.Foundation.Greeter("World"); console.log(greeter.greet()); // "Hello, World!" ``` +> Note: Global namespace access via `globalThis` is only available when `exposeToGlobal: true` is set in your `bridge-js.config.json`. See for more details. + The generated TypeScript declaration will organize the class within its namespace: ```typescript @@ -114,4 +116,4 @@ export interface Greeter extends SwiftHeapObject { } ``` -Using namespaces can be preferable for projects with many global functions, as they help prevent naming collisions. Namespaces also provide intuitive hierarchies for organizing your exported Swift code, and they do not affect the code generated by `@JS` declarations without namespaces. \ No newline at end of file +Using namespaces can be preferable for projects with many global functions, as they help prevent naming collisions. Namespaces also provide intuitive hierarchies for organizing your exported Swift code, and they do not affect the code generated by `@JS` declarations without namespaces. diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index c1877ab35..69564e72c 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -4469,6 +4469,7 @@ "tsFullPath" : "StaticPropertyNamespace.NestedProperties" } ], + "exposeToGlobal" : false, "functions" : [ { "abiName" : "bjs_roundTripVoid", diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.config.exposeToGlobal.json b/Tests/BridgeJSRuntimeTests/bridge-js.config.exposeToGlobal.json new file mode 100644 index 000000000..b1b556981 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/bridge-js.config.exposeToGlobal.json @@ -0,0 +1,3 @@ +{ + "exposeToGlobal": true +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.config.json b/Tests/BridgeJSRuntimeTests/bridge-js.config.json index 9e26dfeeb..55a95efaa 100644 --- a/Tests/BridgeJSRuntimeTests/bridge-js.config.json +++ b/Tests/BridgeJSRuntimeTests/bridge-js.config.json @@ -1 +1,3 @@ -{} \ No newline at end of file +{ + "exposeToGlobal": false +} \ No newline at end of file diff --git a/Tests/prelude.exposeToGlobal.mjs b/Tests/prelude.exposeToGlobal.mjs new file mode 100644 index 000000000..47e36b4d2 --- /dev/null +++ b/Tests/prelude.exposeToGlobal.mjs @@ -0,0 +1,248 @@ +/** @type {import('../.build/plugins/PackageToJS/outputs/PackageTests/test.d.ts').SetupOptionsFn} */ +export async function setupOptions(options, context) { + Error.stackTraceLimit = 100; + setupTestGlobals(globalThis); + return { + ...options, + getImports: (importsContext) => { + return { + "jsRoundTripVoid": () => { + return; + }, + "jsRoundTripNumber": (v) => { + return v; + }, + "jsRoundTripBool": (v) => { + return v; + }, + "jsRoundTripString": (v) => { + return v; + }, + "jsThrowOrVoid": (shouldThrow) => { + if (shouldThrow) { + throw new Error("TestError"); + } + }, + "jsThrowOrNumber": (shouldThrow) => { + if (shouldThrow) { + throw new Error("TestError"); + } + return 1; + }, + "jsThrowOrBool": (shouldThrow) => { + if (shouldThrow) { + throw new Error("TestError"); + } + return true; + }, + "jsThrowOrString": (shouldThrow) => { + if (shouldThrow) { + throw new Error("TestError"); + } + return "Hello, world!"; + }, + JsGreeter: class { + /** + * @param {string} name + * @param {string} prefix + */ + constructor(name, prefix) { + this.name = name; + this.prefix = prefix; + } + greet() { + return `${this.prefix}, ${this.name}!`; + } + /** @param {string} name */ + changeName(name) { + this.name = name; + } + }, + runAsyncWorks: async () => { + const exports = importsContext.getExports(); + if (!exports) { + throw new Error("No exports!?"); + } + BridgeJSRuntimeTests_runAsyncWorks(exports); + return; + } + }; + }, + addToCoreImports(importObject, importsContext) { + const { getInstance, getExports } = importsContext; + options.addToCoreImports?.(importObject, importsContext); + importObject["JavaScriptEventLoopTestSupportTests"] = { + "isMainThread": () => context.isMainThread, + } + const bridgeJSRuntimeTests = importObject["BridgeJSRuntimeTests"] || {}; + bridgeJSRuntimeTests["runJsWorks"] = () => { + const exports = getExports(); + if (!exports) { + throw new Error("No exports!?"); + } + return BridgeJSRuntimeTests_runJsWorks(getInstance(), exports); + } + importObject["BridgeJSRuntimeTests"] = bridgeJSRuntimeTests; + } + } +} + +import assert from "node:assert"; + +/** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ +function BridgeJSRuntimeTests_runJsWorks(instance, exports) { + // Repetition tests to satisfy testAll + const g = new exports.Greeter("John"); + g.release(); + const calc = exports.createCalculator(); + calc.release(); + + assert.equal(globalThis.Networking.API.MethodValues.Get, 0); + assert.equal(globalThis.Networking.API.MethodValues.Post, 1); + assert.equal(globalThis.Networking.API.MethodValues.Put, 2); + assert.equal(globalThis.Networking.API.MethodValues.Delete, 3); + + assert.equal(globalThis.Configuration.LogLevelValues.Debug, "debug"); + assert.equal(globalThis.Configuration.LogLevelValues.Info, "info"); + assert.equal(globalThis.Configuration.LogLevelValues.Warning, "warning"); + assert.equal(globalThis.Configuration.LogLevelValues.Error, "error"); + assert.equal(globalThis.Configuration.PortValues.Http, 80); + assert.equal(globalThis.Configuration.PortValues.Https, 443); + assert.equal(globalThis.Configuration.PortValues.Development, 3000); + + assert.equal(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Get, 0); + assert.equal(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Post, 1); + + const globalConverter = new globalThis.Utils.Converter(); + assert.equal(globalConverter.toString(99), "99"); + globalConverter.release(); + + const globalHttpServer = new globalThis.Networking.API.HTTPServer(); + globalHttpServer.call(globalThis.Networking.API.MethodValues.Get); + globalHttpServer.release(); + + const globalTestServer = new globalThis.Networking.APIV2.Internal.TestServer(); + globalTestServer.call(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Post); + globalTestServer.release(); + + assert.equal(globalThis.StaticPropertyNamespace.namespaceProperty, "namespace"); + assert.equal(globalThis.StaticPropertyNamespace.namespaceConstant, "constant"); + + globalThis.StaticPropertyNamespace.namespaceProperty = "modified namespace"; + assert.equal(globalThis.StaticPropertyNamespace.namespaceProperty, "modified namespace"); + + assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty, 999); + assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedConstant, "nested"); + assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedDouble, 1.414); + + globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty = 1000; + globalThis.StaticPropertyNamespace.NestedProperties.nestedDouble = 2.828; + assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty, 1000); + assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedDouble, 2.828); + + // // Verify both globalThis and exports point to same objects + // assert.equal(globalThis.StaticPropertyNamespace.namespaceProperty, exports.StaticPropertyNamespace.namespaceProperty); + // assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty, exports.StaticPropertyNamespace.NestedProperties.nestedProperty); + + // // Verify enum values accessible via globalThis match exports + // assert.equal(exports.Configuration.LogLevel.Debug, globalThis.Configuration.LogLevelValues.Debug); + // assert.equal(exports.Networking.API.Method.Get, globalThis.Networking.API.MethodValues.Get); +} + +/** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ +async function BridgeJSRuntimeTests_runAsyncWorks(exports) { + await exports.asyncRoundTripVoid(); +} + +function setupTestGlobals(global) { + global.globalObject1 = { + prop_1: { + nested_prop: 1, + }, + prop_2: 2, + prop_3: true, + prop_4: [3, 4, "str_elm_1", null, undefined, 5], + prop_5: { + func1: function () { + return; + }, + func2: function () { + return 1; + }, + func3: function (n) { + return n * 2; + }, + func4: function (a, b, c) { + return a + b + c; + }, + func5: function (x) { + return "Hello, " + x; + }, + func6: function (c, a, b) { + if (c) { + return a; + } else { + return b; + } + }, + }, + prop_6: { + call_host_1: () => { + return global.globalObject1.prop_6.host_func_1(); + }, + }, + prop_7: 3.14, + prop_8: [0, , 2, 3, , , 6], + eval_closure: function (fn) { + return fn(arguments[1]); + }, + observable_obj: { + set_called: false, + target: new Proxy( + { + nested: {}, + }, + { + set(target, key, value) { + global.globalObject1.observable_obj.set_called = true; + target[key] = value; + return true; + }, + } + ), + }, + }; + + global.Animal = function (name, age, isCat) { + if (age < 0) { + throw new Error("Invalid age " + age); + } + this.name = name; + this.age = age; + this.bark = () => { + return isCat ? "nyan" : "wan"; + }; + this.isCat = isCat; + this.getIsCat = function () { + return this.isCat; + }; + this.setName = function (name) { + this.name = name; + }; + }; + + global.callThrowingClosure = (c) => { + try { + c(); + } catch (error) { + return error; + } + }; + + global.objectDecodingTest = { + obj: {}, + fn: () => { }, + sym: Symbol("s"), + bi: BigInt(3) + }; +} diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 77123fec1..640a65612 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -341,36 +341,20 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(exports.StaticPropertyEnum.enumVariable, 500); // Namespace enum static properties - assert.equal(globalThis.StaticPropertyNamespace.namespaceProperty, "namespace"); - assert.equal(globalThis.StaticPropertyNamespace.namespaceConstant, "constant"); - - globalThis.StaticPropertyNamespace.namespaceProperty = "modified namespace"; - assert.equal(globalThis.StaticPropertyNamespace.namespaceProperty, "modified namespace"); - - assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty, 999); - assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedConstant, "nested"); - assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedDouble, 1.414); - - globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty = 1000; - globalThis.StaticPropertyNamespace.NestedProperties.nestedDouble = 2.828; - assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty, 1000); - assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedDouble, 2.828); + assert.equal(exports.StaticPropertyNamespace.namespaceProperty, "namespace"); + assert.equal(exports.StaticPropertyNamespace.namespaceConstant, "constant"); + exports.StaticPropertyNamespace.namespaceProperty = "modified namespace"; assert.equal(exports.StaticPropertyNamespace.namespaceProperty, "modified namespace"); - assert.equal(exports.StaticPropertyNamespace.namespaceConstant, "constant"); - exports.StaticPropertyNamespace.namespaceProperty = "exports modified"; - assert.equal(exports.StaticPropertyNamespace.namespaceProperty, "exports modified"); - assert.equal(globalThis.StaticPropertyNamespace.namespaceProperty, "exports modified"); - assert.equal(exports.StaticPropertyNamespace.NestedProperties.nestedProperty, 1000); + assert.equal(exports.StaticPropertyNamespace.NestedProperties.nestedProperty, 999); assert.equal(exports.StaticPropertyNamespace.NestedProperties.nestedConstant, "nested"); + assert.equal(exports.StaticPropertyNamespace.NestedProperties.nestedDouble, 1.414); + + exports.StaticPropertyNamespace.NestedProperties.nestedProperty = 1000; + exports.StaticPropertyNamespace.NestedProperties.nestedDouble = 2.828; + assert.equal(exports.StaticPropertyNamespace.NestedProperties.nestedProperty, 1000); assert.equal(exports.StaticPropertyNamespace.NestedProperties.nestedDouble, 2.828); - exports.StaticPropertyNamespace.NestedProperties.nestedProperty = 2000; - exports.StaticPropertyNamespace.NestedProperties.nestedDouble = 3.14; - assert.equal(exports.StaticPropertyNamespace.NestedProperties.nestedProperty, 2000); - assert.equal(exports.StaticPropertyNamespace.NestedProperties.nestedDouble, 3.14); - assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty, 2000); - assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedDouble, 3.14); // Test class without @JS init constructor const calc = exports.createCalculator(); @@ -440,21 +424,10 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(exports.setTSTheme(TSTheme.Light), TSTheme.Light); assert.equal(exports.getTSTheme(), TSTheme.Light); - assert.equal(globalThis.Networking.API.MethodValues.Get, 0); - assert.equal(globalThis.Networking.API.MethodValues.Post, 1); - assert.equal(globalThis.Networking.API.MethodValues.Put, 2); - assert.equal(globalThis.Networking.API.MethodValues.Delete, 3); assert.equal(exports.Networking.API.Method.Get, 0); assert.equal(exports.Networking.API.Method.Post, 1); assert.equal(exports.Networking.API.Method.Put, 2); assert.equal(exports.Networking.API.Method.Delete, 3); - assert.equal(globalThis.Configuration.LogLevelValues.Debug, "debug"); - assert.equal(globalThis.Configuration.LogLevelValues.Info, "info"); - assert.equal(globalThis.Configuration.LogLevelValues.Warning, "warning"); - assert.equal(globalThis.Configuration.LogLevelValues.Error, "error"); - assert.equal(globalThis.Configuration.PortValues.Http, 80); - assert.equal(globalThis.Configuration.PortValues.Https, 443); - assert.equal(globalThis.Configuration.PortValues.Development, 3000); assert.equal(exports.Configuration.LogLevel.Debug, "debug"); assert.equal(exports.Configuration.LogLevel.Info, "info"); assert.equal(exports.Configuration.LogLevel.Warning, "warning"); @@ -462,19 +435,16 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(exports.Configuration.Port.Http, 80); assert.equal(exports.Configuration.Port.Https, 443); assert.equal(exports.Configuration.Port.Development, 3000); - assert.equal(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Get, 0); - assert.equal(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Post, 1); assert.equal(exports.Networking.APIV2.Internal.SupportedMethod.Get, 0); assert.equal(exports.Networking.APIV2.Internal.SupportedMethod.Post, 1); - assert.equal(exports.roundtripNetworkingAPIMethod(globalThis.Networking.API.MethodValues.Get), globalThis.Networking.API.MethodValues.Get); - assert.equal(exports.roundtripConfigurationLogLevel(globalThis.Configuration.LogLevelValues.Debug), globalThis.Configuration.LogLevelValues.Debug); - assert.equal(exports.roundtripConfigurationPort(globalThis.Configuration.PortValues.Http), globalThis.Configuration.PortValues.Http); - assert.equal(exports.processConfigurationLogLevel(globalThis.Configuration.LogLevelValues.Debug), globalThis.Configuration.PortValues.Development); - assert.equal(exports.processConfigurationLogLevel(globalThis.Configuration.LogLevelValues.Info), globalThis.Configuration.PortValues.Http); - assert.equal(exports.processConfigurationLogLevel(globalThis.Configuration.LogLevelValues.Warning), globalThis.Configuration.PortValues.Https); - assert.equal(exports.processConfigurationLogLevel(globalThis.Configuration.LogLevelValues.Error), globalThis.Configuration.PortValues.Development); - assert.equal(exports.roundtripInternalSupportedMethod(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Get), globalThis.Networking.APIV2.Internal.SupportedMethodValues.Get); + assert.equal(exports.roundtripNetworkingAPIMethod(exports.Networking.API.Method.Get), exports.Networking.API.Method.Get); + assert.equal(exports.roundtripConfigurationLogLevel(exports.Configuration.LogLevel.Debug), exports.Configuration.LogLevel.Debug); + assert.equal(exports.roundtripConfigurationPort(exports.Configuration.Port.Http), exports.Configuration.Port.Http); + assert.equal(exports.processConfigurationLogLevel(exports.Configuration.LogLevel.Debug), exports.Configuration.Port.Development); + assert.equal(exports.processConfigurationLogLevel(exports.Configuration.LogLevel.Info), exports.Configuration.Port.Http); + assert.equal(exports.processConfigurationLogLevel(exports.Configuration.LogLevel.Warning), exports.Configuration.Port.Https); + assert.equal(exports.roundtripInternalSupportedMethod(exports.Networking.APIV2.Internal.SupportedMethod.Get), exports.Networking.APIV2.Internal.SupportedMethod.Get); const converter = new exports.Utils.Converter(); assert.equal(converter.toString(42), "42"); @@ -482,27 +452,15 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { converter.release(); const httpServer = new exports.Networking.API.HTTPServer(); - httpServer.call(globalThis.Networking.API.MethodValues.Get); - httpServer.call(globalThis.Networking.API.MethodValues.Post); + httpServer.call(exports.Networking.API.Method.Get); + httpServer.call(exports.Networking.API.Method.Post); httpServer.release(); const testServer = new exports.Networking.APIV2.Internal.TestServer(); - testServer.call(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Get); - testServer.call(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Post); + testServer.call(exports.Networking.APIV2.Internal.SupportedMethod.Get); + testServer.call(exports.Networking.APIV2.Internal.SupportedMethod.Post); testServer.release(); - const globalConverter = new globalThis.Utils.Converter(); - assert.equal(globalConverter.toString(99), "99"); - globalConverter.release(); - - const globalHttpServer = new globalThis.Networking.API.HTTPServer(); - globalHttpServer.call(globalThis.Networking.API.MethodValues.Get); - globalHttpServer.release(); - - const globalTestServer = new globalThis.Networking.APIV2.Internal.TestServer(); - globalTestServer.call(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Post); - globalTestServer.release(); - const s1 = { tag: exports.APIResult.Tag.Success, param0: "Cześć 🙋‍♂️" }; const f1 = { tag: exports.APIResult.Tag.Failure, param0: 42 }; const i1 = { tag: APIResultValues.Tag.Info }; @@ -555,27 +513,27 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.deepEqual(exports.makeComplexResultComprehensive(true, false, 10, 20, 1.5, 2.5, "First", "Second", "Third"), { tag: exports.ComplexResult.Tag.Comprehensive, param0: true, param1: false, param2: 10, param3: 20, param4: 1.5, param5: 2.5, param6: "First", param7: "Second", param8: "Third" }); assert.deepEqual(exports.makeComplexResultInfo(), { tag: exports.ComplexResult.Tag.Info }); - const urSuccess = { tag: globalThis.Utilities.ResultValues.Tag.Success, param0: "Utility operation completed" }; - const urFailure = { tag: globalThis.Utilities.ResultValues.Tag.Failure, param0: "Utility error occurred", param1: 500 }; - const urStatus = { tag: globalThis.Utilities.ResultValues.Tag.Status, param0: true, param1: 200, param2: "Utility status OK" }; + const urSuccess = { tag: exports.Utilities.Result.Tag.Success, param0: "Utility operation completed" }; + const urFailure = { tag: exports.Utilities.Result.Tag.Failure, param0: "Utility error occurred", param1: 500 }; + const urStatus = { tag: exports.Utilities.Result.Tag.Status, param0: true, param1: 200, param2: "Utility status OK" }; assert.deepEqual(exports.roundtripUtilitiesResult(urSuccess), urSuccess); assert.deepEqual(exports.roundtripUtilitiesResult(urFailure), urFailure); assert.deepEqual(exports.roundtripUtilitiesResult(urStatus), urStatus); - assert.deepEqual(exports.makeUtilitiesResultSuccess("Test"), { tag: globalThis.Utilities.ResultValues.Tag.Success, param0: "Test" }); - assert.deepEqual(exports.makeUtilitiesResultSuccess("ok"), { tag: globalThis.Utilities.ResultValues.Tag.Success, param0: "ok" }); - assert.deepEqual(exports.makeUtilitiesResultFailure("Error", 123), { tag: globalThis.Utilities.ResultValues.Tag.Failure, param0: "Error", param1: 123 }); - assert.deepEqual(exports.makeUtilitiesResultStatus(true, 200, "OK"), { tag: globalThis.Utilities.ResultValues.Tag.Status, param0: true, param1: 200, param2: "OK" }); + assert.deepEqual(exports.makeUtilitiesResultSuccess("Test"), { tag: exports.Utilities.Result.Tag.Success, param0: "Test" }); + assert.deepEqual(exports.makeUtilitiesResultSuccess("ok"), { tag: exports.Utilities.Result.Tag.Success, param0: "ok" }); + assert.deepEqual(exports.makeUtilitiesResultFailure("Error", 123), { tag: exports.Utilities.Result.Tag.Failure, param0: "Error", param1: 123 }); + assert.deepEqual(exports.makeUtilitiesResultStatus(true, 200, "OK"), { tag: exports.Utilities.Result.Tag.Status, param0: true, param1: 200, param2: "OK" }); - const nrSuccess = { tag: globalThis.API.NetworkingResultValues.Tag.Success, param0: "Network request successful" }; - const nrFailure = { tag: globalThis.API.NetworkingResultValues.Tag.Failure, param0: "Network timeout", param1: 408 }; + const nrSuccess = { tag: exports.API.NetworkingResult.Tag.Success, param0: "Network request successful" }; + const nrFailure = { tag: exports.API.NetworkingResult.Tag.Failure, param0: "Network timeout", param1: 408 }; assert.deepEqual(exports.roundtripAPINetworkingResult(nrSuccess), nrSuccess); assert.deepEqual(exports.roundtripAPINetworkingResult(nrFailure), nrFailure); - assert.deepEqual(exports.makeAPINetworkingResultSuccess("Connected"), { tag: globalThis.API.NetworkingResultValues.Tag.Success, param0: "Connected" }); - assert.deepEqual(exports.makeAPINetworkingResultFailure("Timeout", 408), { tag: globalThis.API.NetworkingResultValues.Tag.Failure, param0: "Timeout", param1: 408 }); + assert.deepEqual(exports.makeAPINetworkingResultSuccess("Connected"), { tag: exports.API.NetworkingResult.Tag.Success, param0: "Connected" }); + assert.deepEqual(exports.makeAPINetworkingResultFailure("Timeout", 408), { tag: exports.API.NetworkingResult.Tag.Failure, param0: "Timeout", param1: 408 }); assert.equal(exports.roundTripOptionalString(null), null); assert.equal(exports.roundTripOptionalInt(null), null); @@ -604,7 +562,7 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(exports.roundTripOptionalHttpStatus(exports.HttpStatus.Ok), HttpStatusValues.Ok); assert.equal(exports.roundTripOptionalTSDirection(TSDirection.North), TSDirection.North); assert.equal(exports.roundTripOptionalTSTheme(TSTheme.Light), TSTheme.Light); - assert.equal(exports.roundTripOptionalNetworkingAPIMethod(globalThis.Networking.API.MethodValues.Get), globalThis.Networking.API.MethodValues.Get); + assert.equal(exports.roundTripOptionalNetworkingAPIMethod(exports.Networking.API.Method.Get), exports.Networking.API.Method.Get); assert.deepEqual(exports.roundTripOptionalAPIResult(p1), p1); assert.deepEqual(exports.roundTripOptionalComplexResult(cl1), cl1); @@ -671,9 +629,8 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(StaticCalculatorValues.Basic, 1); assert.equal(StaticCalculatorValues.Scientific, exports.StaticCalculator.Scientific); assert.equal(StaticCalculatorValues.Basic, exports.StaticCalculator.Basic); - assert.equal(globalThis.StaticUtils.Nested.roundtrip("hello world"), "hello world"); + assert.equal(exports.StaticUtils.Nested.roundtrip("hello world"), "hello world"); assert.equal(exports.StaticUtils.Nested.roundtrip("test"), "test"); - assert.equal(exports.StaticUtils.Nested.roundtrip("exports api"), "exports api"); // Test default parameters assert.equal(exports.testStringDefault(), "Hello World"); @@ -744,9 +701,9 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { function testClosureSupport(exports) { const upperTransform = (text) => text.toUpperCase(); const processor = new exports.TextProcessor(upperTransform); - + assert.equal(processor.process("hello"), "HELLO"); - + const multiParamTransform = (count, text, ratio) => { return `${text.toUpperCase()}-${count}-${ratio.toFixed(2)}`; }; @@ -767,14 +724,14 @@ function testClosureSupport(exports) { const addDr = exports.makeFormatter("Dr."); assert.equal(addDr("Ada"), "Dr. Ada"); assert.equal(addDr("Grace"), "Dr. Grace"); - + const addProf = exports.makeFormatter("Prof."); assert.equal(addProf("Hopper"), "Prof. Hopper"); const add10 = exports.makeAdder(10); assert.equal(add10(5), 15); assert.equal(add10(32), 42); - + const add100 = exports.makeAdder(100); assert.equal(add100(23), 123); @@ -821,12 +778,12 @@ function testClosureSupport(exports) { return value !== null ? `Got: ${value}` : `Got: null`; }); assert.equal(optResult1, "Got: test | Got: null"); - + const optResult2 = processor.processOptionalInt((value) => { return value !== null ? `Number: ${value}` : `Number: null`; }); assert.equal(optResult2, "Number: 42 | Number: null"); - + const optResult3 = processor.processOptionalGreeter((greeter) => { return greeter !== null ? `Greeter: ${greeter.name}` : `Greeter: null`; }); From 0f70f64d6c781efdfae9da5a32d5f518348a921c Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 27 Nov 2025 10:34:07 +0100 Subject: [PATCH 040/252] BridgeJS: Properly treat exposeToGlobal on module level --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 124 ++++++++++-------- 1 file changed, 71 insertions(+), 53 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 23884608a..bd32169f5 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -12,7 +12,6 @@ struct BridgeJSLink { var exportedSkeletons: [ExportedSkeleton] = [] var importedSkeletons: [ImportedModuleSkeleton] = [] let sharedMemory: Bool - var exposeToGlobal: Bool private let namespaceBuilder = NamespaceBuilder() init( @@ -23,15 +22,11 @@ struct BridgeJSLink { self.exportedSkeletons = exportedSkeletons self.importedSkeletons = importedSkeletons self.sharedMemory = sharedMemory - self.exposeToGlobal = exportedSkeletons.contains { $0.exposeToGlobal } } mutating func addExportedSkeletonFile(data: Data) throws { let skeleton = try JSONDecoder().decode(ExportedSkeleton.self, from: data) exportedSkeletons.append(skeleton) - if skeleton.exposeToGlobal { - exposeToGlobal = true - } } mutating func addImportedSkeletonFile(data: Data) throws { @@ -929,7 +924,6 @@ struct BridgeJSLink { // Type definitions section (namespace declarations, class definitions, imported types) let namespaceDeclarationsLines = namespaceBuilder.namespaceDeclarations( exportedSkeletons: exportedSkeletons, - exposeToGlobal: exposeToGlobal, renderTSSignatureCallback: { parameters, returnType, effects in self.renderTSSignature(parameters: parameters, returnType: returnType, effects: effects) } @@ -1012,8 +1006,7 @@ struct BridgeJSLink { printer.write(lines: data.topLevelEnumLines) let topLevelNamespaceCode = namespaceBuilder.buildTopLevelNamespaceInitialization( - exportedSkeletons: exportedSkeletons, - exposeToGlobal: exposeToGlobal + exportedSkeletons: exportedSkeletons ) printer.write(lines: topLevelNamespaceCode) @@ -1076,16 +1069,14 @@ struct BridgeJSLink { printer.write(lines: data.classLines) let namespaceInitCode = namespaceBuilder.buildNamespaceInitialization( - exportedSkeletons: exportedSkeletons, - exposeToGlobal: exposeToGlobal + exportedSkeletons: exportedSkeletons ) printer.write(lines: namespaceInitCode) let propertyAssignments = try generateNamespacePropertyAssignments( data: data, exportedSkeletons: exportedSkeletons, - namespaceBuilder: namespaceBuilder, - exposeToGlobal: exposeToGlobal + namespaceBuilder: namespaceBuilder ) printer.write(lines: propertyAssignments) } @@ -1157,12 +1148,13 @@ struct BridgeJSLink { private func generateNamespacePropertyAssignments( data: LinkData, exportedSkeletons: [ExportedSkeleton], - namespaceBuilder: NamespaceBuilder, - exposeToGlobal: Bool + namespaceBuilder: NamespaceBuilder ) throws -> [String] { let printer = CodeFragmentPrinter() - if exposeToGlobal { + // Only include enum static assignments for modules with exposeToGlobal + let hasAnyGlobalExposure = exportedSkeletons.contains { $0.exposeToGlobal } + if hasAnyGlobalExposure { printer.write(lines: data.enumStaticAssignments) } @@ -1182,10 +1174,8 @@ struct BridgeJSLink { printer.write("};") printer.write("_exports = exports;") - if exposeToGlobal { - let globalThisLines = namespaceBuilder.buildGlobalThisAssignments(exportedSkeletons: exportedSkeletons) - printer.write(lines: globalThisLines) - } + let globalThisLines = namespaceBuilder.buildGlobalThisAssignments(exportedSkeletons: exportedSkeletons) + printer.write(lines: globalThisLines) printer.write("return exports;") @@ -2243,20 +2233,21 @@ extension BridgeJSLink { ) } - func buildNamespaceInitialization(exportedSkeletons: [ExportedSkeleton], exposeToGlobal: Bool) -> [String] { - guard exposeToGlobal else { return [] } - let allNamespacePaths = collectAllNamespacePaths(exportedSkeletons: exportedSkeletons) + func buildNamespaceInitialization(exportedSkeletons: [ExportedSkeleton]) -> [String] { + let globalSkeletons = exportedSkeletons.filter { $0.exposeToGlobal } + guard !globalSkeletons.isEmpty else { return [] } + let allNamespacePaths = collectAllNamespacePaths(exportedSkeletons: globalSkeletons) return generateNamespaceInitializationCode(namespacePaths: allNamespacePaths) } func buildTopLevelNamespaceInitialization( - exportedSkeletons: [ExportedSkeleton], - exposeToGlobal: Bool + exportedSkeletons: [ExportedSkeleton] ) -> [String] { - guard exposeToGlobal else { return [] } + let globalSkeletons = exportedSkeletons.filter { $0.exposeToGlobal } + guard !globalSkeletons.isEmpty else { return [] } var namespacedEnumPaths: Set<[String]> = [] - for skeleton in exportedSkeletons { + for skeleton in globalSkeletons { for enumDef in skeleton.enums where enumDef.namespace != nil && enumDef.enumType != .namespace { namespacedEnumPaths.insert(enumDef.namespace!) } @@ -2267,7 +2258,7 @@ extension BridgeJSLink { let printer = CodeFragmentPrinter() printer.write(lines: initCode) - for skeleton in exportedSkeletons { + for skeleton in globalSkeletons { for enumDef in skeleton.enums where enumDef.namespace != nil && enumDef.enumType != .namespace { let namespacePath = enumDef.namespace!.joined(separator: ".") printer.write("globalThis.\(namespacePath).\(enumDef.valuesName) = \(enumDef.valuesName);") @@ -2280,7 +2271,7 @@ extension BridgeJSLink { func buildGlobalThisAssignments(exportedSkeletons: [ExportedSkeleton]) -> [String] { let printer = CodeFragmentPrinter() - for skeleton in exportedSkeletons { + for skeleton in exportedSkeletons where skeleton.exposeToGlobal { for klass in skeleton.classes where klass.namespace != nil { let namespacePath = klass.namespace!.joined(separator: ".") printer.write("globalThis.\(namespacePath).\(klass.name) = exports.\(namespacePath).\(klass.name);") @@ -2645,25 +2636,60 @@ extension BridgeJSLink { /// - Returns: Array of TypeScript declaration lines defining the global namespace structure func namespaceDeclarations( exportedSkeletons: [ExportedSkeleton], - exposeToGlobal: Bool, renderTSSignatureCallback: @escaping ([Parameter], BridgeType, Effects) -> String ) -> [String] { let printer = CodeFragmentPrinter() - let rootNode = NamespaceNode(name: "") - - buildExportsTree(rootNode: rootNode, exportedSkeletons: exportedSkeletons) - - guard !rootNode.children.isEmpty else { - return printer.lines - } - - if exposeToGlobal { - printer.write("export {};") - printer.nextLine() - printer.write("declare global {") - printer.indent() + + let globalSkeletons = exportedSkeletons.filter { $0.exposeToGlobal } + let nonGlobalSkeletons = exportedSkeletons.filter { !$0.exposeToGlobal } + + if !globalSkeletons.isEmpty { + let globalRootNode = NamespaceNode(name: "") + buildExportsTree(rootNode: globalRootNode, exportedSkeletons: globalSkeletons) + + if !globalRootNode.children.isEmpty { + printer.write("export {};") + printer.nextLine() + printer.write("declare global {") + printer.indent() + generateNamespaceDeclarationsForNode( + node: globalRootNode, + depth: 1, + printer: printer, + exposeToGlobal: true, + renderTSSignatureCallback: renderTSSignatureCallback + ) + printer.unindent() + printer.write("}") + printer.nextLine() + } + } + + if !nonGlobalSkeletons.isEmpty { + let localRootNode = NamespaceNode(name: "") + buildExportsTree(rootNode: localRootNode, exportedSkeletons: nonGlobalSkeletons) + + if !localRootNode.children.isEmpty { + generateNamespaceDeclarationsForNode( + node: localRootNode, + depth: 1, + printer: printer, + exposeToGlobal: false, + renderTSSignatureCallback: renderTSSignatureCallback + ) + } } + return printer.lines + } + + private func generateNamespaceDeclarationsForNode( + node: NamespaceNode, + depth: Int, + printer: CodeFragmentPrinter, + exposeToGlobal: Bool, + renderTSSignatureCallback: @escaping ([Parameter], BridgeType, Effects) -> String + ) { func hasContent(node: NamespaceNode) -> Bool { // Enums are always included if !node.content.enums.isEmpty { @@ -2845,22 +2871,14 @@ extension BridgeJSLink { } } - generateNamespaceDeclarations(node: childNode, depth: depth + 1) + generateNamespaceDeclarationsForNode(node: childNode, depth: depth + 1, printer: printer, exposeToGlobal: exposeToGlobal, renderTSSignatureCallback: renderTSSignatureCallback) printer.unindent() printer.write("}") } } - - generateNamespaceDeclarations(node: rootNode, depth: 1) - - if exposeToGlobal { - printer.unindent() - printer.write("}") - printer.nextLine() - } - - return printer.lines + + generateNamespaceDeclarations(node: node, depth: depth) } } From 4a682aaa0e44542c56f45d539b49cbfbfd6e0c9b Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 27 Nov 2025 12:12:13 +0100 Subject: [PATCH 041/252] BridgeJS: Unified prelude.mjs tests with 2 test targets BridgeJS: Extend snapshot test setup for exports <-> global this by including mixed module test case --- Makefile | 10 - Package.swift | 13 + .../Sources/BridgeJSLink/BridgeJSLink.swift | 26 +- .../BridgeJSToolTests/BridgeJSLinkTests.swift | 21 + .../Inputs/MixedGlobal.swift | 8 + .../Inputs/MixedPrivate.swift | 8 + .../DefaultParameters.Export.js | 8 +- .../BridgeJSLinkTests/MixedGlobal.Export.d.ts | 33 ++ .../BridgeJSLinkTests/MixedGlobal.Export.js | 254 +++++++++ .../MixedModules.Export.d.ts | 54 ++ .../BridgeJSLinkTests/MixedModules.Export.js | 292 ++++++++++ .../MixedPrivate.Export.d.ts | 33 ++ .../BridgeJSLinkTests/MixedPrivate.Export.js | 254 +++++++++ .../BridgeJSLinkTests/Namespaces.Export.js | 8 +- .../Namespaces.Global.Export.js | 8 +- .../BridgeJSLinkTests/SwiftClass.Export.js | 8 +- .../EnumNamespace.Global.swift | 53 +- .../ExportSwiftTests/MixedGlobal.json | 74 +++ .../ExportSwiftTests/MixedGlobal.swift | 61 ++ .../ExportSwiftTests/MixedPrivate.json | 74 +++ .../ExportSwiftTests/MixedPrivate.swift | 61 ++ .../ExportSwiftTests/Namespaces.Global.swift | 53 +- .../StaticFunctions.Global.swift | 19 +- .../StaticProperties.Global.swift | 19 +- .../Generated/BridgeJS.ExportSwift.swift | 303 ++++++++++ .../JavaScript/BridgeJS.ExportSwift.json | 537 ++++++++++++++++++ .../BridgeJSGlobalTests/GlobalAPITests.swift | 78 +++ .../bridge-js.config.json} | 0 Tests/BridgeJSGlobalTests/bridge-js.d.ts | 0 .../BridgeJSRuntimeTests/ExportAPITests.swift | 6 - .../Generated/BridgeJS.ExportSwift.swift | 11 - .../JavaScript/BridgeJS.ExportSwift.json | 17 - Tests/BridgeJSRuntimeTests/bridge-js.d.ts | 18 - Tests/prelude.exposeToGlobal.mjs | 248 -------- Tests/prelude.mjs | 50 ++ 35 files changed, 2316 insertions(+), 404 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MixedGlobal.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MixedPrivate.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift create mode 100644 Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift create mode 100644 Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json create mode 100644 Tests/BridgeJSGlobalTests/GlobalAPITests.swift rename Tests/{BridgeJSRuntimeTests/bridge-js.config.exposeToGlobal.json => BridgeJSGlobalTests/bridge-js.config.json} (100%) create mode 100644 Tests/BridgeJSGlobalTests/bridge-js.d.ts delete mode 100644 Tests/prelude.exposeToGlobal.mjs diff --git a/Makefile b/Makefile index 453b0b648..c46431dd1 100644 --- a/Makefile +++ b/Makefile @@ -11,16 +11,6 @@ unittest: --disable-sandbox \ js test --prelude ./Tests/prelude.mjs -Xnode --expose-gc -.PHONY: unittest-with-global -unittest-with-global: - cp Tests/BridgeJSRuntimeTests/bridge-js.config.exposeToGlobal.json Tests/BridgeJSRuntimeTests/bridge-js.config.local.json - swift package --allow-writing-to-directory Tests/BridgeJSRuntimeTests \ - bridge-js --package-path Tests/BridgeJSRuntimeTests - rm -f Tests/BridgeJSRuntimeTests/bridge-js.config.local.json - env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --swift-sdk "$(SWIFT_SDK_ID)" \ - --disable-sandbox \ - js test --prelude ./Tests/prelude.exposeToGlobal.mjs -Xnode --expose-gc - .PHONY: regenerate_swiftpm_resources regenerate_swiftpm_resources: npm run build diff --git a/Package.swift b/Package.swift index a8518a5a1..ddf2e36ef 100644 --- a/Package.swift +++ b/Package.swift @@ -180,5 +180,18 @@ let package = Package( ], linkerSettings: testingLinkerFlags ), + .testTarget( + name: "BridgeJSGlobalTests", + dependencies: ["JavaScriptKit", "JavaScriptEventLoop"], + exclude: [ + "bridge-js.config.json", + "bridge-js.d.ts", + "Generated/JavaScript", + ], + swiftSettings: [ + .enableExperimentalFeature("Extern") + ], + linkerSettings: testingLinkerFlags + ), ] ) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index bd32169f5..7ecc2086f 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -1127,13 +1127,13 @@ struct BridgeJSLink { } // Generate wrapper functions for each module - for (moduleName, classes) in modulesByName { + for (moduleName, classes) in modulesByName.sorted(by: { $0.key < $1.key }) { wrapperLines.append("// Wrapper functions for module: \(moduleName)") wrapperLines.append("if (!importObject[\"\(moduleName)\"]) {") wrapperLines.append(" importObject[\"\(moduleName)\"] = {};") wrapperLines.append("}") - for klass in classes { + for klass in classes.sorted(by: { $0.name < $1.name }) { let wrapperFunctionName = "bjs_\(klass.name)_wrap" wrapperLines.append("importObject[\"\(moduleName)\"][\"\(wrapperFunctionName)\"] = function(pointer) {") wrapperLines.append(" const obj = \(klass.name).__construct(pointer);") @@ -2639,14 +2639,14 @@ extension BridgeJSLink { renderTSSignatureCallback: @escaping ([Parameter], BridgeType, Effects) -> String ) -> [String] { let printer = CodeFragmentPrinter() - + let globalSkeletons = exportedSkeletons.filter { $0.exposeToGlobal } let nonGlobalSkeletons = exportedSkeletons.filter { !$0.exposeToGlobal } - + if !globalSkeletons.isEmpty { let globalRootNode = NamespaceNode(name: "") buildExportsTree(rootNode: globalRootNode, exportedSkeletons: globalSkeletons) - + if !globalRootNode.children.isEmpty { printer.write("export {};") printer.nextLine() @@ -2664,11 +2664,11 @@ extension BridgeJSLink { printer.nextLine() } } - + if !nonGlobalSkeletons.isEmpty { let localRootNode = NamespaceNode(name: "") buildExportsTree(rootNode: localRootNode, exportedSkeletons: nonGlobalSkeletons) - + if !localRootNode.children.isEmpty { generateNamespaceDeclarationsForNode( node: localRootNode, @@ -2682,7 +2682,7 @@ extension BridgeJSLink { return printer.lines } - + private func generateNamespaceDeclarationsForNode( node: NamespaceNode, depth: Int, @@ -2871,13 +2871,19 @@ extension BridgeJSLink { } } - generateNamespaceDeclarationsForNode(node: childNode, depth: depth + 1, printer: printer, exposeToGlobal: exposeToGlobal, renderTSSignatureCallback: renderTSSignatureCallback) + generateNamespaceDeclarationsForNode( + node: childNode, + depth: depth + 1, + printer: printer, + exposeToGlobal: exposeToGlobal, + renderTSSignatureCallback: renderTSSignatureCallback + ) printer.unindent() printer.write("}") } } - + generateNamespaceDeclarations(node: node, depth: depth) } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift index 989d05e2f..c81a224f8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift @@ -91,4 +91,25 @@ import Testing let bridgeJSLink: BridgeJSLink = BridgeJSLink(exportedSkeletons: [outputSkeleton], sharedMemory: false) try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Global.Export") } + + @Test + func snapshotMixedModuleExposure() throws { + let globalURL = Self.inputsDirectory.appendingPathComponent("MixedGlobal.swift") + let globalSourceFile = Parser.parse(source: try String(contentsOf: globalURL, encoding: .utf8)) + let globalAPI = ExportSwift(progress: .silent, moduleName: "GlobalModule", exposeToGlobal: true) + try globalAPI.addSourceFile(globalSourceFile, "MixedGlobal.swift") + let (_, globalSkeleton) = try #require(try globalAPI.finalize()) + + let privateURL = Self.inputsDirectory.appendingPathComponent("MixedPrivate.swift") + let privateSourceFile = Parser.parse(source: try String(contentsOf: privateURL, encoding: .utf8)) + let privateAPI = ExportSwift(progress: .silent, moduleName: "PrivateModule", exposeToGlobal: false) + try privateAPI.addSourceFile(privateSourceFile, "MixedPrivate.swift") + let (_, privateSkeleton) = try #require(try privateAPI.finalize()) + + let bridgeJSLink = BridgeJSLink( + exportedSkeletons: [globalSkeleton, privateSkeleton], + sharedMemory: false + ) + try snapshot(bridgeJSLink: bridgeJSLink, name: "MixedModules.Export") + } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MixedGlobal.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MixedGlobal.swift new file mode 100644 index 000000000..f65abe3a7 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MixedGlobal.swift @@ -0,0 +1,8 @@ +@JS(namespace: "GlobalAPI") +func globalFunction() -> String + +@JS(namespace: "GlobalAPI") +class GlobalClass { + @JS public init() + @JS public func greet() -> String +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MixedPrivate.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MixedPrivate.swift new file mode 100644 index 000000000..0f99fcede --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MixedPrivate.swift @@ -0,0 +1,8 @@ +@JS(namespace: "PrivateAPI") +func privateFunction() -> String + +@JS(namespace: "PrivateAPI") +class PrivateClass { + @JS public init() + @JS public func greet() -> String +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index 9f56215d7..fa7a7c06b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -191,6 +191,10 @@ export async function createInstantiator(options, swift) { if (!importObject["TestModule"]) { importObject["TestModule"] = {}; } + importObject["TestModule"]["bjs_ConstructorDefaults_wrap"] = function(pointer) { + const obj = ConstructorDefaults.__construct(pointer); + return swift.memory.retain(obj); + }; importObject["TestModule"]["bjs_DefaultGreeter_wrap"] = function(pointer) { const obj = DefaultGreeter.__construct(pointer); return swift.memory.retain(obj); @@ -199,10 +203,6 @@ export async function createInstantiator(options, swift) { const obj = EmptyGreeter.__construct(pointer); return swift.memory.retain(obj); }; - importObject["TestModule"]["bjs_ConstructorDefaults_wrap"] = function(pointer) { - const obj = ConstructorDefaults.__construct(pointer); - return swift.memory.retain(obj); - }; }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.d.ts new file mode 100644 index 000000000..7b4cc95e6 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.d.ts @@ -0,0 +1,33 @@ +// 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 GlobalClass extends SwiftHeapObject { + greet(): string; +} +export type Exports = { + GlobalAPI: { + GlobalClass: { + new(): GlobalClass; + } + globalFunction(): string; + }, +} +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/MixedGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js new file mode 100644 index 000000000..453057fa3 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js @@ -0,0 +1,254 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_GlobalClass_wrap"] = function(pointer) { + const obj = GlobalClass.__construct(pointer); + return swift.memory.retain(obj); + }; + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class GlobalClass extends SwiftHeapObject { + 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); + } + greet() { + instance.exports.bjs_GlobalClass_greet(this.pointer); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + } + const exports = { + GlobalAPI: { + GlobalClass, + globalFunction: function bjs_GlobalAPI_globalFunction() { + instance.exports.bjs_GlobalAPI_globalFunction(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + }, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.d.ts new file mode 100644 index 000000000..67a6eebcf --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.d.ts @@ -0,0 +1,54 @@ +// 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 {}; + +declare global { + namespace GlobalAPI { + class GlobalClass { + constructor(); + greet(): string; + } + globalFunction(): string; + } +} + +/// 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 GlobalClass extends SwiftHeapObject { + greet(): string; +} +export interface PrivateClass extends SwiftHeapObject { + greet(): string; +} +export type Exports = { + GlobalAPI: { + GlobalClass: { + new(): GlobalClass; + } + globalFunction(): string; + }, + PrivateAPI: { + PrivateClass: { + new(): PrivateClass; + } + privateFunction(): string; + }, +} +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/MixedModules.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js new file mode 100644 index 000000000..0ff8f450e --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js @@ -0,0 +1,292 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + // Wrapper functions for module: GlobalModule + if (!importObject["GlobalModule"]) { + importObject["GlobalModule"] = {}; + } + importObject["GlobalModule"]["bjs_GlobalClass_wrap"] = function(pointer) { + const obj = GlobalClass.__construct(pointer); + return swift.memory.retain(obj); + }; + // Wrapper functions for module: PrivateModule + if (!importObject["PrivateModule"]) { + importObject["PrivateModule"] = {}; + } + importObject["PrivateModule"]["bjs_PrivateClass_wrap"] = function(pointer) { + const obj = PrivateClass.__construct(pointer); + return swift.memory.retain(obj); + }; + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class GlobalClass extends SwiftHeapObject { + 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); + } + greet() { + instance.exports.bjs_GlobalClass_greet(this.pointer); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + } + class PrivateClass extends SwiftHeapObject { + 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); + } + greet() { + instance.exports.bjs_PrivateClass_greet(this.pointer); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + } + if (typeof globalThis.GlobalAPI === 'undefined') { + globalThis.GlobalAPI = {}; + } + const exports = { + GlobalAPI: { + GlobalClass, + globalFunction: function bjs_GlobalAPI_globalFunction() { + instance.exports.bjs_GlobalAPI_globalFunction(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + }, + PrivateAPI: { + PrivateClass, + privateFunction: function bjs_PrivateAPI_privateFunction() { + instance.exports.bjs_PrivateAPI_privateFunction(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + }, + }; + _exports = exports; + globalThis.GlobalAPI.GlobalClass = exports.GlobalAPI.GlobalClass; + globalThis.GlobalAPI.globalFunction = exports.GlobalAPI.globalFunction; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.d.ts new file mode 100644 index 000000000..193857072 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.d.ts @@ -0,0 +1,33 @@ +// 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 PrivateClass extends SwiftHeapObject { + greet(): string; +} +export type Exports = { + PrivateAPI: { + PrivateClass: { + new(): PrivateClass; + } + privateFunction(): string; + }, +} +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/MixedPrivate.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js new file mode 100644 index 000000000..e422b08b6 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js @@ -0,0 +1,254 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_PrivateClass_wrap"] = function(pointer) { + const obj = PrivateClass.__construct(pointer); + return swift.memory.retain(obj); + }; + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class PrivateClass extends SwiftHeapObject { + 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); + } + greet() { + instance.exports.bjs_PrivateClass_greet(this.pointer); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + } + const exports = { + PrivateAPI: { + PrivateClass, + privateFunction: function bjs_PrivateAPI_privateFunction() { + instance.exports.bjs_PrivateAPI_privateFunction(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + }, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index 08601bd50..24022a438 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -185,14 +185,14 @@ export async function createInstantiator(options, swift) { if (!importObject["TestModule"]) { importObject["TestModule"] = {}; } - importObject["TestModule"]["bjs_Greeter_wrap"] = function(pointer) { - const obj = Greeter.__construct(pointer); - return swift.memory.retain(obj); - }; importObject["TestModule"]["bjs_Converter_wrap"] = function(pointer) { const obj = Converter.__construct(pointer); return swift.memory.retain(obj); }; + importObject["TestModule"]["bjs_Greeter_wrap"] = function(pointer) { + const obj = Greeter.__construct(pointer); + return swift.memory.retain(obj); + }; importObject["TestModule"]["bjs_UUID_wrap"] = function(pointer) { const obj = UUID.__construct(pointer); return swift.memory.retain(obj); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js index 67670d204..e2f13dd02 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js @@ -185,14 +185,14 @@ export async function createInstantiator(options, swift) { if (!importObject["TestModule"]) { importObject["TestModule"] = {}; } - importObject["TestModule"]["bjs_Greeter_wrap"] = function(pointer) { - const obj = Greeter.__construct(pointer); - return swift.memory.retain(obj); - }; importObject["TestModule"]["bjs_Converter_wrap"] = function(pointer) { const obj = Converter.__construct(pointer); return swift.memory.retain(obj); }; + importObject["TestModule"]["bjs_Greeter_wrap"] = function(pointer) { + const obj = Greeter.__construct(pointer); + return swift.memory.retain(obj); + }; importObject["TestModule"]["bjs_UUID_wrap"] = function(pointer) { const obj = UUID.__construct(pointer); return swift.memory.retain(obj); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js index 9a5eec432..e946b01ce 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js @@ -189,14 +189,14 @@ export async function createInstantiator(options, swift) { const obj = Greeter.__construct(pointer); return swift.memory.retain(obj); }; - importObject["TestModule"]["bjs_PublicGreeter_wrap"] = function(pointer) { - const obj = PublicGreeter.__construct(pointer); - return swift.memory.retain(obj); - }; importObject["TestModule"]["bjs_PackageGreeter_wrap"] = function(pointer) { const obj = PackageGreeter.__construct(pointer); return swift.memory.retain(obj); }; + importObject["TestModule"]["bjs_PublicGreeter_wrap"] = function(pointer) { + const obj = PublicGreeter.__construct(pointer); + return swift.memory.retain(obj); + }; }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift index ca201f3d9..cf4977501 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift @@ -120,18 +120,19 @@ public func _bjs_Converter_deinit(pointer: UnsafeMutableRawPointer) { extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") - func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_Converter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") +fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_HTTPServer_init") @_cdecl("bjs_HTTPServer_init") public func _bjs_HTTPServer_init() -> UnsafeMutableRawPointer { @@ -161,18 +162,19 @@ public func _bjs_HTTPServer_deinit(pointer: UnsafeMutableRawPointer) { extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_HTTPServer_wrap") - func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_HTTPServer_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_HTTPServer_wrap") +fileprivate func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_TestServer_init") @_cdecl("bjs_TestServer_init") public func _bjs_TestServer_init() -> UnsafeMutableRawPointer { @@ -202,14 +204,15 @@ public func _bjs_TestServer_deinit(pointer: UnsafeMutableRawPointer) { extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_TestServer_wrap") - func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_TestServer_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_TestServer_wrap") +fileprivate func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json new file mode 100644 index 000000000..21e78b120 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json @@ -0,0 +1,74 @@ +{ + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_GlobalClass_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_GlobalClass_greet", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "GlobalClass", + "namespace" : [ + "GlobalAPI" + ], + "properties" : [ + + ], + "swiftCallName" : "GlobalClass" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_GlobalAPI_globalFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "globalFunction", + "namespace" : [ + "GlobalAPI" + ], + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "moduleName" : "TestModule", + "protocols" : [ + + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift new file mode 100644 index 000000000..774bf075c --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift @@ -0,0 +1,61 @@ +// 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 + +@_expose(wasm, "bjs_GlobalAPI_globalFunction") +@_cdecl("bjs_GlobalAPI_globalFunction") +public func _bjs_GlobalAPI_globalFunction() -> Void { + #if arch(wasm32) + let ret = globalFunction() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_GlobalClass_init") +@_cdecl("bjs_GlobalClass_init") +public func _bjs_GlobalClass_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = GlobalClass() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_GlobalClass_greet") +@_cdecl("bjs_GlobalClass_greet") +public func _bjs_GlobalClass_greet(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = GlobalClass.bridgeJSLiftParameter(_self).greet() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_GlobalClass_deinit") +@_cdecl("bjs_GlobalClass_deinit") +public func _bjs_GlobalClass_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension GlobalClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_GlobalClass_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_GlobalClass_wrap") +fileprivate func _bjs_GlobalClass_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_GlobalClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json new file mode 100644 index 000000000..d86712af6 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json @@ -0,0 +1,74 @@ +{ + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_PrivateClass_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_PrivateClass_greet", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "PrivateClass", + "namespace" : [ + "PrivateAPI" + ], + "properties" : [ + + ], + "swiftCallName" : "PrivateClass" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_PrivateAPI_privateFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "privateFunction", + "namespace" : [ + "PrivateAPI" + ], + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "moduleName" : "TestModule", + "protocols" : [ + + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift new file mode 100644 index 000000000..10c62bb03 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift @@ -0,0 +1,61 @@ +// 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 + +@_expose(wasm, "bjs_PrivateAPI_privateFunction") +@_cdecl("bjs_PrivateAPI_privateFunction") +public func _bjs_PrivateAPI_privateFunction() -> Void { + #if arch(wasm32) + let ret = privateFunction() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PrivateClass_init") +@_cdecl("bjs_PrivateClass_init") +public func _bjs_PrivateClass_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = PrivateClass() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PrivateClass_greet") +@_cdecl("bjs_PrivateClass_greet") +public func _bjs_PrivateClass_greet(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = PrivateClass.bridgeJSLiftParameter(_self).greet() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PrivateClass_deinit") +@_cdecl("bjs_PrivateClass_deinit") +public func _bjs_PrivateClass_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension PrivateClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_PrivateClass_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_PrivateClass_wrap") +fileprivate func _bjs_PrivateClass_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PrivateClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift index f868fa111..3e7714464 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift @@ -58,18 +58,19 @@ public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") - func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_Greeter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") +fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_Converter_init") @_cdecl("bjs_Converter_init") public func _bjs_Converter_init() -> UnsafeMutableRawPointer { @@ -100,18 +101,19 @@ public func _bjs_Converter_deinit(pointer: UnsafeMutableRawPointer) { extension Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") - func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_Converter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") +fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_UUID_uuidString") @_cdecl("bjs_UUID_uuidString") public func _bjs_UUID_uuidString(_self: UnsafeMutableRawPointer) -> Void { @@ -131,14 +133,15 @@ public func _bjs_UUID_deinit(pointer: UnsafeMutableRawPointer) { extension UUID: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_UUID_wrap") - func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_UUID_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_UUID_wrap") +fileprivate func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift index 7aa91b915..81ea282fe 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift @@ -179,14 +179,15 @@ public func _bjs_MathUtils_deinit(pointer: UnsafeMutableRawPointer) { extension MathUtils: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_MathUtils_wrap") - func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_MathUtils_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_MathUtils_wrap") +fileprivate func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift index 72d561a00..e34f26f8c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift @@ -325,14 +325,15 @@ public func _bjs_PropertyClass_deinit(pointer: UnsafeMutableRawPointer) { extension PropertyClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - #if arch(wasm32) - @_extern(wasm, module: "TestModule", name: "bjs_PropertyClass_wrap") - func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 - #else - func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif return .object(JSObject(id: UInt32(bitPattern: _bjs_PropertyClass_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} \ No newline at end of file +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_PropertyClass_wrap") +fileprivate func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift new file mode 100644 index 000000000..8e0c5f187 --- /dev/null +++ b/Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift @@ -0,0 +1,303 @@ +// 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 + +extension GlobalNetworking.API.CallMethod: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> GlobalNetworking.API.CallMethod { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> GlobalNetworking.API.CallMethod { + return GlobalNetworking.API.CallMethod(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 GlobalConfiguration.PublicLogLevel: _BridgedSwiftEnumNoPayload { +} + +extension GlobalConfiguration.AvailablePort: _BridgedSwiftEnumNoPayload { +} + +extension Internal.SupportedServerMethod: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Internal.SupportedServerMethod { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Internal.SupportedServerMethod { + return Internal.SupportedServerMethod(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 + } + } +} + +@_expose(wasm, "bjs_GlobalStaticPropertyNamespace_static_namespaceProperty_get") +@_cdecl("bjs_GlobalStaticPropertyNamespace_static_namespaceProperty_get") +public func _bjs_GlobalStaticPropertyNamespace_static_namespaceProperty_get() -> Void { + #if arch(wasm32) + let ret = GlobalStaticPropertyNamespace.namespaceProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_GlobalStaticPropertyNamespace_static_namespaceProperty_set") +@_cdecl("bjs_GlobalStaticPropertyNamespace_static_namespaceProperty_set") +public func _bjs_GlobalStaticPropertyNamespace_static_namespaceProperty_set(valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + GlobalStaticPropertyNamespace.namespaceProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_GlobalStaticPropertyNamespace_static_namespaceConstant_get") +@_cdecl("bjs_GlobalStaticPropertyNamespace_static_namespaceConstant_get") +public func _bjs_GlobalStaticPropertyNamespace_static_namespaceConstant_get() -> Void { + #if arch(wasm32) + let ret = GlobalStaticPropertyNamespace.namespaceConstant + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedProperty_get") +@_cdecl("bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedProperty_get") +public func _bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedProperty_get() -> Int32 { + #if arch(wasm32) + let ret = GlobalStaticPropertyNamespace.NestedProperties.nestedProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedProperty_set") +@_cdecl("bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedProperty_set") +public func _bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedProperty_set(value: Int32) -> Void { + #if arch(wasm32) + GlobalStaticPropertyNamespace.NestedProperties.nestedProperty = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedConstant_get") +@_cdecl("bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedConstant_get") +public func _bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedConstant_get() -> Void { + #if arch(wasm32) + let ret = GlobalStaticPropertyNamespace.NestedProperties.nestedConstant + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedDouble_get") +@_cdecl("bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedDouble_get") +public func _bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedDouble_get() -> Float64 { + #if arch(wasm32) + let ret = GlobalStaticPropertyNamespace.NestedProperties.nestedDouble + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedDouble_set") +@_cdecl("bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedDouble_set") +public func _bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedDouble_set(value: Float64) -> Void { + #if arch(wasm32) + GlobalStaticPropertyNamespace.NestedProperties.nestedDouble = Double.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestHTTPServer_init") +@_cdecl("bjs_TestHTTPServer_init") +public func _bjs_TestHTTPServer_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = GlobalNetworking.API.TestHTTPServer() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestHTTPServer_call") +@_cdecl("bjs_TestHTTPServer_call") +public func _bjs_TestHTTPServer_call(_self: UnsafeMutableRawPointer, method: Int32) -> Void { + #if arch(wasm32) + GlobalNetworking.API.TestHTTPServer.bridgeJSLiftParameter(_self).call(_: GlobalNetworking.API.CallMethod.bridgeJSLiftParameter(method)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestHTTPServer_deinit") +@_cdecl("bjs_TestHTTPServer_deinit") +public func _bjs_TestHTTPServer_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension GlobalNetworking.API.TestHTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_TestHTTPServer_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSGlobalTests", name: "bjs_TestHTTPServer_wrap") +fileprivate func _bjs_TestHTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_TestHTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_TestInternalServer_init") +@_cdecl("bjs_TestInternalServer_init") +public func _bjs_TestInternalServer_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Internal.TestInternalServer() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestInternalServer_call") +@_cdecl("bjs_TestInternalServer_call") +public func _bjs_TestInternalServer_call(_self: UnsafeMutableRawPointer, method: Int32) -> Void { + #if arch(wasm32) + Internal.TestInternalServer.bridgeJSLiftParameter(_self).call(_: Internal.SupportedServerMethod.bridgeJSLiftParameter(method)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TestInternalServer_deinit") +@_cdecl("bjs_TestInternalServer_deinit") +public func _bjs_TestInternalServer_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension Internal.TestInternalServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_TestInternalServer_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSGlobalTests", name: "bjs_TestInternalServer_wrap") +fileprivate func _bjs_TestInternalServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_TestInternalServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_PublicConverter_init") +@_cdecl("bjs_PublicConverter_init") +public func _bjs_PublicConverter_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = GlobalUtils.PublicConverter() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PublicConverter_toString") +@_cdecl("bjs_PublicConverter_toString") +public func _bjs_PublicConverter_toString(_self: UnsafeMutableRawPointer, value: Int32) -> Void { + #if arch(wasm32) + let ret = GlobalUtils.PublicConverter.bridgeJSLiftParameter(_self).toString(value: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PublicConverter_deinit") +@_cdecl("bjs_PublicConverter_deinit") +public func _bjs_PublicConverter_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension GlobalUtils.PublicConverter: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_PublicConverter_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSGlobalTests", name: "bjs_PublicConverter_wrap") +fileprivate func _bjs_PublicConverter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PublicConverter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json new file mode 100644 index 000000000..979311c86 --- /dev/null +++ b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -0,0 +1,537 @@ +{ + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_TestHTTPServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_TestHTTPServer_call", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "call", + "namespace" : [ + "GlobalNetworking", + "API" + ], + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "GlobalNetworking.API.CallMethod" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "TestHTTPServer", + "namespace" : [ + "GlobalNetworking", + "API" + ], + "properties" : [ + + ], + "swiftCallName" : "GlobalNetworking.API.TestHTTPServer" + }, + { + "constructor" : { + "abiName" : "bjs_TestInternalServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_TestInternalServer_call", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "call", + "namespace" : [ + "GlobalNetworking", + "APIV2", + "Internal" + ], + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "Internal.SupportedServerMethod" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "TestInternalServer", + "namespace" : [ + "GlobalNetworking", + "APIV2", + "Internal" + ], + "properties" : [ + + ], + "swiftCallName" : "Internal.TestInternalServer" + }, + { + "constructor" : { + "abiName" : "bjs_PublicConverter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_PublicConverter_toString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "toString", + "namespace" : [ + "GlobalUtils" + ], + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "PublicConverter", + "namespace" : [ + "GlobalUtils" + ], + "properties" : [ + + ], + "swiftCallName" : "GlobalUtils.PublicConverter" + } + ], + "enums" : [ + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "GlobalNetworking", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalNetworking", + "tsFullPath" : "GlobalNetworking" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "API", + "namespace" : [ + "GlobalNetworking" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalNetworking.API", + "tsFullPath" : "GlobalNetworking.API" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "get" + }, + { + "associatedValues" : [ + + ], + "name" : "post" + }, + { + "associatedValues" : [ + + ], + "name" : "put" + }, + { + "associatedValues" : [ + + ], + "name" : "delete" + } + ], + "emitStyle" : "const", + "name" : "CallMethod", + "namespace" : [ + "GlobalNetworking", + "API" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalNetworking.API.CallMethod", + "tsFullPath" : "GlobalNetworking.API.CallMethod" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "GlobalConfiguration", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalConfiguration", + "tsFullPath" : "GlobalConfiguration" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "debug", + "rawValue" : "debug" + }, + { + "associatedValues" : [ + + ], + "name" : "info", + "rawValue" : "info" + }, + { + "associatedValues" : [ + + ], + "name" : "warning", + "rawValue" : "warning" + }, + { + "associatedValues" : [ + + ], + "name" : "error", + "rawValue" : "error" + } + ], + "emitStyle" : "const", + "name" : "PublicLogLevel", + "namespace" : [ + "GlobalConfiguration" + ], + "rawType" : "String", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalConfiguration.PublicLogLevel", + "tsFullPath" : "GlobalConfiguration.PublicLogLevel" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "http", + "rawValue" : "80" + }, + { + "associatedValues" : [ + + ], + "name" : "https", + "rawValue" : "443" + }, + { + "associatedValues" : [ + + ], + "name" : "development", + "rawValue" : "3000" + } + ], + "emitStyle" : "const", + "name" : "AvailablePort", + "namespace" : [ + "GlobalConfiguration" + ], + "rawType" : "Int", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalConfiguration.AvailablePort", + "tsFullPath" : "GlobalConfiguration.AvailablePort" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Internal", + "namespace" : [ + "GlobalNetworking", + "APIV2" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Internal", + "tsFullPath" : "GlobalNetworking.APIV2.Internal" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "get" + }, + { + "associatedValues" : [ + + ], + "name" : "post" + } + ], + "emitStyle" : "const", + "name" : "SupportedServerMethod", + "namespace" : [ + "GlobalNetworking", + "APIV2", + "Internal" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Internal.SupportedServerMethod", + "tsFullPath" : "GlobalNetworking.APIV2.Internal.SupportedServerMethod" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "GlobalStaticPropertyNamespace", + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "namespaceProperty", + "namespace" : [ + "GlobalStaticPropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "namespaceConstant", + "namespace" : [ + "GlobalStaticPropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "GlobalStaticPropertyNamespace", + "tsFullPath" : "GlobalStaticPropertyNamespace" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "NestedProperties", + "namespace" : [ + "GlobalStaticPropertyNamespace" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedProperty", + "namespace" : [ + "GlobalStaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "nestedConstant", + "namespace" : [ + "GlobalStaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedDouble", + "namespace" : [ + "GlobalStaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "GlobalStaticPropertyNamespace.NestedProperties", + "tsFullPath" : "GlobalStaticPropertyNamespace.NestedProperties" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "GlobalUtils", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalUtils", + "tsFullPath" : "GlobalUtils" + } + ], + "exposeToGlobal" : true, + "functions" : [ + + ], + "moduleName" : "BridgeJSGlobalTests", + "protocols" : [ + + ] +} \ No newline at end of file diff --git a/Tests/BridgeJSGlobalTests/GlobalAPITests.swift b/Tests/BridgeJSGlobalTests/GlobalAPITests.swift new file mode 100644 index 000000000..19087ff55 --- /dev/null +++ b/Tests/BridgeJSGlobalTests/GlobalAPITests.swift @@ -0,0 +1,78 @@ +import XCTest +import JavaScriptKit + +@_extern(wasm, module: "BridgeJSGlobalTests", name: "runJsWorksGlobal") +@_extern(c) +func runJsWorksGlobal() -> Void + +// Minimal set of @JS declarations for testing globalThis access +// These are namespaced items that should be accessible via globalThis + +@JS enum GlobalNetworking { + @JS enum API { + @JS enum CallMethod { + case get + case post + case put + case delete + } + @JS class TestHTTPServer { + @JS init() {} + @JS func call(_ method: CallMethod) {} + } + } +} + +@JS enum GlobalConfiguration { + @JS enum PublicLogLevel: String { + case debug = "debug" + case info = "info" + case warning = "warning" + case error = "error" + } + + @JS enum AvailablePort: Int { + case http = 80 + case https = 443 + case development = 3000 + } +} + +@JS(namespace: "GlobalNetworking.APIV2") +enum Internal { + @JS enum SupportedServerMethod { + case get + case post + } + @JS class TestInternalServer { + @JS init() {} + @JS func call(_ method: SupportedServerMethod) {} + } +} + +@JS enum GlobalStaticPropertyNamespace { + @JS nonisolated(unsafe) static var namespaceProperty: String = "namespace" + @JS static let namespaceConstant: String = "constant" + + @JS enum NestedProperties { + @JS nonisolated(unsafe) static var nestedProperty: Int = 999 + @JS static let nestedConstant: String = "nested" + @JS nonisolated(unsafe) static var nestedDouble: Double = 1.414 + } +} + +@JS enum GlobalUtils { + @JS class PublicConverter { + @JS init() {} + + @JS func toString(value: Int) -> String { + return String(value) + } + } +} + +class GlobalAPITests: XCTestCase { + func testGlobalAccess() { + runJsWorksGlobal() + } +} diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.config.exposeToGlobal.json b/Tests/BridgeJSGlobalTests/bridge-js.config.json similarity index 100% rename from Tests/BridgeJSRuntimeTests/bridge-js.config.exposeToGlobal.json rename to Tests/BridgeJSGlobalTests/bridge-js.config.json diff --git a/Tests/BridgeJSGlobalTests/bridge-js.d.ts b/Tests/BridgeJSGlobalTests/bridge-js.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index f5268b4ee..ff3d9dbed 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -872,12 +872,6 @@ enum APIOptionalResult { } } -// Test functions for static properties -@JS func getAllStaticPropertyValues() -> String { - return - "const:\(StaticPropertyHolder.staticConstant),var:\(StaticPropertyHolder.staticVariable),computed:\(StaticPropertyHolder.computedProperty),readonly:\(StaticPropertyHolder.readOnlyComputed)" -} - // MARK: - Protocol Tests @JS protocol DataProcessor { diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index 572890b0f..9923eedd5 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -3265,17 +3265,6 @@ public func _bjs_testEmptyInit(object: UnsafeMutableRawPointer) -> UnsafeMutable #endif } -@_expose(wasm, "bjs_getAllStaticPropertyValues") -@_cdecl("bjs_getAllStaticPropertyValues") -public func _bjs_getAllStaticPropertyValues() -> Void { - #if arch(wasm32) - let ret = getAllStaticPropertyValues() - 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 { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index 69564e72c..75964debb 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -7402,23 +7402,6 @@ } } }, - { - "abiName" : "bjs_getAllStaticPropertyValues", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getAllStaticPropertyValues", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, { "abiName" : "bjs_formatName", "effects" : { diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts index 0f0d01556..e69de29bb 100644 --- a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts +++ b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts @@ -1,18 +0,0 @@ -export function jsRoundTripVoid(): void -export function jsRoundTripNumber(v: number): number -export function jsRoundTripBool(v: boolean): boolean -export function jsRoundTripString(v: string): string -export function jsThrowOrVoid(shouldThrow: boolean): void -export function jsThrowOrNumber(shouldThrow: boolean): number -export function jsThrowOrBool(shouldThrow: boolean): boolean -export function jsThrowOrString(shouldThrow: boolean): string - -export class JsGreeter { - name: string; - readonly prefix: string; - constructor(name: string, prefix: string); - greet(): string; - changeName(name: string): void; -} - -export function runAsyncWorks(): Promise; diff --git a/Tests/prelude.exposeToGlobal.mjs b/Tests/prelude.exposeToGlobal.mjs deleted file mode 100644 index 47e36b4d2..000000000 --- a/Tests/prelude.exposeToGlobal.mjs +++ /dev/null @@ -1,248 +0,0 @@ -/** @type {import('../.build/plugins/PackageToJS/outputs/PackageTests/test.d.ts').SetupOptionsFn} */ -export async function setupOptions(options, context) { - Error.stackTraceLimit = 100; - setupTestGlobals(globalThis); - return { - ...options, - getImports: (importsContext) => { - return { - "jsRoundTripVoid": () => { - return; - }, - "jsRoundTripNumber": (v) => { - return v; - }, - "jsRoundTripBool": (v) => { - return v; - }, - "jsRoundTripString": (v) => { - return v; - }, - "jsThrowOrVoid": (shouldThrow) => { - if (shouldThrow) { - throw new Error("TestError"); - } - }, - "jsThrowOrNumber": (shouldThrow) => { - if (shouldThrow) { - throw new Error("TestError"); - } - return 1; - }, - "jsThrowOrBool": (shouldThrow) => { - if (shouldThrow) { - throw new Error("TestError"); - } - return true; - }, - "jsThrowOrString": (shouldThrow) => { - if (shouldThrow) { - throw new Error("TestError"); - } - return "Hello, world!"; - }, - JsGreeter: class { - /** - * @param {string} name - * @param {string} prefix - */ - constructor(name, prefix) { - this.name = name; - this.prefix = prefix; - } - greet() { - return `${this.prefix}, ${this.name}!`; - } - /** @param {string} name */ - changeName(name) { - this.name = name; - } - }, - runAsyncWorks: async () => { - const exports = importsContext.getExports(); - if (!exports) { - throw new Error("No exports!?"); - } - BridgeJSRuntimeTests_runAsyncWorks(exports); - return; - } - }; - }, - addToCoreImports(importObject, importsContext) { - const { getInstance, getExports } = importsContext; - options.addToCoreImports?.(importObject, importsContext); - importObject["JavaScriptEventLoopTestSupportTests"] = { - "isMainThread": () => context.isMainThread, - } - const bridgeJSRuntimeTests = importObject["BridgeJSRuntimeTests"] || {}; - bridgeJSRuntimeTests["runJsWorks"] = () => { - const exports = getExports(); - if (!exports) { - throw new Error("No exports!?"); - } - return BridgeJSRuntimeTests_runJsWorks(getInstance(), exports); - } - importObject["BridgeJSRuntimeTests"] = bridgeJSRuntimeTests; - } - } -} - -import assert from "node:assert"; - -/** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ -function BridgeJSRuntimeTests_runJsWorks(instance, exports) { - // Repetition tests to satisfy testAll - const g = new exports.Greeter("John"); - g.release(); - const calc = exports.createCalculator(); - calc.release(); - - assert.equal(globalThis.Networking.API.MethodValues.Get, 0); - assert.equal(globalThis.Networking.API.MethodValues.Post, 1); - assert.equal(globalThis.Networking.API.MethodValues.Put, 2); - assert.equal(globalThis.Networking.API.MethodValues.Delete, 3); - - assert.equal(globalThis.Configuration.LogLevelValues.Debug, "debug"); - assert.equal(globalThis.Configuration.LogLevelValues.Info, "info"); - assert.equal(globalThis.Configuration.LogLevelValues.Warning, "warning"); - assert.equal(globalThis.Configuration.LogLevelValues.Error, "error"); - assert.equal(globalThis.Configuration.PortValues.Http, 80); - assert.equal(globalThis.Configuration.PortValues.Https, 443); - assert.equal(globalThis.Configuration.PortValues.Development, 3000); - - assert.equal(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Get, 0); - assert.equal(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Post, 1); - - const globalConverter = new globalThis.Utils.Converter(); - assert.equal(globalConverter.toString(99), "99"); - globalConverter.release(); - - const globalHttpServer = new globalThis.Networking.API.HTTPServer(); - globalHttpServer.call(globalThis.Networking.API.MethodValues.Get); - globalHttpServer.release(); - - const globalTestServer = new globalThis.Networking.APIV2.Internal.TestServer(); - globalTestServer.call(globalThis.Networking.APIV2.Internal.SupportedMethodValues.Post); - globalTestServer.release(); - - assert.equal(globalThis.StaticPropertyNamespace.namespaceProperty, "namespace"); - assert.equal(globalThis.StaticPropertyNamespace.namespaceConstant, "constant"); - - globalThis.StaticPropertyNamespace.namespaceProperty = "modified namespace"; - assert.equal(globalThis.StaticPropertyNamespace.namespaceProperty, "modified namespace"); - - assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty, 999); - assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedConstant, "nested"); - assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedDouble, 1.414); - - globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty = 1000; - globalThis.StaticPropertyNamespace.NestedProperties.nestedDouble = 2.828; - assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty, 1000); - assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedDouble, 2.828); - - // // Verify both globalThis and exports point to same objects - // assert.equal(globalThis.StaticPropertyNamespace.namespaceProperty, exports.StaticPropertyNamespace.namespaceProperty); - // assert.equal(globalThis.StaticPropertyNamespace.NestedProperties.nestedProperty, exports.StaticPropertyNamespace.NestedProperties.nestedProperty); - - // // Verify enum values accessible via globalThis match exports - // assert.equal(exports.Configuration.LogLevel.Debug, globalThis.Configuration.LogLevelValues.Debug); - // assert.equal(exports.Networking.API.Method.Get, globalThis.Networking.API.MethodValues.Get); -} - -/** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ -async function BridgeJSRuntimeTests_runAsyncWorks(exports) { - await exports.asyncRoundTripVoid(); -} - -function setupTestGlobals(global) { - global.globalObject1 = { - prop_1: { - nested_prop: 1, - }, - prop_2: 2, - prop_3: true, - prop_4: [3, 4, "str_elm_1", null, undefined, 5], - prop_5: { - func1: function () { - return; - }, - func2: function () { - return 1; - }, - func3: function (n) { - return n * 2; - }, - func4: function (a, b, c) { - return a + b + c; - }, - func5: function (x) { - return "Hello, " + x; - }, - func6: function (c, a, b) { - if (c) { - return a; - } else { - return b; - } - }, - }, - prop_6: { - call_host_1: () => { - return global.globalObject1.prop_6.host_func_1(); - }, - }, - prop_7: 3.14, - prop_8: [0, , 2, 3, , , 6], - eval_closure: function (fn) { - return fn(arguments[1]); - }, - observable_obj: { - set_called: false, - target: new Proxy( - { - nested: {}, - }, - { - set(target, key, value) { - global.globalObject1.observable_obj.set_called = true; - target[key] = value; - return true; - }, - } - ), - }, - }; - - global.Animal = function (name, age, isCat) { - if (age < 0) { - throw new Error("Invalid age " + age); - } - this.name = name; - this.age = age; - this.bark = () => { - return isCat ? "nyan" : "wan"; - }; - this.isCat = isCat; - this.getIsCat = function () { - return this.isCat; - }; - this.setName = function (name) { - this.name = name; - }; - }; - - global.callThrowingClosure = (c) => { - try { - c(); - } catch (error) { - return error; - } - }; - - global.objectDecodingTest = { - obj: {}, - fn: () => { }, - sym: Symbol("s"), - bi: BigInt(3) - }; -} diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 640a65612..cfd898b31 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -88,7 +88,12 @@ export async function setupOptions(options, context) { } return BridgeJSRuntimeTests_runJsWorks(getInstance(), exports); } + const bridgeJSGlobalTests = importObject["BridgeJSGlobalTests"] || {}; + bridgeJSGlobalTests["runJsWorksGlobal"] = () => { + return BridgeJSGlobalTests_runJsWorksGlobal(); + } importObject["BridgeJSRuntimeTests"] = bridgeJSRuntimeTests; + importObject["BridgeJSGlobalTests"] = bridgeJSGlobalTests; } } } @@ -897,6 +902,51 @@ async function BridgeJSRuntimeTests_runAsyncWorks(exports) { await exports.asyncRoundTripVoid(); } +function BridgeJSGlobalTests_runJsWorksGlobal() { + assert.equal(globalThis.GlobalNetworking.API.CallMethodValues.Get, 0); + assert.equal(globalThis.GlobalNetworking.API.CallMethodValues.Post, 1); + assert.equal(globalThis.GlobalNetworking.API.CallMethodValues.Put, 2); + assert.equal(globalThis.GlobalNetworking.API.CallMethodValues.Delete, 3); + + assert.equal(globalThis.GlobalConfiguration.PublicLogLevelValues.Debug, "debug"); + assert.equal(globalThis.GlobalConfiguration.PublicLogLevelValues.Info, "info"); + assert.equal(globalThis.GlobalConfiguration.PublicLogLevelValues.Warning, "warning"); + assert.equal(globalThis.GlobalConfiguration.PublicLogLevelValues.Error, "error"); + assert.equal(globalThis.GlobalConfiguration.AvailablePortValues.Http, 80); + assert.equal(globalThis.GlobalConfiguration.AvailablePortValues.Https, 443); + assert.equal(globalThis.GlobalConfiguration.AvailablePortValues.Development, 3000); + + assert.equal(globalThis.GlobalNetworking.APIV2.Internal.SupportedServerMethodValues.Get, 0); + assert.equal(globalThis.GlobalNetworking.APIV2.Internal.SupportedServerMethodValues.Post, 1); + + const globalConverter = new globalThis.GlobalUtils.PublicConverter(); + assert.equal(globalConverter.toString(99), "99"); + globalConverter.release(); + + const globalHttpServer = new globalThis.GlobalNetworking.API.TestHTTPServer(); + globalHttpServer.call(globalThis.GlobalNetworking.API.CallMethodValues.Get); + globalHttpServer.release(); + + const globalTestServer = new globalThis.GlobalNetworking.APIV2.Internal.TestInternalServer(); + globalTestServer.call(globalThis.GlobalNetworking.APIV2.Internal.SupportedServerMethodValues.Post); + globalTestServer.release(); + + assert.equal(globalThis.GlobalStaticPropertyNamespace.namespaceProperty, "namespace"); + assert.equal(globalThis.GlobalStaticPropertyNamespace.namespaceConstant, "constant"); + + globalThis.GlobalStaticPropertyNamespace.namespaceProperty = "further modified"; + assert.equal(globalThis.GlobalStaticPropertyNamespace.namespaceProperty, "further modified"); + + assert.equal(globalThis.GlobalStaticPropertyNamespace.NestedProperties.nestedProperty, 999); + assert.equal(globalThis.GlobalStaticPropertyNamespace.NestedProperties.nestedConstant, "nested"); + assert.equal(globalThis.GlobalStaticPropertyNamespace.NestedProperties.nestedDouble, 1.414); + + globalThis.GlobalStaticPropertyNamespace.NestedProperties.nestedProperty = 2000; + globalThis.GlobalStaticPropertyNamespace.NestedProperties.nestedDouble = 3.141; + assert.equal(globalThis.GlobalStaticPropertyNamespace.NestedProperties.nestedProperty, 2000); + assert.equal(globalThis.GlobalStaticPropertyNamespace.NestedProperties.nestedDouble, 3.141); +} + function setupTestGlobals(global) { global.globalObject1 = { prop_1: { From 94762ae7b1929519f1c2f64602b795c58b80fb95 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 28 Nov 2025 13:03:10 +0000 Subject: [PATCH 042/252] Documentation: Fix docc formatting issues --- Sources/JavaScriptKit/BasicObjects/JSArray.swift | 2 +- .../Exporting-Swift/Exporting-Swift-Closure.md | 14 +++++++------- .../FundamentalObjects/JSClosure.swift | 8 ++++++++ .../FundamentalObjects/JSObject.swift | 2 +- Sources/JavaScriptKit/JSValueDecoder.swift | 1 + 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Sources/JavaScriptKit/BasicObjects/JSArray.swift b/Sources/JavaScriptKit/BasicObjects/JSArray.swift index 876a49985..9f24f48fd 100644 --- a/Sources/JavaScriptKit/BasicObjects/JSArray.swift +++ b/Sources/JavaScriptKit/BasicObjects/JSArray.swift @@ -19,7 +19,7 @@ public class JSArray: JSBridgedClass { /// Construct a `JSArray` from Array `JSObject`. /// Return `nil` if the object is not an Array. /// - /// - Parameter object: A `JSObject` expected to be a JavaScript Array + /// - Parameter jsObject: A `JSObject` expected to be a JavaScript Array public convenience init?(_ jsObject: JSObject) { guard Self.isArray(jsObject) else { return nil } self.init(unsafelyWrapping: jsObject) diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md index 83a1d9f4c..498e6c077 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md @@ -15,22 +15,22 @@ import JavaScriptKit @JS class TextProcessor { private var transform: (String) -> String - + @JS init(transform: @escaping (String) -> String) { self.transform = transform } - + @JS func processWithPerson(_ person: Person, formatter: (Person) -> String) -> String { return formatter(person) } - + @JS func makePersonCreator(defaultName: String) -> (String) -> Person { return { name in let fullName = name.isEmpty ? defaultName : name return Person(name: fullName) } } - + @JS func getTransform() -> (String) -> String { return transform } @@ -83,8 +83,8 @@ export interface TextProcessor extends SwiftHeapObject { } export type Exports = { - TextProcessor: { - new(transform: (arg0: string) => string): TextProcessor + TextProcessor: { + new(transform: (arg0: string) => string): TextProcessor }; } ``` @@ -111,4 +111,4 @@ Both directions use automatic memory management - no manual cleanup required. ## See Also -- - Complete list of supported types across BridgeJS +- diff --git a/Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift b/Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift index cfdd7b418..baeb29847 100644 --- a/Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift +++ b/Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift @@ -49,6 +49,8 @@ public class JSOneshotClosure: JSObject, JSClosureProtocol { /// - Parameters: /// - priority: The priority of the new unstructured Task created under the hood. /// - body: The Swift function to call asynchronously. + /// - file: The file identifier where the function is defined. + /// - line: The line number where the function is defined. @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) public static func async( priority: TaskPriority? = nil, @@ -65,6 +67,8 @@ public class JSOneshotClosure: JSObject, JSClosureProtocol { /// - taskExecutor: The executor preference of the new unstructured Task created under the hood. /// - priority: The priority of the new unstructured Task created under the hood. /// - body: The Swift function to call asynchronously. + /// - file: The file identifier where the function is defined. + /// - line: The line number where the function is defined. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) public static func async( executorPreference taskExecutor: (any TaskExecutor)? = nil, @@ -171,6 +175,8 @@ public class JSClosure: JSObject, JSClosureProtocol { /// - Parameters: /// - priority: The priority of the new unstructured Task created under the hood. /// - body: The Swift function to call asynchronously. + /// - file: The file identifier where the function is defined. + /// - line: The line number where the function is defined. @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) public static func async( priority: TaskPriority? = nil, @@ -187,6 +193,8 @@ public class JSClosure: JSObject, JSClosureProtocol { /// - taskExecutor: The executor preference of the new unstructured Task created under the hood. /// - priority: The priority of the new unstructured Task created under the hood. /// - body: The Swift function to call asynchronously. + /// - file: The file identifier where the function is defined. + /// - line: The line number where the function is defined. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) public static func async( executorPreference taskExecutor: (any TaskExecutor)? = nil, diff --git a/Sources/JavaScriptKit/FundamentalObjects/JSObject.swift b/Sources/JavaScriptKit/FundamentalObjects/JSObject.swift index f6a14cfb0..238b88055 100644 --- a/Sources/JavaScriptKit/FundamentalObjects/JSObject.swift +++ b/Sources/JavaScriptKit/FundamentalObjects/JSObject.swift @@ -174,7 +174,7 @@ public class JSObject: Equatable, ExpressibleByDictionaryLiteral { } /// Access the `symbol` member dynamically through JavaScript and Swift runtime bridge library. - /// - Parameter symbol: The name of this object's member to access. + /// - Parameter name: The name of this object's member to access. /// - Returns: The value of the `name` member of this object. public subscript(_ name: JSSymbol) -> JSValue { get { diff --git a/Sources/JavaScriptKit/JSValueDecoder.swift b/Sources/JavaScriptKit/JSValueDecoder.swift index 08e29915c..054c6c8da 100644 --- a/Sources/JavaScriptKit/JSValueDecoder.swift +++ b/Sources/JavaScriptKit/JSValueDecoder.swift @@ -243,6 +243,7 @@ public class JSValueDecoder { /// /// - Parameter T: The type of the value to decode. /// - Parameter value: The `JSValue` to decode from. + /// - Parameter userInfo: Additional information to pass to the decoder. public func decode( _: T.Type = T.self, from value: JSValue, From 4de8df387c70d28d37c4e7200808e0d86d17ea7a Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 28 Nov 2025 13:30:57 +0000 Subject: [PATCH 043/252] Documentation: Add debugging and profiling articles --- .../Documentation.docc/Articles/Debugging.md | 59 ++++++++++++++++++ .../Articles/Deploying-Pages.md | 2 +- .../JavaScript-Environment-Requirements.md | 2 + .../Articles/Profiling-Memory-Usage.md | 37 +++++++++++ .../Articles/Profiling-Performance-Issues.md | 51 +++++++++++++++ .../Resources/chrome-devtools-perf.png | Bin 0 -> 252150 bytes .../Resources/chrome-devtools-swift.png | Bin 0 -> 391140 bytes .../Articles/Resources/chrome-devtools.png | Bin 0 -> 924899 bytes .../Documentation.docc/Documentation.md | 3 + 9 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/Debugging.md create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/Profiling-Memory-Usage.md create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/Profiling-Performance-Issues.md create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/Resources/chrome-devtools-perf.png create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/Resources/chrome-devtools-swift.png create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/Resources/chrome-devtools.png diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/Debugging.md b/Sources/JavaScriptKit/Documentation.docc/Articles/Debugging.md new file mode 100644 index 000000000..f766be2ed --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/Debugging.md @@ -0,0 +1,59 @@ +# Debugging + +Debug your Swift applications running on JavaScript environment using DWARF-based debugging tools, including Chrome DevTools extensions and command-line debuggers. + +## Overview + +These debugging tools are DWARF-based, so you need to build your application with DWARF sections enabled. + +Build your application with debug configuration using: + +```bash +swift package --swift-sdk $SWIFT_SDK_ID js -c debug +``` + +Alternatively, you can omit the `-c debug` flag since the `js` plugin builds with debug configuration by default: + +```bash +swift package --swift-sdk $SWIFT_SDK_ID js +``` + +## Chrome DevTools + +When debugging a web browser application, Chrome DevTools provides a powerful debugging environment. It allows you to set breakpoints and step through your Swift source code at the source level. + +There are two DWARF extensions available for Chrome DevTools: an enhanced extension specifically designed for Swift, and the official C/C++ extension. For Swift development, the enhanced extension is recommended. + +> Important: The two extensions cannot coexist. You must use only one extension at a time. + +### Enhanced DWARF Extension for Swift + +For the best Swift debugging experience, use the enhanced DWARF extension that provides: + +- Breakpoint setting and Swift code inspection +- Human-readable call stack frames +- Swift variable value inspection + +![Chrome DevTools with Swift support](chrome-devtools-swift.png) + +To install this enhanced extension: + +1. If you have the official "C/C++ DevTools Support (DWARF)" extension installed, uninstall it first +2. Download the extension ZIP file from [GitHub Releases](https://github.com/GoodNotes/devtools-frontend/releases/tag/swift-0.2.3.0) +3. Go to `chrome://extensions/` and enable "Developer mode" +4. Drag and drop the downloaded ZIP file into the page + +When you close and reopen the DevTools window, DevTools will suggest reloading itself to apply settings. + +> Note: There is a known issue where some JavaScriptKit types like `JSObject` and `JSValue` are not shown in pretty format in the variables view. + +### Official DWARF Extension + +Alternatively, you can use the official [`C/C++ DevTools Support (DWARF)`](https://goo.gle/wasm-debugging-extension) extension. However, it has limitations for Swift development: + +- Function names in the stack trace are mangled (you can demangle them using `swift demangle` command) +- Variable inspection is unavailable since Swift depends on its own mechanisms instead of DWARF's structure type feature + +![Chrome DevTools](chrome-devtools.png) + +See [the DevTools team's official introduction](https://developer.chrome.com/blog/wasm-debugging-2020) for more details about the extension. diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/Deploying-Pages.md b/Sources/JavaScriptKit/Documentation.docc/Articles/Deploying-Pages.md index 96789f206..1de371e40 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/Deploying-Pages.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/Deploying-Pages.md @@ -11,7 +11,7 @@ Once you've built your application with JavaScriptKit, you'll need to deploy it Build your application using [Vite](https://vite.dev/) build tool: ```bash -# Build the Swift package for WebAssembly +# Build the Swift package for WebAssembly with release configuration $ swift package --swift-sdk wasm32-unknown-wasi js -c release # Create a minimal HTML file (if you don't have one) diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/JavaScript-Environment-Requirements.md b/Sources/JavaScriptKit/Documentation.docc/Articles/JavaScript-Environment-Requirements.md index 6483e4ca6..f0672085d 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/JavaScript-Environment-Requirements.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/JavaScript-Environment-Requirements.md @@ -1,5 +1,7 @@ # JavaScript Environment Requirements +Understand the JavaScript features required by JavaScriptKit and ensure your target environment supports them. + ## Required JavaScript Features The JavaScript package produced by the JavaScriptKit packaging plugin requires the following JavaScript features: diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/Profiling-Memory-Usage.md b/Sources/JavaScriptKit/Documentation.docc/Articles/Profiling-Memory-Usage.md new file mode 100644 index 000000000..bf14824b4 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/Profiling-Memory-Usage.md @@ -0,0 +1,37 @@ +# Profiling Memory Usage + +Profile memory usage of your Swift applications running on JavaScript environment to identify memory leaks and understand memory allocation patterns. + +## Overview + +Memory profiling helps you understand how your application uses memory, identify memory leaks, and optimize memory allocation patterns. This guide covers tools and techniques for profiling memory usage in Swift applications running on JavaScript environment. + +When profiling memory usage, start with JavaScript execution environment's heap profiler. If `WebAssembly.Memory` objects are the bottleneck, use specialized WebAssembly memory profilers that understand the Wasm instance's memory allocator. + +## Chrome DevTools Heap Snapshots + +Start by using Chrome DevTools' built-in heap profiler to understand overall memory usage in your application. See [Chrome DevTools documentation on heap snapshots](https://developer.chrome.com/docs/devtools/memory-problems/heap-snapshots) for detailed instructions. + +## wasm-memprof + +If `WebAssembly.Memory` objects are the bottleneck, JavaScript engine's default profiler typically doesn't track allocations within WebAssembly's memory space, so you won't get good insights. In such cases, use a profiler like [wasm-memprof](https://github.com/kateinoigakukun/wasm-memprof) that understands the Wasm instance's memory allocator. + +wasm-memprof is a heap profiler specifically designed for WebAssembly applications. It provides detailed memory allocation tracking with Swift symbol demangling support, helping you identify memory leaks and understand memory usage patterns within WebAssembly's linear memory. + +![wasm-memprof visualization](https://raw.githubusercontent.com/kateinoigakukun/wasm-memprof/main/docs/demo.png) + +### Setup + +Add wasm-memprof to your application before instantiating your Wasm program: + +```javascript +import { WMProf } from "wasm-memprof"; +import { SwiftDemangler } from "wasm-memprof/plugins/swift-demangler.js"; + +const swiftDemangler = SwiftDemangler.create(); +globalThis.WebAssembly = WMProf.wrap(globalThis.WebAssembly, { + demangler: swiftDemangler.demangle.bind(swiftDemangler), +}); +``` + +Check the [wasm-memprof repository](https://github.com/kateinoigakukun/wasm-memprof) for detailed documentation and examples. diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/Profiling-Performance-Issues.md b/Sources/JavaScriptKit/Documentation.docc/Articles/Profiling-Performance-Issues.md new file mode 100644 index 000000000..77ad013e1 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/Profiling-Performance-Issues.md @@ -0,0 +1,51 @@ +# Profiling Performance Issues + +Profile your Swift applications running on JavaScript environment to identify performance bottlenecks using Chrome DevTools and other profiling tools. + +## Overview + +Profiling helps you understand where your application spends time. This guide covers tools and techniques for profiling Swift applications running on JavaScript environment, focusing on performance profiling. For memory profiling, see . + +## Chrome DevTools Performance Tab + +Chrome DevTools provides a built-in Performance profiler that can help you identify performance bottlenecks in your WebAssembly application. See [Chrome DevTools documentation on performance profiling](https://developer.chrome.com/docs/devtools/performance) for detailed instructions. + +![Chrome DevTools Performance Tab](chrome-devtools-perf.png) + +> Note: WebAssembly function names may appear mangled in the performance timeline. You can use `swift demangle` to decode them, or use the enhanced DWARF extension mentioned in for better symbol resolution. + +### V8 Compilation Pipeline Considerations + +When DevTools is open, V8's WebAssembly compilation pipeline behaves differently: + +- **With DevTools open**: V8 replaces optimized TurboFan code with unoptimized Liftoff code for debugging purposes. This means performance measurements taken while DevTools is open will not reflect actual production performance. + +- **With Performance tab recording**: When you click the "Record" button in the Performance tab, code gets recompiled with TurboFan again for profiling. However, the initial tier-down to Liftoff when DevTools opens can still affect measurements. + +> Important: Do not measure FPS or performance metrics while DevTools is open, as the results will not be representative of actual production performance. Close DevTools before taking performance measurements, or use the Performance tab's recording feature which recompiles code appropriately for profiling. + +See [V8's WebAssembly compilation pipeline documentation](https://v8.dev/docs/wasm-compilation-pipeline#debugging) for more details. + +## Performance Best Practices + +### Build Configuration + +For profiling, use a release build with debug information. You have two options: + +**DWARF mode** (recommended for easier symbol resolution): + +```bash +swift package --swift-sdk $SWIFT_SDK_ID js -c release --debug-info-format dwarf +``` + +DWARF mode preserves DWARF structures, which may disable some wasm-opt optimizations. This can result in performance characteristics that differ from actual release builds. However, the DevTools extension can automatically demangle function names, making results easier to read. + +**Name section mode** (recommended for accurate performance characteristics): + +```bash +swift package --swift-sdk $SWIFT_SDK_ID js -c release --debug-info-format name +``` + +Name section mode uses WebAssembly's [name section](https://webassembly.github.io/spec/core/appendix/custom.html#name-section) and applies the same optimizations as regular release builds, providing more accurate performance characteristics. However, you'll need to manually demangle function names using `swift demangle` when analyzing results. + +> Note: The limitation of name section mode requiring manual demangling may be alleviated in the future through improvements to the DevTools extension. diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/Resources/chrome-devtools-perf.png b/Sources/JavaScriptKit/Documentation.docc/Articles/Resources/chrome-devtools-perf.png new file mode 100644 index 0000000000000000000000000000000000000000..c26898a100d0f1238df69be53ae5b564058eb5cc GIT binary patch literal 252150 zcmZ_01yr27);~N90}MVmMF(i{BE@}hDeh9-i@TKK*5WNt3dP-_cyTXoMT@(;>o@0~ zbM8Iw{oilade$RJc9NZBXUi}1L0M566O9B7003ah%1EdJ03av;0Nep1!@rpP)}jFb z5Dcuv#g%2n#i7d14i?t7<^TYFoLg+=YoIZ4Pdbyha%OlaG71$5uz0OH5&Wu(o(${t zV8)7IIS21ZOk)IuEHJbuaa$=ine@3;!4s4XEm=1uNKdZpYC`U%w}@~WCHB$T=_wGA zDulfgCBv3q)54DLd+O4MYeO6fVuV3)b@h}NW_$`SucscJDXARo6wh?>Jw6Y2I=RyLwx)0z-l01M%dq3(v{(DSOaVWhNq^5yY#pY++=oPiCtJ^0)+S z>c+;D{Bn-;snD=?f2k%cJVp!1i$v(@*ZZkfhnWjS86p?ZYkk&KlrqLPtL8n0ePAbg z+X15*^TyWqz`d#~6VLuf=zrXS!}i$6vo6(ghEhT&XI)>wq&{ z(_CBDLO}t*2!93x5W=hhAovpk{33y00082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d00001 diff --git a/Sources/JavaScriptKit/Documentation.docc/Documentation.md b/Sources/JavaScriptKit/Documentation.docc/Documentation.md index 13a6a3215..47937ad43 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Documentation.md +++ b/Sources/JavaScriptKit/Documentation.docc/Documentation.md @@ -53,6 +53,9 @@ Check out the [examples](https://github.com/swiftwasm/JavaScriptKit/tree/main/Ex - - +- +- +- ### BridgeJS From ee4d43145b96802fd12634364c80fa015609f877 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 28 Nov 2025 13:31:52 +0000 Subject: [PATCH 044/252] Clarify fatalError message for unsupported platforms in WebWorkerTaskExecutor --- Sources/JavaScriptEventLoop/WebWorkerTaskExecutor.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/JavaScriptEventLoop/WebWorkerTaskExecutor.swift b/Sources/JavaScriptEventLoop/WebWorkerTaskExecutor.swift index 1d98f4e26..b827ad980 100644 --- a/Sources/JavaScriptEventLoop/WebWorkerTaskExecutor.swift +++ b/Sources/JavaScriptEventLoop/WebWorkerTaskExecutor.swift @@ -451,7 +451,7 @@ public final class WebWorkerTaskExecutor: TaskExecutor { swjs_listen_message_from_worker_thread(tid) } #else - fatalError("Unsupported platform") + fatalError("Unsupported platform. WebWorkerTaskExecutor requires Swift SDK for wasip1-threads target.") #endif } From 4b327dc40d3931c2236ed43c6b47325c17c88afe Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 28 Nov 2025 13:59:30 +0000 Subject: [PATCH 045/252] Documentation: Add Testing article --- .../Articles/Resources/coverage-support.png | Bin 0 -> 902617 bytes .../Documentation.docc/Articles/Testing.md | 185 ++++++++++++++++++ .../Documentation.docc/Documentation.md | 1 + 3 files changed, 186 insertions(+) create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/Resources/coverage-support.png create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/Testing.md diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/Resources/coverage-support.png b/Sources/JavaScriptKit/Documentation.docc/Articles/Resources/coverage-support.png new file mode 100644 index 0000000000000000000000000000000000000000..3ddd9fcb8801d283ff7e2c4256e8a61934b2a1f7 GIT binary patch literal 902617 zcmb4r2Ut^EvoNSK7II_xO9TC4YOp-GFtgER7%R!7Us-^ZKP_37sf!qbEl<>PZNbF zno~tuemiCY3-DydyPDL{?-tiWt*v4 zf|w&mQS8Xaw4RSJ>qaL7s+21tm4xW2y?{N}+bna!HYSO7($*2e?eQibtpi+os_kp# z#H$7?w*-)vjy6|kn{R(=xS43+Ff-;Ox|;VrX_ULqnEqP12=0~;Hm0+$#nZP3k+(*T zr_M3-bW+yqp`7!Q^cPGBglfr}Dk@^I0N2(~z9g$k_YG)&!dzX;QA<%l$k^7J%7{abXz@;_R@fnq?wUv#7kgEvIk0*qH>xx3x^92hpoLCC%2%WASV}y z69i%ho?v%yvvGXp%5LL8`?HZh+mV7g7~7k_a5T5Ip}J`InUSrNqX-SnMMrB;nWk39O zFpc54r+@=ICVuhkKYqMd!3KIL=PNoBDN@1U>i)ufi^t(l z;<&LWvuRebO)y)Nmhgki*i;t<|NJ2yK}4mcVFF>tM=QN#fo_-xgkC(WGII4YwO;1A z7^&j~tC;SiX&$kZFc0eg-p)m(@Vl2W5!(_m+*dSSs%SSik}|ycaa;NFRU!^Vm&$du zYbclW-rKyl(4Pfp_y2i{f6X0R@6s!%@3Bp6T*_7Km_w52`5zT<3&g$OATD$F61{a` zDTgpH{21?l9hi#ARcsj1q$a{o8)!wFcj5;l#Kq}+TA?H#R-#eILvX3akrhYTmqjSVosQm(}<3zevKL^{K); zFW7i5cK*7?OAF}L)q$BGM8OSsDV7IYwt)H^2k(3-7dFW}@k>$z%=T3PB*2p>FdwKKxR!@%`5^!&Y~hJyw1Zju zDEE;Yyb>yfGR(1;aCfG!O9$7{{8u@+D7fPUwD5iBQJ#N9QVvtz)irjcP+QTaA*ZI?YOMNR(@hHU3ldU&y6RZ0fYs}1Eu@m!rt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w>rcP-S1-0 zvMn7wP!N$hEJEb_3GdE`fs}b?<{%LXy&r!SM6;mZXt0Jro%H?1!({drq}49ka5KjQ zC1JB;Q-GTW5z_s^f!YR%F5_95wEmxcbIh!@yLfTH{)f$lc`sG!HW5h1DyIrFPo}KhYsLEd9F& zSL4L>Vl722d`5LYttwbwy*k+c6KLUqLoGab0J7&oCy#~A8GRoFN$Fupm*FBoPS^?h zuxD#X6Q`V9zb5eXc{F)44SZ%3`@72%=~fM8Yg^Nio4J-)!OO^!k(OW&N3YLyY;;J) zwXc^IJ&NAq(y5@#viaHIz8@fA=zVPJRt1CkE9zX;{Gun4tSiy1J}>+ zb%kQLv3D!Gy?#N3VQUE>{TYyA42UKBWZHmWZ3#R2!uHjuuly~ck(cZ#eS*0|A_WoN z7$c(Z>(Cm5NB2!~d}?gwFme`U%FXcnxfnniF?!W-+}SHRmqj4nW~?HVG%%5=q}Rl2 zC&DHc9>;AhtNSVL~OWA0xMiM%Q*4vqP6OyYC3M;2KXd{SK3>;bf>-^>l2Hw-_02lmT(HS8M&++On`9|;wdJy`QG{fzV(_qzrK z-1V%LQHyPd^;f94&U?`F`t(Fui4IFD<6!KCwgoofN?aFUnbA&WVdaetbo=QQ+vH)9 zoTQYsv0dPKgcLv)*f}+1e?Jz~X|QFlVSk&-40dC20BG%shsEYpRh341qz_$usGNNSjJ_>Ax+q{p)*FQV!8_b?Uz9_4J=1 zNG{LLU)_d_tf}bsGKT;6J^vSV`k&Vu9Kj5hcG(Bt;IeUq?!x!OvDDHIVB#03O4OvP zhE`ux4LPNGs+{8=eO||Mmj?$AW|Zy` Note: See the [Testing example](https://github.com/swiftwasm/JavaScriptKit/tree/main/Examples/Testing) for a complete working example. + +## Setting Up Tests + +### Package Configuration + +Your `Package.swift` should have a test target with a dependency on your library target. Here's a simple example: + +```swift +// swift-tools-version: 6.2 + +import PackageDescription + +let package = Package( + name: "Example", + products: [ + .library(name: "Example", targets: ["Example"]), + ], + dependencies: [ + .package(url: "https://github.com/swiftwasm/JavaScriptKit.git", branch: "main") + ], + targets: [ + .target( + name: "Example", + dependencies: [ + .product(name: "JavaScriptKit", package: "JavaScriptKit") + ] + ), + .testTarget( + name: "ExampleTests", + dependencies: [ + "Example", + .product(name: "JavaScriptEventLoopTestSupport", package: "JavaScriptKit"), + ] + ), + ] +) +``` + +> Important: Include `JavaScriptEventLoopTestSupport` in your test target dependencies. This is required to run tests in the JavaScript event loop environment. + +### Writing Tests + +Create your test files in the `Tests/ExampleTests` directory. JavaScriptKit supports both XCTest and swift-testing. Write your tests using either framework as you would for standard Swift projects. + +## Running Tests + +### Basic Test Execution + +Run your tests using the `js test` subcommand: + +```bash +swift package --disable-sandbox --swift-sdk $SWIFT_SDK_ID js test +``` + +> Important: The `--disable-sandbox` flag is required because the test runner needs to execute npm and Playwright to run tests in JavaScript environments. + +This command will: +1. Build your test target as WebAssembly +2. Package the tests with the necessary JavaScript runtime +3. Execute the tests in Node.js by default + +The test binary is produced as `PackageTests.wasm` (where `Package` is your package name) and is located in `.build/plugins/PackageToJS/outputs/PackageTests/`. + +### Test Environment Options + +**Run tests in Node.js (default):** + +```bash +swift package --disable-sandbox --swift-sdk $SWIFT_SDK_ID js test --environment node +``` + +**Run tests in a browser:** + +```bash +swift package --disable-sandbox --swift-sdk $SWIFT_SDK_ID js test --environment browser +``` + +When running tests in the browser, the command will launch a browser instance using Playwright and execute the tests there. + +### Other Test Options + +**Build tests without running them:** + +```bash +swift package --disable-sandbox --swift-sdk $SWIFT_SDK_ID js test --build-only +``` + +After building, you can run the tests manually: + +```bash +node .build/plugins/PackageToJS/outputs/PackageTests/bin/test.js +``` + +**List available tests:** + +```bash +swift package --disable-sandbox --swift-sdk $SWIFT_SDK_ID js test --list-tests +``` + +**Filter tests by name:** + +```bash +swift package --disable-sandbox --swift-sdk $SWIFT_SDK_ID js test --filter "testTrivial" +``` + +**Enable inspector for browser tests:** + +```bash +swift package --disable-sandbox --swift-sdk $SWIFT_SDK_ID js test --environment browser --inspect +``` + +This starts a local server without automatically running tests. You can manually open `http://localhost:3000/test.browser.html` in your browser to run the tests and use the browser's DevTools for debugging. + +## Code Coverage + +To generate code coverage reports: + +1. **Run tests with code coverage enabled:** + +```bash +swift package --disable-sandbox --swift-sdk $SWIFT_SDK_ID js test --enable-code-coverage +``` + +2. **Generate HTML coverage report:** + +```bash +llvm-cov show -instr-profile=.build/plugins/PackageToJS/outputs/PackageTests/default.profdata \ + --format=html .build/plugins/PackageToJS/outputs/PackageTests/main.wasm \ + -o .build/coverage/html Sources +``` + +3. **View the coverage report:** + +```bash +npx serve .build/coverage/html +``` + +![Code coverage report](coverage-support.png) + +## Customizing Test Execution + +You can customize the test harness by importing the generated test function and calling it with custom options: + +```javascript +// run-tests-custom.mjs +import { testBrowser } from "./.build/plugins/PackageToJS/outputs/PackageTests/test.js"; + +async function runTest(args) { + const exitCode = await testBrowser({ + args: args, + playwright: { + browser: "chromium", + launchOptions: { + headless: false, + } + } + }); + if (exitCode !== 0) { + process.exit(exitCode); + } +} + +// Run XCTest test suites +await runTest([]); + +// Run Swift Testing test suites +await runTest(["--testing-library", "swift-testing"]); + +process.exit(0); +``` + +Then run your custom test script: + +```bash +node run-tests-custom.mjs +``` diff --git a/Sources/JavaScriptKit/Documentation.docc/Documentation.md b/Sources/JavaScriptKit/Documentation.docc/Documentation.md index 47937ad43..d506c3867 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Documentation.md +++ b/Sources/JavaScriptKit/Documentation.docc/Documentation.md @@ -53,6 +53,7 @@ Check out the [examples](https://github.com/swiftwasm/JavaScriptKit/tree/main/Ex - - +- - - - From 15974c72250981e55bef095ee6586fde71675853 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 28 Nov 2025 15:19:27 +0100 Subject: [PATCH 046/252] BridgeJS: Snapshot for LIFO order issue in Swift glue code for stack-based types --- .../Inputs/EnumAssociatedValue.swift | 29 ++++-------- .../EnumAssociatedValue.Export.d.ts | 1 + .../EnumAssociatedValue.Export.js | 27 +++++++++++ .../ExportSwiftTests/EnumAssociatedValue.json | 46 +++++++++++++++++++ .../EnumAssociatedValue.swift | 11 +++++ 5 files changed, 93 insertions(+), 21 deletions(-) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumAssociatedValue.swift index e099ba85b..43344ddd1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumAssociatedValue.swift @@ -10,12 +10,8 @@ enum APIResult { @JS func handle(result: APIResult) @JS func getResult() -> APIResult -@JS func roundtripAPIResult(result: APIResult) -> APIResult { - return result -} -@JS func roundTripOptionalAPIResult(result: APIResult?) -> APIResult? { - return result -} +@JS func roundtripAPIResult(result: APIResult) -> APIResult +@JS func roundTripOptionalAPIResult(result: APIResult?) -> APIResult? @JS enum ComplexResult { @@ -29,12 +25,8 @@ enum ComplexResult { @JS func handleComplex(result: ComplexResult) @JS func getComplexResult() -> ComplexResult -@JS func roundtripComplexResult(_ result: ComplexResult) -> ComplexResult { - return result -} -@JS func roundTripOptionalComplexResult(result: ComplexResult?) -> ComplexResult? { - return result -} +@JS func roundtripComplexResult(_ result: ComplexResult) -> ComplexResult +@JS func roundTripOptionalComplexResult(result: ComplexResult?) -> ComplexResult? @JS enum Utilities { @@ -45,9 +37,7 @@ enum Utilities { } } -@JS func roundTripOptionalUtilitiesResult(result: Utilities.Result?) -> Utilities.Result? { - return result -} +@JS func roundTripOptionalUtilitiesResult(result: Utilities.Result?) -> Utilities.Result? @JS(namespace: "API") @JS enum NetworkingResult { @@ -55,9 +45,7 @@ enum Utilities { case failure(String, Int) } -@JS func roundTripOptionalNetworkingResult(result: NetworkingResult?) -> NetworkingResult? { - return result -} +@JS func roundTripOptionalNetworkingResult(result: NetworkingResult?) -> NetworkingResult? @JS enum APIOptionalResult { @@ -65,6 +53,5 @@ enum APIOptionalResult { case failure(Int?, Bool?) case status(Bool?, Int?, String?) } -@JS func roundTripOptionalAPIOptionalResult(result: APIOptionalResult?) -> APIOptionalResult? { - return result -} +@JS func roundTripOptionalAPIOptionalResult(result: APIOptionalResult?) -> APIOptionalResult? +@JS func compareAPIResults(result1: APIOptionalResult?, result2: APIOptionalResult?) -> APIOptionalResult? diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts index 9df9bbea3..20962c388 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts @@ -86,6 +86,7 @@ export type Exports = { roundTripOptionalUtilitiesResult(result: Utilities.ResultTag | null): Utilities.ResultTag | null; roundTripOptionalNetworkingResult(result: API.NetworkingResultTag | null): API.NetworkingResultTag | null; roundTripOptionalAPIOptionalResult(result: APIOptionalResultTag | null): APIOptionalResultTag | null; + compareAPIResults(result1: APIOptionalResultTag | null, result2: APIOptionalResultTag | null): APIOptionalResultTag | null; APIResult: APIResultObject ComplexResult: ComplexResultObject APIOptionalResult: APIOptionalResultObject diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index c332a403e..e484b72c0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -814,6 +814,33 @@ export async function createInstantiator(options, swift) { if (resultCleanup) { resultCleanup(); } return optResult; }, + compareAPIResults: function bjs_compareAPIResults(result1, result2) { + const isSome = result1 != null; + let result1CaseId, result1Cleanup; + if (isSome) { + const enumResult = enumHelpers.APIOptionalResult.lower(result1); + result1CaseId = enumResult.caseId; + result1Cleanup = enumResult.cleanup; + } + const isSome1 = result2 != null; + let result2CaseId, result2Cleanup; + if (isSome1) { + const enumResult1 = enumHelpers.APIOptionalResult.lower(result2); + result2CaseId = enumResult1.caseId; + result2Cleanup = enumResult1.cleanup; + } + instance.exports.bjs_compareAPIResults(+isSome, isSome ? result1CaseId : 0, +isSome1, isSome1 ? result2CaseId : 0); + const isNull = (tmpRetTag === -1); + let optResult; + if (isNull) { + optResult = null; + } else { + optResult = enumHelpers.APIOptionalResult.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + } + if (result1Cleanup) { result1Cleanup(); } + if (result2Cleanup) { result2Cleanup(); } + return optResult; + }, APIResult: APIResultValues, ComplexResult: ComplexResultValues, APIOptionalResult: APIOptionalResultValues, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json index 52279ce0d..fb7271b91 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json @@ -787,6 +787,52 @@ } } } + }, + { + "abiName" : "bjs_compareAPIResults", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "compareAPIResults", + "parameters" : [ + { + "label" : "result1", + "name" : "result1", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + } + } + } + }, + { + "label" : "result2", + "name" : "result2", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + } + } + } } ], "moduleName" : "TestModule", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift index 0c70fe5cc..2f7ad81d1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift @@ -606,4 +606,15 @@ public func _bjs_roundTripOptionalAPIOptionalResult(resultIsSome: Int32, resultC #else fatalError("Only available on WebAssembly") #endif +} + +@_expose(wasm, "bjs_compareAPIResults") +@_cdecl("bjs_compareAPIResults") +public func _bjs_compareAPIResults(result1IsSome: Int32, result1CaseId: Int32, result2IsSome: Int32, result2CaseId: Int32) -> Void { + #if arch(wasm32) + let ret = compareAPIResults(result1: Optional.bridgeJSLiftParameter(result1IsSome, result1CaseId), result2: Optional.bridgeJSLiftParameter(result2IsSome, result2CaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif } \ No newline at end of file From e68dcfbf7548409c23708d6366219851f3d5faf2 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 28 Nov 2025 15:21:26 +0100 Subject: [PATCH 047/252] BridgeJS: Fix issue with multiple stack-based parameters that require reversed order and intermediate properties --- .../Sources/BridgeJSCore/ExportSwift.swift | 25 +++++++++++ .../Inputs/EnumAssociatedValue.swift | 2 +- .../EnumAssociatedValue.swift | 4 +- .../BridgeJSRuntimeTests/ExportAPITests.swift | 26 ++++++++++++ .../Generated/BridgeJS.ExportSwift.swift | 13 ++++++ .../JavaScript/BridgeJS.ExportSwift.json | 42 +++++++++++++++++++ Tests/prelude.mjs | 9 ++++ 7 files changed, 119 insertions(+), 2 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index d4ea770a3..ebcf7d4c5 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1667,6 +1667,7 @@ public class ExportSwift { } func call(name: String, returnType: BridgeType) { + generateParameterLifting() let item = renderCallStatement(callee: "\(raw: name)", returnType: returnType) append(item) } @@ -1694,6 +1695,7 @@ public class ExportSwift { func callMethod(klassName: String, methodName: String, returnType: BridgeType) { let (_, selfExpr) = removeFirstLiftedParameter() + generateParameterLifting() let item = renderCallStatement( callee: "\(raw: selfExpr).\(raw: methodName)", returnType: returnType @@ -1827,6 +1829,29 @@ public class ExportSwift { func returnSignature() -> String { return abiReturnType?.swiftType ?? "Void" } + + /// Generates intermediate variables for stack-using parameters if needed for LIFO compatibility + private func generateParameterLifting() { + let stackParamIndices = parameters.enumerated().compactMap { index, param -> Int? in + switch param.type { + case .optional(.associatedValueEnum): + return index + default: + return nil + } + } + + guard stackParamIndices.count > 1 else { return } + + for index in stackParamIndices.reversed() { + let param = parameters[index] + let expr = liftedParameterExprs[index] + let varName = "_tmp_\(param.name)" + + append("let \(raw: varName) = \(expr)") + liftedParameterExprs[index] = ExprSyntax(DeclReferenceExprSyntax(baseName: .identifier(varName))) + } + } } private struct ClosureCodegen { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumAssociatedValue.swift index 43344ddd1..efb6cd1b1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumAssociatedValue.swift @@ -45,7 +45,7 @@ enum Utilities { case failure(String, Int) } -@JS func roundTripOptionalNetworkingResult(result: NetworkingResult?) -> NetworkingResult? +@JS func roundTripOptionalNetworkingResult(result: NetworkingResult?) -> NetworkingResult? @JS enum APIOptionalResult { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift index 2f7ad81d1..bcc95ef4c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift @@ -612,7 +612,9 @@ public func _bjs_roundTripOptionalAPIOptionalResult(resultIsSome: Int32, resultC @_cdecl("bjs_compareAPIResults") public func _bjs_compareAPIResults(result1IsSome: Int32, result1CaseId: Int32, result2IsSome: Int32, result2CaseId: Int32) -> Void { #if arch(wasm32) - let ret = compareAPIResults(result1: Optional.bridgeJSLiftParameter(result1IsSome, result1CaseId), result2: Optional.bridgeJSLiftParameter(result2IsSome, result2CaseId)) + let _tmp_result2 = Optional.bridgeJSLiftParameter(result2IsSome, result2CaseId) + let _tmp_result1 = Optional.bridgeJSLiftParameter(result1IsSome, result1CaseId) + let ret = compareAPIResults(result1: _tmp_result1, result2: _tmp_result2) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index ff3d9dbed..682e11853 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -528,6 +528,32 @@ typealias OptionalAge = Int? return value } +@JS func compareAPIResults(_ r1: APIResult?, _ r2: APIResult?) -> String { + let r1Str: String + switch r1 { + case .none: r1Str = "nil" + case .some(.success(let msg)): r1Str = "success:\(msg)" + case .some(.failure(let code)): r1Str = "failure:\(code)" + case .some(.info): r1Str = "info" + case .some(.flag(let b)): r1Str = "flag:\(b)" + case .some(.rate(let r)): r1Str = "rate:\(r)" + case .some(.precise(let p)): r1Str = "precise:\(p)" + } + + let r2Str: String + switch r2 { + case .none: r2Str = "nil" + case .some(.success(let msg)): r2Str = "success:\(msg)" + case .some(.failure(let code)): r2Str = "failure:\(code)" + case .some(.info): r2Str = "info" + case .some(.flag(let b)): r2Str = "flag:\(b)" + case .some(.rate(let r)): r2Str = "rate:\(r)" + case .some(.precise(let p)): r2Str = "precise:\(p)" + } + + return "r1:\(r1Str),r2:\(r2Str)" +} + @JS func roundTripOptionalComplexResult(_ result: ComplexResult?) -> ComplexResult? { return result } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index 9923eedd5..bfb102192 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -3079,6 +3079,19 @@ public func _bjs_roundTripOptionalAPIResult(valueIsSome: Int32, valueCaseId: Int #endif } +@_expose(wasm, "bjs_compareAPIResults") +@_cdecl("bjs_compareAPIResults") +public func _bjs_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 = compareAPIResults(_: _tmp_r1, _: _tmp_r2) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_roundTripOptionalComplexResult") @_cdecl("bjs_roundTripOptionalComplexResult") public func _bjs_roundTripOptionalComplexResult(resultIsSome: Int32, resultCaseId: Int32) -> Void { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index 75964debb..50a9236ee 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -6826,6 +6826,48 @@ } } }, + { + "abiName" : "bjs_compareAPIResults", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "compareAPIResults", + "parameters" : [ + { + "label" : "_", + "name" : "r1", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "label" : "_", + "name" : "r2", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, { "abiName" : "bjs_roundTripOptionalComplexResult", "effects" : { diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index cfd898b31..04fa3abdf 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -571,6 +571,15 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.deepEqual(exports.roundTripOptionalAPIResult(p1), p1); assert.deepEqual(exports.roundTripOptionalComplexResult(cl1), cl1); + const apiSuccess = { tag: exports.APIResult.Tag.Success, param0: "test success" }; + const apiFailure = { tag: exports.APIResult.Tag.Failure, param0: 404 }; + const apiInfo = { tag: exports.APIResult.Tag.Info }; + + assert.equal(exports.compareAPIResults(apiSuccess, apiFailure), "r1:success:test success,r2:failure:404"); + assert.equal(exports.compareAPIResults(null, apiInfo), "r1:nil,r2:info"); + assert.equal(exports.compareAPIResults(apiFailure, null), "r1:failure:404,r2:nil"); + assert.equal(exports.compareAPIResults(null, null), "r1:nil,r2:nil"); + const optionalGreeter = new exports.Greeter("Schrödinger"); const optionalGreeter2 = exports.roundTripOptionalClass(optionalGreeter); assert.equal(optionalGreeter2?.greet() ?? "", "Hello, Schrödinger!"); From 68923541af3397f6b8464dfc5cc82b64aab3b2a4 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 29 Nov 2025 15:53:27 +0900 Subject: [PATCH 048/252] Add Node.js example (#473) * PackageToJS: Make some options optional in option setup functions * Examples: Add NodeJS example * Documentation: Add Package output structure article * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Revert browser.d.ts API change --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Examples/NodeJS/.gitignore | 8 + Examples/NodeJS/Package.swift | 15 ++ Examples/NodeJS/README.md | 9 + Examples/NodeJS/Sources/NodeJS/NodeJS.swift | 12 ++ Examples/NodeJS/main.mjs | 18 ++ .../Templates/platforms/browser.d.ts | 2 +- .../Templates/platforms/browser.js | 2 +- .../PackageToJS/Templates/platforms/node.d.ts | 4 +- .../PackageToJS/Templates/platforms/node.js | 4 +- .../Articles/Package-Output-Structure.md | 155 ++++++++++++++++++ .../Documentation.docc/Documentation.md | 1 + 11 files changed, 224 insertions(+), 6 deletions(-) create mode 100644 Examples/NodeJS/.gitignore create mode 100644 Examples/NodeJS/Package.swift create mode 100644 Examples/NodeJS/README.md create mode 100644 Examples/NodeJS/Sources/NodeJS/NodeJS.swift create mode 100644 Examples/NodeJS/main.mjs create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/Package-Output-Structure.md diff --git a/Examples/NodeJS/.gitignore b/Examples/NodeJS/.gitignore new file mode 100644 index 000000000..0023a5340 --- /dev/null +++ b/Examples/NodeJS/.gitignore @@ -0,0 +1,8 @@ +.DS_Store +/.build +/Packages +xcuserdata/ +DerivedData/ +.swiftpm/configuration/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc diff --git a/Examples/NodeJS/Package.swift b/Examples/NodeJS/Package.swift new file mode 100644 index 000000000..83a84fc8e --- /dev/null +++ b/Examples/NodeJS/Package.swift @@ -0,0 +1,15 @@ +// swift-tools-version: 6.2 + +import PackageDescription + +let package = Package( + name: "NodeJS", + dependencies: [.package(name: "JavaScriptKit", path: "../../")], + targets: [ + .executableTarget( + name: "NodeJS", + dependencies: ["JavaScriptKit"] + ) + ], + swiftLanguageModes: [.v6] +) diff --git a/Examples/NodeJS/README.md b/Examples/NodeJS/README.md new file mode 100644 index 000000000..2b4e03218 --- /dev/null +++ b/Examples/NodeJS/README.md @@ -0,0 +1,9 @@ +# Node.js example + +This example demonstrates how to use JavaScriptKit with Node.js. It shows how to export Swift functions to JavaScript and run them in a Node.js environment. + +```sh +$ swift package --swift-sdk $SWIFT_SDK_ID js +$ node main.mjs +``` + diff --git a/Examples/NodeJS/Sources/NodeJS/NodeJS.swift b/Examples/NodeJS/Sources/NodeJS/NodeJS.swift new file mode 100644 index 000000000..deebc1bd8 --- /dev/null +++ b/Examples/NodeJS/Sources/NodeJS/NodeJS.swift @@ -0,0 +1,12 @@ +import JavaScriptKit + +@main +struct NodeJS { + static func main() { + JSObject.global["greet"] = + JSClosure { args in + let nameString = args[0].string! + return .string("Hello, \(nameString) from NodeJS!") + }.jsValue + } +} diff --git a/Examples/NodeJS/main.mjs b/Examples/NodeJS/main.mjs new file mode 100644 index 000000000..5aca7d0a7 --- /dev/null +++ b/Examples/NodeJS/main.mjs @@ -0,0 +1,18 @@ +// @ts-check + +import { instantiate } from "./.build/plugins/PackageToJS/outputs/Package/instantiate.js" +import { defaultNodeSetup } from "./.build/plugins/PackageToJS/outputs/Package/platforms/node.js" + +async function main() { + // Create a default Node.js option object + const options = await defaultNodeSetup(); + // Instantiate the Swift code, executing + // NodeJS.main() in NodeJS.swift + await instantiate(options); + + // Call the greet function set by NodeJS.swift + const greet = globalThis.greet; + console.log(greet("World")); +} + +main() diff --git a/Plugins/PackageToJS/Templates/platforms/browser.d.ts b/Plugins/PackageToJS/Templates/platforms/browser.d.ts index babe3f487..dcfb5f617 100644 --- a/Plugins/PackageToJS/Templates/platforms/browser.d.ts +++ b/Plugins/PackageToJS/Templates/platforms/browser.d.ts @@ -11,7 +11,7 @@ export function defaultBrowserSetup(options: { getImports: () => Imports, /* #endif */ /* #if USE_SHARED_MEMORY */ - spawnWorker: (module: WebAssembly.Module, memory: WebAssembly.Memory, startArg: any) => Worker, + spawnWorker?: (module: WebAssembly.Module, memory: WebAssembly.Memory, startArg: any) => Worker, /* #endif */ }): Promise diff --git a/Plugins/PackageToJS/Templates/platforms/browser.js b/Plugins/PackageToJS/Templates/platforms/browser.js index 3fce7c556..d471e8415 100644 --- a/Plugins/PackageToJS/Templates/platforms/browser.js +++ b/Plugins/PackageToJS/Templates/platforms/browser.js @@ -118,7 +118,7 @@ export async function defaultBrowserSetup(options) { /* #endif */ /* #if USE_SHARED_MEMORY */ const memory = new WebAssembly.Memory(MEMORY_TYPE); - const threadChannel = new DefaultBrowserThreadRegistry(options.spawnWorker) + const threadChannel = new DefaultBrowserThreadRegistry(options.spawnWorker || createDefaultWorkerFactory()) /* #endif */ return { diff --git a/Plugins/PackageToJS/Templates/platforms/node.d.ts b/Plugins/PackageToJS/Templates/platforms/node.d.ts index ca0e826c4..4b8d95843 100644 --- a/Plugins/PackageToJS/Templates/platforms/node.d.ts +++ b/Plugins/PackageToJS/Templates/platforms/node.d.ts @@ -7,10 +7,10 @@ export type DefaultNodeSetupOptions = { /* #endif */ onExit?: (code: number) => void, /* #if USE_SHARED_MEMORY */ - spawnWorker: (module: WebAssembly.Module, memory: WebAssembly.Memory, startArg: any) => Worker, + spawnWorker?: (module: WebAssembly.Module, memory: WebAssembly.Memory, startArg: any) => Worker, /* #endif */ } -export function defaultNodeSetup(options: DefaultNodeSetupOptions): Promise +export function defaultNodeSetup(options?: DefaultNodeSetupOptions): Promise export function createDefaultWorkerFactory(preludeScript?: string): (module: WebAssembly.Module, memory: WebAssembly.Memory, startArg: any) => Worker diff --git a/Plugins/PackageToJS/Templates/platforms/node.js b/Plugins/PackageToJS/Templates/platforms/node.js index 2fc0e8d15..3e1253965 100644 --- a/Plugins/PackageToJS/Templates/platforms/node.js +++ b/Plugins/PackageToJS/Templates/platforms/node.js @@ -113,7 +113,7 @@ class DefaultNodeThreadRegistry { /* #endif */ /** @type {import('./node.d.ts').defaultNodeSetup} */ -export async function defaultNodeSetup(options) { +export async function defaultNodeSetup(options = {}) { const path = await import("node:path"); const { fileURLToPath } = await import("node:url"); const { readFile } = await import("node:fs/promises") @@ -134,7 +134,7 @@ export async function defaultNodeSetup(options) { const module = await WebAssembly.compile(new Uint8Array(await readFile(path.join(pkgDir, MODULE_PATH)))) /* #if USE_SHARED_MEMORY */ const memory = new WebAssembly.Memory(MEMORY_TYPE); - const threadChannel = new DefaultNodeThreadRegistry(options.spawnWorker) + const threadChannel = new DefaultNodeThreadRegistry(options.spawnWorker || createDefaultWorkerFactory()) /* #endif */ return { diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/Package-Output-Structure.md b/Sources/JavaScriptKit/Documentation.docc/Articles/Package-Output-Structure.md new file mode 100644 index 000000000..af9b0d2bd --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/Package-Output-Structure.md @@ -0,0 +1,155 @@ +# Package Output Structure + +Understand the structure and contents of the JavaScript package generated by the `swift package js` command. + +## Overview + +When you run `swift package --swift-sdk $SWIFT_SDK_ID js`, the PackageToJS plugin compiles your Swift code to WebAssembly and generates a JavaScript package in `.build/plugins/PackageToJS/outputs/Package/`. This package contains all the necessary files to run your Swift application in JavaScript environments (browser or Node.js). + +## Package Structure + +The output package has the following structure: + +``` +.build/plugins/PackageToJS/outputs/Package/ +├── ProductName.wasm # Compiled WebAssembly module +├── index.js # Main entry point for browser environments +├── index.d.ts # TypeScript type definitions for index.js +├── instantiate.js # Low-level instantiation API +├── instantiate.d.ts # TypeScript type definitions for instantiate.js +├── package.json # npm package metadata +└── platforms/ + ├── browser.js # Browser-specific platform setup + ├── browser.d.ts # TypeScript definitions for browser.js + ├── node.js # Node.js-specific platform setup + └── node.d.ts # TypeScript definitions for node.js +``` + +## Using the Package + +### In Browser + +```html + + + + + + +``` + +### In Node.js + +```javascript +import { instantiate } from './.build/plugins/PackageToJS/outputs/Package/instantiate.js'; +import { defaultNodeSetup } from './.build/plugins/PackageToJS/outputs/Package/platforms/node.js'; + +async function main() { + const options = await defaultNodeSetup(); + await instantiate(options); +} + +main(); +``` + +> Tip: For a complete Node.js setup example, see the [Node.js example](https://github.com/swiftwasm/JavaScriptKit/tree/main/Examples/NodeJS). + +### With Bundlers (Vite, Webpack, etc.) + +The generated package can be consumed by JavaScript bundlers: + +```bash +npm install .build/plugins/PackageToJS/outputs/Package +``` + +Then import it in your JavaScript code: + +```javascript +import { init } from 'package-name'; +await init(); +``` + +## Core Files + +### WebAssembly Module (`ProductName.wasm`) + +The compiled WebAssembly binary containing your Swift code. The filename matches your SwiftPM product name (e.g., `Basic.wasm` for a product named "Basic"). + +### Entry Point (`index.js`) + +The main entry point for browser environments. It provides a convenient `init()` function that handles module instantiation with default settings. + +```javascript +import { init } from './.build/plugins/PackageToJS/outputs/Package/index.js'; + +// Initialize with default browser setup +await init(); +``` + +For packages with BridgeJS imports, you can provide custom imports: + +```javascript +import { init } from './.build/plugins/PackageToJS/outputs/Package/index.js'; + +await init({ + getImports: () => ({ + // Your custom imports + }) +}); +``` + +### Instantiation API (`instantiate.js`) + +A lower-level API for more control over module instantiation. Use this when you need to customize the WebAssembly instantiation process or WASI setup. + +```javascript +import { instantiate } from './.build/plugins/PackageToJS/outputs/Package/instantiate.js'; +import { defaultBrowserSetup } from './.build/plugins/PackageToJS/outputs/Package/platforms/browser.js'; + +const options = await defaultBrowserSetup({ + module: fetch('./ProductName.wasm'), + // ... other options +}); + +const { instance, swift, exports } = await instantiate(options); +``` + +### Platform-Specific Setup + +The `platforms/` directory contains platform-specific setup functions: +- `platforms/browser.js` - Provides `defaultBrowserSetup()` for browser environments +- `platforms/node.js` - Provides `defaultNodeSetup()` for Node.js environments + +## Package Metadata (`package.json`) + +The generated `package.json` includes: + +```json +{ + "name": "package-name", + "version": "0.0.0", + "type": "module", + "private": true, + "exports": { + ".": "./index.js", + "./wasm": "./ProductName.wasm" + }, + "dependencies": { + "@bjorn3/browser_wasi_shim": "0.3.0" + } +} +``` + +The `exports` field allows importing the package as an npm dependency: + +```javascript +import { init } from '.build/plugins/PackageToJS/outputs/Package'; +``` + +## TypeScript Support + +All JavaScript files have corresponding `.d.ts` TypeScript definition files, providing full type safety when using the package in TypeScript projects. + diff --git a/Sources/JavaScriptKit/Documentation.docc/Documentation.md b/Sources/JavaScriptKit/Documentation.docc/Documentation.md index d506c3867..60808a894 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Documentation.md +++ b/Sources/JavaScriptKit/Documentation.docc/Documentation.md @@ -51,6 +51,7 @@ Check out the [examples](https://github.com/swiftwasm/JavaScriptKit/tree/main/Ex ### Articles +- - - - From 9511ee2f34ae7026def6c7a120c51067d54994a2 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 29 Nov 2025 23:00:24 +0900 Subject: [PATCH 049/252] Update README --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 2f41b7a31..c18cc1ccf 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,3 @@ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for details on ## Sponsoring [Become a gold or platinum sponsor](https://github.com/sponsors/swiftwasm/) and contact maintainers to add your logo on our README on Github with a link to your site. - - - - From 631e25eeeee93fa11167ed3f2fca930b5d7e6786 Mon Sep 17 00:00:00 2001 From: scottmarchant <15382220+scottmarchant@users.noreply.github.com> Date: Mon, 1 Dec 2025 18:41:23 -0700 Subject: [PATCH 050/252] build: Allow swift-syntax 6.2.0 (#474) --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index ddf2e36ef..670b43500 100644 --- a/Package.swift +++ b/Package.swift @@ -37,7 +37,7 @@ let package = Package( .plugin(name: "BridgeJSCommandPlugin", targets: ["BridgeJSCommandPlugin"]), ], dependencies: [ - .package(url: "https://github.com/swiftlang/swift-syntax", "600.0.0"..<"602.0.0") + .package(url: "https://github.com/swiftlang/swift-syntax", "600.0.0"..<"603.0.0") ], targets: [ .target( From fe5aa6c7c373636ae2cbcd39817e89ec14358e80 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Wed, 10 Dec 2025 05:35:12 +0000 Subject: [PATCH 051/252] workflows/test.yml: update `main` snapshots, add 6.3 snapshot (#476) --- .github/workflows/test.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 487b008e2..b79d911ab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,14 +19,19 @@ jobs: download-url: https://download.swift.org/swift-6.1-release/ubuntu2204/swift-6.1-RELEASE/swift-6.1-RELEASE-ubuntu22.04.tar.gz wasi-backend: Node target: "wasm32-unknown-wasi" - - os: ubuntu-22.04 + - os: ubuntu-24.04 + toolchain: + download-url: https://download.swift.org/development/ubuntu2404/swift-DEVELOPMENT-SNAPSHOT-2025-12-01-a/swift-DEVELOPMENT-SNAPSHOT-2025-12-01-a-ubuntu24.04.tar.gz + wasi-backend: Node + target: "wasm32-unknown-wasip1" + - os: ubuntu-24.04 toolchain: - download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a-ubuntu22.04.tar.gz + download-url: https://download.swift.org/swift-6.3-branch/ubuntu2404/swift-6.3-DEVELOPMENT-SNAPSHOT-2025-12-05-a/swift-6.3-DEVELOPMENT-SNAPSHOT-2025-12-05-a-ubuntu24.04.tar.gz wasi-backend: Node target: "wasm32-unknown-wasip1" - os: ubuntu-22.04 toolchain: - download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a-ubuntu22.04.tar.gz + download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-12-01-a/swift-DEVELOPMENT-SNAPSHOT-2025-12-01-a-ubuntu22.04.tar.gz wasi-backend: Node target: "wasm32-unknown-wasip1-threads" From 9b2a6b1ddeaa9d68217a3d764935f0a244cff2e9 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Sat, 20 Dec 2025 11:19:48 +0700 Subject: [PATCH 052/252] BridgeJS: Swift struct support (#479) --- .../JavaScript/BridgeJS.ExportSwift.json | 3 + .../JavaScript/BridgeJS.ExportSwift.json | 3 + .../Sources/BridgeJSCore/ExportSwift.swift | 714 +++++++++++--- .../Sources/BridgeJSCore/ImportTS.swift | 14 + .../Sources/BridgeJSLink/BridgeJSLink.swift | 488 +++++---- .../Sources/BridgeJSLink/JSGlueGen.swift | 922 ++++++++++++++++++ .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 56 +- .../Inputs/SwiftStruct.swift | 44 + .../ArrayParameter.Import.js | 8 + .../BridgeJSLinkTests/Async.Export.js | 8 + .../BridgeJSLinkTests/Async.Import.js | 8 + .../DefaultParameters.Export.js | 8 + .../EnumAssociatedValue.Export.js | 8 + .../BridgeJSLinkTests/EnumCase.Export.js | 8 + .../BridgeJSLinkTests/EnumNamespace.Export.js | 8 + .../EnumNamespace.Global.Export.js | 8 + .../BridgeJSLinkTests/EnumRawType.Export.js | 8 + .../BridgeJSLinkTests/Interface.Import.js | 8 + .../InvalidPropertyNames.Import.js | 8 + .../BridgeJSLinkTests/MixedGlobal.Export.js | 8 + .../BridgeJSLinkTests/MixedModules.Export.js | 8 + .../BridgeJSLinkTests/MixedPrivate.Export.js | 8 + .../MultipleImportedTypes.Import.js | 8 + .../BridgeJSLinkTests/Namespaces.Export.js | 8 + .../Namespaces.Global.Export.js | 8 + .../BridgeJSLinkTests/Optionals.Export.js | 8 + .../PrimitiveParameters.Export.js | 8 + .../PrimitiveParameters.Import.js | 8 + .../PrimitiveReturn.Export.js | 8 + .../PrimitiveReturn.Import.js | 8 + .../BridgeJSLinkTests/PropertyTypes.Export.js | 8 + .../BridgeJSLinkTests/Protocol.Export.js | 8 + .../StaticFunctions.Export.js | 8 + .../StaticFunctions.Global.Export.js | 8 + .../StaticProperties.Export.js | 8 + .../StaticProperties.Global.Export.js | 8 + .../StringParameter.Export.js | 8 + .../StringParameter.Import.js | 8 + .../BridgeJSLinkTests/StringReturn.Export.js | 8 + .../BridgeJSLinkTests/StringReturn.Import.js | 8 + .../BridgeJSLinkTests/SwiftClass.Export.js | 8 + .../BridgeJSLinkTests/SwiftClosure.Export.js | 8 + .../BridgeJSLinkTests/SwiftStruct.Export.d.ts | 66 ++ .../BridgeJSLinkTests/SwiftStruct.Export.js | 499 ++++++++++ .../TS2SkeletonLike.Import.js | 8 + .../BridgeJSLinkTests/Throws.Export.js | 8 + .../BridgeJSLinkTests/TypeAlias.Import.js | 8 + .../TypeScriptClass.Import.js | 8 + .../VoidParameterVoidReturn.Export.js | 8 + .../VoidParameterVoidReturn.Import.js | 8 + .../__Snapshots__/ExportSwiftTests/Async.json | 3 + .../ExportSwiftTests/DefaultParameters.json | 3 + .../ExportSwiftTests/EnumAssociatedValue.json | 3 + .../ExportSwiftTests/EnumCase.json | 3 + .../EnumNamespace.Global.json | 3 + .../ExportSwiftTests/EnumNamespace.json | 3 + .../ExportSwiftTests/EnumRawType.json | 3 + .../ExportSwiftTests/MixedGlobal.json | 3 + .../ExportSwiftTests/MixedPrivate.json | 3 + .../ExportSwiftTests/Namespaces.Global.json | 3 + .../ExportSwiftTests/Namespaces.json | 3 + .../ExportSwiftTests/Optionals.json | 3 + .../ExportSwiftTests/PrimitiveParameters.json | 3 + .../ExportSwiftTests/PrimitiveReturn.json | 3 + .../ExportSwiftTests/PropertyTypes.json | 3 + .../ExportSwiftTests/Protocol.json | 3 + .../StaticFunctions.Global.json | 3 + .../ExportSwiftTests/StaticFunctions.json | 3 + .../StaticProperties.Global.json | 3 + .../ExportSwiftTests/StaticProperties.json | 3 + .../ExportSwiftTests/StringParameter.json | 3 + .../ExportSwiftTests/StringReturn.json | 3 + .../ExportSwiftTests/SwiftClass.json | 3 + .../ExportSwiftTests/SwiftClosure.json | 3 + .../ExportSwiftTests/SwiftStruct.json | 448 +++++++++ .../ExportSwiftTests/SwiftStruct.swift | 273 ++++++ .../ExportSwiftTests/Throws.json | 3 + .../VoidParameterVoidReturn.json | 3 + .../JavaScriptKit/BridgeJSInstrincics.swift | 51 + .../BridgeJS/Exporting-Swift-to-JavaScript.md | 1 + .../Exporting-Swift/Exporting-Swift-Struct.md | 180 ++++ .../JavaScript/BridgeJS.ExportSwift.json | 3 + .../BridgeJSRuntimeTests/ExportAPITests.swift | 122 +++ .../Generated/BridgeJS.ExportSwift.swift | 461 +++++++++ .../JavaScript/BridgeJS.ExportSwift.json | 859 ++++++++++++++++ Tests/prelude.mjs | 95 ++ 86 files changed, 5351 insertions(+), 349 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftStruct.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json index 9094df267..5ba46ff61 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -726,5 +726,8 @@ "moduleName" : "Benchmarks", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json index f48970689..a536a23fc 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -142,5 +142,8 @@ "moduleName" : "PlayBridgeJS", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index ebcf7d4c5..436e264d0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -24,6 +24,7 @@ public class ExportSwift { private var exportedFunctions: [ExportedFunction] = [] private var exportedClasses: [ExportedClass] = [] private var exportedEnums: [ExportedEnum] = [] + private var exportedStructs: [ExportedStruct] = [] private var exportedProtocols: [ExportedProtocol] = [] private var exportedProtocolNameByKey: [String: String] = [:] private var typeDeclResolver: TypeDeclResolver = TypeDeclResolver() @@ -71,6 +72,7 @@ public class ExportSwift { functions: exportedFunctions, classes: exportedClasses, enums: exportedEnums, + structs: exportedStructs, protocols: exportedProtocols, exposeToGlobal: exposeToGlobal ) @@ -88,6 +90,9 @@ public class ExportSwift { /// The names of the exported protocols, in the order they were written in the source file var exportedProtocolNames: [String] = [] var exportedProtocolByName: [String: ExportedProtocol] = [:] + /// The names of the exported structs, in the order they were written in the source file + var exportedStructNames: [String] = [] + var exportedStructByName: [String: ExportedStruct] = [:] var errors: [DiagnosticError] = [] /// Creates a unique key by combining name and namespace @@ -132,6 +137,7 @@ public class ExportSwift { case classBody(name: String, key: String) case enumBody(name: String, key: String) case protocolBody(name: String, key: String) + case structBody(name: String, key: String) } struct StateStack { @@ -516,6 +522,14 @@ public class ExportSwift { case .protocolBody(_, _): // Protocol methods are handled in visitProtocolMethod during protocol parsing return .skipChildren + case .structBody(let structName, let structKey): + if let exportedFunction = visitFunction(node: node, isStatic: isStatic, structName: structName) { + if var currentStruct = exportedStructByName[structKey] { + currentStruct.methods.append(exportedFunction) + exportedStructByName[structKey] = currentStruct + } + } + return .skipChildren } } @@ -524,7 +538,8 @@ public class ExportSwift { isStatic: Bool, className: String? = nil, classKey: String? = nil, - enumName: String? = nil + enumName: String? = nil, + structName: String? = nil ) -> ExportedFunction? { guard let jsAttribute = node.attributes.firstJSAttribute else { return nil @@ -600,12 +615,21 @@ public class ExportSwift { staticContext = isNamespaceEnum ? .namespaceEnum : .enumName(enumName) case .protocolBody(_, _): return nil + case .structBody(let structName, _): + if isStatic { + staticContext = .structName(structName) + } else { + staticContext = nil + } } let classNameForABI: String? - if case .classBody(let className, _) = state { + switch state { + case .classBody(let className, _): classNameForABI = className - } else { + case .structBody(let structName, _): + classNameForABI = structName + default: classNameForABI = nil } abiName = ABINameGenerator.generateABIName( @@ -691,37 +715,59 @@ public class ExportSwift { override func visit(_ node: InitializerDeclSyntax) -> SyntaxVisitorContinueKind { guard let jsAttribute = node.attributes.firstJSAttribute else { return .skipChildren } - guard case .classBody(let className, _) = state else { - if case .enumBody(_, _) = state { - diagnose(node: node, message: "Initializers are not supported inside enums") - } else { - diagnose(node: node, message: "@JS init must be inside a @JS class") + + switch state { + case .classBody(let className, let classKey): + if extractNamespace(from: jsAttribute) != nil { + diagnose( + node: jsAttribute, + message: "Namespace is not supported for initializer declarations", + hint: "Remove the namespace from @JS attribute" + ) } - return .skipChildren - } - if extractNamespace(from: jsAttribute) != nil { - diagnose( - node: jsAttribute, - message: "Namespace is not supported for initializer declarations", - hint: "Remove the namespace from @JS attribute" + let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: true) + + guard let effects = collectEffects(signature: node.signature) else { + return .skipChildren + } + + let constructor = ExportedConstructor( + abiName: "bjs_\(className)_init", + parameters: parameters, + effects: effects ) - } + exportedClassByName[classKey]?.constructor = constructor - let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: true) + case .structBody(let structName, let structKey): + if extractNamespace(from: jsAttribute) != nil { + diagnose( + node: jsAttribute, + message: "Namespace is not supported for initializer declarations", + hint: "Remove the namespace from @JS attribute" + ) + } - guard let effects = collectEffects(signature: node.signature) else { - return .skipChildren - } + let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: true) - let constructor = ExportedConstructor( - abiName: "bjs_\(className)_init", - parameters: parameters, - effects: effects - ) - if case .classBody(_, let classKey) = state { - exportedClassByName[classKey]?.constructor = constructor + guard let effects = collectEffects(signature: node.signature) else { + return .skipChildren + } + + let constructor = ExportedConstructor( + abiName: "bjs_\(structName)_init", + parameters: parameters, + effects: effects + ) + exportedStructByName[structKey]?.constructor = constructor + + case .enumBody(_, _): + diagnose(node: node, message: "Initializers are not supported inside enums") + + case .topLevel, .protocolBody(_, _): + diagnose(node: node, message: "@JS init must be inside a @JS class or struct") } + return .skipChildren } @@ -753,27 +799,29 @@ public class ExportSwift { // Determine static context and validate placement let staticContext: StaticContext? - let classKey: String switch state { - case .classBody(let className, let key): - classKey = key + case .classBody(let className, _): staticContext = isStatic ? .className(className) : nil case .enumBody(let enumName, let enumKey): if !isStatic { diagnose(node: node, message: "Only static properties are supported in enums") return .skipChildren } - classKey = enumKey - let isNamespaceEnum = exportedEnumByName[enumKey]?.cases.isEmpty ?? true staticContext = isStatic ? (isNamespaceEnum ? .namespaceEnum : .enumName(enumName)) : nil - case .topLevel: diagnose(node: node, message: "@JS var must be inside a @JS class or enum") return .skipChildren case .protocolBody(let protocolName, let protocolKey): return visitProtocolProperty(node: node, protocolName: protocolName, protocolKey: protocolKey) + case .structBody(let structName, _): + if isStatic { + staticContext = .structName(structName) + } else { + diagnose(node: node, message: "@JS var must be static in structs (instance fields don't need @JS)") + return .skipChildren + } } // Process each binding (variable declaration) @@ -810,13 +858,15 @@ public class ExportSwift { staticContext: staticContext ) - if case .enumBody(_, let enumKey) = state { - if var currentEnum = exportedEnumByName[enumKey] { + if case .enumBody(_, let key) = state { + if var currentEnum = exportedEnumByName[key] { currentEnum.staticProperties.append(exportedProperty) - exportedEnumByName[enumKey] = currentEnum + exportedEnumByName[key] = currentEnum } - } else { - exportedClassByName[classKey]?.properties.append(exportedProperty) + } else if case .structBody(_, let key) = state { + exportedStructByName[key]?.properties.append(exportedProperty) + } else if case .classBody(_, let key) = state { + exportedClassByName[key]?.properties.append(exportedProperty) } } @@ -937,7 +987,6 @@ public class ExportSwift { let emitStyle = exportedEnum.emitStyle if case .tsEnum = emitStyle { - // Check for Bool raw type limitation if exportedEnum.rawType == .bool { diagnose( node: jsAttribute, @@ -945,8 +994,6 @@ public class ExportSwift { hint: "Use enumStyle: .const or change the raw type to String or a numeric type" ) } - - // Check for static functions limitation if !exportedEnum.staticMethods.isEmpty { diagnose( node: jsAttribute, @@ -1055,6 +1102,98 @@ public class ExportSwift { return .skipChildren } + override func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind { + guard let jsAttribute = node.attributes.firstJSAttribute else { + return .skipChildren + } + + let name = node.name.text + + let namespaceResult = resolveNamespace(from: jsAttribute, for: node, declarationType: "struct") + guard namespaceResult.isValid else { + return .skipChildren + } + let swiftCallName = ExportSwift.computeSwiftCallName(for: node, itemName: name) + let explicitAccessControl = computeExplicitAtLeastInternalAccessControl( + for: node, + message: "Struct visibility must be at least internal" + ) + + var properties: [ExportedProperty] = [] + + // Process all variables in struct as readonly (value semantics) and don't require @JS + for member in node.memberBlock.members { + if let varDecl = member.decl.as(VariableDeclSyntax.self) { + let isStatic = varDecl.modifiers.contains { modifier in + modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) + } + + // Handled with error in visitVariable + if varDecl.attributes.hasJSAttribute() { + continue + } + // Skips static non-@JS properties + if isStatic { + continue + } + + for binding in varDecl.bindings { + guard let pattern = binding.pattern.as(IdentifierPatternSyntax.self) else { + continue + } + + let fieldName = pattern.identifier.text + + guard let typeAnnotation = binding.typeAnnotation else { + diagnose(node: binding, message: "Struct field must have explicit type annotation") + continue + } + + guard let fieldType = self.parent.lookupType(for: typeAnnotation.type) else { + diagnoseUnsupportedType( + node: typeAnnotation.type, + type: typeAnnotation.type.trimmedDescription + ) + continue + } + + let property = ExportedProperty( + name: fieldName, + type: fieldType, + isReadonly: true, + isStatic: false, + namespace: namespaceResult.namespace, + staticContext: nil + ) + properties.append(property) + } + } + } + + let structUniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) + let exportedStruct = ExportedStruct( + name: name, + swiftCallName: swiftCallName, + explicitAccessControl: explicitAccessControl, + properties: properties, + methods: [], + namespace: namespaceResult.namespace + ) + + exportedStructByName[structUniqueKey] = exportedStruct + exportedStructNames.append(structUniqueKey) + + stateStack.push(state: .structBody(name: name, key: structUniqueKey)) + + return .visitChildren + } + + override func visitPost(_ node: StructDeclSyntax) { + if case .structBody(_, _) = stateStack.current { + stateStack.pop() + } + } + private func visitProtocolMethod( node: FunctionDeclSyntax, protocolName: String, @@ -1314,6 +1453,11 @@ public class ExportSwift { collector.exportedProtocolByName[$0]! } ) + exportedStructs.append( + contentsOf: collector.exportedStructNames.map { + collector.exportedStructByName[$0]! + } + ) return collector.errors } @@ -1463,6 +1607,11 @@ public class ExportSwift { } } + if let structDecl = typeDecl.as(StructDeclSyntax.self) { + let swiftCallName = ExportSwift.computeSwiftCallName(for: structDecl, itemName: structDecl.name.text) + return .swiftStruct(swiftCallName) + } + guard typeDecl.is(ClassDeclSyntax.self) || typeDecl.is(ActorDeclSyntax.self) else { return nil } @@ -1484,7 +1633,7 @@ public class ExportSwift { var decls: [DeclSyntax] = [] guard exportedFunctions.count > 0 || exportedClasses.count > 0 || exportedEnums.count > 0 - || exportedProtocols.count > 0 + || exportedProtocols.count > 0 || exportedStructs.count > 0 else { return nil } @@ -1543,6 +1692,12 @@ public class ExportSwift { } } + let structCodegen = StructCodegen() + for structDef in exportedStructs { + decls.append(structCodegen.renderStructHelpers(structDef)) + decls.append(contentsOf: try renderSingleExportedStruct(struct: structDef)) + } + for function in exportedFunctions { decls.append(try renderSingleExportedFunction(function: function)) } @@ -1592,6 +1747,9 @@ public class ExportSwift { case .closure(let signature): typeNameForIntrinsic = param.type.swiftType liftingExpr = ExprSyntax("_BJS_Closure_\(raw: signature.mangleName).bridgeJSLift(\(raw: param.name))") + case .swiftStruct(let structName): + typeNameForIntrinsic = structName + liftingExpr = ExprSyntax("\(raw: structName).bridgeJSLiftParameter()") case .optional(let wrappedType): typeNameForIntrinsic = "Optional<\(wrappedType.swiftType)>" liftingExpr = ExprSyntax( @@ -1703,6 +1861,30 @@ public class ExportSwift { append(item) } + /// Generates intermediate variables for stack-using parameters if needed for LIFO compatibility + private func generateParameterLifting() { + let stackParamIndices = parameters.enumerated().compactMap { index, param -> Int? in + switch param.type { + case .swiftStruct, .optional(.swiftStruct), + .associatedValueEnum, .optional(.associatedValueEnum): + return index + default: + return nil + } + } + + guard stackParamIndices.count > 1 else { return } + + for index in stackParamIndices.reversed() { + let param = parameters[index] + let expr = liftedParameterExprs[index] + let varName = "_tmp_\(param.name)" + + append("let \(raw: varName) = \(expr)") + liftedParameterExprs[index] = ExprSyntax(DeclReferenceExprSyntax(baseName: .identifier(varName))) + } + } + func callPropertyGetter(klassName: String, propertyName: String, returnType: BridgeType) { let (_, selfExpr) = removeFirstLiftedParameter() if returnType == .void { @@ -1830,28 +2012,6 @@ public class ExportSwift { return abiReturnType?.swiftType ?? "Void" } - /// Generates intermediate variables for stack-using parameters if needed for LIFO compatibility - private func generateParameterLifting() { - let stackParamIndices = parameters.enumerated().compactMap { index, param -> Int? in - switch param.type { - case .optional(.associatedValueEnum): - return index - default: - return nil - } - } - - guard stackParamIndices.count > 1 else { return } - - for index in stackParamIndices.reversed() { - let param = parameters[index] - let expr = liftedParameterExprs[index] - let varName = "_tmp_\(param.name)" - - append("let \(raw: varName) = \(expr)") - liftedParameterExprs[index] = ExprSyntax(DeclReferenceExprSyntax(baseName: .identifier(varName))) - } - } } private struct ClosureCodegen { @@ -2051,7 +2211,220 @@ public class ExportSwift { } + /// Helper for stack-based lifting and lowering operations. + private struct StackCodegen { + /// Generates an expression to lift a value from the parameter stack. + /// - Parameter type: The BridgeType to lift + /// - Returns: An ExprSyntax representing the lift expression + func liftExpression(for type: BridgeType) -> ExprSyntax { + switch type { + case .string: + return "String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .int: + return "Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .bool: + return "Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .float: + return "Float.bridgeJSLiftParameter(_swift_js_pop_param_f32())" + case .double: + return "Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())" + case .jsObject: + return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .swiftHeapObject(let className): + return "\(raw: className).bridgeJSLiftParameter(_swift_js_pop_param_pointer())" + case .swiftProtocol: + // Protocols are handled via JSObject + return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .caseEnum(let enumName): + return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .rawValueEnum(let enumName, let rawType): + switch rawType { + case .string: + return + "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .bool, .int, .int32, .int64, .uint, .uint32, .uint64, .float, .double: + return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" + } + case .associatedValueEnum(let enumName): + return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .swiftStruct(let structName): + return "\(raw: structName).bridgeJSLiftParameter()" + case .optional(let wrappedType): + return liftOptionalExpression(wrappedType: wrappedType) + case .void: + // Void shouldn't be lifted, but return a placeholder + return "()" + case .namespaceEnum: + // Namespace enums are not passed as values + return "()" + case .closure: + return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + } + } + + private func liftOptionalExpression(wrappedType: BridgeType) -> ExprSyntax { + switch wrappedType { + case .string: + return + "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .int: + return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .bool: + return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .float: + return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f32())" + case .double: + return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f64())" + case .caseEnum(let enumName): + return + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .rawValueEnum(let enumName, let rawType): + switch rawType { + case .string: + return + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .bool, .int, .float, .double, .int32, .int64, .uint, .uint32, .uint64: + return + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + } + case .swiftStruct(let nestedName): + return "Optional<\(raw: nestedName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .swiftHeapObject(let className): + return + "Optional<\(raw: className)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_pointer())" + case .associatedValueEnum(let enumName): + return + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .jsObject: + return + "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + default: + // Fallback for other optional types + return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + } + } + + /// Generates statements to lower/push a value onto the stack. + /// - Parameters: + /// - type: The BridgeType to lower + /// - accessor: The expression to access the value (e.g., "self.name" or "paramName") + /// - varPrefix: A unique prefix for intermediate variables + /// - Returns: An array of CodeBlockItemSyntax representing the lowering statements + func lowerStatements( + for type: BridgeType, + accessor: String, + varPrefix: String + ) -> [CodeBlockItemSyntax] { + switch type { + case .string: + return [ + "var __bjs_\(raw: varPrefix) = \(raw: accessor)", + "__bjs_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", + ] + case .int: + return ["_swift_js_push_int(Int32(\(raw: accessor)))"] + case .bool: + return ["_swift_js_push_int(\(raw: accessor) ? 1 : 0)"] + case .float: + return ["_swift_js_push_f32(\(raw: accessor))"] + case .double: + return ["_swift_js_push_f64(\(raw: accessor))"] + case .jsObject: + return ["_swift_js_push_int(\(raw: accessor).bridgeJSLowerParameter())"] + case .swiftHeapObject: + return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] + case .swiftProtocol: + return ["_swift_js_push_int(\(raw: accessor).bridgeJSLowerParameter())"] + case .caseEnum: + return ["_swift_js_push_int(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] + case .rawValueEnum: + return ["_swift_js_push_int(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] + case .associatedValueEnum: + return ["\(raw: accessor).bridgeJSLowerReturn()"] + case .swiftStruct: + return ["\(raw: accessor).bridgeJSLowerReturn()"] + case .optional(let wrappedType): + return lowerOptionalStatements(wrappedType: wrappedType, accessor: accessor, varPrefix: varPrefix) + case .void: + return [] + case .namespaceEnum: + return [] + case .closure: + return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] + } + } + + private func lowerOptionalStatements( + wrappedType: BridgeType, + accessor: String, + varPrefix: String + ) -> [CodeBlockItemSyntax] { + var statements: [CodeBlockItemSyntax] = [] + statements.append("let __bjs_isSome_\(raw: varPrefix) = \(raw: accessor) != nil") + statements.append("if let __bjs_unwrapped_\(raw: varPrefix) = \(raw: accessor) {") + + let innerStatements = lowerUnwrappedOptionalStatements( + wrappedType: wrappedType, + unwrappedVar: "__bjs_unwrapped_\(varPrefix)", + varPrefix: varPrefix + ) + for stmt in innerStatements { + statements.append(stmt) + } + + statements.append("}") + statements.append("_swift_js_push_int(__bjs_isSome_\(raw: varPrefix) ? 1 : 0)") + return statements + } + + private func lowerUnwrappedOptionalStatements( + wrappedType: BridgeType, + unwrappedVar: String, + varPrefix: String + ) -> [CodeBlockItemSyntax] { + switch wrappedType { + case .string: + return [ + "var __bjs_str_\(raw: varPrefix) = \(raw: unwrappedVar)", + "__bjs_str_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", + ] + case .int: + return ["_swift_js_push_int(Int32(\(raw: unwrappedVar)))"] + case .bool: + return ["_swift_js_push_int(\(raw: unwrappedVar) ? 1 : 0)"] + case .float: + return ["_swift_js_push_f32(\(raw: unwrappedVar))"] + case .double: + return ["_swift_js_push_f64(\(raw: unwrappedVar))"] + case .caseEnum: + return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + return [ + "var __bjs_str_\(raw: varPrefix) = \(raw: unwrappedVar).rawValue", + "__bjs_str_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", + ] + default: + return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] + } + case .swiftStruct: + return ["\(raw: unwrappedVar).bridgeJSLowerReturn()"] + case .swiftHeapObject: + return ["_swift_js_push_pointer(\(raw: unwrappedVar).bridgeJSLowerReturn())"] + case .associatedValueEnum: + return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] + case .jsObject: + return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] + default: + return ["preconditionFailure(\"BridgeJS: unsupported optional wrapped type\")"] + } + } + } + private struct EnumCodegen { + private let stackCodegen = StackCodegen() + func renderCaseEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { let typeName = enumDef.swiftCallName var initCases: [String] = [] @@ -2138,47 +2511,14 @@ public class ExportSwift { var lines: [String] = [] lines.append("case \(caseIndex):") let argList = enumCase.associatedValues.map { associatedValue in - let paramName: String + let labelPrefix: String if let label = associatedValue.label { - paramName = "\(label): " + labelPrefix = "\(label): " } else { - paramName = "" - } - switch associatedValue.type { - case .string: - return - "\(paramName)String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .int: - return "\(paramName)Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())" - case .bool: - return "\(paramName)Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())" - case .float: - return "\(paramName)Float.bridgeJSLiftParameter(_swift_js_pop_param_f32())" - case .double: - return "\(paramName)Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())" - case .optional(let wrappedType): - switch wrappedType { - case .string: - return - "\(paramName)Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .int: - return - "\(paramName)Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .bool: - return - "\(paramName)Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .float: - return - "\(paramName)Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f32())" - case .double: - return - "\(paramName)Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f64())" - default: - return "" - } - default: - return "\(paramName)Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + labelPrefix = "" } + let liftExpr = stackCodegen.liftExpression(for: associatedValue.type) + return "\(labelPrefix)\(liftExpr)" } lines.append("return .\(enumCase.name)(\(argList.joined(separator: ", ")))") cases.append(lines.joined(separator: "\n")) @@ -2193,48 +2533,13 @@ public class ExportSwift { var bodyLines: [String] = [] for (index, associatedValue) in associatedValues.enumerated() { let paramName = associatedValue.label ?? "param\(index)" - switch associatedValue.type { - case .string: - bodyLines.append("var __bjs_\(paramName) = \(paramName)") - bodyLines.append("__bjs_\(paramName).withUTF8 { ptr in") - bodyLines.append("_swift_js_push_string(ptr.baseAddress, Int32(ptr.count))") - bodyLines.append("}") - case .int: - bodyLines.append("_swift_js_push_int(Int32(\(paramName)))") - case .bool: - bodyLines.append("_swift_js_push_int(\(paramName) ? 1 : 0)") - case .float: - bodyLines.append("_swift_js_push_f32(\(paramName))") - case .double: - bodyLines.append("_swift_js_push_f64(\(paramName))") - case .optional(let wrappedType): - bodyLines.append("let __bjs_isSome_\(paramName) = \(paramName) != nil") - bodyLines.append("if let __bjs_unwrapped_\(paramName) = \(paramName) {") - switch wrappedType { - case .string: - bodyLines.append("var __bjs_str_\(paramName) = __bjs_unwrapped_\(paramName)") - bodyLines.append("__bjs_str_\(paramName).withUTF8 { ptr in") - bodyLines.append("_swift_js_push_string(ptr.baseAddress, Int32(ptr.count))") - bodyLines.append("}") - case .int: - bodyLines.append("_swift_js_push_int(Int32(__bjs_unwrapped_\(paramName)))") - case .bool: - bodyLines.append("_swift_js_push_int(__bjs_unwrapped_\(paramName) ? 1 : 0)") - case .float: - bodyLines.append("_swift_js_push_f32(__bjs_unwrapped_\(paramName))") - case .double: - bodyLines.append("_swift_js_push_f64(__bjs_unwrapped_\(paramName))") - default: - bodyLines.append( - "preconditionFailure(\"BridgeJS: unsupported optional wrapped type in generated code\")" - ) - } - bodyLines.append("}") - bodyLines.append("_swift_js_push_int(__bjs_isSome_\(paramName) ? 1 : 0)") - default: - bodyLines.append( - "preconditionFailure(\"BridgeJS: unsupported associated value type in generated code\")" - ) + let statements = stackCodegen.lowerStatements( + for: associatedValue.type, + accessor: paramName, + varPrefix: paramName + ) + for stmt in statements { + bodyLines.append(stmt.description) } } return bodyLines @@ -2279,11 +2584,69 @@ public class ExportSwift { } } + private struct StructCodegen { + private let stackCodegen = StackCodegen() + + func renderStructHelpers(_ structDef: ExportedStruct) -> DeclSyntax { + let typeName = structDef.swiftCallName + let liftCode = generateStructLiftCode(structDef: structDef) + let lowerCode = generateStructLowerCode(structDef: structDef) + + return """ + extension \(raw: typeName): _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> \(raw: typeName) { + \(raw: liftCode.joined(separator: "\n")) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + \(raw: lowerCode.joined(separator: "\n")) + } + } + """ + } + + private func generateStructLiftCode(structDef: ExportedStruct) -> [String] { + var lines: [String] = [] + let instanceProps = structDef.properties.filter { !$0.isStatic } + + for property in instanceProps.reversed() { + let fieldName = property.name + let liftExpr = stackCodegen.liftExpression(for: property.type) + lines.append("let \(fieldName) = \(liftExpr)") + } + + let initArgs = instanceProps.map { "\($0.name): \($0.name)" }.joined(separator: ", ") + lines.append("return \(structDef.swiftCallName)(\(initArgs))") + + return lines + } + + private func generateStructLowerCode(structDef: ExportedStruct) -> [String] { + var lines: [String] = [] + let instanceProps = structDef.properties.filter { !$0.isStatic } + + for property in instanceProps { + let accessor = "self.\(property.name)" + let statements = stackCodegen.lowerStatements( + for: property.type, + accessor: accessor, + varPrefix: property.name + ) + for stmt in statements { + lines.append(stmt.description) + } + } + + return lines + } + } + /// Context for property rendering that determines call behavior and ABI generation private enum PropertyRenderingContext { case enumStatic(enumDef: ExportedEnum) case classStatic(klass: ExportedClass) case classInstance(klass: ExportedClass) + case structStatic(structDef: ExportedStruct) } /// Renders getter and setter Swift thunk code for a property in any context @@ -2309,6 +2672,10 @@ public class ExportSwift { callName = property.callName() className = klass.name isStatic = false + case .structStatic(let structDef): + callName = property.callName(prefix: structDef.swiftCallName) + className = structDef.name + isStatic = true } let getterBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false, isStatic: isStatic)) @@ -2369,7 +2736,7 @@ public class ExportSwift { if function.effects.isStatic, let staticContext = function.staticContext { let callName: String switch staticContext { - case .className(let baseName), .enumName(let baseName): + case .className(let baseName), .enumName(let baseName), .structName(let baseName): callName = "\(baseName).\(function.name)" case .namespaceEnum: if let namespace = function.namespace, !namespace.isEmpty { @@ -2387,6 +2754,57 @@ public class ExportSwift { return builder.render(abiName: function.abiName) } + func renderSingleExportedStruct(struct structDef: ExportedStruct) throws -> [DeclSyntax] { + var decls: [DeclSyntax] = [] + + if let constructor = structDef.constructor { + let builder = ExportedThunkBuilder(effects: constructor.effects) + for param in constructor.parameters { + try builder.liftParameter(param: param) + } + builder.call(name: structDef.swiftCallName, returnType: .swiftStruct(structDef.swiftCallName)) + try builder.lowerReturnValue(returnType: .swiftStruct(structDef.swiftCallName)) + decls.append(builder.render(abiName: constructor.abiName)) + } + + for property in structDef.properties where property.isStatic { + decls.append( + contentsOf: try renderSingleExportedProperty( + property: property, + context: .structStatic(structDef: structDef) + ) + ) + } + + for method in structDef.methods { + let builder = ExportedThunkBuilder(effects: method.effects) + + if method.effects.isStatic { + for param in method.parameters { + try builder.liftParameter(param: param) + } + builder.call(name: "\(structDef.swiftCallName).\(method.name)", returnType: method.returnType) + } else { + try builder.liftParameter( + param: Parameter(label: nil, name: "_self", type: .swiftStruct(structDef.swiftCallName)) + ) + for param in method.parameters { + try builder.liftParameter(param: param) + } + builder.callMethod( + klassName: structDef.swiftCallName, + methodName: method.name, + returnType: method.returnType + ) + } + + try builder.lowerReturnValue(returnType: method.returnType) + decls.append(builder.render(abiName: method.abiName)) + } + + return decls + } + /// # Example /// /// Given the following Swift code: @@ -2879,6 +3297,7 @@ extension BridgeType { case .caseEnum(let name): return name case .rawValueEnum(let name, _): return name case .associatedValueEnum(let name): return name + case .swiftStruct(let name): return name case .namespaceEnum(let name): return name case .closure(let signature): let paramTypes = signature.parameters.map { $0.swiftType }.joined(separator: ", ") @@ -2935,6 +3354,8 @@ extension BridgeType { } case .associatedValueEnum: return .associatedValueEnum + case .swiftStruct: + return LiftingIntrinsicInfo(parameters: []) case .namespaceEnum: throw BridgeJSCoreError("Namespace enums are not supported to pass as parameters") case .closure: @@ -2956,6 +3377,7 @@ extension BridgeType { static let caseEnum = LoweringIntrinsicInfo(returnType: .i32) static let rawValueEnum = LoweringIntrinsicInfo(returnType: .i32) static let associatedValueEnum = LoweringIntrinsicInfo(returnType: nil) + static let swiftStruct = LoweringIntrinsicInfo(returnType: nil) static let optional = LoweringIntrinsicInfo(returnType: nil) } @@ -2987,6 +3409,8 @@ extension BridgeType { } case .associatedValueEnum: return .associatedValueEnum + case .swiftStruct: + return .swiftStruct case .namespaceEnum: throw BridgeJSCoreError("Namespace enums are not supported to pass as parameters") case .closure: diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 00ef5399b..a3ae96abb 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -476,6 +476,13 @@ extension BridgeType { case .exportSwift: return LoweringParameterInfo(loweredParameters: [("caseId", .i32)]) } + case .swiftStruct: + switch context { + case .importTS: + throw BridgeJSCoreError("Swift structs are not yet supported in TypeScript imports") + case .exportSwift: + return LoweringParameterInfo(loweredParameters: []) + } case .namespaceEnum: throw BridgeJSCoreError("Namespace enums cannot be used as parameters") case .optional(let wrappedType): @@ -552,6 +559,13 @@ extension BridgeType { case .exportSwift: return LiftingReturnInfo(valueToLift: .i32) } + case .swiftStruct: + switch context { + case .importTS: + throw BridgeJSCoreError("Swift structs are not yet supported in TypeScript imports") + case .exportSwift: + return LiftingReturnInfo(valueToLift: nil) + } case .namespaceEnum: throw BridgeJSCoreError("Namespace enums cannot be used as return values") case .optional(let wrappedType): diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 7ecc2086f..3e815b717 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -71,8 +71,8 @@ struct BridgeJSLink { var classLines: [String] = [] var dtsExportLines: [String] = [] var dtsClassLines: [String] = [] - var topLevelEnumLines: [String] = [] - var topLevelDtsEnumLines: [String] = [] + var topLevelTypeLines: [String] = [] + var topLevelDtsTypeLines: [String] = [] var importObjectBuilders: [ImportObjectBuilder] = [] var enumStaticAssignments: [String] = [] } @@ -109,29 +109,33 @@ struct BridgeJSLink { data.dtsClassLines.append(contentsOf: dtsType) } - // Process enums - if !skeleton.enums.isEmpty { - for enumDefinition in skeleton.enums { - let (jsEnum, dtsEnum) = try renderExportedEnum(enumDefinition) + // Process enums - collect top-level definitions and export entries + var enumExportEntries: [(js: [String], dts: [String])] = [] + for enumDefinition in skeleton.enums { + let (jsTopLevel, jsExportEntry, dtsType, dtsExportEntry) = try renderExportedEnum(enumDefinition) - switch enumDefinition.enumType { - case .namespace: - break - case .simple, .rawValue: - var exportedJsEnum = jsEnum - if !exportedJsEnum.isEmpty && exportedJsEnum[0].hasPrefix("const ") { - exportedJsEnum[0] = "export " + exportedJsEnum[0] - } - data.topLevelEnumLines.append(contentsOf: exportedJsEnum) - data.topLevelDtsEnumLines.append(contentsOf: dtsEnum) - case .associatedValue: - var exportedJsEnum = jsEnum - if !exportedJsEnum.isEmpty && exportedJsEnum[0].hasPrefix("const ") { - exportedJsEnum[0] = "export " + exportedJsEnum[0] - } - data.topLevelEnumLines.append(contentsOf: exportedJsEnum) - data.topLevelDtsEnumLines.append(contentsOf: dtsEnum) + // Add top-level JS const definition + if enumDefinition.enumType != .namespace { + var exportedJsEnum = jsTopLevel + if !exportedJsEnum.isEmpty && exportedJsEnum[0].hasPrefix("const ") { + exportedJsEnum[0] = "export " + exportedJsEnum[0] } + data.topLevelTypeLines.append(contentsOf: exportedJsEnum) + data.topLevelDtsTypeLines.append(contentsOf: dtsType) + } + + if !jsExportEntry.isEmpty || !dtsExportEntry.isEmpty { + enumExportEntries.append((js: jsExportEntry, dts: dtsExportEntry)) + } + } + + var structExportEntries: [(js: [String], dts: [String])] = [] + for structDefinition in skeleton.structs { + let (jsStruct, dtsType, dtsExportEntry) = try renderExportedStruct(structDefinition) + data.topLevelDtsTypeLines.append(contentsOf: dtsType) + + if structDefinition.namespace == nil && (!jsStruct.isEmpty || !dtsExportEntry.isEmpty) { + structExportEntries.append((js: jsStruct, dts: dtsExportEntry)) } } @@ -146,107 +150,14 @@ struct BridgeJSLink { } } - for enumDefinition in skeleton.enums - where enumDefinition.enumType != .namespace && enumDefinition.emitStyle != .tsEnum { - if enumDefinition.namespace != nil { - continue - } - - let enumExportPrinter = CodeFragmentPrinter() - let enumValuesName = enumDefinition.valuesName - - for function in enumDefinition.staticMethods { - let thunkBuilder = ExportedThunkBuilder(effects: function.effects) - for param in function.parameters { - try thunkBuilder.lowerParameter(param: param) - } - let returnExpr = try thunkBuilder.call(abiName: function.abiName, returnType: function.returnType) - - let methodPrinter = CodeFragmentPrinter() - methodPrinter.write( - "\(function.name): function(\(function.parameters.map { $0.name }.joined(separator: ", "))) {" - ) - methodPrinter.indent { - methodPrinter.write(contentsOf: thunkBuilder.body) - methodPrinter.write(contentsOf: thunkBuilder.cleanupCode) - methodPrinter.write(lines: thunkBuilder.checkExceptionLines()) - if let returnExpr = returnExpr { - methodPrinter.write("return \(returnExpr);") - } - } - methodPrinter.write("},") - - enumExportPrinter.write(lines: methodPrinter.lines) - } - - let enumExportLines = enumExportPrinter.lines - - let enumPropertyPrinter = CodeFragmentPrinter() - - for property in enumDefinition.staticProperties { - let getterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) - let getterReturnExpr = try getterThunkBuilder.call( - abiName: property.getterAbiName(), - returnType: property.type - ) - - enumPropertyPrinter.write("get \(property.name)() {") - enumPropertyPrinter.indent { - enumPropertyPrinter.write(contentsOf: getterThunkBuilder.body) - enumPropertyPrinter.write(contentsOf: getterThunkBuilder.cleanupCode) - enumPropertyPrinter.write(lines: getterThunkBuilder.checkExceptionLines()) - if let returnExpr = getterReturnExpr { - enumPropertyPrinter.write("return \(returnExpr);") - } - } - enumPropertyPrinter.write("},") - - if !property.isReadonly { - let setterThunkBuilder = ExportedThunkBuilder( - effects: Effects(isAsync: false, isThrows: false) - ) - try setterThunkBuilder.lowerParameter( - param: Parameter(label: "value", name: "value", type: property.type) - ) - _ = try setterThunkBuilder.call( - abiName: property.setterAbiName(), - returnType: .void - ) - - enumPropertyPrinter.write("set \(property.name)(value) {") - enumPropertyPrinter.indent { - enumPropertyPrinter.write(contentsOf: setterThunkBuilder.body) - enumPropertyPrinter.write(contentsOf: setterThunkBuilder.cleanupCode) - enumPropertyPrinter.write(lines: setterThunkBuilder.checkExceptionLines()) - } - enumPropertyPrinter.write("},") - } - } - - let enumPropertyLines = enumPropertyPrinter.lines - - let exportsPrinter = CodeFragmentPrinter() - let dtsExportsPrinter = CodeFragmentPrinter() - - if !enumExportLines.isEmpty || !enumPropertyLines.isEmpty { - exportsPrinter.write("\(enumDefinition.name): {") - exportsPrinter.indent { - exportsPrinter.write("...\(enumValuesName),") - var allLines = enumExportLines + enumPropertyLines - if let lastLineIndex = allLines.indices.last, allLines[lastLineIndex].hasSuffix(",") { - allLines[lastLineIndex] = String(allLines[lastLineIndex].dropLast()) - } - exportsPrinter.write(lines: allLines) - } - exportsPrinter.write("},") - } else { - exportsPrinter.write("\(enumDefinition.name): \(enumValuesName),") - } - - dtsExportsPrinter.write("\(enumDefinition.name): \(enumDefinition.objectTypeName)") + for entry in enumExportEntries { + data.exportsLines.append(contentsOf: entry.js) + data.dtsExportLines.append(contentsOf: entry.dts) + } - data.exportsLines.append(contentsOf: exportsPrinter.lines) - data.dtsExportLines.append(contentsOf: dtsExportsPrinter.lines) + for entry in structExportEntries { + data.exportsLines.append(contentsOf: entry.js) + data.dtsExportLines.append(contentsOf: entry.dts) } } @@ -324,12 +235,22 @@ struct BridgeJSLink { "let \(JSGlueVariableScope.reservedTmpParamInts) = [];", "let \(JSGlueVariableScope.reservedTmpParamF32s) = [];", "let \(JSGlueVariableScope.reservedTmpParamF64s) = [];", + "let \(JSGlueVariableScope.reservedTmpRetPointers) = [];", + "let \(JSGlueVariableScope.reservedTmpParamPointers) = [];", ] + let hasStructs = exportedSkeletons.contains { skeleton in + !skeleton.structs.isEmpty + } + if hasAssociatedValueEnums { declarations.append("const enumHelpers = {};") } + if hasStructs { + declarations.append("const structHelpers = {};") + } + declarations.append("") declarations.append("let _exports = null;") declarations.append("let bjs = null;") @@ -497,6 +418,16 @@ struct BridgeJSLink { printer.write("return \(JSGlueVariableScope.reservedTmpParamF64s).pop();") } printer.write("}") + printer.write("bjs[\"swift_js_push_pointer\"] = function(pointer) {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpRetPointers).push(pointer);") + } + printer.write("}") + printer.write("bjs[\"swift_js_pop_param_pointer\"] = function() {") + printer.indent { + printer.write("return \(JSGlueVariableScope.reservedTmpParamPointers).pop();") + } + printer.write("}") printer.write("bjs[\"swift_js_return_optional_bool\"] = function(isSome, value) {") printer.indent { printer.write("if (isSome === 0) {") @@ -883,7 +814,7 @@ struct BridgeJSLink { } } - printer.write(lines: data.topLevelDtsEnumLines) + printer.write(lines: data.topLevelDtsTypeLines) // Generate Object types for const-style enums for skeleton in exportedSkeletons { @@ -1002,8 +933,7 @@ struct BridgeJSLink { let printer = CodeFragmentPrinter(header: header) printer.nextLine() - // Top-level enums section - printer.write(lines: data.topLevelEnumLines) + printer.write(lines: data.topLevelTypeLines) let topLevelNamespaceCode = namespaceBuilder.buildTopLevelNamespaceInitialization( exportedSkeletons: exportedSkeletons @@ -1015,6 +945,16 @@ struct BridgeJSLink { printer.indent { printer.write(lines: generateVariableDeclarations()) + + let allStructs = exportedSkeletons.flatMap { $0.structs } + for structDef in allStructs { + let structPrinter = CodeFragmentPrinter() + let structScope = JSGlueVariableScope() + let structCleanup = CodeFragmentPrinter() + let fragment = IntrinsicJSFragment.structHelper(structDefinition: structDef, allStructs: allStructs) + _ = fragment.printCode([structDef.name], structScope, structPrinter, structCleanup) + printer.write(lines: structPrinter.lines) + } printer.nextLine() printer.write(contentsOf: generateAddImports()) } @@ -1068,6 +1008,8 @@ struct BridgeJSLink { printer.write(lines: data.classLines) + // Struct helpers must be initialized AFTER classes are defined (to allow _exports access) + printer.write(contentsOf: structHelperAssignments()) let namespaceInitCode = namespaceBuilder.buildNamespaceInitialization( exportedSkeletons: exportedSkeletons ) @@ -1112,6 +1054,22 @@ struct BridgeJSLink { return printer } + private func structHelperAssignments() -> CodeFragmentPrinter { + let printer = CodeFragmentPrinter() + + for skeleton in exportedSkeletons { + for structDef in skeleton.structs { + printer.write( + "const \(structDef.name)Helpers = __bjs_create\(structDef.name)Helpers()(\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTmpParamPointers), \(JSGlueVariableScope.reservedTmpRetPointers), \(JSGlueVariableScope.reservedTextEncoder), \(JSGlueVariableScope.reservedSwift), enumHelpers);" + ) + printer.write("structHelpers.\(structDef.name) = \(structDef.name)Helpers;") + printer.nextLine() + } + } + + return printer + } + private func renderSwiftClassWrappers() -> [String] { var wrapperLines: [String] = [] var modulesByName: [String: [ExportedClass]] = [:] @@ -1367,6 +1325,8 @@ struct BridgeJSLink { } } return type.tsType + case .swiftStruct(let name): + return name.components(separatedBy: ".").last ?? name case .optional(let wrapped): return "\(resolveTypeScriptType(wrapped, exportedSkeletons: exportedSkeletons)) | null" default: @@ -1460,9 +1420,109 @@ struct BridgeJSLink { } } - func renderExportedEnum(_ enumDefinition: ExportedEnum) throws -> (js: [String], dts: [String]) { - var jsLines: [String] = [] - var dtsLines: [String] = [] + func renderExportedStruct( + _ structDefinition: ExportedStruct + ) throws -> (js: [String], dtsType: [String], dtsExportEntry: [String]) { + let structName = structDefinition.name + let hasConstructor = structDefinition.constructor != nil + let staticMethods = structDefinition.methods.filter { $0.effects.isStatic } + let staticProperties = structDefinition.properties.filter { $0.isStatic } + + let dtsTypePrinter = CodeFragmentPrinter() + dtsTypePrinter.write("export interface \(structName) {") + let instanceProps = structDefinition.properties.filter { !$0.isStatic } + dtsTypePrinter.indent { + for property in instanceProps { + let tsType = resolveTypeScriptType(property.type) + dtsTypePrinter.write("\(property.name): \(tsType);") + } + for method in structDefinition.methods where !method.effects.isStatic { + let signature = renderTSSignature( + parameters: method.parameters, + returnType: method.returnType, + effects: method.effects + ) + dtsTypePrinter.write("\(method.name)\(signature);") + } + } + dtsTypePrinter.write("}") + + guard hasConstructor || !staticMethods.isEmpty || !staticProperties.isEmpty else { + return (js: [], dtsType: dtsTypePrinter.lines, dtsExportEntry: []) + } + + let jsPrinter = CodeFragmentPrinter() + jsPrinter.write("\(structName): {") + try jsPrinter.indent { + // Constructor as 'init' function + if let constructor = structDefinition.constructor { + let thunkBuilder = ExportedThunkBuilder(effects: constructor.effects) + for param in constructor.parameters { + try thunkBuilder.lowerParameter(param: param) + } + let returnExpr = try thunkBuilder.call( + abiName: constructor.abiName, + returnType: .swiftStruct(structDefinition.swiftCallName) + ) + + let constructorPrinter = CodeFragmentPrinter() + let paramList = thunkBuilder.generateParameterList(parameters: constructor.parameters) + constructorPrinter.write("init: function(\(paramList)) {") + constructorPrinter.indent { + constructorPrinter.write(contentsOf: thunkBuilder.body) + constructorPrinter.write(contentsOf: thunkBuilder.cleanupCode) + constructorPrinter.write(lines: thunkBuilder.checkExceptionLines()) + if let returnExpr = returnExpr { + constructorPrinter.write("return \(returnExpr);") + } + } + constructorPrinter.write("},") + jsPrinter.write(lines: constructorPrinter.lines) + } + + for property in staticProperties { + let propertyLines = try renderStaticPropertyForExportObject( + property: property, + className: structName + ) + jsPrinter.write(lines: propertyLines) + } + + for method in staticMethods { + let methodLines = try renderStaticMethodForExportObject(method: method) + jsPrinter.write(lines: methodLines) + } + } + jsPrinter.write("},") + + let dtsExportEntryPrinter = CodeFragmentPrinter() + dtsExportEntryPrinter.write("\(structName): {") + dtsExportEntryPrinter.indent { + if let constructor = structDefinition.constructor { + dtsExportEntryPrinter.write( + "init\(renderTSSignature(parameters: constructor.parameters, returnType: .swiftStruct(structDefinition.swiftCallName), effects: constructor.effects));" + ) + } + for property in staticProperties { + let readonly = property.isReadonly ? "readonly " : "" + dtsExportEntryPrinter.write("\(readonly)\(property.name): \(resolveTypeScriptType(property.type));") + } + for method in staticMethods { + dtsExportEntryPrinter.write( + "\(method.name)\(renderTSSignature(parameters: method.parameters, returnType: method.returnType, effects: method.effects));" + ) + } + } + dtsExportEntryPrinter.write("}") + + return (js: jsPrinter.lines, dtsType: dtsTypePrinter.lines, dtsExportEntry: dtsExportEntryPrinter.lines) + } + + func renderExportedEnum( + _ enumDefinition: ExportedEnum + ) throws -> (jsTopLevel: [String], jsExportEntry: [String], dtsType: [String], dtsExportEntry: [String]) { + var jsTopLevelLines: [String] = [] + var dtsTypeLines: [String] = [] let scope = JSGlueVariableScope() let cleanup = CodeFragmentPrinter() let printer = CodeFragmentPrinter() @@ -1472,7 +1532,7 @@ struct BridgeJSLink { case .simple: let fragment = IntrinsicJSFragment.simpleEnumHelper(enumDefinition: enumDefinition) _ = fragment.printCode([enumValuesName], scope, printer, cleanup) - jsLines.append(contentsOf: printer.lines) + jsTopLevelLines.append(contentsOf: printer.lines) case .rawValue: guard enumDefinition.rawType != nil else { throw BridgeJSLinkError(message: "Raw value enum \(enumDefinition.name) is missing rawType") @@ -1480,20 +1540,63 @@ struct BridgeJSLink { let fragment = IntrinsicJSFragment.rawValueEnumHelper(enumDefinition: enumDefinition) _ = fragment.printCode([enumValuesName], scope, printer, cleanup) - jsLines.append(contentsOf: printer.lines) + jsTopLevelLines.append(contentsOf: printer.lines) case .associatedValue: let fragment = IntrinsicJSFragment.associatedValueEnumHelper(enumDefinition: enumDefinition) _ = fragment.printCode([enumValuesName], scope, printer, cleanup) - jsLines.append(contentsOf: printer.lines) + jsTopLevelLines.append(contentsOf: printer.lines) case .namespace: break } if enumDefinition.namespace == nil { - dtsLines.append(contentsOf: generateDeclarations(enumDefinition: enumDefinition)) + dtsTypeLines.append(contentsOf: generateDeclarations(enumDefinition: enumDefinition)) + } + + var jsExportEntryLines: [String] = [] + var dtsExportEntryLines: [String] = [] + + if enumDefinition.enumType != .namespace + && enumDefinition.emitStyle != .tsEnum + && enumDefinition.namespace == nil + { + var enumMethodLines: [String] = [] + for function in enumDefinition.staticMethods { + let methodLines = try renderStaticMethodForExportObject(method: function) + enumMethodLines.append(contentsOf: methodLines) + } + + var enumPropertyLines: [String] = [] + for property in enumDefinition.staticProperties { + let propertyLines = try renderStaticPropertyForExportObject( + property: property, + className: nil + ) + enumPropertyLines.append(contentsOf: propertyLines) + } + + let exportsPrinter = CodeFragmentPrinter() + + if !enumMethodLines.isEmpty || !enumPropertyLines.isEmpty { + exportsPrinter.write("\(enumDefinition.name): {") + exportsPrinter.indent { + exportsPrinter.write("...\(enumValuesName),") + var allLines = enumMethodLines + enumPropertyLines + if let lastLineIndex = allLines.indices.last, allLines[lastLineIndex].hasSuffix(",") { + allLines[lastLineIndex] = String(allLines[lastLineIndex].dropLast()) + } + exportsPrinter.write(lines: allLines) + } + exportsPrinter.write("},") + } else { + exportsPrinter.write("\(enumDefinition.name): \(enumValuesName),") + } + + jsExportEntryLines = exportsPrinter.lines + dtsExportEntryLines = ["\(enumDefinition.name): \(enumDefinition.objectTypeName)"] } - return (jsLines, dtsLines) + return (jsTopLevelLines, jsExportEntryLines, dtsTypeLines, dtsExportEntryLines) } private func generateDeclarations(enumDefinition: ExportedEnum) -> [String] { @@ -1622,8 +1725,8 @@ extension BridgeJSLink { staticContext: StaticContext ) throws -> (js: [String], dts: [String]) { switch staticContext { - case .className(let className): - return try renderClassStaticFunction(function: function, className: className) + case .className(let name), .structName(let name): + return try renderStaticFunction(function: function, className: name) case .enumName(let enumName): return try renderEnumStaticFunction(function: function, enumName: enumName) case .namespaceEnum: @@ -1635,7 +1738,7 @@ extension BridgeJSLink { } } - private func renderClassStaticFunction( + private func renderStaticFunction( function: ExportedFunction, className: String ) throws -> (js: [String], dts: [String]) { @@ -1718,67 +1821,61 @@ extension BridgeJSLink { return (funcLines, dtsLines) } - private func renderEnumStaticFunctionAssignment( - function: ExportedFunction, - enumName: String + /// Renders a static method for use in an export object + private func renderStaticMethodForExportObject( + method: ExportedFunction ) throws -> [String] { - let thunkBuilder = ExportedThunkBuilder(effects: function.effects) - for param in function.parameters { + let thunkBuilder = ExportedThunkBuilder(effects: method.effects) + for param in method.parameters { try thunkBuilder.lowerParameter(param: param) } - let returnExpr = try thunkBuilder.call(abiName: function.abiName, returnType: function.returnType) - let paramList = thunkBuilder.generateParameterList(parameters: function.parameters) + let returnExpr = try thunkBuilder.call(abiName: method.abiName, returnType: method.returnType) - let printer = CodeFragmentPrinter() - printer.write( - "\(enumName).\(function.name) = function(\(paramList)) {" + let methodPrinter = CodeFragmentPrinter() + methodPrinter.write( + "\(method.name): function(\(method.parameters.map { $0.name }.joined(separator: ", "))) {" ) - printer.indent { - printer.write(contentsOf: thunkBuilder.body) - printer.write(contentsOf: thunkBuilder.cleanupCode) - printer.write(lines: thunkBuilder.checkExceptionLines()) + methodPrinter.indent { + methodPrinter.write(contentsOf: thunkBuilder.body) + methodPrinter.write(contentsOf: thunkBuilder.cleanupCode) + methodPrinter.write(lines: thunkBuilder.checkExceptionLines()) if let returnExpr = returnExpr { - printer.write("return \(returnExpr);") + methodPrinter.write("return \(returnExpr);") } } - printer.write("};") - - return printer.lines + methodPrinter.write("},") + return methodPrinter.lines } - /// Renders an enum static property as getter/setter assignments on the enum object - private func renderEnumStaticProperty( + /// Renders a static property getter/setter for use in an export object + private func renderStaticPropertyForExportObject( property: ExportedProperty, - enumName: String - ) throws -> (js: [String], dts: [String]) { - var jsLines: [String] = [] + className: String? + ) throws -> [String] { + let propertyPrinter = CodeFragmentPrinter() - // Generate getter assignment + // Generate getter let getterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) let getterReturnExpr = try getterThunkBuilder.call( - abiName: property.getterAbiName(), + abiName: className != nil + ? property.getterAbiName(className: className!) + : property.getterAbiName(), returnType: property.type ) - let getterLines = getterThunkBuilder.renderFunction( - name: property.name, - parameters: [], - returnExpr: getterReturnExpr, - declarationPrefixKeyword: nil - ) - - // Build Object.defineProperty call - var definePropertyLines: [String] = [] - definePropertyLines.append("Object.defineProperty(\(enumName), '\(property.name)', { get: function() {") - - // Add getter body (skip function declaration and closing brace) - if getterLines.count > 2 { - let bodyLines = Array(getterLines[1.. 2 { - let bodyLines = Array(setterLines[1.. = [ reservedSwift, + reservedInstance, reservedMemory, + reservedSetException, reservedStorageToReturnString, reservedStorageToReturnBytes, reservedStorageToReturnException, @@ -50,6 +54,8 @@ final class JSGlueVariableScope { reservedTmpParamInts, reservedTmpParamF32s, reservedTmpParamF64s, + reservedTmpRetPointers, + reservedTmpParamPointers, ] /// Returns a unique variable name in the scope based on the given name hint. @@ -324,6 +330,22 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") resultExpr = "\(isSome) ? \(enumVar) : null" + case .swiftStruct(let fullName): + let base = fullName.components(separatedBy: ".").last ?? fullName + let structVar = scope.variable("structValue") + printer.write("let \(structVar);") + printer.write("if (\(isSome)) {") + printer.indent { + printer.write( + "\(structVar) = structHelpers.\(base).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + ) + } + printer.write("} else {") + printer.indent { + printer.write("\(structVar) = null;") + } + printer.write("}") + resultExpr = structVar default: resultExpr = "\(isSome) ? \(wrappedValue) : null" } @@ -342,6 +364,19 @@ struct IntrinsicJSFragment: Sendable { printer.write("const \(isSomeVar) = \(value) != null;") switch wrappedType { + case .swiftStruct(let fullName): + let base = fullName.components(separatedBy: ".").last ?? fullName + let cleanupVar = scope.variable("\(value)Cleanup") + printer.write("let \(cleanupVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let resultVar = scope.variable("structResult") + printer.write("const \(resultVar) = structHelpers.\(base).lower(\(value));") + printer.write("\(cleanupVar) = \(resultVar).cleanup;") + } + printer.write("}") + cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") + return ["+\(isSomeVar)"] case .string, .rawValueEnum(_, .string): let bytesVar = scope.variable("\(value)Bytes") let idVar = scope.variable("\(value)Id") @@ -494,6 +529,22 @@ struct IntrinsicJSFragment: Sendable { ) } printer.write("}") + case .swiftStruct(let fullName): + let base = fullName.components(separatedBy: ".").last ?? fullName + let isSomeVar = scope.variable("isSome") + printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("let \(resultVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write( + "\(resultVar) = structHelpers.\(base).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + ) + } + printer.write("} else {") + printer.indent { + printer.write("\(resultVar) = null;") + } + printer.write("}") default: printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnString);") printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = undefined;") @@ -1259,6 +1310,9 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName return .associatedEnumLowerParameter(enumBase: base) + case .swiftStruct(let fullName): + let base = fullName.components(separatedBy: ".").last ?? fullName + return swiftStructLowerParameter(structBase: base) case .closure: return IntrinsicJSFragment( parameters: ["closure"], @@ -1297,6 +1351,9 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName return .associatedEnumLiftReturn(enumBase: base) + case .swiftStruct(let fullName): + let base = fullName.components(separatedBy: ".").last ?? fullName + return swiftStructLiftReturn(structBase: base) case .closure(let signature): let lowerFuncName = "lower_closure_\(signature.moduleName)_\(signature.mangleName)" return IntrinsicJSFragment( @@ -1374,6 +1431,26 @@ struct IntrinsicJSFragment: Sendable { } ) } + case .swiftStruct(let fullName): + switch context { + case .importTS: + throw BridgeJSLinkError( + message: + "Swift structs are not supported to be passed as parameters to imported JS functions: \(fullName)" + ) + case .exportSwift: + let base = fullName.components(separatedBy: ".").last ?? fullName + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanupCode in + let resultVar = scope.variable("structValue") + printer.write( + "const \(resultVar) = structHelpers.\(base).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + ) + return [resultVar] + } + ) + } case .closure: throw BridgeJSLinkError(message: "Closure parameters not yet implemented for imported JS functions") case .namespaceEnum(let string): @@ -1428,6 +1505,16 @@ struct IntrinsicJSFragment: Sendable { case .exportSwift: return associatedValueLowerReturn(fullName: fullName) } + case .swiftStruct(let fullName): + switch context { + case .importTS: + throw BridgeJSLinkError( + message: + "Swift structs are not supported to be returned from imported JS functions: \(fullName)" + ) + case .exportSwift: + return swiftStructLowerReturn(fullName: fullName) + } case .closure: throw BridgeJSLinkError(message: "Closure return values not yet implemented for imported JS functions") case .namespaceEnum(let string): @@ -1886,4 +1973,839 @@ struct IntrinsicJSFragment: Sendable { ) } } + + static func swiftStructLowerReturn(fullName: String) -> IntrinsicJSFragment { + let base = fullName.components(separatedBy: ".").last ?? fullName + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanupCode in + let value = arguments[0] + let cleanupVar = scope.variable("cleanup") + printer.write( + "const { cleanup: \(cleanupVar) } = structHelpers.\(base).lower(\(value));" + ) + cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") + return [] + } + ) + } + + static func swiftStructLowerParameter(structBase: String) -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanupCode in + let value = arguments[0] + let cleanupVar = scope.variable("cleanup") + printer.write( + "const { cleanup: \(cleanupVar) } = structHelpers.\(structBase).lower(\(value));" + ) + cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") + return [] + } + ) + } + + static func swiftStructLiftReturn(structBase: String) -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanupCode in + let resultVar = scope.variable("structValue") + printer.write( + "const \(resultVar) = structHelpers.\(structBase).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + ) + return [resultVar] + } + ) + } + + static func structHelper(structDefinition: ExportedStruct, allStructs: [ExportedStruct]) -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: ["structName"], + printCode: { arguments, scope, printer, cleanup in + let structName = arguments[0] + let capturedStructDef = structDefinition + let capturedAllStructs = allStructs + + printer.write("const __bjs_create\(structName)Helpers = () => {") + printer.indent() + printer.write( + "return (\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTmpParamPointers), \(JSGlueVariableScope.reservedTmpRetPointers), textEncoder, \(JSGlueVariableScope.reservedSwift), enumHelpers) => ({" + ) + printer.indent() + + printer.write("lower: (value) => {") + printer.indent { + generateStructLowerCode( + structDef: capturedStructDef, + allStructs: capturedAllStructs, + printer: printer + ) + } + printer.write("},") + + printer.write( + "raise: (\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers)) => {" + ) + printer.indent { + generateStructRaiseCode( + structDef: capturedStructDef, + allStructs: capturedAllStructs, + printer: printer, + attachMethods: true + ) + } + printer.write("}") + printer.unindent() + printer.write("});") + printer.unindent() + printer.write("};") + + return [] + } + ) + } + + private static func findStruct(name: String, structs: [ExportedStruct]) -> ExportedStruct? { + return structs.first(where: { $0.swiftCallName == name || $0.name == name }) + } + + private static func generateStructLowerCode( + structDef: ExportedStruct, + allStructs: [ExportedStruct], + printer: CodeFragmentPrinter + ) { + let lowerPrinter = CodeFragmentPrinter() + let lowerScope = JSGlueVariableScope() + let lowerCleanup = CodeFragmentPrinter() + lowerCleanup.indent() + + let instanceProps = structDef.properties.filter { !$0.isStatic } + for property in instanceProps { + let fragment = structFieldLowerFragment(field: property, allStructs: allStructs) + let fieldValue = "value.\(property.name)" + _ = fragment.printCode([fieldValue], lowerScope, lowerPrinter, lowerCleanup) + } + + for line in lowerPrinter.lines { + printer.write(line) + } + + if !lowerCleanup.lines.isEmpty { + printer.write("const cleanup = () => {") + printer.write(contentsOf: lowerCleanup) + printer.write("};") + printer.write("return { cleanup };") + } else { + printer.write("return { cleanup: undefined };") + } + } + + private static func generateStructRaiseCode( + structDef: ExportedStruct, + allStructs: [ExportedStruct], + printer: CodeFragmentPrinter, + attachMethods: Bool = false + ) { + let raiseScope = JSGlueVariableScope() + let raiseCleanup = CodeFragmentPrinter() + + var fieldExpressions: [(name: String, expression: String)] = [] + + let instanceProps = structDef.properties.filter { !$0.isStatic } + for property in instanceProps.reversed() { + let fragment = structFieldRaiseFragment(field: property, allStructs: allStructs) + let results = fragment.printCode([], raiseScope, printer, raiseCleanup) + + if let resultExpr = results.first { + fieldExpressions.append((property.name, resultExpr)) + } else { + fieldExpressions.append((property.name, "undefined")) + } + } + + // Construct struct object with fields in original order + let reconstructedFields = instanceProps.map { property in + let expr = fieldExpressions.first(where: { $0.name == property.name })?.expression ?? "undefined" + return "\(property.name): \(expr)" + } + + if attachMethods && !structDef.methods.filter({ !$0.effects.isStatic }).isEmpty { + let instanceVar = raiseScope.variable("instance") + printer.write("const \(instanceVar) = { \(reconstructedFields.joined(separator: ", ")) };") + + // Attach instance methods to the struct instance + for method in structDef.methods where !method.effects.isStatic { + printer.write( + "\(instanceVar).\(method.name) = function(\(method.parameters.map { $0.name }.joined(separator: ", "))) {" + ) + printer.indent { + let methodScope = JSGlueVariableScope() + let methodCleanup = CodeFragmentPrinter() + + // Lower the struct instance (this) using the helper's lower function + let structCleanupVar = methodScope.variable("structCleanup") + printer.write( + "const { cleanup: \(structCleanupVar) } = structHelpers.\(structDef.name).lower(this);" + ) + + // Lower each parameter and collect forwarding expressions + var paramForwardings: [String] = [] + for param in method.parameters { + let fragment = try! IntrinsicJSFragment.lowerParameter(type: param.type) + let loweredValues = fragment.printCode([param.name], methodScope, printer, methodCleanup) + paramForwardings.append(contentsOf: loweredValues) + } + + // Call the Swift function with all lowered parameters + let callExpr = "instance.exports.\(method.abiName)(\(paramForwardings.joined(separator: ", ")))" + if method.returnType == .void { + printer.write("\(callExpr);") + } else { + printer.write("const ret = \(callExpr);") + } + + // Cleanup + printer.write("if (\(structCleanupVar)) { \(structCleanupVar)(); }") + printer.write(contentsOf: methodCleanup) + + // Lift return value if needed + if method.returnType != .void { + let liftFragment = try! IntrinsicJSFragment.liftReturn(type: method.returnType) + if !liftFragment.parameters.isEmpty { + let lifted = liftFragment.printCode(["ret"], methodScope, printer, methodCleanup) + if let liftedValue = lifted.first { + printer.write("return \(liftedValue);") + } + } + } + } + printer.write("}.bind(\(instanceVar));") + } + + printer.write("return \(instanceVar);") + } else { + printer.write("return { \(reconstructedFields.joined(separator: ", ")) };") + } + } + + private static func structFieldLowerFragment( + field: ExportedProperty, + allStructs: [ExportedStruct] + ) -> IntrinsicJSFragment { + switch field.type { + case .string: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let bytesVar = scope.variable("bytes") + let idVar = scope.variable("id") + printer.write("const \(bytesVar) = textEncoder.encode(\(value));") + printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") + return [idVar] + } + ) + case .bool: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(arguments[0]) ? 1 : 0);") + return [] + } + ) + case .int: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(arguments[0]) | 0));") + return [] + } + ) + case .float: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(Math.fround(\(arguments[0])));") + return [] + } + ) + case .double: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(arguments[0]));") + return [] + } + ) + case .jsObject: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let idVar = scope.variable("id") + printer.write("let \(idVar);") + printer.write("if (\(value) != null) {") + printer.indent { + printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + } + printer.write("} else {") + printer.indent { + printer.write("\(idVar) = undefined;") + } + printer.write("}") + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar) !== undefined ? \(idVar) : 0);" + ) + cleanup.write("if(\(idVar) !== undefined && \(idVar) !== 0) {") + cleanup.indent { + cleanup.write("try {") + cleanup.indent { + cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.getObject(\(idVar));") + cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") + } + cleanup.write("} catch(e) {}") + } + cleanup.write("}") + return [idVar] + } + ) + case .optional(let wrappedType): + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let isSomeVar = scope.variable("isSome") + printer.write("const \(isSomeVar) = \(value) != null;") + + if case .caseEnum = wrappedType { + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(value) | 0));") + } + printer.write("} else {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + return [] + } else if case .rawValueEnum(_, let rawType) = wrappedType { + switch rawType { + case .string: + let idVar = scope.variable("id") + printer.write("let \(idVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let bytesVar = scope.variable("bytes") + printer.write("const \(bytesVar) = textEncoder.encode(\(value));") + printer.write( + "\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + } + printer.write("} else {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + cleanup.write( + "if(\(idVar) !== undefined) { \(JSGlueVariableScope.reservedSwift).memory.release(\(idVar)); }" + ) + return [idVar] + default: + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(value) | 0));") + } + printer.write("} else {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + return [] + } + } else if case .swiftHeapObject = wrappedType { + let ptrVar = scope.variable("ptr") + printer.write("let \(ptrVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write("\(ptrVar) = \(value).pointer;") + printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(\(ptrVar));") + } + printer.write("} else {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + return [] + } else if case .swiftStruct(let structName) = wrappedType { + let nestedCleanupVar = scope.variable("nestedCleanup") + printer.write("let \(nestedCleanupVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let structResultVar = scope.variable("structResult") + printer.write("const \(structResultVar) = structHelpers.\(structName).lower(\(value));") + printer.write("\(nestedCleanupVar) = \(structResultVar).cleanup;") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + cleanup.write("if (\(nestedCleanupVar)) { \(nestedCleanupVar)(); }") + return [] + } else if case .string = wrappedType { + let idVar = scope.variable("id") + printer.write("let \(idVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let bytesVar = scope.variable("bytes") + printer.write("const \(bytesVar) = textEncoder.encode(\(value));") + printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + } + printer.write("} else {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + cleanup.write( + "if(\(idVar) !== undefined) { \(JSGlueVariableScope.reservedSwift).memory.release(\(idVar)); }" + ) + return [idVar] + } else if case .jsObject = wrappedType { + let idVar = scope.variable("id") + printer.write("let \(idVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + } + printer.write("} else {") + printer.indent { + printer.write("\(idVar) = undefined;") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + cleanup.write("if(\(idVar) !== undefined && \(idVar) !== 0) {") + cleanup.indent { + cleanup.write("try {") + cleanup.indent { + cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.getObject(\(idVar));") + cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") + } + cleanup.write("} catch(e) {}") + } + cleanup.write("}") + return [idVar] + } else { + // Handle optional primitive types using helper + switch wrappedType { + case .int: + pushOptionalPrimitive( + value: value, + isSomeVar: isSomeVar, + stack: .tmpParamInts, + convert: "| 0", + zeroValue: "0", + printer: printer + ) + case .bool: + pushOptionalPrimitive( + value: value, + isSomeVar: isSomeVar, + stack: .tmpParamInts, + convert: "? 1 : 0", + zeroValue: "0", + printer: printer + ) + case .float: + pushOptionalPrimitive( + value: value, + isSomeVar: isSomeVar, + stack: .tmpParamF32s, + convert: "Math.fround", + zeroValue: "0.0", + printer: printer + ) + case .double: + pushOptionalPrimitive( + value: value, + isSomeVar: isSomeVar, + stack: .tmpParamF64s, + convert: nil, + zeroValue: "0.0", + printer: printer + ) + case .associatedValueEnum(let enumName): + let base = enumName.components(separatedBy: ".").last ?? enumName + let caseIdVar = scope.variable("enumCaseId") + let enumCleanupVar = scope.variable("enumCleanup") + printer.write("let \(caseIdVar), \(enumCleanupVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let enumResultVar = scope.variable("enumResult") + printer.write("const \(enumResultVar) = enumHelpers.\(base).lower(\(value));") + printer.write("\(caseIdVar) = \(enumResultVar).caseId;") + printer.write("\(enumCleanupVar) = \(enumResultVar).cleanup;") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(caseIdVar));") + } + printer.write("} else {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + cleanup.write("if (\(enumCleanupVar)) { \(enumCleanupVar)(); }") + default: + // For other types (nested structs, etc.), original logic applies + let wrappedFragment = structFieldLowerFragment( + field: ExportedProperty( + name: field.name, + type: wrappedType, + isReadonly: true, + isStatic: false + ), + allStructs: allStructs + ) + printer.write("if (\(isSomeVar)) {") + printer.indent { + _ = wrappedFragment.printCode([value], scope, printer, cleanup) + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + } + return [] + } + } + ) + case .swiftStruct(let nestedName): + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let structResultVar = scope.variable("structResult") + printer.write("const \(structResultVar) = structHelpers.\(nestedName).lower(\(value));") + cleanup.write("if (\(structResultVar).cleanup) { \(structResultVar).cleanup(); }") + return [] + } + ) + case .swiftHeapObject: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(\(value).pointer);") + return [] + } + ) + case .associatedValueEnum(let fullName): + let base = fullName.components(separatedBy: ".").last ?? fullName + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let caseIdVar = scope.variable("caseId") + let cleanupVar = scope.variable("enumCleanup") + printer.write( + "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(value));" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(caseIdVar));") + cleanup.write("if (\(cleanupVar)) { \(cleanupVar)(); }") + return [cleanupVar] + } + ) + case .caseEnum: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(arguments[0]) | 0));") + return [] + } + ) + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let bytesVar = scope.variable("bytes") + let idVar = scope.variable("id") + printer.write("const \(bytesVar) = textEncoder.encode(\(value));") + printer.write( + "const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") + return [idVar] + } + ) + default: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(arguments[0]) | 0));") + return [] + } + ) + } + case .void, .swiftProtocol, .namespaceEnum, .closure: + // These types should not appear as struct fields - return error fragment + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("throw new Error(\"Unsupported struct field type for lowering: \(field.type)\");") + return [] + } + ) + } + } + + /// Helper to push optional primitive values to stack-based parameters + private static func pushOptionalPrimitive( + value: String, + isSomeVar: String, + stack: StackType, + convert: String?, + zeroValue: String, + printer: CodeFragmentPrinter + ) { + let stackName: String + switch stack { + case .tmpParamInts: stackName = JSGlueVariableScope.reservedTmpParamInts + case .tmpParamF32s: stackName = JSGlueVariableScope.reservedTmpParamF32s + case .tmpParamF64s: stackName = JSGlueVariableScope.reservedTmpParamF64s + } + + printer.write("if (\(isSomeVar)) {") + printer.indent { + let converted: String + if let convert = convert { + if convert.starts(with: "Math.") { + converted = "\(convert)(\(value))" + } else { + converted = "\(value) \(convert)" + } + } else { + converted = value + } + printer.write("\(stackName).push(\(converted));") + } + printer.write("} else {") + printer.indent { + printer.write("\(stackName).push(\(zeroValue));") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + } + + private enum StackType { + case tmpParamInts + case tmpParamF32s + case tmpParamF64s + } + + private static func structFieldRaiseFragment( + field: ExportedProperty, + allStructs: [ExportedStruct] + ) -> IntrinsicJSFragment { + switch field.type { + case .string: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let strVar = scope.variable("string") + printer.write("const \(strVar) = \(JSGlueVariableScope.reservedTmpRetStrings).pop();") + return [strVar] + } + ) + case .bool: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let bVar = scope.variable("bool") + printer.write("const \(bVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop() !== 0;") + return [bVar] + } + ) + case .int: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let iVar = scope.variable("int") + printer.write("const \(iVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + return [iVar] + } + ) + case .float: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let fVar = scope.variable("f32") + printer.write("const \(fVar) = \(JSGlueVariableScope.reservedTmpRetF32s).pop();") + return [fVar] + } + ) + case .double: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let dVar = scope.variable("f64") + printer.write("const \(dVar) = \(JSGlueVariableScope.reservedTmpRetF64s).pop();") + return [dVar] + } + ) + case .optional(let wrappedType): + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let isSomeVar = scope.variable("isSome") + let optVar = scope.variable("optional") + printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("let \(optVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + // Special handling for associated value enum - in struct fields, case ID is pushed to tmpRetInts + if case .associatedValueEnum(let enumName) = wrappedType { + let base = enumName.components(separatedBy: ".").last ?? enumName + let caseIdVar = scope.variable("enumCaseId") + printer.write("const \(caseIdVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write( + "\(optVar) = enumHelpers.\(base).raise(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + ) + } else { + let wrappedFragment = structFieldRaiseFragment( + field: ExportedProperty( + name: field.name, + type: wrappedType, + isReadonly: true, + isStatic: false + ), + allStructs: allStructs + ) + let wrappedResults = wrappedFragment.printCode([], scope, printer, cleanup) + if let wrappedResult = wrappedResults.first { + printer.write("\(optVar) = \(wrappedResult);") + } else { + printer.write("\(optVar) = undefined;") + } + } + } + printer.write("} else {") + printer.indent { + printer.write("\(optVar) = null;") + } + printer.write("}") + return [optVar] + } + ) + case .swiftStruct(let nestedName): + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let structVar = scope.variable("struct") + printer.write( + "const \(structVar) = structHelpers.\(nestedName).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + ) + return [structVar] + } + ) + case .caseEnum: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let varName = scope.variable("value") + printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + return [varName] + } + ) + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let varName = scope.variable("value") + printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetStrings).pop();") + return [varName] + } + ) + default: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let varName = scope.variable("value") + printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + return [varName] + } + ) + } + case .swiftHeapObject(let className): + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let ptrVar = scope.variable("ptr") + let varName = scope.variable("value") + printer.write("const \(ptrVar) = \(JSGlueVariableScope.reservedTmpRetPointers).pop();") + printer.write("const \(varName) = _exports['\(className)'].__construct(\(ptrVar));") + return [varName] + } + ) + case .jsObject: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let objectIdVar = scope.variable("objectId") + let varName = scope.variable("value") + printer.write("const \(objectIdVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("let \(varName);") + printer.write("if (\(objectIdVar) !== 0) {") + printer.indent { + printer.write( + "\(varName) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(objectIdVar));" + ) + printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(objectIdVar));") + } + printer.write("} else {") + printer.indent { + printer.write("\(varName) = null;") + } + printer.write("}") + return [varName] + } + ) + case .associatedValueEnum(let fullName): + let base = fullName.components(separatedBy: ".").last ?? fullName + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let varName = scope.variable("value") + printer.write( + "const \(varName) = enumHelpers.\(base).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + ) + return [varName] + } + ) + case .void, .swiftProtocol, .namespaceEnum, .closure: + // These types should not appear as struct fields + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + printer.write("throw new Error(\"Unsupported struct field type: \(field.type)\");") + return [] + } + ) + } + } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 12970b505..e80d1c827 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -25,7 +25,7 @@ public struct ABINameGenerator { let contextPart: String? if let staticContext = staticContext { switch staticContext { - case .className(let name), .enumName(let name): + case .className(let name), .enumName(let name), .structName(let name): contextPart = name case .namespaceEnum: contextPart = namespacePart @@ -115,6 +115,7 @@ public enum BridgeType: Codable, Equatable, Hashable, Sendable { case associatedValueEnum(String) case namespaceEnum(String) case swiftProtocol(String) + case swiftStruct(String) indirect case closure(ClosureSignature) } @@ -205,10 +206,51 @@ public struct Effects: Codable, Equatable, Sendable { public enum StaticContext: Codable, Equatable, Sendable { case className(String) + case structName(String) case enumName(String) case namespaceEnum } +// MARK: - Struct Skeleton + +public struct StructField: Codable, Equatable, Sendable { + public let name: String + public let type: BridgeType + + public init(name: String, type: BridgeType) { + self.name = name + self.type = type + } +} + +public struct ExportedStruct: Codable, Equatable, Sendable { + public let name: String + public let swiftCallName: String + public let explicitAccessControl: String? + public var properties: [ExportedProperty] + public var constructor: ExportedConstructor? + public var methods: [ExportedFunction] + public let namespace: [String]? + + public init( + name: String, + swiftCallName: String, + explicitAccessControl: String?, + properties: [ExportedProperty] = [], + constructor: ExportedConstructor? = nil, + methods: [ExportedFunction] = [], + namespace: [String]? + ) { + self.name = name + self.swiftCallName = swiftCallName + self.explicitAccessControl = explicitAccessControl + self.properties = properties + self.constructor = constructor + self.methods = methods + self.namespace = namespace + } +} + // MARK: - Enum Skeleton public struct AssociatedValue: Codable, Equatable, Sendable { @@ -416,7 +458,7 @@ public struct ExportedClass: Codable { } } -public struct ExportedConstructor: Codable { +public struct ExportedConstructor: Codable, Equatable, Sendable { public var abiName: String public var parameters: [Parameter] public var effects: Effects @@ -457,7 +499,7 @@ public struct ExportedProperty: Codable, Equatable, Sendable { public func callName(prefix: String? = nil) -> String { if let staticContext = staticContext { switch staticContext { - case .className(let baseName), .enumName(let baseName): + case .className(let baseName), .enumName(let baseName), .structName(let baseName): return "\(baseName).\(name)" case .namespaceEnum: if let namespace = namespace, !namespace.isEmpty { @@ -498,6 +540,7 @@ public struct ExportedSkeleton: Codable { public let functions: [ExportedFunction] public let classes: [ExportedClass] public let enums: [ExportedEnum] + public let structs: [ExportedStruct] public let protocols: [ExportedProtocol] /// Whether to expose exported APIs to the global namespace. /// @@ -511,6 +554,7 @@ public struct ExportedSkeleton: Codable { functions: [ExportedFunction], classes: [ExportedClass], enums: [ExportedEnum], + structs: [ExportedStruct] = [], protocols: [ExportedProtocol] = [], exposeToGlobal: Bool ) { @@ -518,6 +562,7 @@ public struct ExportedSkeleton: Codable { self.functions = functions self.classes = classes self.enums = enums + self.structs = structs self.protocols = protocols self.exposeToGlobal = exposeToGlobal } @@ -624,6 +669,9 @@ extension BridgeType { case .swiftProtocol: // Protocols pass JSObject IDs as Int32 return .i32 + case .swiftStruct: + // Structs use stack-based return (no direct WASM return type) + return nil case .closure: // Closures pass callback ID as Int32 return .i32 @@ -660,6 +708,8 @@ extension BridgeType { return "\(name.count)\(name)O" case .swiftProtocol(let name): return "\(name.count)\(name)P" + case .swiftStruct(let name): + return "\(name.count)\(name)V" case .closure(let signature): let params = signature.parameters.isEmpty diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftStruct.swift new file mode 100644 index 000000000..3415f54a9 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftStruct.swift @@ -0,0 +1,44 @@ +@JS struct DataPoint { + let x: Double + let y: Double + var label: String + var optCount: Int? + var optFlag: Bool? + + @JS init(x: Double, y: Double, label: String, optCount: Int?, optFlag: Bool?) +} + +@JS struct Address { + var street: String + var city: String + var zipCode: Int? +} + +@JS struct Person { + var name: String + var age: Int + var address: Address + var email: String? +} + +@JS class Greeter { + @JS var name: String + + @JS init(name: String) + @JS func greet() -> String +} + +@JS struct Session { + var id: Int + var owner: Greeter +} + +@JS func roundtrip(_ session: Person) -> Person + +@JS struct ConfigStruct { + @JS static let maxRetries: Int = 3 + @JS nonisolated(unsafe) static var defaultConfig: String = "production" + @JS nonisolated(unsafe) static var timeout: Double = 30.0 + @JS static var computedSetting: String { "Config: \(defaultConfig)" } + @JS static func update(_ timeout: Double) -> Double +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js index 227093668..e53708aab 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js index 372de6ec3..c9c2e484f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js index 873c9d697..c98f19719 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index fa7a7c06b..ba9eac2fb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -32,6 +32,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -97,6 +99,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index e484b72c0..f0fbf6f75 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -501,6 +501,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; const enumHelpers = {}; let _exports = null; @@ -567,6 +569,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js index 526e2fc91..4a0ebe848 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js @@ -50,6 +50,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -115,6 +117,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index 9fed226d9..96127eba5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -51,6 +51,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -116,6 +118,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js index a38b50933..c766f08ef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js @@ -70,6 +70,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -135,6 +137,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js index 9daa221b2..2331d1c78 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js @@ -101,6 +101,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -166,6 +168,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js index 6e5461190..1bfd09445 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index 9336edc6d..c8b242720 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js index 453057fa3..737a40046 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js index 0ff8f450e..ccf941dec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js index e422b08b6..1e1e9563a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index 380f1a721..df998b01b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index 24022a438..da5566616 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js index e2f13dd02..c051fcd21 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js index f9c60e068..015d5a1c0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js index c8bd621df..5e7ae2094 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js index 32f5e36f9..512b48ace 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js index 605a13ea6..f2e1bbe0c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js index 62122a832..4b486f484 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js index e37af60c9..4bfa5f698 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index 58f32ea96..efb6b11e7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -90,6 +90,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; const enumHelpers = {}; let _exports = null; @@ -156,6 +158,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index 8522168f2..782a38605 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -77,6 +77,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; const enumHelpers = {}; let _exports = null; @@ -143,6 +145,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js index 3e445992e..f0ce10325 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js @@ -77,6 +77,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; const enumHelpers = {}; let _exports = null; @@ -143,6 +145,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js index 5d70c39b1..d1039d0f4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js @@ -31,6 +31,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -96,6 +98,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js index 09a2b0de9..086a2ca31 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js @@ -31,6 +31,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -96,6 +98,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js index a668639d4..2f182b630 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js index e13404bbf..21caebd02 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js index f31ef1403..712563448 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js index ae86fd8f1..f1ab79072 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js index e946b01ce..2def00d13 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js index 755d98fd6..74b2cfe4f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js @@ -128,6 +128,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; const enumHelpers = {}; let _exports = null; @@ -194,6 +196,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.d.ts new file mode 100644 index 000000000..1d1474510 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.d.ts @@ -0,0 +1,66 @@ +// 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 interface DataPoint { + x: number; + y: number; + label: string; + optCount: number | null; + optFlag: boolean | null; +} +export interface Address { + street: string; + city: string; + zipCode: number | null; +} +export interface Person { + name: string; + age: number; + address: Address; + email: string | null; +} +export interface Session { + id: number; + owner: Greeter; +} +export interface ConfigStruct { +} +/// 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 Greeter extends SwiftHeapObject { + greet(): string; + name: string; +} +export type Exports = { + Greeter: { + new(name: string): Greeter; + } + roundtrip(session: Person): Person; + DataPoint: { + init(x: number, y: number, label: string, optCount: number | null, optFlag: boolean | null): DataPoint; + } + ConfigStruct: { + readonly maxRetries: number; + defaultConfig: string; + timeout: number; + readonly computedSetting: string; + update(timeout: number): number; + } +} +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/SwiftStruct.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js new file mode 100644 index 000000000..fe359bcbe --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js @@ -0,0 +1,499 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + const __bjs_createDataPointHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + tmpParamF64s.push(value.x); + tmpParamF64s.push(value.y); + const bytes = textEncoder.encode(value.label); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const isSome = value.optCount != null; + if (isSome) { + tmpParamInts.push(value.optCount | 0); + } else { + tmpParamInts.push(0); + } + tmpParamInts.push(isSome ? 1 : 0); + const isSome1 = value.optFlag != null; + if (isSome1) { + tmpParamInts.push(value.optFlag ? 1 : 0); + } else { + tmpParamInts.push(0); + } + tmpParamInts.push(isSome1 ? 1 : 0); + const cleanup = () => { + swift.memory.release(id); + }; + return { cleanup }; + }, + raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const bool = tmpRetInts.pop() !== 0; + optional = bool; + } else { + optional = null; + } + const isSome1 = tmpRetInts.pop(); + let optional1; + if (isSome1) { + const int = tmpRetInts.pop(); + optional1 = int; + } else { + optional1 = null; + } + const string = tmpRetStrings.pop(); + const f64 = tmpRetF64s.pop(); + const f641 = tmpRetF64s.pop(); + return { x: f641, y: f64, label: string, optCount: optional1, optFlag: optional }; + } + }); + }; + const __bjs_createAddressHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + const bytes = textEncoder.encode(value.street); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const bytes1 = textEncoder.encode(value.city); + const id1 = swift.memory.retain(bytes1); + tmpParamInts.push(bytes1.length); + tmpParamInts.push(id1); + const isSome = value.zipCode != null; + if (isSome) { + tmpParamInts.push(value.zipCode | 0); + } else { + tmpParamInts.push(0); + } + tmpParamInts.push(isSome ? 1 : 0); + const cleanup = () => { + swift.memory.release(id); + swift.memory.release(id1); + }; + return { cleanup }; + }, + raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const int = tmpRetInts.pop(); + optional = int; + } else { + optional = null; + } + const string = tmpRetStrings.pop(); + const string1 = tmpRetStrings.pop(); + return { street: string1, city: string, zipCode: optional }; + } + }); + }; + const __bjs_createPersonHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + const bytes = textEncoder.encode(value.name); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + tmpParamInts.push((value.age | 0)); + const structResult = structHelpers.Address.lower(value.address); + const isSome = value.email != null; + let id1; + if (isSome) { + const bytes1 = textEncoder.encode(value.email); + id1 = swift.memory.retain(bytes1); + tmpParamInts.push(bytes1.length); + tmpParamInts.push(id1); + } else { + tmpParamInts.push(0); + tmpParamInts.push(0); + } + tmpParamInts.push(isSome ? 1 : 0); + const cleanup = () => { + swift.memory.release(id); + if (structResult.cleanup) { structResult.cleanup(); } + if(id1 !== undefined) { swift.memory.release(id1); } + }; + return { cleanup }; + }, + raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const string = tmpRetStrings.pop(); + optional = string; + } else { + optional = null; + } + const struct = structHelpers.Address.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const int = tmpRetInts.pop(); + const string1 = tmpRetStrings.pop(); + return { name: string1, age: int, address: struct, email: optional }; + } + }); + }; + const __bjs_createSessionHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + tmpParamInts.push((value.id | 0)); + tmpParamPointers.push(value.owner.pointer); + return { cleanup: undefined }; + }, + raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + const ptr = tmpRetPointers.pop(); + const value = _exports['Greeter'].__construct(ptr); + const int = tmpRetInts.pop(); + return { id: int, owner: value }; + } + }); + }; + const __bjs_createConfigStructHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + return { cleanup: undefined }; + }, + raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + return { }; + } + }); + }; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_Greeter_wrap"] = function(pointer) { + const obj = Greeter.__construct(pointer); + return swift.memory.retain(obj); + }; + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class Greeter extends SwiftHeapObject { + 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); + const ret = instance.exports.bjs_Greeter_init(nameId, nameBytes.length); + swift.memory.release(nameId); + return Greeter.__construct(ret); + } + greet() { + instance.exports.bjs_Greeter_greet(this.pointer); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + get name() { + instance.exports.bjs_Greeter_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_Greeter_name_set(this.pointer, valueId, valueBytes.length); + swift.memory.release(valueId); + } + } + 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 ConfigStructHelpers = __bjs_createConfigStructHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + structHelpers.ConfigStruct = ConfigStructHelpers; + + const exports = { + Greeter, + roundtrip: function bjs_roundtrip(session) { + const { cleanup: cleanup } = structHelpers.Person.lower(session); + instance.exports.bjs_roundtrip(); + const structValue = structHelpers.Person.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + if (cleanup) { cleanup(); } + return structValue; + }, + DataPoint: { + init: function(x, y, label, optCount, optFlag) { + const labelBytes = textEncoder.encode(label); + const labelId = swift.memory.retain(labelBytes); + const isSome = optCount != null; + const isSome1 = optFlag != null; + instance.exports.bjs_DataPoint_init(x, y, labelId, labelBytes.length, +isSome, isSome ? optCount : 0, +isSome1, isSome1 ? optFlag : 0); + const structValue = structHelpers.DataPoint.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + swift.memory.release(labelId); + return structValue; + }, + }, + ConfigStruct: { + get maxRetries() { + const ret = instance.exports.bjs_ConfigStruct_static_maxRetries_get(); + return ret; + }, + get defaultConfig() { + instance.exports.bjs_ConfigStruct_static_defaultConfig_get(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + set defaultConfig(value) { + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + instance.exports.bjs_ConfigStruct_static_defaultConfig_set(valueId, valueBytes.length); + swift.memory.release(valueId); + }, + get timeout() { + const ret = instance.exports.bjs_ConfigStruct_static_timeout_get(); + return ret; + }, + set timeout(value) { + instance.exports.bjs_ConfigStruct_static_timeout_set(value); + }, + get computedSetting() { + instance.exports.bjs_ConfigStruct_static_computedSetting_get(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, + update: function(timeout) { + const ret = instance.exports.bjs_ConfigStruct_static_update(timeout); + return ret; + }, + }, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js index 4c3cbc213..b0684f153 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js index 059c93157..928ba5950 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js index 320609e1c..c2f477245 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index 783884efb..71511ca3c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js index b6d7a4ea3..b39042bda 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js index 627dd140c..8f8328054 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js @@ -26,6 +26,8 @@ export async function createInstantiator(options, swift) { let tmpParamInts = []; let tmpParamF32s = []; let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; let _exports = null; let bjs = null; @@ -91,6 +93,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_f64"] = function() { return tmpParamF64s.pop(); } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json index 2e295991b..4bb845587 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json @@ -178,5 +178,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json index ccb4cb289..66b4dcc41 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json @@ -647,5 +647,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json index fb7271b91..f7e57aabd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json @@ -838,5 +838,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json index 9effaaec7..1f4d55046 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json @@ -314,5 +314,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json index 8aeb6c78c..98ded1fe8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json @@ -409,5 +409,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json index 94d1bb061..24afb4eb2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json @@ -409,5 +409,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json index 4bf1644c4..b7ea9cd17 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json @@ -1492,5 +1492,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json index 21e78b120..995c3efcf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json @@ -70,5 +70,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json index d86712af6..c986a903f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json @@ -70,5 +70,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json index bde86c44f..a0b1efea2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json @@ -176,5 +176,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json index 910fcfc2c..2420d592e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json @@ -176,5 +176,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json index eb92b21d5..64aaa295e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json @@ -693,5 +693,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json index ccd504f4d..d9edf11c3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json @@ -63,5 +63,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json index 6210c8663..79ce75dac 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json @@ -79,5 +79,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json index 14f0cc0fd..aa5fcc86b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json @@ -354,5 +354,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json index 487533b38..c3107394e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json @@ -798,5 +798,8 @@ } ] } + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json index 8a2923a02..4e8d80d59 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json @@ -330,5 +330,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json index 13f707bda..ab399f102 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json @@ -330,5 +330,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json index d7af99185..472406ba9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json @@ -333,5 +333,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json index fb3a12b6b..6ef937981 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json @@ -333,5 +333,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json index bec03d8fc..b70151233 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json @@ -61,5 +61,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json index 86221037d..39ec8b7a3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json @@ -28,5 +28,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json index 9f1f934ec..df4975e11 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json @@ -136,5 +136,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json index 2a8a64040..20015ba25 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json @@ -1069,5 +1069,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json new file mode 100644 index 000000000..498231bf0 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json @@ -0,0 +1,448 @@ +{ + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Greeter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_Greeter_greet", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Greeter", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "Greeter" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtrip", + "parameters" : [ + { + "label" : "_", + "name" : "session", + "type" : { + "swiftStruct" : { + "_0" : "Person" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Person" + } + } + } + ], + "moduleName" : "TestModule", + "protocols" : [ + + ], + "structs" : [ + { + "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" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "label" : "optFlag", + "name" : "optFlag", + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ] + }, + "methods" : [ + + ], + "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" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optFlag", + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "swiftCallName" : "DataPoint" + }, + { + "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" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "swiftCallName" : "Address" + }, + { + "methods" : [ + + ], + "name" : "Person", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "age", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "address", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "email", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "swiftCallName" : "Person" + }, + { + "methods" : [ + + ], + "name" : "Session", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "owner", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "swiftCallName" : "Session" + }, + { + "methods" : [ + { + "abiName" : "bjs_ConfigStruct_static_update", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "update", + "parameters" : [ + { + "label" : "_", + "name" : "timeout", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + }, + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + } + } + ], + "name" : "ConfigStruct", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : true, + "name" : "maxRetries", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "defaultConfig", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "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" + } + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift new file mode 100644 index 000000000..57635c626 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift @@ -0,0 +1,273 @@ +// 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 + +extension DataPoint: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> DataPoint { + let optFlag = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let optCount = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let label = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let y = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let x = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + return DataPoint(x: x, y: y, label: label, optCount: optCount, optFlag: optFlag) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_f64(self.x) + _swift_js_push_f64(self.y) + var __bjs_label = self.label + __bjs_label.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + let __bjs_isSome_optCount = self.optCount != nil + if let __bjs_unwrapped_optCount = self.optCount { + _swift_js_push_int(Int32(__bjs_unwrapped_optCount)) + } + _swift_js_push_int(__bjs_isSome_optCount ? 1 : 0) + let __bjs_isSome_optFlag = self.optFlag != nil + if let __bjs_unwrapped_optFlag = self.optFlag { + _swift_js_push_int(__bjs_unwrapped_optFlag ? 1 : 0) + } + _swift_js_push_int(__bjs_isSome_optFlag ? 1 : 0) + } +} + +@_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 +} + +extension Address: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Address { + let zipCode = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let city = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let street = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + return Address(street: street, city: city, zipCode: zipCode) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + var __bjs_street = self.street + __bjs_street.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + var __bjs_city = self.city + __bjs_city.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + let __bjs_isSome_zipCode = self.zipCode != nil + if let __bjs_unwrapped_zipCode = self.zipCode { + _swift_js_push_int(Int32(__bjs_unwrapped_zipCode)) + } + _swift_js_push_int(__bjs_isSome_zipCode ? 1 : 0) + } +} + +extension Person: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Person { + let email = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let address = Address.bridgeJSLiftParameter() + let age = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + return Person(name: name, age: age, address: address, email: email) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + var __bjs_name = self.name + __bjs_name.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(self.age)) + self.address.bridgeJSLowerReturn() + let __bjs_isSome_email = self.email != nil + if let __bjs_unwrapped_email = self.email { + var __bjs_str_email = __bjs_unwrapped_email + __bjs_str_email.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + } + _swift_js_push_int(__bjs_isSome_email ? 1 : 0) + } +} + +extension Session: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Session { + let owner = Greeter.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) + let id = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + return Session(id: id, owner: owner) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_int(Int32(self.id)) + _swift_js_push_pointer(self.owner.bridgeJSLowerReturn()) + } +} + +extension ConfigStruct: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ConfigStruct { + return ConfigStruct() + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + + } +} + +@_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_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_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 +} + +@_expose(wasm, "bjs_ConfigStruct_static_update") +@_cdecl("bjs_ConfigStruct_static_update") +public func _bjs_ConfigStruct_static_update(timeout: Float64) -> Float64 { + #if arch(wasm32) + let ret = ConfigStruct.update(_: Double.bridgeJSLiftParameter(timeout)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundtrip") +@_cdecl("bjs_roundtrip") +public func _bjs_roundtrip() -> Void { + #if arch(wasm32) + let ret = roundtrip(_: Person.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_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_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_deinit") +@_cdecl("bjs_Greeter_deinit") +public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_Greeter_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") +fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json index 9b2e61044..ef42dc6cf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json @@ -28,5 +28,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json index 508107ee6..c80650aff 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json @@ -28,5 +28,8 @@ "moduleName" : "TestModule", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Sources/JavaScriptKit/BridgeJSInstrincics.swift b/Sources/JavaScriptKit/BridgeJSInstrincics.swift index b0e5ec395..b3262cb9e 100644 --- a/Sources/JavaScriptKit/BridgeJSInstrincics.swift +++ b/Sources/JavaScriptKit/BridgeJSInstrincics.swift @@ -316,6 +316,15 @@ public protocol _BridgedSwiftAssociatedValueEnum: _BridgedSwiftTypeLoweredIntoVo @_spi(BridgeJS) consuming func bridgeJSLowerReturn() -> Void } +/// A protocol that Swift struct types conform to. +/// +/// The conformance is automatically synthesized by the BridgeJS code generator. +public protocol _BridgedSwiftStruct: _BridgedSwiftTypeLoweredIntoVoidType { + // MARK: ExportSwift + @_spi(BridgeJS) static func bridgeJSLiftParameter() -> Self + @_spi(BridgeJS) consuming func bridgeJSLowerReturn() -> Void +} + extension _BridgedSwiftEnumNoPayload where Self: RawRepresentable, RawValue == String { // MARK: ImportTS @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { rawValue.bridgeJSLowerParameter() } @@ -618,6 +627,24 @@ func _swift_js_return_optional_double(_ isSome: Int32, _ value: Float64) { } #endif +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_push_pointer") +@_spi(BridgeJS) public func _swift_js_push_pointer(_ pointer: UnsafeMutableRawPointer) +#else +@_spi(BridgeJS) public func _swift_js_push_pointer(_ pointer: UnsafeMutableRawPointer) { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_pop_param_pointer") +@_spi(BridgeJS) public func _swift_js_pop_param_pointer() -> UnsafeMutableRawPointer +#else +@_spi(BridgeJS) public func _swift_js_pop_param_pointer() -> UnsafeMutableRawPointer { + _onlyAvailableOnWasm() +} +#endif + extension Optional where Wrapped == Bool { // MARK: ImportTS @@ -1225,3 +1252,27 @@ extension Optional where Wrapped: _BridgedSwiftAssociatedValueEnum { } } } + +// MARK: Optional Struct Support + +extension Optional where Wrapped: _BridgedSwiftStruct { + // MARK: ExportSwift + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32) -> Wrapped? { + if isSome == 0 { + return nil + } else { + return Wrapped.bridgeJSLiftParameter() + } + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + switch consume self { + case .none: + _swift_js_push_int(0) // Push only isSome=0 (no struct fields) + case .some(let value): + value.bridgeJSLowerReturn() // Push all struct fields FIRST + _swift_js_push_int(1) // Then push isSome=1 LAST (so it's popped FIRST by JS) + } + } +} diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md index 44019bf6d..c70533055 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md @@ -65,6 +65,7 @@ This command will: - - +- - - - diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md new file mode 100644 index 000000000..e20a324c2 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md @@ -0,0 +1,180 @@ +# Exporting Swift Structs to JS + +Learn how to export Swift structs to JavaScript. + +## Overview + +> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). + +To export a Swift struct, mark it with `@JS`: + +```swift +import JavaScriptKit + +@JS struct Point { + var x: Double + var y: Double + var label: String +} + +@JS struct Address { + var street: String + var city: String + var zipCode: Int? +} + +@JS struct Person { + var name: String + var age: Int + var address: Address + var email: String? +} + +@JS func createPerson(name: String, age: Int, street: String, city: String) -> Person +@JS func updateEmail(person: Person, email: String?) -> Person +``` + +In JavaScript: + +```javascript +import { init } from "./.build/plugins/PackageToJS/outputs/Package/index.js"; +const { exports } = await init({}); + +const person = exports.createPerson("Alice", 30, "123 Main St", "NYC"); +console.log(person.name); // "Alice" +console.log(person.address.street); // "123 Main St" +console.log(person.email); // null + +const updated = exports.updateEmail(person, "alice@example.com"); +console.log(updated.email); // "alice@example.com" +``` + +The generated TypeScript declarations: + +```typescript +export interface Point { + x: number; + y: number; + label: string; +} + +export interface Address { + street: string; + city: string; + zipCode: number | null; +} + +export interface Person { + name: string; + age: number; + address: Address; + email: string | null; +} + +export type Exports = { + createPerson(name: string, age: number, street: string, city: string): Person; + updateEmail(person: Person, email: string | null): Person; +} +``` + +## Instance Fields vs Static Properties + +**Instance fields** (part of the struct value) are automatically exported - no `@JS` needed: +```swift +@JS struct Point { + var x: Double // Auto-exported + var y: Double // Auto-exported +} +``` + +**Static properties** (not part of instance) require `@JS`: +```swift +@JS struct Config { + var name: String + + @JS nonisolated(unsafe) static var defaultTimeout: Double = 30.0 + @JS static let maxRetries: Int = 3 +} +``` + +In JavaScript: +```javascript +console.log(exports.Config.defaultTimeout); // 30.0 +exports.Config.defaultTimeout = 60.0; +console.log(exports.Config.maxRetries); // 3 (readonly) +``` + +## Struct Methods + +Structs can have instance and static methods, both require @JS annotation: + +```swift +@JS struct Calculator { + @JS func add(a: Double, b: Double) -> Double { + return a + b + } + + @JS static func multiply(x: Double, y: Double) -> Double { + return x * y + } +} +``` + +In JavaScript: + +```javascript +const calc = {}; +console.log(exports.useMathOperations(calc, 5.0, 3.0)); // Uses instance methods +console.log(exports.Calculator.multiply(4.0, 5.0)); // Static method +``` + +## Struct Initializers + +Struct initializers are exported as static `init` methods, not constructors: + +```swift +@JS struct Point { + var x: Double + var y: Double + + @JS init(x: Double, y: Double) { + self.x = x + self.y = y + } +} +``` + +In JavaScript: + +```javascript +const point = exports.Point.init(10.0, 20.0); +console.log(point.x); // 10.0 +``` + +This differs from classes, where `@JS init` maps to a JavaScript constructor using `new`: + +```javascript +// Class: uses `new` +const cart = new exports.ShoppingCart(); + +// Struct: uses static `init` method +const point = exports.Point.init(10.0, 20.0); +``` + +## Supported Features + +| Feature | Status | +|:--------|:-------| +| Stored fields with supported types | ✅ | +| Optional fields | ✅ | +| Nested structs | ✅ | +| Instance methods | ✅ | +| Static methods | ✅ | +| Static properties | ✅ | +| Property observers (`willSet`, `didSet`) | ❌ | +| Generics | ❌ | +| Conformances | ❌ | + +## See Also + +- diff --git a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json index 979311c86..955b78f69 100644 --- a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -533,5 +533,8 @@ "moduleName" : "BridgeJSGlobalTests", "protocols" : [ + ], + "structs" : [ + ] } \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 682e11853..b3aa84c18 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -1232,6 +1232,128 @@ enum APIOptionalResult { } } +// MARK: - Struct Tests + +@JS struct DataPoint { + let x: Double + let y: Double + var label: String + var optCount: Int? + var optFlag: Bool? + + @JS init(x: Double, y: Double, label: String, optCount: Int?, optFlag: Bool?) { + self.x = x + self.y = y + self.label = label + self.optCount = optCount + self.optFlag = optFlag + } +} + +@JS struct Address { + var street: String + var city: String + var zipCode: Int? +} + +@JS struct Contact { + var name: String + var age: Int + var address: Address + var email: String? + var secondaryAddress: Address? +} + +@JS struct Config { + var name: String + var theme: Theme? + var direction: Direction? + var status: Status +} + +@JS struct SessionData { + var id: Int + var owner: Greeter? +} + +@JS struct ValidationReport { + var id: Int + var result: APIResult + var status: Status? + var outcome: APIResult? +} + +@JS struct MathOperations { + @JS init() {} + @JS func add(a: Double, b: Double) -> Double { + return a + b + } + + @JS func multiply(a: Double, b: Double) -> Double { + return a * b + } + + @JS static func subtract(a: Double, b: Double) -> Double { + return a - b + } +} + +@JS struct ConfigStruct { + var name: String + var value: Int + + @JS nonisolated(unsafe) static var defaultConfig: String = "production" + @JS static let maxRetries: Int = 3 + @JS nonisolated(unsafe) static var timeout: Double = 30.0 + + @JS static var computedSetting: String { + return "Config: \(defaultConfig)" + } +} + +@JS func roundTripDataPoint(_ data: DataPoint) -> DataPoint { + return data +} + +@JS func roundTripContact(_ contact: Contact) -> Contact { + return contact +} + +@JS func roundTripConfig(_ config: Config) -> Config { + return config +} + +@JS func roundTripSessionData(_ session: SessionData) -> SessionData { + return session +} + +@JS func roundTripValidationReport(_ report: ValidationReport) -> ValidationReport { + return report +} + +@JS func updateValidationReport(_ newResult: APIResult?, _ report: ValidationReport) -> ValidationReport { + return ValidationReport( + id: report.id, + result: newResult ?? report.result, + status: report.status, + outcome: report.outcome + ) +} + +@JS class Container { + @JS var location: DataPoint + @JS var config: Config? + + @JS init(location: DataPoint, config: Config?) { + self.location = location + self.config = config + } +} + +@JS func testContainerWithStruct(_ point: DataPoint) -> Container { + return Container(location: point, config: nil) +} + class ExportAPITests: XCTestCase { func testAll() { var hasDeinitGreeter = false diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index bfb102192..dcae4a744 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -2008,6 +2008,312 @@ public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_se #endif } +extension DataPoint: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> DataPoint { + let optFlag = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let optCount = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let label = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let y = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let x = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + return DataPoint(x: x, y: y, label: label, optCount: optCount, optFlag: optFlag) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_f64(self.x) + _swift_js_push_f64(self.y) + var __bjs_label = self.label + __bjs_label.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + let __bjs_isSome_optCount = self.optCount != nil + if let __bjs_unwrapped_optCount = self.optCount { + _swift_js_push_int(Int32(__bjs_unwrapped_optCount)) + } + _swift_js_push_int(__bjs_isSome_optCount ? 1 : 0) + let __bjs_isSome_optFlag = self.optFlag != nil + if let __bjs_unwrapped_optFlag = self.optFlag { + _swift_js_push_int(__bjs_unwrapped_optFlag ? 1 : 0) + } + _swift_js_push_int(__bjs_isSome_optFlag ? 1 : 0) + } +} + +@_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 +} + +extension Address: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Address { + let zipCode = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let city = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let street = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + return Address(street: street, city: city, zipCode: zipCode) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + var __bjs_street = self.street + __bjs_street.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + var __bjs_city = self.city + __bjs_city.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + let __bjs_isSome_zipCode = self.zipCode != nil + if let __bjs_unwrapped_zipCode = self.zipCode { + _swift_js_push_int(Int32(__bjs_unwrapped_zipCode)) + } + _swift_js_push_int(__bjs_isSome_zipCode ? 1 : 0) + } +} + +extension Contact: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Contact { + let secondaryAddress = Optional

        .bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let email = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let address = Address.bridgeJSLiftParameter() + let age = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + return Contact(name: name, age: age, address: address, email: email, secondaryAddress: secondaryAddress) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + var __bjs_name = self.name + __bjs_name.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(self.age)) + self.address.bridgeJSLowerReturn() + let __bjs_isSome_email = self.email != nil + if let __bjs_unwrapped_email = self.email { + var __bjs_str_email = __bjs_unwrapped_email + __bjs_str_email.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + } + _swift_js_push_int(__bjs_isSome_email ? 1 : 0) + let __bjs_isSome_secondaryAddress = self.secondaryAddress != nil + if let __bjs_unwrapped_secondaryAddress = self.secondaryAddress { + __bjs_unwrapped_secondaryAddress.bridgeJSLowerReturn() + } + _swift_js_push_int(__bjs_isSome_secondaryAddress ? 1 : 0) + } +} + +extension Config: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Config { + let status = Status.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let direction = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let theme = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + return Config(name: name, theme: theme, direction: direction, status: status) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + var __bjs_name = self.name + __bjs_name.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + let __bjs_isSome_theme = self.theme != nil + if let __bjs_unwrapped_theme = self.theme { + var __bjs_str_theme = __bjs_unwrapped_theme.rawValue + __bjs_str_theme.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + } + _swift_js_push_int(__bjs_isSome_theme ? 1 : 0) + let __bjs_isSome_direction = self.direction != nil + if let __bjs_unwrapped_direction = self.direction { + _swift_js_push_int(__bjs_unwrapped_direction.bridgeJSLowerParameter()) + } + _swift_js_push_int(__bjs_isSome_direction ? 1 : 0) + _swift_js_push_int(Int32(self.status.bridgeJSLowerParameter())) + } +} + +extension SessionData: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> SessionData { + let owner = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_pointer()) + let id = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + return SessionData(id: id, owner: owner) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_int(Int32(self.id)) + let __bjs_isSome_owner = self.owner != nil + if let __bjs_unwrapped_owner = self.owner { + _swift_js_push_pointer(__bjs_unwrapped_owner.bridgeJSLowerReturn()) + } + _swift_js_push_int(__bjs_isSome_owner ? 1 : 0) + } +} + +extension ValidationReport: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ValidationReport { + let outcome = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let status = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let result = APIResult.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let id = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + return ValidationReport(id: id, result: result, status: status, outcome: outcome) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_int(Int32(self.id)) + self.result.bridgeJSLowerReturn() + let __bjs_isSome_status = self.status != nil + if let __bjs_unwrapped_status = self.status { + _swift_js_push_int(__bjs_unwrapped_status.bridgeJSLowerParameter()) + } + _swift_js_push_int(__bjs_isSome_status ? 1 : 0) + let __bjs_isSome_outcome = self.outcome != nil + if let __bjs_unwrapped_outcome = self.outcome { + _swift_js_push_int(__bjs_unwrapped_outcome.bridgeJSLowerParameter()) + } + _swift_js_push_int(__bjs_isSome_outcome ? 1 : 0) + } +} + +extension MathOperations: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MathOperations { + return MathOperations() + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + + } +} + +@_expose(wasm, "bjs_MathOperations_init") +@_cdecl("bjs_MathOperations_init") +public func _bjs_MathOperations_init() -> Void { + #if arch(wasm32) + let ret = MathOperations() + 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 ConfigStruct: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ConfigStruct { + let value = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + return ConfigStruct(name: name, value: value) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + var __bjs_name = self.name + __bjs_name.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(self.value)) + } +} + +@_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 +} + @_expose(wasm, "bjs_roundTripVoid") @_cdecl("bjs_roundTripVoid") public func _bjs_roundTripVoid() -> Void { @@ -3311,6 +3617,85 @@ public func _bjs_makeAdder(base: Int32) -> UnsafeMutableRawPointer { #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_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_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_Greeter_init") @_cdecl("bjs_Greeter_init") public func _bjs_Greeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMutableRawPointer { @@ -5461,4 +5846,80 @@ fileprivate func _bjs_TextProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 fileprivate func _bjs_TextProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } +#endif + +@_expose(wasm, "bjs_Container_init") +@_cdecl("bjs_Container_init") +public func _bjs_Container_init(config: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let _tmp_config = Optional.bridgeJSLiftParameter(config) + 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, value: Int32) -> Void { + #if arch(wasm32) + Container.bridgeJSLiftParameter(_self).config = Optional.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Container_deinit") +@_cdecl("bjs_Container_deinit") +public func _bjs_Container_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension Container: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_Container_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Container_wrap") +fileprivate func _bjs_Container_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Container_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} #endif \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index 50a9236ee..751d6519d 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -3118,6 +3118,71 @@ ], "swiftCallName" : "TextProcessor" + }, + { + "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" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "Container", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "location", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "config", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } + } + ], + "swiftCallName" : "Container" } ], "enums" : [ @@ -7578,6 +7643,194 @@ } } } + }, + { + "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_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_updateValidationReport", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "updateValidationReport", + "parameters" : [ + { + "label" : "_", + "name" : "newResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "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" + } + } } ], "moduleName" : "BridgeJSRuntimeTests", @@ -7961,5 +8214,611 @@ } ] } + ], + "structs" : [ + { + "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" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "label" : "optFlag", + "name" : "optFlag", + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ] + }, + "methods" : [ + + ], + "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" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optFlag", + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "swiftCallName" : "DataPoint" + }, + { + "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" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "swiftCallName" : "Address" + }, + { + "methods" : [ + + ], + "name" : "Contact", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "age", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "address", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "email", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "secondaryAddress", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Address" + } + } + } + } + } + ], + "swiftCallName" : "Contact" + }, + { + "methods" : [ + + ], + "name" : "Config", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "theme", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "direction", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + ], + "swiftCallName" : "Config" + }, + { + "methods" : [ + + ], + "name" : "SessionData", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "owner", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "swiftCallName" : "SessionData" + }, + { + "methods" : [ + + ], + "name" : "ValidationReport", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "status", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "outcome", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "swiftCallName" : "ValidationReport" + }, + { + "constructor" : { + "abiName" : "bjs_MathOperations_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_MathOperations_add", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "add", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "double" : { + + } + } + }, + { + "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" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + }, + "staticContext" : { + "structName" : { + "_0" : "MathOperations" + } + } + } + ], + "name" : "MathOperations", + "properties" : [ + + ], + "swiftCallName" : "MathOperations" + }, + { + "methods" : [ + + ], + "name" : "ConfigStruct", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "value", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "defaultConfig", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "maxRetries", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "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" + } ] } \ No newline at end of file diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 04fa3abdf..eaef7ca15 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -710,6 +710,7 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { testProtocolSupport(exports); testClosureSupport(exports); + testStructSupport(exports); } /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ function testClosureSupport(exports) { @@ -905,6 +906,100 @@ function testClosureSupport(exports) { processor.release(); } +/** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ +function testStructSupport(exports) { + const data1 = { x: 1.5, y: 2.5, label: "Point", optCount: 42, optFlag: true }; + assert.deepEqual(exports.roundTripDataPoint(data1), data1); + const data2 = { x: 0.0, y: 0.0, label: "", optCount: null, optFlag: null }; + assert.deepEqual(exports.roundTripDataPoint(data2), data2); + + const contact1 = { + name: "Alice", + age: 30, + address: { street: "123 Main St", city: "NYC", zipCode: 10001 }, + email: "alice@test.com", + secondaryAddress: { street: "456 Oak Ave", city: "LA", zipCode: null } + }; + assert.deepEqual(exports.roundTripContact(contact1), contact1); + const contact2 = { + name: "Bob", + age: 25, + address: { street: "789 Pine Rd", city: "SF", zipCode: null }, + email: null, + secondaryAddress: null + }; + assert.deepEqual(exports.roundTripContact(contact2), contact2); + + const config1 = { + name: "prod", + theme: exports.Theme.Dark, + direction: exports.Direction.North, + status: exports.Status.Success + }; + assert.deepEqual(exports.roundTripConfig(config1), config1); + const config2 = { + name: "dev", + theme: null, + direction: null, + status: exports.Status.Loading + }; + assert.deepEqual(exports.roundTripConfig(config2), config2); + + const owner1 = new exports.Greeter("TestUser"); + const session1 = { id: 123, owner: owner1 }; + const resultSession1 = exports.roundTripSessionData(session1); + assert.equal(resultSession1.id, 123); + assert.equal(resultSession1.owner.greet(), "Hello, TestUser!"); + const session2 = { id: 456, owner: null }; + assert.deepEqual(exports.roundTripSessionData(session2), session2); + owner1.release(); + resultSession1.owner.release(); + + const report1 = { + id: 100, + result: { tag: exports.APIResult.Tag.Success, param0: "ok" }, + status: exports.Status.Success, + outcome: { tag: exports.APIResult.Tag.Info } + }; + assert.deepEqual(exports.roundTripValidationReport(report1), report1); + const report2 = { + id: 200, + result: { tag: exports.APIResult.Tag.Failure, param0: 404 }, + status: null, + outcome: null + }; + assert.deepEqual(exports.roundTripValidationReport(report2), report2); + + const origReport = { + id: 999, + result: { tag: exports.APIResult.Tag.Failure, param0: 500 }, + status: exports.Status.Error, + outcome: { tag: exports.APIResult.Tag.Info } + }; + const updatedReport = exports.updateValidationReport( + { tag: exports.APIResult.Tag.Success, param0: "updated" }, + origReport + ); + assert.deepEqual(updatedReport.result, { tag: exports.APIResult.Tag.Success, param0: "updated" }); + assert.deepEqual(exports.updateValidationReport(null, origReport).result, origReport.result); + + assert.equal(exports.MathOperations.subtract(10.0, 4.0), 6.0); + const mathOps = exports.MathOperations.init(); + assert.equal(mathOps.add(5.0, 3.0), 8.0); + assert.equal(mathOps.multiply(4.0, 7.0), 28.0); + + const container = exports.testContainerWithStruct({ x: 5.0, y: 10.0, label: "test", optCount: null, optFlag: true }); + assert.equal(container.location.x, 5.0); + assert.equal(container.config, null); + container.release(); + + assert.equal(exports.ConfigStruct.defaultConfig, "production"); + assert.equal(exports.ConfigStruct.maxRetries, 3); + assert.equal(exports.ConfigStruct.computedSetting, "Config: production"); + exports.ConfigStruct.defaultConfig = "staging"; + assert.equal(exports.ConfigStruct.computedSetting, "Config: staging"); + exports.ConfigStruct.defaultConfig = "production"; +} /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ async function BridgeJSRuntimeTests_runAsyncWorks(exports) { From 0872dbd7e2dd9c4a3a315d141ef2fd51e4b109ef Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Mon, 22 Dec 2025 23:04:04 +0700 Subject: [PATCH 053/252] BridgeJS: Add default parameters to struct and enable struct as default parameter --- .../Sources/BridgeJSCore/ExportSwift.swift | 79 +++-- .../Sources/BridgeJSLink/BridgeJSLink.swift | 174 +++++----- .../Sources/BridgeJSLink/JSGlueGen.swift | 3 +- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 12 + .../Inputs/DefaultParameters.swift | 45 +-- .../DefaultParameters.Export.d.ts | 32 +- .../DefaultParameters.Export.js | 107 +++++- .../ExportSwiftTests/DefaultParameters.json | 315 +++++++++++++++++- .../ExportSwiftTests/DefaultParameters.swift | 106 +++++- .../Exporting-Swift-Default-Parameters.md | 40 ++- .../BridgeJSRuntimeTests/ExportAPITests.swift | 24 +- .../Generated/BridgeJS.ExportSwift.swift | 20 +- .../JavaScript/BridgeJS.ExportSwift.json | 99 ++++++ Tests/prelude.mjs | 14 +- 14 files changed, 876 insertions(+), 194 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 436e264d0..2a2a19266 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -316,50 +316,77 @@ public class ExportSwift { return nil } - let className = calledExpr.baseName.text - let expectedClassName: String? + let typeName = calledExpr.baseName.text + + let isStructType: Bool + let expectedTypeName: String? switch type { - case .swiftHeapObject(let name): - expectedClassName = name.split(separator: ".").last.map(String.init) - case .optional(.swiftHeapObject(let name)): - expectedClassName = name.split(separator: ".").last.map(String.init) + case .swiftStruct(let name), .optional(.swiftStruct(let name)): + isStructType = true + expectedTypeName = name.split(separator: ".").last.map(String.init) + case .swiftHeapObject(let name), .optional(.swiftHeapObject(let name)): + isStructType = false + expectedTypeName = name.split(separator: ".").last.map(String.init) default: diagnose( node: funcCall, - message: "Constructor calls are only supported for class types", - hint: "Parameter type should be a Swift class" + message: "Constructor calls are only supported for class and struct types", + hint: "Parameter type should be a Swift class or struct" ) return nil } - guard let expectedClassName = expectedClassName, className == expectedClassName else { + guard let expectedTypeName = expectedTypeName, typeName == expectedTypeName else { diagnose( node: funcCall, - message: "Constructor class name '\(className)' doesn't match parameter type", + message: "Constructor type name '\(typeName)' doesn't match parameter type", hint: "Ensure the constructor matches the parameter type" ) return nil } - if funcCall.arguments.isEmpty { - return .object(className) - } - - var constructorArgs: [DefaultValue] = [] - for argument in funcCall.arguments { - guard let argValue = extractLiteralValue(from: argument.expression) else { - diagnose( - node: argument.expression, - message: "Constructor argument must be a literal value", - hint: "Use simple literals like \"text\", 42, true, false in constructor arguments" - ) - return nil + if isStructType { + // For structs, extract field name/value pairs + var fields: [DefaultValueField] = [] + for argument in funcCall.arguments { + guard let fieldName = argument.label?.text else { + diagnose( + node: argument, + message: "Struct initializer arguments must have labels", + hint: "Use labeled arguments like MyStruct(x: 1, y: 2)" + ) + return nil + } + guard let fieldValue = extractLiteralValue(from: argument.expression) else { + diagnose( + node: argument.expression, + message: "Struct field value must be a literal", + hint: "Use simple literals like \"text\", 42, true, false in struct fields" + ) + return nil + } + fields.append(DefaultValueField(name: fieldName, value: fieldValue)) + } + return .structLiteral(typeName, fields) + } else { + if funcCall.arguments.isEmpty { + return .object(typeName) } - constructorArgs.append(argValue) + var constructorArgs: [DefaultValue] = [] + for argument in funcCall.arguments { + guard let argValue = extractLiteralValue(from: argument.expression) else { + diagnose( + node: argument.expression, + message: "Constructor argument must be a literal value", + hint: "Use simple literals like \"text\", 42, true, false in constructor arguments" + ) + return nil + } + constructorArgs.append(argValue) + } + return .objectWithArguments(typeName, constructorArgs) } - - return .objectWithArguments(className, constructorArgs) } /// Extracts a literal value from an expression with optional type checking diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 3e815b717..32a211716 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -1254,16 +1254,6 @@ struct BridgeJSLink { ] } - func generateParameterList(parameters: [Parameter]) -> String { - parameters.map { param in - if let defaultValue = param.defaultValue { - let defaultJs = DefaultValueGenerator().generate(defaultValue, format: .javascript) - return "\(param.name) = \(defaultJs)" - } - return param.name - }.joined(separator: ", ") - } - func renderFunction( name: String, parameters: [Parameter], @@ -1272,7 +1262,7 @@ struct BridgeJSLink { ) -> [String] { let printer = CodeFragmentPrinter() - let parameterList = generateParameterList(parameters: parameters) + let parameterList = DefaultValueUtils.formatParameterList(parameters) printer.write( "\(declarationPrefixKeyword.map { "\($0) "} ?? "")\(name)(\(parameterList)) {" @@ -1350,76 +1340,10 @@ struct BridgeJSLink { /// Helper method to append JSDoc comments for parameters with default values private func appendJSDocIfNeeded(for parameters: [Parameter], to lines: inout [String]) { - let jsDocLines = DefaultValueGenerator().generateJSDoc(for: parameters) + let jsDocLines = DefaultValueUtils.formatJSDoc(for: parameters) lines.append(contentsOf: jsDocLines) } - /// Helper struct for generating default value representations - private struct DefaultValueGenerator { - enum OutputFormat { - case javascript - case typescript - } - - /// Generates default value representation for JavaScript or TypeScript - func generate(_ defaultValue: DefaultValue, format: OutputFormat) -> String { - switch defaultValue { - case .string(let value): - let escapedValue = - format == .javascript - ? escapeForJavaScript(value) - : value // TypeScript doesn't need escape in doc comments - return "\"\(escapedValue)\"" - case .int(let value): - return "\(value)" - case .float(let value): - return "\(value)" - case .double(let value): - return "\(value)" - case .bool(let value): - return value ? "true" : "false" - case .null: - return "null" - case .enumCase(let enumName, let caseName): - let simpleName = enumName.components(separatedBy: ".").last ?? enumName - let jsEnumName = format == .javascript ? "\(simpleName)\(ExportedEnum.valuesSuffix)" : simpleName - return "\(jsEnumName).\(caseName.capitalizedFirstLetter)" - case .object(let className): - return "new \(className)()" - case .objectWithArguments(let className, let args): - let argStrings = args.map { arg in - generate(arg, format: format) - } - return "new \(className)(\(argStrings.joined(separator: ", ")))" - } - } - - private func escapeForJavaScript(_ string: String) -> String { - return - string - .replacingOccurrences(of: "\\", with: "\\\\") - .replacingOccurrences(of: "\"", with: "\\\"") - } - - /// Generates JSDoc comment lines for parameters with default values - func generateJSDoc(for parameters: [Parameter]) -> [String] { - let paramsWithDefaults = parameters.filter { $0.hasDefault } - guard !paramsWithDefaults.isEmpty else { - return [] - } - - var jsDocLines: [String] = ["/**"] - for param in paramsWithDefaults { - if let defaultValue = param.defaultValue { - let defaultDoc = generate(defaultValue, format: .typescript) - jsDocLines.append(" * @param \(param.name) - Optional parameter (default: \(defaultDoc))") - } - } - jsDocLines.append(" */") - return jsDocLines - } - } - func renderExportedStruct( _ structDefinition: ExportedStruct ) throws -> (js: [String], dtsType: [String], dtsExportEntry: [String]) { @@ -1437,6 +1361,8 @@ struct BridgeJSLink { dtsTypePrinter.write("\(property.name): \(tsType);") } for method in structDefinition.methods where !method.effects.isStatic { + let jsDocLines = DefaultValueUtils.formatJSDoc(for: method.parameters) + dtsTypePrinter.write(lines: jsDocLines) let signature = renderTSSignature( parameters: method.parameters, returnType: method.returnType, @@ -1466,7 +1392,7 @@ struct BridgeJSLink { ) let constructorPrinter = CodeFragmentPrinter() - let paramList = thunkBuilder.generateParameterList(parameters: constructor.parameters) + let paramList = DefaultValueUtils.formatParameterList(constructor.parameters) constructorPrinter.write("init: function(\(paramList)) {") constructorPrinter.indent { constructorPrinter.write(contentsOf: thunkBuilder.body) @@ -1499,6 +1425,8 @@ struct BridgeJSLink { dtsExportEntryPrinter.write("\(structName): {") dtsExportEntryPrinter.indent { if let constructor = structDefinition.constructor { + let jsDocLines = DefaultValueUtils.formatJSDoc(for: constructor.parameters) + dtsExportEntryPrinter.write(lines: jsDocLines) dtsExportEntryPrinter.write( "init\(renderTSSignature(parameters: constructor.parameters, returnType: .swiftStruct(structDefinition.swiftCallName), effects: constructor.effects));" ) @@ -1508,6 +1436,8 @@ struct BridgeJSLink { dtsExportEntryPrinter.write("\(readonly)\(property.name): \(resolveTypeScriptType(property.type));") } for method in staticMethods { + let jsDocLines = DefaultValueUtils.formatJSDoc(for: method.parameters) + dtsExportEntryPrinter.write(lines: jsDocLines) dtsExportEntryPrinter.write( "\(method.name)\(renderTSSignature(parameters: method.parameters, returnType: method.returnType, effects: method.effects));" ) @@ -1930,7 +1860,7 @@ extension BridgeJSLink { try thunkBuilder.lowerParameter(param: param) } - let constructorParamList = thunkBuilder.generateParameterList(parameters: constructor.parameters) + let constructorParamList = DefaultValueUtils.formatParameterList(constructor.parameters) jsPrinter.indent { jsPrinter.write("constructor(\(constructorParamList)) {") @@ -1945,7 +1875,7 @@ extension BridgeJSLink { } dtsExportEntryPrinter.indent { - let jsDocLines = DefaultValueGenerator().generateJSDoc(for: constructor.parameters) + let jsDocLines = DefaultValueUtils.formatJSDoc(for: constructor.parameters) for line in jsDocLines { dtsExportEntryPrinter.write(line) } @@ -3173,6 +3103,88 @@ extension BridgeJSLink { } } +/// Utility enum for generating default value representations in JavaScript/TypeScript +enum DefaultValueUtils { + enum OutputFormat { + case javascript + case typescript + } + + /// Generates default value representation for JavaScript or TypeScript + static func format(_ defaultValue: DefaultValue, as format: OutputFormat) -> String { + switch defaultValue { + case .string(let value): + let escapedValue = + format == .javascript + ? escapeForJavaScript(value) + : value // TypeScript doesn't need escape in doc comments + return "\"\(escapedValue)\"" + case .int(let value): + return "\(value)" + case .float(let value): + return "\(value)" + case .double(let value): + return "\(value)" + case .bool(let value): + return value ? "true" : "false" + case .null: + return "null" + case .enumCase(let enumName, let caseName): + let simpleName = enumName.components(separatedBy: ".").last ?? enumName + let jsEnumName = format == .javascript ? "\(simpleName)\(ExportedEnum.valuesSuffix)" : simpleName + return "\(jsEnumName).\(caseName.capitalizedFirstLetter)" + case .object(let className): + return "new \(className)()" + case .objectWithArguments(let className, let args): + let argStrings = args.map { arg in + Self.format(arg, as: format) + } + return "new \(className)(\(argStrings.joined(separator: ", ")))" + case .structLiteral(_, let fields): + let fieldStrings = fields.map { field in + "\(field.name): \(Self.format(field.value, as: format))" + } + return "{ \(fieldStrings.joined(separator: ", ")) }" + } + } + + private static func escapeForJavaScript(_ string: String) -> String { + return + string + .replacingOccurrences(of: "\\", with: "\\\\") + .replacingOccurrences(of: "\"", with: "\\\"") + } + + /// Generates JSDoc comment lines for parameters with default values + static func formatJSDoc(for parameters: [Parameter]) -> [String] { + let paramsWithDefaults = parameters.filter { $0.hasDefault } + guard !paramsWithDefaults.isEmpty else { + return [] + } + + var jsDocLines: [String] = ["/**"] + for param in paramsWithDefaults { + if let defaultValue = param.defaultValue { + let defaultDoc = format(defaultValue, as: .typescript) + jsDocLines.append(" * @param \(param.name) - Optional parameter (default: \(defaultDoc))") + } + } + jsDocLines.append(" */") + return jsDocLines + } + + /// Generates a JavaScript parameter list with default values + static func formatParameterList(_ parameters: [Parameter]) -> String { + return parameters.map { param in + if let defaultValue = param.defaultValue { + let defaultJs = format(defaultValue, as: .javascript) + return "\(param.name) = \(defaultJs)" + } + return param.name + }.joined(separator: ", ") + } +} + struct BridgeJSLinkError: Error { let message: String } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index d1bdf63ae..23fb2b533 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -2135,8 +2135,9 @@ struct IntrinsicJSFragment: Sendable { // Attach instance methods to the struct instance for method in structDef.methods where !method.effects.isStatic { + let paramList = DefaultValueUtils.formatParameterList(method.parameters) printer.write( - "\(instanceVar).\(method.name) = function(\(method.parameters.map { $0.name }.joined(separator: ", "))) {" + "\(instanceVar).\(method.name) = function(\(paramList)) {" ) printer.indent { let methodScope = JSGlueVariableScope() diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index e80d1c827..b2dae86c0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -160,6 +160,17 @@ public enum SwiftEnumRawType: String, CaseIterable, Codable, Sendable { } } +/// Represents a struct field with name and default value for default parameter values +public struct DefaultValueField: Codable, Equatable, Sendable { + public let name: String + public let value: DefaultValue + + public init(name: String, value: DefaultValue) { + self.name = name + self.value = value + } +} + public enum DefaultValue: Codable, Equatable, Sendable { case string(String) case int(Int) @@ -170,6 +181,7 @@ public enum DefaultValue: Codable, Equatable, Sendable { case enumCase(String, String) // enumName, caseName case object(String) // className for parameterless constructor case objectWithArguments(String, [DefaultValue]) // className, constructor argument values + case structLiteral(String, [DefaultValueField]) // structName, field name/value pairs } public struct Parameter: Codable, Equatable, Sendable { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/DefaultParameters.swift index b670d2dbb..73274ad5c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/DefaultParameters.swift @@ -28,13 +28,11 @@ @JS class DefaultGreeter { @JS var name: String - @JS init(name: String) { - self.name = name - } + @JS init(name: String) } @JS class EmptyGreeter { - @JS init() {} + @JS init() } @JS public func testComplexInit(greeter: DefaultGreeter = DefaultGreeter(name: "DefaultUser")) -> DefaultGreeter @@ -53,22 +51,25 @@ enabled: Bool = true, status: Status = .active, tag: String? = nil - ) { - self.name = name - self.count = count - self.enabled = enabled - self.status = status - self.tag = tag - } - - @JS func describe() -> String { - let tagStr = tag ?? "nil" - let statusStr: String - switch status { - case .active: statusStr = "active" - case .inactive: statusStr = "inactive" - case .pending: statusStr = "pending" - } - return "\(name):\(count):\(enabled):\(statusStr):\(tagStr)" - } + ) +} + +@JS struct Config { + var name: String + var value: Int + var enabled: Bool +} + +@JS public func testOptionalStructDefault(point: Config? = nil) -> Config? +@JS public func testOptionalStructWithValueDefault( + point: Config? = Config(name: "default", value: 42, enabled: true) +) -> Config? + +@JS struct MathOperations { + var baseValue: Double + + @JS init(baseValue: Double = 0.0) + @JS func add(a: Double, b: Double = 10.0) -> Double + @JS func multiply(a: Double, b: Double) -> Double + @JS static func subtract(a: Double, b: Double = 5.0) -> Double } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.d.ts index 38cbf989c..c024ecfb6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.d.ts @@ -11,6 +11,19 @@ export const StatusValues: { }; export type StatusTag = typeof StatusValues[keyof typeof StatusValues]; +export interface Config { + name: string; + value: number; + enabled: boolean; +} +export interface MathOperations { + baseValue: number; + /** + * @param b - Optional parameter (default: 10.0) + */ + add(a: number, b?: number): number; + multiply(a: number, b: number): number; +} export type StatusObject = typeof StatusValues; /// Represents a Swift heap object like a class instance or an actor instance. @@ -26,7 +39,6 @@ export interface DefaultGreeter extends SwiftHeapObject { export interface EmptyGreeter extends SwiftHeapObject { } export interface ConstructorDefaults extends SwiftHeapObject { - describe(): string; name: string; count: number; enabled: boolean; @@ -96,7 +108,25 @@ export type Exports = { * @param greeter - Optional parameter (default: new EmptyGreeter()) */ testEmptyInit(greeter?: EmptyGreeter): EmptyGreeter; + /** + * @param point - Optional parameter (default: null) + */ + testOptionalStructDefault(point?: Config | null): Config | null; + /** + * @param point - Optional parameter (default: { name: "default", value: 42, enabled: true }) + */ + testOptionalStructWithValueDefault(point?: Config | null): Config | null; Status: StatusObject + MathOperations: { + /** + * @param baseValue - Optional parameter (default: 0.0) + */ + init(baseValue?: number): MathOperations; + /** + * @param b - Optional parameter (default: 5.0) + */ + subtract(a: number, b?: number): number; + } } export type Imports = { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index ba9eac2fb..9836ffe95 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -34,9 +34,57 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const structHelpers = {}; let _exports = null; let bjs = null; + const __bjs_createConfigHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + const bytes = textEncoder.encode(value.name); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + tmpParamInts.push((value.value | 0)); + tmpParamInts.push(value.enabled ? 1 : 0); + const cleanup = () => { + swift.memory.release(id); + }; + return { cleanup }; + }, + raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + const bool = tmpRetInts.pop() !== 0; + const int = tmpRetInts.pop(); + const string = tmpRetStrings.pop(); + return { name: string, value: int, enabled: bool }; + } + }); + }; + const __bjs_createMathOperationsHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + tmpParamF64s.push(value.baseValue); + return { cleanup: undefined }; + }, + raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + const f64 = tmpRetF64s.pop(); + const instance1 = { baseValue: f64 }; + instance1.add = function(a, b = 10.0) { + const { cleanup: structCleanup } = structHelpers.MathOperations.lower(this); + const ret = instance.exports.bjs_MathOperations_add(a, b); + if (structCleanup) { structCleanup(); } + return ret; + }.bind(instance1); + instance1.multiply = function(a, b) { + const { cleanup: structCleanup } = structHelpers.MathOperations.lower(this); + const ret = instance.exports.bjs_MathOperations_multiply(a, b); + if (structCleanup) { structCleanup(); } + return ret; + }.bind(instance1); + return instance1; + } + }); + }; return { /** @@ -298,12 +346,6 @@ export async function createInstantiator(options, swift) { } return ConstructorDefaults.__construct(ret); } - describe() { - instance.exports.bjs_ConstructorDefaults_describe(this.pointer); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } get name() { instance.exports.bjs_ConstructorDefaults_name_get(this.pointer); const ret = tmpRetString; @@ -356,6 +398,12 @@ 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, @@ -436,7 +484,54 @@ export async function createInstantiator(options, swift) { const ret = instance.exports.bjs_testEmptyInit(greeter.pointer); return EmptyGreeter.__construct(ret); }, + testOptionalStructDefault: function bjs_testOptionalStructDefault(point = null) { + const isSome = point != null; + let pointCleanup; + if (isSome) { + const structResult = structHelpers.Config.lower(point); + pointCleanup = structResult.cleanup; + } + instance.exports.bjs_testOptionalStructDefault(+isSome); + const isSome1 = tmpRetInts.pop(); + let optResult; + if (isSome1) { + optResult = structHelpers.Config.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + } else { + optResult = null; + } + if (pointCleanup) { pointCleanup(); } + return optResult; + }, + testOptionalStructWithValueDefault: function bjs_testOptionalStructWithValueDefault(point = { name: "default", value: 42, enabled: true }) { + const isSome = point != null; + let pointCleanup; + if (isSome) { + const structResult = structHelpers.Config.lower(point); + pointCleanup = structResult.cleanup; + } + instance.exports.bjs_testOptionalStructWithValueDefault(+isSome); + const isSome1 = tmpRetInts.pop(); + let optResult; + if (isSome1) { + optResult = structHelpers.Config.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + } else { + optResult = null; + } + if (pointCleanup) { pointCleanup(); } + return optResult; + }, Status: StatusValues, + MathOperations: { + init: function(baseValue = 0.0) { + instance.exports.bjs_MathOperations_init(baseValue); + const structValue = structHelpers.MathOperations.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return structValue; + }, + subtract: function(a, b) { + const ret = instance.exports.bjs_MathOperations_static_subtract(a, b); + return ret; + }, + }, }; _exports = exports; return exports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json index 66b4dcc41..7e614a324 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json @@ -146,23 +146,7 @@ ] }, "methods" : [ - { - "abiName" : "bjs_ConstructorDefaults_describe", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "describe", - "parameters" : [ - ], - "returnType" : { - "string" : { - - } - } - } ], "name" : "ConstructorDefaults", "properties" : [ @@ -642,6 +626,108 @@ "_0" : "EmptyGreeter" } } + }, + { + "abiName" : "bjs_testOptionalStructDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testOptionalStructDefault", + "parameters" : [ + { + "defaultValue" : { + "null" : { + + } + }, + "label" : "point", + "name" : "point", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } + }, + { + "abiName" : "bjs_testOptionalStructWithValueDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testOptionalStructWithValueDefault", + "parameters" : [ + { + "defaultValue" : { + "structLiteral" : { + "_0" : "Config", + "_1" : [ + { + "name" : "name", + "value" : { + "string" : { + "_0" : "default" + } + } + }, + { + "name" : "value", + "value" : { + "int" : { + "_0" : 42 + } + } + }, + { + "name" : "enabled", + "value" : { + "bool" : { + "_0" : true + } + } + } + ] + } + }, + "label" : "point", + "name" : "point", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } } ], "moduleName" : "TestModule", @@ -649,6 +735,203 @@ ], "structs" : [ + { + "methods" : [ + + ], + "name" : "Config", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "value", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "enabled", + "type" : { + "bool" : { + + } + } + } + ], + "swiftCallName" : "Config" + }, + { + "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" + } ] } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index 525782c4f..03d037e98 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -45,6 +45,79 @@ extension Status: _BridgedSwiftCaseEnum { } } +extension Config: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Config { + let enabled = Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let value = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + return Config(name: name, value: value, enabled: enabled) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + var __bjs_name = self.name + __bjs_name.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(self.value)) + _swift_js_push_int(self.enabled ? 1 : 0) + } +} + +extension MathOperations: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MathOperations { + let baseValue = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + return MathOperations(baseValue: baseValue) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_f64(self.baseValue) + } +} + +@_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 +} + @_expose(wasm, "bjs_testStringDefault") @_cdecl("bjs_testStringDefault") public func _bjs_testStringDefault(messageBytes: Int32, messageLength: Int32) -> Void { @@ -166,6 +239,28 @@ public func _bjs_testEmptyInit(greeter: UnsafeMutableRawPointer) -> UnsafeMutabl #endif } +@_expose(wasm, "bjs_testOptionalStructDefault") +@_cdecl("bjs_testOptionalStructDefault") +public func _bjs_testOptionalStructDefault(point: Int32) -> Void { + #if arch(wasm32) + let ret = testOptionalStructDefault(point: Optional.bridgeJSLiftParameter(point)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_testOptionalStructWithValueDefault") +@_cdecl("bjs_testOptionalStructWithValueDefault") +public func _bjs_testOptionalStructWithValueDefault(point: Int32) -> Void { + #if arch(wasm32) + let ret = testOptionalStructWithValueDefault(point: Optional.bridgeJSLiftParameter(point)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_DefaultGreeter_init") @_cdecl("bjs_DefaultGreeter_init") public func _bjs_DefaultGreeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMutableRawPointer { @@ -262,17 +357,6 @@ public func _bjs_ConstructorDefaults_init(nameBytes: Int32, nameLength: Int32, c #endif } -@_expose(wasm, "bjs_ConstructorDefaults_describe") -@_cdecl("bjs_ConstructorDefaults_describe") -public func _bjs_ConstructorDefaults_describe(_self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = ConstructorDefaults.bridgeJSLiftParameter(_self).describe() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - @_expose(wasm, "bjs_ConstructorDefaults_name_get") @_cdecl("bjs_ConstructorDefaults_name_get") public func _bjs_ConstructorDefaults_name_get(_self: UnsafeMutableRawPointer) -> Void { diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md index 11574f0d0..9eec622f0 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md @@ -107,41 +107,45 @@ The following default value types are supported for both function and constructo | Nil for optionals | `nil` | `null` | | Enum cases (shorthand) | `.north` | `Direction.North` | | Enum cases (qualified) | `Direction.north` | `Direction.North` | -| Object initialization (no args) | `MyClass()` | `new MyClass()` | -| Object initialization (literal args) | `MyClass("value", 42)` | `new MyClass("value", 42)` | +| Class initialization (no args) | `MyClass()` | `new MyClass()` | +| Class initialization (literal args) | `MyClass("value", 42)` | `new MyClass("value", 42)` | +| Struct initialization | `Point(x: 1.0, y: 2.0)` | `{ x: 1.0, y: 2.0 }` | -## Working with Class Instances as Default Parameters +## Working with Class and Struct Defaults -You can use class initialization expressions as default values: +You can use class or struct initialization expressions as default values: ```swift +@JS struct Point { + var x: Double + var y: Double +} + @JS class Config { var setting: String - - @JS init(setting: String) { - self.setting = setting - } + @JS init(setting: String) { self.setting = setting } } -@JS public func process(config: Config = Config(setting: "default")) -> String { - return "Using: \(config.setting)" -} +@JS public func processPoint(point: Point = Point(x: 0.0, y: 0.0)) -> String +@JS public func processConfig(config: Config = Config(setting: "default")) -> String ``` -In JavaScript: +In JavaScript, structs become object literals while classes use constructor calls: ```javascript -exports.process(); // "Using: default" +exports.processPoint(); // uses default { x: 0.0, y: 0.0 } +exports.processPoint({ x: 5.0, y: 10.0 }); // custom struct +exports.processConfig(); // uses default new Config("default") const custom = new exports.Config("custom"); -exports.process(custom); // "Using: custom" +exports.processConfig(custom); // custom instance custom.release(); ``` -**Limitations for object initialization:** -- Constructor arguments must be literal values (`"text"`, `42`, `true`, `false`, `nil`) -- Complex expressions in constructor arguments are not supported -- Computed properties or method calls as arguments are not supported +**Requirements:** +- Constructor/initializer arguments must be literal values (`"text"`, `42`, `true`, `false`, `nil`) +- Struct initializers must use labeled arguments (e.g., `Point(x: 1.0, y: 2.0)`) +- Complex expressions, computed properties, or method calls are not supported ## Unsupported Default Value Types diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index b3aa84c18..7f2dab8ee 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -1,6 +1,5 @@ import XCTest import JavaScriptKit -import JavaScriptEventLoop @_extern(wasm, module: "BridgeJSRuntimeTests", name: "runJsWorks") @_extern(c) @@ -1284,9 +1283,14 @@ enum APIOptionalResult { } @JS struct MathOperations { - @JS init() {} - @JS func add(a: Double, b: Double) -> Double { - return a + b + var baseValue: Double + + @JS init(baseValue: Double = 0.0) { + self.baseValue = baseValue + } + + @JS func add(a: Double, b: Double = 10.0) -> Double { + return baseValue + a + b } @JS func multiply(a: Double, b: Double) -> Double { @@ -1298,6 +1302,12 @@ enum APIOptionalResult { } } +@JS func testStructDefault( + point: DataPoint = DataPoint(x: 1.0, y: 2.0, label: "default", optCount: nil, optFlag: nil) +) -> String { + return "\(point.x),\(point.y),\(point.label)" +} + @JS struct ConfigStruct { var name: String var value: Int @@ -1373,7 +1383,7 @@ class ExportAPITests: XCTestCase { XCTAssertTrue(hasDeinitCalculator, "Calculator (without @JS init) should have been deinitialized") } - func testAllAsync() async throws { - _ = try await runAsyncWorks().value() - } + // func testAllAsync() async throws { + // _ = try await runAsyncWorks().value() + // } } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index dcae4a744..addeedb1e 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -2182,19 +2182,20 @@ extension ValidationReport: _BridgedSwiftStruct { extension MathOperations: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MathOperations { - return MathOperations() + let baseValue = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + return MathOperations(baseValue: baseValue) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - + _swift_js_push_f64(self.baseValue) } } @_expose(wasm, "bjs_MathOperations_init") @_cdecl("bjs_MathOperations_init") -public func _bjs_MathOperations_init() -> Void { +public func _bjs_MathOperations_init(baseValue: Float64) -> Void { #if arch(wasm32) - let ret = MathOperations() + let ret = MathOperations(baseValue: Double.bridgeJSLiftParameter(baseValue)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -3617,6 +3618,17 @@ public func _bjs_makeAdder(base: Int32) -> UnsafeMutableRawPointer { #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_roundTripDataPoint") @_cdecl("bjs_roundTripDataPoint") public func _bjs_roundTripDataPoint() -> Void { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json index 751d6519d..872af0251 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -7644,6 +7644,78 @@ } } }, + { + "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_roundTripDataPoint", "effects" : { @@ -8613,7 +8685,20 @@ "isThrows" : false }, "parameters" : [ + { + "defaultValue" : { + "double" : { + "_0" : 0 + } + }, + "label" : "baseValue", + "name" : "baseValue", + "type" : { + "double" : { + } + } + } ] }, "methods" : [ @@ -8636,6 +8721,11 @@ } }, { + "defaultValue" : { + "double" : { + "_0" : 10 + } + }, "label" : "b", "name" : "b", "type" : { @@ -8727,7 +8817,16 @@ ], "name" : "MathOperations", "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "baseValue", + "type" : { + "double" : { + } + } + } ], "swiftCallName" : "MathOperations" }, diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index eaef7ca15..a5611523c 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -574,7 +574,7 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { const apiSuccess = { tag: exports.APIResult.Tag.Success, param0: "test success" }; const apiFailure = { tag: exports.APIResult.Tag.Failure, param0: 404 }; const apiInfo = { tag: exports.APIResult.Tag.Info }; - + assert.equal(exports.compareAPIResults(apiSuccess, apiFailure), "r1:success:test success,r2:failure:404"); assert.equal(exports.compareAPIResults(null, apiInfo), "r1:nil,r2:info"); assert.equal(exports.compareAPIResults(apiFailure, null), "r1:failure:404,r2:nil"); @@ -985,9 +985,21 @@ function testStructSupport(exports) { assert.equal(exports.MathOperations.subtract(10.0, 4.0), 6.0); const mathOps = exports.MathOperations.init(); + assert.equal(mathOps.baseValue, 0.0); assert.equal(mathOps.add(5.0, 3.0), 8.0); assert.equal(mathOps.multiply(4.0, 7.0), 28.0); + const mathOps2 = exports.MathOperations.init(100.0); + assert.equal(mathOps2.baseValue, 100.0); + assert.equal(mathOps2.add(5.0, 3.0), 108.0); + + assert.equal(mathOps.add(5.0), 15.0); + assert.equal(mathOps2.add(5.0), 115.0); + + assert.equal(exports.testStructDefault(), "1.0,2.0,default"); + const customPoint = { x: 10.0, y: 20.0, label: "custom", optCount: null, optFlag: null }; + assert.equal(exports.testStructDefault(customPoint), "10.0,20.0,custom"); + const container = exports.testContainerWithStruct({ x: 5.0, y: 10.0, label: "test", optCount: null, optFlag: true }); assert.equal(container.location.x, 5.0); assert.equal(container.config, null); From ba38ba68d713f132dbf30fe32954622d3d5c8a80 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 23 Dec 2025 19:02:59 +0700 Subject: [PATCH 054/252] BridgeJS: Struct and struct vs classes benchmarks --- Benchmarks/Sources/Benchmarks.swift | 130 +++ .../Generated/BridgeJS.ExportSwift.swift | 588 ++++++++++++ .../JavaScript/BridgeJS.ExportSwift.json | 851 ++++++++++++++++++ Benchmarks/run.js | 132 ++- 4 files changed, 1700 insertions(+), 1 deletion(-) diff --git a/Benchmarks/Sources/Benchmarks.swift b/Benchmarks/Sources/Benchmarks.swift index b05075eb3..661aba63e 100644 --- a/Benchmarks/Sources/Benchmarks.swift +++ b/Benchmarks/Sources/Benchmarks.swift @@ -111,6 +111,136 @@ enum ComplexResult { } } +// MARK: - Struct Performance Tests + +@JS struct SimpleStruct { + var name: String + var count: Int + var flag: Bool + var rate: Float + var precise: Double +} + +@JS struct Address { + var street: String + var city: String + var zipCode: Int +} + +@JS struct Person { + var name: String + var age: Int + var address: Address + var email: String? +} + +@JS struct ComplexStruct { + var id: Int + var title: String + var active: Bool + var score: Double + var tags: String + var metadata: String +} + +@JS class StructRoundtrip { + @JS init() {} + + @JS func takeSimple(_ value: SimpleStruct) {} + @JS func makeSimple() -> SimpleStruct { + return SimpleStruct(name: "Hello", count: 42, flag: true, rate: 0.5, precise: 3.14159) + } + @JS func roundtripSimple(_ value: SimpleStruct) -> SimpleStruct { + return value + } + + @JS func takeAddress(_ value: Address) {} + @JS func makeAddress() -> Address { + return Address(street: "123 Main St", city: "San Francisco", zipCode: 94102) + } + @JS func roundtripAddress(_ value: Address) -> Address { + return value + } + + @JS func takePerson(_ value: Person) {} + @JS func makePerson() -> Person { + return Person( + name: "John Doe", + age: 30, + address: Address(street: "456 Oak Ave", city: "New York", zipCode: 10001), + email: "john@example.com" + ) + } + @JS func roundtripPerson(_ value: Person) -> Person { + return value + } + + @JS func takeComplex(_ value: ComplexStruct) {} + @JS func makeComplex() -> ComplexStruct { + return ComplexStruct( + id: 12345, + title: "Test Item", + active: true, + score: 98.6, + tags: "swift,wasm,benchmark", + metadata: "{\"version\":1}" + ) + } + @JS func roundtripComplex(_ value: ComplexStruct) -> ComplexStruct { + return value + } +} + +// MARK: - Class vs Struct Comparison Tests + +@JS class SimpleClass { + @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 class AddressClass { + @JS var street: String + @JS var city: String + @JS var zipCode: Int + + @JS init(street: String, city: String, zipCode: Int) { + self.street = street + self.city = city + self.zipCode = zipCode + } +} + +@JS class ClassRoundtrip { + @JS init() {} + + @JS func takeSimpleClass(_ value: SimpleClass) {} + @JS func makeSimpleClass() -> SimpleClass { + return SimpleClass(name: "Hello", count: 42, flag: true, rate: 0.5, precise: 3.14159) + } + @JS func roundtripSimpleClass(_ value: SimpleClass) -> SimpleClass { + return value + } + + @JS func takeAddressClass(_ value: AddressClass) {} + @JS func makeAddressClass() -> AddressClass { + return AddressClass(street: "123 Main St", city: "San Francisco", zipCode: 94102) + } + @JS func roundtripAddressClass(_ value: AddressClass) -> AddressClass { + return value + } +} + @JS func run() { let call = Benchmark("Call") diff --git a/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift b/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift index 8fb5c97d7..fcec5e675 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift @@ -246,6 +246,106 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } } +extension SimpleStruct: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> SimpleStruct { + let precise = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let rate = Float.bridgeJSLiftParameter(_swift_js_pop_param_f32()) + let flag = Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let count = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + return SimpleStruct(name: name, count: count, flag: flag, rate: rate, precise: precise) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + var __bjs_name = self.name + __bjs_name.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(self.count)) + _swift_js_push_int(self.flag ? 1 : 0) + _swift_js_push_f32(self.rate) + _swift_js_push_f64(self.precise) + } +} + +extension Address: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Address { + let zipCode = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let city = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let street = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + return Address(street: street, city: city, zipCode: zipCode) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + var __bjs_street = self.street + __bjs_street.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + var __bjs_city = self.city + __bjs_city.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(self.zipCode)) + } +} + +extension Person: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Person { + let email = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let address = Address.bridgeJSLiftParameter() + let age = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + return Person(name: name, age: age, address: address, email: email) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + var __bjs_name = self.name + __bjs_name.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(self.age)) + self.address.bridgeJSLowerReturn() + let __bjs_isSome_email = self.email != nil + if let __bjs_unwrapped_email = self.email { + var __bjs_str_email = __bjs_unwrapped_email + __bjs_str_email.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + } + _swift_js_push_int(__bjs_isSome_email ? 1 : 0) + } +} + +extension ComplexStruct: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ComplexStruct { + let metadata = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let tags = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let score = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let active = Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let title = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let id = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + return ComplexStruct(id: id, title: title, active: active, score: score, tags: tags, metadata: metadata) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_int(Int32(self.id)) + var __bjs_title = self.title + __bjs_title.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(self.active ? 1 : 0) + _swift_js_push_f64(self.score) + var __bjs_tags = self.tags + __bjs_tags.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + var __bjs_metadata = self.metadata + __bjs_metadata.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + } +} + @_expose(wasm, "bjs_run") @_cdecl("bjs_run") public func _bjs_run() -> Void { @@ -556,4 +656,492 @@ fileprivate func _bjs_StringRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 fileprivate func _bjs_StringRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } +#endif + +@_expose(wasm, "bjs_StructRoundtrip_init") +@_cdecl("bjs_StructRoundtrip_init") +public func _bjs_StructRoundtrip_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = StructRoundtrip() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StructRoundtrip_takeSimple") +@_cdecl("bjs_StructRoundtrip_takeSimple") +public func _bjs_StructRoundtrip_takeSimple(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + StructRoundtrip.bridgeJSLiftParameter(_self).takeSimple(_: SimpleStruct.bridgeJSLiftParameter()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StructRoundtrip_makeSimple") +@_cdecl("bjs_StructRoundtrip_makeSimple") +public func _bjs_StructRoundtrip_makeSimple(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = StructRoundtrip.bridgeJSLiftParameter(_self).makeSimple() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StructRoundtrip_roundtripSimple") +@_cdecl("bjs_StructRoundtrip_roundtripSimple") +public func _bjs_StructRoundtrip_roundtripSimple(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = StructRoundtrip.bridgeJSLiftParameter(_self).roundtripSimple(_: SimpleStruct.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StructRoundtrip_takeAddress") +@_cdecl("bjs_StructRoundtrip_takeAddress") +public func _bjs_StructRoundtrip_takeAddress(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + StructRoundtrip.bridgeJSLiftParameter(_self).takeAddress(_: Address.bridgeJSLiftParameter()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StructRoundtrip_makeAddress") +@_cdecl("bjs_StructRoundtrip_makeAddress") +public func _bjs_StructRoundtrip_makeAddress(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = StructRoundtrip.bridgeJSLiftParameter(_self).makeAddress() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StructRoundtrip_roundtripAddress") +@_cdecl("bjs_StructRoundtrip_roundtripAddress") +public func _bjs_StructRoundtrip_roundtripAddress(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = StructRoundtrip.bridgeJSLiftParameter(_self).roundtripAddress(_: Address.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StructRoundtrip_takePerson") +@_cdecl("bjs_StructRoundtrip_takePerson") +public func _bjs_StructRoundtrip_takePerson(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + StructRoundtrip.bridgeJSLiftParameter(_self).takePerson(_: Person.bridgeJSLiftParameter()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StructRoundtrip_makePerson") +@_cdecl("bjs_StructRoundtrip_makePerson") +public func _bjs_StructRoundtrip_makePerson(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = StructRoundtrip.bridgeJSLiftParameter(_self).makePerson() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StructRoundtrip_roundtripPerson") +@_cdecl("bjs_StructRoundtrip_roundtripPerson") +public func _bjs_StructRoundtrip_roundtripPerson(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = StructRoundtrip.bridgeJSLiftParameter(_self).roundtripPerson(_: Person.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StructRoundtrip_takeComplex") +@_cdecl("bjs_StructRoundtrip_takeComplex") +public func _bjs_StructRoundtrip_takeComplex(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + StructRoundtrip.bridgeJSLiftParameter(_self).takeComplex(_: ComplexStruct.bridgeJSLiftParameter()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StructRoundtrip_makeComplex") +@_cdecl("bjs_StructRoundtrip_makeComplex") +public func _bjs_StructRoundtrip_makeComplex(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = StructRoundtrip.bridgeJSLiftParameter(_self).makeComplex() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StructRoundtrip_roundtripComplex") +@_cdecl("bjs_StructRoundtrip_roundtripComplex") +public func _bjs_StructRoundtrip_roundtripComplex(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = StructRoundtrip.bridgeJSLiftParameter(_self).roundtripComplex(_: ComplexStruct.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StructRoundtrip_deinit") +@_cdecl("bjs_StructRoundtrip_deinit") +public func _bjs_StructRoundtrip_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension StructRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_StructRoundtrip_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_StructRoundtrip_wrap") +fileprivate func _bjs_StructRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_StructRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_SimpleClass_init") +@_cdecl("bjs_SimpleClass_init") +public func _bjs_SimpleClass_init(nameBytes: Int32, nameLength: Int32, count: Int32, flag: Int32, rate: Float32, precise: Float64) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = SimpleClass(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_SimpleClass_name_get") +@_cdecl("bjs_SimpleClass_name_get") +public func _bjs_SimpleClass_name_get(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SimpleClass.bridgeJSLiftParameter(_self).name + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClass_name_set") +@_cdecl("bjs_SimpleClass_name_set") +public func _bjs_SimpleClass_name_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + SimpleClass.bridgeJSLiftParameter(_self).name = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClass_count_get") +@_cdecl("bjs_SimpleClass_count_get") +public func _bjs_SimpleClass_count_get(_self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = SimpleClass.bridgeJSLiftParameter(_self).count + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClass_count_set") +@_cdecl("bjs_SimpleClass_count_set") +public func _bjs_SimpleClass_count_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { + #if arch(wasm32) + SimpleClass.bridgeJSLiftParameter(_self).count = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClass_flag_get") +@_cdecl("bjs_SimpleClass_flag_get") +public func _bjs_SimpleClass_flag_get(_self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = SimpleClass.bridgeJSLiftParameter(_self).flag + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClass_flag_set") +@_cdecl("bjs_SimpleClass_flag_set") +public func _bjs_SimpleClass_flag_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { + #if arch(wasm32) + SimpleClass.bridgeJSLiftParameter(_self).flag = Bool.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClass_rate_get") +@_cdecl("bjs_SimpleClass_rate_get") +public func _bjs_SimpleClass_rate_get(_self: UnsafeMutableRawPointer) -> Float32 { + #if arch(wasm32) + let ret = SimpleClass.bridgeJSLiftParameter(_self).rate + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClass_rate_set") +@_cdecl("bjs_SimpleClass_rate_set") +public func _bjs_SimpleClass_rate_set(_self: UnsafeMutableRawPointer, value: Float32) -> Void { + #if arch(wasm32) + SimpleClass.bridgeJSLiftParameter(_self).rate = Float.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClass_precise_get") +@_cdecl("bjs_SimpleClass_precise_get") +public func _bjs_SimpleClass_precise_get(_self: UnsafeMutableRawPointer) -> Float64 { + #if arch(wasm32) + let ret = SimpleClass.bridgeJSLiftParameter(_self).precise + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClass_precise_set") +@_cdecl("bjs_SimpleClass_precise_set") +public func _bjs_SimpleClass_precise_set(_self: UnsafeMutableRawPointer, value: Float64) -> Void { + #if arch(wasm32) + SimpleClass.bridgeJSLiftParameter(_self).precise = Double.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClass_deinit") +@_cdecl("bjs_SimpleClass_deinit") +public func _bjs_SimpleClass_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension SimpleClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_SimpleClass_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_SimpleClass_wrap") +fileprivate func _bjs_SimpleClass_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_SimpleClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_AddressClass_init") +@_cdecl("bjs_AddressClass_init") +public func _bjs_AddressClass_init(streetBytes: Int32, streetLength: Int32, cityBytes: Int32, cityLength: Int32, zipCode: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = AddressClass(street: String.bridgeJSLiftParameter(streetBytes, streetLength), city: String.bridgeJSLiftParameter(cityBytes, cityLength), zipCode: Int.bridgeJSLiftParameter(zipCode)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_AddressClass_street_get") +@_cdecl("bjs_AddressClass_street_get") +public func _bjs_AddressClass_street_get(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = AddressClass.bridgeJSLiftParameter(_self).street + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_AddressClass_street_set") +@_cdecl("bjs_AddressClass_street_set") +public func _bjs_AddressClass_street_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + AddressClass.bridgeJSLiftParameter(_self).street = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_AddressClass_city_get") +@_cdecl("bjs_AddressClass_city_get") +public func _bjs_AddressClass_city_get(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = AddressClass.bridgeJSLiftParameter(_self).city + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_AddressClass_city_set") +@_cdecl("bjs_AddressClass_city_set") +public func _bjs_AddressClass_city_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + AddressClass.bridgeJSLiftParameter(_self).city = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_AddressClass_zipCode_get") +@_cdecl("bjs_AddressClass_zipCode_get") +public func _bjs_AddressClass_zipCode_get(_self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = AddressClass.bridgeJSLiftParameter(_self).zipCode + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_AddressClass_zipCode_set") +@_cdecl("bjs_AddressClass_zipCode_set") +public func _bjs_AddressClass_zipCode_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { + #if arch(wasm32) + AddressClass.bridgeJSLiftParameter(_self).zipCode = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_AddressClass_deinit") +@_cdecl("bjs_AddressClass_deinit") +public func _bjs_AddressClass_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension AddressClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_AddressClass_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_AddressClass_wrap") +fileprivate func _bjs_AddressClass_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_AddressClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_ClassRoundtrip_init") +@_cdecl("bjs_ClassRoundtrip_init") +public func _bjs_ClassRoundtrip_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ClassRoundtrip() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassRoundtrip_takeSimpleClass") +@_cdecl("bjs_ClassRoundtrip_takeSimpleClass") +public func _bjs_ClassRoundtrip_takeSimpleClass(_self: UnsafeMutableRawPointer, value: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ClassRoundtrip.bridgeJSLiftParameter(_self).takeSimpleClass(_: SimpleClass.bridgeJSLiftParameter(value)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassRoundtrip_makeSimpleClass") +@_cdecl("bjs_ClassRoundtrip_makeSimpleClass") +public func _bjs_ClassRoundtrip_makeSimpleClass(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ClassRoundtrip.bridgeJSLiftParameter(_self).makeSimpleClass() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassRoundtrip_roundtripSimpleClass") +@_cdecl("bjs_ClassRoundtrip_roundtripSimpleClass") +public func _bjs_ClassRoundtrip_roundtripSimpleClass(_self: UnsafeMutableRawPointer, value: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ClassRoundtrip.bridgeJSLiftParameter(_self).roundtripSimpleClass(_: SimpleClass.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassRoundtrip_takeAddressClass") +@_cdecl("bjs_ClassRoundtrip_takeAddressClass") +public func _bjs_ClassRoundtrip_takeAddressClass(_self: UnsafeMutableRawPointer, value: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ClassRoundtrip.bridgeJSLiftParameter(_self).takeAddressClass(_: AddressClass.bridgeJSLiftParameter(value)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassRoundtrip_makeAddressClass") +@_cdecl("bjs_ClassRoundtrip_makeAddressClass") +public func _bjs_ClassRoundtrip_makeAddressClass(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ClassRoundtrip.bridgeJSLiftParameter(_self).makeAddressClass() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassRoundtrip_roundtripAddressClass") +@_cdecl("bjs_ClassRoundtrip_roundtripAddressClass") +public func _bjs_ClassRoundtrip_roundtripAddressClass(_self: UnsafeMutableRawPointer, value: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ClassRoundtrip.bridgeJSLiftParameter(_self).roundtripAddressClass(_: AddressClass.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassRoundtrip_deinit") +@_cdecl("bjs_ClassRoundtrip_deinit") +public func _bjs_ClassRoundtrip_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension ClassRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ClassRoundtrip_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_ClassRoundtrip_wrap") +fileprivate func _bjs_ClassRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ClassRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} #endif \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json index 5ba46ff61..e3532d33c 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json @@ -422,6 +422,638 @@ ], "swiftCallName" : "StringRoundtrip" + }, + { + "constructor" : { + "abiName" : "bjs_StructRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_StructRoundtrip_takeSimple", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeSimple", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "SimpleStruct" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_makeSimple", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeSimple", + "parameters" : [ + + ], + "returnType" : { + "swiftStruct" : { + "_0" : "SimpleStruct" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_roundtripSimple", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripSimple", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "SimpleStruct" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "SimpleStruct" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_takeAddress", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeAddress", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_makeAddress", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAddress", + "parameters" : [ + + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_roundtripAddress", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripAddress", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_takePerson", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takePerson", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "Person" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_makePerson", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makePerson", + "parameters" : [ + + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Person" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_roundtripPerson", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripPerson", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "Person" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Person" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_takeComplex", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeComplex", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "ComplexStruct" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_makeComplex", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplex", + "parameters" : [ + + ], + "returnType" : { + "swiftStruct" : { + "_0" : "ComplexStruct" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_roundtripComplex", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripComplex", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "ComplexStruct" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "ComplexStruct" + } + } + } + ], + "name" : "StructRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "StructRoundtrip" + }, + { + "constructor" : { + "abiName" : "bjs_SimpleClass_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "label" : "count", + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "label" : "flag", + "name" : "flag", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "rate", + "name" : "rate", + "type" : { + "float" : { + + } + } + }, + { + "label" : "precise", + "name" : "precise", + "type" : { + "double" : { + + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "SimpleClass", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "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" : "SimpleClass" + }, + { + "constructor" : { + "abiName" : "bjs_AddressClass_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "street", + "name" : "street", + "type" : { + "string" : { + + } + } + }, + { + "label" : "city", + "name" : "city", + "type" : { + "string" : { + + } + } + }, + { + "label" : "zipCode", + "name" : "zipCode", + "type" : { + "int" : { + + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "AddressClass", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "street", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "city", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "zipCode", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "AddressClass" + }, + { + "constructor" : { + "abiName" : "bjs_ClassRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_ClassRoundtrip_takeSimpleClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeSimpleClass", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_makeSimpleClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeSimpleClass", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_roundtripSimpleClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripSimpleClass", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_takeAddressClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeAddressClass", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "AddressClass" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_makeAddressClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAddressClass", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "AddressClass" + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_roundtripAddressClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripAddressClass", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "AddressClass" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "AddressClass" + } + } + } + ], + "name" : "ClassRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "ClassRoundtrip" } ], "enums" : [ @@ -728,6 +1360,225 @@ ], "structs" : [ + { + "methods" : [ + + ], + "name" : "SimpleStruct", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "flag", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "rate", + "type" : { + "float" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "precise", + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "SimpleStruct" + }, + { + "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" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "Address" + }, + { + "methods" : [ + + ], + "name" : "Person", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "age", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "address", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "email", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "swiftCallName" : "Person" + }, + { + "methods" : [ + + ], + "name" : "ComplexStruct", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "title", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "active", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "score", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "tags", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "metadata", + "type" : { + "string" : { + } + } + } + ], + "swiftCallName" : "ComplexStruct" + } ] } \ No newline at end of file diff --git a/Benchmarks/run.js b/Benchmarks/run.js index d47473115..5c27e6fff 100644 --- a/Benchmarks/run.js +++ b/Benchmarks/run.js @@ -3,7 +3,7 @@ import { defaultNodeSetup } from "./.build/plugins/PackageToJS/outputs/Package/p import fs from 'fs'; import path from 'path'; import { parseArgs } from "util"; -import { APIResult, ComplexResult } from "./.build/plugins/PackageToJS/outputs/Package/bridge-js.js"; +import { APIResultValues as APIResult, ComplexResultValues as ComplexResult } from "./.build/plugins/PackageToJS/outputs/Package/bridge-js.js"; /** * Update progress bar on the current line @@ -454,6 +454,136 @@ async function singleRun(results, nameFilter) { stringRoundtrip.make() } }) + + // Struct performance tests + const structRoundtrip = new exports.StructRoundtrip(); + + benchmarkRunner("StructRoundtrip/takeSimple", () => { + for (let i = 0; i < iterations; i++) { + structRoundtrip.takeSimple({ name: "Hello", count: 42, flag: true, rate: 0.5, precise: 3.14159 }) + } + }) + benchmarkRunner("StructRoundtrip/makeSimple", () => { + for (let i = 0; i < iterations; i++) { + structRoundtrip.makeSimple() + } + }) + benchmarkRunner("StructRoundtrip/roundtripSimple", () => { + for (let i = 0; i < iterations; i++) { + structRoundtrip.roundtripSimple({ name: "Hello", count: 42, flag: true, rate: 0.5, precise: 3.14159 }) + } + }) + + benchmarkRunner("StructRoundtrip/takeAddress", () => { + for (let i = 0; i < iterations; i++) { + structRoundtrip.takeAddress({ street: "123 Main St", city: "San Francisco", zipCode: 94102 }) + } + }) + benchmarkRunner("StructRoundtrip/makeAddress", () => { + for (let i = 0; i < iterations; i++) { + structRoundtrip.makeAddress() + } + }) + benchmarkRunner("StructRoundtrip/roundtripAddress", () => { + for (let i = 0; i < iterations; i++) { + structRoundtrip.roundtripAddress({ street: "123 Main St", city: "San Francisco", zipCode: 94102 }) + } + }) + + benchmarkRunner("StructRoundtrip/takePerson", () => { + for (let i = 0; i < iterations; i++) { + structRoundtrip.takePerson({ + name: "John Doe", + age: 30, + address: { street: "456 Oak Ave", city: "New York", zipCode: 10001 }, + email: "john@example.com" + }) + } + }) + benchmarkRunner("StructRoundtrip/makePerson", () => { + for (let i = 0; i < iterations; i++) { + structRoundtrip.makePerson() + } + }) + benchmarkRunner("StructRoundtrip/roundtripPerson", () => { + for (let i = 0; i < iterations; i++) { + structRoundtrip.roundtripPerson({ + name: "John Doe", + age: 30, + address: { street: "456 Oak Ave", city: "New York", zipCode: 10001 }, + email: "john@example.com" + }) + } + }) + + benchmarkRunner("StructRoundtrip/takeComplex", () => { + for (let i = 0; i < iterations; i++) { + structRoundtrip.takeComplex({ + id: 12345, + title: "Test Item", + active: true, + score: 98.6, + tags: "swift,wasm,benchmark", + metadata: "{\"version\":1}" + }) + } + }) + benchmarkRunner("StructRoundtrip/makeComplex", () => { + for (let i = 0; i < iterations; i++) { + structRoundtrip.makeComplex() + } + }) + benchmarkRunner("StructRoundtrip/roundtripComplex", () => { + for (let i = 0; i < iterations; i++) { + structRoundtrip.roundtripComplex({ + id: 12345, + title: "Test Item", + active: true, + score: 98.6, + tags: "swift,wasm,benchmark", + metadata: "{\"version\":1}" + }) + } + }) + + // Class vs Struct comparison tests + const classRoundtrip = new exports.ClassRoundtrip(); + + benchmarkRunner("ClassRoundtrip/takeSimpleClass", () => { + const simple = new exports.SimpleClass("Hello", 42, true, 0.5, 3.14159) + for (let i = 0; i < iterations; i++) { + classRoundtrip.takeSimpleClass(simple) + } + }) + benchmarkRunner("ClassRoundtrip/makeSimpleClass", () => { + for (let i = 0; i < iterations; i++) { + classRoundtrip.makeSimpleClass() + } + }) + benchmarkRunner("ClassRoundtrip/roundtripSimpleClass", () => { + const simple = new exports.SimpleClass("Hello", 42, true, 0.5, 3.14159) + for (let i = 0; i < iterations; i++) { + classRoundtrip.roundtripSimpleClass(simple) + } + }) + + benchmarkRunner("ClassRoundtrip/takeAddressClass", () => { + const address = new exports.AddressClass("123 Main St", "San Francisco", 94102) + for (let i = 0; i < iterations; i++) { + classRoundtrip.takeAddressClass(address) + } + }) + benchmarkRunner("ClassRoundtrip/makeAddressClass", () => { + for (let i = 0; i < iterations; i++) { + classRoundtrip.makeAddressClass() + } + }) + benchmarkRunner("ClassRoundtrip/roundtripAddressClass", () => { + const address = new exports.AddressClass("123 Main St", "San Francisco", 94102) + for (let i = 0; i < iterations; i++) { + classRoundtrip.roundtripAddressClass(address) + } + }) } /** From 6f4b5b2639bf145245734b2933c1b0525a885ae5 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 24 Dec 2025 18:28:56 +0700 Subject: [PATCH 055/252] [NFC] BridgeJS: Codegen and minor cleanups --- .../Sources/BridgeJSCore/ExportSwift.swift | 1471 +++++++++-------- .../Sources/BridgeJSLink/BridgeJSLink.swift | 225 +-- .../BridgeJSRuntimeTests/ExportAPITests.swift | 7 +- 3 files changed, 839 insertions(+), 864 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 2a2a19266..6ced425a1 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -28,8 +28,6 @@ public class ExportSwift { private var exportedProtocols: [ExportedProtocol] = [] private var exportedProtocolNameByKey: [String: String] = [:] private var typeDeclResolver: TypeDeclResolver = TypeDeclResolver() - private let enumCodegen: EnumCodegen = EnumCodegen() - private let closureCodegen = ClosureCodegen() public init(progress: ProgressReporting, moduleName: String, exposeToGlobal: Bool) { self.progress = progress @@ -1666,43 +1664,39 @@ public class ExportSwift { } decls.append(Self.prelude) + let closureCodegen = ClosureCodegen() var closureSignatures: Set = [] for function in exportedFunctions { - collectClosureSignatures(from: function.parameters, into: &closureSignatures) - collectClosureSignatures(from: function.returnType, into: &closureSignatures) + closureCodegen.collectClosureSignatures(from: function.parameters, into: &closureSignatures) + closureCodegen.collectClosureSignatures(from: function.returnType, into: &closureSignatures) } for klass in exportedClasses { if let constructor = klass.constructor { - collectClosureSignatures(from: constructor.parameters, into: &closureSignatures) + closureCodegen.collectClosureSignatures(from: constructor.parameters, into: &closureSignatures) } for method in klass.methods { - collectClosureSignatures(from: method.parameters, into: &closureSignatures) - collectClosureSignatures(from: method.returnType, into: &closureSignatures) + closureCodegen.collectClosureSignatures(from: method.parameters, into: &closureSignatures) + closureCodegen.collectClosureSignatures(from: method.returnType, into: &closureSignatures) } for property in klass.properties { - collectClosureSignatures(from: property.type, into: &closureSignatures) + closureCodegen.collectClosureSignatures(from: property.type, into: &closureSignatures) } } for signature in closureSignatures.sorted(by: { $0.mangleName < $1.mangleName }) { - decls.append(contentsOf: try closureCodegen.renderClosureHelper(signature: signature)) - decls.append(try closureCodegen.renderClosureInvokeHandler(signature: signature)) + decls.append(contentsOf: try closureCodegen.renderClosureHelpers(signature)) + decls.append(try closureCodegen.renderClosureInvokeHandler(signature)) } + let protocolCodegen = ProtocolCodegen() for proto in exportedProtocols { - decls.append(contentsOf: try renderProtocolWrapper(protocol: proto)) + decls.append(contentsOf: try protocolCodegen.renderProtocolWrapper(proto, moduleName: moduleName)) } + let enumCodegen = EnumCodegen() for enumDef in exportedEnums { - switch enumDef.enumType { - case .simple: - decls.append(enumCodegen.renderCaseEnumHelpers(enumDef)) - case .rawValue: - decls.append("extension \(raw: enumDef.swiftCallName): _BridgedSwiftEnumNoPayload {}") - case .associatedValue: - decls.append(enumCodegen.renderAssociatedValueEnumHelpers(enumDef)) - case .namespace: - () + if let enumHelpers = enumCodegen.renderEnumHelpers(enumDef) { + decls.append(enumHelpers) } for staticMethod in enumDef.staticMethods { @@ -1878,7 +1872,7 @@ public class ExportSwift { } } - func callMethod(klassName: String, methodName: String, returnType: BridgeType) { + func callMethod(methodName: String, returnType: BridgeType) { let (_, selfExpr) = removeFirstLiftedParameter() generateParameterLifting() let item = renderCallStatement( @@ -1912,7 +1906,7 @@ public class ExportSwift { } } - func callPropertyGetter(klassName: String, propertyName: String, returnType: BridgeType) { + func callPropertyGetter(propertyName: String, returnType: BridgeType) { let (_, selfExpr) = removeFirstLiftedParameter() if returnType == .void { append("\(raw: selfExpr).\(raw: propertyName)") @@ -1934,7 +1928,7 @@ public class ExportSwift { } } - func callPropertySetter(klassName: String, propertyName: String) { + func callPropertySetter(propertyName: String) { let (_, selfExpr) = removeFirstLiftedParameter() let (_, newValueExpr) = removeFirstLiftedParameter() append("\(raw: selfExpr).\(raw: propertyName) = \(raw: newValueExpr)") @@ -2041,641 +2035,45 @@ public class ExportSwift { } - private struct ClosureCodegen { - func generateOptionalParameterLowering(signature: ClosureSignature) throws -> String { - var lines: [String] = [] - - for (index, paramType) in signature.parameters.enumerated() { - guard case .optional(let wrappedType) = paramType else { - continue - } - let paramName = "param\(index)" - if case .swiftHeapObject = wrappedType { - lines.append( - "let (\(paramName)IsSome, \(paramName)Value) = \(paramName).bridgeJSLowerParameterWithRetain()" - ) - } else { - lines.append( - "let (\(paramName)IsSome, \(paramName)Value) = \(paramName).bridgeJSLowerParameterWithPresence()" - ) - } - } - - return lines.isEmpty ? "" : lines.joined(separator: "\n") + "\n" - } - - func renderClosureHelper(signature: ClosureSignature) throws -> [DeclSyntax] { - let mangledName = signature.mangleName - let helperName = "_BJS_Closure_\(mangledName)" - let boxClassName = "_BJS_ClosureBox_\(mangledName)" - - let closureParams = signature.parameters.enumerated().map { index, type in - "\(type.swiftType)" - }.joined(separator: ", ") - - let swiftEffects = (signature.isAsync ? " async" : "") + (signature.isThrows ? " throws" : "") - let swiftReturnType = signature.returnType.swiftType - let closureType = "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)" - - var invokeParams: [(name: String, type: String)] = [("_", "Int32")] - var invokeCallArgs: [String] = ["callback.bridgeJSLowerParameter()"] - - for (index, paramType) in signature.parameters.enumerated() { - let paramName = "param\(index)" - - if case .optional(let wrappedType) = paramType { - invokeParams.append(("_", "Int32")) - - switch wrappedType { - case .swiftHeapObject: - invokeParams.append(("_", "UnsafeMutableRawPointer")) - case .string, .rawValueEnum(_, .string): - invokeParams.append(("_", "Int32")) - default: - let lowerInfo = try wrappedType.loweringReturnInfo() - if let wasmType = lowerInfo.returnType { - invokeParams.append(("_", wasmType.swiftType)) - } else { - invokeParams.append(("_", "Int32")) - } - } - - invokeCallArgs.append("\(paramName)IsSome") - invokeCallArgs.append("\(paramName)Value") - } else { - let lowerInfo = try paramType.loweringReturnInfo() - if let wasmType = lowerInfo.returnType { - invokeParams.append(("_", wasmType.swiftType)) - invokeCallArgs.append("\(paramName).bridgeJSLowerParameter()") - } else { - invokeParams.append(("_", "Int32")) - invokeCallArgs.append("\(paramName).bridgeJSLowerParameter()") - } - } - } - - let invokeSignature = invokeParams.map { "\($0.name): \($0.type)" }.joined(separator: ", ") - let invokeReturnType: String - if case .optional = signature.returnType { - invokeReturnType = "Void" - } else if let wasmType = try signature.returnType.liftingReturnInfo(context: .exportSwift).valueToLift { - invokeReturnType = wasmType.swiftType - } else { - invokeReturnType = "Void" - } - - let externName = "invoke_js_callback_\(signature.moduleName)_\(mangledName)" - - let returnLifting: String - if signature.returnType == .void { - returnLifting = "\(externName)(\(invokeCallArgs.joined(separator: ", ")))" - } else if case .optional = signature.returnType { - returnLifting = """ - \(externName)(\(invokeCallArgs.joined(separator: ", "))) - return \(signature.returnType.swiftType).bridgeJSLiftReturnFromSideChannel() - """ - } else { - returnLifting = """ - let resultId = \(externName)(\(invokeCallArgs.joined(separator: ", "))) - return \(signature.returnType.swiftType).bridgeJSLiftReturn(resultId) - """ - } - - let optionalLoweringCode = try generateOptionalParameterLowering(signature: signature) - - let externDecl: DeclSyntax = """ - @_extern(wasm, module: "bjs", name: "\(raw: externName)") - fileprivate func \(raw: externName)(\(raw: invokeSignature)) -> \(raw: invokeReturnType) - """ - - let boxDecl: DeclSyntax = """ - private final class \(raw: boxClassName): _BridgedSwiftClosureBox { - let closure: \(raw: closureType) - init(_ closure: @escaping \(raw: closureType)) { - self.closure = closure - } - } - - private enum \(raw: helperName) { - static func bridgeJSLower(_ closure: @escaping \(raw: closureType)) -> UnsafeMutableRawPointer { - let box = \(raw: boxClassName)(closure) - return Unmanaged.passRetained(box).toOpaque() - } - - static func bridgeJSLift(_ callbackId: Int32) -> \(raw: closureType) { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] \(raw: signature.parameters.indices.map { "param\($0)" }.joined(separator: ", ")) in - #if arch(wasm32) - \(raw: optionalLoweringCode)\(raw: returnLifting) - #else - fatalError("Only available on WebAssembly") - #endif - } - } - } - """ - return [externDecl, boxDecl] - } - - func renderClosureInvokeHandler(signature: ClosureSignature) throws -> DeclSyntax { - let boxClassName = "_BJS_ClosureBox_\(signature.mangleName)" - let abiName = "invoke_swift_closure_\(signature.moduleName)_\(signature.mangleName)" - - var abiParams: [(name: String, type: String)] = [("boxPtr", "UnsafeMutableRawPointer")] - var liftedParams: [String] = [] - - for (index, paramType) in signature.parameters.enumerated() { - let paramName = "param\(index)" - let liftInfo = try paramType.liftParameterInfo() - - for (argName, wasmType) in liftInfo.parameters { - let fullName = - liftInfo.parameters.count > 1 ? "\(paramName)\(argName.capitalizedFirstLetter)" : paramName - abiParams.append((fullName, wasmType.swiftType)) - } - - let argNames = liftInfo.parameters.map { (argName, _) in - liftInfo.parameters.count > 1 ? "\(paramName)\(argName.capitalizedFirstLetter)" : paramName - } - liftedParams.append("\(paramType.swiftType).bridgeJSLiftParameter(\(argNames.joined(separator: ", ")))") - } - - let paramSignature = abiParams.map { "\($0.name): \($0.type)" }.joined(separator: ", ") - let closureCall = "box.closure(\(liftedParams.joined(separator: ", ")))" - - let returnCode: String - if signature.returnType == .void { - returnCode = closureCall - } else { - returnCode = """ - let result = \(closureCall) - return result.bridgeJSLowerReturn() - """ - } - - let abiReturnType: String - if signature.returnType == .void { - abiReturnType = "Void" - } else if let wasmType = try signature.returnType.loweringReturnInfo().returnType { - abiReturnType = wasmType.swiftType - } else { - abiReturnType = "Void" - } - - return """ - @_expose(wasm, "\(raw: abiName)") - @_cdecl("\(raw: abiName)") - public func _\(raw: abiName)(\(raw: paramSignature)) -> \(raw: abiReturnType) { - #if arch(wasm32) - let box = Unmanaged<\(raw: boxClassName)>.fromOpaque(boxPtr).takeUnretainedValue() - \(raw: returnCode) - #else - fatalError("Only available on WebAssembly") - #endif - } - """ - } - - } - - /// Helper for stack-based lifting and lowering operations. - private struct StackCodegen { - /// Generates an expression to lift a value from the parameter stack. - /// - Parameter type: The BridgeType to lift - /// - Returns: An ExprSyntax representing the lift expression - func liftExpression(for type: BridgeType) -> ExprSyntax { - switch type { - case .string: - return "String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .int: - return "Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())" - case .bool: - return "Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())" - case .float: - return "Float.bridgeJSLiftParameter(_swift_js_pop_param_f32())" - case .double: - return "Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())" - case .jsObject: - return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" - case .swiftHeapObject(let className): - return "\(raw: className).bridgeJSLiftParameter(_swift_js_pop_param_pointer())" - case .swiftProtocol: - // Protocols are handled via JSObject - return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" - case .caseEnum(let enumName): - return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" - case .rawValueEnum(let enumName, let rawType): - switch rawType { - case .string: - return - "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .bool, .int, .int32, .int64, .uint, .uint32, .uint64, .float, .double: - return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" - } - case .associatedValueEnum(let enumName): - return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" - case .swiftStruct(let structName): - return "\(raw: structName).bridgeJSLiftParameter()" - case .optional(let wrappedType): - return liftOptionalExpression(wrappedType: wrappedType) - case .void: - // Void shouldn't be lifted, but return a placeholder - return "()" - case .namespaceEnum: - // Namespace enums are not passed as values - return "()" - case .closure: - return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" - } - } - - private func liftOptionalExpression(wrappedType: BridgeType) -> ExprSyntax { - switch wrappedType { - case .string: - return - "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .int: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .bool: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .float: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f32())" - case .double: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f64())" - case .caseEnum(let enumName): - return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .rawValueEnum(let enumName, let rawType): - switch rawType { - case .string: - return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .bool, .int, .float, .double, .int32, .int64, .uint, .uint32, .uint64: - return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - } - case .swiftStruct(let nestedName): - return "Optional<\(raw: nestedName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32())" - case .swiftHeapObject(let className): - return - "Optional<\(raw: className)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_pointer())" - case .associatedValueEnum(let enumName): - return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .jsObject: - return - "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - default: - // Fallback for other optional types - return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - } - } - - /// Generates statements to lower/push a value onto the stack. - /// - Parameters: - /// - type: The BridgeType to lower - /// - accessor: The expression to access the value (e.g., "self.name" or "paramName") - /// - varPrefix: A unique prefix for intermediate variables - /// - Returns: An array of CodeBlockItemSyntax representing the lowering statements - func lowerStatements( - for type: BridgeType, - accessor: String, - varPrefix: String - ) -> [CodeBlockItemSyntax] { - switch type { - case .string: - return [ - "var __bjs_\(raw: varPrefix) = \(raw: accessor)", - "__bjs_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", - ] - case .int: - return ["_swift_js_push_int(Int32(\(raw: accessor)))"] - case .bool: - return ["_swift_js_push_int(\(raw: accessor) ? 1 : 0)"] - case .float: - return ["_swift_js_push_f32(\(raw: accessor))"] - case .double: - return ["_swift_js_push_f64(\(raw: accessor))"] - case .jsObject: - return ["_swift_js_push_int(\(raw: accessor).bridgeJSLowerParameter())"] - case .swiftHeapObject: - return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] - case .swiftProtocol: - return ["_swift_js_push_int(\(raw: accessor).bridgeJSLowerParameter())"] - case .caseEnum: - return ["_swift_js_push_int(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] - case .rawValueEnum: - return ["_swift_js_push_int(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] - case .associatedValueEnum: - return ["\(raw: accessor).bridgeJSLowerReturn()"] - case .swiftStruct: - return ["\(raw: accessor).bridgeJSLowerReturn()"] - case .optional(let wrappedType): - return lowerOptionalStatements(wrappedType: wrappedType, accessor: accessor, varPrefix: varPrefix) - case .void: - return [] - case .namespaceEnum: - return [] - case .closure: - return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] - } - } - - private func lowerOptionalStatements( - wrappedType: BridgeType, - accessor: String, - varPrefix: String - ) -> [CodeBlockItemSyntax] { - var statements: [CodeBlockItemSyntax] = [] - statements.append("let __bjs_isSome_\(raw: varPrefix) = \(raw: accessor) != nil") - statements.append("if let __bjs_unwrapped_\(raw: varPrefix) = \(raw: accessor) {") - - let innerStatements = lowerUnwrappedOptionalStatements( - wrappedType: wrappedType, - unwrappedVar: "__bjs_unwrapped_\(varPrefix)", - varPrefix: varPrefix - ) - for stmt in innerStatements { - statements.append(stmt) - } - - statements.append("}") - statements.append("_swift_js_push_int(__bjs_isSome_\(raw: varPrefix) ? 1 : 0)") - return statements - } - - private func lowerUnwrappedOptionalStatements( - wrappedType: BridgeType, - unwrappedVar: String, - varPrefix: String - ) -> [CodeBlockItemSyntax] { - switch wrappedType { - case .string: - return [ - "var __bjs_str_\(raw: varPrefix) = \(raw: unwrappedVar)", - "__bjs_str_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", - ] - case .int: - return ["_swift_js_push_int(Int32(\(raw: unwrappedVar)))"] - case .bool: - return ["_swift_js_push_int(\(raw: unwrappedVar) ? 1 : 0)"] - case .float: - return ["_swift_js_push_f32(\(raw: unwrappedVar))"] - case .double: - return ["_swift_js_push_f64(\(raw: unwrappedVar))"] - case .caseEnum: - return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - return [ - "var __bjs_str_\(raw: varPrefix) = \(raw: unwrappedVar).rawValue", - "__bjs_str_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", - ] - default: - return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] - } - case .swiftStruct: - return ["\(raw: unwrappedVar).bridgeJSLowerReturn()"] - case .swiftHeapObject: - return ["_swift_js_push_pointer(\(raw: unwrappedVar).bridgeJSLowerReturn())"] - case .associatedValueEnum: - return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] - case .jsObject: - return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] - default: - return ["preconditionFailure(\"BridgeJS: unsupported optional wrapped type\")"] - } - } - } - - private struct EnumCodegen { - private let stackCodegen = StackCodegen() - - func renderCaseEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { - let typeName = enumDef.swiftCallName - var initCases: [String] = [] - var valueCases: [String] = [] - for (index, enumCase) in enumDef.cases.enumerated() { - initCases.append("case \(index): self = .\(enumCase.name)") - valueCases.append("case .\(enumCase.name): return \(index)") - } - let initSwitch = (["switch bridgeJSRawValue {"] + initCases + ["default: return nil", "}"]).joined( - separator: "\n" - ) - let valueSwitch = (["switch self {"] + valueCases + ["}"]).joined(separator: "\n") - - return """ - extension \(raw: typeName): _BridgedSwiftCaseEnum { - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - return bridgeJSRawValue - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> \(raw: typeName) { - return bridgeJSLiftParameter(value) - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> \(raw: typeName) { - return \(raw: typeName)(bridgeJSRawValue: value)! - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSLowerParameter() - } - - private init?(bridgeJSRawValue: Int32) { - \(raw: initSwitch) - } - - private var bridgeJSRawValue: Int32 { - \(raw: valueSwitch) - } - } - """ - } - - func renderAssociatedValueEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { - let typeName = enumDef.swiftCallName - return """ - extension \(raw: typeName): _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> \(raw: typeName) { - switch caseId { - \(raw: generateStackLiftSwitchCases(enumDef: enumDef).joined(separator: "\n")) - default: fatalError("Unknown \(raw: typeName) case ID: \\(caseId)") - } - } - - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - switch self { - \(raw: generateLowerParameterSwitchCases(enumDef: enumDef).joined(separator: "\n")) - } - } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> \(raw: typeName) { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> \(raw: typeName) { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - \(raw: generateReturnSwitchCases(enumDef: enumDef).joined(separator: "\n")) - } - } - } - """ - } - - private func generateStackLiftSwitchCases(enumDef: ExportedEnum) -> [String] { - var cases: [String] = [] - for (caseIndex, enumCase) in enumDef.cases.enumerated() { - if enumCase.associatedValues.isEmpty { - cases.append("case \(caseIndex): return .\(enumCase.name)") - } else { - var lines: [String] = [] - lines.append("case \(caseIndex):") - let argList = enumCase.associatedValues.map { associatedValue in - let labelPrefix: String - if let label = associatedValue.label { - labelPrefix = "\(label): " - } else { - labelPrefix = "" - } - let liftExpr = stackCodegen.liftExpression(for: associatedValue.type) - return "\(labelPrefix)\(liftExpr)" - } - lines.append("return .\(enumCase.name)(\(argList.joined(separator: ", ")))") - cases.append(lines.joined(separator: "\n")) - } - } - return cases - } - - private func generatePayloadPushingCode( - associatedValues: [AssociatedValue] - ) -> [String] { - var bodyLines: [String] = [] - for (index, associatedValue) in associatedValues.enumerated() { - let paramName = associatedValue.label ?? "param\(index)" - let statements = stackCodegen.lowerStatements( - for: associatedValue.type, - accessor: paramName, - varPrefix: paramName - ) - for stmt in statements { - bodyLines.append(stmt.description) - } - } - return bodyLines - } - - private func generateLowerParameterSwitchCases(enumDef: ExportedEnum) -> [String] { - var cases: [String] = [] - for (caseIndex, enumCase) in enumDef.cases.enumerated() { - if enumCase.associatedValues.isEmpty { - cases.append("case .\(enumCase.name):") - cases.append("return Int32(\(caseIndex))") - } else { - let payloadCode = generatePayloadPushingCode(associatedValues: enumCase.associatedValues) - let pattern = enumCase.associatedValues.enumerated() - .map { index, associatedValue in "let \(associatedValue.label ?? "param\(index)")" } - .joined(separator: ", ") - cases.append("case .\(enumCase.name)(\(pattern)):") - cases.append(contentsOf: payloadCode) - cases.append("return Int32(\(caseIndex))") - } - } - return cases - } + /// Context for property rendering that determines call behavior and ABI generation + private enum PropertyRenderingContext { + case enumStatic(enumDef: ExportedEnum) + case classStatic(klass: ExportedClass) + case classInstance(klass: ExportedClass) + case structStatic(structDef: ExportedStruct) - private func generateReturnSwitchCases(enumDef: ExportedEnum) -> [String] { - var cases: [String] = [] - for (caseIndex, enumCase) in enumDef.cases.enumerated() { - if enumCase.associatedValues.isEmpty { - cases.append("case .\(enumCase.name):") - cases.append("_swift_js_push_tag(Int32(\(caseIndex)))") - } else { - let pattern = enumCase.associatedValues.enumerated() - .map { index, associatedValue in "let \(associatedValue.label ?? "param\(index)")" } - .joined(separator: ", ") - cases.append("case .\(enumCase.name)(\(pattern)):") - cases.append("_swift_js_push_tag(Int32(\(caseIndex)))") - let payloadCode = generatePayloadPushingCode(associatedValues: enumCase.associatedValues) - cases.append(contentsOf: payloadCode) - } + var isStatic: Bool { + switch self { + case .enumStatic, .classStatic, .structStatic: + return true + case .classInstance: + return false } - return cases - } - } - - private struct StructCodegen { - private let stackCodegen = StackCodegen() - - func renderStructHelpers(_ structDef: ExportedStruct) -> DeclSyntax { - let typeName = structDef.swiftCallName - let liftCode = generateStructLiftCode(structDef: structDef) - let lowerCode = generateStructLowerCode(structDef: structDef) - - return """ - extension \(raw: typeName): _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> \(raw: typeName) { - \(raw: liftCode.joined(separator: "\n")) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - \(raw: lowerCode.joined(separator: "\n")) - } - } - """ } - private func generateStructLiftCode(structDef: ExportedStruct) -> [String] { - var lines: [String] = [] - let instanceProps = structDef.properties.filter { !$0.isStatic } - - for property in instanceProps.reversed() { - let fieldName = property.name - let liftExpr = stackCodegen.liftExpression(for: property.type) - lines.append("let \(fieldName) = \(liftExpr)") + var className: String { + switch self { + case .enumStatic(let enumDef): + return enumDef.name + case .classStatic(let klass), .classInstance(let klass): + return klass.name + case .structStatic(let structDef): + return structDef.name } - - let initArgs = instanceProps.map { "\($0.name): \($0.name)" }.joined(separator: ", ") - lines.append("return \(structDef.swiftCallName)(\(initArgs))") - - return lines } - private func generateStructLowerCode(structDef: ExportedStruct) -> [String] { - var lines: [String] = [] - let instanceProps = structDef.properties.filter { !$0.isStatic } - - for property in instanceProps { - let accessor = "self.\(property.name)" - let statements = stackCodegen.lowerStatements( - for: property.type, - accessor: accessor, - varPrefix: property.name - ) - for stmt in statements { - lines.append(stmt.description) - } + func callName(for property: ExportedProperty) -> String { + switch self { + case .enumStatic(let enumDef): + return property.callName(prefix: enumDef.swiftCallName) + case .classStatic, .classInstance: + return property.callName() + case .structStatic(let structDef): + return property.callName(prefix: structDef.swiftCallName) } - - return lines } } - /// Context for property rendering that determines call behavior and ABI generation - private enum PropertyRenderingContext { - case enumStatic(enumDef: ExportedEnum) - case classStatic(klass: ExportedClass) - case classInstance(klass: ExportedClass) - case structStatic(structDef: ExportedStruct) - } - /// Renders getter and setter Swift thunk code for a property in any context /// This unified function eliminates duplication between enum static, class static, and class instance property rendering private func renderSingleExportedProperty( @@ -2684,26 +2082,9 @@ public class ExportSwift { ) throws -> [DeclSyntax] { var decls: [DeclSyntax] = [] - let (callName, className, isStatic): (String, String, Bool) - switch context { - case .enumStatic(let enumDef): - callName = property.callName(prefix: enumDef.swiftCallName) - className = enumDef.name - isStatic = true - case .classStatic(let klass): - callName = property.callName() - className = klass.name - isStatic = true - - case .classInstance(let klass): - callName = property.callName() - className = klass.name - isStatic = false - case .structStatic(let structDef): - callName = property.callName(prefix: structDef.swiftCallName) - className = structDef.name - isStatic = true - } + let callName = context.callName(for: property) + let className = context.className + let isStatic = context.isStatic let getterBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false, isStatic: isStatic)) @@ -2716,7 +2097,7 @@ public class ExportSwift { if isStatic { getterBuilder.callStaticProperty(name: callName, returnType: property.type) } else { - getterBuilder.callPropertyGetter(klassName: className, propertyName: callName, returnType: property.type) + getterBuilder.callPropertyGetter(propertyName: callName, returnType: property.type) } try getterBuilder.lowerReturnValue(returnType: property.type) @@ -2744,7 +2125,7 @@ public class ExportSwift { let klassName = callName.components(separatedBy: ".").dropLast().joined(separator: ".") setterBuilder.callStaticPropertySetter(klassName: klassName, propertyName: property.name) } else { - setterBuilder.callPropertySetter(klassName: className, propertyName: callName) + setterBuilder.callPropertySetter(propertyName: callName) } try setterBuilder.lowerReturnValue(returnType: .void) @@ -2819,7 +2200,6 @@ public class ExportSwift { try builder.liftParameter(param: param) } builder.callMethod( - klassName: structDef.swiftCallName, methodName: method.name, returnType: method.returnType ) @@ -2907,7 +2287,6 @@ public class ExportSwift { try builder.liftParameter(param: param) } builder.callMethod( - klassName: klass.swiftCallName, methodName: method.name, returnType: method.returnType ) @@ -2953,27 +2332,6 @@ public class ExportSwift { return decls } - private func collectClosureSignatures(from parameters: [Parameter], into signatures: inout Set) { - for param in parameters { - collectClosureSignatures(from: param.type, into: &signatures) - } - } - - private func collectClosureSignatures(from type: BridgeType, into signatures: inout Set) { - switch type { - case .closure(let signature): - signatures.insert(signature) - for paramType in signature.parameters { - collectClosureSignatures(from: paramType, into: &signatures) - } - collectClosureSignatures(from: signature.returnType, into: &signatures) - case .optional(let wrapped): - collectClosureSignatures(from: wrapped, into: &signatures) - default: - break - } - } - /// Generates a ConvertibleToJSValue extension for the exported class /// /// # Example @@ -3014,10 +2372,684 @@ public class ExportSwift { """ return [extensionDecl, externDecl] } +} + +// MARK: - ClosureCodegen - /// Creates a struct that wraps a JSObject and implements protocol methods - /// by calling `@_extern(wasm)` functions that forward to JavaScript via JSObject ID - func renderProtocolWrapper(protocol proto: ExportedProtocol) throws -> [DeclSyntax] { +struct ClosureCodegen { + func collectClosureSignatures(from parameters: [Parameter], into signatures: inout Set) { + for param in parameters { + collectClosureSignatures(from: param.type, into: &signatures) + } + } + + func collectClosureSignatures(from type: BridgeType, into signatures: inout Set) { + switch type { + case .closure(let signature): + signatures.insert(signature) + for paramType in signature.parameters { + collectClosureSignatures(from: paramType, into: &signatures) + } + collectClosureSignatures(from: signature.returnType, into: &signatures) + case .optional(let wrapped): + collectClosureSignatures(from: wrapped, into: &signatures) + default: + break + } + } + + private func generateOptionalParameterLowering(_ signature: ClosureSignature) throws -> String { + var lines: [String] = [] + + for (index, paramType) in signature.parameters.enumerated() { + guard case .optional(let wrappedType) = paramType else { + continue + } + let paramName = "param\(index)" + if case .swiftHeapObject = wrappedType { + lines.append( + "let (\(paramName)IsSome, \(paramName)Value) = \(paramName).bridgeJSLowerParameterWithRetain()" + ) + } else { + lines.append( + "let (\(paramName)IsSome, \(paramName)Value) = \(paramName).bridgeJSLowerParameterWithPresence()" + ) + } + } + + return lines.isEmpty ? "" : lines.joined(separator: "\n") + "\n" + } + + func renderClosureHelpers(_ signature: ClosureSignature) throws -> [DeclSyntax] { + let mangledName = signature.mangleName + let helperName = "_BJS_Closure_\(mangledName)" + let boxClassName = "_BJS_ClosureBox_\(mangledName)" + + let closureParams = signature.parameters.enumerated().map { index, type in + "\(type.swiftType)" + }.joined(separator: ", ") + + let swiftEffects = (signature.isAsync ? " async" : "") + (signature.isThrows ? " throws" : "") + let swiftReturnType = signature.returnType.swiftType + let closureType = "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)" + + var invokeParams: [(name: String, type: String)] = [("_", "Int32")] + var invokeCallArgs: [String] = ["callback.bridgeJSLowerParameter()"] + + for (index, paramType) in signature.parameters.enumerated() { + let paramName = "param\(index)" + + if case .optional(let wrappedType) = paramType { + invokeParams.append(("_", "Int32")) + + switch wrappedType { + case .swiftHeapObject: + invokeParams.append(("_", "UnsafeMutableRawPointer")) + case .string, .rawValueEnum(_, .string): + invokeParams.append(("_", "Int32")) + default: + let lowerInfo = try wrappedType.loweringReturnInfo() + if let wasmType = lowerInfo.returnType { + invokeParams.append(("_", wasmType.swiftType)) + } else { + invokeParams.append(("_", "Int32")) + } + } + + invokeCallArgs.append("\(paramName)IsSome") + invokeCallArgs.append("\(paramName)Value") + } else { + let lowerInfo = try paramType.loweringReturnInfo() + if let wasmType = lowerInfo.returnType { + invokeParams.append(("_", wasmType.swiftType)) + invokeCallArgs.append("\(paramName).bridgeJSLowerParameter()") + } else { + invokeParams.append(("_", "Int32")) + invokeCallArgs.append("\(paramName).bridgeJSLowerParameter()") + } + } + } + + let invokeSignature = invokeParams.map { "\($0.name): \($0.type)" }.joined(separator: ", ") + let invokeReturnType: String + if case .optional = signature.returnType { + invokeReturnType = "Void" + } else if let wasmType = try signature.returnType.liftingReturnInfo(context: .exportSwift).valueToLift { + invokeReturnType = wasmType.swiftType + } else { + invokeReturnType = "Void" + } + + let externName = "invoke_js_callback_\(signature.moduleName)_\(mangledName)" + + let returnLifting: String + if signature.returnType == .void { + returnLifting = "\(externName)(\(invokeCallArgs.joined(separator: ", ")))" + } else if case .optional = signature.returnType { + returnLifting = """ + \(externName)(\(invokeCallArgs.joined(separator: ", "))) + return \(signature.returnType.swiftType).bridgeJSLiftReturnFromSideChannel() + """ + } else { + returnLifting = """ + let resultId = \(externName)(\(invokeCallArgs.joined(separator: ", "))) + return \(signature.returnType.swiftType).bridgeJSLiftReturn(resultId) + """ + } + + let optionalLoweringCode = try generateOptionalParameterLowering(signature) + + let externDecl: DeclSyntax = """ + @_extern(wasm, module: "bjs", name: "\(raw: externName)") + fileprivate func \(raw: externName)(\(raw: invokeSignature)) -> \(raw: invokeReturnType) + """ + + let boxDecl: DeclSyntax = """ + private final class \(raw: boxClassName): _BridgedSwiftClosureBox { + let closure: \(raw: closureType) + init(_ closure: @escaping \(raw: closureType)) { + self.closure = closure + } + } + + private enum \(raw: helperName) { + static func bridgeJSLower(_ closure: @escaping \(raw: closureType)) -> UnsafeMutableRawPointer { + let box = \(raw: boxClassName)(closure) + return Unmanaged.passRetained(box).toOpaque() + } + + static func bridgeJSLift(_ callbackId: Int32) -> \(raw: closureType) { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] \(raw: signature.parameters.indices.map { "param\($0)" }.joined(separator: ", ")) in + #if arch(wasm32) + \(raw: optionalLoweringCode)\(raw: returnLifting) + #else + fatalError("Only available on WebAssembly") + #endif + } + } + } + """ + return [externDecl, boxDecl] + } + + func renderClosureInvokeHandler(_ signature: ClosureSignature) throws -> DeclSyntax { + let boxClassName = "_BJS_ClosureBox_\(signature.mangleName)" + let abiName = "invoke_swift_closure_\(signature.moduleName)_\(signature.mangleName)" + + var abiParams: [(name: String, type: String)] = [("boxPtr", "UnsafeMutableRawPointer")] + var liftedParams: [String] = [] + + for (index, paramType) in signature.parameters.enumerated() { + let paramName = "param\(index)" + let liftInfo = try paramType.liftParameterInfo() + + for (argName, wasmType) in liftInfo.parameters { + let fullName = + liftInfo.parameters.count > 1 ? "\(paramName)\(argName.capitalizedFirstLetter)" : paramName + abiParams.append((fullName, wasmType.swiftType)) + } + + let argNames = liftInfo.parameters.map { (argName, _) in + liftInfo.parameters.count > 1 ? "\(paramName)\(argName.capitalizedFirstLetter)" : paramName + } + liftedParams.append("\(paramType.swiftType).bridgeJSLiftParameter(\(argNames.joined(separator: ", ")))") + } + + let paramSignature = abiParams.map { "\($0.name): \($0.type)" }.joined(separator: ", ") + let closureCall = "box.closure(\(liftedParams.joined(separator: ", ")))" + + let returnCode: String + if signature.returnType == .void { + returnCode = closureCall + } else { + returnCode = """ + let result = \(closureCall) + return result.bridgeJSLowerReturn() + """ + } + + let abiReturnType: String + if signature.returnType == .void { + abiReturnType = "Void" + } else if let wasmType = try signature.returnType.loweringReturnInfo().returnType { + abiReturnType = wasmType.swiftType + } else { + abiReturnType = "Void" + } + + return """ + @_expose(wasm, "\(raw: abiName)") + @_cdecl("\(raw: abiName)") + public func _\(raw: abiName)(\(raw: paramSignature)) -> \(raw: abiReturnType) { + #if arch(wasm32) + let box = Unmanaged<\(raw: boxClassName)>.fromOpaque(boxPtr).takeUnretainedValue() + \(raw: returnCode) + #else + fatalError("Only available on WebAssembly") + #endif + } + """ + } + +} + +// MARK: - StackCodegen + +/// Helper for stack-based lifting and lowering operations. +struct StackCodegen { + /// Generates an expression to lift a value from the parameter stack. + /// - Parameter type: The BridgeType to lift + /// - Returns: An ExprSyntax representing the lift expression + func liftExpression(for type: BridgeType) -> ExprSyntax { + switch type { + case .string: + return "String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .int: + return "Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .bool: + return "Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .float: + return "Float.bridgeJSLiftParameter(_swift_js_pop_param_f32())" + case .double: + return "Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())" + case .jsObject: + return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .swiftHeapObject(let className): + return "\(raw: className).bridgeJSLiftParameter(_swift_js_pop_param_pointer())" + case .swiftProtocol: + // Protocols are handled via JSObject + return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .caseEnum(let enumName): + return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .rawValueEnum(let enumName, let rawType): + switch rawType { + case .string: + return + "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .bool, .int, .int32, .int64, .uint, .uint32, .uint64, .float, .double: + return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" + } + case .associatedValueEnum(let enumName): + return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .swiftStruct(let structName): + return "\(raw: structName).bridgeJSLiftParameter()" + case .optional(let wrappedType): + return liftOptionalExpression(wrappedType: wrappedType) + case .void: + // Void shouldn't be lifted, but return a placeholder + return "()" + case .namespaceEnum: + // Namespace enums are not passed as values + return "()" + case .closure: + return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + } + } + + private func liftOptionalExpression(wrappedType: BridgeType) -> ExprSyntax { + switch wrappedType { + case .string: + return + "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .int: + return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .bool: + return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .float: + return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f32())" + case .double: + return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f64())" + case .caseEnum(let enumName): + return + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .rawValueEnum(let enumName, let rawType): + switch rawType { + case .string: + return + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .bool, .int, .float, .double, .int32, .int64, .uint, .uint32, .uint64: + return + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + } + case .swiftStruct(let nestedName): + return "Optional<\(raw: nestedName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .swiftHeapObject(let className): + return + "Optional<\(raw: className)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_pointer())" + case .associatedValueEnum(let enumName): + return + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .jsObject: + return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + default: + // Fallback for other optional types + return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + } + } + + /// Generates statements to lower/push a value onto the stack. + /// - Parameters: + /// - type: The BridgeType to lower + /// - accessor: The expression to access the value (e.g., "self.name" or "paramName") + /// - varPrefix: A unique prefix for intermediate variables + /// - Returns: An array of CodeBlockItemSyntax representing the lowering statements + func lowerStatements( + for type: BridgeType, + accessor: String, + varPrefix: String + ) -> [CodeBlockItemSyntax] { + switch type { + case .string: + return [ + "var __bjs_\(raw: varPrefix) = \(raw: accessor)", + "__bjs_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", + ] + case .int: + return ["_swift_js_push_int(Int32(\(raw: accessor)))"] + case .bool: + return ["_swift_js_push_int(\(raw: accessor) ? 1 : 0)"] + case .float: + return ["_swift_js_push_f32(\(raw: accessor))"] + case .double: + return ["_swift_js_push_f64(\(raw: accessor))"] + case .jsObject: + return ["_swift_js_push_int(\(raw: accessor).bridgeJSLowerParameter())"] + case .swiftHeapObject: + return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] + case .swiftProtocol: + return ["_swift_js_push_int(\(raw: accessor).bridgeJSLowerParameter())"] + case .caseEnum: + return ["_swift_js_push_int(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] + case .rawValueEnum: + return ["_swift_js_push_int(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] + case .associatedValueEnum: + return ["\(raw: accessor).bridgeJSLowerReturn()"] + case .swiftStruct: + return ["\(raw: accessor).bridgeJSLowerReturn()"] + case .optional(let wrappedType): + return lowerOptionalStatements(wrappedType: wrappedType, accessor: accessor, varPrefix: varPrefix) + case .void: + return [] + case .namespaceEnum: + return [] + case .closure: + return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] + } + } + + private func lowerOptionalStatements( + wrappedType: BridgeType, + accessor: String, + varPrefix: String + ) -> [CodeBlockItemSyntax] { + var statements: [CodeBlockItemSyntax] = [] + statements.append("let __bjs_isSome_\(raw: varPrefix) = \(raw: accessor) != nil") + statements.append("if let __bjs_unwrapped_\(raw: varPrefix) = \(raw: accessor) {") + + let innerStatements = lowerUnwrappedOptionalStatements( + wrappedType: wrappedType, + unwrappedVar: "__bjs_unwrapped_\(varPrefix)", + varPrefix: varPrefix + ) + for stmt in innerStatements { + statements.append(stmt) + } + + statements.append("}") + statements.append("_swift_js_push_int(__bjs_isSome_\(raw: varPrefix) ? 1 : 0)") + return statements + } + + private func lowerUnwrappedOptionalStatements( + wrappedType: BridgeType, + unwrappedVar: String, + varPrefix: String + ) -> [CodeBlockItemSyntax] { + switch wrappedType { + case .string: + return [ + "var __bjs_str_\(raw: varPrefix) = \(raw: unwrappedVar)", + "__bjs_str_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", + ] + case .int: + return ["_swift_js_push_int(Int32(\(raw: unwrappedVar)))"] + case .bool: + return ["_swift_js_push_int(\(raw: unwrappedVar) ? 1 : 0)"] + case .float: + return ["_swift_js_push_f32(\(raw: unwrappedVar))"] + case .double: + return ["_swift_js_push_f64(\(raw: unwrappedVar))"] + case .caseEnum: + return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + return [ + "var __bjs_str_\(raw: varPrefix) = \(raw: unwrappedVar).rawValue", + "__bjs_str_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", + ] + default: + return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] + } + case .swiftStruct: + return ["\(raw: unwrappedVar).bridgeJSLowerReturn()"] + case .swiftHeapObject: + return ["_swift_js_push_pointer(\(raw: unwrappedVar).bridgeJSLowerReturn())"] + case .associatedValueEnum: + return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] + case .jsObject: + return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] + default: + return ["preconditionFailure(\"BridgeJS: unsupported optional wrapped type\")"] + } + } +} + +// MARK: - EnumCodegen + +struct EnumCodegen { + private let stackCodegen = StackCodegen() + + func renderEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax? { + switch enumDef.enumType { + case .simple: + return renderCaseEnumHelpers(enumDef) + case .rawValue: + return renderRawValueEnumHelpers(enumDef) + case .associatedValue: + return renderAssociatedValueEnumHelpers(enumDef) + case .namespace: + return nil + } + } + + private func renderCaseEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { + let typeName = enumDef.swiftCallName + var initCases: [String] = [] + var valueCases: [String] = [] + for (index, enumCase) in enumDef.cases.enumerated() { + initCases.append("case \(index): self = .\(enumCase.name)") + valueCases.append("case .\(enumCase.name): return \(index)") + } + let initSwitch = (["switch bridgeJSRawValue {"] + initCases + ["default: return nil", "}"]).joined( + separator: "\n" + ) + let valueSwitch = (["switch self {"] + valueCases + ["}"]).joined(separator: "\n") + + return """ + extension \(raw: typeName): _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> \(raw: typeName) { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> \(raw: typeName) { + return \(raw: typeName)(bridgeJSRawValue: value)! + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { + return bridgeJSLowerParameter() + } + + private init?(bridgeJSRawValue: Int32) { + \(raw: initSwitch) + } + + private var bridgeJSRawValue: Int32 { + \(raw: valueSwitch) + } + } + """ + } + + private func renderRawValueEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { + return "extension \(raw: enumDef.swiftCallName): _BridgedSwiftEnumNoPayload {}" + } + + private func renderAssociatedValueEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { + let typeName = enumDef.swiftCallName + return """ + extension \(raw: typeName): _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> \(raw: typeName) { + switch caseId { + \(raw: generateStackLiftSwitchCases(enumDef: enumDef).joined(separator: "\n")) + default: fatalError("Unknown \(raw: typeName) case ID: \\(caseId)") + } + } + + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + \(raw: generateLowerParameterSwitchCases(enumDef: enumDef).joined(separator: "\n")) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> \(raw: typeName) { + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> \(raw: typeName) { + return _bridgeJSLiftFromCaseId(caseId) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + switch self { + \(raw: generateReturnSwitchCases(enumDef: enumDef).joined(separator: "\n")) + } + } + } + """ + } + + private func generateStackLiftSwitchCases(enumDef: ExportedEnum) -> [String] { + var cases: [String] = [] + for (caseIndex, enumCase) in enumDef.cases.enumerated() { + if enumCase.associatedValues.isEmpty { + cases.append("case \(caseIndex): return .\(enumCase.name)") + } else { + var lines: [String] = [] + lines.append("case \(caseIndex):") + let argList = enumCase.associatedValues.map { associatedValue in + let labelPrefix: String + if let label = associatedValue.label { + labelPrefix = "\(label): " + } else { + labelPrefix = "" + } + let liftExpr = stackCodegen.liftExpression(for: associatedValue.type) + return "\(labelPrefix)\(liftExpr)" + } + lines.append("return .\(enumCase.name)(\(argList.joined(separator: ", ")))") + cases.append(lines.joined(separator: "\n")) + } + } + return cases + } + + private func generatePayloadPushingCode( + associatedValues: [AssociatedValue] + ) -> [String] { + var bodyLines: [String] = [] + for (index, associatedValue) in associatedValues.enumerated() { + let paramName = associatedValue.label ?? "param\(index)" + let statements = stackCodegen.lowerStatements( + for: associatedValue.type, + accessor: paramName, + varPrefix: paramName + ) + for stmt in statements { + bodyLines.append(stmt.description) + } + } + return bodyLines + } + + private func generateLowerParameterSwitchCases(enumDef: ExportedEnum) -> [String] { + var cases: [String] = [] + for (caseIndex, enumCase) in enumDef.cases.enumerated() { + if enumCase.associatedValues.isEmpty { + cases.append("case .\(enumCase.name):") + cases.append("return Int32(\(caseIndex))") + } else { + let payloadCode = generatePayloadPushingCode(associatedValues: enumCase.associatedValues) + let pattern = enumCase.associatedValues.enumerated() + .map { index, associatedValue in "let \(associatedValue.label ?? "param\(index)")" } + .joined(separator: ", ") + cases.append("case .\(enumCase.name)(\(pattern)):") + cases.append(contentsOf: payloadCode) + cases.append("return Int32(\(caseIndex))") + } + } + return cases + } + + private func generateReturnSwitchCases(enumDef: ExportedEnum) -> [String] { + var cases: [String] = [] + for (caseIndex, enumCase) in enumDef.cases.enumerated() { + if enumCase.associatedValues.isEmpty { + cases.append("case .\(enumCase.name):") + cases.append("_swift_js_push_tag(Int32(\(caseIndex)))") + } else { + let pattern = enumCase.associatedValues.enumerated() + .map { index, associatedValue in "let \(associatedValue.label ?? "param\(index)")" } + .joined(separator: ", ") + cases.append("case .\(enumCase.name)(\(pattern)):") + cases.append("_swift_js_push_tag(Int32(\(caseIndex)))") + let payloadCode = generatePayloadPushingCode(associatedValues: enumCase.associatedValues) + cases.append(contentsOf: payloadCode) + } + } + return cases + } +} + +// MARK: - StructCodegen + +struct StructCodegen { + private let stackCodegen = StackCodegen() + + func renderStructHelpers(_ structDef: ExportedStruct) -> DeclSyntax { + let typeName = structDef.swiftCallName + let liftCode = generateStructLiftCode(structDef: structDef) + let lowerCode = generateStructLowerCode(structDef: structDef) + + return """ + extension \(raw: typeName): _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> \(raw: typeName) { + \(raw: liftCode.joined(separator: "\n")) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + \(raw: lowerCode.joined(separator: "\n")) + } + } + """ + } + + private func generateStructLiftCode(structDef: ExportedStruct) -> [String] { + var lines: [String] = [] + let instanceProps = structDef.properties.filter { !$0.isStatic } + + for property in instanceProps.reversed() { + let fieldName = property.name + let liftExpr = stackCodegen.liftExpression(for: property.type) + lines.append("let \(fieldName) = \(liftExpr)") + } + + let initArgs = instanceProps.map { "\($0.name): \($0.name)" }.joined(separator: ", ") + lines.append("return \(structDef.swiftCallName)(\(initArgs))") + + return lines + } + + private func generateStructLowerCode(structDef: ExportedStruct) -> [String] { + var lines: [String] = [] + let instanceProps = structDef.properties.filter { !$0.isStatic } + + for property in instanceProps { + let accessor = "self.\(property.name)" + let statements = stackCodegen.lowerStatements( + for: property.type, + accessor: accessor, + varPrefix: property.name + ) + for stmt in statements { + lines.append(stmt.description) + } + } + + return lines + } +} + +// MARK: - ProtocolCodegen + +struct ProtocolCodegen { + func renderProtocolWrapper(_ proto: ExportedProtocol, moduleName: String) throws -> [DeclSyntax] { let wrapperName = "Any\(proto.name)" let protocolName = proto.name @@ -3176,7 +3208,6 @@ public class ExportSwift { let getterBody: String if usesSideChannel { - // Optional case/raw enums use side-channel reading (Void return) getterReturnType = "" getterBody = """ \(getterAbiName)(this: Int32(bitPattern: jsObject.id)) @@ -3367,18 +3398,7 @@ extension BridgeType { return LiftingIntrinsicInfo(parameters: optionalParams) case .caseEnum: return .caseEnum case .rawValueEnum(_, let rawType): - switch rawType { - case .bool: return .bool - case .int: return .int - case .float: return .float - case .double: return .double - case .string: return .string - case .int32: return .int - case .int64: return .int - case .uint: return .int - case .uint32: return .int - case .uint64: return .int - } + return rawType.liftingIntrinsicInfo case .associatedValueEnum: return .associatedValueEnum case .swiftStruct: @@ -3422,18 +3442,7 @@ extension BridgeType { case .optional: return .optional case .caseEnum: return .caseEnum case .rawValueEnum(_, let rawType): - switch rawType { - case .bool: return .bool - case .int: return .int - case .float: return .float - case .double: return .double - case .string: return .string - case .int32: return .int - case .int64: return .int - case .uint: return .int - case .uint32: return .int - case .uint64: return .int - } + return rawType.loweringIntrinsicInfo case .associatedValueEnum: return .associatedValueEnum case .swiftStruct: @@ -3446,6 +3455,28 @@ extension BridgeType { } } +extension SwiftEnumRawType { + var liftingIntrinsicInfo: BridgeType.LiftingIntrinsicInfo { + switch self { + case .bool: return .bool + case .int, .int32, .int64, .uint, .uint32, .uint64: return .int + case .float: return .float + case .double: return .double + case .string: return .string + } + } + + var loweringIntrinsicInfo: BridgeType.LoweringIntrinsicInfo { + switch self { + case .bool: return .bool + case .int, .int32, .int64, .uint, .uint32, .uint64: return .int + case .float: return .float + case .double: return .double + case .string: return .string + } + } +} + extension DeclModifierSyntax { var isAccessControl: Bool { switch self.name.tokenKind { diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 32a211716..4f58e9a60 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -1254,6 +1254,16 @@ struct BridgeJSLink { ] } + /// Renders the thunk body (body code, cleanup, exception handling, and optional return) into a printer. + func renderFunctionBody(into printer: CodeFragmentPrinter, returnExpr: String?) { + printer.write(contentsOf: body) + printer.write(contentsOf: cleanupCode) + printer.write(lines: checkExceptionLines()) + if let returnExpr = returnExpr { + printer.write("return \(returnExpr);") + } + } + func renderFunction( name: String, parameters: [Parameter], @@ -1268,12 +1278,7 @@ struct BridgeJSLink { "\(declarationPrefixKeyword.map { "\($0) "} ?? "")\(name)(\(parameterList)) {" ) printer.indent { - printer.write(contentsOf: body) - printer.write(contentsOf: cleanupCode) - printer.write(lines: checkExceptionLines()) - if let returnExpr = returnExpr { - printer.write("return \(returnExpr);") - } + renderFunctionBody(into: printer, returnExpr: returnExpr) } printer.write("}") @@ -1300,16 +1305,10 @@ struct BridgeJSLink { if enumDef.name == name || enumDef.swiftCallName == name { // Use the stored tsFullPath which has the full namespace switch type { - case .caseEnum: - return "\(enumDef.tsFullPath)Tag" - case .rawValueEnum: - return "\(enumDef.tsFullPath)Tag" - case .associatedValueEnum: - return "\(enumDef.tsFullPath)Tag" case .namespaceEnum: return enumDef.tsFullPath default: - return type.tsType + return "\(enumDef.tsFullPath)Tag" } } } @@ -1395,12 +1394,7 @@ struct BridgeJSLink { let paramList = DefaultValueUtils.formatParameterList(constructor.parameters) constructorPrinter.write("init: function(\(paramList)) {") constructorPrinter.indent { - constructorPrinter.write(contentsOf: thunkBuilder.body) - constructorPrinter.write(contentsOf: thunkBuilder.cleanupCode) - constructorPrinter.write(lines: thunkBuilder.checkExceptionLines()) - if let returnExpr = returnExpr { - constructorPrinter.write("return \(returnExpr);") - } + thunkBuilder.renderFunctionBody(into: constructorPrinter, returnExpr: returnExpr) } constructorPrinter.write("},") jsPrinter.write(lines: constructorPrinter.lines) @@ -1709,12 +1703,7 @@ extension BridgeJSLink { let printer = CodeFragmentPrinter() printer.write("\(function.name)(\(function.parameters.map { $0.name }.joined(separator: ", "))) {") printer.indent { - printer.write(contentsOf: thunkBuilder.body) - printer.write(contentsOf: thunkBuilder.cleanupCode) - printer.write(lines: thunkBuilder.checkExceptionLines()) - if let returnExpr = returnExpr { - printer.write("return \(returnExpr);") - } + thunkBuilder.renderFunctionBody(into: printer, returnExpr: returnExpr) } printer.write("},") @@ -1766,12 +1755,7 @@ extension BridgeJSLink { "\(method.name): function(\(method.parameters.map { $0.name }.joined(separator: ", "))) {" ) methodPrinter.indent { - methodPrinter.write(contentsOf: thunkBuilder.body) - methodPrinter.write(contentsOf: thunkBuilder.cleanupCode) - methodPrinter.write(lines: thunkBuilder.checkExceptionLines()) - if let returnExpr = returnExpr { - methodPrinter.write("return \(returnExpr);") - } + thunkBuilder.renderFunctionBody(into: methodPrinter, returnExpr: returnExpr) } methodPrinter.write("},") return methodPrinter.lines @@ -1795,12 +1779,7 @@ extension BridgeJSLink { propertyPrinter.write("get \(property.name)() {") propertyPrinter.indent { - propertyPrinter.write(contentsOf: getterThunkBuilder.body) - propertyPrinter.write(contentsOf: getterThunkBuilder.cleanupCode) - propertyPrinter.write(lines: getterThunkBuilder.checkExceptionLines()) - if let returnExpr = getterReturnExpr { - propertyPrinter.write("return \(returnExpr);") - } + getterThunkBuilder.renderFunctionBody(into: propertyPrinter, returnExpr: getterReturnExpr) } propertyPrinter.write("},") @@ -1821,9 +1800,7 @@ extension BridgeJSLink { propertyPrinter.write("set \(property.name)(value) {") propertyPrinter.indent { - propertyPrinter.write(contentsOf: setterThunkBuilder.body) - propertyPrinter.write(contentsOf: setterThunkBuilder.cleanupCode) - propertyPrinter.write(lines: setterThunkBuilder.checkExceptionLines()) + setterThunkBuilder.renderFunctionBody(into: propertyPrinter, returnExpr: nil) } propertyPrinter.write("},") } @@ -1866,10 +1843,10 @@ extension BridgeJSLink { jsPrinter.write("constructor(\(constructorParamList)) {") let returnExpr = thunkBuilder.callConstructor(abiName: constructor.abiName) jsPrinter.indent { - jsPrinter.write(contentsOf: thunkBuilder.body) - jsPrinter.write(contentsOf: thunkBuilder.cleanupCode) - jsPrinter.write(lines: thunkBuilder.checkExceptionLines()) - jsPrinter.write("return \(klass.name).__construct(\(returnExpr));") + thunkBuilder.renderFunctionBody( + into: jsPrinter, + returnExpr: "\(klass.name).__construct(\(returnExpr))" + ) } jsPrinter.write("}") } @@ -1938,114 +1915,80 @@ extension BridgeJSLink { // Generate property getters and setters for property in klass.properties { - if property.isStatic { - // Generate static property getter - let getterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) - let getterReturnExpr = try getterThunkBuilder.call( - abiName: property.getterAbiName(), - returnType: property.type - ) + try renderClassProperty( + property: property, + className: klass.name, + isStatic: property.isStatic, + jsPrinter: jsPrinter, + dtsPrinter: property.isStatic ? dtsExportEntryPrinter : dtsTypePrinter + ) + } - jsPrinter.indent { - jsPrinter.write( - lines: getterThunkBuilder.renderFunction( - name: property.name, - parameters: [], - returnExpr: getterReturnExpr, - declarationPrefixKeyword: "static get" - ) - ) - } + jsPrinter.write("}") + dtsTypePrinter.write("}") + dtsExportEntryPrinter.write("}") - // Generate static property setter if not readonly - if !property.isReadonly { - let setterThunkBuilder = ExportedThunkBuilder( - effects: Effects(isAsync: false, isThrows: false) - ) - try setterThunkBuilder.lowerParameter( - param: Parameter(label: "value", name: "value", type: property.type) - ) - _ = try setterThunkBuilder.call( - abiName: property.setterAbiName(), - returnType: .void - ) + return (jsPrinter.lines, dtsTypePrinter.lines, dtsExportEntryPrinter.lines) + } - jsPrinter.indent { - jsPrinter.write( - lines: setterThunkBuilder.renderFunction( - name: property.name, - parameters: [.init(label: nil, name: "value", type: property.type)], - returnExpr: nil, - declarationPrefixKeyword: "static set" - ) - ) - } - } + private func renderClassProperty( + property: ExportedProperty, + className: String, + isStatic: Bool, + jsPrinter: CodeFragmentPrinter, + dtsPrinter: CodeFragmentPrinter + ) throws { + let getterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) + if !isStatic { + getterThunkBuilder.lowerSelf() + } - // Add static property to TypeScript exports definition (not instance interface) - let readonly = property.isReadonly ? "readonly " : "" - dtsExportEntryPrinter.indent { - dtsExportEntryPrinter.write("\(readonly)\(property.name): \(property.type.tsType);") - } - } else { - // Generate instance property getter - let getterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) - getterThunkBuilder.lowerSelf() - let getterReturnExpr = try getterThunkBuilder.call( - abiName: property.getterAbiName(className: klass.name), - returnType: property.type - ) + let getterAbiName = isStatic ? property.getterAbiName() : property.getterAbiName(className: className) + let getterReturnExpr = try getterThunkBuilder.call(abiName: getterAbiName, returnType: property.type) - jsPrinter.indent { - jsPrinter.write( - lines: getterThunkBuilder.renderFunction( - name: property.name, - parameters: [], - returnExpr: getterReturnExpr, - declarationPrefixKeyword: "get" - ) - ) - } + let getterKeyword = isStatic ? "static get" : "get" + jsPrinter.indent { + jsPrinter.write( + lines: getterThunkBuilder.renderFunction( + name: property.name, + parameters: [], + returnExpr: getterReturnExpr, + declarationPrefixKeyword: getterKeyword + ) + ) + } - // Generate instance property setter if not readonly - if !property.isReadonly { - let setterThunkBuilder = ExportedThunkBuilder( - effects: Effects(isAsync: false, isThrows: false) - ) - setterThunkBuilder.lowerSelf() - try setterThunkBuilder.lowerParameter( - param: Parameter(label: "value", name: "value", type: property.type) - ) - _ = try setterThunkBuilder.call( - abiName: property.setterAbiName(className: klass.name), - returnType: .void - ) + // Generate setter if not readonly + if !property.isReadonly { + let setterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) + if !isStatic { + setterThunkBuilder.lowerSelf() + } + try setterThunkBuilder.lowerParameter( + param: Parameter(label: "value", name: "value", type: property.type) + ) - jsPrinter.indent { - jsPrinter.write( - lines: setterThunkBuilder.renderFunction( - name: property.name, - parameters: [.init(label: nil, name: "value", type: property.type)], - returnExpr: nil, - declarationPrefixKeyword: "set" - ) - ) - } - } + let setterAbiName = isStatic ? property.setterAbiName() : property.setterAbiName(className: className) + _ = try setterThunkBuilder.call(abiName: setterAbiName, returnType: .void) - // Add instance property to TypeScript interface definition - let readonly = property.isReadonly ? "readonly " : "" - dtsTypePrinter.indent { - dtsTypePrinter.write("\(readonly)\(property.name): \(property.type.tsType);") - } + let setterKeyword = isStatic ? "static set" : "set" + jsPrinter.indent { + jsPrinter.write( + lines: setterThunkBuilder.renderFunction( + name: property.name, + parameters: [.init(label: nil, name: "value", type: property.type)], + returnExpr: nil, + declarationPrefixKeyword: setterKeyword + ) + ) } } - jsPrinter.write("}") - dtsTypePrinter.write("}") - dtsExportEntryPrinter.write("}") - - return (jsPrinter.lines, dtsTypePrinter.lines, dtsExportEntryPrinter.lines) + // Add instance property to TypeScript interface definition + let readonly = property.isReadonly ? "readonly " : "" + dtsPrinter.indent { + dtsPrinter.write("\(readonly)\(property.name): \(property.type.tsType);") + } } class ImportedThunkBuilder { diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 7f2dab8ee..286c9a380 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -1,5 +1,6 @@ import XCTest import JavaScriptKit +import JavaScriptEventLoop @_extern(wasm, module: "BridgeJSRuntimeTests", name: "runJsWorks") @_extern(c) @@ -1383,7 +1384,7 @@ class ExportAPITests: XCTestCase { XCTAssertTrue(hasDeinitCalculator, "Calculator (without @JS init) should have been deinitialized") } - // func testAllAsync() async throws { - // _ = try await runAsyncWorks().value() - // } + func testAllAsync() async throws { + _ = try await runAsyncWorks().value() + } } From d5399ebdeb4c0a8493c49b743b4f5649d425c635 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Wed, 7 Jan 2026 14:41:47 +0000 Subject: [PATCH 056/252] Use `swift format` command provided by the Swift toolchain As `swift-format` is included in recent Swift toolchains, we can rely on that instead of requiring `swift-format` to be preinstalled. Without this change the formatting script produces `swift-format not found in PATH` error, when `swift-format` is not redundantly installed outside of the Swift toolchain. --- Utilities/format.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/format.swift b/Utilities/format.swift index 9df282ad7..d26cbe2f3 100755 --- a/Utilities/format.swift +++ b/Utilities/format.swift @@ -38,7 +38,7 @@ func which(_ executable: String) -> URL? { /// Runs the `swift-format` command with the given arguments in the project root. func swiftFormat(_ arguments: [String]) throws { - guard let swiftFormat = which("swift-format") else { + guard let swiftFormat = which("swift") else { print("swift-format not found in PATH") exit(1) } @@ -93,7 +93,7 @@ switch arguments.first { case "lint": try swiftFormat(["lint", "--parallel", "--recursive"] + filesToFormat()) case "format", nil: - try swiftFormat(["format", "--parallel", "--in-place", "--recursive"] + filesToFormat()) + try swiftFormat(["format", "format", "--parallel", "--in-place", "--recursive"] + filesToFormat()) case let subcommand?: print("Unknown subcommand: \(subcommand)") print("Usage: format.swift lint|format") From 721f662a4a253187b01a7d00c24f356b9909d34e Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Wed, 7 Jan 2026 18:01:00 +0000 Subject: [PATCH 057/252] Fix typo: rename `BridgeJSInstrincics` to `BridgeJSIntrinsics` (#485) * Fix typo: rename `BridgeJSInstrincics` to `BridgeJSIntrinsic` * Rename`BridgeJSIntrincics.h` * Fix typo in modulemap header filename * Fix typo in documentation comment for IntrinsicJSFragment * Rename BridgeJSIntrinsic.swift to BridgeJSIntrinsics.swift * Fix typo in BridgeJSIntrinsics reference --- CONTRIBUTING.md | 2 +- Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift | 2 +- .../{BridgeJSInstrincics.swift => BridgeJSIntrinsics.swift} | 0 .../include/{BridgeJSInstrincics.h => BridgeJSIntrinsics.h} | 4 ++-- Sources/_CJavaScriptKit/include/module.modulemap | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename Sources/JavaScriptKit/{BridgeJSInstrincics.swift => BridgeJSIntrinsics.swift} (100%) rename Sources/_CJavaScriptKit/include/{BridgeJSInstrincics.h => BridgeJSIntrinsics.h} (74%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9ca71ef13..712aeffb7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -114,7 +114,7 @@ These changes require updating the pre-generated Swift bindings committed to the **Adding new BridgeJS intrinsics:** -If you add new `@_extern(wasm, module: "bjs")` functions to [`BridgeJSInstrincics.swift`](Sources/JavaScriptKit/BridgeJSInstrincics.swift), also add corresponding stub entries to [`Plugins/PackageToJS/Templates/instantiate.js`](Plugins/PackageToJS/Templates/instantiate.js) in the `importObject["bjs"]` object. This allows packages without BridgeJS-generated code to instantiate successfully. +If you add new `@_extern(wasm, module: "bjs")` functions to [`BridgeJSIntrinsics.swift`](Sources/JavaScriptKit/BridgeJSIntrinsics.swift), also add corresponding stub entries to [`Plugins/PackageToJS/Templates/instantiate.js`](Plugins/PackageToJS/Templates/instantiate.js) in the `importObject["bjs"]` object. This allows packages without BridgeJS-generated code to instantiate successfully. ## Support If you have any questions or need assistance, feel free to reach out via [GitHub Issues](https://github.com/swiftwasm/JavaScriptKit/issues) or [Discord](https://discord.gg/ashJW8T8yp). diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 23fb2b533..feaf34832 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -78,7 +78,7 @@ final class JSGlueVariableScope { /// A fragment of JS code used to convert a value between Swift and JS. /// -/// See `BridgeJSInstrincics.swift` in the main JavaScriptKit module for Swift side lowering/lifting implementation. +/// See `BridgeJSIntrinsics.swift` in the main JavaScriptKit module for Swift side lowering/lifting implementation. struct IntrinsicJSFragment: Sendable { /// The names of the parameters that the fragment expects. let parameters: [String] diff --git a/Sources/JavaScriptKit/BridgeJSInstrincics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift similarity index 100% rename from Sources/JavaScriptKit/BridgeJSInstrincics.swift rename to Sources/JavaScriptKit/BridgeJSIntrinsics.swift diff --git a/Sources/_CJavaScriptKit/include/BridgeJSInstrincics.h b/Sources/_CJavaScriptKit/include/BridgeJSIntrinsics.h similarity index 74% rename from Sources/_CJavaScriptKit/include/BridgeJSInstrincics.h rename to Sources/_CJavaScriptKit/include/BridgeJSIntrinsics.h index 7ca098609..f396d1f23 100644 --- a/Sources/_CJavaScriptKit/include/BridgeJSInstrincics.h +++ b/Sources/_CJavaScriptKit/include/BridgeJSIntrinsics.h @@ -1,5 +1,5 @@ -#ifndef _CJavaScriptKit_BridgeJSInstrincics_h -#define _CJavaScriptKit_BridgeJSInstrincics_h +#ifndef _CJavaScriptKit_BridgeJSIntrinsics_h +#define _CJavaScriptKit_BridgeJSIntrinsics_h #include #include "WasmGlobalMacros.h" diff --git a/Sources/_CJavaScriptKit/include/module.modulemap b/Sources/_CJavaScriptKit/include/module.modulemap index 3afe12831..f2d3c162e 100644 --- a/Sources/_CJavaScriptKit/include/module.modulemap +++ b/Sources/_CJavaScriptKit/include/module.modulemap @@ -1,5 +1,5 @@ module _CJavaScriptKit { header "_CJavaScriptKit.h" - header "BridgeJSInstrincics.h" + header "BridgeJSIntrinsics.h" export * } From b8311c47f76889e93be9eb03637ca67a6c85149b Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 8 Jan 2026 17:34:23 +0900 Subject: [PATCH 058/252] BridgeJS: Fix multifile declaration resolution order issue Close https://github.com/swiftwasm/JavaScriptKit/issues/487 --- Plugins/BridgeJS/Package.swift | 2 +- .../Sources/BridgeJSCore/ExportSwift.swift | 33 ++-- .../BridgeJSToolTests/ExportSwiftTests.swift | 74 +++++++++ .../MultifileInputs/CrossFileClassA.swift | 3 + .../MultifileInputs/CrossFileClassB.swift | 3 + .../MultifileInputs/CrossFileFunctionA.swift | 18 +++ .../MultifileInputs/CrossFileFunctionB.swift | 7 + .../CrossFileFunctionTypes.ReverseOrder.json | 150 ++++++++++++++++++ .../CrossFileFunctionTypes.ReverseOrder.swift | 125 +++++++++++++++ .../CrossFileFunctionTypes.json | 150 ++++++++++++++++++ .../CrossFileFunctionTypes.swift | 125 +++++++++++++++ .../CrossFileTypeResolution.ReverseOrder.json | 62 ++++++++ ...CrossFileTypeResolution.ReverseOrder.swift | 81 ++++++++++ .../CrossFileTypeResolution.json | 62 ++++++++ .../CrossFileTypeResolution.swift | 81 ++++++++++ 15 files changed, 966 insertions(+), 10 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileClassA.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileClassB.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileFunctionA.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileFunctionB.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift diff --git a/Plugins/BridgeJS/Package.swift b/Plugins/BridgeJS/Package.swift index bb7daac25..36b920521 100644 --- a/Plugins/BridgeJS/Package.swift +++ b/Plugins/BridgeJS/Package.swift @@ -54,7 +54,7 @@ let package = Package( "BridgeJSLink", "TS2Skeleton", ], - exclude: ["__Snapshots__", "Inputs"] + exclude: ["__Snapshots__", "Inputs", "MultifileInputs"] ), ] ) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 6ced425a1..e5344a45e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -28,6 +28,7 @@ public class ExportSwift { private var exportedProtocols: [ExportedProtocol] = [] private var exportedProtocolNameByKey: [String: String] = [:] private var typeDeclResolver: TypeDeclResolver = TypeDeclResolver() + private var sourceFiles: [(sourceFile: SourceFileSyntax, inputFilePath: String)] = [] public init(progress: ProgressReporting, moduleName: String, exposeToGlobal: Bool) { self.progress = progress @@ -41,16 +42,9 @@ public class ExportSwift { /// - sourceFile: The parsed Swift source file to process /// - inputFilePath: The file path for error reporting public func addSourceFile(_ sourceFile: SourceFileSyntax, _ inputFilePath: String) throws { - progress.print("Processing \(inputFilePath)") + // First, register type declarations before walking for exposed APIs typeDeclResolver.addSourceFile(sourceFile) - - let errors = try parseSingleFile(sourceFile) - if errors.count > 0 { - throw BridgeJSCoreError( - errors.map { $0.formattedDescription(fileName: inputFilePath) } - .joined(separator: "\n") - ) - } + sourceFiles.append((sourceFile, inputFilePath)) } /// Finalizes the export process and generates the bridge code @@ -60,6 +54,27 @@ public class ExportSwift { /// - Returns: A tuple containing the generated Swift code and a skeleton /// describing the exported APIs public func finalize() throws -> (outputSwift: String, outputSkeleton: ExportedSkeleton)? { + // Walk through each source file and collect exported APIs + var perSourceErrors: [(inputFilePath: String, errors: [DiagnosticError])] = [] + for (sourceFile, inputFilePath) in sourceFiles { + progress.print("Processing \(inputFilePath)") + let errors = try parseSingleFile(sourceFile) + if errors.count > 0 { + perSourceErrors.append((inputFilePath: inputFilePath, errors: errors)) + } + } + + if !perSourceErrors.isEmpty { + // Aggregate and throw all errors + var allErrors: [String] = [] + for (inputFilePath, errors) in perSourceErrors { + for error in errors { + allErrors.append(error.formattedDescription(fileName: inputFilePath)) + } + } + throw BridgeJSCoreError(allErrors.joined(separator: "\n")) + } + guard let outputSwift = try renderSwiftGlue() else { return nil } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift index 32c3aae73..41e118315 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift @@ -39,6 +39,11 @@ import Testing "Inputs" ) + static let multifileInputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent() + .appendingPathComponent( + "MultifileInputs" + ) + static func collectInputs() -> [String] { let fileManager = FileManager.default let inputs = try! fileManager.contentsOfDirectory(atPath: Self.inputsDirectory.path) @@ -69,4 +74,73 @@ import Testing let name = url.deletingPathExtension().lastPathComponent try snapshot(swiftAPI: swiftAPI, name: name + ".Global") } + + @Test + func snapshotCrossFileTypeResolution() throws { + // Test that types defined in one file can be referenced from another file + // This tests the fix for cross-file type resolution in BridgeJS + let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + + // Add ClassB first, then ClassA (which references ClassB) + let classBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassB.swift") + let classBSourceFile = Parser.parse(source: try String(contentsOf: classBURL, encoding: .utf8)) + try swiftAPI.addSourceFile(classBSourceFile, "CrossFileClassB.swift") + + let classAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassA.swift") + let classASourceFile = Parser.parse(source: try String(contentsOf: classAURL, encoding: .utf8)) + try swiftAPI.addSourceFile(classASourceFile, "CrossFileClassA.swift") + + try snapshot(swiftAPI: swiftAPI, name: "CrossFileTypeResolution") + } + + @Test + func snapshotCrossFileTypeResolutionReverseOrder() throws { + // Test that types can be resolved regardless of the order files are added + // Add ClassA first (which references ClassB), then ClassB + let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + + let classAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassA.swift") + let classASourceFile = Parser.parse(source: try String(contentsOf: classAURL, encoding: .utf8)) + try swiftAPI.addSourceFile(classASourceFile, "CrossFileClassA.swift") + + let classBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassB.swift") + let classBSourceFile = Parser.parse(source: try String(contentsOf: classBURL, encoding: .utf8)) + try swiftAPI.addSourceFile(classBSourceFile, "CrossFileClassB.swift") + + try snapshot(swiftAPI: swiftAPI, name: "CrossFileTypeResolution.ReverseOrder") + } + + @Test + func snapshotCrossFileFunctionTypes() throws { + // Test that functions and methods can use cross-file types as parameters and return types + let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + + // Add FunctionB first, then FunctionA (which references FunctionB in methods and functions) + let functionBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionB.swift") + let functionBSourceFile = Parser.parse(source: try String(contentsOf: functionBURL, encoding: .utf8)) + try swiftAPI.addSourceFile(functionBSourceFile, "CrossFileFunctionB.swift") + + let functionAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionA.swift") + let functionASourceFile = Parser.parse(source: try String(contentsOf: functionAURL, encoding: .utf8)) + try swiftAPI.addSourceFile(functionASourceFile, "CrossFileFunctionA.swift") + + try snapshot(swiftAPI: swiftAPI, name: "CrossFileFunctionTypes") + } + + @Test + func snapshotCrossFileFunctionTypesReverseOrder() throws { + // Test that function types can be resolved regardless of the order files are added + let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + + // Add FunctionA first (which references FunctionB), then FunctionB + let functionAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionA.swift") + let functionASourceFile = Parser.parse(source: try String(contentsOf: functionAURL, encoding: .utf8)) + try swiftAPI.addSourceFile(functionASourceFile, "CrossFileFunctionA.swift") + + let functionBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionB.swift") + let functionBSourceFile = Parser.parse(source: try String(contentsOf: functionBURL, encoding: .utf8)) + try swiftAPI.addSourceFile(functionBSourceFile, "CrossFileFunctionB.swift") + + try snapshot(swiftAPI: swiftAPI, name: "CrossFileFunctionTypes.ReverseOrder") + } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileClassA.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileClassA.swift new file mode 100644 index 000000000..a26cae313 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileClassA.swift @@ -0,0 +1,3 @@ +@JS class ClassA { + @JS var linkedB: ClassB? +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileClassB.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileClassB.swift new file mode 100644 index 000000000..c7c5b80d9 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileClassB.swift @@ -0,0 +1,3 @@ +@JS class ClassB { + @JS init() {} +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileFunctionA.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileFunctionA.swift new file mode 100644 index 000000000..9a2929e8e --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileFunctionA.swift @@ -0,0 +1,18 @@ +@JS class FunctionA { + @JS init() {} + + // Method that takes a cross-file type as parameter + @JS func processB(b: FunctionB) -> String { + return "Processed \(b.value)" + } + + // Method that returns a cross-file type + @JS func createB(value: String) -> FunctionB { + return FunctionB(value: value) + } +} + +// Standalone function that uses cross-file types +@JS func standaloneFunction(b: FunctionB) -> FunctionB { + return b +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileFunctionB.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileFunctionB.swift new file mode 100644 index 000000000..9c1828219 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileFunctionB.swift @@ -0,0 +1,7 @@ +@JS class FunctionB { + @JS var value: String + + @JS init(value: String) { + self.value = value + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.json new file mode 100644 index 000000000..faff44843 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.json @@ -0,0 +1,150 @@ +{ + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_FunctionA_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_FunctionA_processB", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processB", + "parameters" : [ + { + "label" : "b", + "name" : "b", + "type" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_FunctionA_createB", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createB", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "name" : "FunctionA", + "properties" : [ + + ], + "swiftCallName" : "FunctionA" + }, + { + "constructor" : { + "abiName" : "bjs_FunctionB_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "FunctionB", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "FunctionB" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_standaloneFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "standaloneFunction", + "parameters" : [ + { + "label" : "b", + "name" : "b", + "type" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "moduleName" : "TestModule", + "protocols" : [ + + ], + "structs" : [ + + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift new file mode 100644 index 000000000..e50c67861 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift @@ -0,0 +1,125 @@ +// 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 + +@_expose(wasm, "bjs_standaloneFunction") +@_cdecl("bjs_standaloneFunction") +public func _bjs_standaloneFunction(b: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = standaloneFunction(b: FunctionB.bridgeJSLiftParameter(b)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionA_init") +@_cdecl("bjs_FunctionA_init") +public func _bjs_FunctionA_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = FunctionA() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionA_processB") +@_cdecl("bjs_FunctionA_processB") +public func _bjs_FunctionA_processB(_self: UnsafeMutableRawPointer, b: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = FunctionA.bridgeJSLiftParameter(_self).processB(b: FunctionB.bridgeJSLiftParameter(b)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionA_createB") +@_cdecl("bjs_FunctionA_createB") +public func _bjs_FunctionA_createB(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = FunctionA.bridgeJSLiftParameter(_self).createB(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionA_deinit") +@_cdecl("bjs_FunctionA_deinit") +public func _bjs_FunctionA_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension FunctionA: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_FunctionA_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_FunctionA_wrap") +fileprivate func _bjs_FunctionA_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_FunctionA_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_FunctionB_init") +@_cdecl("bjs_FunctionB_init") +public func _bjs_FunctionB_init(valueBytes: Int32, valueLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = FunctionB(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionB_value_get") +@_cdecl("bjs_FunctionB_value_get") +public func _bjs_FunctionB_value_get(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = FunctionB.bridgeJSLiftParameter(_self).value + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionB_value_set") +@_cdecl("bjs_FunctionB_value_set") +public func _bjs_FunctionB_value_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + FunctionB.bridgeJSLiftParameter(_self).value = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionB_deinit") +@_cdecl("bjs_FunctionB_deinit") +public func _bjs_FunctionB_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension FunctionB: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_FunctionB_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_FunctionB_wrap") +fileprivate func _bjs_FunctionB_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_FunctionB_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.json new file mode 100644 index 000000000..a0caf3bc9 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.json @@ -0,0 +1,150 @@ +{ + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_FunctionB_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "FunctionB", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "FunctionB" + }, + { + "constructor" : { + "abiName" : "bjs_FunctionA_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_FunctionA_processB", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processB", + "parameters" : [ + { + "label" : "b", + "name" : "b", + "type" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_FunctionA_createB", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createB", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "name" : "FunctionA", + "properties" : [ + + ], + "swiftCallName" : "FunctionA" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_standaloneFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "standaloneFunction", + "parameters" : [ + { + "label" : "b", + "name" : "b", + "type" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "moduleName" : "TestModule", + "protocols" : [ + + ], + "structs" : [ + + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift new file mode 100644 index 000000000..e8077c5c4 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift @@ -0,0 +1,125 @@ +// 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 + +@_expose(wasm, "bjs_standaloneFunction") +@_cdecl("bjs_standaloneFunction") +public func _bjs_standaloneFunction(b: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = standaloneFunction(b: FunctionB.bridgeJSLiftParameter(b)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionB_init") +@_cdecl("bjs_FunctionB_init") +public func _bjs_FunctionB_init(valueBytes: Int32, valueLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = FunctionB(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionB_value_get") +@_cdecl("bjs_FunctionB_value_get") +public func _bjs_FunctionB_value_get(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = FunctionB.bridgeJSLiftParameter(_self).value + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionB_value_set") +@_cdecl("bjs_FunctionB_value_set") +public func _bjs_FunctionB_value_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { + #if arch(wasm32) + FunctionB.bridgeJSLiftParameter(_self).value = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionB_deinit") +@_cdecl("bjs_FunctionB_deinit") +public func _bjs_FunctionB_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension FunctionB: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_FunctionB_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_FunctionB_wrap") +fileprivate func _bjs_FunctionB_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_FunctionB_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_FunctionA_init") +@_cdecl("bjs_FunctionA_init") +public func _bjs_FunctionA_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = FunctionA() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionA_processB") +@_cdecl("bjs_FunctionA_processB") +public func _bjs_FunctionA_processB(_self: UnsafeMutableRawPointer, b: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = FunctionA.bridgeJSLiftParameter(_self).processB(b: FunctionB.bridgeJSLiftParameter(b)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionA_createB") +@_cdecl("bjs_FunctionA_createB") +public func _bjs_FunctionA_createB(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = FunctionA.bridgeJSLiftParameter(_self).createB(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_FunctionA_deinit") +@_cdecl("bjs_FunctionA_deinit") +public func _bjs_FunctionA_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension FunctionA: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_FunctionA_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_FunctionA_wrap") +fileprivate func _bjs_FunctionA_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_FunctionA_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.json new file mode 100644 index 000000000..aa4242cd7 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.json @@ -0,0 +1,62 @@ +{ + "classes" : [ + { + "methods" : [ + + ], + "name" : "ClassA", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "linkedB", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "ClassB" + } + } + } + } + } + ], + "swiftCallName" : "ClassA" + }, + { + "constructor" : { + "abiName" : "bjs_ClassB_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + + ], + "name" : "ClassB", + "properties" : [ + + ], + "swiftCallName" : "ClassB" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "moduleName" : "TestModule", + "protocols" : [ + + ], + "structs" : [ + + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift new file mode 100644 index 000000000..a270c0e9d --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift @@ -0,0 +1,81 @@ +// 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 + +@_expose(wasm, "bjs_ClassA_linkedB_get") +@_cdecl("bjs_ClassA_linkedB_get") +public func _bjs_ClassA_linkedB_get(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ClassA.bridgeJSLiftParameter(_self).linkedB + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassA_linkedB_set") +@_cdecl("bjs_ClassA_linkedB_set") +public func _bjs_ClassA_linkedB_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ClassA.bridgeJSLiftParameter(_self).linkedB = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassA_deinit") +@_cdecl("bjs_ClassA_deinit") +public func _bjs_ClassA_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension ClassA: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ClassA_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_ClassA_wrap") +fileprivate func _bjs_ClassA_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ClassA_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_ClassB_init") +@_cdecl("bjs_ClassB_init") +public func _bjs_ClassB_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ClassB() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassB_deinit") +@_cdecl("bjs_ClassB_deinit") +public func _bjs_ClassB_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension ClassB: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ClassB_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_ClassB_wrap") +fileprivate func _bjs_ClassB_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ClassB_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.json new file mode 100644 index 000000000..e6acc7f35 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.json @@ -0,0 +1,62 @@ +{ + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_ClassB_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + + ], + "name" : "ClassB", + "properties" : [ + + ], + "swiftCallName" : "ClassB" + }, + { + "methods" : [ + + ], + "name" : "ClassA", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "linkedB", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "ClassB" + } + } + } + } + } + ], + "swiftCallName" : "ClassA" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "moduleName" : "TestModule", + "protocols" : [ + + ], + "structs" : [ + + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift new file mode 100644 index 000000000..ed05f7c24 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift @@ -0,0 +1,81 @@ +// 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 + +@_expose(wasm, "bjs_ClassB_init") +@_cdecl("bjs_ClassB_init") +public func _bjs_ClassB_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ClassB() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassB_deinit") +@_cdecl("bjs_ClassB_deinit") +public func _bjs_ClassB_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension ClassB: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ClassB_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_ClassB_wrap") +fileprivate func _bjs_ClassB_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ClassB_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_ClassA_linkedB_get") +@_cdecl("bjs_ClassA_linkedB_get") +public func _bjs_ClassA_linkedB_get(_self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ClassA.bridgeJSLiftParameter(_self).linkedB + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassA_linkedB_set") +@_cdecl("bjs_ClassA_linkedB_set") +public func _bjs_ClassA_linkedB_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ClassA.bridgeJSLiftParameter(_self).linkedB = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassA_deinit") +@_cdecl("bjs_ClassA_deinit") +public func _bjs_ClassA_deinit(pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +extension ClassA: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ClassA_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_ClassA_wrap") +fileprivate func _bjs_ClassA_wrap(_: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ClassA_wrap(_: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file From b050829c7a5c29c9644a85c33c40a2086ffbc89a Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Thu, 8 Jan 2026 08:55:11 +0000 Subject: [PATCH 059/252] Merge pull request #483 from swiftwasm/maxd/fix-embedded-example Fix `Examples/Embedded` not building with Swift 6.2.3 --- Examples/Embedded/Package.swift | 21 ++--------- .../_thingsThatShouldNotBeNeeded.swift | 36 ------------------- Examples/Embedded/build.sh | 5 ++- Plugins/PackageToJS/Tests/ExampleTests.swift | 12 ------- 4 files changed, 5 insertions(+), 69 deletions(-) delete mode 100644 Examples/Embedded/Sources/EmbeddedApp/_thingsThatShouldNotBeNeeded.swift diff --git a/Examples/Embedded/Package.swift b/Examples/Embedded/Package.swift index 5ae19adc6..42702394a 100644 --- a/Examples/Embedded/Package.swift +++ b/Examples/Embedded/Package.swift @@ -5,32 +5,17 @@ import PackageDescription let package = Package( name: "Embedded", dependencies: [ - .package(name: "JavaScriptKit", path: "../../"), - .package(url: "https://github.com/swiftwasm/swift-dlmalloc", branch: "0.1.0"), + .package(name: "JavaScriptKit", path: "../../") ], targets: [ .executableTarget( name: "EmbeddedApp", dependencies: [ - "JavaScriptKit", - .product(name: "dlmalloc", package: "swift-dlmalloc"), + "JavaScriptKit" ], - cSettings: [.unsafeFlags(["-fdeclspec"])], swiftSettings: [ - .enableExperimentalFeature("Embedded"), - .enableExperimentalFeature("Extern"), - .unsafeFlags([ - "-Xfrontend", "-gnone", - "-Xfrontend", "-disable-stack-protector", - ]), + .enableExperimentalFeature("Extern") ], - linkerSettings: [ - .unsafeFlags([ - "-Xclang-linker", "-nostdlib", - "-Xlinker", "--no-entry", - "-Xlinker", "--export-if-defined=__main_argc_argv", - ]) - ] ) ], swiftLanguageModes: [.v5] diff --git a/Examples/Embedded/Sources/EmbeddedApp/_thingsThatShouldNotBeNeeded.swift b/Examples/Embedded/Sources/EmbeddedApp/_thingsThatShouldNotBeNeeded.swift deleted file mode 100644 index 8f45ccee9..000000000 --- a/Examples/Embedded/Sources/EmbeddedApp/_thingsThatShouldNotBeNeeded.swift +++ /dev/null @@ -1,36 +0,0 @@ -import JavaScriptKit - -// NOTE: it seems the embedded tree shaker gets rid of these exports if they are not used somewhere -func _i_need_to_be_here_for_wasm_exports_to_work() { - _ = _swjs_library_features - _ = _swjs_call_host_function - _ = _swjs_free_host_function -} - -// TODO: why do I need this? and surely this is not ideal... figure this out, or at least have this come from a C lib -@_cdecl("strlen") -func strlen(_ s: UnsafePointer) -> Int { - var p = s - while p.pointee != 0 { - p += 1 - } - return p - s -} - -enum LCG { - static var x: UInt8 = 0 - static let a: UInt8 = 0x05 - static let c: UInt8 = 0x0b - - static func next() -> UInt8 { - x = a &* x &+ c - return x - } -} - -@_cdecl("arc4random_buf") -public func arc4random_buf(_ buffer: UnsafeMutableRawPointer, _ size: Int) { - for i in 0..=6.3) - @Test(.requireEmbeddedSwiftInToolchain(triple: "wasm32-unknown-none-wasm")) - func embeddedWasmUnknownNone() throws { - try withPackage(at: "Examples/Embedded") { packageDir, _, runSwift in - try runSwift( - ["package", "--triple", "wasm32-unknown-none-wasm", "js", "-c", "release"], - [ - "JAVASCRIPTKIT_EXPERIMENTAL_EMBEDDED_WASM": "true" - ] - ) - } - } - @Test(.requireEmbeddedSwiftInSwiftSDK()) func embeddedWasmUnknownWasi() throws { let swiftSDKID = try #require(Self.getEmbeddedSwiftSDKID()) From a277afbbc057d468961a42dbd4b9e3f6b404c7ff Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 12 Jan 2026 14:39:33 +0900 Subject: [PATCH 060/252] Documentation: Add JavaScript Interop Cheat Sheet (#491) --- .../JavaScript-Interop-Cheat-Sheet.md | 376 ++++++++++++++++++ .../Documentation.docc/Documentation.md | 1 + 2 files changed, 377 insertions(+) create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/JavaScript-Interop-Cheat-Sheet.md diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/JavaScript-Interop-Cheat-Sheet.md b/Sources/JavaScriptKit/Documentation.docc/Articles/JavaScript-Interop-Cheat-Sheet.md new file mode 100644 index 000000000..4280a4637 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/JavaScript-Interop-Cheat-Sheet.md @@ -0,0 +1,376 @@ +# JavaScript Interop Cheat Sheet + +Practical recipes for manipulating JavaScript values from Swift with JavaScriptKit. Each section shows the shortest path to access, call, or convert the APIs you interact with the most. + +## Access JavaScript Values + +### Global entry points + +```swift +let global: JSObject = JSObject.global +let document: JSObject = global.document.object! +let math: JSObject = global.Math.object! +``` + +- Use ``JSObject/global`` for `globalThis` and drill into properties. +- Accessing through [dynamic member lookup](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0195-dynamic-member-lookup.md) returns ``JSValue``; call `.object`, `.number`, `.string`, etc. to unwrap a concrete type (callable values are represented as ``JSObject`` as well). +- Prefer storing ``JSObject`` references (`document` above) when you call multiple members to avoid repeated conversions (for performance). + +### Properties, subscripts, and symbols + +```swift +extension JSObject { + public subscript(_ name: String) -> JSValue { get set } + public subscript(_ index: Int) -> JSValue { get set } + public subscript(_ name: JSSymbol) -> JSValue { get set } + /// Use this API when you want to avoid repeated String serialization overhead + public subscript(_ name: JSString) -> JSValue { get set } + /// A convenience method of `subscript(_ name: String) -> JSValue` + /// to access the member through Dynamic Member Lookup. + /// ```swift + /// let document: JSObject = JSObject.global.document.object! + /// ``` + public subscript(dynamicMember name: String) -> JSValue { get set } +} +extension JSValue { + /// An unsafe convenience method of `JSObject.subscript(_ index: Int) -> JSValue` + /// - Precondition: `self` must be a JavaScript Object. + public subscript(dynamicMember name: String) -> JSValue + public subscript(_ index: Int) -> JSValue +} +``` + +**Example** + +```swift +document.title = .string("Swift <3 Web") +let obj = JSObject.global.myObject.object! +let value = obj["key"].string // Access object property with String +let propName = JSString("key") +let value2 = obj[propName].string // Access object property with JSString + +let array = JSObject.global.Array.object!.new(1, 2, 3) +array[0] = .number(10) // Assign to array index + +let symbol = JSSymbol("secret") +let data = obj[symbol].object +``` + +## Call Functions and Methods + +```swift +extension JSObject { + /// Call this function with given `arguments` using [Callable values of user-defined nominal types](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0253-callable.md) + /// ```swift + /// let alert = JSObject.global.alert.object! + /// alert("Hello from Swift") + /// ``` + public func callAsFunction(_ arguments: ConvertibleToJSValue...) -> JSValue + public func callAsFunction(this: JSObject, _ arguments: ConvertibleToJSValue...) -> JSValue + + /// Returns the `name` member method binding this object as `this` context. + public subscript(_ name: String) -> ((ConvertibleToJSValue...) -> JSValue)? { get } + public subscript(_ name: JSString) -> ((ConvertibleToJSValue...) -> JSValue)? { get } + /// A convenience method of `subscript(_ name: String) -> ((ConvertibleToJSValue...) -> JSValue)?` to access the member through Dynamic Member Lookup. + /// ```swift + /// let document = JSObject.global.document.object! + /// let divElement = document.createElement!("div") + /// ``` + public subscript(dynamicMember name: String) -> ((ConvertibleToJSValue...) -> JSValue)? { get } +} +extension JSValue { + /// An unsafe convenience method of `JSObject.subscript(_ name: String) -> ((ConvertibleToJSValue...) -> JSValue)?` + /// - Precondition: `self` must be a JavaScript Object and specified member should be a callable object. + public subscript(dynamicMember name: String) -> ((ConvertibleToJSValue...) -> JSValue) +} +``` + +**Example** + +```swift +let alert = JSObject.global.alert.object! +alert("Hello from Swift") + +let console = JSObject.global.console.object! +_ = console.log!("Cheat sheet ready", 1, true) + +let document = JSObject.global.document.object! +let button = document.createElement!("button").object! +_ = button.classList.add("primary") +``` + +- **Dynamic Member Lookup and `!`**: When calling a method on ``JSObject`` (like `createElement!`), it returns an optional closure, so `!` is used to unwrap and call it. In contrast, calling on ``JSValue`` (like `button.classList.add`) returns a non-optional closure that traps on failure for convenience. + +Need to bind manually? Grab the function object and supply `this`: + +```swift +let appendChild = document.body.appendChild.object! +appendChild(this: document.body.object!, document.createElement!("div")) +``` + +### Passing options objects + +When JavaScript APIs require an options object, create one using ``JSObject``: + +```swift +public class JSObject: ExpressibleByDictionaryLiteral { + /// Creates an empty JavaScript object (equivalent to {} or new Object()) + public init() + + /// Creates a new object with the key-value pairs in the dictionary literal + public init(dictionaryLiteral elements: (String, JSValue)...) +} +``` + +**Example** + +```swift +// Create options object with dictionary literal +let listeningOptions: JSObject = ["once": .boolean(true), "passive": .boolean(true)] +button.addEventListener!("click", handler, listeningOptions) + +// Create empty object and add properties +let fetchOptions = JSObject() +fetchOptions["method"] = .string("POST") +let headers: JSObject = ["Content-Type": .string("application/json")] +fetchOptions["headers"] = headers.jsValue +fetchOptions["body"] = "{}".jsValue + +let fetch = JSObject.global.fetch.object! +let response = fetch("https://api.example.com", fetchOptions) +``` + +### Throwing JavaScript + +JavaScript exceptions surface as ``JSException``. Wrap the function (or object) in a throwing helper. + +```swift +// Method +let JSON = JSObject.global.JSON.object! +do { + let value = try JSON.throwing.parse!("{\"flag\":true}") +} catch let error as JSException { + print("Invalid JSON", error) +} + +// Function +let validateAge: JSObject = JSObject.global.validateAge.object! +do { + try validateAge.throws(-3) +} catch let error as JSException { + print("Validation failed:", error) +} +``` + +- Use ``JSObject/throwing`` to access object methods that may throw JavaScript exceptions. +- Use ``JSObject/throws`` to call the callable object itself that may throw JavaScript exceptions. + +### Constructors and `new` + +```swift +let url = JSObject.global.URL.object!.new("https://example.com", "https://example.com") +let searchParams = url.searchParams.object! +``` + +Use ``JSThrowingFunction/new(_:)`` (via `throws.new`) when the constructor can throw. + +## Convert Between Swift and JavaScript + +### Swift -> JavaScript + +Types conforming to ``ConvertibleToJSValue`` can be converted via the `.jsValue` property. Conversion behavior depends on the context: + +| Swift type | JavaScript result | Notes | +|------------|------------------|-------| +| `Bool` | `JSValue.boolean(Bool)` | | +| `String` | `JSValue.string(JSString)` | Wrapped in ``JSString`` to avoid extra copies | +| `Int`, `UInt`, `Int8-32`, `UInt8-32`, `Float`, `Double` | `JSValue.number(Double)` | All numeric types convert to `Double` | +| `Int64`, `UInt64` | `JSValue.bigInt(JSBigInt)` | Converted to `BigInt` (requires `import JavaScriptBigIntSupport`) | +| `Data` | `Uint8Array` | Converted to `Uint8Array` (requires `import JavaScriptFoundationCompat`) | +| `Array` where `Element: ConvertibleToJSValue` | JavaScript Array | Each element converted via `.jsValue` | +| `Dictionary` where `Value: ConvertibleToJSValue` | Plain JavaScript object | Keys must be `String` | +| `Optional.none` | `JSValue.null` | Use ``JSValue/undefined`` when you specifically need `undefined` | +| `Optional.some(wrapped)` | `wrapped.jsValue` | | +| ``JSValue``, ``JSObject``, ``JSString`` | Passed through | No conversion needed | + +**Function arguments**: Automatic conversion when passing to JavaScript functions: + +```swift +let alert = JSObject.global.alert.object! +alert("Hello") // String automatically converts via .jsValue + +let console = JSObject.global.console.object! +console.log!("Count", 42, true) // All arguments auto-convert +``` + +**Property assignment**: Explicit conversion required: + +```swift +let obj = JSObject.global.myObject.object! +let count: Int = 42 +let message = "Hello" + +obj["count"] = count.jsValue +obj["message"] = message.jsValue + +obj.count = count.jsValue +obj.message = message.jsValue + +// Alternative: use JSValue static methods +obj["count"] = .number(Double(count)) +obj.message = .string(message) +divElement.innerText = .string("Count \(count)") +canvasElement.width = .number(Double(size)) +``` + +### JavaScript -> Swift + +Access JavaScript values through ``JSValue`` accessors: + +```swift +let jsValue: JSValue = // ... some JavaScript value + +// Primitive types via direct accessors (most common pattern) +let message: String? = jsValue.string +let n: Double? = jsValue.number +let flag: Bool? = jsValue.boolean +let obj: JSObject? = jsValue.object + +// Access nested properties through JSObject subscripts +if let obj = jsValue.object { + let nested = obj.key.string + let arrayItem = obj.items[0].string + let count = obj.count.number +} + +// Arrays (if elements conform to ConstructibleFromJSValue) +if let items = [String].construct(from: jsValue) { + // Use items +} + +// Dictionaries (if values conform to ConstructibleFromJSValue) +if let data = [String: Int].construct(from: jsValue) { + // Use data +} + +// For complex Decodable types, use JSValueDecoder +struct User: Decodable { + let name: String + let age: Int +} +let user = try JSValueDecoder().decode(User.self, from: jsValue) +``` + +## Pass Swift Closures back to JavaScript + +```swift +public class JSClosure: JSObject, JSClosureProtocol { + public init(_ body: @escaping (sending [JSValue]) -> JSValue) + public static func async( + priority: TaskPriority? = nil, + _ body: @escaping (sending [JSValue]) async throws(JSException) -> JSValue + ) -> JSClosure + public func release() +} + +public class JSOneshotClosure: JSObject, JSClosureProtocol { + public init(_ body: @escaping (sending [JSValue]) -> JSValue) + public static func async( + priority: TaskPriority? = nil, + _ body: @escaping (sending [JSValue]) async throws(JSException) -> JSValue + ) -> JSOneshotClosure + public func release() +} +``` + +**Example** + +```swift +let document = JSObject.global.document.object! +let console = JSObject.global.console.object! + +// Persistent closure - keep reference while JavaScript can call it +let button = document.createElement!("button").object! +let handler = JSClosure { args in + console.log!("Clicked", args[0]) + return .undefined +} +button.addEventListener!("click", handler) + +// One-shot closure - automatically released after first call +button.addEventListener!( + "click", + JSOneshotClosure { _ in + console.log!("One-off click") + return .undefined + }, + ["once": true] +) + +// Async closure - bridges Swift async to JavaScript Promise +let asyncHandler = JSClosure.async { _ async throws(JSException) -> JSValue in + try! await Task.sleep(nanoseconds: 1_000_000) + console.log!("Async closure finished") + return .undefined +} +button.addEventListener!("async", asyncHandler) +``` + +## Promises and `async/await` + +```swift +public final class JSPromise: JSBridgedClass { + public init(unsafelyWrapping object: JSObject) + public init(resolver: @escaping (@escaping (Result) -> Void) -> Void) + public static func async( + body: @escaping () async throws(JSException) -> Void + ) -> JSPromise + public static func async( + body: @escaping () async throws(JSException) -> JSValue + ) -> JSPromise + + public enum Result { + case success(JSValue) + case failure(JSValue) + } + + // Available when JavaScriptEventLoop is linked + public var value: JSValue { get async throws(JSException) } + public var result: Result { get async } +} +``` + +**Example** + +```swift +import JavaScriptEventLoop + +JavaScriptEventLoop.installGlobalExecutor() + +let console = JSObject.global.console.object! +let fetch = JSObject.global.fetch.object! + +// Wrap existing JavaScript Promise and await from Swift +Task { + do { + let response = try await JSPromise( + unsafelyWrapping: fetch("https://example.com").object! + ).value + console.log!("Fetched data", response) + } catch let error as JSException { + console.error!("Fetch failed", error.thrownValue) + } +} + +// Expose Swift async work to JavaScript +let swiftPromise = JSPromise.async { + try await Task.sleep(nanoseconds: 1_000_000_000) + return .string("Swift async complete") +} +``` + +- Wrap existing promise-returning APIs with ``JSPromise/init(unsafelyWrapping:)``. +- Use `JSPromise.async(body:)` (with `Void` or `JSValue` return type) to expose Swift `async/await` work to JavaScript callers. +- To await JavaScript `Promise` from Swift, import `JavaScriptEventLoop`, call `JavaScriptEventLoop.installGlobalExecutor()` early, and use the `value` property. +- The `value` property suspends until the promise resolves or rejects, rethrowing rejections as ``JSException``. + diff --git a/Sources/JavaScriptKit/Documentation.docc/Documentation.md b/Sources/JavaScriptKit/Documentation.docc/Documentation.md index 60808a894..51ee62539 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Documentation.md +++ b/Sources/JavaScriptKit/Documentation.docc/Documentation.md @@ -51,6 +51,7 @@ Check out the [examples](https://github.com/swiftwasm/JavaScriptKit/tree/main/Ex ### Articles +- - - - From 8d23cdb9e9ca6c935c6f985fb036fc461e700a2e Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 12 Jan 2026 16:59:51 +0900 Subject: [PATCH 061/252] Documentation: Fix example code snippet in Hello World tutorial --- .../Hello-World/Resources/hello-world-2-1-main-swift.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-2-1-main-swift.swift b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-2-1-main-swift.swift index a528e65b1..b8e5041dd 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-2-1-main-swift.swift +++ b/Sources/JavaScriptKit/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-2-1-main-swift.swift @@ -1,6 +1,6 @@ import JavaScriptKit let document = JSObject.global.document -var div = document.createElement("div") +let div = document.createElement("div") div.innerText = "Hello from Swift!" -document.body.appendChild(div) +_ = document.body.appendChild(div) From c1dbce8eee746b69e03e74b37f6bf0444eaa88e5 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 13 Jan 2026 22:07:19 +0900 Subject: [PATCH 062/252] BridgeJS: Remove call to `getImports` when no JS interface is imported --- Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift | 6 +++++- .../__Snapshots__/BridgeJSLinkTests/Async.Export.js | 1 - .../BridgeJSLinkTests/DefaultParameters.Export.js | 1 - .../BridgeJSLinkTests/EnumAssociatedValue.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js | 1 - .../BridgeJSLinkTests/EnumNamespace.Global.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js | 1 - .../BridgeJSLinkTests/Namespaces.Global.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/Optionals.Export.js | 1 - .../BridgeJSLinkTests/PrimitiveParameters.Export.js | 1 - .../BridgeJSLinkTests/PrimitiveReturn.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/Protocol.Export.js | 1 - .../BridgeJSLinkTests/StaticFunctions.Export.js | 1 - .../BridgeJSLinkTests/StaticFunctions.Global.Export.js | 1 - .../BridgeJSLinkTests/StaticProperties.Export.js | 1 - .../BridgeJSLinkTests/StaticProperties.Global.Export.js | 1 - .../BridgeJSLinkTests/StringParameter.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js | 1 - .../__Snapshots__/BridgeJSLinkTests/Throws.Export.js | 1 - .../BridgeJSLinkTests/VoidParameterVoidReturn.Export.js | 1 - 29 files changed, 5 insertions(+), 29 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 4f58e9a60..52a2ef8ae 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -313,8 +313,12 @@ struct BridgeJSLink { printer.write(lines: [ "bjs = {};", "importObject[\"bjs\"] = bjs;", - "const imports = options.getImports(importsContext);", ]) + if self.importedSkeletons.count > 0 { + printer.write(lines: [ + "const imports = options.getImports(importsContext);" + ]) + } printer.write("bjs[\"swift_js_return_string\"] = function(ptr, len) {") printer.indent { printer.write( diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js index c9c2e484f..3739663bc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index 9836ffe95..c03ecf971 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -93,7 +93,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index f0fbf6f75..754f8b4ef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -515,7 +515,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js index 4a0ebe848..bd0cbbe90 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js @@ -63,7 +63,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index 96127eba5..cc2821568 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -64,7 +64,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js index c766f08ef..386fee68f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js @@ -83,7 +83,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js index 2331d1c78..a4456953e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js @@ -114,7 +114,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js index 737a40046..80367b223 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js index ccf941dec..2b803f936 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js index 1e1e9563a..35139ff68 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index da5566616..7e1c8bb75 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js index c051fcd21..38442a431 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js index 015d5a1c0..6ba65869a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js index 5e7ae2094..39a0ec28c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js index f2e1bbe0c..ff2e8a01a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js index 4bfa5f698..39e9501a1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index efb6b11e7..ce9800583 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -104,7 +104,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index 782a38605..ad85837a7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -91,7 +91,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js index f0ce10325..3910c8381 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js @@ -91,7 +91,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js index d1039d0f4..950e992f9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js @@ -44,7 +44,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js index 086a2ca31..39a967962 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js @@ -44,7 +44,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js index 2f182b630..6614e02e4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js index 712563448..99d7de127 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js index 2def00d13..a372059fa 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js index 74b2cfe4f..6d1ee5af1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js @@ -142,7 +142,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js index fe359bcbe..7324c046f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js @@ -200,7 +200,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js index 928ba5950..43aa45da0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js index b39042bda..9e3f6ef0f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js @@ -39,7 +39,6 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); From fc5b2d9c00d28ace3bf555ede107d843ec1a3cf8 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 14 Jan 2026 14:44:43 +0800 Subject: [PATCH 063/252] Merge pull request #493 from PassiveLogic/fix/enum-helper-availability BridgeJS: Fix enumHelper availability --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 37 +++------- .../Sources/BridgeJSLink/JSGlueGen.swift | 72 +++++++++++-------- .../ArrayParameter.Import.js | 2 + .../BridgeJSLinkTests/Async.Export.js | 2 + .../BridgeJSLinkTests/Async.Import.js | 2 + .../DefaultParameters.Export.js | 1 + .../EnumAssociatedValue.Export.js | 1 + .../BridgeJSLinkTests/EnumCase.Export.js | 2 + .../BridgeJSLinkTests/EnumNamespace.Export.js | 2 + .../EnumNamespace.Global.Export.js | 2 + .../BridgeJSLinkTests/EnumRawType.Export.js | 2 + .../BridgeJSLinkTests/Interface.Import.js | 2 + .../InvalidPropertyNames.Import.js | 2 + .../BridgeJSLinkTests/MixedGlobal.Export.js | 2 + .../BridgeJSLinkTests/MixedModules.Export.js | 2 + .../BridgeJSLinkTests/MixedPrivate.Export.js | 2 + .../MultipleImportedTypes.Import.js | 2 + .../BridgeJSLinkTests/Namespaces.Export.js | 2 + .../Namespaces.Global.Export.js | 2 + .../BridgeJSLinkTests/Optionals.Export.js | 2 + .../PrimitiveParameters.Export.js | 2 + .../PrimitiveParameters.Import.js | 2 + .../PrimitiveReturn.Export.js | 2 + .../PrimitiveReturn.Import.js | 2 + .../BridgeJSLinkTests/PropertyTypes.Export.js | 2 + .../BridgeJSLinkTests/Protocol.Export.js | 1 + .../StaticFunctions.Export.js | 1 + .../StaticFunctions.Global.Export.js | 1 + .../StaticProperties.Export.js | 2 + .../StaticProperties.Global.Export.js | 2 + .../StringParameter.Export.js | 2 + .../StringParameter.Import.js | 2 + .../BridgeJSLinkTests/StringReturn.Export.js | 2 + .../BridgeJSLinkTests/StringReturn.Import.js | 2 + .../BridgeJSLinkTests/SwiftClass.Export.js | 2 + .../BridgeJSLinkTests/SwiftClosure.Export.js | 1 + .../BridgeJSLinkTests/SwiftStruct.Export.js | 1 + .../TS2SkeletonLike.Import.js | 2 + .../BridgeJSLinkTests/Throws.Export.js | 2 + .../BridgeJSLinkTests/TypeAlias.Import.js | 2 + .../TypeScriptClass.Import.js | 2 + .../VoidParameterVoidReturn.Export.js | 2 + .../VoidParameterVoidReturn.Import.js | 2 + 43 files changed, 129 insertions(+), 55 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 52a2ef8ae..41b323425 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -209,11 +209,7 @@ struct BridgeJSLink { } private func generateVariableDeclarations() -> [String] { - let hasAssociatedValueEnums = exportedSkeletons.contains { skeleton in - skeleton.enums.contains { $0.enumType == .associatedValue } - } - - var declarations = [ + return [ "let \(JSGlueVariableScope.reservedInstance);", "let \(JSGlueVariableScope.reservedMemory);", "let \(JSGlueVariableScope.reservedSetException);", @@ -237,25 +233,12 @@ struct BridgeJSLink { "let \(JSGlueVariableScope.reservedTmpParamF64s) = [];", "let \(JSGlueVariableScope.reservedTmpRetPointers) = [];", "let \(JSGlueVariableScope.reservedTmpParamPointers) = [];", + "const \(JSGlueVariableScope.reservedEnumHelpers) = {};", + "const \(JSGlueVariableScope.reservedStructHelpers) = {};", + "", + "let _exports = null;", + "let bjs = null;", ] - - let hasStructs = exportedSkeletons.contains { skeleton in - !skeleton.structs.isEmpty - } - - if hasAssociatedValueEnums { - declarations.append("const enumHelpers = {};") - } - - if hasStructs { - declarations.append("const structHelpers = {};") - } - - declarations.append("") - declarations.append("let _exports = null;") - declarations.append("let bjs = null;") - - return declarations } /// Checks if a skeleton contains any closure types @@ -1050,7 +1033,7 @@ struct BridgeJSLink { printer.write( "const \(enumDef.name)Helpers = __bjs_create\(enumDef.valuesName)Helpers()(\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTextEncoder), \(JSGlueVariableScope.reservedSwift));" ) - printer.write("enumHelpers.\(enumDef.name) = \(enumDef.name)Helpers;") + printer.write("\(JSGlueVariableScope.reservedEnumHelpers).\(enumDef.name) = \(enumDef.name)Helpers;") printer.nextLine() } } @@ -1064,9 +1047,11 @@ struct BridgeJSLink { for skeleton in exportedSkeletons { for structDef in skeleton.structs { printer.write( - "const \(structDef.name)Helpers = __bjs_create\(structDef.name)Helpers()(\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTmpParamPointers), \(JSGlueVariableScope.reservedTmpRetPointers), \(JSGlueVariableScope.reservedTextEncoder), \(JSGlueVariableScope.reservedSwift), enumHelpers);" + "const \(structDef.name)Helpers = __bjs_create\(structDef.name)Helpers()(\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTmpParamPointers), \(JSGlueVariableScope.reservedTmpRetPointers), \(JSGlueVariableScope.reservedTextEncoder), \(JSGlueVariableScope.reservedSwift), \(JSGlueVariableScope.reservedEnumHelpers));" + ) + printer.write( + "\(JSGlueVariableScope.reservedStructHelpers).\(structDef.name) = \(structDef.name)Helpers;" ) - printer.write("structHelpers.\(structDef.name) = \(structDef.name)Helpers;") printer.nextLine() } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index feaf34832..944c1659b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -30,6 +30,8 @@ final class JSGlueVariableScope { static let reservedTmpParamF64s = "tmpParamF64s" static let reservedTmpRetPointers = "tmpRetPointers" static let reservedTmpParamPointers = "tmpParamPointers" + static let reservedEnumHelpers = "enumHelpers" + static let reservedStructHelpers = "structHelpers" private var variables: Set = [ reservedSwift, @@ -56,6 +58,8 @@ final class JSGlueVariableScope { reservedTmpParamF64s, reservedTmpRetPointers, reservedTmpParamPointers, + reservedEnumHelpers, + reservedStructHelpers, ] /// Returns a unique variable name in the scope based on the given name hint. @@ -248,7 +252,7 @@ struct IntrinsicJSFragment: Sendable { let caseIdName = "\(value)CaseId" let cleanupName = "\(value)Cleanup" printer.write( - "const { caseId: \(caseIdName), cleanup: \(cleanupName) } = enumHelpers.\(enumBase).lower(\(value));" + "const { caseId: \(caseIdName), cleanup: \(cleanupName) } = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lower(\(value));" ) cleanup.write("if (\(cleanupName)) { \(cleanupName)(); }") return [caseIdName] @@ -262,7 +266,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { _, scope, printer, _ in let retName = scope.variable("ret") printer.write( - "const \(retName) = enumHelpers.\(enumBase).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) return [retName] } @@ -325,7 +329,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSome)) {") printer.indent { printer.write( - "\(enumVar) = enumHelpers.\(base).raise(\(wrappedValue), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "\(enumVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(wrappedValue), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) } printer.write("}") @@ -337,7 +341,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSome)) {") printer.indent { printer.write( - "\(structVar) = structHelpers.\(base).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "\(structVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) } printer.write("} else {") @@ -371,7 +375,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") printer.indent { let resultVar = scope.variable("structResult") - printer.write("const \(resultVar) = structHelpers.\(base).lower(\(value));") + printer.write( + "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lower(\(value));" + ) printer.write("\(cleanupVar) = \(resultVar).cleanup;") } printer.write("}") @@ -404,7 +410,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") printer.indent { let resultVar = scope.variable("enumResult") - printer.write("const \(resultVar) = enumHelpers.\(base).lower(\(value));") + printer.write( + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" + ) printer.write("\(caseIdVar) = \(resultVar).caseId;") printer.write("\(cleanupVar) = \(resultVar).cleanup;") } @@ -525,7 +533,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("} else {") printer.indent { printer.write( - "\(resultVar) = enumHelpers.\(base).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "\(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) } printer.write("}") @@ -537,7 +545,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") printer.indent { printer.write( - "\(resultVar) = structHelpers.\(base).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "\(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) } printer.write("} else {") @@ -657,7 +665,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") printer.indent { printer.write( - "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(value));" + "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" ) printer.write("return \(caseIdVar);") } @@ -817,7 +825,7 @@ struct IntrinsicJSFragment: Sendable { let targetVar = arguments[1] let base = fullName.components(separatedBy: ".").last ?? fullName printer.write( - "let \(targetVar) = enumHelpers.\(base).raise(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "let \(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) return [] } @@ -884,7 +892,7 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName printer.write( - "\(targetVar) = enumHelpers.\(base).raise(\(value), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "\(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(value), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) default: fatalError("Unsupported optional wrapped type in closure parameter lifting: \(wrappedType)") @@ -1016,7 +1024,7 @@ struct IntrinsicJSFragment: Sendable { let caseIdVar = scope.variable("caseId") let cleanupVar = scope.variable("cleanup") printer.write( - "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(result));" + "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(result));" ) cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") printer.write("return \(caseIdVar);") @@ -1083,7 +1091,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(result)) {") printer.indent() printer.write( - "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(result));" + "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(result));" ) printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(caseIdVar);") cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") @@ -1212,7 +1220,7 @@ struct IntrinsicJSFragment: Sendable { let base = fullName.components(separatedBy: ".").last ?? fullName let resultVar = scope.variable("result") printer.write( - "const \(resultVar) = enumHelpers.\(base).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) printer.write("return \(resultVar);") return [] @@ -1425,7 +1433,7 @@ struct IntrinsicJSFragment: Sendable { let caseId = arguments[0] let resultVar = scope.variable("enumValue") printer.write( - "const \(resultVar) = enumHelpers.\(base).raise(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) return [resultVar] } @@ -1445,7 +1453,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanupCode in let resultVar = scope.variable("structValue") printer.write( - "const \(resultVar) = structHelpers.\(base).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) return [resultVar] } @@ -1535,7 +1543,7 @@ struct IntrinsicJSFragment: Sendable { let caseIdVar = scope.variable("caseId") let cleanupVar = scope.variable("cleanup") printer.write( - "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(value));" + "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" ) cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") printer.write("return \(caseIdVar);") @@ -1982,7 +1990,7 @@ struct IntrinsicJSFragment: Sendable { let value = arguments[0] let cleanupVar = scope.variable("cleanup") printer.write( - "const { cleanup: \(cleanupVar) } = structHelpers.\(base).lower(\(value));" + "const { cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedStructHelpers).\(base).lower(\(value));" ) cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") return [] @@ -1997,7 +2005,7 @@ struct IntrinsicJSFragment: Sendable { let value = arguments[0] let cleanupVar = scope.variable("cleanup") printer.write( - "const { cleanup: \(cleanupVar) } = structHelpers.\(structBase).lower(\(value));" + "const { cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lower(\(value));" ) cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") return [] @@ -2011,7 +2019,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanupCode in let resultVar = scope.variable("structValue") printer.write( - "const \(resultVar) = structHelpers.\(structBase).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) return [resultVar] } @@ -2029,7 +2037,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("const __bjs_create\(structName)Helpers = () => {") printer.indent() printer.write( - "return (\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTmpParamPointers), \(JSGlueVariableScope.reservedTmpRetPointers), textEncoder, \(JSGlueVariableScope.reservedSwift), enumHelpers) => ({" + "return (\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTmpParamPointers), \(JSGlueVariableScope.reservedTmpRetPointers), textEncoder, \(JSGlueVariableScope.reservedSwift), \(JSGlueVariableScope.reservedEnumHelpers)) => ({" ) printer.indent() @@ -2146,7 +2154,7 @@ struct IntrinsicJSFragment: Sendable { // Lower the struct instance (this) using the helper's lower function let structCleanupVar = methodScope.variable("structCleanup") printer.write( - "const { cleanup: \(structCleanupVar) } = structHelpers.\(structDef.name).lower(this);" + "const { cleanup: \(structCleanupVar) } = \(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).lower(this);" ) // Lower each parameter and collect forwarding expressions @@ -2353,7 +2361,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") printer.indent { let structResultVar = scope.variable("structResult") - printer.write("const \(structResultVar) = structHelpers.\(structName).lower(\(value));") + printer.write( + "const \(structResultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structName).lower(\(value));" + ) printer.write("\(nestedCleanupVar) = \(structResultVar).cleanup;") } printer.write("}") @@ -2455,7 +2465,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") printer.indent { let enumResultVar = scope.variable("enumResult") - printer.write("const \(enumResultVar) = enumHelpers.\(base).lower(\(value));") + printer.write( + "const \(enumResultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" + ) printer.write("\(caseIdVar) = \(enumResultVar).caseId;") printer.write("\(enumCleanupVar) = \(enumResultVar).cleanup;") printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(caseIdVar));") @@ -2495,7 +2507,9 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let value = arguments[0] let structResultVar = scope.variable("structResult") - printer.write("const \(structResultVar) = structHelpers.\(nestedName).lower(\(value));") + printer.write( + "const \(structResultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(nestedName).lower(\(value));" + ) cleanup.write("if (\(structResultVar).cleanup) { \(structResultVar).cleanup(); }") return [] } @@ -2518,7 +2532,7 @@ struct IntrinsicJSFragment: Sendable { let caseIdVar = scope.variable("caseId") let cleanupVar = scope.variable("enumCleanup") printer.write( - "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(value));" + "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" ) printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(caseIdVar));") cleanup.write("if (\(cleanupVar)) { \(cleanupVar)(); }") @@ -2683,7 +2697,7 @@ struct IntrinsicJSFragment: Sendable { let caseIdVar = scope.variable("enumCaseId") printer.write("const \(caseIdVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") printer.write( - "\(optVar) = enumHelpers.\(base).raise(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) } else { let wrappedFragment = structFieldRaiseFragment( @@ -2717,7 +2731,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let structVar = scope.variable("struct") printer.write( - "const \(structVar) = structHelpers.\(nestedName).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(structVar) = \(JSGlueVariableScope.reservedStructHelpers).\(nestedName).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) return [structVar] } @@ -2793,7 +2807,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let varName = scope.variable("value") printer.write( - "const \(varName) = enumHelpers.\(base).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "const \(varName) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) return [varName] } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js index e53708aab..d477487e5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js index 3739663bc..c01eac976 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js index c98f19719..15b2a9742 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index c03ecf971..48dfc0994 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -34,6 +34,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; const structHelpers = {}; let _exports = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index 754f8b4ef..a15e386e8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -504,6 +504,7 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js index bd0cbbe90..9cd3e1f3b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js @@ -52,6 +52,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index cc2821568..34a2e0540 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -53,6 +53,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js index 386fee68f..074380d00 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js @@ -72,6 +72,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js index a4456953e..00b542e30 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js @@ -103,6 +103,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js index 1bfd09445..83450b4c5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index c8b242720..a71c8dd71 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js index 80367b223..ce9475b0c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js index 2b803f936..c4a1c2e3a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js index 35139ff68..d0f00f279 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index df998b01b..86edf39ab 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index 7e1c8bb75..0b6ef40dc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js index 38442a431..6b4d37fc5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js index 6ba65869a..9770da2db 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js index 39a0ec28c..761397287 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js index 512b48ace..a0f2c8b08 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js index ff2e8a01a..ec4dd9cab 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js index 4b486f484..871e16a30 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js index 39e9501a1..240ee9cd5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index ce9800583..d6b9a4f01 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -93,6 +93,7 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index ad85837a7..9d69f4183 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -80,6 +80,7 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js index 3910c8381..a7e6c44cc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js @@ -80,6 +80,7 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js index 950e992f9..8019f2a44 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js @@ -33,6 +33,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js index 39a967962..7c4c11f69 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js @@ -33,6 +33,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js index 6614e02e4..891f4bb01 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js index 21caebd02..03a65cc47 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js index 99d7de127..489fbe092 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js index f1ab79072..49fafc92e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js index a372059fa..f95ee4367 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js index 6d1ee5af1..8bdbfa4be 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js @@ -131,6 +131,7 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js index 7324c046f..07a2f320f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; const structHelpers = {}; let _exports = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js index b0684f153..2bbae4fec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js index 43aa45da0..016ebaa53 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js index c2f477245..8b46062c4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index 71511ca3c..0e2041822 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js index 9e3f6ef0f..148418657 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js index 8f8328054..c22ff8c5a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js @@ -28,6 +28,8 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; let _exports = null; let bjs = null; From da703026923979f9022295008d2ee0ab2fd9fefb Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 14 Jan 2026 12:24:51 +0900 Subject: [PATCH 064/252] [NFC] BridgeJS: Unify JS function calling convention code emission --- .../Generated/BridgeJS.ExportSwift.swift | 180 +- .../Sources/Generated/BridgeJS.ImportTS.swift | 7 +- .../Generated/BridgeJS.ExportSwift.swift | 30 +- .../Generated/BridgeJS.ImportTS.swift | 4 +- .../Sources/BridgeJSCore/ExportSwift.swift | 694 ++++---- .../Sources/BridgeJSCore/ImportTS.swift | 636 ++++++-- .../ExportSwiftTests/Async.swift | 12 +- .../CrossFileFunctionTypes.ReverseOrder.swift | 32 +- .../CrossFileFunctionTypes.swift | 32 +- ...CrossFileTypeResolution.ReverseOrder.swift | 24 +- .../CrossFileTypeResolution.swift | 24 +- .../ExportSwiftTests/DefaultParameters.swift | 92 +- .../EnumAssociatedValue.swift | 20 +- .../ExportSwiftTests/EnumCase.swift | 10 +- .../EnumNamespace.Global.swift | 36 +- .../ExportSwiftTests/EnumNamespace.swift | 36 +- .../ExportSwiftTests/EnumRawType.swift | 54 +- .../ExportSwiftTests/MixedGlobal.swift | 12 +- .../ExportSwiftTests/MixedPrivate.swift | 12 +- .../ExportSwiftTests/Namespaces.Global.swift | 38 +- .../ExportSwiftTests/Namespaces.swift | 38 +- .../ExportSwiftTests/Optionals.swift | 72 +- .../PrimitiveParameters.swift | 2 +- .../ExportSwiftTests/PropertyTypes.swift | 70 +- .../ExportSwiftTests/Protocol.swift | 250 +-- .../StaticFunctions.Global.swift | 22 +- .../ExportSwiftTests/StaticFunctions.swift | 22 +- .../StaticProperties.Global.swift | 30 +- .../ExportSwiftTests/StaticProperties.swift | 30 +- .../ExportSwiftTests/StringParameter.swift | 4 +- .../ExportSwiftTests/SwiftClass.swift | 42 +- .../ExportSwiftTests/SwiftClosure.swift | 470 +++--- .../ExportSwiftTests/SwiftStruct.swift | 26 +- .../ImportTSTests/ArrayParameter.swift | 10 +- .../__Snapshots__/ImportTSTests/Async.swift | 18 +- .../ImportTSTests/Interface.swift | 9 +- .../ImportTSTests/InvalidPropertyNames.swift | 32 +- .../ImportTSTests/MultipleImportedTypes.swift | 48 +- .../ImportTSTests/PrimitiveParameters.swift | 4 +- .../ImportTSTests/StringParameter.swift | 7 +- .../ImportTSTests/TS2SkeletonLike.swift | 21 +- .../ImportTSTests/TypeAlias.swift | 3 +- .../ImportTSTests/TypeScriptClass.swift | 20 +- .../JavaScriptKit/BridgeJSIntrinsics.swift | 68 +- .../Generated/BridgeJS.ExportSwift.swift | 42 +- .../Generated/BridgeJS.ExportSwift.swift | 1445 ++++++++++------- 46 files changed, 2935 insertions(+), 1855 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift b/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift index fcec5e675..2c9d9b6bf 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift @@ -369,7 +369,7 @@ public func _bjs_EnumRoundtrip_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_EnumRoundtrip_take") @_cdecl("bjs_EnumRoundtrip_take") -public func _bjs_EnumRoundtrip_take(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_EnumRoundtrip_take(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) EnumRoundtrip.bridgeJSLiftParameter(_self).take(_: APIResult.bridgeJSLiftParameter(value)) #else @@ -379,7 +379,7 @@ public func _bjs_EnumRoundtrip_take(_self: UnsafeMutableRawPointer, value: Int32 @_expose(wasm, "bjs_EnumRoundtrip_makeSuccess") @_cdecl("bjs_EnumRoundtrip_makeSuccess") -public func _bjs_EnumRoundtrip_makeSuccess(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_EnumRoundtrip_makeSuccess(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = EnumRoundtrip.bridgeJSLiftParameter(_self).makeSuccess() return ret.bridgeJSLowerReturn() @@ -390,7 +390,7 @@ public func _bjs_EnumRoundtrip_makeSuccess(_self: UnsafeMutableRawPointer) -> Vo @_expose(wasm, "bjs_EnumRoundtrip_makeFailure") @_cdecl("bjs_EnumRoundtrip_makeFailure") -public func _bjs_EnumRoundtrip_makeFailure(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_EnumRoundtrip_makeFailure(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = EnumRoundtrip.bridgeJSLiftParameter(_self).makeFailure() return ret.bridgeJSLowerReturn() @@ -401,7 +401,7 @@ public func _bjs_EnumRoundtrip_makeFailure(_self: UnsafeMutableRawPointer) -> Vo @_expose(wasm, "bjs_EnumRoundtrip_makeFlag") @_cdecl("bjs_EnumRoundtrip_makeFlag") -public func _bjs_EnumRoundtrip_makeFlag(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_EnumRoundtrip_makeFlag(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = EnumRoundtrip.bridgeJSLiftParameter(_self).makeFlag() return ret.bridgeJSLowerReturn() @@ -412,7 +412,7 @@ public func _bjs_EnumRoundtrip_makeFlag(_self: UnsafeMutableRawPointer) -> Void @_expose(wasm, "bjs_EnumRoundtrip_makeRate") @_cdecl("bjs_EnumRoundtrip_makeRate") -public func _bjs_EnumRoundtrip_makeRate(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_EnumRoundtrip_makeRate(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = EnumRoundtrip.bridgeJSLiftParameter(_self).makeRate() return ret.bridgeJSLowerReturn() @@ -423,7 +423,7 @@ public func _bjs_EnumRoundtrip_makeRate(_self: UnsafeMutableRawPointer) -> Void @_expose(wasm, "bjs_EnumRoundtrip_makePrecise") @_cdecl("bjs_EnumRoundtrip_makePrecise") -public func _bjs_EnumRoundtrip_makePrecise(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_EnumRoundtrip_makePrecise(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = EnumRoundtrip.bridgeJSLiftParameter(_self).makePrecise() return ret.bridgeJSLowerReturn() @@ -434,7 +434,7 @@ public func _bjs_EnumRoundtrip_makePrecise(_self: UnsafeMutableRawPointer) -> Vo @_expose(wasm, "bjs_EnumRoundtrip_makeInfo") @_cdecl("bjs_EnumRoundtrip_makeInfo") -public func _bjs_EnumRoundtrip_makeInfo(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_EnumRoundtrip_makeInfo(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = EnumRoundtrip.bridgeJSLiftParameter(_self).makeInfo() return ret.bridgeJSLowerReturn() @@ -445,7 +445,7 @@ public func _bjs_EnumRoundtrip_makeInfo(_self: UnsafeMutableRawPointer) -> Void @_expose(wasm, "bjs_EnumRoundtrip_roundtrip") @_cdecl("bjs_EnumRoundtrip_roundtrip") -public func _bjs_EnumRoundtrip_roundtrip(_self: UnsafeMutableRawPointer, result: Int32) -> Void { +public func _bjs_EnumRoundtrip_roundtrip(_ _self: UnsafeMutableRawPointer, _ result: Int32) -> Void { #if arch(wasm32) let ret = EnumRoundtrip.bridgeJSLiftParameter(_self).roundtrip(_: APIResult.bridgeJSLiftParameter(result)) return ret.bridgeJSLowerReturn() @@ -456,8 +456,12 @@ public func _bjs_EnumRoundtrip_roundtrip(_self: UnsafeMutableRawPointer, result: @_expose(wasm, "bjs_EnumRoundtrip_deinit") @_cdecl("bjs_EnumRoundtrip_deinit") -public func _bjs_EnumRoundtrip_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_EnumRoundtrip_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension EnumRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -468,9 +472,9 @@ extension EnumRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_EnumRoundtrip_wrap") -fileprivate func _bjs_EnumRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_EnumRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_EnumRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_EnumRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -488,7 +492,7 @@ public func _bjs_ComplexResultRoundtrip_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_ComplexResultRoundtrip_take") @_cdecl("bjs_ComplexResultRoundtrip_take") -public func _bjs_ComplexResultRoundtrip_take(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_ComplexResultRoundtrip_take(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) ComplexResultRoundtrip.bridgeJSLiftParameter(_self).take(_: ComplexResult.bridgeJSLiftParameter(value)) #else @@ -498,7 +502,7 @@ public func _bjs_ComplexResultRoundtrip_take(_self: UnsafeMutableRawPointer, val @_expose(wasm, "bjs_ComplexResultRoundtrip_makeSuccess") @_cdecl("bjs_ComplexResultRoundtrip_makeSuccess") -public func _bjs_ComplexResultRoundtrip_makeSuccess(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ComplexResultRoundtrip_makeSuccess(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ComplexResultRoundtrip.bridgeJSLiftParameter(_self).makeSuccess() return ret.bridgeJSLowerReturn() @@ -509,7 +513,7 @@ public func _bjs_ComplexResultRoundtrip_makeSuccess(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_ComplexResultRoundtrip_makeError") @_cdecl("bjs_ComplexResultRoundtrip_makeError") -public func _bjs_ComplexResultRoundtrip_makeError(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ComplexResultRoundtrip_makeError(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ComplexResultRoundtrip.bridgeJSLiftParameter(_self).makeError() return ret.bridgeJSLowerReturn() @@ -520,7 +524,7 @@ public func _bjs_ComplexResultRoundtrip_makeError(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_ComplexResultRoundtrip_makeLocation") @_cdecl("bjs_ComplexResultRoundtrip_makeLocation") -public func _bjs_ComplexResultRoundtrip_makeLocation(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ComplexResultRoundtrip_makeLocation(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ComplexResultRoundtrip.bridgeJSLiftParameter(_self).makeLocation() return ret.bridgeJSLowerReturn() @@ -531,7 +535,7 @@ public func _bjs_ComplexResultRoundtrip_makeLocation(_self: UnsafeMutableRawPoin @_expose(wasm, "bjs_ComplexResultRoundtrip_makeStatus") @_cdecl("bjs_ComplexResultRoundtrip_makeStatus") -public func _bjs_ComplexResultRoundtrip_makeStatus(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ComplexResultRoundtrip_makeStatus(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ComplexResultRoundtrip.bridgeJSLiftParameter(_self).makeStatus() return ret.bridgeJSLowerReturn() @@ -542,7 +546,7 @@ public func _bjs_ComplexResultRoundtrip_makeStatus(_self: UnsafeMutableRawPointe @_expose(wasm, "bjs_ComplexResultRoundtrip_makeCoordinates") @_cdecl("bjs_ComplexResultRoundtrip_makeCoordinates") -public func _bjs_ComplexResultRoundtrip_makeCoordinates(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ComplexResultRoundtrip_makeCoordinates(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ComplexResultRoundtrip.bridgeJSLiftParameter(_self).makeCoordinates() return ret.bridgeJSLowerReturn() @@ -553,7 +557,7 @@ public func _bjs_ComplexResultRoundtrip_makeCoordinates(_self: UnsafeMutableRawP @_expose(wasm, "bjs_ComplexResultRoundtrip_makeComprehensive") @_cdecl("bjs_ComplexResultRoundtrip_makeComprehensive") -public func _bjs_ComplexResultRoundtrip_makeComprehensive(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ComplexResultRoundtrip_makeComprehensive(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ComplexResultRoundtrip.bridgeJSLiftParameter(_self).makeComprehensive() return ret.bridgeJSLowerReturn() @@ -564,7 +568,7 @@ public func _bjs_ComplexResultRoundtrip_makeComprehensive(_self: UnsafeMutableRa @_expose(wasm, "bjs_ComplexResultRoundtrip_makeInfo") @_cdecl("bjs_ComplexResultRoundtrip_makeInfo") -public func _bjs_ComplexResultRoundtrip_makeInfo(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ComplexResultRoundtrip_makeInfo(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ComplexResultRoundtrip.bridgeJSLiftParameter(_self).makeInfo() return ret.bridgeJSLowerReturn() @@ -575,7 +579,7 @@ public func _bjs_ComplexResultRoundtrip_makeInfo(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_ComplexResultRoundtrip_roundtrip") @_cdecl("bjs_ComplexResultRoundtrip_roundtrip") -public func _bjs_ComplexResultRoundtrip_roundtrip(_self: UnsafeMutableRawPointer, result: Int32) -> Void { +public func _bjs_ComplexResultRoundtrip_roundtrip(_ _self: UnsafeMutableRawPointer, _ result: Int32) -> Void { #if arch(wasm32) let ret = ComplexResultRoundtrip.bridgeJSLiftParameter(_self).roundtrip(_: ComplexResult.bridgeJSLiftParameter(result)) return ret.bridgeJSLowerReturn() @@ -586,8 +590,12 @@ public func _bjs_ComplexResultRoundtrip_roundtrip(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_ComplexResultRoundtrip_deinit") @_cdecl("bjs_ComplexResultRoundtrip_deinit") -public func _bjs_ComplexResultRoundtrip_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_ComplexResultRoundtrip_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension ComplexResultRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -598,9 +606,9 @@ extension ComplexResultRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_ComplexResultRoundtrip_wrap") -fileprivate func _bjs_ComplexResultRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ComplexResultRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ComplexResultRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ComplexResultRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -618,7 +626,7 @@ public func _bjs_StringRoundtrip_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_StringRoundtrip_take") @_cdecl("bjs_StringRoundtrip_take") -public func _bjs_StringRoundtrip_take(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_StringRoundtrip_take(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) StringRoundtrip.bridgeJSLiftParameter(_self).take(_: String.bridgeJSLiftParameter(valueBytes, valueLength)) #else @@ -628,7 +636,7 @@ public func _bjs_StringRoundtrip_take(_self: UnsafeMutableRawPointer, valueBytes @_expose(wasm, "bjs_StringRoundtrip_make") @_cdecl("bjs_StringRoundtrip_make") -public func _bjs_StringRoundtrip_make(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_StringRoundtrip_make(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = StringRoundtrip.bridgeJSLiftParameter(_self).make() return ret.bridgeJSLowerReturn() @@ -639,8 +647,12 @@ public func _bjs_StringRoundtrip_make(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_StringRoundtrip_deinit") @_cdecl("bjs_StringRoundtrip_deinit") -public func _bjs_StringRoundtrip_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_StringRoundtrip_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension StringRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -651,9 +663,9 @@ extension StringRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_StringRoundtrip_wrap") -fileprivate func _bjs_StringRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_StringRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_StringRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_StringRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -671,7 +683,7 @@ public func _bjs_StructRoundtrip_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_StructRoundtrip_takeSimple") @_cdecl("bjs_StructRoundtrip_takeSimple") -public func _bjs_StructRoundtrip_takeSimple(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_StructRoundtrip_takeSimple(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) StructRoundtrip.bridgeJSLiftParameter(_self).takeSimple(_: SimpleStruct.bridgeJSLiftParameter()) #else @@ -681,7 +693,7 @@ public func _bjs_StructRoundtrip_takeSimple(_self: UnsafeMutableRawPointer) -> V @_expose(wasm, "bjs_StructRoundtrip_makeSimple") @_cdecl("bjs_StructRoundtrip_makeSimple") -public func _bjs_StructRoundtrip_makeSimple(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_StructRoundtrip_makeSimple(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = StructRoundtrip.bridgeJSLiftParameter(_self).makeSimple() return ret.bridgeJSLowerReturn() @@ -692,7 +704,7 @@ public func _bjs_StructRoundtrip_makeSimple(_self: UnsafeMutableRawPointer) -> V @_expose(wasm, "bjs_StructRoundtrip_roundtripSimple") @_cdecl("bjs_StructRoundtrip_roundtripSimple") -public func _bjs_StructRoundtrip_roundtripSimple(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_StructRoundtrip_roundtripSimple(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = StructRoundtrip.bridgeJSLiftParameter(_self).roundtripSimple(_: SimpleStruct.bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() @@ -703,7 +715,7 @@ public func _bjs_StructRoundtrip_roundtripSimple(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_StructRoundtrip_takeAddress") @_cdecl("bjs_StructRoundtrip_takeAddress") -public func _bjs_StructRoundtrip_takeAddress(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_StructRoundtrip_takeAddress(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) StructRoundtrip.bridgeJSLiftParameter(_self).takeAddress(_: Address.bridgeJSLiftParameter()) #else @@ -713,7 +725,7 @@ public func _bjs_StructRoundtrip_takeAddress(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_StructRoundtrip_makeAddress") @_cdecl("bjs_StructRoundtrip_makeAddress") -public func _bjs_StructRoundtrip_makeAddress(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_StructRoundtrip_makeAddress(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = StructRoundtrip.bridgeJSLiftParameter(_self).makeAddress() return ret.bridgeJSLowerReturn() @@ -724,7 +736,7 @@ public func _bjs_StructRoundtrip_makeAddress(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_StructRoundtrip_roundtripAddress") @_cdecl("bjs_StructRoundtrip_roundtripAddress") -public func _bjs_StructRoundtrip_roundtripAddress(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_StructRoundtrip_roundtripAddress(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = StructRoundtrip.bridgeJSLiftParameter(_self).roundtripAddress(_: Address.bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() @@ -735,7 +747,7 @@ public func _bjs_StructRoundtrip_roundtripAddress(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_StructRoundtrip_takePerson") @_cdecl("bjs_StructRoundtrip_takePerson") -public func _bjs_StructRoundtrip_takePerson(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_StructRoundtrip_takePerson(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) StructRoundtrip.bridgeJSLiftParameter(_self).takePerson(_: Person.bridgeJSLiftParameter()) #else @@ -745,7 +757,7 @@ public func _bjs_StructRoundtrip_takePerson(_self: UnsafeMutableRawPointer) -> V @_expose(wasm, "bjs_StructRoundtrip_makePerson") @_cdecl("bjs_StructRoundtrip_makePerson") -public func _bjs_StructRoundtrip_makePerson(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_StructRoundtrip_makePerson(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = StructRoundtrip.bridgeJSLiftParameter(_self).makePerson() return ret.bridgeJSLowerReturn() @@ -756,7 +768,7 @@ public func _bjs_StructRoundtrip_makePerson(_self: UnsafeMutableRawPointer) -> V @_expose(wasm, "bjs_StructRoundtrip_roundtripPerson") @_cdecl("bjs_StructRoundtrip_roundtripPerson") -public func _bjs_StructRoundtrip_roundtripPerson(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_StructRoundtrip_roundtripPerson(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = StructRoundtrip.bridgeJSLiftParameter(_self).roundtripPerson(_: Person.bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() @@ -767,7 +779,7 @@ public func _bjs_StructRoundtrip_roundtripPerson(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_StructRoundtrip_takeComplex") @_cdecl("bjs_StructRoundtrip_takeComplex") -public func _bjs_StructRoundtrip_takeComplex(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_StructRoundtrip_takeComplex(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) StructRoundtrip.bridgeJSLiftParameter(_self).takeComplex(_: ComplexStruct.bridgeJSLiftParameter()) #else @@ -777,7 +789,7 @@ public func _bjs_StructRoundtrip_takeComplex(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_StructRoundtrip_makeComplex") @_cdecl("bjs_StructRoundtrip_makeComplex") -public func _bjs_StructRoundtrip_makeComplex(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_StructRoundtrip_makeComplex(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = StructRoundtrip.bridgeJSLiftParameter(_self).makeComplex() return ret.bridgeJSLowerReturn() @@ -788,7 +800,7 @@ public func _bjs_StructRoundtrip_makeComplex(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_StructRoundtrip_roundtripComplex") @_cdecl("bjs_StructRoundtrip_roundtripComplex") -public func _bjs_StructRoundtrip_roundtripComplex(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_StructRoundtrip_roundtripComplex(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = StructRoundtrip.bridgeJSLiftParameter(_self).roundtripComplex(_: ComplexStruct.bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() @@ -799,8 +811,12 @@ public func _bjs_StructRoundtrip_roundtripComplex(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_StructRoundtrip_deinit") @_cdecl("bjs_StructRoundtrip_deinit") -public func _bjs_StructRoundtrip_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_StructRoundtrip_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension StructRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -811,16 +827,16 @@ extension StructRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_StructRoundtrip_wrap") -fileprivate func _bjs_StructRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_StructRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_StructRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_StructRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_SimpleClass_init") @_cdecl("bjs_SimpleClass_init") -public func _bjs_SimpleClass_init(nameBytes: Int32, nameLength: Int32, count: Int32, flag: Int32, rate: Float32, precise: Float64) -> UnsafeMutableRawPointer { +public func _bjs_SimpleClass_init(_ nameBytes: Int32, _ nameLength: Int32, _ count: Int32, _ flag: Int32, _ rate: Float32, _ precise: Float64) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = SimpleClass(name: String.bridgeJSLiftParameter(nameBytes, nameLength), count: Int.bridgeJSLiftParameter(count), flag: Bool.bridgeJSLiftParameter(flag), rate: Float.bridgeJSLiftParameter(rate), precise: Double.bridgeJSLiftParameter(precise)) return ret.bridgeJSLowerReturn() @@ -831,7 +847,7 @@ public func _bjs_SimpleClass_init(nameBytes: Int32, nameLength: Int32, count: In @_expose(wasm, "bjs_SimpleClass_name_get") @_cdecl("bjs_SimpleClass_name_get") -public func _bjs_SimpleClass_name_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_SimpleClass_name_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = SimpleClass.bridgeJSLiftParameter(_self).name return ret.bridgeJSLowerReturn() @@ -842,7 +858,7 @@ public func _bjs_SimpleClass_name_get(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_SimpleClass_name_set") @_cdecl("bjs_SimpleClass_name_set") -public func _bjs_SimpleClass_name_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_SimpleClass_name_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) SimpleClass.bridgeJSLiftParameter(_self).name = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -852,7 +868,7 @@ public func _bjs_SimpleClass_name_set(_self: UnsafeMutableRawPointer, valueBytes @_expose(wasm, "bjs_SimpleClass_count_get") @_cdecl("bjs_SimpleClass_count_get") -public func _bjs_SimpleClass_count_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_SimpleClass_count_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = SimpleClass.bridgeJSLiftParameter(_self).count return ret.bridgeJSLowerReturn() @@ -863,7 +879,7 @@ public func _bjs_SimpleClass_count_get(_self: UnsafeMutableRawPointer) -> Int32 @_expose(wasm, "bjs_SimpleClass_count_set") @_cdecl("bjs_SimpleClass_count_set") -public func _bjs_SimpleClass_count_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_SimpleClass_count_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) SimpleClass.bridgeJSLiftParameter(_self).count = Int.bridgeJSLiftParameter(value) #else @@ -873,7 +889,7 @@ public func _bjs_SimpleClass_count_set(_self: UnsafeMutableRawPointer, value: In @_expose(wasm, "bjs_SimpleClass_flag_get") @_cdecl("bjs_SimpleClass_flag_get") -public func _bjs_SimpleClass_flag_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_SimpleClass_flag_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = SimpleClass.bridgeJSLiftParameter(_self).flag return ret.bridgeJSLowerReturn() @@ -884,7 +900,7 @@ public func _bjs_SimpleClass_flag_get(_self: UnsafeMutableRawPointer) -> Int32 { @_expose(wasm, "bjs_SimpleClass_flag_set") @_cdecl("bjs_SimpleClass_flag_set") -public func _bjs_SimpleClass_flag_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_SimpleClass_flag_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) SimpleClass.bridgeJSLiftParameter(_self).flag = Bool.bridgeJSLiftParameter(value) #else @@ -894,7 +910,7 @@ public func _bjs_SimpleClass_flag_set(_self: UnsafeMutableRawPointer, value: Int @_expose(wasm, "bjs_SimpleClass_rate_get") @_cdecl("bjs_SimpleClass_rate_get") -public func _bjs_SimpleClass_rate_get(_self: UnsafeMutableRawPointer) -> Float32 { +public func _bjs_SimpleClass_rate_get(_ _self: UnsafeMutableRawPointer) -> Float32 { #if arch(wasm32) let ret = SimpleClass.bridgeJSLiftParameter(_self).rate return ret.bridgeJSLowerReturn() @@ -905,7 +921,7 @@ public func _bjs_SimpleClass_rate_get(_self: UnsafeMutableRawPointer) -> Float32 @_expose(wasm, "bjs_SimpleClass_rate_set") @_cdecl("bjs_SimpleClass_rate_set") -public func _bjs_SimpleClass_rate_set(_self: UnsafeMutableRawPointer, value: Float32) -> Void { +public func _bjs_SimpleClass_rate_set(_ _self: UnsafeMutableRawPointer, _ value: Float32) -> Void { #if arch(wasm32) SimpleClass.bridgeJSLiftParameter(_self).rate = Float.bridgeJSLiftParameter(value) #else @@ -915,7 +931,7 @@ public func _bjs_SimpleClass_rate_set(_self: UnsafeMutableRawPointer, value: Flo @_expose(wasm, "bjs_SimpleClass_precise_get") @_cdecl("bjs_SimpleClass_precise_get") -public func _bjs_SimpleClass_precise_get(_self: UnsafeMutableRawPointer) -> Float64 { +public func _bjs_SimpleClass_precise_get(_ _self: UnsafeMutableRawPointer) -> Float64 { #if arch(wasm32) let ret = SimpleClass.bridgeJSLiftParameter(_self).precise return ret.bridgeJSLowerReturn() @@ -926,7 +942,7 @@ public func _bjs_SimpleClass_precise_get(_self: UnsafeMutableRawPointer) -> Floa @_expose(wasm, "bjs_SimpleClass_precise_set") @_cdecl("bjs_SimpleClass_precise_set") -public func _bjs_SimpleClass_precise_set(_self: UnsafeMutableRawPointer, value: Float64) -> Void { +public func _bjs_SimpleClass_precise_set(_ _self: UnsafeMutableRawPointer, _ value: Float64) -> Void { #if arch(wasm32) SimpleClass.bridgeJSLiftParameter(_self).precise = Double.bridgeJSLiftParameter(value) #else @@ -936,8 +952,12 @@ public func _bjs_SimpleClass_precise_set(_self: UnsafeMutableRawPointer, value: @_expose(wasm, "bjs_SimpleClass_deinit") @_cdecl("bjs_SimpleClass_deinit") -public func _bjs_SimpleClass_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_SimpleClass_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension SimpleClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -948,16 +968,16 @@ extension SimpleClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_SimpleClass_wrap") -fileprivate func _bjs_SimpleClass_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_SimpleClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_SimpleClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_SimpleClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_AddressClass_init") @_cdecl("bjs_AddressClass_init") -public func _bjs_AddressClass_init(streetBytes: Int32, streetLength: Int32, cityBytes: Int32, cityLength: Int32, zipCode: Int32) -> UnsafeMutableRawPointer { +public func _bjs_AddressClass_init(_ streetBytes: Int32, _ streetLength: Int32, _ cityBytes: Int32, _ cityLength: Int32, _ zipCode: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = AddressClass(street: String.bridgeJSLiftParameter(streetBytes, streetLength), city: String.bridgeJSLiftParameter(cityBytes, cityLength), zipCode: Int.bridgeJSLiftParameter(zipCode)) return ret.bridgeJSLowerReturn() @@ -968,7 +988,7 @@ public func _bjs_AddressClass_init(streetBytes: Int32, streetLength: Int32, city @_expose(wasm, "bjs_AddressClass_street_get") @_cdecl("bjs_AddressClass_street_get") -public func _bjs_AddressClass_street_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_AddressClass_street_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = AddressClass.bridgeJSLiftParameter(_self).street return ret.bridgeJSLowerReturn() @@ -979,7 +999,7 @@ public func _bjs_AddressClass_street_get(_self: UnsafeMutableRawPointer) -> Void @_expose(wasm, "bjs_AddressClass_street_set") @_cdecl("bjs_AddressClass_street_set") -public func _bjs_AddressClass_street_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_AddressClass_street_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) AddressClass.bridgeJSLiftParameter(_self).street = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -989,7 +1009,7 @@ public func _bjs_AddressClass_street_set(_self: UnsafeMutableRawPointer, valueBy @_expose(wasm, "bjs_AddressClass_city_get") @_cdecl("bjs_AddressClass_city_get") -public func _bjs_AddressClass_city_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_AddressClass_city_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = AddressClass.bridgeJSLiftParameter(_self).city return ret.bridgeJSLowerReturn() @@ -1000,7 +1020,7 @@ public func _bjs_AddressClass_city_get(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_AddressClass_city_set") @_cdecl("bjs_AddressClass_city_set") -public func _bjs_AddressClass_city_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_AddressClass_city_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) AddressClass.bridgeJSLiftParameter(_self).city = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -1010,7 +1030,7 @@ public func _bjs_AddressClass_city_set(_self: UnsafeMutableRawPointer, valueByte @_expose(wasm, "bjs_AddressClass_zipCode_get") @_cdecl("bjs_AddressClass_zipCode_get") -public func _bjs_AddressClass_zipCode_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_AddressClass_zipCode_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = AddressClass.bridgeJSLiftParameter(_self).zipCode return ret.bridgeJSLowerReturn() @@ -1021,7 +1041,7 @@ public func _bjs_AddressClass_zipCode_get(_self: UnsafeMutableRawPointer) -> Int @_expose(wasm, "bjs_AddressClass_zipCode_set") @_cdecl("bjs_AddressClass_zipCode_set") -public func _bjs_AddressClass_zipCode_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_AddressClass_zipCode_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) AddressClass.bridgeJSLiftParameter(_self).zipCode = Int.bridgeJSLiftParameter(value) #else @@ -1031,8 +1051,12 @@ public func _bjs_AddressClass_zipCode_set(_self: UnsafeMutableRawPointer, value: @_expose(wasm, "bjs_AddressClass_deinit") @_cdecl("bjs_AddressClass_deinit") -public func _bjs_AddressClass_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_AddressClass_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension AddressClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -1043,9 +1067,9 @@ extension AddressClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_AddressClass_wrap") -fileprivate func _bjs_AddressClass_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_AddressClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_AddressClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_AddressClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -1063,7 +1087,7 @@ public func _bjs_ClassRoundtrip_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_ClassRoundtrip_takeSimpleClass") @_cdecl("bjs_ClassRoundtrip_takeSimpleClass") -public func _bjs_ClassRoundtrip_takeSimpleClass(_self: UnsafeMutableRawPointer, value: UnsafeMutableRawPointer) -> Void { +public func _bjs_ClassRoundtrip_takeSimpleClass(_ _self: UnsafeMutableRawPointer, _ value: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ClassRoundtrip.bridgeJSLiftParameter(_self).takeSimpleClass(_: SimpleClass.bridgeJSLiftParameter(value)) #else @@ -1073,7 +1097,7 @@ public func _bjs_ClassRoundtrip_takeSimpleClass(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_ClassRoundtrip_makeSimpleClass") @_cdecl("bjs_ClassRoundtrip_makeSimpleClass") -public func _bjs_ClassRoundtrip_makeSimpleClass(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_ClassRoundtrip_makeSimpleClass(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = ClassRoundtrip.bridgeJSLiftParameter(_self).makeSimpleClass() return ret.bridgeJSLowerReturn() @@ -1084,7 +1108,7 @@ public func _bjs_ClassRoundtrip_makeSimpleClass(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_ClassRoundtrip_roundtripSimpleClass") @_cdecl("bjs_ClassRoundtrip_roundtripSimpleClass") -public func _bjs_ClassRoundtrip_roundtripSimpleClass(_self: UnsafeMutableRawPointer, value: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_ClassRoundtrip_roundtripSimpleClass(_ _self: UnsafeMutableRawPointer, _ value: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = ClassRoundtrip.bridgeJSLiftParameter(_self).roundtripSimpleClass(_: SimpleClass.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -1095,7 +1119,7 @@ public func _bjs_ClassRoundtrip_roundtripSimpleClass(_self: UnsafeMutableRawPoin @_expose(wasm, "bjs_ClassRoundtrip_takeAddressClass") @_cdecl("bjs_ClassRoundtrip_takeAddressClass") -public func _bjs_ClassRoundtrip_takeAddressClass(_self: UnsafeMutableRawPointer, value: UnsafeMutableRawPointer) -> Void { +public func _bjs_ClassRoundtrip_takeAddressClass(_ _self: UnsafeMutableRawPointer, _ value: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ClassRoundtrip.bridgeJSLiftParameter(_self).takeAddressClass(_: AddressClass.bridgeJSLiftParameter(value)) #else @@ -1105,7 +1129,7 @@ public func _bjs_ClassRoundtrip_takeAddressClass(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_ClassRoundtrip_makeAddressClass") @_cdecl("bjs_ClassRoundtrip_makeAddressClass") -public func _bjs_ClassRoundtrip_makeAddressClass(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_ClassRoundtrip_makeAddressClass(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = ClassRoundtrip.bridgeJSLiftParameter(_self).makeAddressClass() return ret.bridgeJSLowerReturn() @@ -1116,7 +1140,7 @@ public func _bjs_ClassRoundtrip_makeAddressClass(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_ClassRoundtrip_roundtripAddressClass") @_cdecl("bjs_ClassRoundtrip_roundtripAddressClass") -public func _bjs_ClassRoundtrip_roundtripAddressClass(_self: UnsafeMutableRawPointer, value: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_ClassRoundtrip_roundtripAddressClass(_ _self: UnsafeMutableRawPointer, _ value: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = ClassRoundtrip.bridgeJSLiftParameter(_self).roundtripAddressClass(_: AddressClass.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -1127,8 +1151,12 @@ public func _bjs_ClassRoundtrip_roundtripAddressClass(_self: UnsafeMutableRawPoi @_expose(wasm, "bjs_ClassRoundtrip_deinit") @_cdecl("bjs_ClassRoundtrip_deinit") -public func _bjs_ClassRoundtrip_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_ClassRoundtrip_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension ClassRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -1139,9 +1167,9 @@ extension ClassRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_ClassRoundtrip_wrap") -fileprivate func _bjs_ClassRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ClassRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ClassRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ClassRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift b/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift index e885569de..e6bb84c13 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift @@ -32,7 +32,8 @@ fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void { #endif func benchmarkHelperNoopWithNumber(_ n: Double) throws(JSException) -> Void { - bjs_benchmarkHelperNoopWithNumber(n.bridgeJSLowerParameter()) + let nValue = n.bridgeJSLowerParameter() + bjs_benchmarkHelperNoopWithNumber(nValue) if let error = _swift_js_take_exception() { throw error } @@ -48,7 +49,9 @@ fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void { #endif func benchmarkRunner(_ name: String, _ body: JSObject) throws(JSException) -> Void { - bjs_benchmarkRunner(name.bridgeJSLowerParameter(), body.bridgeJSLowerParameter()) + let nameValue = name.bridgeJSLowerParameter() + let bodyValue = body.bridgeJSLowerParameter() + bjs_benchmarkRunner(nameValue, bodyValue) if let error = _swift_js_take_exception() { throw error } diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift index be683415c..3391b2fd6 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift @@ -19,7 +19,7 @@ public func _bjs_PlayBridgeJS_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_PlayBridgeJS_update") @_cdecl("bjs_PlayBridgeJS_update") -public func _bjs_PlayBridgeJS_update(_self: UnsafeMutableRawPointer, swiftSourceBytes: Int32, swiftSourceLength: Int32, dtsSourceBytes: Int32, dtsSourceLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_PlayBridgeJS_update(_ _self: UnsafeMutableRawPointer, _ swiftSourceBytes: Int32, _ swiftSourceLength: Int32, _ dtsSourceBytes: Int32, _ dtsSourceLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) do { let ret = try PlayBridgeJS.bridgeJSLiftParameter(_self).update(swiftSource: String.bridgeJSLiftParameter(swiftSourceBytes, swiftSourceLength), dtsSource: String.bridgeJSLiftParameter(dtsSourceBytes, dtsSourceLength)) @@ -44,8 +44,12 @@ public func _bjs_PlayBridgeJS_update(_self: UnsafeMutableRawPointer, swiftSource @_expose(wasm, "bjs_PlayBridgeJS_deinit") @_cdecl("bjs_PlayBridgeJS_deinit") -public func _bjs_PlayBridgeJS_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_PlayBridgeJS_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension PlayBridgeJS: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -56,16 +60,16 @@ extension PlayBridgeJS: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJS_wrap") -fileprivate func _bjs_PlayBridgeJS_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PlayBridgeJS_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PlayBridgeJS_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PlayBridgeJS_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_PlayBridgeJSOutput_outputJs") @_cdecl("bjs_PlayBridgeJSOutput_outputJs") -public func _bjs_PlayBridgeJSOutput_outputJs(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PlayBridgeJSOutput_outputJs(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).outputJs() return ret.bridgeJSLowerReturn() @@ -76,7 +80,7 @@ public func _bjs_PlayBridgeJSOutput_outputJs(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_PlayBridgeJSOutput_outputDts") @_cdecl("bjs_PlayBridgeJSOutput_outputDts") -public func _bjs_PlayBridgeJSOutput_outputDts(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PlayBridgeJSOutput_outputDts(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).outputDts() return ret.bridgeJSLowerReturn() @@ -87,7 +91,7 @@ public func _bjs_PlayBridgeJSOutput_outputDts(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_PlayBridgeJSOutput_importSwiftGlue") @_cdecl("bjs_PlayBridgeJSOutput_importSwiftGlue") -public func _bjs_PlayBridgeJSOutput_importSwiftGlue(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PlayBridgeJSOutput_importSwiftGlue(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).importSwiftGlue() return ret.bridgeJSLowerReturn() @@ -98,7 +102,7 @@ public func _bjs_PlayBridgeJSOutput_importSwiftGlue(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_PlayBridgeJSOutput_exportSwiftGlue") @_cdecl("bjs_PlayBridgeJSOutput_exportSwiftGlue") -public func _bjs_PlayBridgeJSOutput_exportSwiftGlue(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PlayBridgeJSOutput_exportSwiftGlue(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).exportSwiftGlue() return ret.bridgeJSLowerReturn() @@ -109,8 +113,12 @@ public func _bjs_PlayBridgeJSOutput_exportSwiftGlue(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_PlayBridgeJSOutput_deinit") @_cdecl("bjs_PlayBridgeJSOutput_deinit") -public func _bjs_PlayBridgeJSOutput_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_PlayBridgeJSOutput_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension PlayBridgeJSOutput: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -121,9 +129,9 @@ extension PlayBridgeJSOutput: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJSOutput_wrap") -fileprivate func _bjs_PlayBridgeJSOutput_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PlayBridgeJSOutput_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PlayBridgeJSOutput_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PlayBridgeJSOutput_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift index fca5dcb20..cd1ef9814 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift @@ -40,7 +40,9 @@ struct TS2Skeleton: _JSBridgedClass { } func convert(_ ts: String) throws(JSException) -> String { - let ret = bjs_TS2Skeleton_convert(self.bridgeJSLowerParameter(), ts.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let tsValue = ts.bridgeJSLowerParameter() + let ret = bjs_TS2Skeleton_convert(selfValue, tsValue) if let error = _swift_js_take_exception() { throw error } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index e5344a45e..e20bb6ab2 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1986,10 +1986,10 @@ public class ExportSwift { let body: CodeBlockItemListSyntax if effects.isAsync { body = """ - let ret = JSPromise.async { - \(CodeBlockItemListSyntax(self.body)) - }.jsObject - return ret.bridgeJSLowerReturn() + let ret = JSPromise.async { + \(CodeBlockItemListSyntax(self.body)) + }.jsObject + return ret.bridgeJSLowerReturn() """ } else if effects.isThrows { body = """ @@ -2012,17 +2012,20 @@ public class ExportSwift { } else { body = CodeBlockItemListSyntax(self.body) } - return """ - @_expose(wasm, "\(raw: abiName)") - @_cdecl("\(raw: abiName)") - public func _\(raw: abiName)(\(raw: parameterSignature())) -> \(raw: returnSignature()) { - #if arch(wasm32) - \(body) - #else - fatalError("Only available on WebAssembly") - #endif - } - """ + // Build function signature using SwiftSignatureBuilder + let signature = SwiftSignatureBuilder.buildABIFunctionSignature( + abiParameters: abiParameterSignatures, + returnType: abiReturnType + ) + + // Build function declaration using helper function + let funcDecl = SwiftCodePattern.buildExposedFunctionDecl( + abiName: abiName, + signature: signature, + body: body + ) + + return DeclSyntax(funcDecl) } private func returnPlaceholderStmt() -> String { @@ -2035,19 +2038,6 @@ public class ExportSwift { case .none: return "return" } } - - func parameterSignature() -> String { - var nameAndType: [(name: String, abiType: String)] = [] - for (name, type) in abiParameterSignatures { - nameAndType.append((name, type.swiftType)) - } - return nameAndType.map { "\($0.name): \($0.abiType)" }.joined(separator: ", ") - } - - func returnSignature() -> String { - return abiReturnType?.swiftType ?? "Void" - } - } /// Context for property rendering that determines call behavior and ABI generation @@ -2330,15 +2320,17 @@ public class ExportSwift { } do { - decls.append( - """ - @_expose(wasm, "bjs_\(raw: klass.name)_deinit") - @_cdecl("bjs_\(raw: klass.name)_deinit") - public func _bjs_\(raw: klass.name)_deinit(pointer: UnsafeMutableRawPointer) { - Unmanaged<\(raw: klass.swiftCallName)>.fromOpaque(pointer).release() + let funcDecl = SwiftCodePattern.buildExposedFunctionDecl( + abiName: "bjs_\(klass.name)_deinit", + signature: SwiftSignatureBuilder.buildABIFunctionSignature( + abiParameters: [("pointer", .pointer)], + returnType: nil + ), + body: CodeBlockItemListSyntax { + "Unmanaged<\(raw: klass.swiftCallName)>.fromOpaque(pointer).release()" } - """ ) + decls.append(DeclSyntax(funcDecl)) } // Generate ConvertibleToJSValue extension @@ -2375,16 +2367,40 @@ public class ExportSwift { } } """ - let externDecl: DeclSyntax = """ - #if arch(wasm32) - @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: externFunctionName)") - fileprivate func \(raw: wrapFunctionName)(_: UnsafeMutableRawPointer) -> Int32 - #else - fileprivate func \(raw: wrapFunctionName)(_: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif - """ + // Build common function signature + let funcSignature = SwiftSignatureBuilder.buildABIFunctionSignature( + abiParameters: [("pointer", .pointer)], + returnType: .i32 + ) + + // Build extern function declaration (no body) + let externFuncDecl = SwiftCodePattern.buildExternFunctionDecl( + moduleName: moduleName, + abiName: externFunctionName, + functionName: wrapFunctionName, + signature: funcSignature + ) + + // Build stub function declaration (with fatalError body) + let stubFuncDecl = FunctionDeclSyntax( + modifiers: DeclModifierListSyntax { + DeclModifierSyntax(name: .keyword(.fileprivate)) + }, + funcKeyword: .keyword(.func), + name: .identifier(wrapFunctionName), + signature: funcSignature, + body: CodeBlockSyntax { + "fatalError(\"Only available on WebAssembly\")" + } + ) + + // Use helper function for conditional compilation + let externDecl = DeclSyntax( + SwiftCodePattern.buildWasmConditionalCompilationDecls( + wasmDecl: DeclSyntax(externFuncDecl), + elseDecl: DeclSyntax(stubFuncDecl) + ) + ) return [extensionDecl, externDecl] } } @@ -2413,28 +2429,6 @@ struct ClosureCodegen { } } - private func generateOptionalParameterLowering(_ signature: ClosureSignature) throws -> String { - var lines: [String] = [] - - for (index, paramType) in signature.parameters.enumerated() { - guard case .optional(let wrappedType) = paramType else { - continue - } - let paramName = "param\(index)" - if case .swiftHeapObject = wrappedType { - lines.append( - "let (\(paramName)IsSome, \(paramName)Value) = \(paramName).bridgeJSLowerParameterWithRetain()" - ) - } else { - lines.append( - "let (\(paramName)IsSome, \(paramName)Value) = \(paramName).bridgeJSLowerParameterWithPresence()" - ) - } - } - - return lines.isEmpty ? "" : lines.joined(separator: "\n") + "\n" - } - func renderClosureHelpers(_ signature: ClosureSignature) throws -> [DeclSyntax] { let mangledName = signature.mangleName let helperName = "_BJS_Closure_\(mangledName)" @@ -2448,111 +2442,139 @@ struct ClosureCodegen { let swiftReturnType = signature.returnType.swiftType let closureType = "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)" - var invokeParams: [(name: String, type: String)] = [("_", "Int32")] - var invokeCallArgs: [String] = ["callback.bridgeJSLowerParameter()"] - - for (index, paramType) in signature.parameters.enumerated() { - let paramName = "param\(index)" - - if case .optional(let wrappedType) = paramType { - invokeParams.append(("_", "Int32")) + let externName = "invoke_js_callback_\(signature.moduleName)_\(mangledName)" - switch wrappedType { - case .swiftHeapObject: - invokeParams.append(("_", "UnsafeMutableRawPointer")) - case .string, .rawValueEnum(_, .string): - invokeParams.append(("_", "Int32")) - default: - let lowerInfo = try wrappedType.loweringReturnInfo() - if let wasmType = lowerInfo.returnType { - invokeParams.append(("_", wasmType.swiftType)) - } else { - invokeParams.append(("_", "Int32")) - } - } + // Use CallJSEmission to generate the callback invocation + let builder = ImportTS.CallJSEmission( + moduleName: "bjs", + abiName: externName, + context: .exportSwift + ) - invokeCallArgs.append("\(paramName)IsSome") - invokeCallArgs.append("\(paramName)Value") - } else { - let lowerInfo = try paramType.loweringReturnInfo() - if let wasmType = lowerInfo.returnType { - invokeParams.append(("_", wasmType.swiftType)) - invokeCallArgs.append("\(paramName).bridgeJSLowerParameter()") - } else { - invokeParams.append(("_", "Int32")) - invokeCallArgs.append("\(paramName).bridgeJSLowerParameter()") - } - } - } + // Lower the callback parameter + try builder.lowerParameter(param: Parameter(label: nil, name: "callback", type: .jsObject(nil))) - let invokeSignature = invokeParams.map { "\($0.name): \($0.type)" }.joined(separator: ", ") - let invokeReturnType: String - if case .optional = signature.returnType { - invokeReturnType = "Void" - } else if let wasmType = try signature.returnType.liftingReturnInfo(context: .exportSwift).valueToLift { - invokeReturnType = wasmType.swiftType - } else { - invokeReturnType = "Void" + // Lower each closure parameter + for (index, paramType) in signature.parameters.enumerated() { + try builder.lowerParameter(param: Parameter(label: nil, name: "param\(index)", type: paramType)) } - let externName = "invoke_js_callback_\(signature.moduleName)_\(mangledName)" - - let returnLifting: String - if signature.returnType == .void { - returnLifting = "\(externName)(\(invokeCallArgs.joined(separator: ", ")))" - } else if case .optional = signature.returnType { - returnLifting = """ - \(externName)(\(invokeCallArgs.joined(separator: ", "))) - return \(signature.returnType.swiftType).bridgeJSLiftReturnFromSideChannel() - """ - } else { - returnLifting = """ - let resultId = \(externName)(\(invokeCallArgs.joined(separator: ", "))) - return \(signature.returnType.swiftType).bridgeJSLiftReturn(resultId) - """ - } + // Generate the call and return value lifting + try builder.call(returnType: signature.returnType) + try builder.liftReturnValue(returnType: signature.returnType) - let optionalLoweringCode = try generateOptionalParameterLowering(signature) + // Get the body code + let bodyCode = builder.getBody() - let externDecl: DeclSyntax = """ - @_extern(wasm, module: "bjs", name: "\(raw: externName)") - fileprivate func \(raw: externName)(\(raw: invokeSignature)) -> \(raw: invokeReturnType) - """ + // Generate extern declaration using CallJSEmission + let externDecl = builder.renderImportDecl() - let boxDecl: DeclSyntax = """ + let boxClassDecl: DeclSyntax = """ private final class \(raw: boxClassName): _BridgedSwiftClosureBox { let closure: \(raw: closureType) init(_ closure: @escaping \(raw: closureType)) { self.closure = closure } } + """ - private enum \(raw: helperName) { - static func bridgeJSLower(_ closure: @escaping \(raw: closureType)) -> UnsafeMutableRawPointer { - let box = \(raw: boxClassName)(closure) - return Unmanaged.passRetained(box).toOpaque() - } + let helperEnumDecl = EnumDeclSyntax( + modifiers: DeclModifierListSyntax { + DeclModifierSyntax(name: .keyword(.private)) + }, + name: .identifier(helperName), + memberBlockBuilder: { + DeclSyntax( + FunctionDeclSyntax( + modifiers: DeclModifierListSyntax { + DeclModifierSyntax(name: .keyword(.static)) + }, + name: .identifier("bridgeJSLower"), + signature: FunctionSignatureSyntax( + parameterClause: FunctionParameterClauseSyntax { + FunctionParameterSyntax( + firstName: .wildcardToken(), + secondName: .identifier("closure"), + colon: .colonToken(), + type: TypeSyntax("@escaping \(raw: closureType)") + ) + }, + returnClause: ReturnClauseSyntax( + arrow: .arrowToken(), + type: IdentifierTypeSyntax(name: .identifier("UnsafeMutableRawPointer")) + ) + ), + body: CodeBlockSyntax { + "let box = \(raw: boxClassName)(closure)" + "return Unmanaged.passRetained(box).toOpaque()" + } + ) + ) - static func bridgeJSLift(_ callbackId: Int32) -> \(raw: closureType) { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] \(raw: signature.parameters.indices.map { "param\($0)" }.joined(separator: ", ")) in - #if arch(wasm32) - \(raw: optionalLoweringCode)\(raw: returnLifting) - #else - fatalError("Only available on WebAssembly") - #endif + DeclSyntax( + FunctionDeclSyntax( + modifiers: DeclModifierListSyntax { + DeclModifierSyntax(name: .keyword(.static)) + }, + name: .identifier("bridgeJSLift"), + signature: FunctionSignatureSyntax( + parameterClause: FunctionParameterClauseSyntax { + FunctionParameterSyntax( + firstName: .wildcardToken(), + secondName: .identifier("callbackId"), + colon: .colonToken(), + type: IdentifierTypeSyntax(name: .identifier("Int32")) + ) + }, + returnClause: ReturnClauseSyntax( + arrow: .arrowToken(), + type: IdentifierTypeSyntax(name: .identifier(closureType)) + ) + ), + body: CodeBlockSyntax { + "let callback = JSObject.bridgeJSLiftParameter(callbackId)" + ReturnStmtSyntax( + expression: ClosureExprSyntax( + leftBrace: .leftBraceToken(), + signature: ClosureSignatureSyntax( + capture: ClosureCaptureClauseSyntax( + leftSquare: .leftSquareToken(), + items: ClosureCaptureListSyntax { + ClosureCaptureSyntax( + expression: ExprSyntax("callback") + ) + }, + rightSquare: .rightSquareToken() + ), + parameterClause: .simpleInput( + ClosureShorthandParameterListSyntax { + for (index, _) in signature.parameters.enumerated() { + ClosureShorthandParameterSyntax(name: .identifier("param\(index)")) + } + } + ), + inKeyword: .keyword(.in) + ), + statements: CodeBlockItemListSyntax { + SwiftCodePattern.buildWasmConditionalCompilation(wasmBody: bodyCode.statements) + }, + rightBrace: .rightBraceToken() + ) + ) } - } + ) + ) } - """ - return [externDecl, boxDecl] + ) + return [externDecl, boxClassDecl, DeclSyntax(helperEnumDecl)] } func renderClosureInvokeHandler(_ signature: ClosureSignature) throws -> DeclSyntax { let boxClassName = "_BJS_ClosureBox_\(signature.mangleName)" let abiName = "invoke_swift_closure_\(signature.moduleName)_\(signature.mangleName)" - var abiParams: [(name: String, type: String)] = [("boxPtr", "UnsafeMutableRawPointer")] + // Build ABI parameters directly with WasmCoreType (no string conversion needed) + var abiParams: [(name: String, type: WasmCoreType)] = [("boxPtr", .pointer)] var liftedParams: [String] = [] for (index, paramType) in signature.parameters.enumerated() { @@ -2562,7 +2584,7 @@ struct ClosureCodegen { for (argName, wasmType) in liftInfo.parameters { let fullName = liftInfo.parameters.count > 1 ? "\(paramName)\(argName.capitalizedFirstLetter)" : paramName - abiParams.append((fullName, wasmType.swiftType)) + abiParams.append((fullName, wasmType)) } let argNames = liftInfo.parameters.map { (argName, _) in @@ -2571,40 +2593,43 @@ struct ClosureCodegen { liftedParams.append("\(paramType.swiftType).bridgeJSLiftParameter(\(argNames.joined(separator: ", ")))") } - let paramSignature = abiParams.map { "\($0.name): \($0.type)" }.joined(separator: ", ") - let closureCall = "box.closure(\(liftedParams.joined(separator: ", ")))" - - let returnCode: String - if signature.returnType == .void { - returnCode = closureCall - } else { - returnCode = """ - let result = \(closureCall) - return result.bridgeJSLowerReturn() - """ - } + let closureCallExpr = ExprSyntax("box.closure(\(raw: liftedParams.joined(separator: ", ")))") - let abiReturnType: String + // Determine return type + let abiReturnWasmType: WasmCoreType? if signature.returnType == .void { - abiReturnType = "Void" + abiReturnWasmType = nil } else if let wasmType = try signature.returnType.loweringReturnInfo().returnType { - abiReturnType = wasmType.swiftType + abiReturnWasmType = wasmType } else { - abiReturnType = "Void" + abiReturnWasmType = nil } - return """ - @_expose(wasm, "\(raw: abiName)") - @_cdecl("\(raw: abiName)") - public func _\(raw: abiName)(\(raw: paramSignature)) -> \(raw: abiReturnType) { - #if arch(wasm32) - let box = Unmanaged<\(raw: boxClassName)>.fromOpaque(boxPtr).takeUnretainedValue() - \(raw: returnCode) - #else - fatalError("Only available on WebAssembly") - #endif + // Build signature using SwiftSignatureBuilder + let funcSignature = SwiftSignatureBuilder.buildABIFunctionSignature( + abiParameters: abiParams, + returnType: abiReturnWasmType + ) + + // Build body + let body = CodeBlockItemListSyntax { + "let box = Unmanaged<\(raw: boxClassName)>.fromOpaque(boxPtr).takeUnretainedValue()" + if signature.returnType == .void { + closureCallExpr + } else { + "let result = \(closureCallExpr)" + "return result.bridgeJSLowerReturn()" } - """ + } + + // Build function declaration using helper + let funcDecl = SwiftCodePattern.buildExposedFunctionDecl( + abiName: abiName, + signature: funcSignature, + body: body + ) + + return DeclSyntax(funcDecl) } } @@ -3072,104 +3097,45 @@ struct ProtocolCodegen { var externDecls: [DeclSyntax] = [] for method in proto.methods { - var swiftParams: [String] = [] - for param in method.parameters { - let label = param.label ?? param.name - if label == param.name { - swiftParams.append("\(param.name): \(param.type.swiftType)") - } else { - swiftParams.append("\(label) \(param.name): \(param.type.swiftType)") - } - } - - var externParams: [String] = ["this: Int32"] - for param in method.parameters { - let loweringInfo = try param.type.loweringParameterInfo(context: .exportSwift) - for (paramName, wasmType) in loweringInfo.loweredParameters { - let fullParamName = - loweringInfo.loweredParameters.count > 1 - ? "\(param.name)\(paramName.capitalizedFirstLetter)" : param.name - externParams.append("\(fullParamName): \(wasmType.swiftType)") - } - } - - var preCallStatements: [String] = [] - var callArgs: [String] = ["this: Int32(bitPattern: jsObject.id)"] + let builder = ImportTS.CallJSEmission( + moduleName: moduleName, + abiName: "_extern_\(method.name)", + context: .exportSwift + ) + try builder.lowerParameter(param: Parameter(label: nil, name: "jsObject", type: .jsObject(nil))) for param in method.parameters { - let loweringInfo = try param.type.loweringParameterInfo(context: .exportSwift) - if case .optional = param.type, loweringInfo.loweredParameters.count > 1 { - let isSomeName = "\(param.name)\(loweringInfo.loweredParameters[0].name.capitalizedFirstLetter)" - let wrappedName = "\(param.name)\(loweringInfo.loweredParameters[1].name.capitalizedFirstLetter)" - preCallStatements.append( - "let (\(isSomeName), \(wrappedName)) = \(param.name).bridgeJSLowerParameterWithPresence()" - ) - callArgs.append("\(isSomeName): \(isSomeName)") - callArgs.append("\(wrappedName): \(wrappedName)") - } else { - callArgs.append("\(param.name): \(param.name).bridgeJSLowerParameter()") - } + try builder.lowerParameter(param: param) } + try builder.call(returnType: method.returnType) + try builder.liftReturnValue(returnType: method.returnType) - let returnTypeStr: String - let externReturnType: String - let callCode: DeclSyntax - - let preCallCode = preCallStatements.isEmpty ? "" : preCallStatements.joined(separator: "\n") + "\n" + // Build function signature using SwiftSignatureBuilder + let signature = SwiftSignatureBuilder.buildFunctionSignature( + parameters: method.parameters, + returnType: method.returnType, + effects: nil + ) - if method.returnType == .void { - returnTypeStr = "" - externReturnType = "" - callCode = """ - \(raw: preCallCode)_extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) - """ - } else { - returnTypeStr = " -> \(method.returnType.swiftType)" - let liftingInfo = try method.returnType.liftingReturnInfo( - context: .exportSwift + // Build extern declaration using helper function + let externSignature = SwiftSignatureBuilder.buildABIFunctionSignature( + abiParameters: builder.abiParameterSignatures, + returnType: builder.abiReturnType + ) + let externFuncDecl = SwiftCodePattern.buildExternFunctionDecl( + moduleName: moduleName, + abiName: method.abiName, + functionName: "_extern_\(method.name)", + signature: externSignature + ) + externDecls.append(DeclSyntax(externFuncDecl)) + let methodImplementation = DeclSyntax( + FunctionDeclSyntax( + name: .identifier(method.name), + signature: signature, + body: builder.getBody() ) - - if case .optional = method.returnType { - if let abiType = liftingInfo.valueToLift { - externReturnType = " -> \(abiType.swiftType)" - callCode = """ - \(raw: preCallCode)let ret = _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) - return \(raw: method.returnType.swiftType).bridgeJSLiftReturn(ret) - """ - } else { - externReturnType = "" - callCode = """ - \(raw: preCallCode)_extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) - return \(raw: method.returnType.swiftType).bridgeJSLiftReturn() - """ - } - } else if let abiType = liftingInfo.valueToLift { - externReturnType = " -> \(abiType.swiftType)" - callCode = """ - \(raw: preCallCode)let ret = _extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) - return \(raw: method.returnType.swiftType).bridgeJSLiftReturn(ret) - """ - } else { - externReturnType = "" - callCode = """ - \(raw: preCallCode)_extern_\(raw: method.name)(\(raw: callArgs.joined(separator: ", "))) - return \(raw: method.returnType.swiftType).bridgeJSLiftReturn() - """ - } - } - - externDecls.append( - """ - @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: method.abiName)") - fileprivate func _extern_\(raw: method.name)(\(raw: externParams.joined(separator: ", ")))\(raw: externReturnType) - """ ) - let methodImplementation: DeclSyntax = """ - func \(raw: method.name)(\(raw: swiftParams.joined(separator: ", ")))\(raw: returnTypeStr) { - \(raw: callCode) - } - """ - methodDecls.append(methodImplementation) } @@ -3185,20 +3151,35 @@ struct ProtocolCodegen { externDecls.append(contentsOf: propertyExternDecls) } - let allDecls = (methodDecls + propertyDecls).map { $0.description }.joined(separator: "\n\n") - - let structDecl: DeclSyntax = """ - struct \(raw: wrapperName): \(raw: protocolName), _BridgedSwiftProtocolWrapper { - let jsObject: JSObject - - \(raw: allDecls) + let structDecl = StructDeclSyntax( + name: .identifier(wrapperName), + inheritanceClause: InheritanceClauseSyntax( + inheritedTypesBuilder: { + InheritedTypeSyntax(type: IdentifierTypeSyntax(name: .identifier(protocolName))) + InheritedTypeSyntax(type: IdentifierTypeSyntax(name: .identifier("_BridgedSwiftProtocolWrapper"))) + } + ), + memberBlockBuilder: { + DeclSyntax( + """ + let jsObject: JSObject + """ + ).with(\.trailingTrivia, .newlines(2)) - static func bridgeJSLiftParameter(_ value: Int32) -> Self { - return \(raw: wrapperName)(jsObject: JSObject(id: UInt32(bitPattern: value))) + for decl in methodDecls + propertyDecls { + decl.with(\.trailingTrivia, .newlines(2)) } + + DeclSyntax( + """ + static func bridgeJSLiftParameter(_ value: Int32) -> Self { + return \(raw: wrapperName)(jsObject: JSObject(id: UInt32(bitPattern: value))) + } + """ + ) } - """ - return [structDecl] + externDecls + ) + return [DeclSyntax(structDecl)] + externDecls } private func renderProtocolProperty( @@ -3217,87 +3198,98 @@ struct ProtocolCodegen { className: protocolName ) - let usesSideChannel = property.type.usesSideChannelForOptionalReturn() - let liftingInfo = try property.type.liftingReturnInfo(context: .exportSwift) - let getterReturnType: String - let getterBody: String - - if usesSideChannel { - getterReturnType = "" - getterBody = """ - \(getterAbiName)(this: Int32(bitPattern: jsObject.id)) - return \(property.type.swiftType).bridgeJSLiftReturnFromSideChannel() - """ - } else if let abiType = liftingInfo.valueToLift { - getterReturnType = " -> \(abiType.swiftType)" - getterBody = """ - let ret = \(getterAbiName)(this: Int32(bitPattern: jsObject.id)) - return \(property.type.swiftType).bridgeJSLiftReturn(ret) - """ - } else { - getterReturnType = "" - getterBody = """ - \(getterAbiName)(this: Int32(bitPattern: jsObject.id)) - return \(property.type.swiftType).bridgeJSLiftReturn() - """ - } - - let getterExternDecl: DeclSyntax = """ - @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: getterAbiName)") - fileprivate func \(raw: getterAbiName)(this: Int32)\(raw: getterReturnType) - """ + let getterBuilder = ImportTS.CallJSEmission( + moduleName: moduleName, + abiName: getterAbiName, + context: .exportSwift + ) + try getterBuilder.lowerParameter(param: Parameter(label: nil, name: "jsObject", type: .jsObject(nil))) + try getterBuilder.call(returnType: property.type) + try getterBuilder.liftReturnValue(returnType: property.type) + + // Build getter extern declaration using helper function + let getterExternSignature = SwiftSignatureBuilder.buildABIFunctionSignature( + abiParameters: getterBuilder.abiParameterSignatures, + returnType: getterBuilder.abiReturnType + ) + let getterExternDecl = SwiftCodePattern.buildExternFunctionDecl( + moduleName: moduleName, + abiName: getterAbiName, + functionName: getterAbiName, + signature: getterExternSignature + ) if property.isReadonly { - return ( - """ - var \(raw: property.name): \(raw: property.type.swiftType) { - get { - \(raw: getterBody) - } + let propertyDecl = VariableDeclSyntax( + bindingSpecifier: .keyword(.var), + bindings: PatternBindingListSyntax { + PatternBindingSyntax( + pattern: IdentifierPatternSyntax(identifier: .identifier(property.name)), + typeAnnotation: TypeAnnotationSyntax( + type: IdentifierTypeSyntax(name: .identifier(property.type.swiftType)) + ), + accessorBlock: AccessorBlockSyntax( + accessors: .accessors( + AccessorDeclListSyntax { + AccessorDeclSyntax( + accessorSpecifier: .keyword(.get), + body: getterBuilder.getBody() + ) + } + ) + ) + ) } - """, - [getterExternDecl] ) + return (DeclSyntax(propertyDecl), [DeclSyntax(getterExternDecl)]) } else { - let loweringInfo = try property.type.loweringParameterInfo(context: .exportSwift) - - let setterParams = - (["this: Int32"] + loweringInfo.loweredParameters.map { "\($0.name): \($0.type.swiftType)" }).joined( - separator: ", " - ) - - let setterBody: String - if case .optional = property.type, loweringInfo.loweredParameters.count > 1 { - let isSomeParam = loweringInfo.loweredParameters[0].name - let wrappedParam = loweringInfo.loweredParameters[1].name - setterBody = """ - let (\(isSomeParam), \(wrappedParam)) = newValue.bridgeJSLowerParameterWithPresence() - \(setterAbiName)(this: Int32(bitPattern: jsObject.id), \(isSomeParam): \(isSomeParam), \(wrappedParam): \(wrappedParam)) - """ - } else { - let paramName = loweringInfo.loweredParameters[0].name - setterBody = - "\(setterAbiName)(this: Int32(bitPattern: jsObject.id), \(paramName): newValue.bridgeJSLowerParameter())" - } - - let setterExternDecl: DeclSyntax = """ - @_extern(wasm, module: "\(raw: moduleName)", name: "\(raw: setterAbiName)") - fileprivate func \(raw: setterAbiName)(\(raw: setterParams)) - """ + let setterBuilder = ImportTS.CallJSEmission( + moduleName: moduleName, + abiName: setterAbiName, + context: .exportSwift + ) + try setterBuilder.lowerParameter(param: Parameter(label: nil, name: "jsObject", type: .jsObject(nil))) + try setterBuilder.lowerParameter(param: Parameter(label: nil, name: "newValue", type: property.type)) + try setterBuilder.call(returnType: .void) + + // Build setter extern declaration using helper function + let setterExternSignature = SwiftSignatureBuilder.buildABIFunctionSignature( + abiParameters: setterBuilder.abiParameterSignatures, + returnType: setterBuilder.abiReturnType + ) + let setterExternDecl = SwiftCodePattern.buildExternFunctionDecl( + moduleName: moduleName, + abiName: setterAbiName, + functionName: setterAbiName, + signature: setterExternSignature + ) - return ( - """ - var \(raw: property.name): \(raw: property.type.swiftType) { - get { - \(raw: getterBody) - } - set { - \(raw: setterBody) - } + let propertyDecl = VariableDeclSyntax( + bindingSpecifier: .keyword(.var), + bindings: PatternBindingListSyntax { + PatternBindingSyntax( + pattern: IdentifierPatternSyntax(identifier: .identifier(property.name)), + typeAnnotation: TypeAnnotationSyntax( + type: IdentifierTypeSyntax(name: .identifier(property.type.swiftType)) + ), + accessorBlock: AccessorBlockSyntax( + accessors: .accessors( + AccessorDeclListSyntax { + AccessorDeclSyntax( + accessorSpecifier: .keyword(.get), + body: getterBuilder.getBody() + ) + AccessorDeclSyntax( + accessorSpecifier: .keyword(.set), + body: setterBuilder.getBody() + ) + } + ) + ) + ) } - """, - [getterExternDecl, setterExternDecl] ) + return (DeclSyntax(propertyDecl), [DeclSyntax(getterExternDecl), DeclSyntax(setterExternDecl)]) } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index a3ae96abb..1a3bd0ceb 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -56,54 +56,163 @@ public struct ImportTS { return allDecls.map { $0.formatted(using: format).description }.joined(separator: "\n\n") } - class ImportedThunkBuilder { + class CallJSEmission { let abiName: String let moduleName: String + let context: BridgeContext var body: [CodeBlockItemSyntax] = [] var abiParameterForwardings: [LabeledExprSyntax] = [] var abiParameterSignatures: [(name: String, type: WasmCoreType)] = [] var abiReturnType: WasmCoreType? + // Track destructured variable names for multiple lowered parameters + var destructuredVarNames: [String] = [] - init(moduleName: String, abiName: String) { + init(moduleName: String, abiName: String, context: BridgeContext = .importTS) { self.moduleName = moduleName self.abiName = abiName + self.context = context } func lowerParameter(param: Parameter) throws { - let loweringInfo = try param.type.loweringParameterInfo() - assert( - loweringInfo.loweredParameters.count == 1, - "For now, we require a single parameter to be lowered to a single Wasm core type" - ) - let (_, type) = loweringInfo.loweredParameters[0] - abiParameterForwardings.append( - LabeledExprSyntax( - label: param.label, - expression: ExprSyntax("\(raw: param.name).bridgeJSLowerParameter()") + let loweringInfo = try param.type.loweringParameterInfo(context: context) + + // Generate destructured variable names for all lowered parameters + let destructuredNames = loweringInfo.loweredParameters.map { + "\(param.name)\($0.name.capitalizedFirstLetter)" + } + + // Always add destructuring statement to body (unified for single and multiple) + let pattern: PatternSyntax + if destructuredNames.count == 1 { + pattern = PatternSyntax(IdentifierPatternSyntax(identifier: .identifier(destructuredNames[0]))) + } else { + pattern = PatternSyntax( + TuplePatternSyntax { + for name in destructuredNames { + TuplePatternElementSyntax( + pattern: IdentifierPatternSyntax(identifier: .identifier(name)) + ) + } + } + ) + } + + body.append( + CodeBlockItemSyntax( + item: .decl( + DeclSyntax( + VariableDeclSyntax( + bindingSpecifier: .keyword(.let), + bindings: PatternBindingListSyntax { + PatternBindingSyntax( + pattern: pattern, + initializer: InitializerClauseSyntax( + value: ExprSyntax("\(raw: param.name).bridgeJSLowerParameter()") + ) + ) + } + ) + ) + ) ) ) - abiParameterSignatures.append((param.name, type)) + destructuredVarNames.append(contentsOf: destructuredNames) + + // Add to signatures and forwardings (unified for both single and multiple) + for (index, (paramName, type)) in loweringInfo.loweredParameters.enumerated() { + // For single parameter, use param.name; for multiple, use constructed name + let abiParamName: String + if loweringInfo.loweredParameters.count == 1 { + abiParamName = param.name + } else { + abiParamName = "\(param.name)\(paramName.capitalizedFirstLetter)" + } + abiParameterSignatures.append((abiParamName, type)) + + // Always use destructured variable in call without labels + // Swift allows omitting labels when they match parameter names + let callExpr = ExprSyntax("\(raw: destructuredNames[index])") + abiParameterForwardings.append( + LabeledExprSyntax(expression: callExpr) + ) + } } - func call(returnType: BridgeType) { - let call: ExprSyntax = - "\(raw: abiName)(\(raw: abiParameterForwardings.map { $0.description }.joined(separator: ", ")))" + func call(returnType: BridgeType) throws { + // Build function call expression + let callExpr = FunctionCallExprSyntax( + calledExpression: ExprSyntax("\(raw: abiName)"), + leftParen: .leftParenToken(), + arguments: LabeledExprListSyntax { + for forwarding in abiParameterForwardings { + forwarding + } + }, + rightParen: .rightParenToken() + ) + if returnType == .void { - body.append("\(raw: call)") + body.append(CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr))))) + } else if returnType.usesSideChannelForOptionalReturn() { + // Side channel returns don't need "let ret =" + body.append(CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr))))) } else { - body.append("let ret = \(raw: call)") + body.append("let ret = \(raw: callExpr)") + } + + // Add exception check for ImportTS context + if context == .importTS { + body.append("if let error = _swift_js_take_exception() { throw error }") } - body.append("if let error = _swift_js_take_exception() { throw error }") } func liftReturnValue(returnType: BridgeType) throws { - let liftingInfo = try returnType.liftingReturnInfo() - abiReturnType = liftingInfo.valueToLift + let liftingInfo = try returnType.liftingReturnInfo(context: context) + if returnType == .void { + abiReturnType = nil return } - body.append("return \(raw: returnType.swiftType).bridgeJSLiftReturn(ret)") + + if returnType.usesSideChannelForOptionalReturn() { + // Side channel returns: extern function returns Void, value is retrieved via side channel + abiReturnType = nil + body.append( + CodeBlockItemSyntax( + item: .stmt( + StmtSyntax( + ReturnStmtSyntax( + expression: ExprSyntax( + "\(raw: returnType.swiftType).bridgeJSLiftReturnFromSideChannel()" + ) + ) + ) + ) + ) + ) + } else { + abiReturnType = liftingInfo.valueToLift + let liftExpr: ExprSyntax + if liftingInfo.valueToLift != nil { + liftExpr = "\(raw: returnType.swiftType).bridgeJSLiftReturn(ret)" + } else { + liftExpr = "\(raw: returnType.swiftType).bridgeJSLiftReturn()" + } + body.append( + CodeBlockItemSyntax( + item: .stmt( + StmtSyntax( + ReturnStmtSyntax(expression: liftExpr) + ) + ) + ) + ) + } + } + + func getBody() -> CodeBlockSyntax { + return CodeBlockSyntax(statements: CodeBlockItemListSyntax(body)) } func assignThis(returnType: BridgeType) { @@ -115,68 +224,56 @@ public struct ImportTS { } func renderImportDecl() -> DeclSyntax { - let baseDecl = FunctionDeclSyntax( - modifiers: DeclModifierListSyntax(itemsBuilder: { + let signature = SwiftSignatureBuilder.buildABIFunctionSignature( + abiParameters: abiParameterSignatures, + returnType: abiReturnType + ) + + // Build extern function declaration (no body) + let externFuncDecl = FunctionDeclSyntax( + attributes: SwiftCodePattern.buildExternAttribute(moduleName: moduleName, abiName: abiName), + modifiers: DeclModifierListSyntax { DeclModifierSyntax(name: .keyword(.fileprivate)).with(\.trailingTrivia, .space) - }), + }, funcKeyword: .keyword(.func).with(\.trailingTrivia, .space), name: .identifier(abiName), - signature: FunctionSignatureSyntax( - parameterClause: FunctionParameterClauseSyntax(parametersBuilder: { - for param in abiParameterSignatures { - FunctionParameterSyntax( - firstName: .wildcardToken().with(\.trailingTrivia, .space), - secondName: .identifier(param.name), - type: IdentifierTypeSyntax(name: .identifier(param.type.swiftType)) - ) - } - }), - returnClause: ReturnClauseSyntax( - arrow: .arrowToken(), - type: IdentifierTypeSyntax(name: .identifier(abiReturnType.map { $0.swiftType } ?? "Void")) - ) + signature: signature + ) + + // Build stub function declaration (with fatalError body) + let stubFuncDecl = FunctionDeclSyntax( + modifiers: DeclModifierListSyntax { + DeclModifierSyntax(name: .keyword(.fileprivate)).with(\.trailingTrivia, .space) + }, + funcKeyword: .keyword(.func).with(\.trailingTrivia, .space), + name: .identifier(abiName), + signature: signature, + body: CodeBlockSyntax { + "fatalError(\"Only available on WebAssembly\")" + } + ) + + // Use conditional compilation helper + return DeclSyntax( + SwiftCodePattern.buildWasmConditionalCompilationDecls( + wasmDecl: DeclSyntax(externFuncDecl), + elseDecl: DeclSyntax(stubFuncDecl) ) ) - var externDecl = baseDecl - externDecl.attributes = AttributeListSyntax(itemsBuilder: { - "@_extern(wasm, module: \"\(raw: moduleName)\", name: \"\(raw: abiName)\")" - }).with(\.trailingTrivia, .newline) - var stubDecl = baseDecl - stubDecl.body = CodeBlockSyntax { - """ - fatalError("Only available on WebAssembly") - """ - } - return """ - #if arch(wasm32) - \(externDecl) - #else - \(stubDecl) - #endif - """ } func renderThunkDecl(name: String, parameters: [Parameter], returnType: BridgeType) -> DeclSyntax { + let effects = Effects(isAsync: false, isThrows: true) + let signature = SwiftSignatureBuilder.buildFunctionSignature( + parameters: parameters, + returnType: returnType, + effects: effects, + useWildcardLabels: true + ) return DeclSyntax( FunctionDeclSyntax( name: .identifier(name.backtickIfNeeded()), - signature: FunctionSignatureSyntax( - parameterClause: FunctionParameterClauseSyntax(parametersBuilder: { - for param in parameters { - FunctionParameterSyntax( - firstName: .wildcardToken(), - secondName: .identifier(param.name), - colon: .colonToken(), - type: IdentifierTypeSyntax(name: .identifier(param.type.swiftType)) - ) - } - }), - effectSpecifiers: ImportTS.buildFunctionEffect(throws: true, async: false), - returnClause: ReturnClauseSyntax( - arrow: .arrowToken(), - type: IdentifierTypeSyntax(name: .identifier(returnType.swiftType)) - ) - ), + signature: signature, body: CodeBlockSyntax { body } @@ -185,22 +282,18 @@ public struct ImportTS { } func renderConstructorDecl(parameters: [Parameter]) -> DeclSyntax { + let effects = Effects(isAsync: false, isThrows: true) + // Constructors don't have return types, so build signature without return clause + let signature = FunctionSignatureSyntax( + parameterClause: SwiftSignatureBuilder.buildParameterClause( + parameters: parameters, + useWildcardLabels: true + ), + effectSpecifiers: SwiftSignatureBuilder.buildEffectSpecifiers(effects: effects) + ) return DeclSyntax( InitializerDeclSyntax( - signature: FunctionSignatureSyntax( - parameterClause: FunctionParameterClauseSyntax( - parametersBuilder: { - for param in parameters { - FunctionParameterSyntax( - firstName: .wildcardToken(), - secondName: .identifier(param.name), - type: IdentifierTypeSyntax(name: .identifier(param.type.swiftType)) - ) - } - } - ), - effectSpecifiers: ImportTS.buildFunctionEffect(throws: true, async: false) - ), + signature: signature, bodyBuilder: { body } @@ -223,11 +316,11 @@ public struct ImportTS { _ function: ImportedFunctionSkeleton, topLevelDecls: inout [DeclSyntax] ) throws -> [DeclSyntax] { - let builder = ImportedThunkBuilder(moduleName: moduleName, abiName: function.abiName(context: nil)) + let builder = CallJSEmission(moduleName: moduleName, abiName: function.abiName(context: nil)) for param in function.parameters { try builder.lowerParameter(param: param) } - builder.call(returnType: function.returnType) + try builder.call(returnType: function.returnType) try builder.liftReturnValue(returnType: function.returnType) topLevelDecls.append(builder.renderImportDecl()) return [ @@ -244,12 +337,12 @@ public struct ImportTS { let name = type.name func renderMethod(method: ImportedFunctionSkeleton) throws -> [DeclSyntax] { - let builder = ImportedThunkBuilder(moduleName: moduleName, abiName: method.abiName(context: type)) + let builder = CallJSEmission(moduleName: moduleName, abiName: method.abiName(context: type)) try builder.lowerParameter(param: Parameter(label: nil, name: "self", type: .jsObject(name))) for param in method.parameters { try builder.lowerParameter(param: param) } - builder.call(returnType: method.returnType) + try builder.call(returnType: method.returnType) try builder.liftReturnValue(returnType: method.returnType) topLevelDecls.append(builder.renderImportDecl()) return [ @@ -263,11 +356,11 @@ public struct ImportTS { } func renderConstructorDecl(constructor: ImportedConstructorSkeleton) throws -> [DeclSyntax] { - let builder = ImportedThunkBuilder(moduleName: moduleName, abiName: constructor.abiName(context: type)) + let builder = CallJSEmission(moduleName: moduleName, abiName: constructor.abiName(context: type)) for param in constructor.parameters { try builder.lowerParameter(param: param) } - builder.call(returnType: .jsObject(name)) + try builder.call(returnType: .jsObject(name)) builder.assignThis(returnType: .jsObject(name)) topLevelDecls.append(builder.renderImportDecl()) return [ @@ -276,12 +369,12 @@ public struct ImportTS { } func renderGetterDecl(property: ImportedPropertySkeleton) throws -> AccessorDeclSyntax { - let builder = ImportedThunkBuilder( + let builder = CallJSEmission( moduleName: moduleName, abiName: property.getterAbiName(context: type) ) try builder.lowerParameter(param: Parameter(label: nil, name: "self", type: .jsObject(name))) - builder.call(returnType: property.type) + try builder.call(returnType: property.type) try builder.liftReturnValue(returnType: property.type) topLevelDecls.append(builder.renderImportDecl()) return AccessorDeclSyntax( @@ -294,14 +387,14 @@ public struct ImportTS { } func renderSetterDecl(property: ImportedPropertySkeleton) throws -> DeclSyntax { - let builder = ImportedThunkBuilder( + let builder = CallJSEmission( moduleName: moduleName, abiName: property.setterAbiName(context: type) ) let newValue = Parameter(label: nil, name: "newValue", type: property.type) try builder.lowerParameter(param: Parameter(label: nil, name: "self", type: .jsObject(name))) try builder.lowerParameter(param: newValue) - builder.call(returnType: .void) + try builder.call(returnType: .void) topLevelDecls.append(builder.renderImportDecl()) return builder.renderThunkDecl( name: "set\(property.name.capitalizedFirstLetter)", @@ -416,6 +509,355 @@ public struct ImportTS { } } +/// Unified utility for building Swift function signatures using SwiftSyntax +/// +/// This struct eliminates code duplication by providing a single source of truth +/// for generating Swift function signatures across ImportTS, ExportSwift, and +/// other code generators. +struct SwiftSignatureBuilder { + /// Builds a complete function signature from parameters, return type, and effects + /// + /// - Parameters: + /// - parameters: Array of Parameter structs for Swift function signatures + /// - returnType: The return type of the function + /// - effects: Optional effects (async/throws) + /// - Returns: A FunctionSignatureSyntax node + static func buildFunctionSignature( + parameters: [Parameter], + returnType: BridgeType, + effects: Effects? = nil, + useWildcardLabels: Bool = false + ) -> FunctionSignatureSyntax { + return FunctionSignatureSyntax( + parameterClause: buildParameterClause(parameters: parameters, useWildcardLabels: useWildcardLabels), + effectSpecifiers: effects.flatMap { buildEffectSpecifiers(effects: $0) }, + returnClause: buildReturnClause(returnType: returnType) + ) + } + + /// Builds a function signature for ABI/extern functions using WasmCoreType parameters + /// + /// - Parameters: + /// - abiParameters: Array of (name, WasmCoreType) tuples for ABI signatures + /// - returnType: The return type as WasmCoreType (nil for Void) + /// - effects: Optional effects (async/throws) + /// - Returns: A FunctionSignatureSyntax node + static func buildABIFunctionSignature( + abiParameters: [(name: String, type: WasmCoreType)], + returnType: WasmCoreType?, + effects: Effects? = nil + ) -> FunctionSignatureSyntax { + return FunctionSignatureSyntax( + parameterClause: buildABIParameterClause(abiParameters: abiParameters), + effectSpecifiers: effects.flatMap { buildEffectSpecifiers(effects: $0) }, + returnClause: buildABIReturnClause(returnType: returnType) + ) + } + + /// Builds a parameter clause from an array of Parameter structs + /// + /// - Parameters: + /// - parameters: Array of Parameter structs + /// - useWildcardLabels: If true, all parameters use wildcard labels ("_ name: Type"). + /// If false, handles parameter labels: + /// - If label == name: single identifier (e.g., "count: Int") + /// - If label != name: labeled parameter (e.g., "label count: Int") + /// - If label == nil: wildcard label (e.g., "_ count: Int") + static func buildParameterClause( + parameters: [Parameter], + useWildcardLabels: Bool = false + ) -> FunctionParameterClauseSyntax { + return FunctionParameterClauseSyntax(parametersBuilder: { + for param in parameters { + if useWildcardLabels { + // Always use wildcard labels: "_ name: Type" + FunctionParameterSyntax( + firstName: .wildcardToken(), + secondName: .identifier(param.name), + colon: .colonToken(), + type: buildTypeSyntax(from: param.type) + ) + } else { + let label = param.label ?? param.name + if label == param.name { + // External label same as parameter name: "count: Int" + FunctionParameterSyntax( + firstName: .identifier(label), + secondName: nil, + colon: .colonToken(), + type: buildTypeSyntax(from: param.type) + ) + } else if param.label == nil { + // No label specified: use wildcard "_ name: Type" + FunctionParameterSyntax( + firstName: .wildcardToken(), + secondName: .identifier(param.name), + colon: .colonToken(), + type: buildTypeSyntax(from: param.type) + ) + } else { + // External label differs: "label count: Int" + FunctionParameterSyntax( + firstName: .identifier(label), + secondName: .identifier(param.name), + colon: .colonToken(), + type: buildTypeSyntax(from: param.type) + ) + } + } + } + }) + } + + /// Builds a parameter clause for ABI/extern functions + /// + /// All parameters use wildcard labels: "_ name: Type" + static func buildABIParameterClause( + abiParameters: [(name: String, type: WasmCoreType)] + ) -> FunctionParameterClauseSyntax { + return FunctionParameterClauseSyntax(parametersBuilder: { + for param in abiParameters { + FunctionParameterSyntax( + firstName: .wildcardToken().with(\.trailingTrivia, .space), + secondName: .identifier(param.name), + type: IdentifierTypeSyntax(name: .identifier(param.type.swiftType)) + ) + } + }) + } + + /// Builds a return clause from a BridgeType + /// + /// Always returns a ReturnClauseSyntax, including for Void types + /// (to match original behavior that explicitly includes "-> Void") + static func buildReturnClause(returnType: BridgeType) -> ReturnClauseSyntax? { + return ReturnClauseSyntax( + arrow: .arrowToken(), + type: buildTypeSyntax(from: returnType) + ) + } + + /// Builds a return clause for ABI/extern functions + /// + /// Returns nil for Void (when returnType is nil), otherwise returns a ReturnClauseSyntax + static func buildABIReturnClause(returnType: WasmCoreType?) -> ReturnClauseSyntax? { + guard let returnType = returnType else { + return ReturnClauseSyntax( + arrow: .arrowToken(), + type: IdentifierTypeSyntax(name: .identifier("Void")) + ) + } + return ReturnClauseSyntax( + arrow: .arrowToken(), + type: IdentifierTypeSyntax(name: .identifier(returnType.swiftType)) + ) + } + + /// Builds effect specifiers (async/throws) from an Effects struct + /// + /// Uses JSException as the thrown error type for throws clauses + static func buildEffectSpecifiers(effects: Effects) -> FunctionEffectSpecifiersSyntax? { + guard effects.isAsync || effects.isThrows else { + return nil + } + return FunctionEffectSpecifiersSyntax( + asyncSpecifier: effects.isAsync ? .keyword(.async) : nil, + throwsClause: effects.isThrows + ? ThrowsClauseSyntax( + throwsSpecifier: .keyword(.throws), + leftParen: .leftParenToken(), + type: IdentifierTypeSyntax(name: .identifier("JSException")), + rightParen: .rightParenToken() + ) : nil + ) + } + + /// Builds a TypeSyntax node from a BridgeType + /// + /// Converts BridgeType to its Swift type representation as a TypeSyntax node + static func buildTypeSyntax(from type: BridgeType) -> TypeSyntax { + let identifierType = IdentifierTypeSyntax(name: .identifier(type.swiftType)) + return TypeSyntax(identifierType) + } + + /// Formats a FunctionSignatureSyntax to a string representation + /// + /// Useful when string interpolation is needed (e.g., in renderExternDecl) + static func formatSignatureToString(_ signature: FunctionSignatureSyntax) -> String { + let format = BasicFormat() + return signature.formatted(using: format).description + } + + /// Formats a FunctionParameterClauseSyntax to a string representation + /// + /// Useful for building parameter signature strings + static func formatParameterClauseToString(_ clause: FunctionParameterClauseSyntax) -> String { + let format = BasicFormat() + return clause.formatted(using: format).description + } + + /// Formats a ReturnClauseSyntax to a string representation + /// + /// Useful for building return type signature strings + static func formatReturnClauseToString(_ clause: ReturnClauseSyntax?) -> String { + guard let clause = clause else { + return "" + } + let format = BasicFormat() + return clause.formatted(using: format).description + } +} + +enum SwiftCodePattern { + /// Builds a conditional compilation block with #if arch(wasm32) and #else fatalError + static func buildWasmConditionalCompilation( + wasmBody: CodeBlockItemListSyntax + ) -> IfConfigDeclSyntax { + return IfConfigDeclSyntax( + clauses: IfConfigClauseListSyntax { + IfConfigClauseSyntax( + poundKeyword: .poundIfToken(), + condition: ExprSyntax("arch(wasm32)"), + elements: .statements(wasmBody) + ) + IfConfigClauseSyntax( + poundKeyword: .poundElseToken(), + elements: .statements( + CodeBlockItemListSyntax { + "fatalError(\"Only available on WebAssembly\")" + } + ) + ) + } + ) + } + + /// Builds a conditional compilation block with #if arch(wasm32) and #else for declarations + static func buildWasmConditionalCompilationDecls( + wasmDecl: DeclSyntax, + elseDecl: DeclSyntax + ) -> IfConfigDeclSyntax { + return IfConfigDeclSyntax( + clauses: IfConfigClauseListSyntax { + IfConfigClauseSyntax( + poundKeyword: .poundIfToken(), + condition: ExprSyntax("arch(wasm32)"), + elements: .statements( + CodeBlockItemListSyntax { + CodeBlockItemSyntax(item: .decl(wasmDecl)) + } + ) + ) + IfConfigClauseSyntax( + poundKeyword: .poundElseToken(), + elements: .statements( + CodeBlockItemListSyntax { + CodeBlockItemSyntax(item: .decl(elseDecl)) + } + ) + ) + } + ) + } + + /// Builds the @_extern attribute for WebAssembly extern function declarations + /// Builds an @_extern function declaration (no body, just the declaration) + static func buildExternFunctionDecl( + moduleName: String, + abiName: String, + functionName: String, + signature: FunctionSignatureSyntax + ) -> FunctionDeclSyntax { + return FunctionDeclSyntax( + attributes: buildExternAttribute(moduleName: moduleName, abiName: abiName), + modifiers: DeclModifierListSyntax { + DeclModifierSyntax(name: .keyword(.fileprivate)) + }, + funcKeyword: .keyword(.func), + name: .identifier(functionName), + signature: signature + ) + } + + /// Builds the standard @_expose and @_cdecl attributes for WebAssembly-exposed functions + static func buildExposeAttributes(abiName: String) -> AttributeListSyntax { + return AttributeListSyntax { + AttributeSyntax( + attributeName: IdentifierTypeSyntax(name: .identifier("_expose")), + leftParen: .leftParenToken(), + arguments: .exposeAttributeArguments( + ExposeAttributeArgumentsSyntax( + language: .identifier("wasm"), + comma: .commaToken(), + cxxName: StringLiteralExprSyntax(content: abiName) + ) + ), + rightParen: .rightParenToken() + ) + .with(\.trailingTrivia, .newline) + + AttributeSyntax( + attributeName: IdentifierTypeSyntax(name: .identifier("_cdecl")), + leftParen: .leftParenToken(), + arguments: .string(StringLiteralExprSyntax(content: abiName)), + rightParen: .rightParenToken() + ) + .with(\.trailingTrivia, .newline) + } + } + + /// Builds a function declaration with @_expose/@_cdecl attributes and conditional compilation + static func buildExposedFunctionDecl( + abiName: String, + signature: FunctionSignatureSyntax, + body: CodeBlockItemListSyntax + ) -> FunctionDeclSyntax { + let funcBody = CodeBlockSyntax { + buildWasmConditionalCompilation(wasmBody: body) + } + + return FunctionDeclSyntax( + attributes: buildExposeAttributes(abiName: abiName), + modifiers: DeclModifierListSyntax { + DeclModifierSyntax(name: .keyword(.public)) + }, + funcKeyword: .keyword(.func), + name: .identifier("_\(abiName)"), + signature: signature, + body: funcBody + ) + } + + /// Builds the @_extern attribute for WebAssembly extern function declarations + static func buildExternAttribute(moduleName: String, abiName: String) -> AttributeListSyntax { + return AttributeListSyntax { + AttributeSyntax( + attributeName: IdentifierTypeSyntax(name: .identifier("_extern")), + leftParen: .leftParenToken(), + arguments: .argumentList( + LabeledExprListSyntax { + LabeledExprSyntax( + expression: ExprSyntax("wasm") + ) + LabeledExprSyntax( + label: .identifier("module"), + colon: .colonToken(), + expression: StringLiteralExprSyntax(content: moduleName) + ) + LabeledExprSyntax( + label: .identifier("name"), + colon: .colonToken(), + expression: StringLiteralExprSyntax(content: abiName) + ) + } + ), + rightParen: .rightParenToken() + ) + .with(\.trailingTrivia, .newline) + } + } +} + extension BridgeType { struct LoweringParameterInfo { let loweredParameters: [(name: String, type: WasmCoreType)] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift index 33ddda258..08e384350 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift @@ -21,7 +21,7 @@ public func _bjs_asyncReturnVoid() -> Int32 { @_expose(wasm, "bjs_asyncRoundTripInt") @_cdecl("bjs_asyncRoundTripInt") -public func _bjs_asyncRoundTripInt(v: Int32) -> Int32 { +public func _bjs_asyncRoundTripInt(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripInt(_: Int.bridgeJSLiftParameter(v)).jsValue @@ -34,7 +34,7 @@ public func _bjs_asyncRoundTripInt(v: Int32) -> Int32 { @_expose(wasm, "bjs_asyncRoundTripString") @_cdecl("bjs_asyncRoundTripString") -public func _bjs_asyncRoundTripString(vBytes: Int32, vLength: Int32) -> Int32 { +public func _bjs_asyncRoundTripString(_ vBytes: Int32, _ vLength: Int32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripString(_: String.bridgeJSLiftParameter(vBytes, vLength)).jsValue @@ -47,7 +47,7 @@ public func _bjs_asyncRoundTripString(vBytes: Int32, vLength: Int32) -> Int32 { @_expose(wasm, "bjs_asyncRoundTripBool") @_cdecl("bjs_asyncRoundTripBool") -public func _bjs_asyncRoundTripBool(v: Int32) -> Int32 { +public func _bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripBool(_: Bool.bridgeJSLiftParameter(v)).jsValue @@ -60,7 +60,7 @@ public func _bjs_asyncRoundTripBool(v: Int32) -> Int32 { @_expose(wasm, "bjs_asyncRoundTripFloat") @_cdecl("bjs_asyncRoundTripFloat") -public func _bjs_asyncRoundTripFloat(v: Float32) -> Int32 { +public func _bjs_asyncRoundTripFloat(_ v: Float32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripFloat(_: Float.bridgeJSLiftParameter(v)).jsValue @@ -73,7 +73,7 @@ public func _bjs_asyncRoundTripFloat(v: Float32) -> Int32 { @_expose(wasm, "bjs_asyncRoundTripDouble") @_cdecl("bjs_asyncRoundTripDouble") -public func _bjs_asyncRoundTripDouble(v: Float64) -> Int32 { +public func _bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripDouble(_: Double.bridgeJSLiftParameter(v)).jsValue @@ -86,7 +86,7 @@ public func _bjs_asyncRoundTripDouble(v: Float64) -> Int32 { @_expose(wasm, "bjs_asyncRoundTripJSObject") @_cdecl("bjs_asyncRoundTripJSObject") -public func _bjs_asyncRoundTripJSObject(v: Int32) -> Int32 { +public func _bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripJSObject(_: JSObject.bridgeJSLiftParameter(v)).jsValue diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift index e50c67861..eef86b6d7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift @@ -8,7 +8,7 @@ @_expose(wasm, "bjs_standaloneFunction") @_cdecl("bjs_standaloneFunction") -public func _bjs_standaloneFunction(b: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_standaloneFunction(_ b: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = standaloneFunction(b: FunctionB.bridgeJSLiftParameter(b)) return ret.bridgeJSLowerReturn() @@ -30,7 +30,7 @@ public func _bjs_FunctionA_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_FunctionA_processB") @_cdecl("bjs_FunctionA_processB") -public func _bjs_FunctionA_processB(_self: UnsafeMutableRawPointer, b: UnsafeMutableRawPointer) -> Void { +public func _bjs_FunctionA_processB(_ _self: UnsafeMutableRawPointer, _ b: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = FunctionA.bridgeJSLiftParameter(_self).processB(b: FunctionB.bridgeJSLiftParameter(b)) return ret.bridgeJSLowerReturn() @@ -41,7 +41,7 @@ public func _bjs_FunctionA_processB(_self: UnsafeMutableRawPointer, b: UnsafeMut @_expose(wasm, "bjs_FunctionA_createB") @_cdecl("bjs_FunctionA_createB") -public func _bjs_FunctionA_createB(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_FunctionA_createB(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = FunctionA.bridgeJSLiftParameter(_self).createB(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) return ret.bridgeJSLowerReturn() @@ -52,8 +52,12 @@ public func _bjs_FunctionA_createB(_self: UnsafeMutableRawPointer, valueBytes: I @_expose(wasm, "bjs_FunctionA_deinit") @_cdecl("bjs_FunctionA_deinit") -public func _bjs_FunctionA_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_FunctionA_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension FunctionA: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -64,16 +68,16 @@ extension FunctionA: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_FunctionA_wrap") -fileprivate func _bjs_FunctionA_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_FunctionA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_FunctionA_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_FunctionA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_FunctionB_init") @_cdecl("bjs_FunctionB_init") -public func _bjs_FunctionB_init(valueBytes: Int32, valueLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_FunctionB_init(_ valueBytes: Int32, _ valueLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = FunctionB(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) return ret.bridgeJSLowerReturn() @@ -84,7 +88,7 @@ public func _bjs_FunctionB_init(valueBytes: Int32, valueLength: Int32) -> Unsafe @_expose(wasm, "bjs_FunctionB_value_get") @_cdecl("bjs_FunctionB_value_get") -public func _bjs_FunctionB_value_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_FunctionB_value_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = FunctionB.bridgeJSLiftParameter(_self).value return ret.bridgeJSLowerReturn() @@ -95,7 +99,7 @@ public func _bjs_FunctionB_value_get(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_FunctionB_value_set") @_cdecl("bjs_FunctionB_value_set") -public func _bjs_FunctionB_value_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_FunctionB_value_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) FunctionB.bridgeJSLiftParameter(_self).value = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -105,8 +109,12 @@ public func _bjs_FunctionB_value_set(_self: UnsafeMutableRawPointer, valueBytes: @_expose(wasm, "bjs_FunctionB_deinit") @_cdecl("bjs_FunctionB_deinit") -public func _bjs_FunctionB_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_FunctionB_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension FunctionB: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -117,9 +125,9 @@ extension FunctionB: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_FunctionB_wrap") -fileprivate func _bjs_FunctionB_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_FunctionB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_FunctionB_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_FunctionB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift index e8077c5c4..729520362 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift @@ -8,7 +8,7 @@ @_expose(wasm, "bjs_standaloneFunction") @_cdecl("bjs_standaloneFunction") -public func _bjs_standaloneFunction(b: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_standaloneFunction(_ b: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = standaloneFunction(b: FunctionB.bridgeJSLiftParameter(b)) return ret.bridgeJSLowerReturn() @@ -19,7 +19,7 @@ public func _bjs_standaloneFunction(b: UnsafeMutableRawPointer) -> UnsafeMutable @_expose(wasm, "bjs_FunctionB_init") @_cdecl("bjs_FunctionB_init") -public func _bjs_FunctionB_init(valueBytes: Int32, valueLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_FunctionB_init(_ valueBytes: Int32, _ valueLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = FunctionB(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) return ret.bridgeJSLowerReturn() @@ -30,7 +30,7 @@ public func _bjs_FunctionB_init(valueBytes: Int32, valueLength: Int32) -> Unsafe @_expose(wasm, "bjs_FunctionB_value_get") @_cdecl("bjs_FunctionB_value_get") -public func _bjs_FunctionB_value_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_FunctionB_value_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = FunctionB.bridgeJSLiftParameter(_self).value return ret.bridgeJSLowerReturn() @@ -41,7 +41,7 @@ public func _bjs_FunctionB_value_get(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_FunctionB_value_set") @_cdecl("bjs_FunctionB_value_set") -public func _bjs_FunctionB_value_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_FunctionB_value_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) FunctionB.bridgeJSLiftParameter(_self).value = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -51,8 +51,12 @@ public func _bjs_FunctionB_value_set(_self: UnsafeMutableRawPointer, valueBytes: @_expose(wasm, "bjs_FunctionB_deinit") @_cdecl("bjs_FunctionB_deinit") -public func _bjs_FunctionB_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_FunctionB_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension FunctionB: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -63,9 +67,9 @@ extension FunctionB: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_FunctionB_wrap") -fileprivate func _bjs_FunctionB_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_FunctionB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_FunctionB_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_FunctionB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -83,7 +87,7 @@ public func _bjs_FunctionA_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_FunctionA_processB") @_cdecl("bjs_FunctionA_processB") -public func _bjs_FunctionA_processB(_self: UnsafeMutableRawPointer, b: UnsafeMutableRawPointer) -> Void { +public func _bjs_FunctionA_processB(_ _self: UnsafeMutableRawPointer, _ b: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = FunctionA.bridgeJSLiftParameter(_self).processB(b: FunctionB.bridgeJSLiftParameter(b)) return ret.bridgeJSLowerReturn() @@ -94,7 +98,7 @@ public func _bjs_FunctionA_processB(_self: UnsafeMutableRawPointer, b: UnsafeMut @_expose(wasm, "bjs_FunctionA_createB") @_cdecl("bjs_FunctionA_createB") -public func _bjs_FunctionA_createB(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_FunctionA_createB(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = FunctionA.bridgeJSLiftParameter(_self).createB(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) return ret.bridgeJSLowerReturn() @@ -105,8 +109,12 @@ public func _bjs_FunctionA_createB(_self: UnsafeMutableRawPointer, valueBytes: I @_expose(wasm, "bjs_FunctionA_deinit") @_cdecl("bjs_FunctionA_deinit") -public func _bjs_FunctionA_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_FunctionA_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension FunctionA: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -117,9 +125,9 @@ extension FunctionA: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_FunctionA_wrap") -fileprivate func _bjs_FunctionA_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_FunctionA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_FunctionA_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_FunctionA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift index a270c0e9d..7504b289c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift @@ -8,7 +8,7 @@ @_expose(wasm, "bjs_ClassA_linkedB_get") @_cdecl("bjs_ClassA_linkedB_get") -public func _bjs_ClassA_linkedB_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ClassA_linkedB_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ClassA.bridgeJSLiftParameter(_self).linkedB return ret.bridgeJSLowerReturn() @@ -19,7 +19,7 @@ public func _bjs_ClassA_linkedB_get(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_ClassA_linkedB_set") @_cdecl("bjs_ClassA_linkedB_set") -public func _bjs_ClassA_linkedB_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: UnsafeMutableRawPointer) -> Void { +public func _bjs_ClassA_linkedB_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ClassA.bridgeJSLiftParameter(_self).linkedB = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) #else @@ -29,8 +29,12 @@ public func _bjs_ClassA_linkedB_set(_self: UnsafeMutableRawPointer, valueIsSome: @_expose(wasm, "bjs_ClassA_deinit") @_cdecl("bjs_ClassA_deinit") -public func _bjs_ClassA_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_ClassA_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension ClassA: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -41,9 +45,9 @@ extension ClassA: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_ClassA_wrap") -fileprivate func _bjs_ClassA_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ClassA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ClassA_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ClassA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -61,8 +65,12 @@ public func _bjs_ClassB_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_ClassB_deinit") @_cdecl("bjs_ClassB_deinit") -public func _bjs_ClassB_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_ClassB_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension ClassB: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -73,9 +81,9 @@ extension ClassB: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_ClassB_wrap") -fileprivate func _bjs_ClassB_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ClassB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ClassB_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ClassB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift index ed05f7c24..04130f749 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift @@ -19,8 +19,12 @@ public func _bjs_ClassB_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_ClassB_deinit") @_cdecl("bjs_ClassB_deinit") -public func _bjs_ClassB_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_ClassB_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension ClassB: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -31,16 +35,16 @@ extension ClassB: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_ClassB_wrap") -fileprivate func _bjs_ClassB_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ClassB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ClassB_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ClassB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_ClassA_linkedB_get") @_cdecl("bjs_ClassA_linkedB_get") -public func _bjs_ClassA_linkedB_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ClassA_linkedB_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ClassA.bridgeJSLiftParameter(_self).linkedB return ret.bridgeJSLowerReturn() @@ -51,7 +55,7 @@ public func _bjs_ClassA_linkedB_get(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_ClassA_linkedB_set") @_cdecl("bjs_ClassA_linkedB_set") -public func _bjs_ClassA_linkedB_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: UnsafeMutableRawPointer) -> Void { +public func _bjs_ClassA_linkedB_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ClassA.bridgeJSLiftParameter(_self).linkedB = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) #else @@ -61,8 +65,12 @@ public func _bjs_ClassA_linkedB_set(_self: UnsafeMutableRawPointer, valueIsSome: @_expose(wasm, "bjs_ClassA_deinit") @_cdecl("bjs_ClassA_deinit") -public func _bjs_ClassA_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_ClassA_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension ClassA: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -73,9 +81,9 @@ extension ClassA: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_ClassA_wrap") -fileprivate func _bjs_ClassA_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ClassA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ClassA_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ClassA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index 03d037e98..f624dc33c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -76,7 +76,7 @@ extension MathOperations: _BridgedSwiftStruct { @_expose(wasm, "bjs_MathOperations_init") @_cdecl("bjs_MathOperations_init") -public func _bjs_MathOperations_init(baseValue: Float64) -> Void { +public func _bjs_MathOperations_init(_ baseValue: Float64) -> Void { #if arch(wasm32) let ret = MathOperations(baseValue: Double.bridgeJSLiftParameter(baseValue)) return ret.bridgeJSLowerReturn() @@ -87,7 +87,7 @@ public func _bjs_MathOperations_init(baseValue: Float64) -> Void { @_expose(wasm, "bjs_MathOperations_add") @_cdecl("bjs_MathOperations_add") -public func _bjs_MathOperations_add(a: Float64, b: Float64) -> Float64 { +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() @@ -98,7 +98,7 @@ public func _bjs_MathOperations_add(a: Float64, b: Float64) -> Float64 { @_expose(wasm, "bjs_MathOperations_multiply") @_cdecl("bjs_MathOperations_multiply") -public func _bjs_MathOperations_multiply(a: Float64, b: Float64) -> Float64 { +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() @@ -109,7 +109,7 @@ public func _bjs_MathOperations_multiply(a: Float64, b: Float64) -> Float64 { @_expose(wasm, "bjs_MathOperations_static_subtract") @_cdecl("bjs_MathOperations_static_subtract") -public func _bjs_MathOperations_static_subtract(a: Float64, b: Float64) -> Float64 { +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() @@ -120,7 +120,7 @@ public func _bjs_MathOperations_static_subtract(a: Float64, b: Float64) -> Float @_expose(wasm, "bjs_testStringDefault") @_cdecl("bjs_testStringDefault") -public func _bjs_testStringDefault(messageBytes: Int32, messageLength: Int32) -> Void { +public func _bjs_testStringDefault(_ messageBytes: Int32, _ messageLength: Int32) -> Void { #if arch(wasm32) let ret = testStringDefault(message: String.bridgeJSLiftParameter(messageBytes, messageLength)) return ret.bridgeJSLowerReturn() @@ -131,7 +131,7 @@ public func _bjs_testStringDefault(messageBytes: Int32, messageLength: Int32) -> @_expose(wasm, "bjs_testNegativeIntDefault") @_cdecl("bjs_testNegativeIntDefault") -public func _bjs_testNegativeIntDefault(value: Int32) -> Int32 { +public func _bjs_testNegativeIntDefault(_ value: Int32) -> Int32 { #if arch(wasm32) let ret = testNegativeIntDefault(value: Int.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -142,7 +142,7 @@ public func _bjs_testNegativeIntDefault(value: Int32) -> Int32 { @_expose(wasm, "bjs_testBoolDefault") @_cdecl("bjs_testBoolDefault") -public func _bjs_testBoolDefault(flag: Int32) -> Int32 { +public func _bjs_testBoolDefault(_ flag: Int32) -> Int32 { #if arch(wasm32) let ret = testBoolDefault(flag: Bool.bridgeJSLiftParameter(flag)) return ret.bridgeJSLowerReturn() @@ -153,7 +153,7 @@ public func _bjs_testBoolDefault(flag: Int32) -> Int32 { @_expose(wasm, "bjs_testNegativeFloatDefault") @_cdecl("bjs_testNegativeFloatDefault") -public func _bjs_testNegativeFloatDefault(temp: Float32) -> Float32 { +public func _bjs_testNegativeFloatDefault(_ temp: Float32) -> Float32 { #if arch(wasm32) let ret = testNegativeFloatDefault(temp: Float.bridgeJSLiftParameter(temp)) return ret.bridgeJSLowerReturn() @@ -164,7 +164,7 @@ public func _bjs_testNegativeFloatDefault(temp: Float32) -> Float32 { @_expose(wasm, "bjs_testDoubleDefault") @_cdecl("bjs_testDoubleDefault") -public func _bjs_testDoubleDefault(precision: Float64) -> Float64 { +public func _bjs_testDoubleDefault(_ precision: Float64) -> Float64 { #if arch(wasm32) let ret = testDoubleDefault(precision: Double.bridgeJSLiftParameter(precision)) return ret.bridgeJSLowerReturn() @@ -175,7 +175,7 @@ public func _bjs_testDoubleDefault(precision: Float64) -> Float64 { @_expose(wasm, "bjs_testOptionalDefault") @_cdecl("bjs_testOptionalDefault") -public func _bjs_testOptionalDefault(nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> Void { +public func _bjs_testOptionalDefault(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) let ret = testOptionalDefault(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -186,7 +186,7 @@ public func _bjs_testOptionalDefault(nameIsSome: Int32, nameBytes: Int32, nameLe @_expose(wasm, "bjs_testOptionalStringDefault") @_cdecl("bjs_testOptionalStringDefault") -public func _bjs_testOptionalStringDefault(greetingIsSome: Int32, greetingBytes: Int32, greetingLength: Int32) -> Void { +public func _bjs_testOptionalStringDefault(_ greetingIsSome: Int32, _ greetingBytes: Int32, _ greetingLength: Int32) -> Void { #if arch(wasm32) let ret = testOptionalStringDefault(greeting: Optional.bridgeJSLiftParameter(greetingIsSome, greetingBytes, greetingLength)) return ret.bridgeJSLowerReturn() @@ -197,7 +197,7 @@ public func _bjs_testOptionalStringDefault(greetingIsSome: Int32, greetingBytes: @_expose(wasm, "bjs_testMultipleDefaults") @_cdecl("bjs_testMultipleDefaults") -public func _bjs_testMultipleDefaults(titleBytes: Int32, titleLength: Int32, count: Int32, enabled: Int32) -> Void { +public func _bjs_testMultipleDefaults(_ titleBytes: Int32, _ titleLength: Int32, _ count: Int32, _ enabled: Int32) -> Void { #if arch(wasm32) let ret = testMultipleDefaults(title: String.bridgeJSLiftParameter(titleBytes, titleLength), count: Int.bridgeJSLiftParameter(count), enabled: Bool.bridgeJSLiftParameter(enabled)) return ret.bridgeJSLowerReturn() @@ -208,7 +208,7 @@ public func _bjs_testMultipleDefaults(titleBytes: Int32, titleLength: Int32, cou @_expose(wasm, "bjs_testEnumDefault") @_cdecl("bjs_testEnumDefault") -public func _bjs_testEnumDefault(status: Int32) -> Int32 { +public func _bjs_testEnumDefault(_ status: Int32) -> Int32 { #if arch(wasm32) let ret = testEnumDefault(status: Status.bridgeJSLiftParameter(status)) return ret.bridgeJSLowerReturn() @@ -219,7 +219,7 @@ public func _bjs_testEnumDefault(status: Int32) -> Int32 { @_expose(wasm, "bjs_testComplexInit") @_cdecl("bjs_testComplexInit") -public func _bjs_testComplexInit(greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_testComplexInit(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = testComplexInit(greeter: DefaultGreeter.bridgeJSLiftParameter(greeter)) return ret.bridgeJSLowerReturn() @@ -230,7 +230,7 @@ public func _bjs_testComplexInit(greeter: UnsafeMutableRawPointer) -> UnsafeMuta @_expose(wasm, "bjs_testEmptyInit") @_cdecl("bjs_testEmptyInit") -public func _bjs_testEmptyInit(greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_testEmptyInit(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = testEmptyInit(greeter: EmptyGreeter.bridgeJSLiftParameter(greeter)) return ret.bridgeJSLowerReturn() @@ -241,7 +241,7 @@ public func _bjs_testEmptyInit(greeter: UnsafeMutableRawPointer) -> UnsafeMutabl @_expose(wasm, "bjs_testOptionalStructDefault") @_cdecl("bjs_testOptionalStructDefault") -public func _bjs_testOptionalStructDefault(point: Int32) -> Void { +public func _bjs_testOptionalStructDefault(_ point: Int32) -> Void { #if arch(wasm32) let ret = testOptionalStructDefault(point: Optional.bridgeJSLiftParameter(point)) return ret.bridgeJSLowerReturn() @@ -252,7 +252,7 @@ public func _bjs_testOptionalStructDefault(point: Int32) -> Void { @_expose(wasm, "bjs_testOptionalStructWithValueDefault") @_cdecl("bjs_testOptionalStructWithValueDefault") -public func _bjs_testOptionalStructWithValueDefault(point: Int32) -> Void { +public func _bjs_testOptionalStructWithValueDefault(_ point: Int32) -> Void { #if arch(wasm32) let ret = testOptionalStructWithValueDefault(point: Optional.bridgeJSLiftParameter(point)) return ret.bridgeJSLowerReturn() @@ -263,7 +263,7 @@ public func _bjs_testOptionalStructWithValueDefault(point: Int32) -> Void { @_expose(wasm, "bjs_DefaultGreeter_init") @_cdecl("bjs_DefaultGreeter_init") -public func _bjs_DefaultGreeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_DefaultGreeter_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = DefaultGreeter(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -274,7 +274,7 @@ public func _bjs_DefaultGreeter_init(nameBytes: Int32, nameLength: Int32) -> Uns @_expose(wasm, "bjs_DefaultGreeter_name_get") @_cdecl("bjs_DefaultGreeter_name_get") -public func _bjs_DefaultGreeter_name_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_DefaultGreeter_name_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = DefaultGreeter.bridgeJSLiftParameter(_self).name return ret.bridgeJSLowerReturn() @@ -285,7 +285,7 @@ public func _bjs_DefaultGreeter_name_get(_self: UnsafeMutableRawPointer) -> Void @_expose(wasm, "bjs_DefaultGreeter_name_set") @_cdecl("bjs_DefaultGreeter_name_set") -public func _bjs_DefaultGreeter_name_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_DefaultGreeter_name_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) DefaultGreeter.bridgeJSLiftParameter(_self).name = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -295,8 +295,12 @@ public func _bjs_DefaultGreeter_name_set(_self: UnsafeMutableRawPointer, valueBy @_expose(wasm, "bjs_DefaultGreeter_deinit") @_cdecl("bjs_DefaultGreeter_deinit") -public func _bjs_DefaultGreeter_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_DefaultGreeter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension DefaultGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -307,9 +311,9 @@ extension DefaultGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_DefaultGreeter_wrap") -fileprivate func _bjs_DefaultGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_DefaultGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_DefaultGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_DefaultGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -327,8 +331,12 @@ public func _bjs_EmptyGreeter_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_EmptyGreeter_deinit") @_cdecl("bjs_EmptyGreeter_deinit") -public func _bjs_EmptyGreeter_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_EmptyGreeter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension EmptyGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -339,16 +347,16 @@ extension EmptyGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_EmptyGreeter_wrap") -fileprivate func _bjs_EmptyGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_EmptyGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_EmptyGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_EmptyGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_ConstructorDefaults_init") @_cdecl("bjs_ConstructorDefaults_init") -public func _bjs_ConstructorDefaults_init(nameBytes: Int32, nameLength: Int32, count: Int32, enabled: Int32, status: Int32, tagIsSome: Int32, tagBytes: Int32, tagLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_ConstructorDefaults_init(_ nameBytes: Int32, _ nameLength: Int32, _ count: Int32, _ enabled: Int32, _ status: Int32, _ tagIsSome: Int32, _ tagBytes: Int32, _ tagLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = ConstructorDefaults(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() @@ -359,7 +367,7 @@ public func _bjs_ConstructorDefaults_init(nameBytes: Int32, nameLength: Int32, c @_expose(wasm, "bjs_ConstructorDefaults_name_get") @_cdecl("bjs_ConstructorDefaults_name_get") -public func _bjs_ConstructorDefaults_name_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ConstructorDefaults_name_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ConstructorDefaults.bridgeJSLiftParameter(_self).name return ret.bridgeJSLowerReturn() @@ -370,7 +378,7 @@ public func _bjs_ConstructorDefaults_name_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_ConstructorDefaults_name_set") @_cdecl("bjs_ConstructorDefaults_name_set") -public func _bjs_ConstructorDefaults_name_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_ConstructorDefaults_name_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) ConstructorDefaults.bridgeJSLiftParameter(_self).name = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -380,7 +388,7 @@ public func _bjs_ConstructorDefaults_name_set(_self: UnsafeMutableRawPointer, va @_expose(wasm, "bjs_ConstructorDefaults_count_get") @_cdecl("bjs_ConstructorDefaults_count_get") -public func _bjs_ConstructorDefaults_count_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_ConstructorDefaults_count_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = ConstructorDefaults.bridgeJSLiftParameter(_self).count return ret.bridgeJSLowerReturn() @@ -391,7 +399,7 @@ public func _bjs_ConstructorDefaults_count_get(_self: UnsafeMutableRawPointer) - @_expose(wasm, "bjs_ConstructorDefaults_count_set") @_cdecl("bjs_ConstructorDefaults_count_set") -public func _bjs_ConstructorDefaults_count_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_ConstructorDefaults_count_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) ConstructorDefaults.bridgeJSLiftParameter(_self).count = Int.bridgeJSLiftParameter(value) #else @@ -401,7 +409,7 @@ public func _bjs_ConstructorDefaults_count_set(_self: UnsafeMutableRawPointer, v @_expose(wasm, "bjs_ConstructorDefaults_enabled_get") @_cdecl("bjs_ConstructorDefaults_enabled_get") -public func _bjs_ConstructorDefaults_enabled_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_ConstructorDefaults_enabled_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = ConstructorDefaults.bridgeJSLiftParameter(_self).enabled return ret.bridgeJSLowerReturn() @@ -412,7 +420,7 @@ public func _bjs_ConstructorDefaults_enabled_get(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_ConstructorDefaults_enabled_set") @_cdecl("bjs_ConstructorDefaults_enabled_set") -public func _bjs_ConstructorDefaults_enabled_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_ConstructorDefaults_enabled_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) ConstructorDefaults.bridgeJSLiftParameter(_self).enabled = Bool.bridgeJSLiftParameter(value) #else @@ -422,7 +430,7 @@ public func _bjs_ConstructorDefaults_enabled_set(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_ConstructorDefaults_status_get") @_cdecl("bjs_ConstructorDefaults_status_get") -public func _bjs_ConstructorDefaults_status_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_ConstructorDefaults_status_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = ConstructorDefaults.bridgeJSLiftParameter(_self).status return ret.bridgeJSLowerReturn() @@ -433,7 +441,7 @@ public func _bjs_ConstructorDefaults_status_get(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_ConstructorDefaults_status_set") @_cdecl("bjs_ConstructorDefaults_status_set") -public func _bjs_ConstructorDefaults_status_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_ConstructorDefaults_status_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) ConstructorDefaults.bridgeJSLiftParameter(_self).status = Status.bridgeJSLiftParameter(value) #else @@ -443,7 +451,7 @@ public func _bjs_ConstructorDefaults_status_set(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_ConstructorDefaults_tag_get") @_cdecl("bjs_ConstructorDefaults_tag_get") -public func _bjs_ConstructorDefaults_tag_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ConstructorDefaults_tag_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ConstructorDefaults.bridgeJSLiftParameter(_self).tag return ret.bridgeJSLowerReturn() @@ -454,7 +462,7 @@ public func _bjs_ConstructorDefaults_tag_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_ConstructorDefaults_tag_set") @_cdecl("bjs_ConstructorDefaults_tag_set") -public func _bjs_ConstructorDefaults_tag_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_ConstructorDefaults_tag_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) ConstructorDefaults.bridgeJSLiftParameter(_self).tag = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) #else @@ -464,8 +472,12 @@ public func _bjs_ConstructorDefaults_tag_set(_self: UnsafeMutableRawPointer, val @_expose(wasm, "bjs_ConstructorDefaults_deinit") @_cdecl("bjs_ConstructorDefaults_deinit") -public func _bjs_ConstructorDefaults_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_ConstructorDefaults_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension ConstructorDefaults: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -476,9 +488,9 @@ extension ConstructorDefaults: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_ConstructorDefaults_wrap") -fileprivate func _bjs_ConstructorDefaults_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ConstructorDefaults_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ConstructorDefaults_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ConstructorDefaults_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift index bcc95ef4c..1a1bc9baf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift @@ -491,7 +491,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { @_expose(wasm, "bjs_handle") @_cdecl("bjs_handle") -public func _bjs_handle(result: Int32) -> Void { +public func _bjs_handle(_ result: Int32) -> Void { #if arch(wasm32) handle(result: APIResult.bridgeJSLiftParameter(result)) #else @@ -512,7 +512,7 @@ public func _bjs_getResult() -> Void { @_expose(wasm, "bjs_roundtripAPIResult") @_cdecl("bjs_roundtripAPIResult") -public func _bjs_roundtripAPIResult(result: Int32) -> Void { +public func _bjs_roundtripAPIResult(_ result: Int32) -> Void { #if arch(wasm32) let ret = roundtripAPIResult(result: APIResult.bridgeJSLiftParameter(result)) return ret.bridgeJSLowerReturn() @@ -523,7 +523,7 @@ public func _bjs_roundtripAPIResult(result: Int32) -> Void { @_expose(wasm, "bjs_roundTripOptionalAPIResult") @_cdecl("bjs_roundTripOptionalAPIResult") -public func _bjs_roundTripOptionalAPIResult(resultIsSome: Int32, resultCaseId: Int32) -> Void { +public func _bjs_roundTripOptionalAPIResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalAPIResult(result: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) return ret.bridgeJSLowerReturn() @@ -534,7 +534,7 @@ public func _bjs_roundTripOptionalAPIResult(resultIsSome: Int32, resultCaseId: I @_expose(wasm, "bjs_handleComplex") @_cdecl("bjs_handleComplex") -public func _bjs_handleComplex(result: Int32) -> Void { +public func _bjs_handleComplex(_ result: Int32) -> Void { #if arch(wasm32) handleComplex(result: ComplexResult.bridgeJSLiftParameter(result)) #else @@ -555,7 +555,7 @@ public func _bjs_getComplexResult() -> Void { @_expose(wasm, "bjs_roundtripComplexResult") @_cdecl("bjs_roundtripComplexResult") -public func _bjs_roundtripComplexResult(result: Int32) -> Void { +public func _bjs_roundtripComplexResult(_ result: Int32) -> Void { #if arch(wasm32) let ret = roundtripComplexResult(_: ComplexResult.bridgeJSLiftParameter(result)) return ret.bridgeJSLowerReturn() @@ -566,7 +566,7 @@ public func _bjs_roundtripComplexResult(result: Int32) -> Void { @_expose(wasm, "bjs_roundTripOptionalComplexResult") @_cdecl("bjs_roundTripOptionalComplexResult") -public func _bjs_roundTripOptionalComplexResult(resultIsSome: Int32, resultCaseId: Int32) -> Void { +public func _bjs_roundTripOptionalComplexResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalComplexResult(result: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) return ret.bridgeJSLowerReturn() @@ -577,7 +577,7 @@ public func _bjs_roundTripOptionalComplexResult(resultIsSome: Int32, resultCaseI @_expose(wasm, "bjs_roundTripOptionalUtilitiesResult") @_cdecl("bjs_roundTripOptionalUtilitiesResult") -public func _bjs_roundTripOptionalUtilitiesResult(resultIsSome: Int32, resultCaseId: Int32) -> Void { +public func _bjs_roundTripOptionalUtilitiesResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalUtilitiesResult(result: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) return ret.bridgeJSLowerReturn() @@ -588,7 +588,7 @@ public func _bjs_roundTripOptionalUtilitiesResult(resultIsSome: Int32, resultCas @_expose(wasm, "bjs_roundTripOptionalNetworkingResult") @_cdecl("bjs_roundTripOptionalNetworkingResult") -public func _bjs_roundTripOptionalNetworkingResult(resultIsSome: Int32, resultCaseId: Int32) -> Void { +public func _bjs_roundTripOptionalNetworkingResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalNetworkingResult(result: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) return ret.bridgeJSLowerReturn() @@ -599,7 +599,7 @@ public func _bjs_roundTripOptionalNetworkingResult(resultIsSome: Int32, resultCa @_expose(wasm, "bjs_roundTripOptionalAPIOptionalResult") @_cdecl("bjs_roundTripOptionalAPIOptionalResult") -public func _bjs_roundTripOptionalAPIOptionalResult(resultIsSome: Int32, resultCaseId: Int32) -> Void { +public func _bjs_roundTripOptionalAPIOptionalResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalAPIOptionalResult(result: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) return ret.bridgeJSLowerReturn() @@ -610,7 +610,7 @@ public func _bjs_roundTripOptionalAPIOptionalResult(resultIsSome: Int32, resultC @_expose(wasm, "bjs_compareAPIResults") @_cdecl("bjs_compareAPIResults") -public func _bjs_compareAPIResults(result1IsSome: Int32, result1CaseId: Int32, result2IsSome: Int32, result2CaseId: Int32) -> Void { +public func _bjs_compareAPIResults(_ result1IsSome: Int32, _ result1CaseId: Int32, _ result2IsSome: Int32, _ result2CaseId: Int32) -> Void { #if arch(wasm32) let _tmp_result2 = Optional.bridgeJSLiftParameter(result2IsSome, result2CaseId) let _tmp_result1 = Optional.bridgeJSLiftParameter(result1IsSome, result1CaseId) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift index 06bfa86af..a513a22ab 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift @@ -164,7 +164,7 @@ extension PublicStatus: _BridgedSwiftCaseEnum { @_expose(wasm, "bjs_setDirection") @_cdecl("bjs_setDirection") -public func _bjs_setDirection(direction: Int32) -> Void { +public func _bjs_setDirection(_ direction: Int32) -> Void { #if arch(wasm32) setDirection(_: Direction.bridgeJSLiftParameter(direction)) #else @@ -185,7 +185,7 @@ public func _bjs_getDirection() -> Int32 { @_expose(wasm, "bjs_processDirection") @_cdecl("bjs_processDirection") -public func _bjs_processDirection(input: Int32) -> Int32 { +public func _bjs_processDirection(_ input: Int32) -> Int32 { #if arch(wasm32) let ret = processDirection(_: Direction.bridgeJSLiftParameter(input)) return ret.bridgeJSLowerReturn() @@ -196,7 +196,7 @@ public func _bjs_processDirection(input: Int32) -> Int32 { @_expose(wasm, "bjs_roundTripOptionalDirection") @_cdecl("bjs_roundTripOptionalDirection") -public func _bjs_roundTripOptionalDirection(inputIsSome: Int32, inputValue: Int32) -> Void { +public func _bjs_roundTripOptionalDirection(_ inputIsSome: Int32, _ inputValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalDirection(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() @@ -207,7 +207,7 @@ public func _bjs_roundTripOptionalDirection(inputIsSome: Int32, inputValue: Int3 @_expose(wasm, "bjs_setTSDirection") @_cdecl("bjs_setTSDirection") -public func _bjs_setTSDirection(direction: Int32) -> Void { +public func _bjs_setTSDirection(_ direction: Int32) -> Void { #if arch(wasm32) setTSDirection(_: TSDirection.bridgeJSLiftParameter(direction)) #else @@ -228,7 +228,7 @@ public func _bjs_getTSDirection() -> Int32 { @_expose(wasm, "bjs_roundTripOptionalTSDirection") @_cdecl("bjs_roundTripOptionalTSDirection") -public func _bjs_roundTripOptionalTSDirection(inputIsSome: Int32, inputValue: Int32) -> Void { +public func _bjs_roundTripOptionalTSDirection(_ inputIsSome: Int32, _ inputValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalTSDirection(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift index cf4977501..66f8e22a6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift @@ -103,7 +103,7 @@ public func _bjs_Converter_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_Converter_toString") @_cdecl("bjs_Converter_toString") -public func _bjs_Converter_toString(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_Converter_toString(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) let ret = Utils.Converter.bridgeJSLiftParameter(_self).toString(value: Int.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -114,8 +114,12 @@ public func _bjs_Converter_toString(_self: UnsafeMutableRawPointer, value: Int32 @_expose(wasm, "bjs_Converter_deinit") @_cdecl("bjs_Converter_deinit") -public func _bjs_Converter_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_Converter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -126,9 +130,9 @@ extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") -fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -146,7 +150,7 @@ public func _bjs_HTTPServer_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_HTTPServer_call") @_cdecl("bjs_HTTPServer_call") -public func _bjs_HTTPServer_call(_self: UnsafeMutableRawPointer, method: Int32) -> Void { +public func _bjs_HTTPServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { #if arch(wasm32) Networking.API.HTTPServer.bridgeJSLiftParameter(_self).call(_: Networking.API.Method.bridgeJSLiftParameter(method)) #else @@ -156,8 +160,12 @@ public func _bjs_HTTPServer_call(_self: UnsafeMutableRawPointer, method: Int32) @_expose(wasm, "bjs_HTTPServer_deinit") @_cdecl("bjs_HTTPServer_deinit") -public func _bjs_HTTPServer_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_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 { @@ -168,9 +176,9 @@ extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObje #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_HTTPServer_wrap") -fileprivate func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -188,7 +196,7 @@ public func _bjs_TestServer_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_TestServer_call") @_cdecl("bjs_TestServer_call") -public func _bjs_TestServer_call(_self: UnsafeMutableRawPointer, method: Int32) -> Void { +public func _bjs_TestServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { #if arch(wasm32) Internal.TestServer.bridgeJSLiftParameter(_self).call(_: Internal.SupportedMethod.bridgeJSLiftParameter(method)) #else @@ -198,8 +206,12 @@ public func _bjs_TestServer_call(_self: UnsafeMutableRawPointer, method: Int32) @_expose(wasm, "bjs_TestServer_deinit") @_cdecl("bjs_TestServer_deinit") -public func _bjs_TestServer_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_TestServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -210,9 +222,9 @@ extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_TestServer_wrap") -fileprivate func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift index cf4977501..66f8e22a6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift @@ -103,7 +103,7 @@ public func _bjs_Converter_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_Converter_toString") @_cdecl("bjs_Converter_toString") -public func _bjs_Converter_toString(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_Converter_toString(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) let ret = Utils.Converter.bridgeJSLiftParameter(_self).toString(value: Int.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -114,8 +114,12 @@ public func _bjs_Converter_toString(_self: UnsafeMutableRawPointer, value: Int32 @_expose(wasm, "bjs_Converter_deinit") @_cdecl("bjs_Converter_deinit") -public func _bjs_Converter_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_Converter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -126,9 +130,9 @@ extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") -fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -146,7 +150,7 @@ public func _bjs_HTTPServer_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_HTTPServer_call") @_cdecl("bjs_HTTPServer_call") -public func _bjs_HTTPServer_call(_self: UnsafeMutableRawPointer, method: Int32) -> Void { +public func _bjs_HTTPServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { #if arch(wasm32) Networking.API.HTTPServer.bridgeJSLiftParameter(_self).call(_: Networking.API.Method.bridgeJSLiftParameter(method)) #else @@ -156,8 +160,12 @@ public func _bjs_HTTPServer_call(_self: UnsafeMutableRawPointer, method: Int32) @_expose(wasm, "bjs_HTTPServer_deinit") @_cdecl("bjs_HTTPServer_deinit") -public func _bjs_HTTPServer_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_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 { @@ -168,9 +176,9 @@ extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObje #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_HTTPServer_wrap") -fileprivate func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -188,7 +196,7 @@ public func _bjs_TestServer_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_TestServer_call") @_cdecl("bjs_TestServer_call") -public func _bjs_TestServer_call(_self: UnsafeMutableRawPointer, method: Int32) -> Void { +public func _bjs_TestServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { #if arch(wasm32) Internal.TestServer.bridgeJSLiftParameter(_self).call(_: Internal.SupportedMethod.bridgeJSLiftParameter(method)) #else @@ -198,8 +206,12 @@ public func _bjs_TestServer_call(_self: UnsafeMutableRawPointer, method: Int32) @_expose(wasm, "bjs_TestServer_deinit") @_cdecl("bjs_TestServer_deinit") -public func _bjs_TestServer_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_TestServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -210,9 +222,9 @@ extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_TestServer_wrap") -fileprivate func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift index 9e03a6659..5d88fce46 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift @@ -44,7 +44,7 @@ extension Ratio: _BridgedSwiftEnumNoPayload { @_expose(wasm, "bjs_setTheme") @_cdecl("bjs_setTheme") -public func _bjs_setTheme(themeBytes: Int32, themeLength: Int32) -> Void { +public func _bjs_setTheme(_ themeBytes: Int32, _ themeLength: Int32) -> Void { #if arch(wasm32) setTheme(_: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) #else @@ -65,7 +65,7 @@ public func _bjs_getTheme() -> Void { @_expose(wasm, "bjs_roundTripOptionalTheme") @_cdecl("bjs_roundTripOptionalTheme") -public func _bjs_roundTripOptionalTheme(inputIsSome: Int32, inputBytes: Int32, inputLength: Int32) -> Void { +public func _bjs_roundTripOptionalTheme(_ inputIsSome: Int32, _ inputBytes: Int32, _ inputLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalTheme(_: Optional.bridgeJSLiftParameter(inputIsSome, inputBytes, inputLength)) return ret.bridgeJSLowerReturn() @@ -76,7 +76,7 @@ public func _bjs_roundTripOptionalTheme(inputIsSome: Int32, inputBytes: Int32, i @_expose(wasm, "bjs_setTSTheme") @_cdecl("bjs_setTSTheme") -public func _bjs_setTSTheme(themeBytes: Int32, themeLength: Int32) -> Void { +public func _bjs_setTSTheme(_ themeBytes: Int32, _ themeLength: Int32) -> Void { #if arch(wasm32) setTSTheme(_: TSTheme.bridgeJSLiftParameter(themeBytes, themeLength)) #else @@ -97,7 +97,7 @@ public func _bjs_getTSTheme() -> Void { @_expose(wasm, "bjs_roundTripOptionalTSTheme") @_cdecl("bjs_roundTripOptionalTSTheme") -public func _bjs_roundTripOptionalTSTheme(inputIsSome: Int32, inputBytes: Int32, inputLength: Int32) -> Void { +public func _bjs_roundTripOptionalTSTheme(_ inputIsSome: Int32, _ inputBytes: Int32, _ inputLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalTSTheme(_: Optional.bridgeJSLiftParameter(inputIsSome, inputBytes, inputLength)) return ret.bridgeJSLowerReturn() @@ -108,7 +108,7 @@ public func _bjs_roundTripOptionalTSTheme(inputIsSome: Int32, inputBytes: Int32, @_expose(wasm, "bjs_setFeatureFlag") @_cdecl("bjs_setFeatureFlag") -public func _bjs_setFeatureFlag(flag: Int32) -> Void { +public func _bjs_setFeatureFlag(_ flag: Int32) -> Void { #if arch(wasm32) setFeatureFlag(_: FeatureFlag.bridgeJSLiftParameter(flag)) #else @@ -129,7 +129,7 @@ public func _bjs_getFeatureFlag() -> Int32 { @_expose(wasm, "bjs_roundTripOptionalFeatureFlag") @_cdecl("bjs_roundTripOptionalFeatureFlag") -public func _bjs_roundTripOptionalFeatureFlag(inputIsSome: Int32, inputValue: Int32) -> Void { +public func _bjs_roundTripOptionalFeatureFlag(_ inputIsSome: Int32, _ inputValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalFeatureFlag(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() @@ -140,7 +140,7 @@ public func _bjs_roundTripOptionalFeatureFlag(inputIsSome: Int32, inputValue: In @_expose(wasm, "bjs_setHttpStatus") @_cdecl("bjs_setHttpStatus") -public func _bjs_setHttpStatus(status: Int32) -> Void { +public func _bjs_setHttpStatus(_ status: Int32) -> Void { #if arch(wasm32) setHttpStatus(_: HttpStatus.bridgeJSLiftParameter(status)) #else @@ -161,7 +161,7 @@ public func _bjs_getHttpStatus() -> Int32 { @_expose(wasm, "bjs_roundTripOptionalHttpStatus") @_cdecl("bjs_roundTripOptionalHttpStatus") -public func _bjs_roundTripOptionalHttpStatus(inputIsSome: Int32, inputValue: Int32) -> Void { +public func _bjs_roundTripOptionalHttpStatus(_ inputIsSome: Int32, _ inputValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalHttpStatus(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() @@ -172,7 +172,7 @@ public func _bjs_roundTripOptionalHttpStatus(inputIsSome: Int32, inputValue: Int @_expose(wasm, "bjs_setTSHttpStatus") @_cdecl("bjs_setTSHttpStatus") -public func _bjs_setTSHttpStatus(status: Int32) -> Void { +public func _bjs_setTSHttpStatus(_ status: Int32) -> Void { #if arch(wasm32) setTSHttpStatus(_: TSHttpStatus.bridgeJSLiftParameter(status)) #else @@ -193,7 +193,7 @@ public func _bjs_getTSHttpStatus() -> Int32 { @_expose(wasm, "bjs_roundTripOptionalHttpStatus") @_cdecl("bjs_roundTripOptionalHttpStatus") -public func _bjs_roundTripOptionalHttpStatus(inputIsSome: Int32, inputValue: Int32) -> Void { +public func _bjs_roundTripOptionalHttpStatus(_ inputIsSome: Int32, _ inputValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalHttpStatus(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() @@ -204,7 +204,7 @@ public func _bjs_roundTripOptionalHttpStatus(inputIsSome: Int32, inputValue: Int @_expose(wasm, "bjs_setPriority") @_cdecl("bjs_setPriority") -public func _bjs_setPriority(priority: Int32) -> Void { +public func _bjs_setPriority(_ priority: Int32) -> Void { #if arch(wasm32) setPriority(_: Priority.bridgeJSLiftParameter(priority)) #else @@ -225,7 +225,7 @@ public func _bjs_getPriority() -> Int32 { @_expose(wasm, "bjs_roundTripOptionalPriority") @_cdecl("bjs_roundTripOptionalPriority") -public func _bjs_roundTripOptionalPriority(inputIsSome: Int32, inputValue: Int32) -> Void { +public func _bjs_roundTripOptionalPriority(_ inputIsSome: Int32, _ inputValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalPriority(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() @@ -236,7 +236,7 @@ public func _bjs_roundTripOptionalPriority(inputIsSome: Int32, inputValue: Int32 @_expose(wasm, "bjs_setFileSize") @_cdecl("bjs_setFileSize") -public func _bjs_setFileSize(size: Int32) -> Void { +public func _bjs_setFileSize(_ size: Int32) -> Void { #if arch(wasm32) setFileSize(_: FileSize.bridgeJSLiftParameter(size)) #else @@ -257,7 +257,7 @@ public func _bjs_getFileSize() -> Int32 { @_expose(wasm, "bjs_roundTripOptionalFileSize") @_cdecl("bjs_roundTripOptionalFileSize") -public func _bjs_roundTripOptionalFileSize(inputIsSome: Int32, inputValue: Int32) -> Void { +public func _bjs_roundTripOptionalFileSize(_ inputIsSome: Int32, _ inputValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalFileSize(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() @@ -268,7 +268,7 @@ public func _bjs_roundTripOptionalFileSize(inputIsSome: Int32, inputValue: Int32 @_expose(wasm, "bjs_setUserId") @_cdecl("bjs_setUserId") -public func _bjs_setUserId(id: Int32) -> Void { +public func _bjs_setUserId(_ id: Int32) -> Void { #if arch(wasm32) setUserId(_: UserId.bridgeJSLiftParameter(id)) #else @@ -289,7 +289,7 @@ public func _bjs_getUserId() -> Int32 { @_expose(wasm, "bjs_roundTripOptionalUserId") @_cdecl("bjs_roundTripOptionalUserId") -public func _bjs_roundTripOptionalUserId(inputIsSome: Int32, inputValue: Int32) -> Void { +public func _bjs_roundTripOptionalUserId(_ inputIsSome: Int32, _ inputValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalUserId(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() @@ -300,7 +300,7 @@ public func _bjs_roundTripOptionalUserId(inputIsSome: Int32, inputValue: Int32) @_expose(wasm, "bjs_setTokenId") @_cdecl("bjs_setTokenId") -public func _bjs_setTokenId(token: Int32) -> Void { +public func _bjs_setTokenId(_ token: Int32) -> Void { #if arch(wasm32) setTokenId(_: TokenId.bridgeJSLiftParameter(token)) #else @@ -321,7 +321,7 @@ public func _bjs_getTokenId() -> Int32 { @_expose(wasm, "bjs_roundTripOptionalTokenId") @_cdecl("bjs_roundTripOptionalTokenId") -public func _bjs_roundTripOptionalTokenId(inputIsSome: Int32, inputValue: Int32) -> Void { +public func _bjs_roundTripOptionalTokenId(_ inputIsSome: Int32, _ inputValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalTokenId(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() @@ -332,7 +332,7 @@ public func _bjs_roundTripOptionalTokenId(inputIsSome: Int32, inputValue: Int32) @_expose(wasm, "bjs_setSessionId") @_cdecl("bjs_setSessionId") -public func _bjs_setSessionId(session: Int32) -> Void { +public func _bjs_setSessionId(_ session: Int32) -> Void { #if arch(wasm32) setSessionId(_: SessionId.bridgeJSLiftParameter(session)) #else @@ -353,7 +353,7 @@ public func _bjs_getSessionId() -> Int32 { @_expose(wasm, "bjs_roundTripOptionalSessionId") @_cdecl("bjs_roundTripOptionalSessionId") -public func _bjs_roundTripOptionalSessionId(inputIsSome: Int32, inputValue: Int32) -> Void { +public func _bjs_roundTripOptionalSessionId(_ inputIsSome: Int32, _ inputValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalSessionId(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() @@ -364,7 +364,7 @@ public func _bjs_roundTripOptionalSessionId(inputIsSome: Int32, inputValue: Int3 @_expose(wasm, "bjs_setPrecision") @_cdecl("bjs_setPrecision") -public func _bjs_setPrecision(precision: Float32) -> Void { +public func _bjs_setPrecision(_ precision: Float32) -> Void { #if arch(wasm32) setPrecision(_: Precision.bridgeJSLiftParameter(precision)) #else @@ -385,7 +385,7 @@ public func _bjs_getPrecision() -> Float32 { @_expose(wasm, "bjs_roundTripOptionalPrecision") @_cdecl("bjs_roundTripOptionalPrecision") -public func _bjs_roundTripOptionalPrecision(inputIsSome: Int32, inputValue: Float32) -> Void { +public func _bjs_roundTripOptionalPrecision(_ inputIsSome: Int32, _ inputValue: Float32) -> Void { #if arch(wasm32) let ret = roundTripOptionalPrecision(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() @@ -396,7 +396,7 @@ public func _bjs_roundTripOptionalPrecision(inputIsSome: Int32, inputValue: Floa @_expose(wasm, "bjs_setRatio") @_cdecl("bjs_setRatio") -public func _bjs_setRatio(ratio: Float64) -> Void { +public func _bjs_setRatio(_ ratio: Float64) -> Void { #if arch(wasm32) setRatio(_: Ratio.bridgeJSLiftParameter(ratio)) #else @@ -417,7 +417,7 @@ public func _bjs_getRatio() -> Float64 { @_expose(wasm, "bjs_roundTripOptionalRatio") @_cdecl("bjs_roundTripOptionalRatio") -public func _bjs_roundTripOptionalRatio(inputIsSome: Int32, inputValue: Float64) -> Void { +public func _bjs_roundTripOptionalRatio(_ inputIsSome: Int32, _ inputValue: Float64) -> Void { #if arch(wasm32) let ret = roundTripOptionalRatio(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) return ret.bridgeJSLowerReturn() @@ -428,7 +428,7 @@ public func _bjs_roundTripOptionalRatio(inputIsSome: Int32, inputValue: Float64) @_expose(wasm, "bjs_processTheme") @_cdecl("bjs_processTheme") -public func _bjs_processTheme(themeBytes: Int32, themeLength: Int32) -> Int32 { +public func _bjs_processTheme(_ themeBytes: Int32, _ themeLength: Int32) -> Int32 { #if arch(wasm32) let ret = processTheme(_: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) return ret.bridgeJSLowerReturn() @@ -439,7 +439,7 @@ public func _bjs_processTheme(themeBytes: Int32, themeLength: Int32) -> Int32 { @_expose(wasm, "bjs_convertPriority") @_cdecl("bjs_convertPriority") -public func _bjs_convertPriority(status: Int32) -> Int32 { +public func _bjs_convertPriority(_ status: Int32) -> Int32 { #if arch(wasm32) let ret = convertPriority(_: HttpStatus.bridgeJSLiftParameter(status)) return ret.bridgeJSLowerReturn() @@ -450,7 +450,7 @@ public func _bjs_convertPriority(status: Int32) -> Int32 { @_expose(wasm, "bjs_validateSession") @_cdecl("bjs_validateSession") -public func _bjs_validateSession(session: Int32) -> Void { +public func _bjs_validateSession(_ session: Int32) -> Void { #if arch(wasm32) let ret = validateSession(_: SessionId.bridgeJSLiftParameter(session)) return ret.bridgeJSLowerReturn() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift index 774bf075c..3e38fee4b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift @@ -30,7 +30,7 @@ public func _bjs_GlobalClass_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_GlobalClass_greet") @_cdecl("bjs_GlobalClass_greet") -public func _bjs_GlobalClass_greet(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_GlobalClass_greet(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = GlobalClass.bridgeJSLiftParameter(_self).greet() return ret.bridgeJSLowerReturn() @@ -41,8 +41,12 @@ public func _bjs_GlobalClass_greet(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_GlobalClass_deinit") @_cdecl("bjs_GlobalClass_deinit") -public func _bjs_GlobalClass_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_GlobalClass_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension GlobalClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -53,9 +57,9 @@ extension GlobalClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_GlobalClass_wrap") -fileprivate func _bjs_GlobalClass_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_GlobalClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_GlobalClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_GlobalClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift index 10c62bb03..76a1a6c2a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift @@ -30,7 +30,7 @@ public func _bjs_PrivateClass_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_PrivateClass_greet") @_cdecl("bjs_PrivateClass_greet") -public func _bjs_PrivateClass_greet(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PrivateClass_greet(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PrivateClass.bridgeJSLiftParameter(_self).greet() return ret.bridgeJSLowerReturn() @@ -41,8 +41,12 @@ public func _bjs_PrivateClass_greet(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_PrivateClass_deinit") @_cdecl("bjs_PrivateClass_deinit") -public func _bjs_PrivateClass_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_PrivateClass_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension PrivateClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -53,9 +57,9 @@ extension PrivateClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_PrivateClass_wrap") -fileprivate func _bjs_PrivateClass_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PrivateClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PrivateClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PrivateClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift index 3e7714464..19fe8ea9f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift @@ -30,7 +30,7 @@ public func _bjs_MyModule_Utils_namespacedFunction() -> Void { @_expose(wasm, "bjs_Greeter_init") @_cdecl("bjs_Greeter_init") -public func _bjs_Greeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_Greeter_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Greeter(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -41,7 +41,7 @@ public func _bjs_Greeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMuta @_expose(wasm, "bjs_Greeter_greet") @_cdecl("bjs_Greeter_greet") -public func _bjs_Greeter_greet(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Greeter_greet(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).greet() return ret.bridgeJSLowerReturn() @@ -52,8 +52,12 @@ public func _bjs_Greeter_greet(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Greeter_deinit") @_cdecl("bjs_Greeter_deinit") -public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -64,9 +68,9 @@ extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") -fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -84,7 +88,7 @@ public func _bjs_Converter_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_Converter_toString") @_cdecl("bjs_Converter_toString") -public func _bjs_Converter_toString(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_Converter_toString(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) let ret = Converter.bridgeJSLiftParameter(_self).toString(value: Int.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -95,8 +99,12 @@ public func _bjs_Converter_toString(_self: UnsafeMutableRawPointer, value: Int32 @_expose(wasm, "bjs_Converter_deinit") @_cdecl("bjs_Converter_deinit") -public func _bjs_Converter_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_Converter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -107,16 +115,16 @@ extension Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") -fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_UUID_uuidString") @_cdecl("bjs_UUID_uuidString") -public func _bjs_UUID_uuidString(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_UUID_uuidString(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = UUID.bridgeJSLiftParameter(_self).uuidString() return ret.bridgeJSLowerReturn() @@ -127,8 +135,12 @@ public func _bjs_UUID_uuidString(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_UUID_deinit") @_cdecl("bjs_UUID_deinit") -public func _bjs_UUID_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_UUID_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension UUID: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -139,9 +151,9 @@ extension UUID: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_UUID_wrap") -fileprivate func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_UUID_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_UUID_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift index 3e7714464..19fe8ea9f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift @@ -30,7 +30,7 @@ public func _bjs_MyModule_Utils_namespacedFunction() -> Void { @_expose(wasm, "bjs_Greeter_init") @_cdecl("bjs_Greeter_init") -public func _bjs_Greeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_Greeter_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Greeter(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -41,7 +41,7 @@ public func _bjs_Greeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMuta @_expose(wasm, "bjs_Greeter_greet") @_cdecl("bjs_Greeter_greet") -public func _bjs_Greeter_greet(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Greeter_greet(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).greet() return ret.bridgeJSLowerReturn() @@ -52,8 +52,12 @@ public func _bjs_Greeter_greet(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Greeter_deinit") @_cdecl("bjs_Greeter_deinit") -public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -64,9 +68,9 @@ extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") -fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -84,7 +88,7 @@ public func _bjs_Converter_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_Converter_toString") @_cdecl("bjs_Converter_toString") -public func _bjs_Converter_toString(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_Converter_toString(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) let ret = Converter.bridgeJSLiftParameter(_self).toString(value: Int.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -95,8 +99,12 @@ public func _bjs_Converter_toString(_self: UnsafeMutableRawPointer, value: Int32 @_expose(wasm, "bjs_Converter_deinit") @_cdecl("bjs_Converter_deinit") -public func _bjs_Converter_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_Converter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -107,16 +115,16 @@ extension Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") -fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_UUID_uuidString") @_cdecl("bjs_UUID_uuidString") -public func _bjs_UUID_uuidString(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_UUID_uuidString(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = UUID.bridgeJSLiftParameter(_self).uuidString() return ret.bridgeJSLowerReturn() @@ -127,8 +135,12 @@ public func _bjs_UUID_uuidString(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_UUID_deinit") @_cdecl("bjs_UUID_deinit") -public func _bjs_UUID_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_UUID_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension UUID: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -139,9 +151,9 @@ extension UUID: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_UUID_wrap") -fileprivate func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_UUID_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_UUID_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_UUID_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift index 0834943eb..f2f19f9af 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift @@ -8,7 +8,7 @@ @_expose(wasm, "bjs_roundTripOptionalClass") @_cdecl("bjs_roundTripOptionalClass") -public func _bjs_roundTripOptionalClass(valueIsSome: Int32, valueValue: UnsafeMutableRawPointer) -> Void { +public func _bjs_roundTripOptionalClass(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = roundTripOptionalClass(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) return ret.bridgeJSLowerReturn() @@ -19,7 +19,7 @@ public func _bjs_roundTripOptionalClass(valueIsSome: Int32, valueValue: UnsafeMu @_expose(wasm, "bjs_testOptionalPropertyRoundtrip") @_cdecl("bjs_testOptionalPropertyRoundtrip") -public func _bjs_testOptionalPropertyRoundtrip(holderIsSome: Int32, holderValue: UnsafeMutableRawPointer) -> Void { +public func _bjs_testOptionalPropertyRoundtrip(_ holderIsSome: Int32, _ holderValue: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = testOptionalPropertyRoundtrip(_: Optional.bridgeJSLiftParameter(holderIsSome, holderValue)) return ret.bridgeJSLowerReturn() @@ -30,7 +30,7 @@ public func _bjs_testOptionalPropertyRoundtrip(holderIsSome: Int32, holderValue: @_expose(wasm, "bjs_roundTripString") @_cdecl("bjs_roundTripString") -public func _bjs_roundTripString(nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> Void { +public func _bjs_roundTripString(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripString(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -41,7 +41,7 @@ public func _bjs_roundTripString(nameIsSome: Int32, nameBytes: Int32, nameLength @_expose(wasm, "bjs_roundTripInt") @_cdecl("bjs_roundTripInt") -public func _bjs_roundTripInt(valueIsSome: Int32, valueValue: Int32) -> Void { +public func _bjs_roundTripInt(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripInt(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) return ret.bridgeJSLowerReturn() @@ -52,7 +52,7 @@ public func _bjs_roundTripInt(valueIsSome: Int32, valueValue: Int32) -> Void { @_expose(wasm, "bjs_roundTripBool") @_cdecl("bjs_roundTripBool") -public func _bjs_roundTripBool(flagIsSome: Int32, flagValue: Int32) -> Void { +public func _bjs_roundTripBool(_ flagIsSome: Int32, _ flagValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripBool(flag: Optional.bridgeJSLiftParameter(flagIsSome, flagValue)) return ret.bridgeJSLowerReturn() @@ -63,7 +63,7 @@ public func _bjs_roundTripBool(flagIsSome: Int32, flagValue: Int32) -> Void { @_expose(wasm, "bjs_roundTripFloat") @_cdecl("bjs_roundTripFloat") -public func _bjs_roundTripFloat(numberIsSome: Int32, numberValue: Float32) -> Void { +public func _bjs_roundTripFloat(_ numberIsSome: Int32, _ numberValue: Float32) -> Void { #if arch(wasm32) let ret = roundTripFloat(number: Optional.bridgeJSLiftParameter(numberIsSome, numberValue)) return ret.bridgeJSLowerReturn() @@ -74,7 +74,7 @@ public func _bjs_roundTripFloat(numberIsSome: Int32, numberValue: Float32) -> Vo @_expose(wasm, "bjs_roundTripDouble") @_cdecl("bjs_roundTripDouble") -public func _bjs_roundTripDouble(precisionIsSome: Int32, precisionValue: Float64) -> Void { +public func _bjs_roundTripDouble(_ precisionIsSome: Int32, _ precisionValue: Float64) -> Void { #if arch(wasm32) let ret = roundTripDouble(precision: Optional.bridgeJSLiftParameter(precisionIsSome, precisionValue)) return ret.bridgeJSLowerReturn() @@ -85,7 +85,7 @@ public func _bjs_roundTripDouble(precisionIsSome: Int32, precisionValue: Float64 @_expose(wasm, "bjs_roundTripSyntax") @_cdecl("bjs_roundTripSyntax") -public func _bjs_roundTripSyntax(nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> Void { +public func _bjs_roundTripSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -96,7 +96,7 @@ public func _bjs_roundTripSyntax(nameIsSome: Int32, nameBytes: Int32, nameLength @_expose(wasm, "bjs_roundTripMixSyntax") @_cdecl("bjs_roundTripMixSyntax") -public func _bjs_roundTripMixSyntax(nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> Void { +public func _bjs_roundTripMixSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripMixSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -107,7 +107,7 @@ public func _bjs_roundTripMixSyntax(nameIsSome: Int32, nameBytes: Int32, nameLen @_expose(wasm, "bjs_roundTripSwiftSyntax") @_cdecl("bjs_roundTripSwiftSyntax") -public func _bjs_roundTripSwiftSyntax(nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> Void { +public func _bjs_roundTripSwiftSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripSwiftSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -118,7 +118,7 @@ public func _bjs_roundTripSwiftSyntax(nameIsSome: Int32, nameBytes: Int32, nameL @_expose(wasm, "bjs_roundTripMixedSwiftSyntax") @_cdecl("bjs_roundTripMixedSwiftSyntax") -public func _bjs_roundTripMixedSwiftSyntax(nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> Void { +public func _bjs_roundTripMixedSwiftSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripMixedSwiftSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -129,7 +129,7 @@ public func _bjs_roundTripMixedSwiftSyntax(nameIsSome: Int32, nameBytes: Int32, @_expose(wasm, "bjs_roundTripWithSpaces") @_cdecl("bjs_roundTripWithSpaces") -public func _bjs_roundTripWithSpaces(valueIsSome: Int32, valueValue: Float64) -> Void { +public func _bjs_roundTripWithSpaces(_ valueIsSome: Int32, _ valueValue: Float64) -> Void { #if arch(wasm32) let ret = roundTripWithSpaces(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) return ret.bridgeJSLowerReturn() @@ -140,7 +140,7 @@ public func _bjs_roundTripWithSpaces(valueIsSome: Int32, valueValue: Float64) -> @_expose(wasm, "bjs_roundTripAlias") @_cdecl("bjs_roundTripAlias") -public func _bjs_roundTripAlias(ageIsSome: Int32, ageValue: Int32) -> Void { +public func _bjs_roundTripAlias(_ ageIsSome: Int32, _ ageValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripAlias(age: Optional.bridgeJSLiftParameter(ageIsSome, ageValue)) return ret.bridgeJSLowerReturn() @@ -151,7 +151,7 @@ public func _bjs_roundTripAlias(ageIsSome: Int32, ageValue: Int32) -> Void { @_expose(wasm, "bjs_roundTripOptionalAlias") @_cdecl("bjs_roundTripOptionalAlias") -public func _bjs_roundTripOptionalAlias(nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> Void { +public func _bjs_roundTripOptionalAlias(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalAlias(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -162,7 +162,7 @@ public func _bjs_roundTripOptionalAlias(nameIsSome: Int32, nameBytes: Int32, nam @_expose(wasm, "bjs_testMixedOptionals") @_cdecl("bjs_testMixedOptionals") -public func _bjs_testMixedOptionals(firstNameIsSome: Int32, firstNameBytes: Int32, firstNameLength: Int32, lastNameIsSome: Int32, lastNameBytes: Int32, lastNameLength: Int32, ageIsSome: Int32, ageValue: Int32, active: Int32) -> Void { +public func _bjs_testMixedOptionals(_ firstNameIsSome: Int32, _ firstNameBytes: Int32, _ firstNameLength: Int32, _ lastNameIsSome: Int32, _ lastNameBytes: Int32, _ lastNameLength: Int32, _ ageIsSome: Int32, _ ageValue: Int32, _ active: Int32) -> Void { #if arch(wasm32) let ret = testMixedOptionals(firstName: Optional.bridgeJSLiftParameter(firstNameIsSome, firstNameBytes, firstNameLength), lastName: Optional.bridgeJSLiftParameter(lastNameIsSome, lastNameBytes, lastNameLength), age: Optional.bridgeJSLiftParameter(ageIsSome, ageValue), active: Bool.bridgeJSLiftParameter(active)) return ret.bridgeJSLowerReturn() @@ -173,7 +173,7 @@ public func _bjs_testMixedOptionals(firstNameIsSome: Int32, firstNameBytes: Int3 @_expose(wasm, "bjs_Greeter_init") @_cdecl("bjs_Greeter_init") -public func _bjs_Greeter_init(nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_Greeter_init(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Greeter(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -184,7 +184,7 @@ public func _bjs_Greeter_init(nameIsSome: Int32, nameBytes: Int32, nameLength: I @_expose(wasm, "bjs_Greeter_greet") @_cdecl("bjs_Greeter_greet") -public func _bjs_Greeter_greet(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Greeter_greet(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).greet() return ret.bridgeJSLowerReturn() @@ -195,7 +195,7 @@ public func _bjs_Greeter_greet(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Greeter_changeName") @_cdecl("bjs_Greeter_changeName") -public func _bjs_Greeter_changeName(_self: UnsafeMutableRawPointer, nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> Void { +public func _bjs_Greeter_changeName(_ _self: UnsafeMutableRawPointer, _ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) Greeter.bridgeJSLiftParameter(_self).changeName(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) #else @@ -205,7 +205,7 @@ public func _bjs_Greeter_changeName(_self: UnsafeMutableRawPointer, nameIsSome: @_expose(wasm, "bjs_Greeter_name_get") @_cdecl("bjs_Greeter_name_get") -public func _bjs_Greeter_name_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Greeter_name_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).name return ret.bridgeJSLowerReturn() @@ -216,7 +216,7 @@ public func _bjs_Greeter_name_get(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Greeter_name_set") @_cdecl("bjs_Greeter_name_set") -public func _bjs_Greeter_name_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_Greeter_name_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) Greeter.bridgeJSLiftParameter(_self).name = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) #else @@ -226,8 +226,12 @@ public func _bjs_Greeter_name_set(_self: UnsafeMutableRawPointer, valueIsSome: I @_expose(wasm, "bjs_Greeter_deinit") @_cdecl("bjs_Greeter_deinit") -public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -238,9 +242,9 @@ extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") -fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -258,7 +262,7 @@ public func _bjs_OptionalPropertyHolder_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_OptionalPropertyHolder_optionalName_get") @_cdecl("bjs_OptionalPropertyHolder_optionalName_get") -public func _bjs_OptionalPropertyHolder_optionalName_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_OptionalPropertyHolder_optionalName_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName return ret.bridgeJSLowerReturn() @@ -269,7 +273,7 @@ public func _bjs_OptionalPropertyHolder_optionalName_get(_self: UnsafeMutableRaw @_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 { +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 @@ -279,7 +283,7 @@ public func _bjs_OptionalPropertyHolder_optionalName_set(_self: UnsafeMutableRaw @_expose(wasm, "bjs_OptionalPropertyHolder_optionalAge_get") @_cdecl("bjs_OptionalPropertyHolder_optionalAge_get") -public func _bjs_OptionalPropertyHolder_optionalAge_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_OptionalPropertyHolder_optionalAge_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalAge return ret.bridgeJSLowerReturn() @@ -290,7 +294,7 @@ public func _bjs_OptionalPropertyHolder_optionalAge_get(_self: UnsafeMutableRawP @_expose(wasm, "bjs_OptionalPropertyHolder_optionalAge_set") @_cdecl("bjs_OptionalPropertyHolder_optionalAge_set") -public func _bjs_OptionalPropertyHolder_optionalAge_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: Int32) -> Void { +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 @@ -300,7 +304,7 @@ public func _bjs_OptionalPropertyHolder_optionalAge_set(_self: UnsafeMutableRawP @_expose(wasm, "bjs_OptionalPropertyHolder_optionalGreeter_get") @_cdecl("bjs_OptionalPropertyHolder_optionalGreeter_get") -public func _bjs_OptionalPropertyHolder_optionalGreeter_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_OptionalPropertyHolder_optionalGreeter_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter return ret.bridgeJSLowerReturn() @@ -311,7 +315,7 @@ public func _bjs_OptionalPropertyHolder_optionalGreeter_get(_self: UnsafeMutable @_expose(wasm, "bjs_OptionalPropertyHolder_optionalGreeter_set") @_cdecl("bjs_OptionalPropertyHolder_optionalGreeter_set") -public func _bjs_OptionalPropertyHolder_optionalGreeter_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: UnsafeMutableRawPointer) -> Void { +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 @@ -321,8 +325,12 @@ public func _bjs_OptionalPropertyHolder_optionalGreeter_set(_self: UnsafeMutable @_expose(wasm, "bjs_OptionalPropertyHolder_deinit") @_cdecl("bjs_OptionalPropertyHolder_deinit") -public func _bjs_OptionalPropertyHolder_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -333,9 +341,9 @@ extension OptionalPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_OptionalPropertyHolder_wrap") -fileprivate func _bjs_OptionalPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_OptionalPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift index 330977265..4f906704f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift @@ -8,7 +8,7 @@ @_expose(wasm, "bjs_check") @_cdecl("bjs_check") -public func _bjs_check(a: Int32, b: Float32, c: Float64, d: Int32) -> Void { +public func _bjs_check(_ a: Int32, _ b: Float32, _ c: Float64, _ d: Int32) -> Void { #if arch(wasm32) check(a: Int.bridgeJSLiftParameter(a), b: Float.bridgeJSLiftParameter(b), c: Double.bridgeJSLiftParameter(c), d: Bool.bridgeJSLiftParameter(d)) #else diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift index f622e3ac6..96bde51e6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift @@ -8,7 +8,7 @@ @_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 { +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() @@ -19,7 +19,7 @@ public func _bjs_createPropertyHolder(intValue: Int32, floatValue: Float32, doub @_expose(wasm, "bjs_testPropertyHolder") @_cdecl("bjs_testPropertyHolder") -public func _bjs_testPropertyHolder(holder: UnsafeMutableRawPointer) -> Void { +public func _bjs_testPropertyHolder(_ holder: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = testPropertyHolder(holder: PropertyHolder.bridgeJSLiftParameter(holder)) return ret.bridgeJSLowerReturn() @@ -30,7 +30,7 @@ public func _bjs_testPropertyHolder(holder: UnsafeMutableRawPointer) -> Void { @_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) -> UnsafeMutableRawPointer { +public func _bjs_PropertyHolder_init(_ intValue: Int32, _ floatValue: Float32, _ doubleValue: Float64, _ boolValue: Int32, _ stringValueBytes: Int32, _ stringValueLength: Int32, _ jsObject: Int32) -> 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)) return ret.bridgeJSLowerReturn() @@ -41,7 +41,7 @@ public func _bjs_PropertyHolder_init(intValue: Int32, floatValue: Float32, doubl @_expose(wasm, "bjs_PropertyHolder_getAllValues") @_cdecl("bjs_PropertyHolder_getAllValues") -public func _bjs_PropertyHolder_getAllValues(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PropertyHolder_getAllValues(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).getAllValues() return ret.bridgeJSLowerReturn() @@ -52,7 +52,7 @@ public func _bjs_PropertyHolder_getAllValues(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_PropertyHolder_intValue_get") @_cdecl("bjs_PropertyHolder_intValue_get") -public func _bjs_PropertyHolder_intValue_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_intValue_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).intValue return ret.bridgeJSLowerReturn() @@ -63,7 +63,7 @@ public func _bjs_PropertyHolder_intValue_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_PropertyHolder_intValue_set") @_cdecl("bjs_PropertyHolder_intValue_set") -public func _bjs_PropertyHolder_intValue_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_PropertyHolder_intValue_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).intValue = Int.bridgeJSLiftParameter(value) #else @@ -73,7 +73,7 @@ public func _bjs_PropertyHolder_intValue_set(_self: UnsafeMutableRawPointer, val @_expose(wasm, "bjs_PropertyHolder_floatValue_get") @_cdecl("bjs_PropertyHolder_floatValue_get") -public func _bjs_PropertyHolder_floatValue_get(_self: UnsafeMutableRawPointer) -> Float32 { +public func _bjs_PropertyHolder_floatValue_get(_ _self: UnsafeMutableRawPointer) -> Float32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).floatValue return ret.bridgeJSLowerReturn() @@ -84,7 +84,7 @@ public func _bjs_PropertyHolder_floatValue_get(_self: UnsafeMutableRawPointer) - @_expose(wasm, "bjs_PropertyHolder_floatValue_set") @_cdecl("bjs_PropertyHolder_floatValue_set") -public func _bjs_PropertyHolder_floatValue_set(_self: UnsafeMutableRawPointer, value: Float32) -> Void { +public func _bjs_PropertyHolder_floatValue_set(_ _self: UnsafeMutableRawPointer, _ value: Float32) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).floatValue = Float.bridgeJSLiftParameter(value) #else @@ -94,7 +94,7 @@ public func _bjs_PropertyHolder_floatValue_set(_self: UnsafeMutableRawPointer, v @_expose(wasm, "bjs_PropertyHolder_doubleValue_get") @_cdecl("bjs_PropertyHolder_doubleValue_get") -public func _bjs_PropertyHolder_doubleValue_get(_self: UnsafeMutableRawPointer) -> Float64 { +public func _bjs_PropertyHolder_doubleValue_get(_ _self: UnsafeMutableRawPointer) -> Float64 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).doubleValue return ret.bridgeJSLowerReturn() @@ -105,7 +105,7 @@ public func _bjs_PropertyHolder_doubleValue_get(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_PropertyHolder_doubleValue_set") @_cdecl("bjs_PropertyHolder_doubleValue_set") -public func _bjs_PropertyHolder_doubleValue_set(_self: UnsafeMutableRawPointer, value: Float64) -> Void { +public func _bjs_PropertyHolder_doubleValue_set(_ _self: UnsafeMutableRawPointer, _ value: Float64) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).doubleValue = Double.bridgeJSLiftParameter(value) #else @@ -115,7 +115,7 @@ public func _bjs_PropertyHolder_doubleValue_set(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_PropertyHolder_boolValue_get") @_cdecl("bjs_PropertyHolder_boolValue_get") -public func _bjs_PropertyHolder_boolValue_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_boolValue_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).boolValue return ret.bridgeJSLowerReturn() @@ -126,7 +126,7 @@ public func _bjs_PropertyHolder_boolValue_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_PropertyHolder_boolValue_set") @_cdecl("bjs_PropertyHolder_boolValue_set") -public func _bjs_PropertyHolder_boolValue_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_PropertyHolder_boolValue_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).boolValue = Bool.bridgeJSLiftParameter(value) #else @@ -136,7 +136,7 @@ public func _bjs_PropertyHolder_boolValue_set(_self: UnsafeMutableRawPointer, va @_expose(wasm, "bjs_PropertyHolder_stringValue_get") @_cdecl("bjs_PropertyHolder_stringValue_get") -public func _bjs_PropertyHolder_stringValue_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PropertyHolder_stringValue_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).stringValue return ret.bridgeJSLowerReturn() @@ -147,7 +147,7 @@ public func _bjs_PropertyHolder_stringValue_get(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_PropertyHolder_stringValue_set") @_cdecl("bjs_PropertyHolder_stringValue_set") -public func _bjs_PropertyHolder_stringValue_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +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 @@ -157,7 +157,7 @@ public func _bjs_PropertyHolder_stringValue_set(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_PropertyHolder_readonlyInt_get") @_cdecl("bjs_PropertyHolder_readonlyInt_get") -public func _bjs_PropertyHolder_readonlyInt_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_readonlyInt_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyInt return ret.bridgeJSLowerReturn() @@ -168,7 +168,7 @@ public func _bjs_PropertyHolder_readonlyInt_get(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_PropertyHolder_readonlyFloat_get") @_cdecl("bjs_PropertyHolder_readonlyFloat_get") -public func _bjs_PropertyHolder_readonlyFloat_get(_self: UnsafeMutableRawPointer) -> Float32 { +public func _bjs_PropertyHolder_readonlyFloat_get(_ _self: UnsafeMutableRawPointer) -> Float32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyFloat return ret.bridgeJSLowerReturn() @@ -179,7 +179,7 @@ public func _bjs_PropertyHolder_readonlyFloat_get(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_PropertyHolder_readonlyDouble_get") @_cdecl("bjs_PropertyHolder_readonlyDouble_get") -public func _bjs_PropertyHolder_readonlyDouble_get(_self: UnsafeMutableRawPointer) -> Float64 { +public func _bjs_PropertyHolder_readonlyDouble_get(_ _self: UnsafeMutableRawPointer) -> Float64 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyDouble return ret.bridgeJSLowerReturn() @@ -190,7 +190,7 @@ public func _bjs_PropertyHolder_readonlyDouble_get(_self: UnsafeMutableRawPointe @_expose(wasm, "bjs_PropertyHolder_readonlyBool_get") @_cdecl("bjs_PropertyHolder_readonlyBool_get") -public func _bjs_PropertyHolder_readonlyBool_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_readonlyBool_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyBool return ret.bridgeJSLowerReturn() @@ -201,7 +201,7 @@ public func _bjs_PropertyHolder_readonlyBool_get(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_PropertyHolder_readonlyString_get") @_cdecl("bjs_PropertyHolder_readonlyString_get") -public func _bjs_PropertyHolder_readonlyString_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PropertyHolder_readonlyString_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyString return ret.bridgeJSLowerReturn() @@ -212,7 +212,7 @@ public func _bjs_PropertyHolder_readonlyString_get(_self: UnsafeMutableRawPointe @_expose(wasm, "bjs_PropertyHolder_jsObject_get") @_cdecl("bjs_PropertyHolder_jsObject_get") -public func _bjs_PropertyHolder_jsObject_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_jsObject_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).jsObject return ret.bridgeJSLowerReturn() @@ -223,7 +223,7 @@ public func _bjs_PropertyHolder_jsObject_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_PropertyHolder_jsObject_set") @_cdecl("bjs_PropertyHolder_jsObject_set") -public func _bjs_PropertyHolder_jsObject_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_PropertyHolder_jsObject_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).jsObject = JSObject.bridgeJSLiftParameter(value) #else @@ -233,7 +233,7 @@ public func _bjs_PropertyHolder_jsObject_set(_self: UnsafeMutableRawPointer, val @_expose(wasm, "bjs_PropertyHolder_sibling_get") @_cdecl("bjs_PropertyHolder_sibling_get") -public func _bjs_PropertyHolder_sibling_get(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_PropertyHolder_sibling_get(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).sibling return ret.bridgeJSLowerReturn() @@ -244,7 +244,7 @@ public func _bjs_PropertyHolder_sibling_get(_self: UnsafeMutableRawPointer) -> U @_expose(wasm, "bjs_PropertyHolder_sibling_set") @_cdecl("bjs_PropertyHolder_sibling_set") -public func _bjs_PropertyHolder_sibling_set(_self: UnsafeMutableRawPointer, value: UnsafeMutableRawPointer) -> Void { +public func _bjs_PropertyHolder_sibling_set(_ _self: UnsafeMutableRawPointer, _ value: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).sibling = PropertyHolder.bridgeJSLiftParameter(value) #else @@ -254,7 +254,7 @@ public func _bjs_PropertyHolder_sibling_set(_self: UnsafeMutableRawPointer, valu @_expose(wasm, "bjs_PropertyHolder_lazyValue_get") @_cdecl("bjs_PropertyHolder_lazyValue_get") -public func _bjs_PropertyHolder_lazyValue_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PropertyHolder_lazyValue_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).lazyValue return ret.bridgeJSLowerReturn() @@ -265,7 +265,7 @@ public func _bjs_PropertyHolder_lazyValue_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_PropertyHolder_lazyValue_set") @_cdecl("bjs_PropertyHolder_lazyValue_set") -public func _bjs_PropertyHolder_lazyValue_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +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 @@ -275,7 +275,7 @@ public func _bjs_PropertyHolder_lazyValue_set(_self: UnsafeMutableRawPointer, va @_expose(wasm, "bjs_PropertyHolder_computedReadonly_get") @_cdecl("bjs_PropertyHolder_computedReadonly_get") -public func _bjs_PropertyHolder_computedReadonly_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_computedReadonly_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).computedReadonly return ret.bridgeJSLowerReturn() @@ -286,7 +286,7 @@ public func _bjs_PropertyHolder_computedReadonly_get(_self: UnsafeMutableRawPoin @_expose(wasm, "bjs_PropertyHolder_computedReadWrite_get") @_cdecl("bjs_PropertyHolder_computedReadWrite_get") -public func _bjs_PropertyHolder_computedReadWrite_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PropertyHolder_computedReadWrite_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).computedReadWrite return ret.bridgeJSLowerReturn() @@ -297,7 +297,7 @@ public func _bjs_PropertyHolder_computedReadWrite_get(_self: UnsafeMutableRawPoi @_expose(wasm, "bjs_PropertyHolder_computedReadWrite_set") @_cdecl("bjs_PropertyHolder_computedReadWrite_set") -public func _bjs_PropertyHolder_computedReadWrite_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +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 @@ -307,7 +307,7 @@ public func _bjs_PropertyHolder_computedReadWrite_set(_self: UnsafeMutableRawPoi @_expose(wasm, "bjs_PropertyHolder_observedProperty_get") @_cdecl("bjs_PropertyHolder_observedProperty_get") -public func _bjs_PropertyHolder_observedProperty_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_observedProperty_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).observedProperty return ret.bridgeJSLowerReturn() @@ -318,7 +318,7 @@ public func _bjs_PropertyHolder_observedProperty_get(_self: UnsafeMutableRawPoin @_expose(wasm, "bjs_PropertyHolder_observedProperty_set") @_cdecl("bjs_PropertyHolder_observedProperty_set") -public func _bjs_PropertyHolder_observedProperty_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_PropertyHolder_observedProperty_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).observedProperty = Int.bridgeJSLiftParameter(value) #else @@ -328,8 +328,12 @@ public func _bjs_PropertyHolder_observedProperty_set(_self: UnsafeMutableRawPoin @_expose(wasm, "bjs_PropertyHolder_deinit") @_cdecl("bjs_PropertyHolder_deinit") -public func _bjs_PropertyHolder_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -340,9 +344,9 @@ extension PropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_PropertyHolder_wrap") -fileprivate func _bjs_PropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index ef6160d28..318b908b5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -9,170 +9,214 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProtocolWrapper { let jsObject: JSObject - func onSomethingHappened() { - _extern_onSomethingHappened(this: Int32(bitPattern: jsObject.id)) + func onSomethingHappened() -> Void { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + _extern_onSomethingHappened(jsObjectValue) } - func onValueChanged(_ value: String) { - _extern_onValueChanged(this: Int32(bitPattern: jsObject.id), value: value.bridgeJSLowerParameter()) + func onValueChanged(_ value: String) -> Void { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let valueValue = value.bridgeJSLowerParameter() + _extern_onValueChanged(jsObjectValue, valueValue) } func onCountUpdated(count: Int) -> Bool { - let ret = _extern_onCountUpdated(this: Int32(bitPattern: jsObject.id), count: count.bridgeJSLowerParameter()) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let countValue = count.bridgeJSLowerParameter() + let ret = _extern_onCountUpdated(jsObjectValue, countValue) return Bool.bridgeJSLiftReturn(ret) } - func onLabelUpdated(_ prefix: String, _ suffix: String) { - _extern_onLabelUpdated(this: Int32(bitPattern: jsObject.id), prefix: prefix.bridgeJSLowerParameter(), suffix: suffix.bridgeJSLowerParameter()) + func onLabelUpdated(_ prefix: String, _ suffix: String) -> Void { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let prefixValue = prefix.bridgeJSLowerParameter() + let suffixValue = suffix.bridgeJSLowerParameter() + _extern_onLabelUpdated(jsObjectValue, prefixValue, suffixValue) } func isCountEven() -> Bool { - let ret = _extern_isCountEven(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_isCountEven(jsObjectValue) return Bool.bridgeJSLiftReturn(ret) } - func onHelperUpdated(_ helper: Helper) { - _extern_onHelperUpdated(this: Int32(bitPattern: jsObject.id), helper: helper.bridgeJSLowerParameter()) + func onHelperUpdated(_ helper: Helper) -> Void { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let helperPointer = helper.bridgeJSLowerParameter() + _extern_onHelperUpdated(jsObjectValue, helperPointer) } func createHelper() -> Helper { - let ret = _extern_createHelper(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_createHelper(jsObjectValue) return Helper.bridgeJSLiftReturn(ret) } - func onOptionalHelperUpdated(_ helper: Optional) { - let (helperIsSome, helperPointer) = helper.bridgeJSLowerParameterWithPresence() - _extern_onOptionalHelperUpdated(this: Int32(bitPattern: jsObject.id), helperIsSome: helperIsSome, helperPointer: helperPointer) + func onOptionalHelperUpdated(_ helper: Optional) -> Void { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (helperIsSome, helperPointer) = helper.bridgeJSLowerParameter() + _extern_onOptionalHelperUpdated(jsObjectValue, helperIsSome, helperPointer) } func createOptionalHelper() -> Optional { - let ret = _extern_createOptionalHelper(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_createOptionalHelper(jsObjectValue) return Optional.bridgeJSLiftReturn(ret) } func createEnum() -> ExampleEnum { - let ret = _extern_createEnum(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_createEnum(jsObjectValue) return ExampleEnum.bridgeJSLiftReturn(ret) } - func handleResult(_ result: Result) { - _extern_handleResult(this: Int32(bitPattern: jsObject.id), result: result.bridgeJSLowerParameter()) + func handleResult(_ result: Result) -> Void { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let resultCaseId = result.bridgeJSLowerParameter() + _extern_handleResult(jsObjectValue, resultCaseId) } func getResult() -> Result { - let ret = _extern_getResult(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_getResult(jsObjectValue) return Result.bridgeJSLiftReturn(ret) } var eventCount: Int { get { - let ret = bjs_MyViewControllerDelegate_eventCount_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_MyViewControllerDelegate_eventCount_get(jsObjectValue) return Int.bridgeJSLiftReturn(ret) } set { - bjs_MyViewControllerDelegate_eventCount_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_MyViewControllerDelegate_eventCount_set(jsObjectValue, newValueValue) } } var delegateName: String { get { - let ret = bjs_MyViewControllerDelegate_delegateName_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_MyViewControllerDelegate_delegateName_get(jsObjectValue) return String.bridgeJSLiftReturn(ret) } } var optionalName: Optional { get { - bjs_MyViewControllerDelegate_optionalName_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + bjs_MyViewControllerDelegate_optionalName_get(jsObjectValue) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - bjs_MyViewControllerDelegate_optionalName_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_MyViewControllerDelegate_optionalName_set(jsObjectValue, newValueIsSome, newValueValue) } } var optionalRawEnum: Optional { get { - bjs_MyViewControllerDelegate_optionalRawEnum_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + bjs_MyViewControllerDelegate_optionalRawEnum_get(jsObjectValue) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - bjs_MyViewControllerDelegate_optionalRawEnum_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_MyViewControllerDelegate_optionalRawEnum_set(jsObjectValue, newValueIsSome, newValueValue) } } var rawStringEnum: ExampleEnum { get { - let ret = bjs_MyViewControllerDelegate_rawStringEnum_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_MyViewControllerDelegate_rawStringEnum_get(jsObjectValue) return ExampleEnum.bridgeJSLiftReturn(ret) } set { - bjs_MyViewControllerDelegate_rawStringEnum_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_MyViewControllerDelegate_rawStringEnum_set(jsObjectValue, newValueValue) } } var result: Result { get { - let ret = bjs_MyViewControllerDelegate_result_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_MyViewControllerDelegate_result_get(jsObjectValue) return Result.bridgeJSLiftReturn(ret) } set { - bjs_MyViewControllerDelegate_result_set(this: Int32(bitPattern: jsObject.id), caseId: newValue.bridgeJSLowerParameter()) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let newValueCaseId = newValue.bridgeJSLowerParameter() + bjs_MyViewControllerDelegate_result_set(jsObjectValue, newValueCaseId) } } var optionalResult: Optional { get { - let ret = bjs_MyViewControllerDelegate_optionalResult_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_MyViewControllerDelegate_optionalResult_get(jsObjectValue) return Optional.bridgeJSLiftReturn(ret) } set { - let (isSome, caseId) = newValue.bridgeJSLowerParameterWithPresence() - bjs_MyViewControllerDelegate_optionalResult_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, caseId: caseId) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueCaseId) = newValue.bridgeJSLowerParameter() + bjs_MyViewControllerDelegate_optionalResult_set(jsObjectValue, newValueIsSome, newValueCaseId) } } var direction: Direction { get { - let ret = bjs_MyViewControllerDelegate_direction_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_MyViewControllerDelegate_direction_get(jsObjectValue) return Direction.bridgeJSLiftReturn(ret) } set { - bjs_MyViewControllerDelegate_direction_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_MyViewControllerDelegate_direction_set(jsObjectValue, newValueValue) } } var directionOptional: Optional { get { - let ret = bjs_MyViewControllerDelegate_directionOptional_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_MyViewControllerDelegate_directionOptional_get(jsObjectValue) return Optional.bridgeJSLiftReturn(ret) } set { - let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - bjs_MyViewControllerDelegate_directionOptional_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_MyViewControllerDelegate_directionOptional_set(jsObjectValue, newValueIsSome, newValueValue) } } var priority: Priority { get { - let ret = bjs_MyViewControllerDelegate_priority_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_MyViewControllerDelegate_priority_get(jsObjectValue) return Priority.bridgeJSLiftReturn(ret) } set { - bjs_MyViewControllerDelegate_priority_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_MyViewControllerDelegate_priority_set(jsObjectValue, newValueValue) } } var priorityOptional: Optional { get { - bjs_MyViewControllerDelegate_priorityOptional_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + bjs_MyViewControllerDelegate_priorityOptional_get(jsObjectValue) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - bjs_MyViewControllerDelegate_priorityOptional_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_MyViewControllerDelegate_priorityOptional_set(jsObjectValue, newValueIsSome, newValueValue) } } @@ -182,103 +226,103 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto } @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onSomethingHappened") -fileprivate func _extern_onSomethingHappened(this: Int32) +fileprivate func _extern_onSomethingHappened(_ jsObject: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onValueChanged") -fileprivate func _extern_onValueChanged(this: Int32, value: Int32) +fileprivate func _extern_onValueChanged(_ jsObject: Int32, _ value: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onCountUpdated") -fileprivate func _extern_onCountUpdated(this: Int32, count: Int32) -> Int32 +fileprivate func _extern_onCountUpdated(_ jsObject: Int32, _ count: Int32) -> Int32 @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onLabelUpdated") -fileprivate func _extern_onLabelUpdated(this: Int32, prefix: Int32, suffix: Int32) +fileprivate func _extern_onLabelUpdated(_ jsObject: Int32, _ prefix: Int32, _ suffix: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_isCountEven") -fileprivate func _extern_isCountEven(this: Int32) -> Int32 +fileprivate func _extern_isCountEven(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onHelperUpdated") -fileprivate func _extern_onHelperUpdated(this: Int32, helper: UnsafeMutableRawPointer) +fileprivate func _extern_onHelperUpdated(_ jsObject: Int32, _ helper: UnsafeMutableRawPointer) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createHelper") -fileprivate func _extern_createHelper(this: Int32) -> UnsafeMutableRawPointer +fileprivate func _extern_createHelper(_ jsObject: Int32) -> UnsafeMutableRawPointer @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onOptionalHelperUpdated") -fileprivate func _extern_onOptionalHelperUpdated(this: Int32, helperIsSome: Int32, helperPointer: UnsafeMutableRawPointer) +fileprivate func _extern_onOptionalHelperUpdated(_ jsObject: Int32, _ helperIsSome: Int32, _ helperPointer: UnsafeMutableRawPointer) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createOptionalHelper") -fileprivate func _extern_createOptionalHelper(this: Int32) -> UnsafeMutableRawPointer +fileprivate func _extern_createOptionalHelper(_ jsObject: Int32) -> UnsafeMutableRawPointer @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createEnum") -fileprivate func _extern_createEnum(this: Int32) -> Int32 +fileprivate func _extern_createEnum(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_handleResult") -fileprivate func _extern_handleResult(this: Int32, result: Int32) +fileprivate func _extern_handleResult(_ jsObject: Int32, _ result: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_getResult") -fileprivate func _extern_getResult(this: Int32) -> Int32 +fileprivate func _extern_getResult(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_get") -fileprivate func bjs_MyViewControllerDelegate_eventCount_get(this: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_eventCount_get(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_set") -fileprivate func bjs_MyViewControllerDelegate_eventCount_set(this: Int32, value: Int32) +fileprivate func bjs_MyViewControllerDelegate_eventCount_set(_ jsObject: Int32, _ newValue: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_delegateName_get") -fileprivate func bjs_MyViewControllerDelegate_delegateName_get(this: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_delegateName_get(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_get") -fileprivate func bjs_MyViewControllerDelegate_optionalName_get(this: Int32) +fileprivate func bjs_MyViewControllerDelegate_optionalName_get(_ jsObject: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_set") -fileprivate func bjs_MyViewControllerDelegate_optionalName_set(this: Int32, isSome: Int32, value: Int32) +fileprivate func bjs_MyViewControllerDelegate_optionalName_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalRawEnum_get") -fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_get(this: Int32) +fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_get(_ jsObject: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalRawEnum_set") -fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_set(this: Int32, isSome: Int32, value: Int32) +fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_rawStringEnum_get") -fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_get(this: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_get(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_rawStringEnum_set") -fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_set(this: Int32, value: Int32) +fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_set(_ jsObject: Int32, _ newValue: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_get") -fileprivate func bjs_MyViewControllerDelegate_result_get(this: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_result_get(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_set") -fileprivate func bjs_MyViewControllerDelegate_result_set(this: Int32, caseId: Int32) +fileprivate func bjs_MyViewControllerDelegate_result_set(_ jsObject: Int32, _ newValue: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalResult_get") -fileprivate func bjs_MyViewControllerDelegate_optionalResult_get(this: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_optionalResult_get(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalResult_set") -fileprivate func bjs_MyViewControllerDelegate_optionalResult_set(this: Int32, isSome: Int32, caseId: Int32) +fileprivate func bjs_MyViewControllerDelegate_optionalResult_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_direction_get") -fileprivate func bjs_MyViewControllerDelegate_direction_get(this: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_direction_get(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_direction_set") -fileprivate func bjs_MyViewControllerDelegate_direction_set(this: Int32, value: Int32) +fileprivate func bjs_MyViewControllerDelegate_direction_set(_ jsObject: Int32, _ newValue: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_directionOptional_get") -fileprivate func bjs_MyViewControllerDelegate_directionOptional_get(this: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_directionOptional_get(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_directionOptional_set") -fileprivate func bjs_MyViewControllerDelegate_directionOptional_set(this: Int32, isSome: Int32, value: Int32) +fileprivate func bjs_MyViewControllerDelegate_directionOptional_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priority_get") -fileprivate func bjs_MyViewControllerDelegate_priority_get(this: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_priority_get(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priority_set") -fileprivate func bjs_MyViewControllerDelegate_priority_set(this: Int32, value: Int32) +fileprivate func bjs_MyViewControllerDelegate_priority_set(_ jsObject: Int32, _ newValue: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priorityOptional_get") -fileprivate func bjs_MyViewControllerDelegate_priorityOptional_get(this: Int32) +fileprivate func bjs_MyViewControllerDelegate_priorityOptional_get(_ jsObject: Int32) -> Void @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priorityOptional_set") -fileprivate func bjs_MyViewControllerDelegate_priorityOptional_set(this: Int32, isSome: Int32, value: Int32) +fileprivate func bjs_MyViewControllerDelegate_priorityOptional_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void extension Direction: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { @@ -384,7 +428,7 @@ extension Priority: _BridgedSwiftEnumNoPayload { @_expose(wasm, "bjs_Helper_init") @_cdecl("bjs_Helper_init") -public func _bjs_Helper_init(value: Int32) -> UnsafeMutableRawPointer { +public func _bjs_Helper_init(_ value: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Helper(value: Int.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -395,7 +439,7 @@ public func _bjs_Helper_init(value: Int32) -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_Helper_increment") @_cdecl("bjs_Helper_increment") -public func _bjs_Helper_increment(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Helper_increment(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) Helper.bridgeJSLiftParameter(_self).increment() #else @@ -405,7 +449,7 @@ public func _bjs_Helper_increment(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Helper_value_get") @_cdecl("bjs_Helper_value_get") -public func _bjs_Helper_value_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_Helper_value_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = Helper.bridgeJSLiftParameter(_self).value return ret.bridgeJSLowerReturn() @@ -416,7 +460,7 @@ public func _bjs_Helper_value_get(_self: UnsafeMutableRawPointer) -> Int32 { @_expose(wasm, "bjs_Helper_value_set") @_cdecl("bjs_Helper_value_set") -public func _bjs_Helper_value_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_Helper_value_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) Helper.bridgeJSLiftParameter(_self).value = Int.bridgeJSLiftParameter(value) #else @@ -426,8 +470,12 @@ public func _bjs_Helper_value_set(_self: UnsafeMutableRawPointer, value: Int32) @_expose(wasm, "bjs_Helper_deinit") @_cdecl("bjs_Helper_deinit") -public func _bjs_Helper_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_Helper_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension Helper: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -438,16 +486,16 @@ extension Helper: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Helper_wrap") -fileprivate func _bjs_Helper_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Helper_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Helper_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Helper_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_MyViewController_init") @_cdecl("bjs_MyViewController_init") -public func _bjs_MyViewController_init(delegate: Int32) -> UnsafeMutableRawPointer { +public func _bjs_MyViewController_init(_ delegate: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = MyViewController(delegate: AnyMyViewControllerDelegate.bridgeJSLiftParameter(delegate)) return ret.bridgeJSLowerReturn() @@ -458,7 +506,7 @@ public func _bjs_MyViewController_init(delegate: Int32) -> UnsafeMutableRawPoint @_expose(wasm, "bjs_MyViewController_triggerEvent") @_cdecl("bjs_MyViewController_triggerEvent") -public func _bjs_MyViewController_triggerEvent(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_MyViewController_triggerEvent(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) MyViewController.bridgeJSLiftParameter(_self).triggerEvent() #else @@ -468,7 +516,7 @@ public func _bjs_MyViewController_triggerEvent(_self: UnsafeMutableRawPointer) - @_expose(wasm, "bjs_MyViewController_updateValue") @_cdecl("bjs_MyViewController_updateValue") -public func _bjs_MyViewController_updateValue(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_MyViewController_updateValue(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) MyViewController.bridgeJSLiftParameter(_self).updateValue(_: String.bridgeJSLiftParameter(valueBytes, valueLength)) #else @@ -478,7 +526,7 @@ public func _bjs_MyViewController_updateValue(_self: UnsafeMutableRawPointer, va @_expose(wasm, "bjs_MyViewController_updateCount") @_cdecl("bjs_MyViewController_updateCount") -public func _bjs_MyViewController_updateCount(_self: UnsafeMutableRawPointer, count: Int32) -> Int32 { +public func _bjs_MyViewController_updateCount(_ _self: UnsafeMutableRawPointer, _ count: Int32) -> Int32 { #if arch(wasm32) let ret = MyViewController.bridgeJSLiftParameter(_self).updateCount(_: Int.bridgeJSLiftParameter(count)) return ret.bridgeJSLowerReturn() @@ -489,7 +537,7 @@ public func _bjs_MyViewController_updateCount(_self: UnsafeMutableRawPointer, co @_expose(wasm, "bjs_MyViewController_updateLabel") @_cdecl("bjs_MyViewController_updateLabel") -public func _bjs_MyViewController_updateLabel(_self: UnsafeMutableRawPointer, prefixBytes: Int32, prefixLength: Int32, suffixBytes: Int32, suffixLength: Int32) -> Void { +public func _bjs_MyViewController_updateLabel(_ _self: UnsafeMutableRawPointer, _ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { #if arch(wasm32) MyViewController.bridgeJSLiftParameter(_self).updateLabel(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength), _: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) #else @@ -499,7 +547,7 @@ public func _bjs_MyViewController_updateLabel(_self: UnsafeMutableRawPointer, pr @_expose(wasm, "bjs_MyViewController_checkEvenCount") @_cdecl("bjs_MyViewController_checkEvenCount") -public func _bjs_MyViewController_checkEvenCount(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_MyViewController_checkEvenCount(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = MyViewController.bridgeJSLiftParameter(_self).checkEvenCount() return ret.bridgeJSLowerReturn() @@ -510,7 +558,7 @@ public func _bjs_MyViewController_checkEvenCount(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_MyViewController_sendHelper") @_cdecl("bjs_MyViewController_sendHelper") -public func _bjs_MyViewController_sendHelper(_self: UnsafeMutableRawPointer, helper: UnsafeMutableRawPointer) -> Void { +public func _bjs_MyViewController_sendHelper(_ _self: UnsafeMutableRawPointer, _ helper: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) MyViewController.bridgeJSLiftParameter(_self).sendHelper(_: Helper.bridgeJSLiftParameter(helper)) #else @@ -520,7 +568,7 @@ public func _bjs_MyViewController_sendHelper(_self: UnsafeMutableRawPointer, hel @_expose(wasm, "bjs_MyViewController_delegate_get") @_cdecl("bjs_MyViewController_delegate_get") -public func _bjs_MyViewController_delegate_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_MyViewController_delegate_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = MyViewController.bridgeJSLiftParameter(_self).delegate as! AnyMyViewControllerDelegate return ret.bridgeJSLowerReturn() @@ -531,7 +579,7 @@ public func _bjs_MyViewController_delegate_get(_self: UnsafeMutableRawPointer) - @_expose(wasm, "bjs_MyViewController_delegate_set") @_cdecl("bjs_MyViewController_delegate_set") -public func _bjs_MyViewController_delegate_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_MyViewController_delegate_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) MyViewController.bridgeJSLiftParameter(_self).delegate = AnyMyViewControllerDelegate.bridgeJSLiftParameter(value) #else @@ -541,7 +589,7 @@ public func _bjs_MyViewController_delegate_set(_self: UnsafeMutableRawPointer, v @_expose(wasm, "bjs_MyViewController_secondDelegate_get") @_cdecl("bjs_MyViewController_secondDelegate_get") -public func _bjs_MyViewController_secondDelegate_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_MyViewController_secondDelegate_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = MyViewController.bridgeJSLiftParameter(_self).secondDelegate.flatMap { $0 as? AnyMyViewControllerDelegate @@ -554,7 +602,7 @@ public func _bjs_MyViewController_secondDelegate_get(_self: UnsafeMutableRawPoin @_expose(wasm, "bjs_MyViewController_secondDelegate_set") @_cdecl("bjs_MyViewController_secondDelegate_set") -public func _bjs_MyViewController_secondDelegate_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: Int32) -> Void { +public func _bjs_MyViewController_secondDelegate_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) MyViewController.bridgeJSLiftParameter(_self).secondDelegate = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) #else @@ -564,8 +612,12 @@ public func _bjs_MyViewController_secondDelegate_set(_self: UnsafeMutableRawPoin @_expose(wasm, "bjs_MyViewController_deinit") @_cdecl("bjs_MyViewController_deinit") -public func _bjs_MyViewController_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_MyViewController_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension MyViewController: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -576,9 +628,9 @@ extension MyViewController: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewController_wrap") -fileprivate func _bjs_MyViewController_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_MyViewController_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_MyViewController_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_MyViewController_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift index 81ea282fe..8ea228dc5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift @@ -43,7 +43,7 @@ extension Calculator: _BridgedSwiftCaseEnum { @_expose(wasm, "bjs_Calculator_static_square") @_cdecl("bjs_Calculator_static_square") -public func _bjs_Calculator_static_square(value: Int32) -> Int32 { +public func _bjs_Calculator_static_square(_ value: Int32) -> Int32 { #if arch(wasm32) let ret = Calculator.square(value: Int.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -107,7 +107,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_expose(wasm, "bjs_APIResult_static_roundtrip") @_cdecl("bjs_APIResult_static_roundtrip") -public func _bjs_APIResult_static_roundtrip(value: Int32) -> Void { +public func _bjs_APIResult_static_roundtrip(_ value: Int32) -> Void { #if arch(wasm32) let ret = APIResult.roundtrip(value: APIResult.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -118,7 +118,7 @@ public func _bjs_APIResult_static_roundtrip(value: Int32) -> Void { @_expose(wasm, "bjs_Utils_String_static_uppercase") @_cdecl("bjs_Utils_String_static_uppercase") -public func _bjs_Utils_String_static_uppercase(textBytes: Int32, textLength: Int32) -> Void { +public func _bjs_Utils_String_static_uppercase(_ textBytes: Int32, _ textLength: Int32) -> Void { #if arch(wasm32) let ret = Utils.String.uppercase(_: String.bridgeJSLiftParameter(textBytes, textLength)) return ret.bridgeJSLowerReturn() @@ -140,7 +140,7 @@ public func _bjs_MathUtils_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_MathUtils_static_subtract") @_cdecl("bjs_MathUtils_static_subtract") -public func _bjs_MathUtils_static_subtract(a: Int32, b: Int32) -> Int32 { +public func _bjs_MathUtils_static_subtract(_ a: Int32, _ b: Int32) -> Int32 { #if arch(wasm32) let ret = MathUtils.subtract(a: Int.bridgeJSLiftParameter(a), b: Int.bridgeJSLiftParameter(b)) return ret.bridgeJSLowerReturn() @@ -151,7 +151,7 @@ public func _bjs_MathUtils_static_subtract(a: Int32, b: Int32) -> Int32 { @_expose(wasm, "bjs_MathUtils_static_add") @_cdecl("bjs_MathUtils_static_add") -public func _bjs_MathUtils_static_add(a: Int32, b: Int32) -> Int32 { +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() @@ -162,7 +162,7 @@ public func _bjs_MathUtils_static_add(a: Int32, b: Int32) -> Int32 { @_expose(wasm, "bjs_MathUtils_multiply") @_cdecl("bjs_MathUtils_multiply") -public func _bjs_MathUtils_multiply(_self: UnsafeMutableRawPointer, x: Int32, y: Int32) -> Int32 { +public func _bjs_MathUtils_multiply(_ _self: UnsafeMutableRawPointer, _ x: Int32, _ y: Int32) -> Int32 { #if arch(wasm32) let ret = MathUtils.bridgeJSLiftParameter(_self).multiply(x: Int.bridgeJSLiftParameter(x), y: Int.bridgeJSLiftParameter(y)) return ret.bridgeJSLowerReturn() @@ -173,8 +173,12 @@ public func _bjs_MathUtils_multiply(_self: UnsafeMutableRawPointer, x: Int32, y: @_expose(wasm, "bjs_MathUtils_deinit") @_cdecl("bjs_MathUtils_deinit") -public func _bjs_MathUtils_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -185,9 +189,9 @@ extension MathUtils: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MathUtils_wrap") -fileprivate func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift index 81ea282fe..8ea228dc5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift @@ -43,7 +43,7 @@ extension Calculator: _BridgedSwiftCaseEnum { @_expose(wasm, "bjs_Calculator_static_square") @_cdecl("bjs_Calculator_static_square") -public func _bjs_Calculator_static_square(value: Int32) -> Int32 { +public func _bjs_Calculator_static_square(_ value: Int32) -> Int32 { #if arch(wasm32) let ret = Calculator.square(value: Int.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -107,7 +107,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_expose(wasm, "bjs_APIResult_static_roundtrip") @_cdecl("bjs_APIResult_static_roundtrip") -public func _bjs_APIResult_static_roundtrip(value: Int32) -> Void { +public func _bjs_APIResult_static_roundtrip(_ value: Int32) -> Void { #if arch(wasm32) let ret = APIResult.roundtrip(value: APIResult.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -118,7 +118,7 @@ public func _bjs_APIResult_static_roundtrip(value: Int32) -> Void { @_expose(wasm, "bjs_Utils_String_static_uppercase") @_cdecl("bjs_Utils_String_static_uppercase") -public func _bjs_Utils_String_static_uppercase(textBytes: Int32, textLength: Int32) -> Void { +public func _bjs_Utils_String_static_uppercase(_ textBytes: Int32, _ textLength: Int32) -> Void { #if arch(wasm32) let ret = Utils.String.uppercase(_: String.bridgeJSLiftParameter(textBytes, textLength)) return ret.bridgeJSLowerReturn() @@ -140,7 +140,7 @@ public func _bjs_MathUtils_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_MathUtils_static_subtract") @_cdecl("bjs_MathUtils_static_subtract") -public func _bjs_MathUtils_static_subtract(a: Int32, b: Int32) -> Int32 { +public func _bjs_MathUtils_static_subtract(_ a: Int32, _ b: Int32) -> Int32 { #if arch(wasm32) let ret = MathUtils.subtract(a: Int.bridgeJSLiftParameter(a), b: Int.bridgeJSLiftParameter(b)) return ret.bridgeJSLowerReturn() @@ -151,7 +151,7 @@ public func _bjs_MathUtils_static_subtract(a: Int32, b: Int32) -> Int32 { @_expose(wasm, "bjs_MathUtils_static_add") @_cdecl("bjs_MathUtils_static_add") -public func _bjs_MathUtils_static_add(a: Int32, b: Int32) -> Int32 { +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() @@ -162,7 +162,7 @@ public func _bjs_MathUtils_static_add(a: Int32, b: Int32) -> Int32 { @_expose(wasm, "bjs_MathUtils_multiply") @_cdecl("bjs_MathUtils_multiply") -public func _bjs_MathUtils_multiply(_self: UnsafeMutableRawPointer, x: Int32, y: Int32) -> Int32 { +public func _bjs_MathUtils_multiply(_ _self: UnsafeMutableRawPointer, _ x: Int32, _ y: Int32) -> Int32 { #if arch(wasm32) let ret = MathUtils.bridgeJSLiftParameter(_self).multiply(x: Int.bridgeJSLiftParameter(x), y: Int.bridgeJSLiftParameter(y)) return ret.bridgeJSLowerReturn() @@ -173,8 +173,12 @@ public func _bjs_MathUtils_multiply(_self: UnsafeMutableRawPointer, x: Int32, y: @_expose(wasm, "bjs_MathUtils_deinit") @_cdecl("bjs_MathUtils_deinit") -public func _bjs_MathUtils_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -185,9 +189,9 @@ extension MathUtils: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MathUtils_wrap") -fileprivate func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift index e34f26f8c..91577ebfc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift @@ -54,7 +54,7 @@ public func _bjs_PropertyEnum_static_enumProperty_get() -> Void { @_expose(wasm, "bjs_PropertyEnum_static_enumProperty_set") @_cdecl("bjs_PropertyEnum_static_enumProperty_set") -public func _bjs_PropertyEnum_static_enumProperty_set(valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_PropertyEnum_static_enumProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) PropertyEnum.enumProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -86,7 +86,7 @@ public func _bjs_PropertyEnum_static_computedEnum_get() -> Void { @_expose(wasm, "bjs_PropertyEnum_static_computedEnum_set") @_cdecl("bjs_PropertyEnum_static_computedEnum_set") -public func _bjs_PropertyEnum_static_computedEnum_set(valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_PropertyEnum_static_computedEnum_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) PropertyEnum.computedEnum = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -107,7 +107,7 @@ public func _bjs_PropertyNamespace_static_namespaceProperty_get() -> Void { @_expose(wasm, "bjs_PropertyNamespace_static_namespaceProperty_set") @_cdecl("bjs_PropertyNamespace_static_namespaceProperty_set") -public func _bjs_PropertyNamespace_static_namespaceProperty_set(valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_PropertyNamespace_static_namespaceProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) PropertyNamespace.namespaceProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -139,7 +139,7 @@ public func _bjs_PropertyNamespace_Nested_static_nestedProperty_get() -> Int32 { @_expose(wasm, "bjs_PropertyNamespace_Nested_static_nestedProperty_set") @_cdecl("bjs_PropertyNamespace_Nested_static_nestedProperty_set") -public func _bjs_PropertyNamespace_Nested_static_nestedProperty_set(value: Int32) -> Void { +public func _bjs_PropertyNamespace_Nested_static_nestedProperty_set(_ value: Int32) -> Void { #if arch(wasm32) PropertyNamespace.Nested.nestedProperty = Int.bridgeJSLiftParameter(value) #else @@ -171,7 +171,7 @@ public func _bjs_PropertyNamespace_Nested_static_nestedDouble_get() -> Float64 { @_expose(wasm, "bjs_PropertyNamespace_Nested_static_nestedDouble_set") @_cdecl("bjs_PropertyNamespace_Nested_static_nestedDouble_set") -public func _bjs_PropertyNamespace_Nested_static_nestedDouble_set(value: Float64) -> Void { +public func _bjs_PropertyNamespace_Nested_static_nestedDouble_set(_ value: Float64) -> Void { #if arch(wasm32) PropertyNamespace.Nested.nestedDouble = Double.bridgeJSLiftParameter(value) #else @@ -214,7 +214,7 @@ public func _bjs_PropertyClass_static_staticVariable_get() -> Int32 { @_expose(wasm, "bjs_PropertyClass_static_staticVariable_set") @_cdecl("bjs_PropertyClass_static_staticVariable_set") -public func _bjs_PropertyClass_static_staticVariable_set(value: Int32) -> Void { +public func _bjs_PropertyClass_static_staticVariable_set(_ value: Int32) -> Void { #if arch(wasm32) PropertyClass.staticVariable = Int.bridgeJSLiftParameter(value) #else @@ -235,7 +235,7 @@ public func _bjs_PropertyClass_static_jsObjectProperty_get() -> Int32 { @_expose(wasm, "bjs_PropertyClass_static_jsObjectProperty_set") @_cdecl("bjs_PropertyClass_static_jsObjectProperty_set") -public func _bjs_PropertyClass_static_jsObjectProperty_set(value: Int32) -> Void { +public func _bjs_PropertyClass_static_jsObjectProperty_set(_ value: Int32) -> Void { #if arch(wasm32) PropertyClass.jsObjectProperty = JSObject.bridgeJSLiftParameter(value) #else @@ -256,7 +256,7 @@ public func _bjs_PropertyClass_static_classVariable_get() -> Void { @_expose(wasm, "bjs_PropertyClass_static_classVariable_set") @_cdecl("bjs_PropertyClass_static_classVariable_set") -public func _bjs_PropertyClass_static_classVariable_set(valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_PropertyClass_static_classVariable_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) PropertyClass.classVariable = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -277,7 +277,7 @@ public func _bjs_PropertyClass_static_computedProperty_get() -> Void { @_expose(wasm, "bjs_PropertyClass_static_computedProperty_set") @_cdecl("bjs_PropertyClass_static_computedProperty_set") -public func _bjs_PropertyClass_static_computedProperty_set(valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_PropertyClass_static_computedProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) PropertyClass.computedProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -309,7 +309,7 @@ public func _bjs_PropertyClass_static_optionalProperty_get() -> Void { @_expose(wasm, "bjs_PropertyClass_static_optionalProperty_set") @_cdecl("bjs_PropertyClass_static_optionalProperty_set") -public func _bjs_PropertyClass_static_optionalProperty_set(valueIsSome: Int32, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_PropertyClass_static_optionalProperty_set(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) PropertyClass.optionalProperty = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) #else @@ -319,8 +319,12 @@ public func _bjs_PropertyClass_static_optionalProperty_set(valueIsSome: Int32, v @_expose(wasm, "bjs_PropertyClass_deinit") @_cdecl("bjs_PropertyClass_deinit") -public func _bjs_PropertyClass_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_PropertyClass_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension PropertyClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -331,9 +335,9 @@ extension PropertyClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_PropertyClass_wrap") -fileprivate func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PropertyClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PropertyClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift index e34f26f8c..91577ebfc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift @@ -54,7 +54,7 @@ public func _bjs_PropertyEnum_static_enumProperty_get() -> Void { @_expose(wasm, "bjs_PropertyEnum_static_enumProperty_set") @_cdecl("bjs_PropertyEnum_static_enumProperty_set") -public func _bjs_PropertyEnum_static_enumProperty_set(valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_PropertyEnum_static_enumProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) PropertyEnum.enumProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -86,7 +86,7 @@ public func _bjs_PropertyEnum_static_computedEnum_get() -> Void { @_expose(wasm, "bjs_PropertyEnum_static_computedEnum_set") @_cdecl("bjs_PropertyEnum_static_computedEnum_set") -public func _bjs_PropertyEnum_static_computedEnum_set(valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_PropertyEnum_static_computedEnum_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) PropertyEnum.computedEnum = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -107,7 +107,7 @@ public func _bjs_PropertyNamespace_static_namespaceProperty_get() -> Void { @_expose(wasm, "bjs_PropertyNamespace_static_namespaceProperty_set") @_cdecl("bjs_PropertyNamespace_static_namespaceProperty_set") -public func _bjs_PropertyNamespace_static_namespaceProperty_set(valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_PropertyNamespace_static_namespaceProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) PropertyNamespace.namespaceProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -139,7 +139,7 @@ public func _bjs_PropertyNamespace_Nested_static_nestedProperty_get() -> Int32 { @_expose(wasm, "bjs_PropertyNamespace_Nested_static_nestedProperty_set") @_cdecl("bjs_PropertyNamespace_Nested_static_nestedProperty_set") -public func _bjs_PropertyNamespace_Nested_static_nestedProperty_set(value: Int32) -> Void { +public func _bjs_PropertyNamespace_Nested_static_nestedProperty_set(_ value: Int32) -> Void { #if arch(wasm32) PropertyNamespace.Nested.nestedProperty = Int.bridgeJSLiftParameter(value) #else @@ -171,7 +171,7 @@ public func _bjs_PropertyNamespace_Nested_static_nestedDouble_get() -> Float64 { @_expose(wasm, "bjs_PropertyNamespace_Nested_static_nestedDouble_set") @_cdecl("bjs_PropertyNamespace_Nested_static_nestedDouble_set") -public func _bjs_PropertyNamespace_Nested_static_nestedDouble_set(value: Float64) -> Void { +public func _bjs_PropertyNamespace_Nested_static_nestedDouble_set(_ value: Float64) -> Void { #if arch(wasm32) PropertyNamespace.Nested.nestedDouble = Double.bridgeJSLiftParameter(value) #else @@ -214,7 +214,7 @@ public func _bjs_PropertyClass_static_staticVariable_get() -> Int32 { @_expose(wasm, "bjs_PropertyClass_static_staticVariable_set") @_cdecl("bjs_PropertyClass_static_staticVariable_set") -public func _bjs_PropertyClass_static_staticVariable_set(value: Int32) -> Void { +public func _bjs_PropertyClass_static_staticVariable_set(_ value: Int32) -> Void { #if arch(wasm32) PropertyClass.staticVariable = Int.bridgeJSLiftParameter(value) #else @@ -235,7 +235,7 @@ public func _bjs_PropertyClass_static_jsObjectProperty_get() -> Int32 { @_expose(wasm, "bjs_PropertyClass_static_jsObjectProperty_set") @_cdecl("bjs_PropertyClass_static_jsObjectProperty_set") -public func _bjs_PropertyClass_static_jsObjectProperty_set(value: Int32) -> Void { +public func _bjs_PropertyClass_static_jsObjectProperty_set(_ value: Int32) -> Void { #if arch(wasm32) PropertyClass.jsObjectProperty = JSObject.bridgeJSLiftParameter(value) #else @@ -256,7 +256,7 @@ public func _bjs_PropertyClass_static_classVariable_get() -> Void { @_expose(wasm, "bjs_PropertyClass_static_classVariable_set") @_cdecl("bjs_PropertyClass_static_classVariable_set") -public func _bjs_PropertyClass_static_classVariable_set(valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_PropertyClass_static_classVariable_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) PropertyClass.classVariable = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -277,7 +277,7 @@ public func _bjs_PropertyClass_static_computedProperty_get() -> Void { @_expose(wasm, "bjs_PropertyClass_static_computedProperty_set") @_cdecl("bjs_PropertyClass_static_computedProperty_set") -public func _bjs_PropertyClass_static_computedProperty_set(valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_PropertyClass_static_computedProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) PropertyClass.computedProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -309,7 +309,7 @@ public func _bjs_PropertyClass_static_optionalProperty_get() -> Void { @_expose(wasm, "bjs_PropertyClass_static_optionalProperty_set") @_cdecl("bjs_PropertyClass_static_optionalProperty_set") -public func _bjs_PropertyClass_static_optionalProperty_set(valueIsSome: Int32, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_PropertyClass_static_optionalProperty_set(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) PropertyClass.optionalProperty = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) #else @@ -319,8 +319,12 @@ public func _bjs_PropertyClass_static_optionalProperty_set(valueIsSome: Int32, v @_expose(wasm, "bjs_PropertyClass_deinit") @_cdecl("bjs_PropertyClass_deinit") -public func _bjs_PropertyClass_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_PropertyClass_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension PropertyClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -331,9 +335,9 @@ extension PropertyClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_PropertyClass_wrap") -fileprivate func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PropertyClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PropertyClass_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PropertyClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift index 2a43d7bf3..6e32c00d3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift @@ -8,7 +8,7 @@ @_expose(wasm, "bjs_checkString") @_cdecl("bjs_checkString") -public func _bjs_checkString(aBytes: Int32, aLength: Int32) -> Void { +public func _bjs_checkString(_ aBytes: Int32, _ aLength: Int32) -> Void { #if arch(wasm32) checkString(a: String.bridgeJSLiftParameter(aBytes, aLength)) #else @@ -18,7 +18,7 @@ public func _bjs_checkString(aBytes: Int32, aLength: Int32) -> Void { @_expose(wasm, "bjs_roundtripString") @_cdecl("bjs_roundtripString") -public func _bjs_roundtripString(aBytes: Int32, aLength: Int32) -> Void { +public func _bjs_roundtripString(_ aBytes: Int32, _ aLength: Int32) -> Void { #if arch(wasm32) let ret = roundtripString(a: String.bridgeJSLiftParameter(aBytes, aLength)) return ret.bridgeJSLowerReturn() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift index 097f73a97..652792106 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift @@ -8,7 +8,7 @@ @_expose(wasm, "bjs_takeGreeter") @_cdecl("bjs_takeGreeter") -public func _bjs_takeGreeter(greeter: UnsafeMutableRawPointer) -> Void { +public func _bjs_takeGreeter(_ greeter: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) takeGreeter(greeter: Greeter.bridgeJSLiftParameter(greeter)) #else @@ -18,7 +18,7 @@ public func _bjs_takeGreeter(greeter: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Greeter_init") @_cdecl("bjs_Greeter_init") -public func _bjs_Greeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_Greeter_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Greeter(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -29,7 +29,7 @@ public func _bjs_Greeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMuta @_expose(wasm, "bjs_Greeter_greet") @_cdecl("bjs_Greeter_greet") -public func _bjs_Greeter_greet(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Greeter_greet(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).greet() return ret.bridgeJSLowerReturn() @@ -40,7 +40,7 @@ public func _bjs_Greeter_greet(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Greeter_changeName") @_cdecl("bjs_Greeter_changeName") -public func _bjs_Greeter_changeName(_self: UnsafeMutableRawPointer, nameBytes: Int32, nameLength: Int32) -> Void { +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 @@ -50,7 +50,7 @@ public func _bjs_Greeter_changeName(_self: UnsafeMutableRawPointer, nameBytes: I @_expose(wasm, "bjs_Greeter_name_get") @_cdecl("bjs_Greeter_name_get") -public func _bjs_Greeter_name_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Greeter_name_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).name return ret.bridgeJSLowerReturn() @@ -61,7 +61,7 @@ public func _bjs_Greeter_name_get(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Greeter_name_set") @_cdecl("bjs_Greeter_name_set") -public func _bjs_Greeter_name_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +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 @@ -71,8 +71,12 @@ public func _bjs_Greeter_name_set(_self: UnsafeMutableRawPointer, valueBytes: In @_expose(wasm, "bjs_Greeter_deinit") @_cdecl("bjs_Greeter_deinit") -public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -83,17 +87,21 @@ extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") -fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_PublicGreeter_deinit") @_cdecl("bjs_PublicGreeter_deinit") -public func _bjs_PublicGreeter_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -104,17 +112,21 @@ extension PublicGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_PublicGreeter_wrap") -fileprivate func _bjs_PublicGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PublicGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PublicGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PublicGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_PackageGreeter_deinit") @_cdecl("bjs_PackageGreeter_deinit") -public func _bjs_PackageGreeter_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -125,9 +137,9 @@ extension PackageGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_PackageGreeter_wrap") -fileprivate func _bjs_PackageGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PackageGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PackageGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PackageGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift index c036a7973..2e57a8a56 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift @@ -6,8 +6,14 @@ @_spi(BridgeJS) import JavaScriptKit +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si") -fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_10TestModule10HttpStatusO_Si: _BridgedSwiftClosureBox { let closure: (HttpStatus) -> Int @@ -21,23 +27,24 @@ private enum _BJS_Closure_10TestModule10HttpStatusO_Si { let box = _BJS_ClosureBox_10TestModule10HttpStatusO_Si(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> Int { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return Int.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_TestModule_10TestModule10HttpStatusO_Si(callbackValue, param0Value) + return Int.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si") @_cdecl("invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si") -public func _invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { +public func _invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_10TestModule10HttpStatusO_Si>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(HttpStatus.bridgeJSLiftParameter(param0)) @@ -47,8 +54,14 @@ public func _invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si(boxPtr #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule5ThemeO_SS") -fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_SS(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_SS(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_10TestModule5ThemeO_SS: _BridgedSwiftClosureBox { let closure: (Theme) -> String @@ -62,23 +75,24 @@ private enum _BJS_Closure_10TestModule5ThemeO_SS { let box = _BJS_ClosureBox_10TestModule5ThemeO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_TestModule_10TestModule5ThemeO_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_TestModule_10TestModule5ThemeO_SS(callbackValue, param0Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule5ThemeO_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModule5ThemeO_SS") -public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_SS(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Void { +public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_10TestModule5ThemeO_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) @@ -88,8 +102,14 @@ public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_SS(boxPtr: Unsa #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule5ThemeO_Sb") -fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_Sb(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_10TestModule5ThemeO_Sb: _BridgedSwiftClosureBox { let closure: (Theme) -> Bool @@ -103,23 +123,24 @@ private enum _BJS_Closure_10TestModule5ThemeO_Sb { let box = _BJS_ClosureBox_10TestModule5ThemeO_Sb(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Bool { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_TestModule_10TestModule5ThemeO_Sb(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return Bool.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_TestModule_10TestModule5ThemeO_Sb(callbackValue, param0Value) + return Bool.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb") @_cdecl("invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb") -public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Int32 { +public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_10TestModule5ThemeO_Sb>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) @@ -129,8 +150,14 @@ public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb(boxPtr: Unsa #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule6PersonC_SS") -fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_SS(_: Int32, _: UnsafeMutableRawPointer) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_SS(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_SS(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_10TestModule6PersonC_SS: _BridgedSwiftClosureBox { let closure: (Person) -> String @@ -144,23 +171,24 @@ private enum _BJS_Closure_10TestModule6PersonC_SS { let box = _BJS_ClosureBox_10TestModule6PersonC_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Person) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_TestModule_10TestModule6PersonC_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_TestModule_10TestModule6PersonC_SS(callbackValue, param0Pointer) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule6PersonC_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModule6PersonC_SS") -public func _invoke_swift_closure_TestModule_10TestModule6PersonC_SS(boxPtr: UnsafeMutableRawPointer, param0: UnsafeMutableRawPointer) -> Void { +public func _invoke_swift_closure_TestModule_10TestModule6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_10TestModule6PersonC_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Person.bridgeJSLiftParameter(param0)) @@ -170,8 +198,14 @@ public func _invoke_swift_closure_TestModule_10TestModule6PersonC_SS(boxPtr: Uns #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9APIResultO_SS") -fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_SS(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_SS(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_10TestModule9APIResultO_SS: _BridgedSwiftClosureBox { let closure: (APIResult) -> String @@ -185,23 +219,24 @@ private enum _BJS_Closure_10TestModule9APIResultO_SS { let box = _BJS_ClosureBox_10TestModule9APIResultO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_TestModule_10TestModule9APIResultO_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_TestModule_10TestModule9APIResultO_SS(callbackValue, param0CaseId) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9APIResultO_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModule9APIResultO_SS") -public func _invoke_swift_closure_TestModule_10TestModule9APIResultO_SS(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Void { +public func _invoke_swift_closure_TestModule_10TestModule9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_10TestModule9APIResultO_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(APIResult.bridgeJSLiftParameter(param0)) @@ -211,8 +246,14 @@ public func _invoke_swift_closure_TestModule_10TestModule9APIResultO_SS(boxPtr: #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9DirectionO_SS") -fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_SS(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_SS(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_10TestModule9DirectionO_SS: _BridgedSwiftClosureBox { let closure: (Direction) -> String @@ -226,23 +267,24 @@ private enum _BJS_Closure_10TestModule9DirectionO_SS { let box = _BJS_ClosureBox_10TestModule9DirectionO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_TestModule_10TestModule9DirectionO_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_TestModule_10TestModule9DirectionO_SS(callbackValue, param0Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9DirectionO_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModule9DirectionO_SS") -public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_SS(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Void { +public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_10TestModule9DirectionO_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Direction.bridgeJSLiftParameter(param0)) @@ -252,8 +294,14 @@ public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_SS(boxPtr: #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9DirectionO_Sb") -fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_Sb(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_10TestModule9DirectionO_Sb: _BridgedSwiftClosureBox { let closure: (Direction) -> Bool @@ -267,23 +315,24 @@ private enum _BJS_Closure_10TestModule9DirectionO_Sb { let box = _BJS_ClosureBox_10TestModule9DirectionO_Sb(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Bool { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_TestModule_10TestModule9DirectionO_Sb(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return Bool.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_TestModule_10TestModule9DirectionO_Sb(callbackValue, param0Value) + return Bool.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb") @_cdecl("invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb") -public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb(boxPtr: UnsafeMutableRawPointer, param0: Int32) -> Int32 { +public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_10TestModule9DirectionO_Sb>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Direction.bridgeJSLiftParameter(param0)) @@ -293,8 +342,14 @@ public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb(boxPtr: #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSS_SS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_10TestModuleSS_SS: _BridgedSwiftClosureBox { let closure: (String) -> String @@ -308,23 +363,24 @@ private enum _BJS_Closure_10TestModuleSS_SS { let box = _BJS_ClosureBox_10TestModuleSS_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_TestModule_10TestModuleSS_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_TestModule_10TestModuleSS_SS(callbackValue, param0Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSS_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModuleSS_SS") -public func _invoke_swift_closure_TestModule_10TestModuleSS_SS(boxPtr: UnsafeMutableRawPointer, param0Bytes: Int32, param0Length: Int32) -> Void { +public func _invoke_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_10TestModuleSS_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) @@ -334,8 +390,14 @@ public func _invoke_swift_closure_TestModule_10TestModuleSS_SS(boxPtr: UnsafeMut #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS(_: Int32, _: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_10TestModuleSq5ThemeO_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String @@ -349,24 +411,24 @@ private enum _BJS_Closure_10TestModuleSq5ThemeO_SS { let box = _BJS_ClosureBox_10TestModuleSq5ThemeO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_TestModule_10TestModuleSq5ThemeO_SS(callbackValue, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS") -public func _invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Bytes: Int32, param0Length: Int32) -> Void { +public func _invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq5ThemeO_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) @@ -376,8 +438,14 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(boxPtr: Un #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_: Int32, _: Int32, _: UnsafeMutableRawPointer, _: Int32, _: Int32, _: Int32, _: Float64) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer, _ param1IsSome: Int32, _ param1Value: Int32, _ param2IsSome: Int32, _ param2Value: Float64) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer, _ param1IsSome: Int32, _ param1Value: Int32, _ param2IsSome: Int32, _ param2Value: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_10TestModuleSq6PersonCSqSSSqSd_SS: _BridgedSwiftClosureBox { let closure: (Optional, Optional, Optional) -> String @@ -391,26 +459,26 @@ private enum _BJS_Closure_10TestModuleSq6PersonCSqSSSqSd_SS { let box = _BJS_ClosureBox_10TestModuleSq6PersonCSqSSSqSd_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional, Optional, Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0, param1, param2 in - #if arch(wasm32) - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() -let (param1IsSome, param1Value) = param1.bridgeJSLowerParameterWithPresence() -let (param2IsSome, param2Value) = param2.bridgeJSLowerParameterWithPresence() -let resultId = invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value, param1IsSome, param1Value, param2IsSome, param2Value) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0, param1, param2 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let (param0IsSome, param0Pointer) = param0.bridgeJSLowerParameter() + let (param1IsSome, param1Value) = param1.bridgeJSLowerParameter() + let (param2IsSome, param2Value) = param2.bridgeJSLowerParameter() + let ret = invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(callbackValue, param0IsSome, param0Pointer, param1IsSome, param1Value, param2IsSome, param2Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") -public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: UnsafeMutableRawPointer, param1IsSome: Int32, param1Bytes: Int32, param1Length: Int32, param2IsSome: Int32, param2Value: Float64) -> Void { +public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: UnsafeMutableRawPointer, _ param1IsSome: Int32, _ param1Bytes: Int32, _ param1Length: Int32, _ param2IsSome: Int32, _ param2Value: Float64) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq6PersonCSqSSSqSd_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value), Optional.bridgeJSLiftParameter(param1IsSome, param1Bytes, param1Length), Optional.bridgeJSLiftParameter(param2IsSome, param2Value)) @@ -420,8 +488,14 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(b #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS(_: Int32, _: Int32, _: UnsafeMutableRawPointer) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_10TestModuleSq6PersonC_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String @@ -435,24 +509,24 @@ private enum _BJS_Closure_10TestModuleSq6PersonC_SS { let box = _BJS_ClosureBox_10TestModuleSq6PersonC_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() -let resultId = invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_TestModule_10TestModuleSq6PersonC_SS(callbackValue, param0IsSome, param0Pointer) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS") -public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: UnsafeMutableRawPointer) -> Void { +public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq6PersonC_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) @@ -462,8 +536,14 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS(boxPtr: U #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS(_: Int32, _: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_10TestModuleSq9APIResultO_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String @@ -477,24 +557,24 @@ private enum _BJS_Closure_10TestModuleSq9APIResultO_SS { let box = _BJS_ClosureBox_10TestModuleSq9APIResultO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_TestModule_10TestModuleSq9APIResultO_SS(callbackValue, param0IsSome, param0CaseId) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS") -public func _invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0CaseId: Int32) -> Void { +public func _invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq9APIResultO_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0CaseId)) @@ -504,8 +584,14 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(boxPtr #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS(_: Int32, _: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_10TestModuleSq9DirectionO_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String @@ -519,24 +605,24 @@ private enum _BJS_Closure_10TestModuleSq9DirectionO_SS { let box = _BJS_ClosureBox_10TestModuleSq9DirectionO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_TestModule_10TestModuleSq9DirectionO_SS(callbackValue, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS") -public func _invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(boxPtr: UnsafeMutableRawPointer, param0IsSome: Int32, param0Value: Int32) -> Void { +public func _invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq9DirectionO_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) @@ -680,7 +766,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_expose(wasm, "bjs_Person_init") @_cdecl("bjs_Person_init") -public func _bjs_Person_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_Person_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Person(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -691,8 +777,12 @@ public func _bjs_Person_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMutab @_expose(wasm, "bjs_Person_deinit") @_cdecl("bjs_Person_deinit") -public func _bjs_Person_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_Person_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension Person: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -703,16 +793,16 @@ extension Person: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Person_wrap") -fileprivate func _bjs_Person_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Person_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Person_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Person_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_TestProcessor_init") @_cdecl("bjs_TestProcessor_init") -public func _bjs_TestProcessor_init(transform: Int32) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_init(_ transform: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor(transform: _BJS_Closure_10TestModuleSS_SS.bridgeJSLift(transform)) return ret.bridgeJSLowerReturn() @@ -723,7 +813,7 @@ public func _bjs_TestProcessor_init(transform: Int32) -> UnsafeMutableRawPointer @_expose(wasm, "bjs_TestProcessor_getTransform") @_cdecl("bjs_TestProcessor_getTransform") -public func _bjs_TestProcessor_getTransform(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_getTransform(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).getTransform() return _BJS_Closure_10TestModuleSS_SS.bridgeJSLower(ret) @@ -734,7 +824,7 @@ public func _bjs_TestProcessor_getTransform(_self: UnsafeMutableRawPointer) -> U @_expose(wasm, "bjs_TestProcessor_processWithCustom") @_cdecl("bjs_TestProcessor_processWithCustom") -public func _bjs_TestProcessor_processWithCustom(_self: UnsafeMutableRawPointer, textBytes: Int32, textLength: Int32, customTransform: Int32) -> Void { +public func _bjs_TestProcessor_processWithCustom(_ _self: UnsafeMutableRawPointer, _ textBytes: Int32, _ textLength: Int32, _ customTransform: Int32) -> Void { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).processWithCustom(_: String.bridgeJSLiftParameter(textBytes, textLength), customTransform: _BJS_Closure_10TestModuleSS_SS.bridgeJSLift(customTransform)) return ret.bridgeJSLowerReturn() @@ -745,7 +835,7 @@ public func _bjs_TestProcessor_processWithCustom(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_TestProcessor_printTogether") @_cdecl("bjs_TestProcessor_printTogether") -public func _bjs_TestProcessor_printTogether(_self: UnsafeMutableRawPointer, person: UnsafeMutableRawPointer, nameBytes: Int32, nameLength: Int32, ratio: Float64, customTransform: Int32) -> Void { +public func _bjs_TestProcessor_printTogether(_ _self: UnsafeMutableRawPointer, _ person: UnsafeMutableRawPointer, _ nameBytes: Int32, _ nameLength: Int32, _ ratio: Float64, _ customTransform: Int32) -> Void { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).printTogether(person: Person.bridgeJSLiftParameter(person), name: String.bridgeJSLiftParameter(nameBytes, nameLength), ratio: Double.bridgeJSLiftParameter(ratio), customTransform: _BJS_Closure_10TestModuleSq6PersonCSqSSSqSd_SS.bridgeJSLift(customTransform)) return ret.bridgeJSLowerReturn() @@ -756,7 +846,7 @@ public func _bjs_TestProcessor_printTogether(_self: UnsafeMutableRawPointer, per @_expose(wasm, "bjs_TestProcessor_roundtrip") @_cdecl("bjs_TestProcessor_roundtrip") -public func _bjs_TestProcessor_roundtrip(_self: UnsafeMutableRawPointer, personClosure: Int32) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_roundtrip(_ _self: UnsafeMutableRawPointer, _ personClosure: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).roundtrip(_: _BJS_Closure_10TestModule6PersonC_SS.bridgeJSLift(personClosure)) return _BJS_Closure_10TestModule6PersonC_SS.bridgeJSLower(ret) @@ -767,7 +857,7 @@ public func _bjs_TestProcessor_roundtrip(_self: UnsafeMutableRawPointer, personC @_expose(wasm, "bjs_TestProcessor_roundtripOptional") @_cdecl("bjs_TestProcessor_roundtripOptional") -public func _bjs_TestProcessor_roundtripOptional(_self: UnsafeMutableRawPointer, personClosure: Int32) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_roundtripOptional(_ _self: UnsafeMutableRawPointer, _ personClosure: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).roundtripOptional(_: _BJS_Closure_10TestModuleSq6PersonC_SS.bridgeJSLift(personClosure)) return _BJS_Closure_10TestModuleSq6PersonC_SS.bridgeJSLower(ret) @@ -778,7 +868,7 @@ public func _bjs_TestProcessor_roundtripOptional(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_TestProcessor_processDirection") @_cdecl("bjs_TestProcessor_processDirection") -public func _bjs_TestProcessor_processDirection(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +public func _bjs_TestProcessor_processDirection(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).processDirection(_: _BJS_Closure_10TestModule9DirectionO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() @@ -789,7 +879,7 @@ public func _bjs_TestProcessor_processDirection(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_TestProcessor_processTheme") @_cdecl("bjs_TestProcessor_processTheme") -public func _bjs_TestProcessor_processTheme(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +public func _bjs_TestProcessor_processTheme(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).processTheme(_: _BJS_Closure_10TestModule5ThemeO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() @@ -800,7 +890,7 @@ public func _bjs_TestProcessor_processTheme(_self: UnsafeMutableRawPointer, call @_expose(wasm, "bjs_TestProcessor_processHttpStatus") @_cdecl("bjs_TestProcessor_processHttpStatus") -public func _bjs_TestProcessor_processHttpStatus(_self: UnsafeMutableRawPointer, callback: Int32) -> Int32 { +public func _bjs_TestProcessor_processHttpStatus(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Int32 { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).processHttpStatus(_: _BJS_Closure_10TestModule10HttpStatusO_Si.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() @@ -811,7 +901,7 @@ public func _bjs_TestProcessor_processHttpStatus(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_TestProcessor_processAPIResult") @_cdecl("bjs_TestProcessor_processAPIResult") -public func _bjs_TestProcessor_processAPIResult(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +public func _bjs_TestProcessor_processAPIResult(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).processAPIResult(_: _BJS_Closure_10TestModule9APIResultO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() @@ -822,7 +912,7 @@ public func _bjs_TestProcessor_processAPIResult(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_TestProcessor_makeDirectionChecker") @_cdecl("bjs_TestProcessor_makeDirectionChecker") -public func _bjs_TestProcessor_makeDirectionChecker(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() return _BJS_Closure_10TestModule9DirectionO_Sb.bridgeJSLower(ret) @@ -833,7 +923,7 @@ public func _bjs_TestProcessor_makeDirectionChecker(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_TestProcessor_makeThemeValidator") @_cdecl("bjs_TestProcessor_makeThemeValidator") -public func _bjs_TestProcessor_makeThemeValidator(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() return _BJS_Closure_10TestModule5ThemeO_Sb.bridgeJSLower(ret) @@ -844,7 +934,7 @@ public func _bjs_TestProcessor_makeThemeValidator(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_TestProcessor_makeStatusCodeExtractor") @_cdecl("bjs_TestProcessor_makeStatusCodeExtractor") -public func _bjs_TestProcessor_makeStatusCodeExtractor(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() return _BJS_Closure_10TestModule10HttpStatusO_Si.bridgeJSLower(ret) @@ -855,7 +945,7 @@ public func _bjs_TestProcessor_makeStatusCodeExtractor(_self: UnsafeMutableRawPo @_expose(wasm, "bjs_TestProcessor_makeAPIResultHandler") @_cdecl("bjs_TestProcessor_makeAPIResultHandler") -public func _bjs_TestProcessor_makeAPIResultHandler(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_makeAPIResultHandler(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() return _BJS_Closure_10TestModule9APIResultO_SS.bridgeJSLower(ret) @@ -866,7 +956,7 @@ public func _bjs_TestProcessor_makeAPIResultHandler(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_TestProcessor_processOptionalDirection") @_cdecl("bjs_TestProcessor_processOptionalDirection") -public func _bjs_TestProcessor_processOptionalDirection(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +public func _bjs_TestProcessor_processOptionalDirection(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalDirection(_: _BJS_Closure_10TestModuleSq9DirectionO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() @@ -877,7 +967,7 @@ public func _bjs_TestProcessor_processOptionalDirection(_self: UnsafeMutableRawP @_expose(wasm, "bjs_TestProcessor_processOptionalTheme") @_cdecl("bjs_TestProcessor_processOptionalTheme") -public func _bjs_TestProcessor_processOptionalTheme(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +public func _bjs_TestProcessor_processOptionalTheme(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalTheme(_: _BJS_Closure_10TestModuleSq5ThemeO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() @@ -888,7 +978,7 @@ public func _bjs_TestProcessor_processOptionalTheme(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_TestProcessor_processOptionalAPIResult") @_cdecl("bjs_TestProcessor_processOptionalAPIResult") -public func _bjs_TestProcessor_processOptionalAPIResult(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +public func _bjs_TestProcessor_processOptionalAPIResult(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalAPIResult(_: _BJS_Closure_10TestModuleSq9APIResultO_SS.bridgeJSLift(callback)) return ret.bridgeJSLowerReturn() @@ -899,7 +989,7 @@ public func _bjs_TestProcessor_processOptionalAPIResult(_self: UnsafeMutableRawP @_expose(wasm, "bjs_TestProcessor_makeOptionalDirectionFormatter") @_cdecl("bjs_TestProcessor_makeOptionalDirectionFormatter") -public func _bjs_TestProcessor_makeOptionalDirectionFormatter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_makeOptionalDirectionFormatter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() return _BJS_Closure_10TestModuleSq9DirectionO_SS.bridgeJSLower(ret) @@ -910,8 +1000,12 @@ public func _bjs_TestProcessor_makeOptionalDirectionFormatter(_self: UnsafeMutab @_expose(wasm, "bjs_TestProcessor_deinit") @_cdecl("bjs_TestProcessor_deinit") -public func _bjs_TestProcessor_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_TestProcessor_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension TestProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -922,9 +1016,9 @@ extension TestProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_TestProcessor_wrap") -fileprivate func _bjs_TestProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TestProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TestProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift index 57635c626..f35fc3b02 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift @@ -38,7 +38,7 @@ extension DataPoint: _BridgedSwiftStruct { @_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 { +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() @@ -146,7 +146,7 @@ public func _bjs_ConfigStruct_static_defaultConfig_get() -> Void { @_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 { +public func _bjs_ConfigStruct_static_defaultConfig_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) ConfigStruct.defaultConfig = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -167,7 +167,7 @@ public func _bjs_ConfigStruct_static_timeout_get() -> Float64 { @_expose(wasm, "bjs_ConfigStruct_static_timeout_set") @_cdecl("bjs_ConfigStruct_static_timeout_set") -public func _bjs_ConfigStruct_static_timeout_set(value: Float64) -> Void { +public func _bjs_ConfigStruct_static_timeout_set(_ value: Float64) -> Void { #if arch(wasm32) ConfigStruct.timeout = Double.bridgeJSLiftParameter(value) #else @@ -188,7 +188,7 @@ public func _bjs_ConfigStruct_static_computedSetting_get() -> Void { @_expose(wasm, "bjs_ConfigStruct_static_update") @_cdecl("bjs_ConfigStruct_static_update") -public func _bjs_ConfigStruct_static_update(timeout: Float64) -> Float64 { +public func _bjs_ConfigStruct_static_update(_ timeout: Float64) -> Float64 { #if arch(wasm32) let ret = ConfigStruct.update(_: Double.bridgeJSLiftParameter(timeout)) return ret.bridgeJSLowerReturn() @@ -210,7 +210,7 @@ public func _bjs_roundtrip() -> Void { @_expose(wasm, "bjs_Greeter_init") @_cdecl("bjs_Greeter_init") -public func _bjs_Greeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_Greeter_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Greeter(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -221,7 +221,7 @@ public func _bjs_Greeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMuta @_expose(wasm, "bjs_Greeter_greet") @_cdecl("bjs_Greeter_greet") -public func _bjs_Greeter_greet(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Greeter_greet(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).greet() return ret.bridgeJSLowerReturn() @@ -232,7 +232,7 @@ public func _bjs_Greeter_greet(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Greeter_name_get") @_cdecl("bjs_Greeter_name_get") -public func _bjs_Greeter_name_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Greeter_name_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).name return ret.bridgeJSLowerReturn() @@ -243,7 +243,7 @@ public func _bjs_Greeter_name_get(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Greeter_name_set") @_cdecl("bjs_Greeter_name_set") -public func _bjs_Greeter_name_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +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 @@ -253,8 +253,12 @@ public func _bjs_Greeter_name_set(_self: UnsafeMutableRawPointer, valueBytes: In @_expose(wasm, "bjs_Greeter_deinit") @_cdecl("bjs_Greeter_deinit") -public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -265,9 +269,9 @@ extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") -fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift index 1806d8aad..56425b208 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift @@ -16,7 +16,8 @@ fileprivate func bjs_checkArray(_ a: Int32) -> Void { #endif func checkArray(_ a: JSObject) throws(JSException) -> Void { - bjs_checkArray(a.bridgeJSLowerParameter()) + let aValue = a.bridgeJSLowerParameter() + bjs_checkArray(aValue) if let error = _swift_js_take_exception() { throw error } @@ -32,7 +33,9 @@ fileprivate func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void { #endif func checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void { - bjs_checkArrayWithLength(a.bridgeJSLowerParameter(), b.bridgeJSLowerParameter()) + let aValue = a.bridgeJSLowerParameter() + let bValue = b.bridgeJSLowerParameter() + bjs_checkArrayWithLength(aValue, bValue) if let error = _swift_js_take_exception() { throw error } @@ -48,7 +51,8 @@ fileprivate func bjs_checkArray(_ a: Int32) -> Void { #endif func checkArray(_ a: JSObject) throws(JSException) -> Void { - bjs_checkArray(a.bridgeJSLowerParameter()) + let aValue = a.bridgeJSLowerParameter() + bjs_checkArray(aValue) if let error = _swift_js_take_exception() { throw error } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift index 5e564aa3a..41a89ad2f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift @@ -33,7 +33,8 @@ fileprivate func bjs_asyncRoundTripInt(_ v: Float64) -> Int32 { #endif func asyncRoundTripInt(_ v: Double) throws(JSException) -> JSPromise { - let ret = bjs_asyncRoundTripInt(v.bridgeJSLowerParameter()) + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_asyncRoundTripInt(vValue) if let error = _swift_js_take_exception() { throw error } @@ -50,7 +51,8 @@ fileprivate func bjs_asyncRoundTripString(_ v: Int32) -> Int32 { #endif func asyncRoundTripString(_ v: String) throws(JSException) -> JSPromise { - let ret = bjs_asyncRoundTripString(v.bridgeJSLowerParameter()) + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_asyncRoundTripString(vValue) if let error = _swift_js_take_exception() { throw error } @@ -67,7 +69,8 @@ fileprivate func bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { #endif func asyncRoundTripBool(_ v: Bool) throws(JSException) -> JSPromise { - let ret = bjs_asyncRoundTripBool(v.bridgeJSLowerParameter()) + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_asyncRoundTripBool(vValue) if let error = _swift_js_take_exception() { throw error } @@ -84,7 +87,8 @@ fileprivate func bjs_asyncRoundTripFloat(_ v: Float64) -> Int32 { #endif func asyncRoundTripFloat(_ v: Double) throws(JSException) -> JSPromise { - let ret = bjs_asyncRoundTripFloat(v.bridgeJSLowerParameter()) + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_asyncRoundTripFloat(vValue) if let error = _swift_js_take_exception() { throw error } @@ -101,7 +105,8 @@ fileprivate func bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { #endif func asyncRoundTripDouble(_ v: Double) throws(JSException) -> JSPromise { - let ret = bjs_asyncRoundTripDouble(v.bridgeJSLowerParameter()) + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_asyncRoundTripDouble(vValue) if let error = _swift_js_take_exception() { throw error } @@ -118,7 +123,8 @@ fileprivate func bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { #endif func asyncRoundTripJSObject(_ v: JSObject) throws(JSException) -> JSPromise { - let ret = bjs_asyncRoundTripJSObject(v.bridgeJSLowerParameter()) + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_asyncRoundTripJSObject(vValue) if let error = _swift_js_take_exception() { throw error } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift index 12e04e054..122771716 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift @@ -49,7 +49,10 @@ struct Animatable: _JSBridgedClass { } func animate(_ keyframes: JSObject, _ options: JSObject) throws(JSException) -> JSObject { - let ret = bjs_Animatable_animate(self.bridgeJSLowerParameter(), keyframes.bridgeJSLowerParameter(), options.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let keyframesValue = keyframes.bridgeJSLowerParameter() + let optionsValue = options.bridgeJSLowerParameter() + let ret = bjs_Animatable_animate(selfValue, keyframesValue, optionsValue) if let error = _swift_js_take_exception() { throw error } @@ -57,7 +60,9 @@ struct Animatable: _JSBridgedClass { } func getAnimations(_ options: JSObject) throws(JSException) -> JSObject { - let ret = bjs_Animatable_getAnimations(self.bridgeJSLowerParameter(), options.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let optionsValue = options.bridgeJSLowerParameter() + let ret = bjs_Animatable_getAnimations(selfValue, optionsValue) if let error = _swift_js_take_exception() { throw error } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift index 9fa2feafb..c78682994 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift @@ -67,7 +67,8 @@ struct ArrayBufferLike: _JSBridgedClass { var byteLength: Double { get throws(JSException) { - let ret = bjs_ArrayBufferLike_byteLength_get(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_ArrayBufferLike_byteLength_get(selfValue) if let error = _swift_js_take_exception() { throw error } @@ -76,7 +77,10 @@ struct ArrayBufferLike: _JSBridgedClass { } func slice(_ begin: Double, _ end: Double) throws(JSException) -> ArrayBufferLike { - let ret = bjs_ArrayBufferLike_slice(self.bridgeJSLowerParameter(), begin.bridgeJSLowerParameter(), end.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let beginValue = begin.bridgeJSLowerParameter() + let endValue = end.bridgeJSLowerParameter() + let ret = bjs_ArrayBufferLike_slice(selfValue, beginValue, endValue) if let error = _swift_js_take_exception() { throw error } @@ -157,7 +161,8 @@ struct WeirdNaming: _JSBridgedClass { var normalProperty: String { get throws(JSException) { - let ret = bjs_WeirdNaming_normalProperty_get(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming_normalProperty_get(selfValue) if let error = _swift_js_take_exception() { throw error } @@ -166,7 +171,9 @@ struct WeirdNaming: _JSBridgedClass { } func setNormalProperty(_ newValue: String) throws(JSException) -> Void { - bjs_WeirdNaming_normalProperty_set(self.bridgeJSLowerParameter(), newValue.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_normalProperty_set(selfValue, newValueValue) if let error = _swift_js_take_exception() { throw error } @@ -174,7 +181,8 @@ struct WeirdNaming: _JSBridgedClass { var `for`: String { get throws(JSException) { - let ret = bjs_WeirdNaming_for_get(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming_for_get(selfValue) if let error = _swift_js_take_exception() { throw error } @@ -183,7 +191,9 @@ struct WeirdNaming: _JSBridgedClass { } func setFor(_ newValue: String) throws(JSException) -> Void { - bjs_WeirdNaming_for_set(self.bridgeJSLowerParameter(), newValue.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_for_set(selfValue, newValueValue) if let error = _swift_js_take_exception() { throw error } @@ -191,7 +201,8 @@ struct WeirdNaming: _JSBridgedClass { var `Any`: String { get throws(JSException) { - let ret = bjs_WeirdNaming_Any_get(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming_Any_get(selfValue) if let error = _swift_js_take_exception() { throw error } @@ -200,14 +211,17 @@ struct WeirdNaming: _JSBridgedClass { } func setAny(_ newValue: String) throws(JSException) -> Void { - bjs_WeirdNaming_Any_set(self.bridgeJSLowerParameter(), newValue.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_Any_set(selfValue, newValueValue) if let error = _swift_js_take_exception() { throw error } } func `as`() throws(JSException) -> Void { - bjs_WeirdNaming_as(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + bjs_WeirdNaming_as(selfValue) if let error = _swift_js_take_exception() { throw error } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift index 3102cd6e8..1f8a14800 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift @@ -16,7 +16,8 @@ fileprivate func bjs_createDatabaseConnection(_ config: Int32) -> Int32 { #endif func createDatabaseConnection(_ config: JSObject) throws(JSException) -> DatabaseConnection { - let ret = bjs_createDatabaseConnection(config.bridgeJSLowerParameter()) + let configValue = config.bridgeJSLowerParameter() + let ret = bjs_createDatabaseConnection(configValue) if let error = _swift_js_take_exception() { throw error } @@ -33,7 +34,8 @@ fileprivate func bjs_createLogger(_ level: Int32) -> Int32 { #endif func createLogger(_ level: String) throws(JSException) -> Logger { - let ret = bjs_createLogger(level.bridgeJSLowerParameter()) + let levelValue = level.bridgeJSLowerParameter() + let ret = bjs_createLogger(levelValue) if let error = _swift_js_take_exception() { throw error } @@ -111,7 +113,8 @@ struct DatabaseConnection: _JSBridgedClass { var isConnected: Bool { get throws(JSException) { - let ret = bjs_DatabaseConnection_isConnected_get(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_DatabaseConnection_isConnected_get(selfValue) if let error = _swift_js_take_exception() { throw error } @@ -121,7 +124,8 @@ struct DatabaseConnection: _JSBridgedClass { var connectionTimeout: Double { get throws(JSException) { - let ret = bjs_DatabaseConnection_connectionTimeout_get(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_DatabaseConnection_connectionTimeout_get(selfValue) if let error = _swift_js_take_exception() { throw error } @@ -130,21 +134,27 @@ struct DatabaseConnection: _JSBridgedClass { } func setConnectionTimeout(_ newValue: Double) throws(JSException) -> Void { - bjs_DatabaseConnection_connectionTimeout_set(self.bridgeJSLowerParameter(), newValue.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_DatabaseConnection_connectionTimeout_set(selfValue, newValueValue) if let error = _swift_js_take_exception() { throw error } } func connect(_ url: String) throws(JSException) -> Void { - bjs_DatabaseConnection_connect(self.bridgeJSLowerParameter(), url.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let urlValue = url.bridgeJSLowerParameter() + bjs_DatabaseConnection_connect(selfValue, urlValue) if let error = _swift_js_take_exception() { throw error } } func execute(_ query: String) throws(JSException) -> JSObject { - let ret = bjs_DatabaseConnection_execute(self.bridgeJSLowerParameter(), query.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let queryValue = query.bridgeJSLowerParameter() + let ret = bjs_DatabaseConnection_execute(selfValue, queryValue) if let error = _swift_js_take_exception() { throw error } @@ -189,7 +199,8 @@ struct Logger: _JSBridgedClass { var level: String { get throws(JSException) { - let ret = bjs_Logger_level_get(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Logger_level_get(selfValue) if let error = _swift_js_take_exception() { throw error } @@ -198,14 +209,19 @@ struct Logger: _JSBridgedClass { } func log(_ message: String) throws(JSException) -> Void { - bjs_Logger_log(self.bridgeJSLowerParameter(), message.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let messageValue = message.bridgeJSLowerParameter() + bjs_Logger_log(selfValue, messageValue) if let error = _swift_js_take_exception() { throw error } } func error(_ message: String, _ error: JSObject) throws(JSException) -> Void { - bjs_Logger_error(self.bridgeJSLowerParameter(), message.bridgeJSLowerParameter(), error.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let messageValue = message.bridgeJSLowerParameter() + let errorValue = error.bridgeJSLowerParameter() + bjs_Logger_error(selfValue, messageValue, errorValue) if let error = _swift_js_take_exception() { throw error } @@ -249,7 +265,8 @@ struct ConfigManager: _JSBridgedClass { var configPath: String { get throws(JSException) { - let ret = bjs_ConfigManager_configPath_get(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_ConfigManager_configPath_get(selfValue) if let error = _swift_js_take_exception() { throw error } @@ -258,7 +275,9 @@ struct ConfigManager: _JSBridgedClass { } func get(_ key: String) throws(JSException) -> JSObject { - let ret = bjs_ConfigManager_get(self.bridgeJSLowerParameter(), key.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let keyValue = key.bridgeJSLowerParameter() + let ret = bjs_ConfigManager_get(selfValue, keyValue) if let error = _swift_js_take_exception() { throw error } @@ -266,7 +285,10 @@ struct ConfigManager: _JSBridgedClass { } func set(_ key: String, _ value: JSObject) throws(JSException) -> Void { - bjs_ConfigManager_set(self.bridgeJSLowerParameter(), key.bridgeJSLowerParameter(), value.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let keyValue = key.bridgeJSLowerParameter() + let valueValue = value.bridgeJSLowerParameter() + bjs_ConfigManager_set(selfValue, keyValue, valueValue) if let error = _swift_js_take_exception() { throw error } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift index 2643eaa08..90088799d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift @@ -16,7 +16,9 @@ fileprivate func bjs_check(_ a: Float64, _ b: Int32) -> Void { #endif func check(_ a: Double, _ b: Bool) throws(JSException) -> Void { - bjs_check(a.bridgeJSLowerParameter(), b.bridgeJSLowerParameter()) + let aValue = a.bridgeJSLowerParameter() + let bValue = b.bridgeJSLowerParameter() + bjs_check(aValue, bValue) if let error = _swift_js_take_exception() { throw error } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift index 68b341ca7..35502a7cd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift @@ -16,7 +16,8 @@ fileprivate func bjs_checkString(_ a: Int32) -> Void { #endif func checkString(_ a: String) throws(JSException) -> Void { - bjs_checkString(a.bridgeJSLowerParameter()) + let aValue = a.bridgeJSLowerParameter() + bjs_checkString(aValue) if let error = _swift_js_take_exception() { throw error } @@ -32,7 +33,9 @@ fileprivate func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void { #endif func checkStringWithLength(_ a: String, _ b: Double) throws(JSException) -> Void { - bjs_checkStringWithLength(a.bridgeJSLowerParameter(), b.bridgeJSLowerParameter()) + let aValue = a.bridgeJSLowerParameter() + let bValue = b.bridgeJSLowerParameter() + bjs_checkStringWithLength(aValue, bValue) if let error = _swift_js_take_exception() { throw error } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift index 2e4331c78..26d37a909 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift @@ -33,7 +33,8 @@ fileprivate func bjs_createCodeGenerator(_ format: Int32) -> Int32 { #endif func createCodeGenerator(_ format: String) throws(JSException) -> CodeGenerator { - let ret = bjs_createCodeGenerator(format.bridgeJSLowerParameter()) + let formatValue = format.bridgeJSLowerParameter() + let ret = bjs_createCodeGenerator(formatValue) if let error = _swift_js_take_exception() { throw error } @@ -76,7 +77,8 @@ struct TypeScriptProcessor: _JSBridgedClass { var version: String { get throws(JSException) { - let ret = bjs_TypeScriptProcessor_version_get(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_TypeScriptProcessor_version_get(selfValue) if let error = _swift_js_take_exception() { throw error } @@ -85,7 +87,9 @@ struct TypeScriptProcessor: _JSBridgedClass { } func convert(_ ts: String) throws(JSException) -> String { - let ret = bjs_TypeScriptProcessor_convert(self.bridgeJSLowerParameter(), ts.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let tsValue = ts.bridgeJSLowerParameter() + let ret = bjs_TypeScriptProcessor_convert(selfValue, tsValue) if let error = _swift_js_take_exception() { throw error } @@ -93,7 +97,9 @@ struct TypeScriptProcessor: _JSBridgedClass { } func validate(_ ts: String) throws(JSException) -> Bool { - let ret = bjs_TypeScriptProcessor_validate(self.bridgeJSLowerParameter(), ts.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let tsValue = ts.bridgeJSLowerParameter() + let ret = bjs_TypeScriptProcessor_validate(selfValue, tsValue) if let error = _swift_js_take_exception() { throw error } @@ -129,7 +135,8 @@ struct CodeGenerator: _JSBridgedClass { var outputFormat: String { get throws(JSException) { - let ret = bjs_CodeGenerator_outputFormat_get(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_CodeGenerator_outputFormat_get(selfValue) if let error = _swift_js_take_exception() { throw error } @@ -138,7 +145,9 @@ struct CodeGenerator: _JSBridgedClass { } func generate(_ input: JSObject) throws(JSException) -> String { - let ret = bjs_CodeGenerator_generate(self.bridgeJSLowerParameter(), input.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let inputValue = input.bridgeJSLowerParameter() + let ret = bjs_CodeGenerator_generate(selfValue, inputValue) if let error = _swift_js_take_exception() { throw error } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift index e539e65df..afd99723e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift @@ -16,7 +16,8 @@ fileprivate func bjs_checkSimple(_ a: Float64) -> Void { #endif func checkSimple(_ a: Double) throws(JSException) -> Void { - bjs_checkSimple(a.bridgeJSLowerParameter()) + let aValue = a.bridgeJSLowerParameter() + bjs_checkSimple(aValue) if let error = _swift_js_take_exception() { throw error } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift index 148419de2..6d1bdca34 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift @@ -68,7 +68,8 @@ struct Greeter: _JSBridgedClass { } init(_ name: String) throws(JSException) { - let ret = bjs_Greeter_init(name.bridgeJSLowerParameter()) + let nameValue = name.bridgeJSLowerParameter() + let ret = bjs_Greeter_init(nameValue) if let error = _swift_js_take_exception() { throw error } @@ -77,7 +78,8 @@ struct Greeter: _JSBridgedClass { var name: String { get throws(JSException) { - let ret = bjs_Greeter_name_get(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Greeter_name_get(selfValue) if let error = _swift_js_take_exception() { throw error } @@ -86,7 +88,9 @@ struct Greeter: _JSBridgedClass { } func setName(_ newValue: String) throws(JSException) -> Void { - bjs_Greeter_name_set(self.bridgeJSLowerParameter(), newValue.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_Greeter_name_set(selfValue, newValueValue) if let error = _swift_js_take_exception() { throw error } @@ -94,7 +98,8 @@ struct Greeter: _JSBridgedClass { var age: Double { get throws(JSException) { - let ret = bjs_Greeter_age_get(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Greeter_age_get(selfValue) if let error = _swift_js_take_exception() { throw error } @@ -103,7 +108,8 @@ struct Greeter: _JSBridgedClass { } func greet() throws(JSException) -> String { - let ret = bjs_Greeter_greet(self.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Greeter_greet(selfValue) if let error = _swift_js_take_exception() { throw error } @@ -111,7 +117,9 @@ struct Greeter: _JSBridgedClass { } func changeName(_ name: String) throws(JSException) -> Void { - bjs_Greeter_changeName(self.bridgeJSLowerParameter(), name.bridgeJSLowerParameter()) + let selfValue = self.bridgeJSLowerParameter() + let nameValue = name.bridgeJSLowerParameter() + bjs_Greeter_changeName(selfValue, nameValue) if let error = _swift_js_take_exception() { throw error } diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index b3262cb9e..92ab52f04 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -78,7 +78,6 @@ import _CJavaScriptKit // - `func bridgeJSLowerReturn() -> <#WasmCoreType#>`: lower the given higher-level return value to a Wasm core type // // Optional types (ExportSwift only) additionally define: -// - `func bridgeJSLowerParameterWithPresence()`: lower optional as (isSome, value) tuple for protocol setters/parameters (borrows object) // - `func bridgeJSLowerParameterWithRetain()`: lower optional heap object with ownership transfer for escaping closures // - `func bridgeJSLiftReturnFromSideChannel()`: lift optional from side-channel storage for protocol property getters // @@ -653,7 +652,7 @@ extension Optional where Wrapped == Bool { // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( isSome: Int32, value: Int32 ) { switch consume self { @@ -703,7 +702,7 @@ extension Optional where Wrapped == Int { // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( isSome: Int32, value: Int32 ) { switch consume self { @@ -743,7 +742,7 @@ extension Optional where Wrapped == Int { extension Optional where Wrapped == String { // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( isSome: Int32, value: Int32 ) { switch consume self { @@ -786,7 +785,7 @@ extension Optional where Wrapped == String { extension Optional where Wrapped == JSObject { // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( isSome: Int32, value: Int32 ) { switch consume self { @@ -840,18 +839,7 @@ extension Optional where Wrapped: _BridgedSwiftProtocolWrapper { /// Optional support for Swift heap objects extension Optional where Wrapped: _BridgedSwiftHeapObject { - // MARK: ImportTS - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { - switch consume self { - case .none: - // Return null pointer for nil - return UnsafeMutableRawPointer(bitPattern: 0).unsafelyUnwrapped - case .some(let value): - // Pass unretained pointer since JS will manage the lifetime - return Unmanaged.passUnretained(value).toOpaque() - } - } - + // MARK: ExportSwift /// Lowers optional Swift heap object as (isSome, pointer) tuple for protocol parameters. /// /// This method uses `passUnretained()` because the caller (JavaScript protocol implementation) @@ -859,7 +847,7 @@ extension Optional where Wrapped: _BridgedSwiftHeapObject { /// duration of the call. /// /// - Returns: A tuple containing presence flag (0 for nil, 1 for some) and unretained pointer - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( isSome: Int32, pointer: UnsafeMutableRawPointer ) { switch consume self { @@ -931,13 +919,19 @@ extension Optional where Wrapped: _BridgedSwiftHeapObject { } } extension Optional where Wrapped == Float { - // MARK: ImportTS - - @available(*, unavailable, message: "Optional Float type is not supported to be passed to imported JS functions") - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Void {} - // MARK: ExportSwift + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( + isSome: Int32, value: Float32 + ) { + switch consume self { + case .none: + return (isSome: 0, value: 0.0) + case .some(let wrapped): + return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) + } + } + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Float? { if isSome == 0 { return nil @@ -967,13 +961,19 @@ extension Optional where Wrapped == Float { /// Optional support for Double extension Optional where Wrapped == Double { - // MARK: ImportTS - - @available(*, unavailable, message: "Optional Double type is not supported to be passed to imported JS functions") - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Void {} - // MARK: ExportSwift + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( + isSome: Int32, value: Float64 + ) { + switch consume self { + case .none: + return (isSome: 0, value: 0.0) + case .some(let wrapped): + return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) + } + } + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float64) -> Double? { if isSome == 0 { return nil @@ -1005,7 +1005,7 @@ extension Optional where Wrapped == Double { extension Optional where Wrapped: _BridgedSwiftCaseEnum { // MARK: ExportSwift - @_spi(BridgeJS) public consuming func bridgeJSLowerParameterWithPresence() -> (isSome: Int32, value: Int32) { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { switch consume self { case .none: return (isSome: 0, value: 0) @@ -1061,7 +1061,7 @@ extension Optional where Wrapped: _BridgedSwiftTypeLoweredIntoVoidType { extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == String { // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( isSome: Int32, value: Int32 ) { switch consume self { @@ -1099,7 +1099,7 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Int { // MARK: ExportSwift - @_spi(BridgeJS) public consuming func bridgeJSLowerParameterWithPresence() -> (isSome: Int32, value: Int32) { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { switch consume self { case .none: return (isSome: 0, value: 0) @@ -1146,7 +1146,7 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Float { // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( isSome: Int32, value: Float32 ) { switch consume self { @@ -1181,7 +1181,7 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Double { // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( isSome: Int32, value: Float64 ) { switch consume self { @@ -1218,7 +1218,7 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres extension Optional where Wrapped: _BridgedSwiftAssociatedValueEnum { // MARK: ExportSwift - @_spi(BridgeJS) public consuming func bridgeJSLowerParameterWithPresence() -> (isSome: Int32, caseId: Int32) { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, caseId: Int32) { switch consume self { case .none: return (isSome: 0, caseId: 0) diff --git a/Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift index 8e0c5f187..09cd79ecc 100644 --- a/Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift @@ -103,7 +103,7 @@ public func _bjs_GlobalStaticPropertyNamespace_static_namespaceProperty_get() -> @_expose(wasm, "bjs_GlobalStaticPropertyNamespace_static_namespaceProperty_set") @_cdecl("bjs_GlobalStaticPropertyNamespace_static_namespaceProperty_set") -public func _bjs_GlobalStaticPropertyNamespace_static_namespaceProperty_set(valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_GlobalStaticPropertyNamespace_static_namespaceProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) GlobalStaticPropertyNamespace.namespaceProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -135,7 +135,7 @@ public func _bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedPro @_expose(wasm, "bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedProperty_set") @_cdecl("bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedProperty_set") -public func _bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedProperty_set(value: Int32) -> Void { +public func _bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedProperty_set(_ value: Int32) -> Void { #if arch(wasm32) GlobalStaticPropertyNamespace.NestedProperties.nestedProperty = Int.bridgeJSLiftParameter(value) #else @@ -167,7 +167,7 @@ public func _bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedDou @_expose(wasm, "bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedDouble_set") @_cdecl("bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedDouble_set") -public func _bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedDouble_set(value: Float64) -> Void { +public func _bjs_GlobalStaticPropertyNamespace_NestedProperties_static_nestedDouble_set(_ value: Float64) -> Void { #if arch(wasm32) GlobalStaticPropertyNamespace.NestedProperties.nestedDouble = Double.bridgeJSLiftParameter(value) #else @@ -188,7 +188,7 @@ public func _bjs_TestHTTPServer_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_TestHTTPServer_call") @_cdecl("bjs_TestHTTPServer_call") -public func _bjs_TestHTTPServer_call(_self: UnsafeMutableRawPointer, method: Int32) -> Void { +public func _bjs_TestHTTPServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { #if arch(wasm32) GlobalNetworking.API.TestHTTPServer.bridgeJSLiftParameter(_self).call(_: GlobalNetworking.API.CallMethod.bridgeJSLiftParameter(method)) #else @@ -198,8 +198,12 @@ public func _bjs_TestHTTPServer_call(_self: UnsafeMutableRawPointer, method: Int @_expose(wasm, "bjs_TestHTTPServer_deinit") @_cdecl("bjs_TestHTTPServer_deinit") -public func _bjs_TestHTTPServer_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_TestHTTPServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension GlobalNetworking.API.TestHTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -210,9 +214,9 @@ extension GlobalNetworking.API.TestHTTPServer: ConvertibleToJSValue, _BridgedSwi #if arch(wasm32) @_extern(wasm, module: "BridgeJSGlobalTests", name: "bjs_TestHTTPServer_wrap") -fileprivate func _bjs_TestHTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TestHTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TestHTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestHTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -230,7 +234,7 @@ public func _bjs_TestInternalServer_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_TestInternalServer_call") @_cdecl("bjs_TestInternalServer_call") -public func _bjs_TestInternalServer_call(_self: UnsafeMutableRawPointer, method: Int32) -> Void { +public func _bjs_TestInternalServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { #if arch(wasm32) Internal.TestInternalServer.bridgeJSLiftParameter(_self).call(_: Internal.SupportedServerMethod.bridgeJSLiftParameter(method)) #else @@ -240,8 +244,12 @@ public func _bjs_TestInternalServer_call(_self: UnsafeMutableRawPointer, method: @_expose(wasm, "bjs_TestInternalServer_deinit") @_cdecl("bjs_TestInternalServer_deinit") -public func _bjs_TestInternalServer_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_TestInternalServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension Internal.TestInternalServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -252,9 +260,9 @@ extension Internal.TestInternalServer: ConvertibleToJSValue, _BridgedSwiftHeapOb #if arch(wasm32) @_extern(wasm, module: "BridgeJSGlobalTests", name: "bjs_TestInternalServer_wrap") -fileprivate func _bjs_TestInternalServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TestInternalServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TestInternalServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestInternalServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -272,7 +280,7 @@ public func _bjs_PublicConverter_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_PublicConverter_toString") @_cdecl("bjs_PublicConverter_toString") -public func _bjs_PublicConverter_toString(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_PublicConverter_toString(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) let ret = GlobalUtils.PublicConverter.bridgeJSLiftParameter(_self).toString(value: Int.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -283,8 +291,12 @@ public func _bjs_PublicConverter_toString(_self: UnsafeMutableRawPointer, value: @_expose(wasm, "bjs_PublicConverter_deinit") @_cdecl("bjs_PublicConverter_deinit") -public func _bjs_PublicConverter_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_PublicConverter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension GlobalUtils.PublicConverter: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -295,9 +307,9 @@ extension GlobalUtils.PublicConverter: ConvertibleToJSValue, _BridgedSwiftHeapOb #if arch(wasm32) @_extern(wasm, module: "BridgeJSGlobalTests", name: "bjs_PublicConverter_wrap") -fileprivate func _bjs_PublicConverter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PublicConverter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PublicConverter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PublicConverter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift index addeedb1e..0a95e88f9 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift @@ -6,8 +6,14 @@ @_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(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTests10HttpStatusO_Si: _BridgedSwiftClosureBox { let closure: (HttpStatus) -> Int @@ -21,23 +27,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si { let box = _BJS_ClosureBox_20BridgeJSRuntimeTests10HttpStatusO_Si(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> Int { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return Int.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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 } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests10HttpStatusO_Si>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(HttpStatus.bridgeJSLiftParameter(param0)) @@ -47,8 +54,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10H #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_SS: _BridgedSwiftClosureBox { let closure: (Theme) -> String @@ -62,23 +75,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_SS { let box = _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_20BridgeJSRuntimeTests5ThemeO_SS(callbackValue, param0Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) @@ -88,8 +102,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5Th #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_Sb: _BridgedSwiftClosureBox { let closure: (Theme) -> Bool @@ -103,23 +123,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb { let box = _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_Sb(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Bool { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return Bool.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_20BridgeJSRuntimeTests5ThemeO_Sb(callbackValue, param0Value) + return Bool.bridgeJSLiftReturn(ret) + #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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_Sb>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) @@ -129,8 +150,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5Th #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_: Int32, _: UnsafeMutableRawPointer) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTests7GreeterC_SS: _BridgedSwiftClosureBox { let closure: (Greeter) -> String @@ -144,23 +171,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests7GreeterC_SS { let box = _BJS_ClosureBox_20BridgeJSRuntimeTests7GreeterC_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Greeter) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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, "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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests7GreeterC_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Greeter.bridgeJSLiftParameter(param0)) @@ -170,8 +198,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7Gr #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTests9APIResultO_SS: _BridgedSwiftClosureBox { let closure: (APIResult) -> String @@ -185,23 +219,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS { let box = _BJS_ClosureBox_20BridgeJSRuntimeTests9APIResultO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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 } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests9APIResultO_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(APIResult.bridgeJSLiftParameter(param0)) @@ -211,8 +246,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9AP #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_SS: _BridgedSwiftClosureBox { let closure: (Direction) -> String @@ -226,23 +267,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_SS { let box = _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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 } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Direction.bridgeJSLiftParameter(param0)) @@ -252,8 +294,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9Di #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_Sb: _BridgedSwiftClosureBox { let closure: (Direction) -> Bool @@ -267,23 +315,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb { let box = _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_Sb(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Bool { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return Bool.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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 } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_Sb>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Direction.bridgeJSLiftParameter(param0)) @@ -293,8 +342,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9Di #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_: Int32, _: Int32) -> UnsafeMutableRawPointer +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ callback: Int32, _ param0: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ callback: Int32, _ param0: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_7GreeterC: _BridgedSwiftClosureBox { let closure: (String) -> Greeter @@ -308,23 +363,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_7GreeterC { let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_7GreeterC(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (String) -> Greeter { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return Greeter.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_20BridgeJSRuntimeTestsSS_7GreeterC(callbackValue, param0Value) + return Greeter.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSS_7GreeterC>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) @@ -334,8 +390,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_ #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_SS: _BridgedSwiftClosureBox { let closure: (String) -> String @@ -349,23 +411,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_SS { let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_20BridgeJSRuntimeTestsSS_SS(callbackValue, param0Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSS_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) @@ -375,8 +438,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_ #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_: Int32, _: Int32, _: Int32, _: Float64) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Float64) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSiSSSd_SS: _BridgedSwiftClosureBox { let closure: (Int, String, Double) -> String @@ -390,23 +459,26 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSiSSSd_SS { let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSiSSSd_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Int, String, Double) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0, param1, param2 in - #if arch(wasm32) - let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter(), param1.bridgeJSLowerParameter(), param2.bridgeJSLowerParameter()) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_20BridgeJSRuntimeTestsSiSSSd_SS(callbackValue, param0Value, param1Value, param2Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32, _ param1Bytes: Int32, _ param1Length: Int32, _ param2: Float64) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSiSSSd_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Int.bridgeJSLiftParameter(param0), String.bridgeJSLiftParameter(param1Bytes, param1Length), Double.bridgeJSLiftParameter(param2)) @@ -416,8 +488,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiS #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSi_Si: _BridgedSwiftClosureBox { let closure: (Int) -> Int @@ -431,23 +509,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSi_Si { let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSi_Si(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Int { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(callback.bridgeJSLowerParameter(), param0.bridgeJSLowerParameter()) - return Int.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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 } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSi_Si>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Int.bridgeJSLiftParameter(param0)) @@ -457,8 +536,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_ #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_: Int32, _: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq5ThemeO_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String @@ -472,24 +557,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSq5ThemeO_SS { let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq5ThemeO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_20BridgeJSRuntimeTestsSq5ThemeO_SS(callbackValue, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq5ThemeO_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) @@ -499,8 +584,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5 #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_: Int32, _: Int32, _: UnsafeMutableRawPointer) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String @@ -514,24 +605,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_SS { let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithRetain() -let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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 } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) @@ -541,8 +632,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7 #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_: Int32, _: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9APIResultO_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String @@ -556,24 +653,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9APIResultO_SS { let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9APIResultO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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 } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq9APIResultO_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0CaseId)) @@ -583,8 +680,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9 #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_: Int32, _: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9DirectionO_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String @@ -598,24 +701,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS { let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9DirectionO_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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 } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq9DirectionO_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) @@ -625,8 +728,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9 #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_: Int32, _: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSS_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String @@ -640,24 +749,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS { let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSS_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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_20BridgeJSRuntimeTestsSqSS_SS(callbackValue, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSqSS_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) @@ -667,8 +776,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqS #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_: Int32, _: Int32, _: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSi_SS: _BridgedSwiftClosureBox { let closure: (Optional) -> String @@ -682,24 +797,24 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSi_SS { let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSi_SS(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameterWithPresence() -let resultId = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(callback.bridgeJSLowerParameter(), param0IsSome, param0Value) - return String.bridgeJSLiftReturn(resultId) - #else - fatalError("Only available on WebAssembly") - #endif - } + 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 } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSqSi_SS>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) @@ -709,8 +824,14 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqS #endif } +#if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_: Int32) -> Void +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_ callback: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_ callback: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsy_Sq7GreeterC: _BridgedSwiftClosureBox { let closure: () -> Optional @@ -724,23 +845,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC { let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsy_Sq7GreeterC(closure) return Unmanaged.passRetained(box).toOpaque() } - static func bridgeJSLift(_ callbackId: Int32) -> () -> Optional { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] in - #if arch(wasm32) - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(callback.bridgeJSLowerParameter()) - return Optional.bridgeJSLiftReturnFromSideChannel() - #else - fatalError("Only available on WebAssembly") - #endif - } + 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 } + } } @_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 { +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_ boxPtr: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsy_Sq7GreeterC>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure() @@ -753,161 +874,197 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_S struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { let jsObject: JSObject - func increment(by amount: Int) { - _extern_increment(this: Int32(bitPattern: jsObject.id), amount: amount.bridgeJSLowerParameter()) + func increment(by amount: Int) -> Void { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let amountValue = amount.bridgeJSLowerParameter() + _extern_increment(jsObjectValue, amountValue) } func getValue() -> Int { - let ret = _extern_getValue(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_getValue(jsObjectValue) return Int.bridgeJSLiftReturn(ret) } - func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) { - _extern_setLabelElements(this: Int32(bitPattern: jsObject.id), labelPrefix: labelPrefix.bridgeJSLowerParameter(), labelSuffix: labelSuffix.bridgeJSLowerParameter()) + func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) -> Void { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let labelPrefixValue = labelPrefix.bridgeJSLowerParameter() + let labelSuffixValue = labelSuffix.bridgeJSLowerParameter() + _extern_setLabelElements(jsObjectValue, labelPrefixValue, labelSuffixValue) } func getLabel() -> String { - let ret = _extern_getLabel(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_getLabel(jsObjectValue) return String.bridgeJSLiftReturn(ret) } func isEven() -> Bool { - let ret = _extern_isEven(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_isEven(jsObjectValue) return Bool.bridgeJSLiftReturn(ret) } func processGreeter(_ greeter: Greeter) -> String { - let ret = _extern_processGreeter(this: Int32(bitPattern: jsObject.id), greeter: greeter.bridgeJSLowerParameter()) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let greeterPointer = greeter.bridgeJSLowerParameter() + let ret = _extern_processGreeter(jsObjectValue, greeterPointer) return String.bridgeJSLiftReturn(ret) } func createGreeter() -> Greeter { - let ret = _extern_createGreeter(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_createGreeter(jsObjectValue) return Greeter.bridgeJSLiftReturn(ret) } func processOptionalGreeter(_ greeter: Optional) -> String { - let (greeterIsSome, greeterPointer) = greeter.bridgeJSLowerParameterWithPresence() - let ret = _extern_processOptionalGreeter(this: Int32(bitPattern: jsObject.id), greeterIsSome: greeterIsSome, greeterPointer: greeterPointer) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (greeterIsSome, greeterPointer) = greeter.bridgeJSLowerParameter() + let ret = _extern_processOptionalGreeter(jsObjectValue, greeterIsSome, greeterPointer) return String.bridgeJSLiftReturn(ret) } func createOptionalGreeter() -> Optional { - let ret = _extern_createOptionalGreeter(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_createOptionalGreeter(jsObjectValue) return Optional.bridgeJSLiftReturn(ret) } - func handleAPIResult(_ result: Optional) { - let (resultIsSome, resultCaseId) = result.bridgeJSLowerParameterWithPresence() - _extern_handleAPIResult(this: Int32(bitPattern: jsObject.id), resultIsSome: resultIsSome, resultCaseId: resultCaseId) + func handleAPIResult(_ result: Optional) -> Void { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (resultIsSome, resultCaseId) = result.bridgeJSLowerParameter() + _extern_handleAPIResult(jsObjectValue, resultIsSome, resultCaseId) } func getAPIResult() -> Optional { - let ret = _extern_getAPIResult(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_getAPIResult(jsObjectValue) return Optional.bridgeJSLiftReturn(ret) } var count: Int { get { - let ret = bjs_DataProcessor_count_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_DataProcessor_count_get(jsObjectValue) return Int.bridgeJSLiftReturn(ret) } set { - bjs_DataProcessor_count_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_count_set(jsObjectValue, newValueValue) } } var name: String { get { - let ret = bjs_DataProcessor_name_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_DataProcessor_name_get(jsObjectValue) return String.bridgeJSLiftReturn(ret) } } var optionalTag: Optional { get { - bjs_DataProcessor_optionalTag_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + bjs_DataProcessor_optionalTag_get(jsObjectValue) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - bjs_DataProcessor_optionalTag_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_optionalTag_set(jsObjectValue, newValueIsSome, newValueValue) } } var optionalCount: Optional { get { - bjs_DataProcessor_optionalCount_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + bjs_DataProcessor_optionalCount_get(jsObjectValue) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - bjs_DataProcessor_optionalCount_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_optionalCount_set(jsObjectValue, newValueIsSome, newValueValue) } } var direction: Optional { get { - let ret = bjs_DataProcessor_direction_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_DataProcessor_direction_get(jsObjectValue) return Optional.bridgeJSLiftReturn(ret) } set { - let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - bjs_DataProcessor_direction_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_direction_set(jsObjectValue, newValueIsSome, newValueValue) } } var optionalTheme: Optional { get { - bjs_DataProcessor_optionalTheme_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + bjs_DataProcessor_optionalTheme_get(jsObjectValue) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - bjs_DataProcessor_optionalTheme_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_optionalTheme_set(jsObjectValue, newValueIsSome, newValueValue) } } var httpStatus: Optional { get { - bjs_DataProcessor_httpStatus_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + bjs_DataProcessor_httpStatus_get(jsObjectValue) return Optional.bridgeJSLiftReturnFromSideChannel() } set { - let (isSome, value) = newValue.bridgeJSLowerParameterWithPresence() - bjs_DataProcessor_httpStatus_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, value: value) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_httpStatus_set(jsObjectValue, newValueIsSome, newValueValue) } } var apiResult: Optional { get { - let ret = bjs_DataProcessor_apiResult_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_DataProcessor_apiResult_get(jsObjectValue) return Optional.bridgeJSLiftReturn(ret) } set { - let (isSome, caseId) = newValue.bridgeJSLowerParameterWithPresence() - bjs_DataProcessor_apiResult_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, caseId: caseId) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueCaseId) = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_apiResult_set(jsObjectValue, newValueIsSome, newValueCaseId) } } var helper: Greeter { get { - let ret = bjs_DataProcessor_helper_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_DataProcessor_helper_get(jsObjectValue) return Greeter.bridgeJSLiftReturn(ret) } set { - bjs_DataProcessor_helper_set(this: Int32(bitPattern: jsObject.id), pointer: newValue.bridgeJSLowerParameter()) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let newValuePointer = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_helper_set(jsObjectValue, newValuePointer) } } var optionalHelper: Optional { get { - let ret = bjs_DataProcessor_optionalHelper_get(this: Int32(bitPattern: jsObject.id)) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_DataProcessor_optionalHelper_get(jsObjectValue) return Optional.bridgeJSLiftReturn(ret) } set { - let (isSome, pointer) = newValue.bridgeJSLowerParameterWithPresence() - bjs_DataProcessor_optionalHelper_set(this: Int32(bitPattern: jsObject.id), isSome: isSome, pointer: pointer) + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValuePointer) = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_optionalHelper_set(jsObjectValue, newValueIsSome, newValuePointer) } } @@ -917,94 +1074,94 @@ struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { } @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_increment") -fileprivate func _extern_increment(this: Int32, amount: Int32) +fileprivate func _extern_increment(_ jsObject: Int32, _ amount: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getValue") -fileprivate func _extern_getValue(this: Int32) -> Int32 +fileprivate func _extern_getValue(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_setLabelElements") -fileprivate func _extern_setLabelElements(this: Int32, labelPrefix: Int32, labelSuffix: Int32) +fileprivate func _extern_setLabelElements(_ jsObject: Int32, _ labelPrefix: Int32, _ labelSuffix: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getLabel") -fileprivate func _extern_getLabel(this: Int32) -> Int32 +fileprivate func _extern_getLabel(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_isEven") -fileprivate func _extern_isEven(this: Int32) -> Int32 +fileprivate func _extern_isEven(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processGreeter") -fileprivate func _extern_processGreeter(this: Int32, greeter: UnsafeMutableRawPointer) -> Int32 +fileprivate func _extern_processGreeter(_ jsObject: Int32, _ greeter: UnsafeMutableRawPointer) -> Int32 @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createGreeter") -fileprivate func _extern_createGreeter(this: Int32) -> UnsafeMutableRawPointer +fileprivate func _extern_createGreeter(_ jsObject: Int32) -> UnsafeMutableRawPointer @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processOptionalGreeter") -fileprivate func _extern_processOptionalGreeter(this: Int32, greeterIsSome: Int32, greeterPointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _extern_processOptionalGreeter(_ jsObject: Int32, _ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> Int32 @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createOptionalGreeter") -fileprivate func _extern_createOptionalGreeter(this: Int32) -> UnsafeMutableRawPointer +fileprivate func _extern_createOptionalGreeter(_ jsObject: Int32) -> UnsafeMutableRawPointer @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_handleAPIResult") -fileprivate func _extern_handleAPIResult(this: Int32, resultIsSome: Int32, resultCaseId: Int32) +fileprivate func _extern_handleAPIResult(_ jsObject: Int32, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getAPIResult") -fileprivate func _extern_getAPIResult(this: Int32) -> Int32 +fileprivate func _extern_getAPIResult(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_get") -fileprivate func bjs_DataProcessor_count_get(this: Int32) -> Int32 +fileprivate func bjs_DataProcessor_count_get(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_set") -fileprivate func bjs_DataProcessor_count_set(this: Int32, value: Int32) +fileprivate func bjs_DataProcessor_count_set(_ jsObject: Int32, _ newValue: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_name_get") -fileprivate func bjs_DataProcessor_name_get(this: Int32) -> Int32 +fileprivate func bjs_DataProcessor_name_get(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_get") -fileprivate func bjs_DataProcessor_optionalTag_get(this: Int32) +fileprivate func bjs_DataProcessor_optionalTag_get(_ jsObject: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_set") -fileprivate func bjs_DataProcessor_optionalTag_set(this: Int32, isSome: Int32, value: Int32) +fileprivate func bjs_DataProcessor_optionalTag_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_get") -fileprivate func bjs_DataProcessor_optionalCount_get(this: Int32) +fileprivate func bjs_DataProcessor_optionalCount_get(_ jsObject: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_set") -fileprivate func bjs_DataProcessor_optionalCount_set(this: Int32, isSome: Int32, value: Int32) +fileprivate func bjs_DataProcessor_optionalCount_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_get") -fileprivate func bjs_DataProcessor_direction_get(this: Int32) -> Int32 +fileprivate func bjs_DataProcessor_direction_get(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_set") -fileprivate func bjs_DataProcessor_direction_set(this: Int32, isSome: Int32, value: Int32) +fileprivate func bjs_DataProcessor_direction_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_get") -fileprivate func bjs_DataProcessor_optionalTheme_get(this: Int32) +fileprivate func bjs_DataProcessor_optionalTheme_get(_ jsObject: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_set") -fileprivate func bjs_DataProcessor_optionalTheme_set(this: Int32, isSome: Int32, value: Int32) +fileprivate func bjs_DataProcessor_optionalTheme_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_get") -fileprivate func bjs_DataProcessor_httpStatus_get(this: Int32) +fileprivate func bjs_DataProcessor_httpStatus_get(_ jsObject: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_set") -fileprivate func bjs_DataProcessor_httpStatus_set(this: Int32, isSome: Int32, value: Int32) +fileprivate func bjs_DataProcessor_httpStatus_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_get") -fileprivate func bjs_DataProcessor_apiResult_get(this: Int32) -> Int32 +fileprivate func bjs_DataProcessor_apiResult_get(_ jsObject: Int32) -> Int32 @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_set") -fileprivate func bjs_DataProcessor_apiResult_set(this: Int32, isSome: Int32, caseId: Int32) +fileprivate func bjs_DataProcessor_apiResult_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_get") -fileprivate func bjs_DataProcessor_helper_get(this: Int32) -> UnsafeMutableRawPointer +fileprivate func bjs_DataProcessor_helper_get(_ jsObject: Int32) -> UnsafeMutableRawPointer @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_set") -fileprivate func bjs_DataProcessor_helper_set(this: Int32, pointer: UnsafeMutableRawPointer) +fileprivate func bjs_DataProcessor_helper_set(_ jsObject: Int32, _ newValue: UnsafeMutableRawPointer) -> Void @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_get") -fileprivate func bjs_DataProcessor_optionalHelper_get(this: Int32) -> UnsafeMutableRawPointer +fileprivate func bjs_DataProcessor_optionalHelper_get(_ jsObject: Int32) -> UnsafeMutableRawPointer @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_set") -fileprivate func bjs_DataProcessor_optionalHelper_set(this: Int32, isSome: Int32, pointer: UnsafeMutableRawPointer) +fileprivate func bjs_DataProcessor_optionalHelper_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValuePointer: UnsafeMutableRawPointer) -> Void extension Direction: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { @@ -1762,7 +1919,7 @@ extension StaticCalculator: _BridgedSwiftCaseEnum { @_expose(wasm, "bjs_StaticCalculator_static_roundtrip") @_cdecl("bjs_StaticCalculator_static_roundtrip") -public func _bjs_StaticCalculator_static_roundtrip(value: Int32) -> Int32 { +public func _bjs_StaticCalculator_static_roundtrip(_ value: Int32) -> Int32 { #if arch(wasm32) let ret = StaticCalculator.roundtrip(_: Int.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -1773,7 +1930,7 @@ public func _bjs_StaticCalculator_static_roundtrip(value: Int32) -> Int32 { @_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 { +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() @@ -1830,7 +1987,7 @@ public func _bjs_StaticPropertyEnum_static_enumProperty_get() -> Void { @_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 { +public func _bjs_StaticPropertyEnum_static_enumProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) StaticPropertyEnum.enumProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -1862,7 +2019,7 @@ public func _bjs_StaticPropertyEnum_static_enumBool_get() -> Int32 { @_expose(wasm, "bjs_StaticPropertyEnum_static_enumBool_set") @_cdecl("bjs_StaticPropertyEnum_static_enumBool_set") -public func _bjs_StaticPropertyEnum_static_enumBool_set(value: Int32) -> Void { +public func _bjs_StaticPropertyEnum_static_enumBool_set(_ value: Int32) -> Void { #if arch(wasm32) StaticPropertyEnum.enumBool = Bool.bridgeJSLiftParameter(value) #else @@ -1883,7 +2040,7 @@ public func _bjs_StaticPropertyEnum_static_enumVariable_get() -> Int32 { @_expose(wasm, "bjs_StaticPropertyEnum_static_enumVariable_set") @_cdecl("bjs_StaticPropertyEnum_static_enumVariable_set") -public func _bjs_StaticPropertyEnum_static_enumVariable_set(value: Int32) -> Void { +public func _bjs_StaticPropertyEnum_static_enumVariable_set(_ value: Int32) -> Void { #if arch(wasm32) StaticPropertyEnum.enumVariable = Int.bridgeJSLiftParameter(value) #else @@ -1915,7 +2072,7 @@ public func _bjs_StaticPropertyEnum_static_computedReadWrite_get() -> Void { @_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 { +public func _bjs_StaticPropertyEnum_static_computedReadWrite_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) StaticPropertyEnum.computedReadWrite = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -1936,7 +2093,7 @@ public func _bjs_StaticPropertyNamespace_static_namespaceProperty_get() -> Void @_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 { +public func _bjs_StaticPropertyNamespace_static_namespaceProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) StaticPropertyNamespace.namespaceProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -1968,7 +2125,7 @@ public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_ @_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 { +public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_set(_ value: Int32) -> Void { #if arch(wasm32) StaticPropertyNamespace.NestedProperties.nestedProperty = Int.bridgeJSLiftParameter(value) #else @@ -2000,7 +2157,7 @@ public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_ge @_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 { +public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_set(_ value: Float64) -> Void { #if arch(wasm32) StaticPropertyNamespace.NestedProperties.nestedDouble = Double.bridgeJSLiftParameter(value) #else @@ -2040,7 +2197,7 @@ extension DataPoint: _BridgedSwiftStruct { @_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 { +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() @@ -2193,7 +2350,7 @@ extension MathOperations: _BridgedSwiftStruct { @_expose(wasm, "bjs_MathOperations_init") @_cdecl("bjs_MathOperations_init") -public func _bjs_MathOperations_init(baseValue: Float64) -> Void { +public func _bjs_MathOperations_init(_ baseValue: Float64) -> Void { #if arch(wasm32) let ret = MathOperations(baseValue: Double.bridgeJSLiftParameter(baseValue)) return ret.bridgeJSLowerReturn() @@ -2204,7 +2361,7 @@ public func _bjs_MathOperations_init(baseValue: Float64) -> Void { @_expose(wasm, "bjs_MathOperations_add") @_cdecl("bjs_MathOperations_add") -public func _bjs_MathOperations_add(a: Float64, b: Float64) -> Float64 { +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() @@ -2215,7 +2372,7 @@ public func _bjs_MathOperations_add(a: Float64, b: Float64) -> Float64 { @_expose(wasm, "bjs_MathOperations_multiply") @_cdecl("bjs_MathOperations_multiply") -public func _bjs_MathOperations_multiply(a: Float64, b: Float64) -> Float64 { +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() @@ -2226,7 +2383,7 @@ public func _bjs_MathOperations_multiply(a: Float64, b: Float64) -> Float64 { @_expose(wasm, "bjs_MathOperations_static_subtract") @_cdecl("bjs_MathOperations_static_subtract") -public func _bjs_MathOperations_static_subtract(a: Float64, b: Float64) -> Float64 { +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() @@ -2264,7 +2421,7 @@ public func _bjs_ConfigStruct_static_defaultConfig_get() -> Void { @_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 { +public func _bjs_ConfigStruct_static_defaultConfig_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) ConfigStruct.defaultConfig = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -2296,7 +2453,7 @@ public func _bjs_ConfigStruct_static_timeout_get() -> Float64 { @_expose(wasm, "bjs_ConfigStruct_static_timeout_set") @_cdecl("bjs_ConfigStruct_static_timeout_set") -public func _bjs_ConfigStruct_static_timeout_set(value: Float64) -> Void { +public func _bjs_ConfigStruct_static_timeout_set(_ value: Float64) -> Void { #if arch(wasm32) ConfigStruct.timeout = Double.bridgeJSLiftParameter(value) #else @@ -2327,7 +2484,7 @@ public func _bjs_roundTripVoid() -> Void { @_expose(wasm, "bjs_roundTripInt") @_cdecl("bjs_roundTripInt") -public func _bjs_roundTripInt(v: Int32) -> Int32 { +public func _bjs_roundTripInt(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = roundTripInt(v: Int.bridgeJSLiftParameter(v)) return ret.bridgeJSLowerReturn() @@ -2338,7 +2495,7 @@ public func _bjs_roundTripInt(v: Int32) -> Int32 { @_expose(wasm, "bjs_roundTripFloat") @_cdecl("bjs_roundTripFloat") -public func _bjs_roundTripFloat(v: Float32) -> Float32 { +public func _bjs_roundTripFloat(_ v: Float32) -> Float32 { #if arch(wasm32) let ret = roundTripFloat(v: Float.bridgeJSLiftParameter(v)) return ret.bridgeJSLowerReturn() @@ -2349,7 +2506,7 @@ public func _bjs_roundTripFloat(v: Float32) -> Float32 { @_expose(wasm, "bjs_roundTripDouble") @_cdecl("bjs_roundTripDouble") -public func _bjs_roundTripDouble(v: Float64) -> Float64 { +public func _bjs_roundTripDouble(_ v: Float64) -> Float64 { #if arch(wasm32) let ret = roundTripDouble(v: Double.bridgeJSLiftParameter(v)) return ret.bridgeJSLowerReturn() @@ -2360,7 +2517,7 @@ public func _bjs_roundTripDouble(v: Float64) -> Float64 { @_expose(wasm, "bjs_roundTripBool") @_cdecl("bjs_roundTripBool") -public func _bjs_roundTripBool(v: Int32) -> Int32 { +public func _bjs_roundTripBool(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = roundTripBool(v: Bool.bridgeJSLiftParameter(v)) return ret.bridgeJSLowerReturn() @@ -2371,7 +2528,7 @@ public func _bjs_roundTripBool(v: Int32) -> Int32 { @_expose(wasm, "bjs_roundTripString") @_cdecl("bjs_roundTripString") -public func _bjs_roundTripString(vBytes: Int32, vLength: Int32) -> Void { +public func _bjs_roundTripString(_ vBytes: Int32, _ vLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripString(v: String.bridgeJSLiftParameter(vBytes, vLength)) return ret.bridgeJSLowerReturn() @@ -2382,7 +2539,7 @@ public func _bjs_roundTripString(vBytes: Int32, vLength: Int32) -> Void { @_expose(wasm, "bjs_roundTripSwiftHeapObject") @_cdecl("bjs_roundTripSwiftHeapObject") -public func _bjs_roundTripSwiftHeapObject(v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_roundTripSwiftHeapObject(_ v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = roundTripSwiftHeapObject(v: Greeter.bridgeJSLiftParameter(v)) return ret.bridgeJSLowerReturn() @@ -2393,7 +2550,7 @@ public func _bjs_roundTripSwiftHeapObject(v: UnsafeMutableRawPointer) -> UnsafeM @_expose(wasm, "bjs_roundTripJSObject") @_cdecl("bjs_roundTripJSObject") -public func _bjs_roundTripJSObject(v: Int32) -> Int32 { +public func _bjs_roundTripJSObject(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = roundTripJSObject(v: JSObject.bridgeJSLiftParameter(v)) return ret.bridgeJSLowerReturn() @@ -2404,7 +2561,7 @@ public func _bjs_roundTripJSObject(v: Int32) -> Int32 { @_expose(wasm, "bjs_throwsSwiftError") @_cdecl("bjs_throwsSwiftError") -public func _bjs_throwsSwiftError(shouldThrow: Int32) -> Void { +public func _bjs_throwsSwiftError(_ shouldThrow: Int32) -> Void { #if arch(wasm32) do { try throwsSwiftError(shouldThrow: Bool.bridgeJSLiftParameter(shouldThrow)) @@ -2616,7 +2773,7 @@ public func _bjs_asyncRoundTripVoid() -> Int32 { @_expose(wasm, "bjs_asyncRoundTripInt") @_cdecl("bjs_asyncRoundTripInt") -public func _bjs_asyncRoundTripInt(v: Int32) -> Int32 { +public func _bjs_asyncRoundTripInt(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripInt(v: Int.bridgeJSLiftParameter(v)).jsValue @@ -2629,7 +2786,7 @@ public func _bjs_asyncRoundTripInt(v: Int32) -> Int32 { @_expose(wasm, "bjs_asyncRoundTripFloat") @_cdecl("bjs_asyncRoundTripFloat") -public func _bjs_asyncRoundTripFloat(v: Float32) -> Int32 { +public func _bjs_asyncRoundTripFloat(_ v: Float32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripFloat(v: Float.bridgeJSLiftParameter(v)).jsValue @@ -2642,7 +2799,7 @@ public func _bjs_asyncRoundTripFloat(v: Float32) -> Int32 { @_expose(wasm, "bjs_asyncRoundTripDouble") @_cdecl("bjs_asyncRoundTripDouble") -public func _bjs_asyncRoundTripDouble(v: Float64) -> Int32 { +public func _bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripDouble(v: Double.bridgeJSLiftParameter(v)).jsValue @@ -2655,7 +2812,7 @@ public func _bjs_asyncRoundTripDouble(v: Float64) -> Int32 { @_expose(wasm, "bjs_asyncRoundTripBool") @_cdecl("bjs_asyncRoundTripBool") -public func _bjs_asyncRoundTripBool(v: Int32) -> Int32 { +public func _bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripBool(v: Bool.bridgeJSLiftParameter(v)).jsValue @@ -2668,7 +2825,7 @@ public func _bjs_asyncRoundTripBool(v: Int32) -> Int32 { @_expose(wasm, "bjs_asyncRoundTripString") @_cdecl("bjs_asyncRoundTripString") -public func _bjs_asyncRoundTripString(vBytes: Int32, vLength: Int32) -> Int32 { +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 @@ -2681,7 +2838,7 @@ public func _bjs_asyncRoundTripString(vBytes: Int32, vLength: Int32) -> Int32 { @_expose(wasm, "bjs_asyncRoundTripSwiftHeapObject") @_cdecl("bjs_asyncRoundTripSwiftHeapObject") -public func _bjs_asyncRoundTripSwiftHeapObject(v: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_asyncRoundTripSwiftHeapObject(_ v: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripSwiftHeapObject(v: Greeter.bridgeJSLiftParameter(v)).jsValue @@ -2694,7 +2851,7 @@ public func _bjs_asyncRoundTripSwiftHeapObject(v: UnsafeMutableRawPointer) -> In @_expose(wasm, "bjs_asyncRoundTripJSObject") @_cdecl("bjs_asyncRoundTripJSObject") -public func _bjs_asyncRoundTripJSObject(v: Int32) -> Int32 { +public func _bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripJSObject(v: JSObject.bridgeJSLiftParameter(v)).jsValue @@ -2707,7 +2864,7 @@ public func _bjs_asyncRoundTripJSObject(v: Int32) -> Int32 { @_expose(wasm, "bjs_takeGreeter") @_cdecl("bjs_takeGreeter") -public func _bjs_takeGreeter(g: UnsafeMutableRawPointer, nameBytes: Int32, nameLength: Int32) -> Void { +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 @@ -2728,7 +2885,7 @@ public func _bjs_createCalculator() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_useCalculator") @_cdecl("bjs_useCalculator") -public func _bjs_useCalculator(calc: UnsafeMutableRawPointer, x: Int32, y: Int32) -> Int32 { +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() @@ -2761,7 +2918,7 @@ public func _bjs_testCalculatorToJSValue() -> Int32 { @_expose(wasm, "bjs_testSwiftClassAsJSValue") @_cdecl("bjs_testSwiftClassAsJSValue") -public func _bjs_testSwiftClassAsJSValue(greeter: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_testSwiftClassAsJSValue(_ greeter: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = testSwiftClassAsJSValue(greeter: Greeter.bridgeJSLiftParameter(greeter)) return ret.bridgeJSLowerReturn() @@ -2772,7 +2929,7 @@ public func _bjs_testSwiftClassAsJSValue(greeter: UnsafeMutableRawPointer) -> In @_expose(wasm, "bjs_setDirection") @_cdecl("bjs_setDirection") -public func _bjs_setDirection(direction: Int32) -> Int32 { +public func _bjs_setDirection(_ direction: Int32) -> Int32 { #if arch(wasm32) let ret = setDirection(_: Direction.bridgeJSLiftParameter(direction)) return ret.bridgeJSLowerReturn() @@ -2794,7 +2951,7 @@ public func _bjs_getDirection() -> Int32 { @_expose(wasm, "bjs_processDirection") @_cdecl("bjs_processDirection") -public func _bjs_processDirection(input: Int32) -> Int32 { +public func _bjs_processDirection(_ input: Int32) -> Int32 { #if arch(wasm32) let ret = processDirection(_: Direction.bridgeJSLiftParameter(input)) return ret.bridgeJSLowerReturn() @@ -2805,7 +2962,7 @@ public func _bjs_processDirection(input: Int32) -> Int32 { @_expose(wasm, "bjs_setTheme") @_cdecl("bjs_setTheme") -public func _bjs_setTheme(themeBytes: Int32, themeLength: Int32) -> Void { +public func _bjs_setTheme(_ themeBytes: Int32, _ themeLength: Int32) -> Void { #if arch(wasm32) let ret = setTheme(_: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) return ret.bridgeJSLowerReturn() @@ -2827,7 +2984,7 @@ public func _bjs_getTheme() -> Void { @_expose(wasm, "bjs_setHttpStatus") @_cdecl("bjs_setHttpStatus") -public func _bjs_setHttpStatus(status: Int32) -> Int32 { +public func _bjs_setHttpStatus(_ status: Int32) -> Int32 { #if arch(wasm32) let ret = setHttpStatus(_: HttpStatus.bridgeJSLiftParameter(status)) return ret.bridgeJSLowerReturn() @@ -2849,7 +3006,7 @@ public func _bjs_getHttpStatus() -> Int32 { @_expose(wasm, "bjs_processTheme") @_cdecl("bjs_processTheme") -public func _bjs_processTheme(themeBytes: Int32, themeLength: Int32) -> Int32 { +public func _bjs_processTheme(_ themeBytes: Int32, _ themeLength: Int32) -> Int32 { #if arch(wasm32) let ret = processTheme(_: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) return ret.bridgeJSLowerReturn() @@ -2860,7 +3017,7 @@ public func _bjs_processTheme(themeBytes: Int32, themeLength: Int32) -> Int32 { @_expose(wasm, "bjs_setTSDirection") @_cdecl("bjs_setTSDirection") -public func _bjs_setTSDirection(direction: Int32) -> Int32 { +public func _bjs_setTSDirection(_ direction: Int32) -> Int32 { #if arch(wasm32) let ret = setTSDirection(_: TSDirection.bridgeJSLiftParameter(direction)) return ret.bridgeJSLowerReturn() @@ -2882,7 +3039,7 @@ public func _bjs_getTSDirection() -> Int32 { @_expose(wasm, "bjs_setTSTheme") @_cdecl("bjs_setTSTheme") -public func _bjs_setTSTheme(themeBytes: Int32, themeLength: Int32) -> Void { +public func _bjs_setTSTheme(_ themeBytes: Int32, _ themeLength: Int32) -> Void { #if arch(wasm32) let ret = setTSTheme(_: TSTheme.bridgeJSLiftParameter(themeBytes, themeLength)) return ret.bridgeJSLowerReturn() @@ -2904,7 +3061,7 @@ public func _bjs_getTSTheme() -> Void { @_expose(wasm, "bjs_roundtripNetworkingAPIMethod") @_cdecl("bjs_roundtripNetworkingAPIMethod") -public func _bjs_roundtripNetworkingAPIMethod(method: Int32) -> Int32 { +public func _bjs_roundtripNetworkingAPIMethod(_ method: Int32) -> Int32 { #if arch(wasm32) let ret = roundtripNetworkingAPIMethod(_: Networking.API.Method.bridgeJSLiftParameter(method)) return ret.bridgeJSLowerReturn() @@ -2915,7 +3072,7 @@ public func _bjs_roundtripNetworkingAPIMethod(method: Int32) -> Int32 { @_expose(wasm, "bjs_roundtripConfigurationLogLevel") @_cdecl("bjs_roundtripConfigurationLogLevel") -public func _bjs_roundtripConfigurationLogLevel(levelBytes: Int32, levelLength: Int32) -> Void { +public func _bjs_roundtripConfigurationLogLevel(_ levelBytes: Int32, _ levelLength: Int32) -> Void { #if arch(wasm32) let ret = roundtripConfigurationLogLevel(_: Configuration.LogLevel.bridgeJSLiftParameter(levelBytes, levelLength)) return ret.bridgeJSLowerReturn() @@ -2926,7 +3083,7 @@ public func _bjs_roundtripConfigurationLogLevel(levelBytes: Int32, levelLength: @_expose(wasm, "bjs_roundtripConfigurationPort") @_cdecl("bjs_roundtripConfigurationPort") -public func _bjs_roundtripConfigurationPort(port: Int32) -> Int32 { +public func _bjs_roundtripConfigurationPort(_ port: Int32) -> Int32 { #if arch(wasm32) let ret = roundtripConfigurationPort(_: Configuration.Port.bridgeJSLiftParameter(port)) return ret.bridgeJSLowerReturn() @@ -2937,7 +3094,7 @@ public func _bjs_roundtripConfigurationPort(port: Int32) -> Int32 { @_expose(wasm, "bjs_processConfigurationLogLevel") @_cdecl("bjs_processConfigurationLogLevel") -public func _bjs_processConfigurationLogLevel(levelBytes: Int32, levelLength: Int32) -> Int32 { +public func _bjs_processConfigurationLogLevel(_ levelBytes: Int32, _ levelLength: Int32) -> Int32 { #if arch(wasm32) let ret = processConfigurationLogLevel(_: Configuration.LogLevel.bridgeJSLiftParameter(levelBytes, levelLength)) return ret.bridgeJSLowerReturn() @@ -2948,7 +3105,7 @@ public func _bjs_processConfigurationLogLevel(levelBytes: Int32, levelLength: In @_expose(wasm, "bjs_roundtripInternalSupportedMethod") @_cdecl("bjs_roundtripInternalSupportedMethod") -public func _bjs_roundtripInternalSupportedMethod(method: Int32) -> Int32 { +public func _bjs_roundtripInternalSupportedMethod(_ method: Int32) -> Int32 { #if arch(wasm32) let ret = roundtripInternalSupportedMethod(_: Internal.SupportedMethod.bridgeJSLiftParameter(method)) return ret.bridgeJSLowerReturn() @@ -2959,7 +3116,7 @@ public func _bjs_roundtripInternalSupportedMethod(method: Int32) -> Int32 { @_expose(wasm, "bjs_roundtripAPIResult") @_cdecl("bjs_roundtripAPIResult") -public func _bjs_roundtripAPIResult(result: Int32) -> Void { +public func _bjs_roundtripAPIResult(_ result: Int32) -> Void { #if arch(wasm32) let ret = roundtripAPIResult(result: APIResult.bridgeJSLiftParameter(result)) return ret.bridgeJSLowerReturn() @@ -2970,7 +3127,7 @@ public func _bjs_roundtripAPIResult(result: Int32) -> Void { @_expose(wasm, "bjs_makeAPIResultSuccess") @_cdecl("bjs_makeAPIResultSuccess") -public func _bjs_makeAPIResultSuccess(valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_makeAPIResultSuccess(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) let ret = makeAPIResultSuccess(_: String.bridgeJSLiftParameter(valueBytes, valueLength)) return ret.bridgeJSLowerReturn() @@ -2981,7 +3138,7 @@ public func _bjs_makeAPIResultSuccess(valueBytes: Int32, valueLength: Int32) -> @_expose(wasm, "bjs_makeAPIResultFailure") @_cdecl("bjs_makeAPIResultFailure") -public func _bjs_makeAPIResultFailure(value: Int32) -> Void { +public func _bjs_makeAPIResultFailure(_ value: Int32) -> Void { #if arch(wasm32) let ret = makeAPIResultFailure(_: Int.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -3003,7 +3160,7 @@ public func _bjs_makeAPIResultInfo() -> Void { @_expose(wasm, "bjs_makeAPIResultFlag") @_cdecl("bjs_makeAPIResultFlag") -public func _bjs_makeAPIResultFlag(value: Int32) -> Void { +public func _bjs_makeAPIResultFlag(_ value: Int32) -> Void { #if arch(wasm32) let ret = makeAPIResultFlag(_: Bool.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -3014,7 +3171,7 @@ public func _bjs_makeAPIResultFlag(value: Int32) -> Void { @_expose(wasm, "bjs_makeAPIResultRate") @_cdecl("bjs_makeAPIResultRate") -public func _bjs_makeAPIResultRate(value: Float32) -> Void { +public func _bjs_makeAPIResultRate(_ value: Float32) -> Void { #if arch(wasm32) let ret = makeAPIResultRate(_: Float.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -3025,7 +3182,7 @@ public func _bjs_makeAPIResultRate(value: Float32) -> Void { @_expose(wasm, "bjs_makeAPIResultPrecise") @_cdecl("bjs_makeAPIResultPrecise") -public func _bjs_makeAPIResultPrecise(value: Float64) -> Void { +public func _bjs_makeAPIResultPrecise(_ value: Float64) -> Void { #if arch(wasm32) let ret = makeAPIResultPrecise(_: Double.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -3036,7 +3193,7 @@ public func _bjs_makeAPIResultPrecise(value: Float64) -> Void { @_expose(wasm, "bjs_roundtripComplexResult") @_cdecl("bjs_roundtripComplexResult") -public func _bjs_roundtripComplexResult(result: Int32) -> Void { +public func _bjs_roundtripComplexResult(_ result: Int32) -> Void { #if arch(wasm32) let ret = roundtripComplexResult(_: ComplexResult.bridgeJSLiftParameter(result)) return ret.bridgeJSLowerReturn() @@ -3047,7 +3204,7 @@ public func _bjs_roundtripComplexResult(result: Int32) -> Void { @_expose(wasm, "bjs_makeComplexResultSuccess") @_cdecl("bjs_makeComplexResultSuccess") -public func _bjs_makeComplexResultSuccess(valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_makeComplexResultSuccess(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) let ret = makeComplexResultSuccess(_: String.bridgeJSLiftParameter(valueBytes, valueLength)) return ret.bridgeJSLowerReturn() @@ -3058,7 +3215,7 @@ public func _bjs_makeComplexResultSuccess(valueBytes: Int32, valueLength: Int32) @_expose(wasm, "bjs_makeComplexResultError") @_cdecl("bjs_makeComplexResultError") -public func _bjs_makeComplexResultError(messageBytes: Int32, messageLength: Int32, code: Int32) -> Void { +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() @@ -3069,7 +3226,7 @@ public func _bjs_makeComplexResultError(messageBytes: Int32, messageLength: Int3 @_expose(wasm, "bjs_makeComplexResultLocation") @_cdecl("bjs_makeComplexResultLocation") -public func _bjs_makeComplexResultLocation(lat: Float64, lng: Float64, nameBytes: Int32, nameLength: Int32) -> Void { +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() @@ -3080,7 +3237,7 @@ public func _bjs_makeComplexResultLocation(lat: Float64, lng: Float64, nameBytes @_expose(wasm, "bjs_makeComplexResultStatus") @_cdecl("bjs_makeComplexResultStatus") -public func _bjs_makeComplexResultStatus(active: Int32, code: Int32, messageBytes: Int32, messageLength: Int32) -> Void { +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() @@ -3091,7 +3248,7 @@ public func _bjs_makeComplexResultStatus(active: Int32, code: Int32, messageByte @_expose(wasm, "bjs_makeComplexResultCoordinates") @_cdecl("bjs_makeComplexResultCoordinates") -public func _bjs_makeComplexResultCoordinates(x: Float64, y: Float64, z: Float64) -> Void { +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() @@ -3102,7 +3259,7 @@ public func _bjs_makeComplexResultCoordinates(x: Float64, y: Float64, z: Float64 @_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 { +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() @@ -3124,7 +3281,7 @@ public func _bjs_makeComplexResultInfo() -> Void { @_expose(wasm, "bjs_makeUtilitiesResultSuccess") @_cdecl("bjs_makeUtilitiesResultSuccess") -public func _bjs_makeUtilitiesResultSuccess(messageBytes: Int32, messageLength: Int32) -> Void { +public func _bjs_makeUtilitiesResultSuccess(_ messageBytes: Int32, _ messageLength: Int32) -> Void { #if arch(wasm32) let ret = makeUtilitiesResultSuccess(_: String.bridgeJSLiftParameter(messageBytes, messageLength)) return ret.bridgeJSLowerReturn() @@ -3135,7 +3292,7 @@ public func _bjs_makeUtilitiesResultSuccess(messageBytes: Int32, messageLength: @_expose(wasm, "bjs_makeUtilitiesResultFailure") @_cdecl("bjs_makeUtilitiesResultFailure") -public func _bjs_makeUtilitiesResultFailure(errorBytes: Int32, errorLength: Int32, code: Int32) -> Void { +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() @@ -3146,7 +3303,7 @@ public func _bjs_makeUtilitiesResultFailure(errorBytes: Int32, errorLength: Int3 @_expose(wasm, "bjs_makeUtilitiesResultStatus") @_cdecl("bjs_makeUtilitiesResultStatus") -public func _bjs_makeUtilitiesResultStatus(active: Int32, code: Int32, messageBytes: Int32, messageLength: Int32) -> Void { +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() @@ -3157,7 +3314,7 @@ public func _bjs_makeUtilitiesResultStatus(active: Int32, code: Int32, messageBy @_expose(wasm, "bjs_makeAPINetworkingResultSuccess") @_cdecl("bjs_makeAPINetworkingResultSuccess") -public func _bjs_makeAPINetworkingResultSuccess(messageBytes: Int32, messageLength: Int32) -> Void { +public func _bjs_makeAPINetworkingResultSuccess(_ messageBytes: Int32, _ messageLength: Int32) -> Void { #if arch(wasm32) let ret = makeAPINetworkingResultSuccess(_: String.bridgeJSLiftParameter(messageBytes, messageLength)) return ret.bridgeJSLowerReturn() @@ -3168,7 +3325,7 @@ public func _bjs_makeAPINetworkingResultSuccess(messageBytes: Int32, messageLeng @_expose(wasm, "bjs_makeAPINetworkingResultFailure") @_cdecl("bjs_makeAPINetworkingResultFailure") -public func _bjs_makeAPINetworkingResultFailure(errorBytes: Int32, errorLength: Int32, code: Int32) -> Void { +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() @@ -3179,7 +3336,7 @@ public func _bjs_makeAPINetworkingResultFailure(errorBytes: Int32, errorLength: @_expose(wasm, "bjs_roundtripUtilitiesResult") @_cdecl("bjs_roundtripUtilitiesResult") -public func _bjs_roundtripUtilitiesResult(result: Int32) -> Void { +public func _bjs_roundtripUtilitiesResult(_ result: Int32) -> Void { #if arch(wasm32) let ret = roundtripUtilitiesResult(_: Utilities.Result.bridgeJSLiftParameter(result)) return ret.bridgeJSLowerReturn() @@ -3190,7 +3347,7 @@ public func _bjs_roundtripUtilitiesResult(result: Int32) -> Void { @_expose(wasm, "bjs_roundtripAPINetworkingResult") @_cdecl("bjs_roundtripAPINetworkingResult") -public func _bjs_roundtripAPINetworkingResult(result: Int32) -> Void { +public func _bjs_roundtripAPINetworkingResult(_ result: Int32) -> Void { #if arch(wasm32) let ret = roundtripAPINetworkingResult(_: API.NetworkingResult.bridgeJSLiftParameter(result)) return ret.bridgeJSLowerReturn() @@ -3201,7 +3358,7 @@ public func _bjs_roundtripAPINetworkingResult(result: Int32) -> Void { @_expose(wasm, "bjs_roundTripOptionalString") @_cdecl("bjs_roundTripOptionalString") -public func _bjs_roundTripOptionalString(nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> Void { +public func _bjs_roundTripOptionalString(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalString(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -3212,7 +3369,7 @@ public func _bjs_roundTripOptionalString(nameIsSome: Int32, nameBytes: Int32, na @_expose(wasm, "bjs_roundTripOptionalInt") @_cdecl("bjs_roundTripOptionalInt") -public func _bjs_roundTripOptionalInt(valueIsSome: Int32, valueValue: Int32) -> Void { +public func _bjs_roundTripOptionalInt(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalInt(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) return ret.bridgeJSLowerReturn() @@ -3223,7 +3380,7 @@ public func _bjs_roundTripOptionalInt(valueIsSome: Int32, valueValue: Int32) -> @_expose(wasm, "bjs_roundTripOptionalBool") @_cdecl("bjs_roundTripOptionalBool") -public func _bjs_roundTripOptionalBool(flagIsSome: Int32, flagValue: Int32) -> Void { +public func _bjs_roundTripOptionalBool(_ flagIsSome: Int32, _ flagValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalBool(flag: Optional.bridgeJSLiftParameter(flagIsSome, flagValue)) return ret.bridgeJSLowerReturn() @@ -3234,7 +3391,7 @@ public func _bjs_roundTripOptionalBool(flagIsSome: Int32, flagValue: Int32) -> V @_expose(wasm, "bjs_roundTripOptionalFloat") @_cdecl("bjs_roundTripOptionalFloat") -public func _bjs_roundTripOptionalFloat(numberIsSome: Int32, numberValue: Float32) -> Void { +public func _bjs_roundTripOptionalFloat(_ numberIsSome: Int32, _ numberValue: Float32) -> Void { #if arch(wasm32) let ret = roundTripOptionalFloat(number: Optional.bridgeJSLiftParameter(numberIsSome, numberValue)) return ret.bridgeJSLowerReturn() @@ -3245,7 +3402,7 @@ public func _bjs_roundTripOptionalFloat(numberIsSome: Int32, numberValue: Float3 @_expose(wasm, "bjs_roundTripOptionalDouble") @_cdecl("bjs_roundTripOptionalDouble") -public func _bjs_roundTripOptionalDouble(precisionIsSome: Int32, precisionValue: Float64) -> Void { +public func _bjs_roundTripOptionalDouble(_ precisionIsSome: Int32, _ precisionValue: Float64) -> Void { #if arch(wasm32) let ret = roundTripOptionalDouble(precision: Optional.bridgeJSLiftParameter(precisionIsSome, precisionValue)) return ret.bridgeJSLowerReturn() @@ -3256,7 +3413,7 @@ public func _bjs_roundTripOptionalDouble(precisionIsSome: Int32, precisionValue: @_expose(wasm, "bjs_roundTripOptionalSyntax") @_cdecl("bjs_roundTripOptionalSyntax") -public func _bjs_roundTripOptionalSyntax(nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> Void { +public func _bjs_roundTripOptionalSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -3267,7 +3424,7 @@ public func _bjs_roundTripOptionalSyntax(nameIsSome: Int32, nameBytes: Int32, na @_expose(wasm, "bjs_roundTripOptionalMixSyntax") @_cdecl("bjs_roundTripOptionalMixSyntax") -public func _bjs_roundTripOptionalMixSyntax(nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> Void { +public func _bjs_roundTripOptionalMixSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalMixSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -3278,7 +3435,7 @@ public func _bjs_roundTripOptionalMixSyntax(nameIsSome: Int32, nameBytes: Int32, @_expose(wasm, "bjs_roundTripOptionalSwiftSyntax") @_cdecl("bjs_roundTripOptionalSwiftSyntax") -public func _bjs_roundTripOptionalSwiftSyntax(nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> Void { +public func _bjs_roundTripOptionalSwiftSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalSwiftSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -3289,7 +3446,7 @@ public func _bjs_roundTripOptionalSwiftSyntax(nameIsSome: Int32, nameBytes: Int3 @_expose(wasm, "bjs_roundTripOptionalWithSpaces") @_cdecl("bjs_roundTripOptionalWithSpaces") -public func _bjs_roundTripOptionalWithSpaces(valueIsSome: Int32, valueValue: Float64) -> Void { +public func _bjs_roundTripOptionalWithSpaces(_ valueIsSome: Int32, _ valueValue: Float64) -> Void { #if arch(wasm32) let ret = roundTripOptionalWithSpaces(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) return ret.bridgeJSLowerReturn() @@ -3300,7 +3457,7 @@ public func _bjs_roundTripOptionalWithSpaces(valueIsSome: Int32, valueValue: Flo @_expose(wasm, "bjs_roundTripOptionalTypeAlias") @_cdecl("bjs_roundTripOptionalTypeAlias") -public func _bjs_roundTripOptionalTypeAlias(ageIsSome: Int32, ageValue: Int32) -> Void { +public func _bjs_roundTripOptionalTypeAlias(_ ageIsSome: Int32, _ ageValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalTypeAlias(age: Optional.bridgeJSLiftParameter(ageIsSome, ageValue)) return ret.bridgeJSLowerReturn() @@ -3311,7 +3468,7 @@ public func _bjs_roundTripOptionalTypeAlias(ageIsSome: Int32, ageValue: Int32) - @_expose(wasm, "bjs_roundTripOptionalStatus") @_cdecl("bjs_roundTripOptionalStatus") -public func _bjs_roundTripOptionalStatus(valueIsSome: Int32, valueValue: Int32) -> Void { +public func _bjs_roundTripOptionalStatus(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalStatus(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) return ret.bridgeJSLowerReturn() @@ -3322,7 +3479,7 @@ public func _bjs_roundTripOptionalStatus(valueIsSome: Int32, valueValue: Int32) @_expose(wasm, "bjs_roundTripOptionalTheme") @_cdecl("bjs_roundTripOptionalTheme") -public func _bjs_roundTripOptionalTheme(valueIsSome: Int32, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_roundTripOptionalTheme(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalTheme(value: Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength)) return ret.bridgeJSLowerReturn() @@ -3333,7 +3490,7 @@ public func _bjs_roundTripOptionalTheme(valueIsSome: Int32, valueBytes: Int32, v @_expose(wasm, "bjs_roundTripOptionalHttpStatus") @_cdecl("bjs_roundTripOptionalHttpStatus") -public func _bjs_roundTripOptionalHttpStatus(valueIsSome: Int32, valueValue: Int32) -> Void { +public func _bjs_roundTripOptionalHttpStatus(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalHttpStatus(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) return ret.bridgeJSLowerReturn() @@ -3344,7 +3501,7 @@ public func _bjs_roundTripOptionalHttpStatus(valueIsSome: Int32, valueValue: Int @_expose(wasm, "bjs_roundTripOptionalTSDirection") @_cdecl("bjs_roundTripOptionalTSDirection") -public func _bjs_roundTripOptionalTSDirection(valueIsSome: Int32, valueValue: Int32) -> Void { +public func _bjs_roundTripOptionalTSDirection(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalTSDirection(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) return ret.bridgeJSLowerReturn() @@ -3355,7 +3512,7 @@ public func _bjs_roundTripOptionalTSDirection(valueIsSome: Int32, valueValue: In @_expose(wasm, "bjs_roundTripOptionalTSTheme") @_cdecl("bjs_roundTripOptionalTSTheme") -public func _bjs_roundTripOptionalTSTheme(valueIsSome: Int32, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_roundTripOptionalTSTheme(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalTSTheme(value: Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength)) return ret.bridgeJSLowerReturn() @@ -3366,7 +3523,7 @@ public func _bjs_roundTripOptionalTSTheme(valueIsSome: Int32, valueBytes: Int32, @_expose(wasm, "bjs_roundTripOptionalNetworkingAPIMethod") @_cdecl("bjs_roundTripOptionalNetworkingAPIMethod") -public func _bjs_roundTripOptionalNetworkingAPIMethod(methodIsSome: Int32, methodValue: Int32) -> Void { +public func _bjs_roundTripOptionalNetworkingAPIMethod(_ methodIsSome: Int32, _ methodValue: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalNetworkingAPIMethod(_: Optional.bridgeJSLiftParameter(methodIsSome, methodValue)) return ret.bridgeJSLowerReturn() @@ -3377,7 +3534,7 @@ public func _bjs_roundTripOptionalNetworkingAPIMethod(methodIsSome: Int32, metho @_expose(wasm, "bjs_roundTripOptionalAPIResult") @_cdecl("bjs_roundTripOptionalAPIResult") -public func _bjs_roundTripOptionalAPIResult(valueIsSome: Int32, valueCaseId: Int32) -> Void { +public func _bjs_roundTripOptionalAPIResult(_ valueIsSome: Int32, _ valueCaseId: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalAPIResult(value: Optional.bridgeJSLiftParameter(valueIsSome, valueCaseId)) return ret.bridgeJSLowerReturn() @@ -3388,7 +3545,7 @@ public func _bjs_roundTripOptionalAPIResult(valueIsSome: Int32, valueCaseId: Int @_expose(wasm, "bjs_compareAPIResults") @_cdecl("bjs_compareAPIResults") -public func _bjs_compareAPIResults(r1IsSome: Int32, r1CaseId: Int32, r2IsSome: Int32, r2CaseId: Int32) -> Void { +public func _bjs_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) @@ -3401,7 +3558,7 @@ public func _bjs_compareAPIResults(r1IsSome: Int32, r1CaseId: Int32, r2IsSome: I @_expose(wasm, "bjs_roundTripOptionalComplexResult") @_cdecl("bjs_roundTripOptionalComplexResult") -public func _bjs_roundTripOptionalComplexResult(resultIsSome: Int32, resultCaseId: Int32) -> Void { +public func _bjs_roundTripOptionalComplexResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalComplexResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) return ret.bridgeJSLowerReturn() @@ -3412,7 +3569,7 @@ public func _bjs_roundTripOptionalComplexResult(resultIsSome: Int32, resultCaseI @_expose(wasm, "bjs_roundTripOptionalClass") @_cdecl("bjs_roundTripOptionalClass") -public func _bjs_roundTripOptionalClass(valueIsSome: Int32, valueValue: UnsafeMutableRawPointer) -> Void { +public func _bjs_roundTripOptionalClass(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = roundTripOptionalClass(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) return ret.bridgeJSLowerReturn() @@ -3423,7 +3580,7 @@ public func _bjs_roundTripOptionalClass(valueIsSome: Int32, valueValue: UnsafeMu @_expose(wasm, "bjs_roundTripOptionalAPIOptionalResult") @_cdecl("bjs_roundTripOptionalAPIOptionalResult") -public func _bjs_roundTripOptionalAPIOptionalResult(resultIsSome: Int32, resultCaseId: Int32) -> Void { +public func _bjs_roundTripOptionalAPIOptionalResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) let ret = roundTripOptionalAPIOptionalResult(result: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) return ret.bridgeJSLowerReturn() @@ -3434,7 +3591,7 @@ public func _bjs_roundTripOptionalAPIOptionalResult(resultIsSome: Int32, resultC @_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 { +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() @@ -3445,7 +3602,7 @@ public func _bjs_createPropertyHolder(intValue: Int32, floatValue: Float32, doub @_expose(wasm, "bjs_testPropertyHolder") @_cdecl("bjs_testPropertyHolder") -public func _bjs_testPropertyHolder(holder: UnsafeMutableRawPointer) -> Void { +public func _bjs_testPropertyHolder(_ holder: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = testPropertyHolder(holder: PropertyHolder.bridgeJSLiftParameter(holder)) return ret.bridgeJSLowerReturn() @@ -3477,7 +3634,7 @@ public func _bjs_getObserverStats() -> Void { @_expose(wasm, "bjs_testStringDefault") @_cdecl("bjs_testStringDefault") -public func _bjs_testStringDefault(messageBytes: Int32, messageLength: Int32) -> Void { +public func _bjs_testStringDefault(_ messageBytes: Int32, _ messageLength: Int32) -> Void { #if arch(wasm32) let ret = testStringDefault(message: String.bridgeJSLiftParameter(messageBytes, messageLength)) return ret.bridgeJSLowerReturn() @@ -3488,7 +3645,7 @@ public func _bjs_testStringDefault(messageBytes: Int32, messageLength: Int32) -> @_expose(wasm, "bjs_testIntDefault") @_cdecl("bjs_testIntDefault") -public func _bjs_testIntDefault(count: Int32) -> Int32 { +public func _bjs_testIntDefault(_ count: Int32) -> Int32 { #if arch(wasm32) let ret = testIntDefault(count: Int.bridgeJSLiftParameter(count)) return ret.bridgeJSLowerReturn() @@ -3499,7 +3656,7 @@ public func _bjs_testIntDefault(count: Int32) -> Int32 { @_expose(wasm, "bjs_testBoolDefault") @_cdecl("bjs_testBoolDefault") -public func _bjs_testBoolDefault(flag: Int32) -> Int32 { +public func _bjs_testBoolDefault(_ flag: Int32) -> Int32 { #if arch(wasm32) let ret = testBoolDefault(flag: Bool.bridgeJSLiftParameter(flag)) return ret.bridgeJSLowerReturn() @@ -3510,7 +3667,7 @@ public func _bjs_testBoolDefault(flag: Int32) -> Int32 { @_expose(wasm, "bjs_testOptionalDefault") @_cdecl("bjs_testOptionalDefault") -public func _bjs_testOptionalDefault(nameIsSome: Int32, nameBytes: Int32, nameLength: Int32) -> Void { +public func _bjs_testOptionalDefault(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) let ret = testOptionalDefault(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -3521,7 +3678,7 @@ public func _bjs_testOptionalDefault(nameIsSome: Int32, nameBytes: Int32, nameLe @_expose(wasm, "bjs_testMultipleDefaults") @_cdecl("bjs_testMultipleDefaults") -public func _bjs_testMultipleDefaults(titleBytes: Int32, titleLength: Int32, count: Int32, enabled: Int32) -> Void { +public func _bjs_testMultipleDefaults(_ titleBytes: Int32, _ titleLength: Int32, _ count: Int32, _ enabled: Int32) -> Void { #if arch(wasm32) let ret = testMultipleDefaults(title: String.bridgeJSLiftParameter(titleBytes, titleLength), count: Int.bridgeJSLiftParameter(count), enabled: Bool.bridgeJSLiftParameter(enabled)) return ret.bridgeJSLowerReturn() @@ -3532,7 +3689,7 @@ public func _bjs_testMultipleDefaults(titleBytes: Int32, titleLength: Int32, cou @_expose(wasm, "bjs_testSimpleEnumDefault") @_cdecl("bjs_testSimpleEnumDefault") -public func _bjs_testSimpleEnumDefault(status: Int32) -> Int32 { +public func _bjs_testSimpleEnumDefault(_ status: Int32) -> Int32 { #if arch(wasm32) let ret = testSimpleEnumDefault(status: Status.bridgeJSLiftParameter(status)) return ret.bridgeJSLowerReturn() @@ -3543,7 +3700,7 @@ public func _bjs_testSimpleEnumDefault(status: Int32) -> Int32 { @_expose(wasm, "bjs_testDirectionDefault") @_cdecl("bjs_testDirectionDefault") -public func _bjs_testDirectionDefault(direction: Int32) -> Int32 { +public func _bjs_testDirectionDefault(_ direction: Int32) -> Int32 { #if arch(wasm32) let ret = testDirectionDefault(direction: Direction.bridgeJSLiftParameter(direction)) return ret.bridgeJSLowerReturn() @@ -3554,7 +3711,7 @@ public func _bjs_testDirectionDefault(direction: Int32) -> Int32 { @_expose(wasm, "bjs_testRawStringEnumDefault") @_cdecl("bjs_testRawStringEnumDefault") -public func _bjs_testRawStringEnumDefault(themeBytes: Int32, themeLength: Int32) -> Void { +public func _bjs_testRawStringEnumDefault(_ themeBytes: Int32, _ themeLength: Int32) -> Void { #if arch(wasm32) let ret = testRawStringEnumDefault(theme: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) return ret.bridgeJSLowerReturn() @@ -3565,7 +3722,7 @@ public func _bjs_testRawStringEnumDefault(themeBytes: Int32, themeLength: Int32) @_expose(wasm, "bjs_testComplexInit") @_cdecl("bjs_testComplexInit") -public func _bjs_testComplexInit(greeter: UnsafeMutableRawPointer) -> Void { +public func _bjs_testComplexInit(_ greeter: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = testComplexInit(greeter: Greeter.bridgeJSLiftParameter(greeter)) return ret.bridgeJSLowerReturn() @@ -3576,7 +3733,7 @@ public func _bjs_testComplexInit(greeter: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_testEmptyInit") @_cdecl("bjs_testEmptyInit") -public func _bjs_testEmptyInit(object: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_testEmptyInit(_ object: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = testEmptyInit(_: StaticPropertyHolder.bridgeJSLiftParameter(object)) return ret.bridgeJSLowerReturn() @@ -3587,7 +3744,7 @@ public func _bjs_testEmptyInit(object: UnsafeMutableRawPointer) -> UnsafeMutable @_expose(wasm, "bjs_formatName") @_cdecl("bjs_formatName") -public func _bjs_formatName(nameBytes: Int32, nameLength: Int32, transform: Int32) -> Void { +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() @@ -3598,7 +3755,7 @@ public func _bjs_formatName(nameBytes: Int32, nameLength: Int32, transform: Int3 @_expose(wasm, "bjs_makeFormatter") @_cdecl("bjs_makeFormatter") -public func _bjs_makeFormatter(prefixBytes: Int32, prefixLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_makeFormatter(_ prefixBytes: Int32, _ prefixLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = makeFormatter(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(ret) @@ -3609,7 +3766,7 @@ public func _bjs_makeFormatter(prefixBytes: Int32, prefixLength: Int32) -> Unsaf @_expose(wasm, "bjs_makeAdder") @_cdecl("bjs_makeAdder") -public func _bjs_makeAdder(base: Int32) -> UnsafeMutableRawPointer { +public func _bjs_makeAdder(_ base: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = makeAdder(base: Int.bridgeJSLiftParameter(base)) return _BJS_Closure_20BridgeJSRuntimeTestsSi_Si.bridgeJSLower(ret) @@ -3686,7 +3843,7 @@ public func _bjs_roundTripValidationReport() -> Void { @_expose(wasm, "bjs_updateValidationReport") @_cdecl("bjs_updateValidationReport") -public func _bjs_updateValidationReport(newResultIsSome: Int32, newResultCaseId: Int32) -> Void { +public func _bjs_updateValidationReport(_ newResultIsSome: Int32, _ newResultCaseId: Int32) -> Void { #if arch(wasm32) let _tmp_report = ValidationReport.bridgeJSLiftParameter() let _tmp_newResult = Optional.bridgeJSLiftParameter(newResultIsSome, newResultCaseId) @@ -3710,7 +3867,7 @@ public func _bjs_testContainerWithStruct() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_Greeter_init") @_cdecl("bjs_Greeter_init") -public func _bjs_Greeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_Greeter_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Greeter(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) return ret.bridgeJSLowerReturn() @@ -3721,7 +3878,7 @@ public func _bjs_Greeter_init(nameBytes: Int32, nameLength: Int32) -> UnsafeMuta @_expose(wasm, "bjs_Greeter_greet") @_cdecl("bjs_Greeter_greet") -public func _bjs_Greeter_greet(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Greeter_greet(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).greet() return ret.bridgeJSLowerReturn() @@ -3732,7 +3889,7 @@ public func _bjs_Greeter_greet(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Greeter_changeName") @_cdecl("bjs_Greeter_changeName") -public func _bjs_Greeter_changeName(_self: UnsafeMutableRawPointer, nameBytes: Int32, nameLength: Int32) -> Void { +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 @@ -3742,7 +3899,7 @@ public func _bjs_Greeter_changeName(_self: UnsafeMutableRawPointer, nameBytes: I @_expose(wasm, "bjs_Greeter_greetWith") @_cdecl("bjs_Greeter_greetWith") -public func _bjs_Greeter_greetWith(_self: UnsafeMutableRawPointer, greeter: UnsafeMutableRawPointer, customGreeting: Int32) -> Void { +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() @@ -3753,7 +3910,7 @@ public func _bjs_Greeter_greetWith(_self: UnsafeMutableRawPointer, greeter: Unsa @_expose(wasm, "bjs_Greeter_makeFormatter") @_cdecl("bjs_Greeter_makeFormatter") -public func _bjs_Greeter_makeFormatter(_self: UnsafeMutableRawPointer, suffixBytes: Int32, suffixLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_Greeter_makeFormatter(_ _self: UnsafeMutableRawPointer, _ suffixBytes: Int32, _ suffixLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).makeFormatter(suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(ret) @@ -3764,7 +3921,7 @@ public func _bjs_Greeter_makeFormatter(_self: UnsafeMutableRawPointer, suffixByt @_expose(wasm, "bjs_Greeter_static_makeCreator") @_cdecl("bjs_Greeter_static_makeCreator") -public func _bjs_Greeter_static_makeCreator(defaultNameBytes: Int32, defaultNameLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_Greeter_static_makeCreator(_ defaultNameBytes: Int32, _ defaultNameLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Greeter.makeCreator(defaultName: String.bridgeJSLiftParameter(defaultNameBytes, defaultNameLength)) return _BJS_Closure_20BridgeJSRuntimeTestsSS_7GreeterC.bridgeJSLower(ret) @@ -3775,7 +3932,7 @@ public func _bjs_Greeter_static_makeCreator(defaultNameBytes: Int32, defaultName @_expose(wasm, "bjs_Greeter_makeCustomGreeter") @_cdecl("bjs_Greeter_makeCustomGreeter") -public func _bjs_Greeter_makeCustomGreeter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_Greeter_makeCustomGreeter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).makeCustomGreeter() return _BJS_Closure_20BridgeJSRuntimeTests7GreeterC_SS.bridgeJSLower(ret) @@ -3786,7 +3943,7 @@ public func _bjs_Greeter_makeCustomGreeter(_self: UnsafeMutableRawPointer) -> Un @_expose(wasm, "bjs_Greeter_name_get") @_cdecl("bjs_Greeter_name_get") -public func _bjs_Greeter_name_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Greeter_name_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).name return ret.bridgeJSLowerReturn() @@ -3797,7 +3954,7 @@ public func _bjs_Greeter_name_get(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Greeter_name_set") @_cdecl("bjs_Greeter_name_set") -public func _bjs_Greeter_name_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +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 @@ -3807,7 +3964,7 @@ public func _bjs_Greeter_name_set(_self: UnsafeMutableRawPointer, valueBytes: In @_expose(wasm, "bjs_Greeter_prefix_get") @_cdecl("bjs_Greeter_prefix_get") -public func _bjs_Greeter_prefix_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Greeter_prefix_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).prefix return ret.bridgeJSLowerReturn() @@ -3818,8 +3975,12 @@ public func _bjs_Greeter_prefix_get(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Greeter_deinit") @_cdecl("bjs_Greeter_deinit") -public func _bjs_Greeter_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -3830,16 +3991,16 @@ extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Greeter_wrap") -fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Greeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_Calculator_square") @_cdecl("bjs_Calculator_square") -public func _bjs_Calculator_square(_self: UnsafeMutableRawPointer, value: Int32) -> Int32 { +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() @@ -3850,7 +4011,7 @@ public func _bjs_Calculator_square(_self: UnsafeMutableRawPointer, value: Int32) @_expose(wasm, "bjs_Calculator_add") @_cdecl("bjs_Calculator_add") -public func _bjs_Calculator_add(_self: UnsafeMutableRawPointer, a: Int32, b: Int32) -> Int32 { +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() @@ -3861,8 +4022,12 @@ public func _bjs_Calculator_add(_self: UnsafeMutableRawPointer, a: Int32, b: Int @_expose(wasm, "bjs_Calculator_deinit") @_cdecl("bjs_Calculator_deinit") -public func _bjs_Calculator_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -3873,17 +4038,21 @@ extension Calculator: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Calculator_wrap") -fileprivate func _bjs_Calculator_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Calculator_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Calculator_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Calculator_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_InternalGreeter_deinit") @_cdecl("bjs_InternalGreeter_deinit") -public func _bjs_InternalGreeter_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -3894,17 +4063,21 @@ extension InternalGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_InternalGreeter_wrap") -fileprivate func _bjs_InternalGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_InternalGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_InternalGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_InternalGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_PublicGreeter_deinit") @_cdecl("bjs_PublicGreeter_deinit") -public func _bjs_PublicGreeter_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -3915,17 +4088,21 @@ extension PublicGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PublicGreeter_wrap") -fileprivate func _bjs_PublicGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PublicGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PublicGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PublicGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_PackageGreeter_deinit") @_cdecl("bjs_PackageGreeter_deinit") -public func _bjs_PackageGreeter_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -3936,9 +4113,9 @@ extension PackageGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PackageGreeter_wrap") -fileprivate func _bjs_PackageGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PackageGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PackageGreeter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PackageGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -3956,7 +4133,7 @@ public func _bjs_Converter_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_Converter_toString") @_cdecl("bjs_Converter_toString") -public func _bjs_Converter_toString(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_Converter_toString(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) let ret = Utils.Converter.bridgeJSLiftParameter(_self).toString(value: Int.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -3967,8 +4144,12 @@ public func _bjs_Converter_toString(_self: UnsafeMutableRawPointer, value: Int32 @_expose(wasm, "bjs_Converter_deinit") @_cdecl("bjs_Converter_deinit") -public func _bjs_Converter_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_Converter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -3979,9 +4160,9 @@ extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Converter_wrap") -fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Converter_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -3999,7 +4180,7 @@ public func _bjs_HTTPServer_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_HTTPServer_call") @_cdecl("bjs_HTTPServer_call") -public func _bjs_HTTPServer_call(_self: UnsafeMutableRawPointer, method: Int32) -> Void { +public func _bjs_HTTPServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { #if arch(wasm32) Networking.API.HTTPServer.bridgeJSLiftParameter(_self).call(_: Networking.API.Method.bridgeJSLiftParameter(method)) #else @@ -4009,8 +4190,12 @@ public func _bjs_HTTPServer_call(_self: UnsafeMutableRawPointer, method: Int32) @_expose(wasm, "bjs_HTTPServer_deinit") @_cdecl("bjs_HTTPServer_deinit") -public func _bjs_HTTPServer_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_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 { @@ -4021,9 +4206,9 @@ extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObje #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_HTTPServer_wrap") -fileprivate func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_HTTPServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -4041,7 +4226,7 @@ public func _bjs_TestServer_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_TestServer_call") @_cdecl("bjs_TestServer_call") -public func _bjs_TestServer_call(_self: UnsafeMutableRawPointer, method: Int32) -> Void { +public func _bjs_TestServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { #if arch(wasm32) Internal.TestServer.bridgeJSLiftParameter(_self).call(_: Internal.SupportedMethod.bridgeJSLiftParameter(method)) #else @@ -4051,8 +4236,12 @@ public func _bjs_TestServer_call(_self: UnsafeMutableRawPointer, method: Int32) @_expose(wasm, "bjs_TestServer_deinit") @_cdecl("bjs_TestServer_deinit") -public func _bjs_TestServer_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_TestServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -4063,16 +4252,16 @@ extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TestServer_wrap") -fileprivate func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TestServer_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_OptionalPropertyHolder_init") @_cdecl("bjs_OptionalPropertyHolder_init") -public func _bjs_OptionalPropertyHolder_init(optionalNameIsSome: Int32, optionalNameBytes: Int32, optionalNameLength: Int32) -> UnsafeMutableRawPointer { +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() @@ -4083,7 +4272,7 @@ public func _bjs_OptionalPropertyHolder_init(optionalNameIsSome: Int32, optional @_expose(wasm, "bjs_OptionalPropertyHolder_optionalName_get") @_cdecl("bjs_OptionalPropertyHolder_optionalName_get") -public func _bjs_OptionalPropertyHolder_optionalName_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_OptionalPropertyHolder_optionalName_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName return ret.bridgeJSLowerReturn() @@ -4094,7 +4283,7 @@ public func _bjs_OptionalPropertyHolder_optionalName_get(_self: UnsafeMutableRaw @_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 { +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 @@ -4104,7 +4293,7 @@ public func _bjs_OptionalPropertyHolder_optionalName_set(_self: UnsafeMutableRaw @_expose(wasm, "bjs_OptionalPropertyHolder_optionalAge_get") @_cdecl("bjs_OptionalPropertyHolder_optionalAge_get") -public func _bjs_OptionalPropertyHolder_optionalAge_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_OptionalPropertyHolder_optionalAge_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalAge return ret.bridgeJSLowerReturn() @@ -4115,7 +4304,7 @@ public func _bjs_OptionalPropertyHolder_optionalAge_get(_self: UnsafeMutableRawP @_expose(wasm, "bjs_OptionalPropertyHolder_optionalAge_set") @_cdecl("bjs_OptionalPropertyHolder_optionalAge_set") -public func _bjs_OptionalPropertyHolder_optionalAge_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: Int32) -> Void { +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 @@ -4125,7 +4314,7 @@ public func _bjs_OptionalPropertyHolder_optionalAge_set(_self: UnsafeMutableRawP @_expose(wasm, "bjs_OptionalPropertyHolder_optionalGreeter_get") @_cdecl("bjs_OptionalPropertyHolder_optionalGreeter_get") -public func _bjs_OptionalPropertyHolder_optionalGreeter_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_OptionalPropertyHolder_optionalGreeter_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter return ret.bridgeJSLowerReturn() @@ -4136,7 +4325,7 @@ public func _bjs_OptionalPropertyHolder_optionalGreeter_get(_self: UnsafeMutable @_expose(wasm, "bjs_OptionalPropertyHolder_optionalGreeter_set") @_cdecl("bjs_OptionalPropertyHolder_optionalGreeter_set") -public func _bjs_OptionalPropertyHolder_optionalGreeter_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: UnsafeMutableRawPointer) -> Void { +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 @@ -4146,8 +4335,12 @@ public func _bjs_OptionalPropertyHolder_optionalGreeter_set(_self: UnsafeMutable @_expose(wasm, "bjs_OptionalPropertyHolder_deinit") @_cdecl("bjs_OptionalPropertyHolder_deinit") -public func _bjs_OptionalPropertyHolder_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -4158,16 +4351,16 @@ extension OptionalPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalPropertyHolder_wrap") -fileprivate func _bjs_OptionalPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_OptionalPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_SimplePropertyHolder_init") @_cdecl("bjs_SimplePropertyHolder_init") -public func _bjs_SimplePropertyHolder_init(value: Int32) -> UnsafeMutableRawPointer { +public func _bjs_SimplePropertyHolder_init(_ value: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = SimplePropertyHolder(value: Int.bridgeJSLiftParameter(value)) return ret.bridgeJSLowerReturn() @@ -4178,7 +4371,7 @@ public func _bjs_SimplePropertyHolder_init(value: Int32) -> UnsafeMutableRawPoin @_expose(wasm, "bjs_SimplePropertyHolder_value_get") @_cdecl("bjs_SimplePropertyHolder_value_get") -public func _bjs_SimplePropertyHolder_value_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_SimplePropertyHolder_value_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = SimplePropertyHolder.bridgeJSLiftParameter(_self).value return ret.bridgeJSLowerReturn() @@ -4189,7 +4382,7 @@ public func _bjs_SimplePropertyHolder_value_get(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_SimplePropertyHolder_value_set") @_cdecl("bjs_SimplePropertyHolder_value_set") -public func _bjs_SimplePropertyHolder_value_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_SimplePropertyHolder_value_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) SimplePropertyHolder.bridgeJSLiftParameter(_self).value = Int.bridgeJSLiftParameter(value) #else @@ -4199,8 +4392,12 @@ public func _bjs_SimplePropertyHolder_value_set(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_SimplePropertyHolder_deinit") @_cdecl("bjs_SimplePropertyHolder_deinit") -public func _bjs_SimplePropertyHolder_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -4211,16 +4408,16 @@ extension SimplePropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SimplePropertyHolder_wrap") -fileprivate func _bjs_SimplePropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_SimplePropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_SimplePropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_SimplePropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_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 { +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() @@ -4231,7 +4428,7 @@ public func _bjs_PropertyHolder_init(intValue: Int32, floatValue: Float32, doubl @_expose(wasm, "bjs_PropertyHolder_getAllValues") @_cdecl("bjs_PropertyHolder_getAllValues") -public func _bjs_PropertyHolder_getAllValues(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PropertyHolder_getAllValues(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).getAllValues() return ret.bridgeJSLowerReturn() @@ -4242,7 +4439,7 @@ public func _bjs_PropertyHolder_getAllValues(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_PropertyHolder_intValue_get") @_cdecl("bjs_PropertyHolder_intValue_get") -public func _bjs_PropertyHolder_intValue_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_intValue_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).intValue return ret.bridgeJSLowerReturn() @@ -4253,7 +4450,7 @@ public func _bjs_PropertyHolder_intValue_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_PropertyHolder_intValue_set") @_cdecl("bjs_PropertyHolder_intValue_set") -public func _bjs_PropertyHolder_intValue_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_PropertyHolder_intValue_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).intValue = Int.bridgeJSLiftParameter(value) #else @@ -4263,7 +4460,7 @@ public func _bjs_PropertyHolder_intValue_set(_self: UnsafeMutableRawPointer, val @_expose(wasm, "bjs_PropertyHolder_floatValue_get") @_cdecl("bjs_PropertyHolder_floatValue_get") -public func _bjs_PropertyHolder_floatValue_get(_self: UnsafeMutableRawPointer) -> Float32 { +public func _bjs_PropertyHolder_floatValue_get(_ _self: UnsafeMutableRawPointer) -> Float32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).floatValue return ret.bridgeJSLowerReturn() @@ -4274,7 +4471,7 @@ public func _bjs_PropertyHolder_floatValue_get(_self: UnsafeMutableRawPointer) - @_expose(wasm, "bjs_PropertyHolder_floatValue_set") @_cdecl("bjs_PropertyHolder_floatValue_set") -public func _bjs_PropertyHolder_floatValue_set(_self: UnsafeMutableRawPointer, value: Float32) -> Void { +public func _bjs_PropertyHolder_floatValue_set(_ _self: UnsafeMutableRawPointer, _ value: Float32) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).floatValue = Float.bridgeJSLiftParameter(value) #else @@ -4284,7 +4481,7 @@ public func _bjs_PropertyHolder_floatValue_set(_self: UnsafeMutableRawPointer, v @_expose(wasm, "bjs_PropertyHolder_doubleValue_get") @_cdecl("bjs_PropertyHolder_doubleValue_get") -public func _bjs_PropertyHolder_doubleValue_get(_self: UnsafeMutableRawPointer) -> Float64 { +public func _bjs_PropertyHolder_doubleValue_get(_ _self: UnsafeMutableRawPointer) -> Float64 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).doubleValue return ret.bridgeJSLowerReturn() @@ -4295,7 +4492,7 @@ public func _bjs_PropertyHolder_doubleValue_get(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_PropertyHolder_doubleValue_set") @_cdecl("bjs_PropertyHolder_doubleValue_set") -public func _bjs_PropertyHolder_doubleValue_set(_self: UnsafeMutableRawPointer, value: Float64) -> Void { +public func _bjs_PropertyHolder_doubleValue_set(_ _self: UnsafeMutableRawPointer, _ value: Float64) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).doubleValue = Double.bridgeJSLiftParameter(value) #else @@ -4305,7 +4502,7 @@ public func _bjs_PropertyHolder_doubleValue_set(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_PropertyHolder_boolValue_get") @_cdecl("bjs_PropertyHolder_boolValue_get") -public func _bjs_PropertyHolder_boolValue_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_boolValue_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).boolValue return ret.bridgeJSLowerReturn() @@ -4316,7 +4513,7 @@ public func _bjs_PropertyHolder_boolValue_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_PropertyHolder_boolValue_set") @_cdecl("bjs_PropertyHolder_boolValue_set") -public func _bjs_PropertyHolder_boolValue_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_PropertyHolder_boolValue_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).boolValue = Bool.bridgeJSLiftParameter(value) #else @@ -4326,7 +4523,7 @@ public func _bjs_PropertyHolder_boolValue_set(_self: UnsafeMutableRawPointer, va @_expose(wasm, "bjs_PropertyHolder_stringValue_get") @_cdecl("bjs_PropertyHolder_stringValue_get") -public func _bjs_PropertyHolder_stringValue_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PropertyHolder_stringValue_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).stringValue return ret.bridgeJSLowerReturn() @@ -4337,7 +4534,7 @@ public func _bjs_PropertyHolder_stringValue_get(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_PropertyHolder_stringValue_set") @_cdecl("bjs_PropertyHolder_stringValue_set") -public func _bjs_PropertyHolder_stringValue_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +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 @@ -4347,7 +4544,7 @@ public func _bjs_PropertyHolder_stringValue_set(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_PropertyHolder_readonlyInt_get") @_cdecl("bjs_PropertyHolder_readonlyInt_get") -public func _bjs_PropertyHolder_readonlyInt_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_readonlyInt_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyInt return ret.bridgeJSLowerReturn() @@ -4358,7 +4555,7 @@ public func _bjs_PropertyHolder_readonlyInt_get(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_PropertyHolder_readonlyFloat_get") @_cdecl("bjs_PropertyHolder_readonlyFloat_get") -public func _bjs_PropertyHolder_readonlyFloat_get(_self: UnsafeMutableRawPointer) -> Float32 { +public func _bjs_PropertyHolder_readonlyFloat_get(_ _self: UnsafeMutableRawPointer) -> Float32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyFloat return ret.bridgeJSLowerReturn() @@ -4369,7 +4566,7 @@ public func _bjs_PropertyHolder_readonlyFloat_get(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_PropertyHolder_readonlyDouble_get") @_cdecl("bjs_PropertyHolder_readonlyDouble_get") -public func _bjs_PropertyHolder_readonlyDouble_get(_self: UnsafeMutableRawPointer) -> Float64 { +public func _bjs_PropertyHolder_readonlyDouble_get(_ _self: UnsafeMutableRawPointer) -> Float64 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyDouble return ret.bridgeJSLowerReturn() @@ -4380,7 +4577,7 @@ public func _bjs_PropertyHolder_readonlyDouble_get(_self: UnsafeMutableRawPointe @_expose(wasm, "bjs_PropertyHolder_readonlyBool_get") @_cdecl("bjs_PropertyHolder_readonlyBool_get") -public func _bjs_PropertyHolder_readonlyBool_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_readonlyBool_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyBool return ret.bridgeJSLowerReturn() @@ -4391,7 +4588,7 @@ public func _bjs_PropertyHolder_readonlyBool_get(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_PropertyHolder_readonlyString_get") @_cdecl("bjs_PropertyHolder_readonlyString_get") -public func _bjs_PropertyHolder_readonlyString_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PropertyHolder_readonlyString_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyString return ret.bridgeJSLowerReturn() @@ -4402,7 +4599,7 @@ public func _bjs_PropertyHolder_readonlyString_get(_self: UnsafeMutableRawPointe @_expose(wasm, "bjs_PropertyHolder_jsObject_get") @_cdecl("bjs_PropertyHolder_jsObject_get") -public func _bjs_PropertyHolder_jsObject_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_jsObject_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).jsObject return ret.bridgeJSLowerReturn() @@ -4413,7 +4610,7 @@ public func _bjs_PropertyHolder_jsObject_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_PropertyHolder_jsObject_set") @_cdecl("bjs_PropertyHolder_jsObject_set") -public func _bjs_PropertyHolder_jsObject_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_PropertyHolder_jsObject_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).jsObject = JSObject.bridgeJSLiftParameter(value) #else @@ -4423,7 +4620,7 @@ public func _bjs_PropertyHolder_jsObject_set(_self: UnsafeMutableRawPointer, val @_expose(wasm, "bjs_PropertyHolder_sibling_get") @_cdecl("bjs_PropertyHolder_sibling_get") -public func _bjs_PropertyHolder_sibling_get(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_PropertyHolder_sibling_get(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).sibling return ret.bridgeJSLowerReturn() @@ -4434,7 +4631,7 @@ public func _bjs_PropertyHolder_sibling_get(_self: UnsafeMutableRawPointer) -> U @_expose(wasm, "bjs_PropertyHolder_sibling_set") @_cdecl("bjs_PropertyHolder_sibling_set") -public func _bjs_PropertyHolder_sibling_set(_self: UnsafeMutableRawPointer, value: UnsafeMutableRawPointer) -> Void { +public func _bjs_PropertyHolder_sibling_set(_ _self: UnsafeMutableRawPointer, _ value: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).sibling = SimplePropertyHolder.bridgeJSLiftParameter(value) #else @@ -4444,7 +4641,7 @@ public func _bjs_PropertyHolder_sibling_set(_self: UnsafeMutableRawPointer, valu @_expose(wasm, "bjs_PropertyHolder_lazyValue_get") @_cdecl("bjs_PropertyHolder_lazyValue_get") -public func _bjs_PropertyHolder_lazyValue_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PropertyHolder_lazyValue_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).lazyValue return ret.bridgeJSLowerReturn() @@ -4455,7 +4652,7 @@ public func _bjs_PropertyHolder_lazyValue_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_PropertyHolder_lazyValue_set") @_cdecl("bjs_PropertyHolder_lazyValue_set") -public func _bjs_PropertyHolder_lazyValue_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +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 @@ -4465,7 +4662,7 @@ public func _bjs_PropertyHolder_lazyValue_set(_self: UnsafeMutableRawPointer, va @_expose(wasm, "bjs_PropertyHolder_computedReadonly_get") @_cdecl("bjs_PropertyHolder_computedReadonly_get") -public func _bjs_PropertyHolder_computedReadonly_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_computedReadonly_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).computedReadonly return ret.bridgeJSLowerReturn() @@ -4476,7 +4673,7 @@ public func _bjs_PropertyHolder_computedReadonly_get(_self: UnsafeMutableRawPoin @_expose(wasm, "bjs_PropertyHolder_computedReadWrite_get") @_cdecl("bjs_PropertyHolder_computedReadWrite_get") -public func _bjs_PropertyHolder_computedReadWrite_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_PropertyHolder_computedReadWrite_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).computedReadWrite return ret.bridgeJSLowerReturn() @@ -4487,7 +4684,7 @@ public func _bjs_PropertyHolder_computedReadWrite_get(_self: UnsafeMutableRawPoi @_expose(wasm, "bjs_PropertyHolder_computedReadWrite_set") @_cdecl("bjs_PropertyHolder_computedReadWrite_set") -public func _bjs_PropertyHolder_computedReadWrite_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +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 @@ -4497,7 +4694,7 @@ public func _bjs_PropertyHolder_computedReadWrite_set(_self: UnsafeMutableRawPoi @_expose(wasm, "bjs_PropertyHolder_observedProperty_get") @_cdecl("bjs_PropertyHolder_observedProperty_get") -public func _bjs_PropertyHolder_observedProperty_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_PropertyHolder_observedProperty_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = PropertyHolder.bridgeJSLiftParameter(_self).observedProperty return ret.bridgeJSLowerReturn() @@ -4508,7 +4705,7 @@ public func _bjs_PropertyHolder_observedProperty_get(_self: UnsafeMutableRawPoin @_expose(wasm, "bjs_PropertyHolder_observedProperty_set") @_cdecl("bjs_PropertyHolder_observedProperty_set") -public func _bjs_PropertyHolder_observedProperty_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_PropertyHolder_observedProperty_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) PropertyHolder.bridgeJSLiftParameter(_self).observedProperty = Int.bridgeJSLiftParameter(value) #else @@ -4518,8 +4715,12 @@ public func _bjs_PropertyHolder_observedProperty_set(_self: UnsafeMutableRawPoin @_expose(wasm, "bjs_PropertyHolder_deinit") @_cdecl("bjs_PropertyHolder_deinit") -public func _bjs_PropertyHolder_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -4530,16 +4731,16 @@ extension PropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PropertyHolder_wrap") -fileprivate func _bjs_PropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_MathUtils_static_add") @_cdecl("bjs_MathUtils_static_add") -public func _bjs_MathUtils_static_add(a: Int32, b: Int32) -> Int32 { +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() @@ -4550,7 +4751,7 @@ public func _bjs_MathUtils_static_add(a: Int32, b: Int32) -> Int32 { @_expose(wasm, "bjs_MathUtils_static_substract") @_cdecl("bjs_MathUtils_static_substract") -public func _bjs_MathUtils_static_substract(a: Int32, b: Int32) -> Int32 { +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() @@ -4561,8 +4762,12 @@ public func _bjs_MathUtils_static_substract(a: Int32, b: Int32) -> Int32 { @_expose(wasm, "bjs_MathUtils_deinit") @_cdecl("bjs_MathUtils_deinit") -public func _bjs_MathUtils_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -4573,16 +4778,16 @@ extension MathUtils: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MathUtils_wrap") -fileprivate func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_MathUtils_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_ConstructorDefaults_init") @_cdecl("bjs_ConstructorDefaults_init") -public func _bjs_ConstructorDefaults_init(nameBytes: Int32, nameLength: Int32, count: Int32, enabled: Int32, status: Int32, tagIsSome: Int32, tagBytes: Int32, tagLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_ConstructorDefaults_init(_ nameBytes: Int32, _ nameLength: Int32, _ count: Int32, _ enabled: Int32, _ status: Int32, _ tagIsSome: Int32, _ tagBytes: Int32, _ tagLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = ConstructorDefaults(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() @@ -4593,7 +4798,7 @@ public func _bjs_ConstructorDefaults_init(nameBytes: Int32, nameLength: Int32, c @_expose(wasm, "bjs_ConstructorDefaults_describe") @_cdecl("bjs_ConstructorDefaults_describe") -public func _bjs_ConstructorDefaults_describe(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ConstructorDefaults_describe(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ConstructorDefaults.bridgeJSLiftParameter(_self).describe() return ret.bridgeJSLowerReturn() @@ -4604,7 +4809,7 @@ public func _bjs_ConstructorDefaults_describe(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_ConstructorDefaults_name_get") @_cdecl("bjs_ConstructorDefaults_name_get") -public func _bjs_ConstructorDefaults_name_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ConstructorDefaults_name_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ConstructorDefaults.bridgeJSLiftParameter(_self).name return ret.bridgeJSLowerReturn() @@ -4615,7 +4820,7 @@ public func _bjs_ConstructorDefaults_name_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_ConstructorDefaults_name_set") @_cdecl("bjs_ConstructorDefaults_name_set") -public func _bjs_ConstructorDefaults_name_set(_self: UnsafeMutableRawPointer, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_ConstructorDefaults_name_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) ConstructorDefaults.bridgeJSLiftParameter(_self).name = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -4625,7 +4830,7 @@ public func _bjs_ConstructorDefaults_name_set(_self: UnsafeMutableRawPointer, va @_expose(wasm, "bjs_ConstructorDefaults_count_get") @_cdecl("bjs_ConstructorDefaults_count_get") -public func _bjs_ConstructorDefaults_count_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_ConstructorDefaults_count_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = ConstructorDefaults.bridgeJSLiftParameter(_self).count return ret.bridgeJSLowerReturn() @@ -4636,7 +4841,7 @@ public func _bjs_ConstructorDefaults_count_get(_self: UnsafeMutableRawPointer) - @_expose(wasm, "bjs_ConstructorDefaults_count_set") @_cdecl("bjs_ConstructorDefaults_count_set") -public func _bjs_ConstructorDefaults_count_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_ConstructorDefaults_count_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) ConstructorDefaults.bridgeJSLiftParameter(_self).count = Int.bridgeJSLiftParameter(value) #else @@ -4646,7 +4851,7 @@ public func _bjs_ConstructorDefaults_count_set(_self: UnsafeMutableRawPointer, v @_expose(wasm, "bjs_ConstructorDefaults_enabled_get") @_cdecl("bjs_ConstructorDefaults_enabled_get") -public func _bjs_ConstructorDefaults_enabled_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_ConstructorDefaults_enabled_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = ConstructorDefaults.bridgeJSLiftParameter(_self).enabled return ret.bridgeJSLowerReturn() @@ -4657,7 +4862,7 @@ public func _bjs_ConstructorDefaults_enabled_get(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_ConstructorDefaults_enabled_set") @_cdecl("bjs_ConstructorDefaults_enabled_set") -public func _bjs_ConstructorDefaults_enabled_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_ConstructorDefaults_enabled_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) ConstructorDefaults.bridgeJSLiftParameter(_self).enabled = Bool.bridgeJSLiftParameter(value) #else @@ -4667,7 +4872,7 @@ public func _bjs_ConstructorDefaults_enabled_set(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_ConstructorDefaults_status_get") @_cdecl("bjs_ConstructorDefaults_status_get") -public func _bjs_ConstructorDefaults_status_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_ConstructorDefaults_status_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = ConstructorDefaults.bridgeJSLiftParameter(_self).status return ret.bridgeJSLowerReturn() @@ -4678,7 +4883,7 @@ public func _bjs_ConstructorDefaults_status_get(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_ConstructorDefaults_status_set") @_cdecl("bjs_ConstructorDefaults_status_set") -public func _bjs_ConstructorDefaults_status_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_ConstructorDefaults_status_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) ConstructorDefaults.bridgeJSLiftParameter(_self).status = Status.bridgeJSLiftParameter(value) #else @@ -4688,7 +4893,7 @@ public func _bjs_ConstructorDefaults_status_set(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_ConstructorDefaults_tag_get") @_cdecl("bjs_ConstructorDefaults_tag_get") -public func _bjs_ConstructorDefaults_tag_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_ConstructorDefaults_tag_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ConstructorDefaults.bridgeJSLiftParameter(_self).tag return ret.bridgeJSLowerReturn() @@ -4699,7 +4904,7 @@ public func _bjs_ConstructorDefaults_tag_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_ConstructorDefaults_tag_set") @_cdecl("bjs_ConstructorDefaults_tag_set") -public func _bjs_ConstructorDefaults_tag_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueBytes: Int32, valueLength: Int32) -> Void { +public func _bjs_ConstructorDefaults_tag_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) ConstructorDefaults.bridgeJSLiftParameter(_self).tag = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) #else @@ -4709,8 +4914,12 @@ public func _bjs_ConstructorDefaults_tag_set(_self: UnsafeMutableRawPointer, val @_expose(wasm, "bjs_ConstructorDefaults_deinit") @_cdecl("bjs_ConstructorDefaults_deinit") -public func _bjs_ConstructorDefaults_deinit(pointer: UnsafeMutableRawPointer) { +public func _bjs_ConstructorDefaults_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif } extension ConstructorDefaults: ConvertibleToJSValue, _BridgedSwiftHeapObject { @@ -4721,9 +4930,9 @@ extension ConstructorDefaults: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ConstructorDefaults_wrap") -fileprivate func _bjs_ConstructorDefaults_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ConstructorDefaults_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ConstructorDefaults_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ConstructorDefaults_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -4763,7 +4972,7 @@ public func _bjs_StaticPropertyHolder_static_staticVariable_get() -> Int32 { @_expose(wasm, "bjs_StaticPropertyHolder_static_staticVariable_set") @_cdecl("bjs_StaticPropertyHolder_static_staticVariable_set") -public func _bjs_StaticPropertyHolder_static_staticVariable_set(value: Int32) -> Void { +public func _bjs_StaticPropertyHolder_static_staticVariable_set(_ value: Int32) -> Void { #if arch(wasm32) StaticPropertyHolder.staticVariable = Int.bridgeJSLiftParameter(value) #else @@ -4784,7 +4993,7 @@ public func _bjs_StaticPropertyHolder_static_staticString_get() -> Void { @_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 { +public func _bjs_StaticPropertyHolder_static_staticString_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) StaticPropertyHolder.staticString = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -4805,7 +5014,7 @@ public func _bjs_StaticPropertyHolder_static_staticBool_get() -> Int32 { @_expose(wasm, "bjs_StaticPropertyHolder_static_staticBool_set") @_cdecl("bjs_StaticPropertyHolder_static_staticBool_set") -public func _bjs_StaticPropertyHolder_static_staticBool_set(value: Int32) -> Void { +public func _bjs_StaticPropertyHolder_static_staticBool_set(_ value: Int32) -> Void { #if arch(wasm32) StaticPropertyHolder.staticBool = Bool.bridgeJSLiftParameter(value) #else @@ -4826,7 +5035,7 @@ public func _bjs_StaticPropertyHolder_static_staticFloat_get() -> Float32 { @_expose(wasm, "bjs_StaticPropertyHolder_static_staticFloat_set") @_cdecl("bjs_StaticPropertyHolder_static_staticFloat_set") -public func _bjs_StaticPropertyHolder_static_staticFloat_set(value: Float32) -> Void { +public func _bjs_StaticPropertyHolder_static_staticFloat_set(_ value: Float32) -> Void { #if arch(wasm32) StaticPropertyHolder.staticFloat = Float.bridgeJSLiftParameter(value) #else @@ -4847,7 +5056,7 @@ public func _bjs_StaticPropertyHolder_static_staticDouble_get() -> Float64 { @_expose(wasm, "bjs_StaticPropertyHolder_static_staticDouble_set") @_cdecl("bjs_StaticPropertyHolder_static_staticDouble_set") -public func _bjs_StaticPropertyHolder_static_staticDouble_set(value: Float64) -> Void { +public func _bjs_StaticPropertyHolder_static_staticDouble_set(_ value: Float64) -> Void { #if arch(wasm32) StaticPropertyHolder.staticDouble = Double.bridgeJSLiftParameter(value) #else @@ -4868,7 +5077,7 @@ public func _bjs_StaticPropertyHolder_static_computedProperty_get() -> Void { @_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 { +public func _bjs_StaticPropertyHolder_static_computedProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) StaticPropertyHolder.computedProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) #else @@ -4900,7 +5109,7 @@ public func _bjs_StaticPropertyHolder_static_optionalString_get() -> Void { @_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 { +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 @@ -4921,7 +5130,7 @@ public func _bjs_StaticPropertyHolder_static_optionalInt_get() -> Void { @_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 { +public func _bjs_StaticPropertyHolder_static_optionalInt_set(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) StaticPropertyHolder.optionalInt = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) #else @@ -4942,7 +5151,7 @@ public func _bjs_StaticPropertyHolder_static_jsObjectProperty_get() -> Int32 { @_expose(wasm, "bjs_StaticPropertyHolder_static_jsObjectProperty_set") @_cdecl("bjs_StaticPropertyHolder_static_jsObjectProperty_set") -public func _bjs_StaticPropertyHolder_static_jsObjectProperty_set(value: Int32) -> Void { +public func _bjs_StaticPropertyHolder_static_jsObjectProperty_set(_ value: Int32) -> Void { #if arch(wasm32) StaticPropertyHolder.jsObjectProperty = JSObject.bridgeJSLiftParameter(value) #else @@ -4952,8 +5161,12 @@ public func _bjs_StaticPropertyHolder_static_jsObjectProperty_set(value: Int32) @_expose(wasm, "bjs_StaticPropertyHolder_deinit") @_cdecl("bjs_StaticPropertyHolder_deinit") -public func _bjs_StaticPropertyHolder_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -4964,16 +5177,16 @@ extension StaticPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticPropertyHolder_wrap") -fileprivate func _bjs_StaticPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_StaticPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_StaticPropertyHolder_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_StaticPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_DataProcessorManager_init") @_cdecl("bjs_DataProcessorManager_init") -public func _bjs_DataProcessorManager_init(processor: Int32) -> UnsafeMutableRawPointer { +public func _bjs_DataProcessorManager_init(_ processor: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = DataProcessorManager(processor: AnyDataProcessor.bridgeJSLiftParameter(processor)) return ret.bridgeJSLowerReturn() @@ -4984,7 +5197,7 @@ public func _bjs_DataProcessorManager_init(processor: Int32) -> UnsafeMutableRaw @_expose(wasm, "bjs_DataProcessorManager_incrementByAmount") @_cdecl("bjs_DataProcessorManager_incrementByAmount") -public func _bjs_DataProcessorManager_incrementByAmount(_self: UnsafeMutableRawPointer, amount: Int32) -> Void { +public func _bjs_DataProcessorManager_incrementByAmount(_ _self: UnsafeMutableRawPointer, _ amount: Int32) -> Void { #if arch(wasm32) DataProcessorManager.bridgeJSLiftParameter(_self).incrementByAmount(_: Int.bridgeJSLiftParameter(amount)) #else @@ -4994,7 +5207,7 @@ public func _bjs_DataProcessorManager_incrementByAmount(_self: UnsafeMutableRawP @_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 { +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 @@ -5004,7 +5217,7 @@ public func _bjs_DataProcessorManager_setProcessorLabel(_self: UnsafeMutableRawP @_expose(wasm, "bjs_DataProcessorManager_isProcessorEven") @_cdecl("bjs_DataProcessorManager_isProcessorEven") -public func _bjs_DataProcessorManager_isProcessorEven(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_DataProcessorManager_isProcessorEven(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = DataProcessorManager.bridgeJSLiftParameter(_self).isProcessorEven() return ret.bridgeJSLowerReturn() @@ -5015,7 +5228,7 @@ public func _bjs_DataProcessorManager_isProcessorEven(_self: UnsafeMutableRawPoi @_expose(wasm, "bjs_DataProcessorManager_getProcessorLabel") @_cdecl("bjs_DataProcessorManager_getProcessorLabel") -public func _bjs_DataProcessorManager_getProcessorLabel(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_DataProcessorManager_getProcessorLabel(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorLabel() return ret.bridgeJSLowerReturn() @@ -5026,7 +5239,7 @@ public func _bjs_DataProcessorManager_getProcessorLabel(_self: UnsafeMutableRawP @_expose(wasm, "bjs_DataProcessorManager_getCurrentValue") @_cdecl("bjs_DataProcessorManager_getCurrentValue") -public func _bjs_DataProcessorManager_getCurrentValue(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_DataProcessorManager_getCurrentValue(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getCurrentValue() return ret.bridgeJSLowerReturn() @@ -5037,7 +5250,7 @@ public func _bjs_DataProcessorManager_getCurrentValue(_self: UnsafeMutableRawPoi @_expose(wasm, "bjs_DataProcessorManager_incrementBoth") @_cdecl("bjs_DataProcessorManager_incrementBoth") -public func _bjs_DataProcessorManager_incrementBoth(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_DataProcessorManager_incrementBoth(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) DataProcessorManager.bridgeJSLiftParameter(_self).incrementBoth() #else @@ -5047,7 +5260,7 @@ public func _bjs_DataProcessorManager_incrementBoth(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_DataProcessorManager_getBackupValue") @_cdecl("bjs_DataProcessorManager_getBackupValue") -public func _bjs_DataProcessorManager_getBackupValue(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_DataProcessorManager_getBackupValue(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getBackupValue() return ret.bridgeJSLowerReturn() @@ -5058,7 +5271,7 @@ public func _bjs_DataProcessorManager_getBackupValue(_self: UnsafeMutableRawPoin @_expose(wasm, "bjs_DataProcessorManager_hasBackup") @_cdecl("bjs_DataProcessorManager_hasBackup") -public func _bjs_DataProcessorManager_hasBackup(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_DataProcessorManager_hasBackup(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = DataProcessorManager.bridgeJSLiftParameter(_self).hasBackup() return ret.bridgeJSLowerReturn() @@ -5069,7 +5282,7 @@ public func _bjs_DataProcessorManager_hasBackup(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_DataProcessorManager_getProcessorOptionalTag") @_cdecl("bjs_DataProcessorManager_getProcessorOptionalTag") -public func _bjs_DataProcessorManager_getProcessorOptionalTag(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_DataProcessorManager_getProcessorOptionalTag(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorOptionalTag() return ret.bridgeJSLowerReturn() @@ -5080,7 +5293,7 @@ public func _bjs_DataProcessorManager_getProcessorOptionalTag(_self: UnsafeMutab @_expose(wasm, "bjs_DataProcessorManager_setProcessorOptionalTag") @_cdecl("bjs_DataProcessorManager_setProcessorOptionalTag") -public func _bjs_DataProcessorManager_setProcessorOptionalTag(_self: UnsafeMutableRawPointer, tagIsSome: Int32, tagBytes: Int32, tagLength: Int32) -> Void { +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 @@ -5090,7 +5303,7 @@ public func _bjs_DataProcessorManager_setProcessorOptionalTag(_self: UnsafeMutab @_expose(wasm, "bjs_DataProcessorManager_getProcessorOptionalCount") @_cdecl("bjs_DataProcessorManager_getProcessorOptionalCount") -public func _bjs_DataProcessorManager_getProcessorOptionalCount(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_DataProcessorManager_getProcessorOptionalCount(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorOptionalCount() return ret.bridgeJSLowerReturn() @@ -5101,7 +5314,7 @@ public func _bjs_DataProcessorManager_getProcessorOptionalCount(_self: UnsafeMut @_expose(wasm, "bjs_DataProcessorManager_setProcessorOptionalCount") @_cdecl("bjs_DataProcessorManager_setProcessorOptionalCount") -public func _bjs_DataProcessorManager_setProcessorOptionalCount(_self: UnsafeMutableRawPointer, countIsSome: Int32, countValue: Int32) -> Void { +public func _bjs_DataProcessorManager_setProcessorOptionalCount(_ _self: UnsafeMutableRawPointer, _ countIsSome: Int32, _ countValue: Int32) -> Void { #if arch(wasm32) DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorOptionalCount(_: Optional.bridgeJSLiftParameter(countIsSome, countValue)) #else @@ -5111,7 +5324,7 @@ public func _bjs_DataProcessorManager_setProcessorOptionalCount(_self: UnsafeMut @_expose(wasm, "bjs_DataProcessorManager_getProcessorDirection") @_cdecl("bjs_DataProcessorManager_getProcessorDirection") -public func _bjs_DataProcessorManager_getProcessorDirection(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_DataProcessorManager_getProcessorDirection(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorDirection() return ret.bridgeJSLowerReturn() @@ -5122,7 +5335,7 @@ public func _bjs_DataProcessorManager_getProcessorDirection(_self: UnsafeMutable @_expose(wasm, "bjs_DataProcessorManager_setProcessorDirection") @_cdecl("bjs_DataProcessorManager_setProcessorDirection") -public func _bjs_DataProcessorManager_setProcessorDirection(_self: UnsafeMutableRawPointer, directionIsSome: Int32, directionValue: Int32) -> Void { +public func _bjs_DataProcessorManager_setProcessorDirection(_ _self: UnsafeMutableRawPointer, _ directionIsSome: Int32, _ directionValue: Int32) -> Void { #if arch(wasm32) DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorDirection(_: Optional.bridgeJSLiftParameter(directionIsSome, directionValue)) #else @@ -5132,7 +5345,7 @@ public func _bjs_DataProcessorManager_setProcessorDirection(_self: UnsafeMutable @_expose(wasm, "bjs_DataProcessorManager_getProcessorTheme") @_cdecl("bjs_DataProcessorManager_getProcessorTheme") -public func _bjs_DataProcessorManager_getProcessorTheme(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_DataProcessorManager_getProcessorTheme(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorTheme() return ret.bridgeJSLowerReturn() @@ -5143,7 +5356,7 @@ public func _bjs_DataProcessorManager_getProcessorTheme(_self: UnsafeMutableRawP @_expose(wasm, "bjs_DataProcessorManager_setProcessorTheme") @_cdecl("bjs_DataProcessorManager_setProcessorTheme") -public func _bjs_DataProcessorManager_setProcessorTheme(_self: UnsafeMutableRawPointer, themeIsSome: Int32, themeBytes: Int32, themeLength: Int32) -> Void { +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 @@ -5153,7 +5366,7 @@ public func _bjs_DataProcessorManager_setProcessorTheme(_self: UnsafeMutableRawP @_expose(wasm, "bjs_DataProcessorManager_getProcessorHttpStatus") @_cdecl("bjs_DataProcessorManager_getProcessorHttpStatus") -public func _bjs_DataProcessorManager_getProcessorHttpStatus(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_DataProcessorManager_getProcessorHttpStatus(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorHttpStatus() return ret.bridgeJSLowerReturn() @@ -5164,7 +5377,7 @@ public func _bjs_DataProcessorManager_getProcessorHttpStatus(_self: UnsafeMutabl @_expose(wasm, "bjs_DataProcessorManager_setProcessorHttpStatus") @_cdecl("bjs_DataProcessorManager_setProcessorHttpStatus") -public func _bjs_DataProcessorManager_setProcessorHttpStatus(_self: UnsafeMutableRawPointer, statusIsSome: Int32, statusValue: Int32) -> Void { +public func _bjs_DataProcessorManager_setProcessorHttpStatus(_ _self: UnsafeMutableRawPointer, _ statusIsSome: Int32, _ statusValue: Int32) -> Void { #if arch(wasm32) DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorHttpStatus(_: Optional.bridgeJSLiftParameter(statusIsSome, statusValue)) #else @@ -5174,7 +5387,7 @@ public func _bjs_DataProcessorManager_setProcessorHttpStatus(_self: UnsafeMutabl @_expose(wasm, "bjs_DataProcessorManager_getProcessorAPIResult") @_cdecl("bjs_DataProcessorManager_getProcessorAPIResult") -public func _bjs_DataProcessorManager_getProcessorAPIResult(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_DataProcessorManager_getProcessorAPIResult(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorAPIResult() return ret.bridgeJSLowerReturn() @@ -5185,7 +5398,7 @@ public func _bjs_DataProcessorManager_getProcessorAPIResult(_self: UnsafeMutable @_expose(wasm, "bjs_DataProcessorManager_setProcessorAPIResult") @_cdecl("bjs_DataProcessorManager_setProcessorAPIResult") -public func _bjs_DataProcessorManager_setProcessorAPIResult(_self: UnsafeMutableRawPointer, apiResultIsSome: Int32, apiResultCaseId: Int32) -> Void { +public func _bjs_DataProcessorManager_setProcessorAPIResult(_ _self: UnsafeMutableRawPointer, _ apiResultIsSome: Int32, _ apiResultCaseId: Int32) -> Void { #if arch(wasm32) DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorAPIResult(_: Optional.bridgeJSLiftParameter(apiResultIsSome, apiResultCaseId)) #else @@ -5195,7 +5408,7 @@ public func _bjs_DataProcessorManager_setProcessorAPIResult(_self: UnsafeMutable @_expose(wasm, "bjs_DataProcessorManager_processor_get") @_cdecl("bjs_DataProcessorManager_processor_get") -public func _bjs_DataProcessorManager_processor_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_DataProcessorManager_processor_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = DataProcessorManager.bridgeJSLiftParameter(_self).processor as! AnyDataProcessor return ret.bridgeJSLowerReturn() @@ -5206,7 +5419,7 @@ public func _bjs_DataProcessorManager_processor_get(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_DataProcessorManager_processor_set") @_cdecl("bjs_DataProcessorManager_processor_set") -public func _bjs_DataProcessorManager_processor_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_DataProcessorManager_processor_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) DataProcessorManager.bridgeJSLiftParameter(_self).processor = AnyDataProcessor.bridgeJSLiftParameter(value) #else @@ -5216,7 +5429,7 @@ public func _bjs_DataProcessorManager_processor_set(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_DataProcessorManager_backupProcessor_get") @_cdecl("bjs_DataProcessorManager_backupProcessor_get") -public func _bjs_DataProcessorManager_backupProcessor_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_DataProcessorManager_backupProcessor_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = DataProcessorManager.bridgeJSLiftParameter(_self).backupProcessor.flatMap { $0 as? AnyDataProcessor @@ -5229,7 +5442,7 @@ public func _bjs_DataProcessorManager_backupProcessor_get(_self: UnsafeMutableRa @_expose(wasm, "bjs_DataProcessorManager_backupProcessor_set") @_cdecl("bjs_DataProcessorManager_backupProcessor_set") -public func _bjs_DataProcessorManager_backupProcessor_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: Int32) -> Void { +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 @@ -5239,8 +5452,12 @@ public func _bjs_DataProcessorManager_backupProcessor_set(_self: UnsafeMutableRa @_expose(wasm, "bjs_DataProcessorManager_deinit") @_cdecl("bjs_DataProcessorManager_deinit") -public func _bjs_DataProcessorManager_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -5251,9 +5468,9 @@ extension DataProcessorManager: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessorManager_wrap") -fileprivate func _bjs_DataProcessorManager_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_DataProcessorManager_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_DataProcessorManager_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_DataProcessorManager_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -5271,7 +5488,7 @@ public func _bjs_SwiftDataProcessor_init() -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_SwiftDataProcessor_increment") @_cdecl("bjs_SwiftDataProcessor_increment") -public func _bjs_SwiftDataProcessor_increment(_self: UnsafeMutableRawPointer, amount: Int32) -> Void { +public func _bjs_SwiftDataProcessor_increment(_ _self: UnsafeMutableRawPointer, _ amount: Int32) -> Void { #if arch(wasm32) SwiftDataProcessor.bridgeJSLiftParameter(_self).increment(by: Int.bridgeJSLiftParameter(amount)) #else @@ -5281,7 +5498,7 @@ public func _bjs_SwiftDataProcessor_increment(_self: UnsafeMutableRawPointer, am @_expose(wasm, "bjs_SwiftDataProcessor_getValue") @_cdecl("bjs_SwiftDataProcessor_getValue") -public func _bjs_SwiftDataProcessor_getValue(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_SwiftDataProcessor_getValue(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).getValue() return ret.bridgeJSLowerReturn() @@ -5292,7 +5509,7 @@ public func _bjs_SwiftDataProcessor_getValue(_self: UnsafeMutableRawPointer) -> @_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 { +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 @@ -5302,7 +5519,7 @@ public func _bjs_SwiftDataProcessor_setLabelElements(_self: UnsafeMutableRawPoin @_expose(wasm, "bjs_SwiftDataProcessor_getLabel") @_cdecl("bjs_SwiftDataProcessor_getLabel") -public func _bjs_SwiftDataProcessor_getLabel(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_SwiftDataProcessor_getLabel(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).getLabel() return ret.bridgeJSLowerReturn() @@ -5313,7 +5530,7 @@ public func _bjs_SwiftDataProcessor_getLabel(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_SwiftDataProcessor_isEven") @_cdecl("bjs_SwiftDataProcessor_isEven") -public func _bjs_SwiftDataProcessor_isEven(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_SwiftDataProcessor_isEven(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).isEven() return ret.bridgeJSLowerReturn() @@ -5324,7 +5541,7 @@ public func _bjs_SwiftDataProcessor_isEven(_self: UnsafeMutableRawPointer) -> In @_expose(wasm, "bjs_SwiftDataProcessor_processGreeter") @_cdecl("bjs_SwiftDataProcessor_processGreeter") -public func _bjs_SwiftDataProcessor_processGreeter(_self: UnsafeMutableRawPointer, greeter: UnsafeMutableRawPointer) -> Void { +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() @@ -5335,7 +5552,7 @@ public func _bjs_SwiftDataProcessor_processGreeter(_self: UnsafeMutableRawPointe @_expose(wasm, "bjs_SwiftDataProcessor_createGreeter") @_cdecl("bjs_SwiftDataProcessor_createGreeter") -public func _bjs_SwiftDataProcessor_createGreeter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_SwiftDataProcessor_createGreeter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).createGreeter() return ret.bridgeJSLowerReturn() @@ -5346,7 +5563,7 @@ public func _bjs_SwiftDataProcessor_createGreeter(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_SwiftDataProcessor_processOptionalGreeter") @_cdecl("bjs_SwiftDataProcessor_processOptionalGreeter") -public func _bjs_SwiftDataProcessor_processOptionalGreeter(_self: UnsafeMutableRawPointer, greeterIsSome: Int32, greeterValue: UnsafeMutableRawPointer) -> Void { +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() @@ -5357,7 +5574,7 @@ public func _bjs_SwiftDataProcessor_processOptionalGreeter(_self: UnsafeMutableR @_expose(wasm, "bjs_SwiftDataProcessor_createOptionalGreeter") @_cdecl("bjs_SwiftDataProcessor_createOptionalGreeter") -public func _bjs_SwiftDataProcessor_createOptionalGreeter(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_SwiftDataProcessor_createOptionalGreeter(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).createOptionalGreeter() return ret.bridgeJSLowerReturn() @@ -5368,7 +5585,7 @@ public func _bjs_SwiftDataProcessor_createOptionalGreeter(_self: UnsafeMutableRa @_expose(wasm, "bjs_SwiftDataProcessor_handleAPIResult") @_cdecl("bjs_SwiftDataProcessor_handleAPIResult") -public func _bjs_SwiftDataProcessor_handleAPIResult(_self: UnsafeMutableRawPointer, resultIsSome: Int32, resultCaseId: Int32) -> Void { +public func _bjs_SwiftDataProcessor_handleAPIResult(_ _self: UnsafeMutableRawPointer, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) SwiftDataProcessor.bridgeJSLiftParameter(_self).handleAPIResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) #else @@ -5378,7 +5595,7 @@ public func _bjs_SwiftDataProcessor_handleAPIResult(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_SwiftDataProcessor_getAPIResult") @_cdecl("bjs_SwiftDataProcessor_getAPIResult") -public func _bjs_SwiftDataProcessor_getAPIResult(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_SwiftDataProcessor_getAPIResult(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).getAPIResult() return ret.bridgeJSLowerReturn() @@ -5389,7 +5606,7 @@ public func _bjs_SwiftDataProcessor_getAPIResult(_self: UnsafeMutableRawPointer) @_expose(wasm, "bjs_SwiftDataProcessor_count_get") @_cdecl("bjs_SwiftDataProcessor_count_get") -public func _bjs_SwiftDataProcessor_count_get(_self: UnsafeMutableRawPointer) -> Int32 { +public func _bjs_SwiftDataProcessor_count_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).count return ret.bridgeJSLowerReturn() @@ -5400,7 +5617,7 @@ public func _bjs_SwiftDataProcessor_count_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_SwiftDataProcessor_count_set") @_cdecl("bjs_SwiftDataProcessor_count_set") -public func _bjs_SwiftDataProcessor_count_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_SwiftDataProcessor_count_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) SwiftDataProcessor.bridgeJSLiftParameter(_self).count = Int.bridgeJSLiftParameter(value) #else @@ -5410,7 +5627,7 @@ public func _bjs_SwiftDataProcessor_count_set(_self: UnsafeMutableRawPointer, va @_expose(wasm, "bjs_SwiftDataProcessor_name_get") @_cdecl("bjs_SwiftDataProcessor_name_get") -public func _bjs_SwiftDataProcessor_name_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_SwiftDataProcessor_name_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).name return ret.bridgeJSLowerReturn() @@ -5421,7 +5638,7 @@ public func _bjs_SwiftDataProcessor_name_get(_self: UnsafeMutableRawPointer) -> @_expose(wasm, "bjs_SwiftDataProcessor_optionalTag_get") @_cdecl("bjs_SwiftDataProcessor_optionalTag_get") -public func _bjs_SwiftDataProcessor_optionalTag_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_SwiftDataProcessor_optionalTag_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalTag return ret.bridgeJSLowerReturn() @@ -5432,7 +5649,7 @@ public func _bjs_SwiftDataProcessor_optionalTag_get(_self: UnsafeMutableRawPoint @_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 { +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 @@ -5442,7 +5659,7 @@ public func _bjs_SwiftDataProcessor_optionalTag_set(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_SwiftDataProcessor_optionalCount_get") @_cdecl("bjs_SwiftDataProcessor_optionalCount_get") -public func _bjs_SwiftDataProcessor_optionalCount_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_SwiftDataProcessor_optionalCount_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalCount return ret.bridgeJSLowerReturn() @@ -5453,7 +5670,7 @@ public func _bjs_SwiftDataProcessor_optionalCount_get(_self: UnsafeMutableRawPoi @_expose(wasm, "bjs_SwiftDataProcessor_optionalCount_set") @_cdecl("bjs_SwiftDataProcessor_optionalCount_set") -public func _bjs_SwiftDataProcessor_optionalCount_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: Int32) -> Void { +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 @@ -5463,7 +5680,7 @@ public func _bjs_SwiftDataProcessor_optionalCount_set(_self: UnsafeMutableRawPoi @_expose(wasm, "bjs_SwiftDataProcessor_direction_get") @_cdecl("bjs_SwiftDataProcessor_direction_get") -public func _bjs_SwiftDataProcessor_direction_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_SwiftDataProcessor_direction_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).direction return ret.bridgeJSLowerReturn() @@ -5474,7 +5691,7 @@ public func _bjs_SwiftDataProcessor_direction_get(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_SwiftDataProcessor_direction_set") @_cdecl("bjs_SwiftDataProcessor_direction_set") -public func _bjs_SwiftDataProcessor_direction_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: Int32) -> Void { +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 @@ -5484,7 +5701,7 @@ public func _bjs_SwiftDataProcessor_direction_set(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_SwiftDataProcessor_optionalTheme_get") @_cdecl("bjs_SwiftDataProcessor_optionalTheme_get") -public func _bjs_SwiftDataProcessor_optionalTheme_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_SwiftDataProcessor_optionalTheme_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalTheme return ret.bridgeJSLowerReturn() @@ -5495,7 +5712,7 @@ public func _bjs_SwiftDataProcessor_optionalTheme_get(_self: UnsafeMutableRawPoi @_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 { +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 @@ -5505,7 +5722,7 @@ public func _bjs_SwiftDataProcessor_optionalTheme_set(_self: UnsafeMutableRawPoi @_expose(wasm, "bjs_SwiftDataProcessor_httpStatus_get") @_cdecl("bjs_SwiftDataProcessor_httpStatus_get") -public func _bjs_SwiftDataProcessor_httpStatus_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_SwiftDataProcessor_httpStatus_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).httpStatus return ret.bridgeJSLowerReturn() @@ -5516,7 +5733,7 @@ public func _bjs_SwiftDataProcessor_httpStatus_get(_self: UnsafeMutableRawPointe @_expose(wasm, "bjs_SwiftDataProcessor_httpStatus_set") @_cdecl("bjs_SwiftDataProcessor_httpStatus_set") -public func _bjs_SwiftDataProcessor_httpStatus_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: Int32) -> Void { +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 @@ -5526,7 +5743,7 @@ public func _bjs_SwiftDataProcessor_httpStatus_set(_self: UnsafeMutableRawPointe @_expose(wasm, "bjs_SwiftDataProcessor_apiResult_get") @_cdecl("bjs_SwiftDataProcessor_apiResult_get") -public func _bjs_SwiftDataProcessor_apiResult_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_SwiftDataProcessor_apiResult_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).apiResult return ret.bridgeJSLowerReturn() @@ -5537,7 +5754,7 @@ public func _bjs_SwiftDataProcessor_apiResult_get(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_SwiftDataProcessor_apiResult_set") @_cdecl("bjs_SwiftDataProcessor_apiResult_set") -public func _bjs_SwiftDataProcessor_apiResult_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueCaseId: Int32) -> Void { +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 @@ -5547,7 +5764,7 @@ public func _bjs_SwiftDataProcessor_apiResult_set(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_SwiftDataProcessor_helper_get") @_cdecl("bjs_SwiftDataProcessor_helper_get") -public func _bjs_SwiftDataProcessor_helper_get(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_SwiftDataProcessor_helper_get(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).helper return ret.bridgeJSLowerReturn() @@ -5558,7 +5775,7 @@ public func _bjs_SwiftDataProcessor_helper_get(_self: UnsafeMutableRawPointer) - @_expose(wasm, "bjs_SwiftDataProcessor_helper_set") @_cdecl("bjs_SwiftDataProcessor_helper_set") -public func _bjs_SwiftDataProcessor_helper_set(_self: UnsafeMutableRawPointer, value: UnsafeMutableRawPointer) -> Void { +public func _bjs_SwiftDataProcessor_helper_set(_ _self: UnsafeMutableRawPointer, _ value: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) SwiftDataProcessor.bridgeJSLiftParameter(_self).helper = Greeter.bridgeJSLiftParameter(value) #else @@ -5568,7 +5785,7 @@ public func _bjs_SwiftDataProcessor_helper_set(_self: UnsafeMutableRawPointer, v @_expose(wasm, "bjs_SwiftDataProcessor_optionalHelper_get") @_cdecl("bjs_SwiftDataProcessor_optionalHelper_get") -public func _bjs_SwiftDataProcessor_optionalHelper_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_SwiftDataProcessor_optionalHelper_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalHelper return ret.bridgeJSLowerReturn() @@ -5579,7 +5796,7 @@ public func _bjs_SwiftDataProcessor_optionalHelper_get(_self: UnsafeMutableRawPo @_expose(wasm, "bjs_SwiftDataProcessor_optionalHelper_set") @_cdecl("bjs_SwiftDataProcessor_optionalHelper_set") -public func _bjs_SwiftDataProcessor_optionalHelper_set(_self: UnsafeMutableRawPointer, valueIsSome: Int32, valueValue: UnsafeMutableRawPointer) -> Void { +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 @@ -5589,8 +5806,12 @@ public func _bjs_SwiftDataProcessor_optionalHelper_set(_self: UnsafeMutableRawPo @_expose(wasm, "bjs_SwiftDataProcessor_deinit") @_cdecl("bjs_SwiftDataProcessor_deinit") -public func _bjs_SwiftDataProcessor_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -5601,16 +5822,16 @@ extension SwiftDataProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftDataProcessor_wrap") -fileprivate func _bjs_SwiftDataProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_SwiftDataProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_SwiftDataProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_SwiftDataProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_TextProcessor_init") @_cdecl("bjs_TextProcessor_init") -public func _bjs_TextProcessor_init(transform: Int32) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_init(_ transform: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor(transform: _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(transform)) return ret.bridgeJSLowerReturn() @@ -5621,7 +5842,7 @@ public func _bjs_TextProcessor_init(transform: Int32) -> UnsafeMutableRawPointer @_expose(wasm, "bjs_TextProcessor_process") @_cdecl("bjs_TextProcessor_process") -public func _bjs_TextProcessor_process(_self: UnsafeMutableRawPointer, textBytes: Int32, textLength: Int32) -> Void { +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() @@ -5632,7 +5853,7 @@ public func _bjs_TextProcessor_process(_self: UnsafeMutableRawPointer, textBytes @_expose(wasm, "bjs_TextProcessor_processWithCustom") @_cdecl("bjs_TextProcessor_processWithCustom") -public func _bjs_TextProcessor_processWithCustom(_self: UnsafeMutableRawPointer, textBytes: Int32, textLength: Int32, customTransform: Int32) -> Void { +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() @@ -5643,7 +5864,7 @@ public func _bjs_TextProcessor_processWithCustom(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_TextProcessor_getTransform") @_cdecl("bjs_TextProcessor_getTransform") -public func _bjs_TextProcessor_getTransform(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_getTransform(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).getTransform() return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(ret) @@ -5654,7 +5875,7 @@ public func _bjs_TextProcessor_getTransform(_self: UnsafeMutableRawPointer) -> U @_expose(wasm, "bjs_TextProcessor_processOptionalString") @_cdecl("bjs_TextProcessor_processOptionalString") -public func _bjs_TextProcessor_processOptionalString(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +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() @@ -5665,7 +5886,7 @@ public func _bjs_TextProcessor_processOptionalString(_self: UnsafeMutableRawPoin @_expose(wasm, "bjs_TextProcessor_processOptionalInt") @_cdecl("bjs_TextProcessor_processOptionalInt") -public func _bjs_TextProcessor_processOptionalInt(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +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() @@ -5676,7 +5897,7 @@ public func _bjs_TextProcessor_processOptionalInt(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_TextProcessor_processOptionalGreeter") @_cdecl("bjs_TextProcessor_processOptionalGreeter") -public func _bjs_TextProcessor_processOptionalGreeter(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +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() @@ -5687,7 +5908,7 @@ public func _bjs_TextProcessor_processOptionalGreeter(_self: UnsafeMutableRawPoi @_expose(wasm, "bjs_TextProcessor_makeOptionalStringFormatter") @_cdecl("bjs_TextProcessor_makeOptionalStringFormatter") -public func _bjs_TextProcessor_makeOptionalStringFormatter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeOptionalStringFormatter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalStringFormatter() return _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS.bridgeJSLower(ret) @@ -5698,7 +5919,7 @@ public func _bjs_TextProcessor_makeOptionalStringFormatter(_self: UnsafeMutableR @_expose(wasm, "bjs_TextProcessor_makeOptionalGreeterCreator") @_cdecl("bjs_TextProcessor_makeOptionalGreeterCreator") -public func _bjs_TextProcessor_makeOptionalGreeterCreator(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeOptionalGreeterCreator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalGreeterCreator() return _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC.bridgeJSLower(ret) @@ -5709,7 +5930,7 @@ public func _bjs_TextProcessor_makeOptionalGreeterCreator(_self: UnsafeMutableRa @_expose(wasm, "bjs_TextProcessor_processDirection") @_cdecl("bjs_TextProcessor_processDirection") -public func _bjs_TextProcessor_processDirection(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +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() @@ -5720,7 +5941,7 @@ public func _bjs_TextProcessor_processDirection(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_TextProcessor_processTheme") @_cdecl("bjs_TextProcessor_processTheme") -public func _bjs_TextProcessor_processTheme(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +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() @@ -5731,7 +5952,7 @@ public func _bjs_TextProcessor_processTheme(_self: UnsafeMutableRawPointer, call @_expose(wasm, "bjs_TextProcessor_processHttpStatus") @_cdecl("bjs_TextProcessor_processHttpStatus") -public func _bjs_TextProcessor_processHttpStatus(_self: UnsafeMutableRawPointer, callback: Int32) -> Int32 { +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() @@ -5742,7 +5963,7 @@ public func _bjs_TextProcessor_processHttpStatus(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_TextProcessor_processAPIResult") @_cdecl("bjs_TextProcessor_processAPIResult") -public func _bjs_TextProcessor_processAPIResult(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +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() @@ -5753,7 +5974,7 @@ public func _bjs_TextProcessor_processAPIResult(_self: UnsafeMutableRawPointer, @_expose(wasm, "bjs_TextProcessor_makeDirectionChecker") @_cdecl("bjs_TextProcessor_makeDirectionChecker") -public func _bjs_TextProcessor_makeDirectionChecker(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() return _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb.bridgeJSLower(ret) @@ -5764,7 +5985,7 @@ public func _bjs_TextProcessor_makeDirectionChecker(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_TextProcessor_makeThemeValidator") @_cdecl("bjs_TextProcessor_makeThemeValidator") -public func _bjs_TextProcessor_makeThemeValidator(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() return _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb.bridgeJSLower(ret) @@ -5775,7 +5996,7 @@ public func _bjs_TextProcessor_makeThemeValidator(_self: UnsafeMutableRawPointer @_expose(wasm, "bjs_TextProcessor_makeStatusCodeExtractor") @_cdecl("bjs_TextProcessor_makeStatusCodeExtractor") -public func _bjs_TextProcessor_makeStatusCodeExtractor(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() return _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si.bridgeJSLower(ret) @@ -5786,7 +6007,7 @@ public func _bjs_TextProcessor_makeStatusCodeExtractor(_self: UnsafeMutableRawPo @_expose(wasm, "bjs_TextProcessor_makeAPIResultHandler") @_cdecl("bjs_TextProcessor_makeAPIResultHandler") -public func _bjs_TextProcessor_makeAPIResultHandler(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeAPIResultHandler(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() return _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS.bridgeJSLower(ret) @@ -5797,7 +6018,7 @@ public func _bjs_TextProcessor_makeAPIResultHandler(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_TextProcessor_processOptionalDirection") @_cdecl("bjs_TextProcessor_processOptionalDirection") -public func _bjs_TextProcessor_processOptionalDirection(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +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() @@ -5808,7 +6029,7 @@ public func _bjs_TextProcessor_processOptionalDirection(_self: UnsafeMutableRawP @_expose(wasm, "bjs_TextProcessor_processOptionalTheme") @_cdecl("bjs_TextProcessor_processOptionalTheme") -public func _bjs_TextProcessor_processOptionalTheme(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +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() @@ -5819,7 +6040,7 @@ public func _bjs_TextProcessor_processOptionalTheme(_self: UnsafeMutableRawPoint @_expose(wasm, "bjs_TextProcessor_processOptionalAPIResult") @_cdecl("bjs_TextProcessor_processOptionalAPIResult") -public func _bjs_TextProcessor_processOptionalAPIResult(_self: UnsafeMutableRawPointer, callback: Int32) -> Void { +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() @@ -5830,7 +6051,7 @@ public func _bjs_TextProcessor_processOptionalAPIResult(_self: UnsafeMutableRawP @_expose(wasm, "bjs_TextProcessor_makeOptionalDirectionFormatter") @_cdecl("bjs_TextProcessor_makeOptionalDirectionFormatter") -public func _bjs_TextProcessor_makeOptionalDirectionFormatter(_self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeOptionalDirectionFormatter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() return _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS.bridgeJSLower(ret) @@ -5841,8 +6062,12 @@ public func _bjs_TextProcessor_makeOptionalDirectionFormatter(_self: UnsafeMutab @_expose(wasm, "bjs_TextProcessor_deinit") @_cdecl("bjs_TextProcessor_deinit") -public func _bjs_TextProcessor_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -5853,16 +6078,16 @@ extension TextProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TextProcessor_wrap") -fileprivate func _bjs_TextProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TextProcessor_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @_expose(wasm, "bjs_Container_init") @_cdecl("bjs_Container_init") -public func _bjs_Container_init(config: Int32) -> UnsafeMutableRawPointer { +public func _bjs_Container_init(_ config: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let _tmp_config = Optional.bridgeJSLiftParameter(config) let _tmp_location = DataPoint.bridgeJSLiftParameter() @@ -5875,7 +6100,7 @@ public func _bjs_Container_init(config: Int32) -> UnsafeMutableRawPointer { @_expose(wasm, "bjs_Container_location_get") @_cdecl("bjs_Container_location_get") -public func _bjs_Container_location_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Container_location_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = Container.bridgeJSLiftParameter(_self).location return ret.bridgeJSLowerReturn() @@ -5886,7 +6111,7 @@ public func _bjs_Container_location_get(_self: UnsafeMutableRawPointer) -> Void @_expose(wasm, "bjs_Container_location_set") @_cdecl("bjs_Container_location_set") -public func _bjs_Container_location_set(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Container_location_set(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) Container.bridgeJSLiftParameter(_self).location = DataPoint.bridgeJSLiftParameter() #else @@ -5896,7 +6121,7 @@ public func _bjs_Container_location_set(_self: UnsafeMutableRawPointer) -> Void @_expose(wasm, "bjs_Container_config_get") @_cdecl("bjs_Container_config_get") -public func _bjs_Container_config_get(_self: UnsafeMutableRawPointer) -> Void { +public func _bjs_Container_config_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = Container.bridgeJSLiftParameter(_self).config return ret.bridgeJSLowerReturn() @@ -5907,7 +6132,7 @@ public func _bjs_Container_config_get(_self: UnsafeMutableRawPointer) -> Void { @_expose(wasm, "bjs_Container_config_set") @_cdecl("bjs_Container_config_set") -public func _bjs_Container_config_set(_self: UnsafeMutableRawPointer, value: Int32) -> Void { +public func _bjs_Container_config_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) Container.bridgeJSLiftParameter(_self).config = Optional.bridgeJSLiftParameter(value) #else @@ -5917,8 +6142,12 @@ public func _bjs_Container_config_set(_self: UnsafeMutableRawPointer, value: Int @_expose(wasm, "bjs_Container_deinit") @_cdecl("bjs_Container_deinit") -public func _bjs_Container_deinit(pointer: UnsafeMutableRawPointer) { +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 { @@ -5929,9 +6158,9 @@ extension Container: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Container_wrap") -fileprivate func _bjs_Container_wrap(_: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Container_wrap(_: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif \ No newline at end of file From 0a90ab7f1be5b0c5c9e22b81fa29fd73f56bbda7 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 14 Jan 2026 19:56:34 +0900 Subject: [PATCH 065/252] BridgeJS: Remove dead code --- .../Sources/BridgeJSCore/ImportTS.swift | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 1a3bd0ceb..e4f6c89bc 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -483,18 +483,6 @@ public struct ImportTS { return Trivia(pieces: lines.flatMap { [TriviaPiece.docLineComment("/// \($0)"), .newlines(1)] }) } - static func buildFunctionEffect(throws: Bool, async: Bool) -> FunctionEffectSpecifiersSyntax { - return FunctionEffectSpecifiersSyntax( - asyncSpecifier: `async` ? .keyword(.async) : nil, - throwsClause: `throws` - ? ThrowsClauseSyntax( - throwsSpecifier: .keyword(.throws), - leftParen: .leftParenToken(), - type: IdentifierTypeSyntax(name: .identifier("JSException")), - rightParen: .rightParenToken() - ) : nil - ) - } static func buildAccessorEffect(throws: Bool, async: Bool) -> AccessorEffectSpecifiersSyntax { return AccessorEffectSpecifiersSyntax( asyncSpecifier: `async` ? .keyword(.async) : nil, @@ -679,33 +667,6 @@ struct SwiftSignatureBuilder { let identifierType = IdentifierTypeSyntax(name: .identifier(type.swiftType)) return TypeSyntax(identifierType) } - - /// Formats a FunctionSignatureSyntax to a string representation - /// - /// Useful when string interpolation is needed (e.g., in renderExternDecl) - static func formatSignatureToString(_ signature: FunctionSignatureSyntax) -> String { - let format = BasicFormat() - return signature.formatted(using: format).description - } - - /// Formats a FunctionParameterClauseSyntax to a string representation - /// - /// Useful for building parameter signature strings - static func formatParameterClauseToString(_ clause: FunctionParameterClauseSyntax) -> String { - let format = BasicFormat() - return clause.formatted(using: format).description - } - - /// Formats a ReturnClauseSyntax to a string representation - /// - /// Useful for building return type signature strings - static func formatReturnClauseToString(_ clause: ReturnClauseSyntax?) -> String { - guard let clause = clause else { - return "" - } - let format = BasicFormat() - return clause.formatted(using: format).description - } } enum SwiftCodePattern { From dbeee8aa950de4c3a7d0757ea485d5093337ba55 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 17 Jan 2026 19:26:23 +0900 Subject: [PATCH 066/252] Drop Swift 6.0 support (#500) --- .github/workflows/test.yml | 5 -- CONTRIBUTING.md | 49 ++++++------------- Package.swift | 2 +- .../Articles/Deploying-Pages.md | 2 +- 4 files changed, 18 insertions(+), 40 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b79d911ab..0ee5bf317 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,11 +9,6 @@ jobs: strategy: matrix: entry: - - os: ubuntu-22.04 - toolchain: - download-url: https://download.swift.org/swift-6.0.2-release/ubuntu2204/swift-6.0.2-RELEASE/swift-6.0.2-RELEASE-ubuntu22.04.tar.gz - wasi-backend: Node - target: "wasm32-unknown-wasi" - os: ubuntu-22.04 toolchain: download-url: https://download.swift.org/swift-6.1-release/ubuntu2204/swift-6.1-RELEASE/swift-6.1-RELEASE-ubuntu22.04.tar.gz diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 712aeffb7..339a268ee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,41 +18,24 @@ Thank you for considering contributing to JavaScriptKit! We welcome contribution cd JavaScriptKit ``` -2. Install **OSS** Swift toolchain (not the one from Xcode): -
        - For macOS users - - ```bash - ( - SWIFT_TOOLCHAIN_CHANNEL=swift-6.0.2-release; - SWIFT_TOOLCHAIN_TAG="swift-6.0.2-RELEASE"; - SWIFT_SDK_TAG="swift-wasm-6.0.2-RELEASE"; - SWIFT_SDK_CHECKSUM="6ffedb055cb9956395d9f435d03d53ebe9f6a8d45106b979d1b7f53358e1dcb4"; - pkg="$(mktemp -d)/InstallMe.pkg"; set -ex; - curl -o "$pkg" "https://download.swift.org/$SWIFT_TOOLCHAIN_CHANNEL/xcode/$SWIFT_TOOLCHAIN_TAG/$SWIFT_TOOLCHAIN_TAG-osx.pkg"; - installer -pkg "$pkg" -target CurrentUserHomeDirectory; - export TOOLCHAINS="$(plutil -extract CFBundleIdentifier raw ~/Library/Developer/Toolchains/$SWIFT_TOOLCHAIN_TAG.xctoolchain/Info.plist)"; - swift sdk install "https://github.com/swiftwasm/swift/releases/download/$SWIFT_SDK_TAG/$SWIFT_SDK_TAG-wasm32-unknown-wasi.artifactbundle.zip" --checksum "$SWIFT_SDK_CHECKSUM"; - ) - ``` - -
        - -
        - For Linux users - Install Swift 6.0.2 by following the instructions on the official Swift website. - +2. Install **OSS** Swift toolchain via `swiftly` +3. Install Swift SDK for Wasm corresponding to the Swift version: ```bash ( - SWIFT_SDK_TAG="swift-wasm-6.0.2-RELEASE"; - SWIFT_SDK_CHECKSUM="6ffedb055cb9956395d9f435d03d53ebe9f6a8d45106b979d1b7f53358e1dcb4"; - swift sdk install "https://github.com/swiftwasm/swift/releases/download/$SWIFT_SDK_TAG/$SWIFT_SDK_TAG-wasm32-unknown-wasi.artifactbundle.zip" --checksum "$SWIFT_SDK_CHECKSUM"; + set -eo pipefail; \ + V="$(swiftc --version | head -n1)"; \ + TAG="$(curl -sL "https://raw.githubusercontent.com/swiftwasm/swift-sdk-index/refs/heads/main/v1/tag-by-version.json" | jq -e -r --arg v "$V" '.[$v] | .[-1]')"; \ + curl -sL "https://raw.githubusercontent.com/swiftwasm/swift-sdk-index/refs/heads/main/v1/builds/$TAG.json" | \ + jq -r '.["swift-sdks"]["wasm32-unknown-wasip1"] | "swift sdk install \"\(.url)\" --checksum \"\(.checksum)\""' | sh -x + ); + export SWIFT_SDK_ID=$( + V="$(swiftc --version | head -n1)"; \ + TAG="$(curl -sL "https://raw.githubusercontent.com/swiftwasm/swift-sdk-index/refs/heads/main/v1/tag-by-version.json" | jq -e -r --arg v "$V" '.[$v] | .[-1]')"; \ + curl -sL "https://raw.githubusercontent.com/swiftwasm/swift-sdk-index/refs/heads/main/v1/builds/$TAG.json" | \ + jq -r '.["swift-sdks"]["wasm32-unknown-wasip1"]["id"]' ) ``` - -
        - -3. Install dependencies: +4. Install dependencies: ```bash make bootstrap ``` @@ -62,7 +45,7 @@ Thank you for considering contributing to JavaScriptKit! We welcome contribution Unit tests running on WebAssembly: ```bash -make unittest SWIFT_SDK_ID=wasm32-unknown-wasi +make unittest ``` Tests for `PackageToJS` plugin: @@ -112,7 +95,7 @@ Run this script when you've made changes to: These changes require updating the pre-generated Swift bindings committed to the repository. -**Adding new BridgeJS intrinsics:** +**Adding new BridgeJS intrinsics:** If you add new `@_extern(wasm, module: "bjs")` functions to [`BridgeJSIntrinsics.swift`](Sources/JavaScriptKit/BridgeJSIntrinsics.swift), also add corresponding stub entries to [`Plugins/PackageToJS/Templates/instantiate.js`](Plugins/PackageToJS/Templates/instantiate.js) in the `importObject["bjs"]` object. This allows packages without BridgeJS-generated code to instantiate successfully. diff --git a/Package.swift b/Package.swift index 670b43500..f1e5a04c9 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:6.0 +// swift-tools-version:6.1 import CompilerPluginSupport import PackageDescription diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/Deploying-Pages.md b/Sources/JavaScriptKit/Documentation.docc/Articles/Deploying-Pages.md index 1de371e40..435a00f53 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/Deploying-Pages.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/Deploying-Pages.md @@ -63,7 +63,7 @@ jobs: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest - container: swift:6.0.3 + container: swift:6.2 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From 91d2f0617fbcacb53d234104363e20bb091c2aa4 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 17 Jan 2026 16:18:58 +0900 Subject: [PATCH 067/252] BridgeJS: Macro-annotated import notations --- .../Sources/Generated/BridgeJS.ImportTS.swift | 58 - .../Sources/Generated/BridgeJS.Macros.swift | 13 + ...dgeJS.ExportSwift.swift => BridgeJS.swift} | 56 +- .../JavaScript/BridgeJS.ExportSwift.json | 1584 --- .../JavaScript/BridgeJS.ImportTS.json | 67 - .../Generated/JavaScript/BridgeJS.json | 1660 +++ Benchmarks/Sources/bridge-js.d.ts | 6 +- .../PlayBridgeJS/Sources/JavaScript/app.js | 8 +- .../Generated/BridgeJS.ImportTS.swift | 52 - .../Generated/BridgeJS.Macros.swift | 13 + ...dgeJS.ExportSwift.swift => BridgeJS.swift} | 41 +- .../JavaScript/BridgeJS.ExportSwift.json | 149 - .../JavaScript/BridgeJS.ImportTS.json | 48 - .../Generated/JavaScript/BridgeJS.json | 209 + .../Sources/PlayBridgeJS/bridge-js.d.ts | 4 +- .../Sources/PlayBridgeJS/main.swift | 4 +- Package.swift | 12 +- Plugins/BridgeJS/Package.swift | 21 +- Plugins/BridgeJS/README.md | 41 +- .../BridgeJSBuildPlugin.swift | 101 +- .../BridgeJSCommandPlugin.swift | 71 +- .../Sources/BridgeJSCore/ExportSwift.swift | 12 - .../BridgeJSCore/ImportSwiftMacros.swift | 695 ++ .../Sources/BridgeJSCore/ImportTS.swift | 181 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 168 +- .../BridgeJSMacros/BridgeJSMacrosPlugin.swift | 12 + .../Sources/BridgeJSMacros/JSClassMacro.swift | 51 + .../BridgeJSMacros/JSFunctionMacro.swift | 72 + .../BridgeJSMacros/JSGetterMacro.swift | 62 + .../BridgeJSMacros/JSMacroSupport.swift | 100 + .../BridgeJSMacros/JSSetterMacro.swift | 71 + .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 112 +- .../Sources/BridgeJSTool/BridgeJSTool.swift | 253 +- .../Sources/BridgeJSUtilities/Utilities.swift | 23 + .../Sources/TS2Skeleton/JavaScript/README.md | 3 - .../Sources/TS2Swift/JavaScript/README.md | 3 + .../JavaScript/bin/ts2swift.js} | 7 +- .../JavaScript/package.json | 2 +- .../JavaScript/src/cli.js | 13 +- .../JavaScript/src/index.d.ts | 0 .../JavaScript/src/processor.js | 373 +- .../TS2Swift.swift} | 82 +- .../JSClassMacroTests.swift | 289 + .../JSFunctionMacroTests.swift | 377 + .../JSGetterMacroTests.swift | 299 + .../JSSetterMacroTests.swift | 278 + .../BridgeJSToolTests/BridgeJSLinkTests.swift | 56 +- .../BridgeJSToolTests/ImportTSTests.swift | 33 +- .../Tests/BridgeJSToolTests/WhichTests.swift | 2 +- .../InvalidPropertyNames.Import.js | 26 +- .../MultipleImportedTypes.Import.js | 1 - .../TypeScriptClass.Import.js | 16 +- .../__Snapshots__/ExportSwiftTests/Async.json | 1 - .../ExportSwiftTests/Async.swift | 8 - .../CrossFileFunctionTypes.ReverseOrder.json | 1 - .../CrossFileFunctionTypes.ReverseOrder.swift | 8 - .../CrossFileFunctionTypes.json | 1 - .../CrossFileFunctionTypes.swift | 8 - .../CrossFileTypeResolution.ReverseOrder.json | 1 - ...CrossFileTypeResolution.ReverseOrder.swift | 8 - .../CrossFileTypeResolution.json | 1 - .../CrossFileTypeResolution.swift | 8 - .../ExportSwiftTests/DefaultParameters.json | 1 - .../ExportSwiftTests/DefaultParameters.swift | 8 - .../ExportSwiftTests/EnumAssociatedValue.json | 1 - .../EnumAssociatedValue.swift | 8 - .../ExportSwiftTests/EnumCase.json | 1 - .../ExportSwiftTests/EnumCase.swift | 8 - .../EnumNamespace.Global.json | 1 - .../EnumNamespace.Global.swift | 8 - .../ExportSwiftTests/EnumNamespace.json | 1 - .../ExportSwiftTests/EnumNamespace.swift | 8 - .../ExportSwiftTests/EnumRawType.json | 1 - .../ExportSwiftTests/EnumRawType.swift | 8 - .../ExportSwiftTests/MixedGlobal.json | 1 - .../ExportSwiftTests/MixedGlobal.swift | 8 - .../ExportSwiftTests/MixedPrivate.json | 1 - .../ExportSwiftTests/MixedPrivate.swift | 8 - .../ExportSwiftTests/Namespaces.Global.json | 1 - .../ExportSwiftTests/Namespaces.Global.swift | 8 - .../ExportSwiftTests/Namespaces.json | 1 - .../ExportSwiftTests/Namespaces.swift | 8 - .../ExportSwiftTests/Optionals.json | 1 - .../ExportSwiftTests/Optionals.swift | 8 - .../ExportSwiftTests/PrimitiveParameters.json | 1 - .../PrimitiveParameters.swift | 8 - .../ExportSwiftTests/PrimitiveReturn.json | 1 - .../ExportSwiftTests/PrimitiveReturn.swift | 8 - .../ExportSwiftTests/PropertyTypes.json | 1 - .../ExportSwiftTests/PropertyTypes.swift | 8 - .../ExportSwiftTests/Protocol.json | 1 - .../ExportSwiftTests/Protocol.swift | 8 - .../StaticFunctions.Global.json | 1 - .../StaticFunctions.Global.swift | 8 - .../ExportSwiftTests/StaticFunctions.json | 1 - .../ExportSwiftTests/StaticFunctions.swift | 8 - .../StaticProperties.Global.json | 1 - .../StaticProperties.Global.swift | 8 - .../ExportSwiftTests/StaticProperties.json | 1 - .../ExportSwiftTests/StaticProperties.swift | 8 - .../ExportSwiftTests/StringParameter.json | 1 - .../ExportSwiftTests/StringParameter.swift | 8 - .../ExportSwiftTests/StringReturn.json | 1 - .../ExportSwiftTests/StringReturn.swift | 8 - .../ExportSwiftTests/SwiftClass.json | 1 - .../ExportSwiftTests/SwiftClass.swift | 8 - .../ExportSwiftTests/SwiftClosure.json | 1 - .../ExportSwiftTests/SwiftClosure.swift | 8 - .../ExportSwiftTests/SwiftStruct.json | 1 - .../ExportSwiftTests/SwiftStruct.swift | 8 - .../ExportSwiftTests/Throws.json | 1 - .../ExportSwiftTests/Throws.swift | 8 - .../VoidParameterVoidReturn.json | 1 - .../VoidParameterVoidReturn.swift | 8 - .../ImportTSTests/ArrayParameter.Macros.swift | 13 + .../ImportTSTests/ArrayParameter.swift | 14 +- .../ImportTSTests/Async.Macros.swift | 21 + .../__Snapshots__/ImportTSTests/Async.swift | 22 +- .../ImportTSTests/Interface.Macros.swift | 14 + .../ImportTSTests/Interface.swift | 51 +- .../InvalidPropertyNames.Macros.swift | 26 + .../ImportTSTests/InvalidPropertyNames.swift | 192 +- .../MultipleImportedTypes.Macros.swift | 33 + .../ImportTSTests/MultipleImportedTypes.swift | 205 +- .../PrimitiveParameters.Macros.swift | 9 + .../ImportTSTests/PrimitiveParameters.swift | 10 +- .../PrimitiveReturn.Macros.swift | 11 + .../ImportTSTests/PrimitiveReturn.swift | 12 +- .../StringParameter.Macros.swift | 11 + .../ImportTSTests/StringParameter.swift | 12 +- .../ImportTSTests/StringReturn.Macros.swift | 9 + .../ImportTSTests/StringReturn.swift | 10 +- .../TS2SkeletonLike.Macros.swift | 22 + .../ImportTSTests/TS2SkeletonLike.swift | 106 +- .../ImportTSTests/TypeAlias.Macros.swift | 9 + .../ImportTSTests/TypeAlias.swift | 10 +- .../TypeScriptClass.Macros.swift | 16 + .../ImportTSTests/TypeScriptClass.swift | 115 +- .../VoidParameterVoidReturn.Macros.swift | 9 + .../VoidParameterVoidReturn.swift | 10 +- Plugins/PackageToJS/Sources/PackageToJS.swift | 24 +- .../Sources/PackageToJSPlugin.swift | 37 +- Sources/BridgeJSMacros | 1 + Sources/BridgeJSTool/TS2Skeleton | 1 - Sources/BridgeJSTool/TS2Swift | 1 + .../BridgeJS/Ahead-of-Time-Code-Generation.md | 5 +- Sources/JavaScriptKit/Macros.swift | 78 + ...dgeJS.ExportSwift.swift => BridgeJS.swift} | 3 +- .../JavaScript/BridgeJS.ExportSwift.json | 540 - .../Generated/JavaScript/BridgeJS.json | 554 + .../Generated/BridgeJS.ImportTS.swift | 271 - .../Generated/BridgeJS.Macros.swift | 34 + ...dgeJS.ExportSwift.swift => BridgeJS.swift} | 272 +- .../JavaScript/BridgeJS.ExportSwift.json | 8923 ---------------- .../JavaScript/BridgeJS.ImportTS.json | 233 - .../Generated/JavaScript/BridgeJS.json | 9182 +++++++++++++++++ Tests/BridgeJSRuntimeTests/bridge-js.d.ts | 18 + Utilities/bridge-js-generate.sh | 10 +- 158 files changed, 15914 insertions(+), 13414 deletions(-) delete mode 100644 Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift create mode 100644 Benchmarks/Sources/Generated/BridgeJS.Macros.swift rename Benchmarks/Sources/Generated/{BridgeJS.ExportSwift.swift => BridgeJS.swift} (96%) delete mode 100644 Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json delete mode 100644 Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json create mode 100644 Benchmarks/Sources/Generated/JavaScript/BridgeJS.json delete mode 100644 Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift create mode 100644 Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift rename Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/{BridgeJS.ExportSwift.swift => BridgeJS.swift} (80%) delete mode 100644 Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json delete mode 100644 Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json create mode 100644 Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json create mode 100644 Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift create mode 100644 Plugins/BridgeJS/Sources/BridgeJSMacros/BridgeJSMacrosPlugin.swift create mode 100644 Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift create mode 100644 Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift create mode 100644 Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift create mode 100644 Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift create mode 100644 Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift delete mode 100644 Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/README.md create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/README.md rename Plugins/BridgeJS/Sources/{TS2Skeleton/JavaScript/bin/ts2skeleton.js => TS2Swift/JavaScript/bin/ts2swift.js} (53%) mode change 100755 => 100644 rename Plugins/BridgeJS/Sources/{TS2Skeleton => TS2Swift}/JavaScript/package.json (69%) rename Plugins/BridgeJS/Sources/{TS2Skeleton => TS2Swift}/JavaScript/src/cli.js (90%) rename Plugins/BridgeJS/Sources/{TS2Skeleton => TS2Swift}/JavaScript/src/index.d.ts (100%) rename Plugins/BridgeJS/Sources/{TS2Skeleton => TS2Swift}/JavaScript/src/processor.js (51%) rename Plugins/BridgeJS/Sources/{TS2Skeleton/TS2Skeleton.swift => TS2Swift/TS2Swift.swift} (65%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift create mode 120000 Sources/BridgeJSMacros delete mode 120000 Sources/BridgeJSTool/TS2Skeleton create mode 120000 Sources/BridgeJSTool/TS2Swift rename Tests/BridgeJSGlobalTests/Generated/{BridgeJS.ExportSwift.swift => BridgeJS.swift} (99%) delete mode 100644 Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json create mode 100644 Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json delete mode 100644 Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift create mode 100644 Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift rename Tests/BridgeJSRuntimeTests/Generated/{BridgeJS.ExportSwift.swift => BridgeJS.swift} (96%) delete mode 100644 Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json delete mode 100644 Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json create mode 100644 Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json diff --git a/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift b/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift deleted file mode 100644 index e6bb84c13..000000000 --- a/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift +++ /dev/null @@ -1,58 +0,0 @@ -// 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: "Benchmarks", name: "bjs_benchmarkHelperNoop") -fileprivate func bjs_benchmarkHelperNoop() -> Void -#else -fileprivate func bjs_benchmarkHelperNoop() -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func benchmarkHelperNoop() throws(JSException) -> Void { - bjs_benchmarkHelperNoop() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoopWithNumber") -fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void -#else -fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func benchmarkHelperNoopWithNumber(_ n: Double) throws(JSException) -> Void { - let nValue = n.bridgeJSLowerParameter() - bjs_benchmarkHelperNoopWithNumber(nValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkRunner") -fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void -#else -fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func benchmarkRunner(_ name: String, _ body: JSObject) throws(JSException) -> Void { - let nameValue = name.bridgeJSLowerParameter() - let bodyValue = body.bridgeJSLowerParameter() - bjs_benchmarkRunner(nameValue, bodyValue) - if let error = _swift_js_take_exception() { - throw error - } -} \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/BridgeJS.Macros.swift b/Benchmarks/Sources/Generated/BridgeJS.Macros.swift new file mode 100644 index 000000000..c96789495 --- /dev/null +++ b/Benchmarks/Sources/Generated/BridgeJS.Macros.swift @@ -0,0 +1,13 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func benchmarkHelperNoop() throws (JSException) -> Void + +@JSFunction func benchmarkHelperNoopWithNumber(_ n: Double) throws (JSException) -> Void + +@JSFunction func benchmarkRunner(_ name: String, _ body: JSObject) throws (JSException) -> Void diff --git a/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift b/Benchmarks/Sources/Generated/BridgeJS.swift similarity index 96% rename from Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift rename to Benchmarks/Sources/Generated/BridgeJS.swift index 2c9d9b6bf..b80dbb56a 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -1,10 +1,11 @@ +// 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 +@_spi(BridgeJS) @_spi(Experimental) import JavaScriptKit extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { @@ -1172,4 +1173,55 @@ fileprivate func _bjs_ClassRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> fileprivate func _bjs_ClassRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoop") +fileprivate func bjs_benchmarkHelperNoop() -> Void +#else +fileprivate func bjs_benchmarkHelperNoop() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$benchmarkHelperNoop() throws(JSException) -> Void { + bjs_benchmarkHelperNoop() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoopWithNumber") +fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void +#else +fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$benchmarkHelperNoopWithNumber(_ n: Double) throws(JSException) -> Void { + let nValue = n.bridgeJSLowerParameter() + bjs_benchmarkHelperNoopWithNumber(nValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkRunner") +fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void +#else +fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$benchmarkRunner(_ name: String, _ body: JSObject) throws(JSException) -> Void { + let nameValue = name.bridgeJSLowerParameter() + let bodyValue = body.bridgeJSLowerParameter() + bjs_benchmarkRunner(nameValue, bodyValue) + if let error = _swift_js_take_exception() { + throw error + } +} \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json deleted file mode 100644 index e3532d33c..000000000 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json +++ /dev/null @@ -1,1584 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_EnumRoundtrip_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_EnumRoundtrip_take", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "take", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_makeSuccess", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeSuccess", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_makeFailure", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeFailure", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_makeFlag", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeFlag", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_makeRate", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeRate", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_makePrecise", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makePrecise", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_makeInfo", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeInfo", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_roundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtrip", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - ], - "name" : "EnumRoundtrip", - "properties" : [ - - ], - "swiftCallName" : "EnumRoundtrip" - }, - { - "constructor" : { - "abiName" : "bjs_ComplexResultRoundtrip_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_ComplexResultRoundtrip_take", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "take", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeSuccess", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeSuccess", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeError", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeError", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeLocation", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeLocation", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeStatus", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeCoordinates", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeCoordinates", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeComprehensive", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComprehensive", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeInfo", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeInfo", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_roundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtrip", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - ], - "name" : "ComplexResultRoundtrip", - "properties" : [ - - ], - "swiftCallName" : "ComplexResultRoundtrip" - }, - { - "constructor" : { - "abiName" : "bjs_StringRoundtrip_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_StringRoundtrip_take", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "take", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_StringRoundtrip_make", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "make", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "StringRoundtrip", - "properties" : [ - - ], - "swiftCallName" : "StringRoundtrip" - }, - { - "constructor" : { - "abiName" : "bjs_StructRoundtrip_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_StructRoundtrip_takeSimple", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeSimple", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "SimpleStruct" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_makeSimple", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeSimple", - "parameters" : [ - - ], - "returnType" : { - "swiftStruct" : { - "_0" : "SimpleStruct" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_roundtripSimple", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripSimple", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "SimpleStruct" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "SimpleStruct" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_takeAddress", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeAddress", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "Address" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_makeAddress", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAddress", - "parameters" : [ - - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Address" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_roundtripAddress", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripAddress", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "Address" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Address" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_takePerson", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takePerson", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "Person" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_makePerson", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makePerson", - "parameters" : [ - - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Person" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_roundtripPerson", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripPerson", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "Person" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Person" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_takeComplex", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeComplex", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "ComplexStruct" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_makeComplex", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplex", - "parameters" : [ - - ], - "returnType" : { - "swiftStruct" : { - "_0" : "ComplexStruct" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_roundtripComplex", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripComplex", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "ComplexStruct" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "ComplexStruct" - } - } - } - ], - "name" : "StructRoundtrip", - "properties" : [ - - ], - "swiftCallName" : "StructRoundtrip" - }, - { - "constructor" : { - "abiName" : "bjs_SimpleClass_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "label" : "count", - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "label" : "flag", - "name" : "flag", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "rate", - "name" : "rate", - "type" : { - "float" : { - - } - } - }, - { - "label" : "precise", - "name" : "precise", - "type" : { - "double" : { - - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "SimpleClass", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "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" : "SimpleClass" - }, - { - "constructor" : { - "abiName" : "bjs_AddressClass_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "street", - "name" : "street", - "type" : { - "string" : { - - } - } - }, - { - "label" : "city", - "name" : "city", - "type" : { - "string" : { - - } - } - }, - { - "label" : "zipCode", - "name" : "zipCode", - "type" : { - "int" : { - - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "AddressClass", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "street", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "city", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "zipCode", - "type" : { - "int" : { - - } - } - } - ], - "swiftCallName" : "AddressClass" - }, - { - "constructor" : { - "abiName" : "bjs_ClassRoundtrip_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_ClassRoundtrip_takeSimpleClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeSimpleClass", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftHeapObject" : { - "_0" : "SimpleClass" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_ClassRoundtrip_makeSimpleClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeSimpleClass", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "SimpleClass" - } - } - }, - { - "abiName" : "bjs_ClassRoundtrip_roundtripSimpleClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripSimpleClass", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftHeapObject" : { - "_0" : "SimpleClass" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "SimpleClass" - } - } - }, - { - "abiName" : "bjs_ClassRoundtrip_takeAddressClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeAddressClass", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftHeapObject" : { - "_0" : "AddressClass" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_ClassRoundtrip_makeAddressClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAddressClass", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "AddressClass" - } - } - }, - { - "abiName" : "bjs_ClassRoundtrip_roundtripAddressClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripAddressClass", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftHeapObject" : { - "_0" : "AddressClass" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "AddressClass" - } - } - } - ], - "name" : "ClassRoundtrip", - "properties" : [ - - ], - "swiftCallName" : "ClassRoundtrip" - } - ], - "enums" : [ - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "int" : { - - } - } - } - ], - "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" : { - "int" : { - - } - } - } - ], - "name" : "error" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "location" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "status" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - } - ], - "name" : "coordinates" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "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" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_run", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "run", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - } - ], - "moduleName" : "Benchmarks", - "protocols" : [ - - ], - "structs" : [ - { - "methods" : [ - - ], - "name" : "SimpleStruct", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "flag", - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "rate", - "type" : { - "float" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "precise", - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "SimpleStruct" - }, - { - "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" : { - "int" : { - - } - } - } - ], - "swiftCallName" : "Address" - }, - { - "methods" : [ - - ], - "name" : "Person", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "age", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "address", - "type" : { - "swiftStruct" : { - "_0" : "Address" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "email", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "swiftCallName" : "Person" - }, - { - "methods" : [ - - ], - "name" : "ComplexStruct", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "id", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "title", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "active", - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "score", - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "tags", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "metadata", - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "ComplexStruct" - } - ] -} \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json deleted file mode 100644 index 366342bbc..000000000 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "children" : [ - { - "functions" : [ - { - "name" : "benchmarkHelperNoop", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "name" : "benchmarkHelperNoopWithNumber", - "parameters" : [ - { - "name" : "n", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "name" : "benchmarkRunner", - "parameters" : [ - { - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "name" : "body", - "type" : { - "jsObject" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "types" : [ - - ] - } - ], - "moduleName" : "Benchmarks" -} \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json new file mode 100644 index 000000000..27a245f56 --- /dev/null +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json @@ -0,0 +1,1660 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_EnumRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_EnumRoundtrip_take", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "take", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_makeSuccess", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeSuccess", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_makeFailure", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeFailure", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_makeFlag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeFlag", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_makeRate", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeRate", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_makePrecise", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makePrecise", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_makeInfo", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeInfo", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtrip", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "name" : "EnumRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "EnumRoundtrip" + }, + { + "constructor" : { + "abiName" : "bjs_ComplexResultRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_ComplexResultRoundtrip_take", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "take", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeSuccess", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeSuccess", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeError", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeError", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeLocation", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeLocation", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeStatus", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeCoordinates", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeCoordinates", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeComprehensive", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComprehensive", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeInfo", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeInfo", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtrip", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + ], + "name" : "ComplexResultRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "ComplexResultRoundtrip" + }, + { + "constructor" : { + "abiName" : "bjs_StringRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_StringRoundtrip_take", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "take", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StringRoundtrip_make", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "make", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "StringRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "StringRoundtrip" + }, + { + "constructor" : { + "abiName" : "bjs_StructRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_StructRoundtrip_takeSimple", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeSimple", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "SimpleStruct" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_makeSimple", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeSimple", + "parameters" : [ + + ], + "returnType" : { + "swiftStruct" : { + "_0" : "SimpleStruct" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_roundtripSimple", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripSimple", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "SimpleStruct" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "SimpleStruct" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_takeAddress", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeAddress", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_makeAddress", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAddress", + "parameters" : [ + + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_roundtripAddress", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripAddress", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_takePerson", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takePerson", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "Person" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_makePerson", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makePerson", + "parameters" : [ + + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Person" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_roundtripPerson", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripPerson", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "Person" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Person" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_takeComplex", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeComplex", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "ComplexStruct" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_makeComplex", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplex", + "parameters" : [ + + ], + "returnType" : { + "swiftStruct" : { + "_0" : "ComplexStruct" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_roundtripComplex", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripComplex", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "ComplexStruct" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "ComplexStruct" + } + } + } + ], + "name" : "StructRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "StructRoundtrip" + }, + { + "constructor" : { + "abiName" : "bjs_SimpleClass_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "label" : "count", + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "label" : "flag", + "name" : "flag", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "rate", + "name" : "rate", + "type" : { + "float" : { + + } + } + }, + { + "label" : "precise", + "name" : "precise", + "type" : { + "double" : { + + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "SimpleClass", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "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" : "SimpleClass" + }, + { + "constructor" : { + "abiName" : "bjs_AddressClass_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "street", + "name" : "street", + "type" : { + "string" : { + + } + } + }, + { + "label" : "city", + "name" : "city", + "type" : { + "string" : { + + } + } + }, + { + "label" : "zipCode", + "name" : "zipCode", + "type" : { + "int" : { + + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "AddressClass", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "street", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "city", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "zipCode", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "AddressClass" + }, + { + "constructor" : { + "abiName" : "bjs_ClassRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_ClassRoundtrip_takeSimpleClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeSimpleClass", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_makeSimpleClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeSimpleClass", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_roundtripSimpleClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripSimpleClass", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_takeAddressClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeAddressClass", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "AddressClass" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_makeAddressClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAddressClass", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "AddressClass" + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_roundtripAddressClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripAddressClass", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "AddressClass" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "AddressClass" + } + } + } + ], + "name" : "ClassRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "ClassRoundtrip" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "int" : { + + } + } + } + ], + "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" : { + "int" : { + + } + } + } + ], + "name" : "error" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "location" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "status" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + } + ], + "name" : "coordinates" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "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" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_run", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "run", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + { + "methods" : [ + + ], + "name" : "SimpleStruct", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "flag", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "rate", + "type" : { + "float" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "precise", + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "SimpleStruct" + }, + { + "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" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "Address" + }, + { + "methods" : [ + + ], + "name" : "Person", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "age", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "address", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "email", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "swiftCallName" : "Person" + }, + { + "methods" : [ + + ], + "name" : "ComplexStruct", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "title", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "active", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "score", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "tags", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "metadata", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "ComplexStruct" + } + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + + ], + "types" : [ + + ] + }, + { + "functions" : [ + { + "name" : "benchmarkHelperNoop", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "benchmarkHelperNoopWithNumber", + "parameters" : [ + { + "name" : "n", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "benchmarkRunner", + "parameters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "name" : "body", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "Benchmarks" +} \ No newline at end of file diff --git a/Benchmarks/Sources/bridge-js.d.ts b/Benchmarks/Sources/bridge-js.d.ts index a9eb5d0bf..9f5137e1e 100644 --- a/Benchmarks/Sources/bridge-js.d.ts +++ b/Benchmarks/Sources/bridge-js.d.ts @@ -1,3 +1,3 @@ -declare function benchmarkHelperNoop(): void; -declare function benchmarkHelperNoopWithNumber(n: number): void; -declare function benchmarkRunner(name: string, body: (n: number) => void): void; +export function benchmarkHelperNoop(): void; +export function benchmarkHelperNoopWithNumber(n: number): void; +export function benchmarkRunner(name: string, body: (n: number) => void): void; diff --git a/Examples/PlayBridgeJS/Sources/JavaScript/app.js b/Examples/PlayBridgeJS/Sources/JavaScript/app.js index 2f5267d3e..b82810238 100644 --- a/Examples/PlayBridgeJS/Sources/JavaScript/app.js +++ b/Examples/PlayBridgeJS/Sources/JavaScript/app.js @@ -102,11 +102,11 @@ export class BridgeJSPlayground { // Import the BridgeJS module this.setProgress('Loading BridgeJS…', 50); const { init } = await import("../../Bundle/index.js"); - const virtualHost = await this.createTS2SkeletonFactory(); + const virtualHost = await this.createTS2SwiftFactory(); this.setProgress('Preparing TypeScript host…', 60); const { exports } = await init({ getImports: () => ({ - createTS2Skeleton: () => this.createTS2Skeleton(virtualHost) + createTS2Swift: () => this.createTS2Swift(virtualHost) }) }); this.setProgress('Creating runtime…', 65); @@ -193,7 +193,7 @@ export class BridgeJSPlayground { }); } - async createTS2SkeletonFactory() { + async createTS2SwiftFactory() { const createVirtualHost = async () => { const fsMap = await createDefaultMapFromCDN( { target: ts.ScriptTarget.ES2015 }, @@ -217,7 +217,7 @@ export class BridgeJSPlayground { /** * @param {ReturnType} virtualHost */ - createTS2Skeleton(virtualHost) { + createTS2Swift(virtualHost) { return { /** * @param {string} dtsCode diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift deleted file mode 100644 index cd1ef9814..000000000 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift +++ /dev/null @@ -1,52 +0,0 @@ -// 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: "PlayBridgeJS", name: "bjs_createTS2Skeleton") -fileprivate func bjs_createTS2Skeleton() -> Int32 -#else -fileprivate func bjs_createTS2Skeleton() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func createTS2Skeleton() throws(JSException) -> TS2Skeleton { - let ret = bjs_createTS2Skeleton() - if let error = _swift_js_take_exception() { - throw error - } - return TS2Skeleton.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "PlayBridgeJS", name: "bjs_TS2Skeleton_convert") -fileprivate func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 -#else -fileprivate func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -struct TS2Skeleton: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - func convert(_ ts: String) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let tsValue = ts.bridgeJSLowerParameter() - let ret = bjs_TS2Skeleton_convert(selfValue, tsValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } - -} \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift new file mode 100644 index 000000000..feb0a2ead --- /dev/null +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift @@ -0,0 +1,13 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func createTS2Swift() throws (JSException) -> TS2Swift + +@JSClass struct TS2Swift: _JSBridgedClass { + @JSFunction func convert(_ ts: String) throws (JSException) -> String +} diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift similarity index 80% rename from Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift rename to Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift index 3391b2fd6..469f13de9 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift @@ -1,10 +1,11 @@ +// 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 +@_spi(BridgeJS) @_spi(Experimental) import JavaScriptKit @_expose(wasm, "bjs_PlayBridgeJS_init") @_cdecl("bjs_PlayBridgeJS_init") @@ -134,4 +135,40 @@ fileprivate func _bjs_PlayBridgeJSOutput_wrap(_ pointer: UnsafeMutableRawPointer fileprivate func _bjs_PlayBridgeJSOutput_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif + +#if arch(wasm32) +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_createTS2Swift") +fileprivate func bjs_createTS2Swift() -> Int32 +#else +fileprivate func bjs_createTS2Swift() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$createTS2Swift() throws(JSException) -> TS2Swift { + let ret = bjs_createTS2Swift() + if let error = _swift_js_take_exception() { + throw error + } + return TS2Swift.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_TS2Swift_convert") +fileprivate func bjs_TS2Swift_convert(_ self: Int32, _ ts: Int32) -> Int32 +#else +fileprivate func bjs_TS2Swift_convert(_ self: Int32, _ ts: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$TS2Swift_convert(_ self: JSObject, _ ts: String) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let tsValue = ts.bridgeJSLowerParameter() + let ret = bjs_TS2Swift_convert(selfValue, tsValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json deleted file mode 100644 index a536a23fc..000000000 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_PlayBridgeJS_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_PlayBridgeJS_update", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "update", - "parameters" : [ - { - "label" : "swiftSource", - "name" : "swiftSource", - "type" : { - "string" : { - - } - } - }, - { - "label" : "dtsSource", - "name" : "dtsSource", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "PlayBridgeJSOutput" - } - } - } - ], - "name" : "PlayBridgeJS", - "properties" : [ - - ], - "swiftCallName" : "PlayBridgeJS" - }, - { - "methods" : [ - { - "abiName" : "bjs_PlayBridgeJSOutput_outputJs", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "outputJs", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_PlayBridgeJSOutput_outputDts", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "outputDts", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_PlayBridgeJSOutput_importSwiftGlue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "importSwiftGlue", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_PlayBridgeJSOutput_exportSwiftGlue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "exportSwiftGlue", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "PlayBridgeJSOutput", - "properties" : [ - - ], - "swiftCallName" : "PlayBridgeJSOutput" - } - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "moduleName" : "PlayBridgeJS", - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json deleted file mode 100644 index f1a567cde..000000000 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "children" : [ - { - "functions" : [ - { - "name" : "createTS2Skeleton", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - "_0" : "TS2Skeleton" - } - } - } - ], - "types" : [ - { - "methods" : [ - { - "name" : "convert", - "parameters" : [ - { - "name" : "ts", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "TS2Skeleton", - "properties" : [ - - ] - } - ] - } - ], - "moduleName" : "PlayBridgeJS" -} \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json new file mode 100644 index 000000000..c1cf453d3 --- /dev/null +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json @@ -0,0 +1,209 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_PlayBridgeJS_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_PlayBridgeJS_update", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "update", + "parameters" : [ + { + "label" : "swiftSource", + "name" : "swiftSource", + "type" : { + "string" : { + + } + } + }, + { + "label" : "dtsSource", + "name" : "dtsSource", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "PlayBridgeJSOutput" + } + } + } + ], + "name" : "PlayBridgeJS", + "properties" : [ + + ], + "swiftCallName" : "PlayBridgeJS" + }, + { + "methods" : [ + { + "abiName" : "bjs_PlayBridgeJSOutput_outputJs", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "outputJs", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_PlayBridgeJSOutput_outputDts", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "outputDts", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_PlayBridgeJSOutput_importSwiftGlue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "importSwiftGlue", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_PlayBridgeJSOutput_exportSwiftGlue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "exportSwiftGlue", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "PlayBridgeJSOutput", + "properties" : [ + + ], + "swiftCallName" : "PlayBridgeJSOutput" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "createTS2Swift", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "TS2Swift" + } + } + } + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + { + "name" : "convert", + "parameters" : [ + { + "name" : "ts", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "TS2Swift", + "setters" : [ + + ] + } + ] + }, + { + "functions" : [ + + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "PlayBridgeJS" +} \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/bridge-js.d.ts b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/bridge-js.d.ts index 44e79a5cb..7173fab8e 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/bridge-js.d.ts +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/bridge-js.d.ts @@ -1,5 +1,5 @@ -export interface TS2Skeleton { +export interface TS2Swift { convert(ts: string): string; } -export function createTS2Skeleton(): TS2Skeleton; \ No newline at end of file +export function createTS2Swift(): TS2Swift; \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift index 52cb0cc27..b82fc6f43 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift @@ -22,8 +22,8 @@ import class Foundation.JSONDecoder try exportSwift.addSourceFile(sourceFile, "Playground.swift") let exportResult = try exportSwift.finalize() var importTS = ImportTS(progress: .silent, moduleName: "Playground") - let ts2skeleton = try createTS2Skeleton() - let skeletonJSONString = try ts2skeleton.convert(dtsSource) + let ts2swift = try createTS2Swift() + let skeletonJSONString = try ts2swift.convert(dtsSource) let decoder = JSONDecoder() let importSkeleton = try decoder.decode( ImportedFileSkeleton.self, diff --git a/Package.swift b/Package.swift index f1e5a04c9..521b543cc 100644 --- a/Package.swift +++ b/Package.swift @@ -42,7 +42,7 @@ let package = Package( targets: [ .target( name: "JavaScriptKit", - dependencies: ["_CJavaScriptKit"], + dependencies: ["_CJavaScriptKit", "BridgeJSMacros"], exclude: useLegacyResourceBundling ? [] : ["Runtime"], resources: useLegacyResourceBundling ? [.copy("Runtime")] : [], cSettings: shouldBuildForEmbedded @@ -59,6 +59,14 @@ let package = Package( ] : []) ), .target(name: "_CJavaScriptKit"), + .macro( + name: "BridgeJSMacros", + dependencies: [ + .product(name: "SwiftSyntaxMacros", package: "swift-syntax"), + .product(name: "SwiftCompilerPlugin", package: "swift-syntax"), + ] + ), + .testTarget( name: "JavaScriptKitTests", dependencies: ["JavaScriptKit"], @@ -165,7 +173,7 @@ let package = Package( .product(name: "SwiftBasicFormat", package: "swift-syntax"), .product(name: "SwiftSyntaxBuilder", package: "swift-syntax"), ], - exclude: ["TS2Skeleton/JavaScript", "README.md"] + exclude: ["TS2Swift/JavaScript", "README.md"] ), .testTarget( name: "BridgeJSRuntimeTests", diff --git a/Plugins/BridgeJS/Package.swift b/Plugins/BridgeJS/Package.swift index 36b920521..63c74c53e 100644 --- a/Plugins/BridgeJS/Package.swift +++ b/Plugins/BridgeJS/Package.swift @@ -1,5 +1,6 @@ // swift-tools-version: 6.0 +import CompilerPluginSupport import PackageDescription let package = Package( @@ -14,11 +15,11 @@ let package = Package( name: "BridgeJSTool", dependencies: [ "BridgeJSCore", - "TS2Skeleton", + "TS2Swift", ] ), .target( - name: "TS2Skeleton", + name: "TS2Swift", dependencies: [ "BridgeJSCore", "BridgeJSSkeleton", @@ -52,9 +53,23 @@ let package = Package( dependencies: [ "BridgeJSCore", "BridgeJSLink", - "TS2Skeleton", + "TS2Swift", ], exclude: ["__Snapshots__", "Inputs", "MultifileInputs"] ), + .macro( + name: "BridgeJSMacros", + dependencies: [ + .product(name: "SwiftSyntaxMacros", package: "swift-syntax"), + .product(name: "SwiftCompilerPlugin", package: "swift-syntax"), + ] + ), + .testTarget( + name: "BridgeJSMacrosTests", + dependencies: [ + "BridgeJSMacros", + .product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"), + ] + ), ] ) diff --git a/Plugins/BridgeJS/README.md b/Plugins/BridgeJS/README.md index f762c294b..0cc4ceba9 100644 --- a/Plugins/BridgeJS/README.md +++ b/Plugins/BridgeJS/README.md @@ -13,34 +13,39 @@ BridgeJS provides easy interoperability between Swift and JavaScript/TypeScript. 1. **Importing TypeScript APIs into Swift**: Use TypeScript/JavaScript APIs directly from Swift code 2. **Exporting Swift APIs to JavaScript**: Make your Swift APIs available to JavaScript code +The workflow is: +1. `ts2swift` converts TypeScript definitions (`bridge-js.d.ts`) to macro-annotated Swift declarations (`BridgeJS.Macros.swift`) +2. `bridge-js generate` processes both Swift source files (for export) and macro-annotated Swift files (for import) to generate: + - `BridgeJS.swift` (Swift glue code) + - `JavaScript/BridgeJS.json` (a unified skeleton for linking) +3. `bridge-js link` combines module skeletons (`JavaScript/BridgeJS.json`) to produce JavaScript glue code (`bridge-js.js` and `bridge-js.d.ts`) + ## Architecture Diagram ```mermaid graph LR - E1 --> G3[ExportSwift.json] subgraph ModuleA - A.swift --> E1[[bridge-js export]] - B.swift --> E1 - E1 --> G1[ExportSwift.swift] - B1[bridge-js.d.ts]-->I1[[bridge-js import]] - I1 --> G2[ImportTS.swift] + A.swift --> G1[bridge-js generate] + B.swift --> G1 + B1[bridge-js.d.ts] --> T1[[ts2swift]] + T1 --> M1[BridgeJS.Macros.swift] + M1 --> G1 + G1 --> G3[BridgeJS.json] + G1 --> G2[BridgeJS.swift] end - I1 --> G4[ImportTS.json] - E2 --> G7[ExportSwift.json] subgraph ModuleB - C.swift --> E2[[bridge-js export]] - D.swift --> E2 - E2 --> G5[ExportSwift.swift] - B2[bridge-js.d.ts]-->I2[[bridge-js import]] - I2 --> G6[ImportTS.swift] + C.swift --> G4[bridge-js generate] + D.swift --> G4 + B2[bridge-js.d.ts] --> T2[[ts2swift]] + T2 --> M2[BridgeJS.Macros.swift] + M2 --> G4 + G4 --> G5[BridgeJS.swift] + G4 --> G6[BridgeJS.json] end - I2 --> G8[ImportTS.json] G3 --> L1[[bridge-js link]] - G4 --> L1 - G7 --> L1 - G8 --> L1 + G6 --> L1 L1 --> F1[bridge-js.js] L1 --> F2[bridge-js.d.ts] @@ -135,4 +140,4 @@ TBD declare var Foo: FooConstructor; ``` - [ ] Use `externref` once it's widely available -- [ ] Test SwiftObject roundtrip \ No newline at end of file +- [ ] Test SwiftObject roundtrip diff --git a/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift b/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift index 47487bfc2..aec9f3bca 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift @@ -11,95 +11,58 @@ struct BridgeJSBuildPlugin: BuildToolPlugin { guard let swiftSourceModuleTarget = target as? SwiftSourceModuleTarget else { return [] } - var commands: [Command] = [] - commands.append(try createExportSwiftCommand(context: context, target: swiftSourceModuleTarget)) - if let importCommand = try createImportTSCommand(context: context, target: swiftSourceModuleTarget) { - commands.append(importCommand) - } - return commands + return [try createGenerateCommand(context: context, target: swiftSourceModuleTarget)] } private func pathToConfigFile(target: SwiftSourceModuleTarget) -> URL { return target.directoryURL.appending(path: "bridge-js.config.json") } - private func createExportSwiftCommand(context: PluginContext, target: SwiftSourceModuleTarget) throws -> Command { - let outputSwiftPath = context.pluginWorkDirectoryURL.appending(path: "BridgeJS.ExportSwift.swift") - let outputSkeletonPath = context.pluginWorkDirectoryURL.appending(path: "BridgeJS.ExportSwift.json") + private func createGenerateCommand(context: PluginContext, target: SwiftSourceModuleTarget) throws -> Command { + let outputSwiftPath = context.pluginWorkDirectoryURL.appending(path: "BridgeJS.swift") + let inputSwiftFiles = target.sourceFiles.filter { !$0.url.path.hasPrefix(context.pluginWorkDirectoryURL.path + "/") } .map(\.url) + let configFile = pathToConfigFile(target: target) - let inputFiles: [URL] + var inputFiles: [URL] = inputSwiftFiles if FileManager.default.fileExists(atPath: configFile.path) { - inputFiles = inputSwiftFiles + [configFile] - } else { - inputFiles = inputSwiftFiles + inputFiles.append(configFile) } - return .buildCommand( - displayName: "Export Swift API", - executable: try context.tool(named: "BridgeJSTool").url, - arguments: [ - "export", - "--module-name", - target.name, - "--target-dir", - target.directoryURL.path, - "--output-skeleton", - outputSkeletonPath.path, - "--output-swift", - outputSwiftPath.path, - // Generate the output files even if nothing is exported not to surprise - // the build system. - "--always-write", "true", - ] + inputSwiftFiles.map(\.path), - inputFiles: inputFiles, - outputFiles: [ - outputSwiftPath - ] - ) - } - private func createImportTSCommand(context: PluginContext, target: SwiftSourceModuleTarget) throws -> Command? { - let outputSwiftPath = context.pluginWorkDirectoryURL.appending(path: "BridgeJS.ImportTS.swift") - let outputSkeletonPath = context.pluginWorkDirectoryURL.appending(path: "BridgeJS.ImportTS.json") let inputTSFile = target.directoryURL.appending(path: "bridge-js.d.ts") - guard FileManager.default.fileExists(atPath: inputTSFile.path) else { - return nil - } + let tsconfigPath = context.package.directoryURL.appending(path: "tsconfig.json") - let configFile = pathToConfigFile(target: target) - let inputFiles: [URL] - if FileManager.default.fileExists(atPath: configFile.path) { - inputFiles = [inputTSFile, configFile] - } else { - inputFiles = [inputTSFile] + var arguments: [String] = [ + "generate", + "--module-name", + target.name, + "--target-dir", + target.directoryURL.path, + "--output-dir", + context.pluginWorkDirectoryURL.path, + "--always-write", "true", + ] + + if FileManager.default.fileExists(atPath: inputTSFile.path) { + // Add .d.ts file and tsconfig.json as inputs + inputFiles.append(contentsOf: [inputTSFile, tsconfigPath]) + arguments.append(contentsOf: [ + "--project", + tsconfigPath.path, + ]) } + + arguments.append(contentsOf: inputSwiftFiles.map(\.path)) + return .buildCommand( - displayName: "Import TypeScript API", + displayName: "Generate BridgeJS code", executable: try context.tool(named: "BridgeJSTool").url, - arguments: [ - "import", - "--target-dir", - target.directoryURL.path, - "--output-skeleton", - outputSkeletonPath.path, - "--output-swift", - outputSwiftPath.path, - "--module-name", - target.name, - // Generate the output files even if nothing is imported not to surprise - // the build system. - "--always-write", "true", - "--project", - context.package.directoryURL.appending(path: "tsconfig.json").path, - inputTSFile.path, - ], + arguments: arguments, inputFiles: inputFiles, - outputFiles: [ - outputSwiftPath - ] + outputFiles: [outputSwiftPath] ) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift b/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift index 26a0d0ef9..3dce62578 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift @@ -97,54 +97,41 @@ extension BridgeJSCommandPlugin.Context { ) throws { printStderr("Generating bridge code for \(target.name)...") - printVerbose("Exporting Swift API for \(target.name)...") - let generatedDirectory = target.directoryURL.appending(path: "Generated") let generatedJavaScriptDirectory = generatedDirectory.appending(path: "JavaScript") - try runBridgeJSTool( - arguments: [ - "export", - "--module-name", - target.name, - "--target-dir", - target.directoryURL.path, - "--output-skeleton", - generatedJavaScriptDirectory.appending(path: "BridgeJS.ExportSwift.json").path, - "--output-swift", - generatedDirectory.appending(path: "BridgeJS.ExportSwift.swift").path, - "--verbose", - options.verbose ? "true" : "false", - ] - + target.sourceFiles.filter { - !$0.url.path.hasPrefix(generatedDirectory.path + "/") - }.map(\.url.path) + remainingArguments - ) - - printVerbose("Importing TypeScript API for \(target.name)...") - let bridgeDtsPath = target.directoryURL.appending(path: "bridge-js.d.ts") - // Execute import only if bridge-js.d.ts exists + let tsconfigPath = context.package.directoryURL.appending(path: "tsconfig.json") + + // Unified generate command + var generateArguments: [String] = [ + "generate", + "--module-name", + target.name, + "--target-dir", + target.directoryURL.path, + "--output-dir", + generatedDirectory.path, + "--verbose", + options.verbose ? "true" : "false", + ] + if FileManager.default.fileExists(atPath: bridgeDtsPath.path) { - try runBridgeJSTool( - arguments: [ - "import", - "--target-dir", - target.directoryURL.path, - "--output-skeleton", - generatedJavaScriptDirectory.appending(path: "BridgeJS.ImportTS.json").path, - "--output-swift", - generatedDirectory.appending(path: "BridgeJS.ImportTS.swift").path, - "--verbose", - options.verbose ? "true" : "false", - "--module-name", - target.name, - "--project", - context.package.directoryURL.appending(path: "tsconfig.json").path, - bridgeDtsPath.path, - ] + remainingArguments - ) + generateArguments.append(contentsOf: [ + "--project", + tsconfigPath.path, + bridgeDtsPath.path, + ]) } + + generateArguments.append( + contentsOf: target.sourceFiles.filter { + !$0.url.path.hasPrefix(generatedDirectory.path + "/") + }.map(\.url.path) + ) + generateArguments.append(contentsOf: remainingArguments) + + try runBridgeJSTool(arguments: generateArguments) } private func runBridgeJSTool(arguments: [String]) throws { diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index e20bb6ab2..b9b9e0634 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -81,7 +81,6 @@ public class ExportSwift { return ( outputSwift: outputSwift, outputSkeleton: ExportedSkeleton( - moduleName: moduleName, functions: exportedFunctions, classes: exportedClasses, enums: exportedEnums, @@ -1659,16 +1658,6 @@ public class ExportSwift { return .swiftHeapObject(swiftCallName) } - static let prelude: DeclSyntax = """ - // 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 - """ - func renderSwiftGlue() throws -> String? { var decls: [DeclSyntax] = [] guard @@ -1677,7 +1666,6 @@ public class ExportSwift { else { return nil } - decls.append(Self.prelude) let closureCodegen = ClosureCodegen() var closureSignatures: Set = [] diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift new file mode 100644 index 000000000..90e3d7313 --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift @@ -0,0 +1,695 @@ +import SwiftSyntax +#if canImport(BridgeJSSkeleton) +import BridgeJSSkeleton +#endif +#if canImport(BridgeJSUtilities) +import BridgeJSUtilities +#endif + +/// Collects macro-annotated Swift declarations and produces ImportedModuleSkeleton. +public final class ImportSwiftMacros { + let progress: ProgressReporting + let moduleName: String + private var sourceFiles: [(sourceFile: SourceFileSyntax, inputFilePath: String)] = [] + + public init(progress: ProgressReporting, moduleName: String) { + self.progress = progress + self.moduleName = moduleName + } + + /// Processes a Swift source file to find declarations marked with @JSFunction/@JSGetter/@JSSetter/@JSClass + /// + /// - Parameters: + /// - sourceFile: The parsed Swift source file to process + /// - inputFilePath: The file path for error reporting + public func addSourceFile(_ sourceFile: SourceFileSyntax, _ inputFilePath: String) { + sourceFiles.append((sourceFile, inputFilePath)) + } + + /// Finalizes the import process and generates the bridge code plus skeleton. + public func finalize() throws -> (outputSwift: String?, outputSkeleton: ImportedModuleSkeleton) { + var perSourceErrors: [(inputFilePath: String, errors: [DiagnosticError])] = [] + var importedFiles: [ImportedFileSkeleton] = [] + + for (sourceFile, inputFilePath) in sourceFiles { + progress.print("Processing \(inputFilePath)") + let collector = APICollector( + inputFilePath: inputFilePath, + knownJSClassNames: Self.collectJSClassNames(from: sourceFile) + ) + collector.walk(sourceFile) + if !collector.errors.isEmpty { + perSourceErrors.append((inputFilePath: inputFilePath, errors: collector.errors)) + } + importedFiles.append( + ImportedFileSkeleton( + functions: collector.importedFunctions, + types: collector.importedTypes + ) + ) + } + + if !perSourceErrors.isEmpty { + let allErrors = perSourceErrors.flatMap { inputFilePath, errors in + errors.map { $0.formattedDescription(fileName: inputFilePath) } + } + throw BridgeJSCoreError(allErrors.joined(separator: "\n")) + } + + let moduleSkeleton = ImportedModuleSkeleton(children: importedFiles) + + var importer = ImportTS(progress: progress, moduleName: moduleName) + for skeleton in importedFiles { + importer.addSkeleton(skeleton) + } + let outputSwift = try importer.finalize() + return (outputSwift: outputSwift, outputSkeleton: moduleSkeleton) + } + + private static func collectJSClassNames(from sourceFile: SourceFileSyntax) -> Set { + let collector = JSImportTypeNameCollector(viewMode: .sourceAccurate) + collector.walk(sourceFile) + return collector.typeNames + } + + private final class JSImportTypeNameCollector: SyntaxAnyVisitor { + var typeNames: Set = [] + + private func visitTypeDecl(_ attributes: AttributeListSyntax?, _ name: String) -> SyntaxVisitorContinueKind { + if APICollector.AttributeChecker.hasJSClassAttribute(attributes) { + typeNames.insert(name) + } + return .visitChildren + } + + override func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind { + visitTypeDecl(node.attributes, node.name.text) + } + + override func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind { + visitTypeDecl(node.attributes, node.name.text) + } + } + + fileprivate final class APICollector: SyntaxAnyVisitor { + var importedFunctions: [ImportedFunctionSkeleton] = [] + var importedTypes: [ImportedTypeSkeleton] = [] + var errors: [DiagnosticError] = [] + + private let inputFilePath: String + private var jsClassNames: Set + + // MARK: - State Management + + enum State { + case topLevel + case jsClassBody(name: String) + } + + private var stateStack: [State] = [.topLevel] + var state: State { + return stateStack.last! + } + + // Current type being collected (when in jsClassBody state) + private struct CurrentType { + let name: String + var constructor: ImportedConstructorSkeleton? + var methods: [ImportedFunctionSkeleton] + var getters: [ImportedGetterSkeleton] + var setters: [ImportedSetterSkeleton] + } + private var currentType: CurrentType? + + // MARK: - Attribute Checking + + /// Helper struct for checking and extracting attributes + fileprivate struct AttributeChecker { + static func hasJSFunctionAttribute(_ attributes: AttributeListSyntax?) -> Bool { + hasAttribute(attributes, name: "JSFunction") + } + + static func hasJSGetterAttribute(_ attributes: AttributeListSyntax?) -> Bool { + hasAttribute(attributes, name: "JSGetter") + } + + static func hasJSSetterAttribute(_ attributes: AttributeListSyntax?) -> Bool { + hasAttribute(attributes, name: "JSSetter") + } + + static func firstJSSetterAttribute(_ attributes: AttributeListSyntax?) -> AttributeSyntax? { + attributes?.first { attribute in + attribute.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JSSetter" + }?.as(AttributeSyntax.self) + } + + static func hasJSClassAttribute(_ attributes: AttributeListSyntax?) -> Bool { + hasAttribute(attributes, name: "JSClass") + } + + static func hasAttribute(_ attributes: AttributeListSyntax?, name: String) -> Bool { + guard let attributes else { return false } + return attributes.contains { attribute in + guard let syntax = attribute.as(AttributeSyntax.self) else { return false } + return syntax.attributeName.trimmedDescription == name + } + } + + + /// Extracts the jsName argument value from a @JSSetter attribute, if present. + static func extractJSName(from attribute: AttributeSyntax) -> String? { + guard let arguments = attribute.arguments?.as(LabeledExprListSyntax.self) else { + return nil + } + for argument in arguments { + if argument.label?.text == "jsName", + let stringLiteral = argument.expression.as(StringLiteralExprSyntax.self), + let segment = stringLiteral.segments.first?.as(StringSegmentSyntax.self) + { + return segment.content.text + } + } + return nil + } + } + + // MARK: - Validation Helpers + + /// Common validation result for setter functions + private struct SetterValidationResult { + let effects: Effects + let jsName: String? + let firstParam: FunctionParameterSyntax + let valueType: BridgeType + } + + /// Validates effects (throws required, async not supported) + private func validateEffects( + _ effects: FunctionEffectSpecifiersSyntax?, + node: some SyntaxProtocol, + attributeName: String + ) -> Effects? { + guard let effects = parseEffects(effects) else { + errors.append( + DiagnosticError( + node: node, + message: "@\(attributeName) declarations must be throws.", + hint: "Declare the function as 'throws (JSException)'." + ) + ) + return nil + } + if effects.isAsync { + errors.append( + DiagnosticError( + node: node, + message: "@\(attributeName) declarations do not support async yet." + ) + ) + return nil + } + return effects + } + + /// Validates a setter function and extracts common information + private func validateSetter( + _ node: FunctionDeclSyntax, + jsSetter: AttributeSyntax, + enclosingTypeName: String? + ) -> SetterValidationResult? { + guard let effects = validateEffects(node.signature.effectSpecifiers, node: node, attributeName: "JSSetter") else { + return nil + } + + let jsName = AttributeChecker.extractJSName(from: jsSetter) + let parameters = node.signature.parameterClause.parameters + + guard let firstParam = parameters.first else { + errors.append( + DiagnosticError( + node: node, + message: "@JSSetter function must have at least one parameter." + ) + ) + return nil + } + + if firstParam.type.is(MissingTypeSyntax.self) { + errors.append( + DiagnosticError( + node: firstParam, + message: "All @JSSetter parameters must have explicit types." + ) + ) + return nil + } + + return SetterValidationResult( + effects: effects, + jsName: jsName, + firstParam: firstParam, + valueType: parseType(firstParam.type, enclosingTypeName: enclosingTypeName) + ) + } + + // MARK: - Property Name Resolution + + /// Helper for resolving property names from setter function names and jsName attributes + private struct PropertyNameResolver { + /// Resolves property name and function base name from a setter function and optional jsName + /// - Returns: (propertyName, functionBaseName) where propertyName preserves case for getter matching, + /// and functionBaseName has lowercase first char for ABI generation + static func resolve( + functionName: String, + jsName: String?, + normalizeIdentifier: (String) -> String + ) -> (propertyName: String, functionBaseName: String)? { + if let jsName = jsName { + let propertyName = normalizeIdentifier(jsName) + let functionBaseName = propertyName.prefix(1).lowercased() + propertyName.dropFirst() + return (propertyName: propertyName, functionBaseName: functionBaseName) + } + + let rawFunctionName = functionName.hasPrefix("`") && functionName.hasSuffix("`") && functionName.count > 2 + ? String(functionName.dropFirst().dropLast()) + : functionName + + guard rawFunctionName.hasPrefix("set"), rawFunctionName.count > 3 else { + return nil + } + + let derivedPropertyName = String(rawFunctionName.dropFirst(3)) + let normalized = normalizeIdentifier(derivedPropertyName) + let propertyName = normalized.prefix(1).lowercased() + normalized.dropFirst() + return (propertyName: propertyName, functionBaseName: propertyName) + } + } + + init(inputFilePath: String, knownJSClassNames: Set) { + self.inputFilePath = inputFilePath + self.jsClassNames = knownJSClassNames + super.init(viewMode: .sourceAccurate) + } + + private func enterJSClass(_ typeName: String) { + stateStack.append(.jsClassBody(name: typeName)) + currentType = CurrentType(name: typeName, constructor: nil, methods: [], getters: [], setters: []) + } + + private func exitJSClass() { + if case .jsClassBody(let typeName) = state, let type = currentType, type.name == typeName { + importedTypes.append( + ImportedTypeSkeleton( + name: type.name, + constructor: type.constructor, + methods: type.methods, + getters: type.getters, + setters: type.setters, + documentation: nil + ) + ) + currentType = nil + } + stateStack.removeLast() + } + + override func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind { + if AttributeChecker.hasJSClassAttribute(node.attributes) { + enterJSClass(node.name.text) + } + return .visitChildren + } + + override func visitPost(_ node: StructDeclSyntax) { + if AttributeChecker.hasJSClassAttribute(node.attributes) { + exitJSClass() + } + } + + override func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind { + if AttributeChecker.hasJSClassAttribute(node.attributes) { + enterJSClass(node.name.text) + } + return .visitChildren + } + + override func visitPost(_ node: ClassDeclSyntax) { + if AttributeChecker.hasJSClassAttribute(node.attributes) { + exitJSClass() + } + } + + // MARK: - Visitor Methods + + override func visit(_ node: ExtensionDeclSyntax) -> SyntaxVisitorContinueKind { + let typeName = node.extendedType.trimmedDescription + collectStaticMembers(in: node.memberBlock.members, typeName: typeName) + return .skipChildren + } + + override func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { + switch state { + case .topLevel: + return handleTopLevelFunction(node) + + case .jsClassBody(let typeName): + guard var type = currentType, type.name == typeName else { + return .skipChildren + } + let isStaticMember = isStatic(node.modifiers) + let handled = handleClassFunction(node, typeName: typeName, isStaticMember: isStaticMember, type: &type) + if handled { + currentType = type + } + return .skipChildren + } + } + + private func handleTopLevelFunction(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { + if AttributeChecker.hasJSFunctionAttribute(node.attributes), + let function = parseFunction(node, enclosingTypeName: nil, isStaticMember: true) { + importedFunctions.append(function) + return .skipChildren + } + // Top-level setters are not supported + if AttributeChecker.hasJSSetterAttribute(node.attributes) { + errors.append( + DiagnosticError( + node: node, + message: "@JSSetter is not supported at top-level. Use it only in @JSClass types." + ) + ) + return .skipChildren + } + return .visitChildren + } + + private func handleClassFunction( + _ node: FunctionDeclSyntax, + typeName: String, + isStaticMember: Bool, + type: inout CurrentType + ) -> Bool { + if AttributeChecker.hasJSFunctionAttribute(node.attributes) { + if isStaticMember { + parseFunction(node, enclosingTypeName: typeName, isStaticMember: true).map { importedFunctions.append($0) } + } else { + parseFunction(node, enclosingTypeName: typeName, isStaticMember: false).map { type.methods.append($0) } + } + return true + } + + if AttributeChecker.hasJSSetterAttribute(node.attributes) { + if isStaticMember { + errors.append( + DiagnosticError( + node: node, + message: "@JSSetter is not supported for static members. Use it only for instance members in @JSClass types." + ) + ) + } else if let jsSetter = AttributeChecker.firstJSSetterAttribute(node.attributes), + let setter = parseSetterSkeleton(jsSetter, node, enclosingTypeName: typeName) { + type.setters.append(setter) + } + return true + } + + return false + } + + override func visit(_ node: VariableDeclSyntax) -> SyntaxVisitorContinueKind { + guard AttributeChecker.hasJSGetterAttribute(node.attributes) else { + return .visitChildren + } + + switch state { + case .topLevel: + errors.append( + DiagnosticError( + node: node, + message: "@JSGetter is not supported at top-level. Use it only in @JSClass types." + ) + ) + return .skipChildren + + case .jsClassBody(let typeName): + guard var type = currentType, type.name == typeName else { + return .skipChildren + } + if isStatic(node.modifiers) { + errors.append( + DiagnosticError( + node: node, + message: "@JSGetter is not supported for static members. Use it only for instance members in @JSClass types." + ) + ) + } else if let getter = parseGetterSkeleton(node, enclosingTypeName: typeName) { + type.getters.append(getter) + currentType = type + } + return .skipChildren + } + } + + override func visit(_ node: InitializerDeclSyntax) -> SyntaxVisitorContinueKind { + guard AttributeChecker.hasJSFunctionAttribute(node.attributes) else { + return .visitChildren + } + + switch state { + case .topLevel: + return .visitChildren + + case .jsClassBody(let typeName): + guard var type = currentType, type.name == typeName else { + return .skipChildren + } + if type.constructor != nil { + errors.append( + DiagnosticError( + node: node, + message: "Only one @JSFunction initializer is supported in @JSClass types." + ) + ) + return .skipChildren + } + if let parsed = parseConstructor(node, typeName: typeName) { + type.constructor = parsed + currentType = type + } + return .skipChildren + } + } + + + // MARK: - Member Collection + + private func collectStaticMembers(in members: MemberBlockItemListSyntax, typeName: String) { + for member in members { + if let function = member.decl.as(FunctionDeclSyntax.self) { + if AttributeChecker.hasJSFunctionAttribute(function.attributes), + let parsed = parseFunction(function, enclosingTypeName: typeName, isStaticMember: true) { + importedFunctions.append(parsed) + } else if AttributeChecker.hasJSSetterAttribute(function.attributes) { + errors.append( + DiagnosticError( + node: function, + message: "@JSSetter is not supported for static members. Use it only for instance members in @JSClass types." + ) + ) + } + } else if let variable = member.decl.as(VariableDeclSyntax.self), + AttributeChecker.hasJSGetterAttribute(variable.attributes) { + errors.append( + DiagnosticError( + node: variable, + message: "@JSGetter is not supported for static members. Use it only for instance members in @JSClass types." + ) + ) + } + } + } + + // MARK: - Parsing Methods + + private func parseConstructor( + _ initializer: InitializerDeclSyntax, + typeName: String + ) -> ImportedConstructorSkeleton? { + guard validateEffects(initializer.signature.effectSpecifiers, node: initializer, attributeName: "JSFunction") != nil else { + return nil + } + return ImportedConstructorSkeleton( + parameters: parseParameters( + from: initializer.signature.parameterClause, + enclosingTypeName: typeName + ) + ) + } + + private func parseFunction( + _ node: FunctionDeclSyntax, + enclosingTypeName: String?, + isStaticMember: Bool + ) -> ImportedFunctionSkeleton? { + guard validateEffects(node.signature.effectSpecifiers, node: node, attributeName: "JSFunction") != nil else { + return nil + } + + let baseName = normalizeIdentifier(node.name.text) + let name: String + if isStaticMember, let enclosingTypeName { + name = "\(enclosingTypeName)_\(baseName)" + } else { + name = baseName + } + + let parameters = parseParameters( + from: node.signature.parameterClause, + enclosingTypeName: enclosingTypeName + ) + let returnType: BridgeType + if let returnTypeSyntax = node.signature.returnClause?.type { + returnType = parseType(returnTypeSyntax, enclosingTypeName: enclosingTypeName) + } else { + returnType = .void + } + return ImportedFunctionSkeleton( + name: name, + parameters: parameters, + returnType: returnType, + documentation: nil + ) + } + + + /// Extracts property info from a VariableDeclSyntax (binding, identifier, type) + private func extractPropertyInfo( + _ node: VariableDeclSyntax, + errorMessage: String = "@JSGetter must declare a single stored property with an explicit type." + ) -> (identifier: IdentifierPatternSyntax, type: TypeSyntax)? { + guard let binding = node.bindings.first, + let identifier = binding.pattern.as(IdentifierPatternSyntax.self), + let typeAnnotation = binding.typeAnnotation else { + errors.append(DiagnosticError(node: node, message: errorMessage)) + return nil + } + return (identifier, typeAnnotation.type) + } + + private func parseGetterSkeleton( + _ node: VariableDeclSyntax, + enclosingTypeName: String? + ) -> ImportedGetterSkeleton? { + guard let (identifier, type) = extractPropertyInfo(node) else { + return nil + } + let propertyType = parseType(type, enclosingTypeName: enclosingTypeName) + let propertyName = normalizeIdentifier(identifier.identifier.text) + return ImportedGetterSkeleton( + name: propertyName, + type: propertyType, + documentation: nil, + functionName: nil + ) + } + + /// Parses a setter as part of a type's property system (for instance setters) + private func parseSetterSkeleton( + _ jsSetter: AttributeSyntax, + _ node: FunctionDeclSyntax, + enclosingTypeName: String? + ) -> ImportedSetterSkeleton? { + guard let validation = validateSetter(node, jsSetter: jsSetter, enclosingTypeName: enclosingTypeName) else { + return nil + } + + let functionName = node.name.text + guard let (propertyName, functionBaseName) = PropertyNameResolver.resolve( + functionName: functionName, + jsName: validation.jsName, + normalizeIdentifier: normalizeIdentifier + ) else { + return nil + } + + return ImportedSetterSkeleton( + name: propertyName, + type: validation.valueType, + documentation: nil, + functionName: "\(functionBaseName)_set" + ) + } + + + // MARK: - Type and Parameter Parsing + + private func parseParameters( + from clause: FunctionParameterClauseSyntax, + enclosingTypeName: String? + ) -> [Parameter] { + clause.parameters.compactMap { param in + let type = param.type + if type.is(MissingTypeSyntax.self) { + errors.append( + DiagnosticError( + node: param, + message: "All @JSFunction parameters must have explicit types." + ) + ) + return nil + } + let nameToken = param.secondName ?? param.firstName + let name = normalizeIdentifier(nameToken.text) + let labelToken = param.secondName == nil ? nil : param.firstName + let label = labelToken?.text == "_" ? nil : labelToken?.text + let bridgeType = parseType(type, enclosingTypeName: enclosingTypeName) + return Parameter(label: label, name: name, type: bridgeType) + } + } + + + private func parseType(_ type: TypeSyntax, enclosingTypeName: String?) -> BridgeType { + guard let identifier = type.as(IdentifierTypeSyntax.self) else { + errors.append( + DiagnosticError( + node: type, + message: "Unsupported @JS type '\(type.trimmedDescription)'." + ) + ) + return .void + } + + let name = normalizeIdentifier(identifier.name.text) + if name == "Self", let enclosingTypeName { + return .jsObject(enclosingTypeName) + } + return BridgeType(swiftType: name) ?? .jsObject(name) + } + + // MARK: - Helper Methods + + private func parseEffects(_ effects: FunctionEffectSpecifiersSyntax?) -> Effects? { + let isThrows = effects?.throwsClause != nil + let isAsync = effects?.asyncSpecifier != nil + guard isThrows else { + return nil + } + return Effects(isAsync: isAsync, isThrows: isThrows) + } + + private func isStatic(_ modifiers: DeclModifierListSyntax?) -> Bool { + guard let modifiers else { return false } + return modifiers.contains { modifier in + modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) + } + } + + private func normalizeIdentifier(_ name: String) -> String { + guard name.hasPrefix("`"), name.hasSuffix("`"), name.count >= 2 else { + return name + } + return String(name.dropFirst().dropLast()) + } + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index e4f6c89bc..402e6e671 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -19,13 +19,12 @@ import BridgeJSUtilities public struct ImportTS { public let progress: ProgressReporting public private(set) var skeleton: ImportedModuleSkeleton - private var moduleName: String { - skeleton.moduleName - } + private let moduleName: String public init(progress: ProgressReporting, moduleName: String) { self.progress = progress - self.skeleton = ImportedModuleSkeleton(moduleName: moduleName, children: []) + self.moduleName = moduleName + self.skeleton = ImportedModuleSkeleton(children: []) } /// Adds a skeleton to the importer's state @@ -52,8 +51,7 @@ public struct ImportTS { } let format = BasicFormat() - let allDecls: [DeclSyntax] = [Self.prelude] + decls - return allDecls.map { $0.formatted(using: format).description }.joined(separator: "\n\n") + return decls.map { $0.formatted(using: format).description }.joined(separator: "\n\n") } class CallJSEmission { @@ -302,15 +300,27 @@ public struct ImportTS { } } - static let prelude: DeclSyntax = """ - // 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`. + private static func thunkName(function: ImportedFunctionSkeleton) -> String { + "_$\(function.name)" + } + + private static func thunkName(type: ImportedTypeSkeleton, method: ImportedFunctionSkeleton) -> String { + "_$\(type.name)_\(method.name)" + } - @_spi(BridgeJS) import JavaScriptKit - """ + private static func thunkName(type: ImportedTypeSkeleton) -> String { + "_$\(type.name)_init" + } + + private static func thunkName( + type: ImportedTypeSkeleton, + propertyName: String, + operation: String + ) + -> String + { + "_$\(type.name)_\(propertyName)_\(operation)" + } func renderSwiftThunk( _ function: ImportedFunctionSkeleton, @@ -325,7 +335,7 @@ public struct ImportTS { topLevelDecls.append(builder.renderImportDecl()) return [ builder.renderThunkDecl( - name: function.name, + name: Self.thunkName(function: function), parameters: function.parameters, returnType: function.returnType ) @@ -334,11 +344,12 @@ public struct ImportTS { } func renderSwiftType(_ type: ImportedTypeSkeleton, topLevelDecls: inout [DeclSyntax]) throws -> [DeclSyntax] { - let name = type.name + let selfParameter = Parameter(label: nil, name: "self", type: .jsObject(nil)) + var decls: [DeclSyntax] = [] func renderMethod(method: ImportedFunctionSkeleton) throws -> [DeclSyntax] { let builder = CallJSEmission(moduleName: moduleName, abiName: method.abiName(context: type)) - try builder.lowerParameter(param: Parameter(label: nil, name: "self", type: .jsObject(name))) + try builder.lowerParameter(param: selfParameter) for param in method.parameters { try builder.lowerParameter(param: param) } @@ -347,11 +358,10 @@ public struct ImportTS { topLevelDecls.append(builder.renderImportDecl()) return [ builder.renderThunkDecl( - name: method.name, - parameters: method.parameters, + name: Self.thunkName(type: type, method: method), + parameters: [selfParameter] + method.parameters, returnType: method.returnType ) - .with(\.leadingTrivia, Self.renderDocumentation(documentation: method.documentation)) ] } @@ -360,119 +370,78 @@ public struct ImportTS { for param in constructor.parameters { try builder.lowerParameter(param: param) } - try builder.call(returnType: .jsObject(name)) - builder.assignThis(returnType: .jsObject(name)) + try builder.call(returnType: .jsObject(nil)) + try builder.liftReturnValue(returnType: .jsObject(nil)) topLevelDecls.append(builder.renderImportDecl()) return [ - builder.renderConstructorDecl(parameters: constructor.parameters) + builder.renderThunkDecl( + name: Self.thunkName(type: type), + parameters: constructor.parameters, + returnType: .jsObject(nil) + ) ] } - func renderGetterDecl(property: ImportedPropertySkeleton) throws -> AccessorDeclSyntax { + func renderGetterDecl(getter: ImportedGetterSkeleton) throws -> DeclSyntax { let builder = CallJSEmission( moduleName: moduleName, - abiName: property.getterAbiName(context: type) + abiName: getter.abiName(context: type) ) - try builder.lowerParameter(param: Parameter(label: nil, name: "self", type: .jsObject(name))) - try builder.call(returnType: property.type) - try builder.liftReturnValue(returnType: property.type) + try builder.lowerParameter(param: selfParameter) + try builder.call(returnType: getter.type) + try builder.liftReturnValue(returnType: getter.type) topLevelDecls.append(builder.renderImportDecl()) - return AccessorDeclSyntax( - accessorSpecifier: .keyword(.get), - effectSpecifiers: Self.buildAccessorEffect(throws: true, async: false), - body: CodeBlockSyntax { - builder.body - } + return DeclSyntax( + builder.renderThunkDecl( + name: Self.thunkName(type: type, propertyName: getter.name, operation: "get"), + parameters: [selfParameter], + returnType: getter.type + ) ) } - func renderSetterDecl(property: ImportedPropertySkeleton) throws -> DeclSyntax { + func renderSetterDecl(setter: ImportedSetterSkeleton) throws -> DeclSyntax { let builder = CallJSEmission( moduleName: moduleName, - abiName: property.setterAbiName(context: type) + abiName: setter.abiName(context: type) ) - let newValue = Parameter(label: nil, name: "newValue", type: property.type) - try builder.lowerParameter(param: Parameter(label: nil, name: "self", type: .jsObject(name))) + let newValue = Parameter(label: nil, name: "newValue", type: setter.type) + try builder.lowerParameter(param: selfParameter) try builder.lowerParameter(param: newValue) try builder.call(returnType: .void) topLevelDecls.append(builder.renderImportDecl()) + // Use functionName if available (has lowercase first char), otherwise derive from name + let propertyNameForThunk: String + if let functionName = setter.functionName, functionName.hasSuffix("_set") { + // Extract base name from functionName (e.g., "any_set" -> "any") + propertyNameForThunk = String(functionName.dropLast(4)) + } else { + // Lowercase first character of property name for thunk + propertyNameForThunk = setter.name.prefix(1).lowercased() + setter.name.dropFirst() + } return builder.renderThunkDecl( - name: "set\(property.name.capitalizedFirstLetter)", - parameters: [newValue], + name: Self.thunkName(type: type, propertyName: propertyNameForThunk, operation: "set"), + parameters: [selfParameter, newValue], returnType: .void ) } - - func renderPropertyDecl(property: ImportedPropertySkeleton) throws -> [DeclSyntax] { - let accessorDecls: [AccessorDeclSyntax] = [try renderGetterDecl(property: property)] - var decls: [DeclSyntax] = [ - DeclSyntax( - VariableDeclSyntax( - leadingTrivia: Self.renderDocumentation(documentation: property.documentation), - bindingSpecifier: .keyword(.var), - bindingsBuilder: { - PatternBindingListSyntax { - PatternBindingSyntax( - pattern: IdentifierPatternSyntax( - identifier: .identifier(property.name.backtickIfNeeded()) - ), - typeAnnotation: TypeAnnotationSyntax( - type: IdentifierTypeSyntax(name: .identifier(property.type.swiftType)) - ), - accessorBlock: AccessorBlockSyntax( - accessors: .accessors( - AccessorDeclListSyntax(accessorDecls) - ) - ) - ) - } - } - ) - ) - ] - if !property.isReadonly { - decls.append(try renderSetterDecl(property: property)) - } - return decls + if let constructor = type.constructor { + decls.append(contentsOf: try renderConstructorDecl(constructor: constructor)) } - let classDecl = try StructDeclSyntax( - leadingTrivia: Self.renderDocumentation(documentation: type.documentation), - name: .identifier(name), - inheritanceClause: InheritanceClauseSyntax( - inheritedTypesBuilder: { - InheritedTypeSyntax(type: TypeSyntax("_JSBridgedClass")) - } - ), - memberBlockBuilder: { - DeclSyntax( - """ - let jsObject: JSObject - """ - ).with(\.trailingTrivia, .newlines(2)) - - DeclSyntax( - """ - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - """ - ).with(\.trailingTrivia, .newlines(2)) - if let constructor = type.constructor { - try renderConstructorDecl(constructor: constructor).map { $0.with(\.trailingTrivia, .newlines(2)) } - } + for getter in type.getters { + decls.append(try renderGetterDecl(getter: getter)) + } - for property in type.properties { - try renderPropertyDecl(property: property).map { $0.with(\.trailingTrivia, .newlines(2)) } - } + for setter in type.setters { + decls.append(try renderSetterDecl(setter: setter)) + } - for method in type.methods { - try renderMethod(method: method).map { $0.with(\.trailingTrivia, .newlines(2)) } - } - } - ) + for method in type.methods { + decls.append(contentsOf: try renderMethod(method: method)) + } - return [DeclSyntax(classDecl)] + return decls } static func renderDocumentation(documentation: String?) -> Trivia { diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 41b323425..d6103f7de 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -8,30 +8,35 @@ import BridgeJSUtilities #endif struct BridgeJSLink { - /// The exported skeletons - var exportedSkeletons: [ExportedSkeleton] = [] - var importedSkeletons: [ImportedModuleSkeleton] = [] + var skeletons: [BridgeJSSkeleton] = [] let sharedMemory: Bool private let namespaceBuilder = NamespaceBuilder() init( - exportedSkeletons: [ExportedSkeleton] = [], - importedSkeletons: [ImportedModuleSkeleton] = [], + skeletons: [BridgeJSSkeleton] = [], sharedMemory: Bool ) { - self.exportedSkeletons = exportedSkeletons - self.importedSkeletons = importedSkeletons + self.skeletons = skeletons self.sharedMemory = sharedMemory } - mutating func addExportedSkeletonFile(data: Data) throws { - let skeleton = try JSONDecoder().decode(ExportedSkeleton.self, from: data) - exportedSkeletons.append(skeleton) - } - - mutating func addImportedSkeletonFile(data: Data) throws { - let skeletons = try JSONDecoder().decode(ImportedModuleSkeleton.self, from: data) - importedSkeletons.append(skeletons) + mutating func addSkeletonFile(data: Data) throws { + do { + let unified = try JSONDecoder().decode(BridgeJSSkeleton.self, from: data) + skeletons.append(unified) + } catch { + struct SkeletonDecodingError: Error, CustomStringConvertible { + let description: String + } + throw SkeletonDecodingError( + description: """ + Failed to decode skeleton file: \(error) + + This file appears to be in an old format. Please regenerate skeleton files using: + bridge-js generate --module-name --target-dir --output-skeleton ... + """ + ) + } } let swiftHeapObjectClassDts = """ @@ -81,7 +86,7 @@ struct BridgeJSLink { var data = LinkData() // Swift heap object class definitions - if exportedSkeletons.contains(where: { $0.classes.count > 0 }) { + if skeletons.contains(where: { $0.exported?.classes.isEmpty == false }) { data.classLines.append( contentsOf: swiftHeapObjectClassJs.split(separator: "\n", omittingEmptySubsequences: false).map { String($0) @@ -95,7 +100,8 @@ struct BridgeJSLink { } // Process exported skeletons - for skeleton in exportedSkeletons { + for unified in skeletons { + guard let skeleton = unified.exported else { continue } // Process classes for klass in skeleton.classes { let (jsType, dtsType, dtsExportEntry) = try renderExportedClass(klass) @@ -162,9 +168,10 @@ struct BridgeJSLink { } // Process imported skeletons - for skeletonSet in importedSkeletons { - let importObjectBuilder = ImportObjectBuilder(moduleName: skeletonSet.moduleName) - for fileSkeleton in skeletonSet.children { + for unified in skeletons { + guard let imported = unified.imported else { continue } + let importObjectBuilder = ImportObjectBuilder(moduleName: unified.moduleName) + for fileSkeleton in imported.children { for function in fileSkeleton.functions { try renderImportedFunction(importObjectBuilder: importObjectBuilder, function: function) } @@ -175,14 +182,16 @@ struct BridgeJSLink { data.importObjectBuilders.append(importObjectBuilder) } - for skeleton in exportedSkeletons { + for unified in skeletons { + guard let skeleton = unified.exported else { continue } + let moduleName = unified.moduleName if !skeleton.protocols.isEmpty { let importObjectBuilder: ImportObjectBuilder - if let existingBuilder = data.importObjectBuilders.first(where: { $0.moduleName == skeleton.moduleName } + if let existingBuilder = data.importObjectBuilders.first(where: { $0.moduleName == moduleName } ) { importObjectBuilder = existingBuilder } else { - importObjectBuilder = ImportObjectBuilder(moduleName: skeleton.moduleName) + importObjectBuilder = ImportObjectBuilder(moduleName: moduleName) data.importObjectBuilders.append(importObjectBuilder) } @@ -297,7 +306,7 @@ struct BridgeJSLink { "bjs = {};", "importObject[\"bjs\"] = bjs;", ]) - if self.importedSkeletons.count > 0 { + if skeletons.contains(where: { $0.imported != nil }) { printer.write(lines: [ "const imports = options.getImports(importsContext);" ]) @@ -576,14 +585,16 @@ struct BridgeJSLink { } printer.write("}") - for skeleton in exportedSkeletons { + for unified in skeletons { + guard let skeleton = unified.exported else { continue } + let moduleName = unified.moduleName var closureSignatures: Set = [] collectClosureSignatures(from: skeleton, into: &closureSignatures) guard !closureSignatures.isEmpty else { continue } for signature in closureSignatures.sorted(by: { $0.mangleName < $1.mangleName }) { - let invokeFuncName = "invoke_js_callback_\(skeleton.moduleName)_\(signature.mangleName)" + let invokeFuncName = "invoke_js_callback_\(moduleName)_\(signature.mangleName)" printer.write( lines: generateInvokeFunction( signature: signature, @@ -591,7 +602,7 @@ struct BridgeJSLink { ) ) - let lowerFuncName = "lower_closure_\(skeleton.moduleName)_\(signature.mangleName)" + let lowerFuncName = "lower_closure_\(moduleName)_\(signature.mangleName)" printer.write( lines: generateLowerClosureFunction( signature: signature, @@ -779,6 +790,8 @@ struct BridgeJSLink { let printer = CodeFragmentPrinter(header: header) printer.nextLine() + let exportedSkeletons = skeletons.compactMap(\.exported) + for skeleton in exportedSkeletons { for proto in skeleton.protocols { printer.write("export interface \(proto.name) {") @@ -922,6 +935,7 @@ struct BridgeJSLink { printer.write(lines: data.topLevelTypeLines) + let exportedSkeletons = skeletons.compactMap(\.exported) let topLevelNamespaceCode = namespaceBuilder.buildTopLevelNamespaceInitialization( exportedSkeletons: exportedSkeletons ) @@ -1028,7 +1042,7 @@ struct BridgeJSLink { private func enumHelperAssignments() -> CodeFragmentPrinter { let printer = CodeFragmentPrinter() - for skeleton in exportedSkeletons { + for skeleton in skeletons.compactMap(\.exported) { for enumDef in skeleton.enums where enumDef.enumType == .associatedValue { printer.write( "const \(enumDef.name)Helpers = __bjs_create\(enumDef.valuesName)Helpers()(\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTextEncoder), \(JSGlueVariableScope.reservedSwift));" @@ -1044,7 +1058,7 @@ struct BridgeJSLink { private func structHelperAssignments() -> CodeFragmentPrinter { let printer = CodeFragmentPrinter() - for skeleton in exportedSkeletons { + for skeleton in skeletons.compactMap(\.exported) { for structDef in skeleton.structs { printer.write( "const \(structDef.name)Helpers = __bjs_create\(structDef.name)Helpers()(\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTmpParamPointers), \(JSGlueVariableScope.reservedTmpRetPointers), \(JSGlueVariableScope.reservedTextEncoder), \(JSGlueVariableScope.reservedSwift), \(JSGlueVariableScope.reservedEnumHelpers));" @@ -1064,13 +1078,15 @@ struct BridgeJSLink { var modulesByName: [String: [ExportedClass]] = [:] // Group classes by their module name - for skeleton in exportedSkeletons { + for unified in skeletons { + guard let skeleton = unified.exported else { continue } if skeleton.classes.isEmpty { continue } + let moduleName = unified.moduleName - if modulesByName[skeleton.moduleName] == nil { - modulesByName[skeleton.moduleName] = [] + if modulesByName[moduleName] == nil { + modulesByName[moduleName] = [] } - modulesByName[skeleton.moduleName]?.append(contentsOf: skeleton.classes) + modulesByName[moduleName]?.append(contentsOf: skeleton.classes) } // Generate wrapper functions for each module @@ -1132,7 +1148,8 @@ struct BridgeJSLink { private func generateImportedTypeDefinitions() -> [String] { let printer = CodeFragmentPrinter() - for skeletonSet in importedSkeletons { + for unified in skeletons { + guard let skeletonSet = unified.imported else { continue } for fileSkeleton in skeletonSet.children { for type in fileSkeleton.types { printer.write("export interface \(type.name) {") @@ -1145,14 +1162,21 @@ struct BridgeJSLink { printer.write(methodSignature) } - // Add properties - for property in type.properties { + // Add properties from getters + var propertyNames = Set() + for getter in type.getters { + propertyNames.insert(getter.name) + let hasSetter = type.setters.contains { $0.name == getter.name } let propertySignature = - property.isReadonly - ? "readonly \(property.name): \(resolveTypeScriptType(property.type));" - : "\(property.name): \(resolveTypeScriptType(property.type));" + hasSetter + ? "\(getter.name): \(resolveTypeScriptType(getter.type));" + : "readonly \(getter.name): \(resolveTypeScriptType(getter.type));" printer.write(propertySignature) } + // Add setters that don't have corresponding getters + for setter in type.setters where !propertyNames.contains(setter.name) { + printer.write("\(setter.name): \(resolveTypeScriptType(setter.type));") + } printer.unindent() printer.write("}") @@ -1279,7 +1303,7 @@ struct BridgeJSLink { /// If the type is an enum, looks up the ExportedEnum and uses its tsFullPath /// Otherwise, uses the default tsType property private func resolveTypeScriptType(_ type: BridgeType) -> String { - return Self.resolveTypeScriptType(type, exportedSkeletons: exportedSkeletons) + return Self.resolveTypeScriptType(type, exportedSkeletons: skeletons.compactMap(\.exported)) } /// Static helper for resolving TypeScript types with full enum paths @@ -2868,34 +2892,34 @@ extension BridgeJSLink { constructor: constructor ) } - for property in type.properties { - let getterAbiName = property.getterAbiName(context: type) - let (js, dts) = try renderImportedProperty( - property: property, + for getter in type.getters { + let getterAbiName = getter.abiName(context: type) + let (js, dts) = try renderImportedGetter( + getter: getter, abiName: getterAbiName, emitCall: { thunkBuilder in - return try thunkBuilder.callPropertyGetter(name: property.name, returnType: property.type) + return try thunkBuilder.callPropertyGetter(name: getter.name, returnType: getter.type) } ) importObjectBuilder.assignToImportObject(name: getterAbiName, function: js) importObjectBuilder.appendDts(dts) + } - if !property.isReadonly { - let setterAbiName = property.setterAbiName(context: type) - let (js, dts) = try renderImportedProperty( - property: property, - abiName: setterAbiName, - emitCall: { thunkBuilder in - try thunkBuilder.liftParameter( - param: Parameter(label: nil, name: "newValue", type: property.type) - ) - thunkBuilder.callPropertySetter(name: property.name, returnType: property.type) - return nil - } - ) - importObjectBuilder.assignToImportObject(name: setterAbiName, function: js) - importObjectBuilder.appendDts(dts) - } + for setter in type.setters { + let setterAbiName = setter.abiName(context: type) + let (js, dts) = try renderImportedSetter( + setter: setter, + abiName: setterAbiName, + emitCall: { thunkBuilder in + try thunkBuilder.liftParameter( + param: Parameter(label: nil, name: "newValue", type: setter.type) + ) + thunkBuilder.callPropertySetter(name: setter.name, returnType: setter.type) + return nil + } + ) + importObjectBuilder.assignToImportObject(name: setterAbiName, function: js) + importObjectBuilder.appendDts(dts) } for method in type.methods { let (js, dts) = try renderImportedMethod(context: type, method: method) @@ -2935,8 +2959,8 @@ extension BridgeJSLink { importObjectBuilder.appendDts(dtsPrinter.lines) } - func renderImportedProperty( - property: ImportedPropertySkeleton, + func renderImportedGetter( + getter: ImportedGetterSkeleton, abiName: String, emitCall: (ImportedThunkBuilder) throws -> String? ) throws -> (js: [String], dts: [String]) { @@ -2946,7 +2970,23 @@ extension BridgeJSLink { let funcLines = thunkBuilder.renderFunction( name: abiName, returnExpr: returnExpr, - returnType: property.type + returnType: getter.type + ) + return (funcLines, []) + } + + func renderImportedSetter( + setter: ImportedSetterSkeleton, + abiName: String, + emitCall: (ImportedThunkBuilder) throws -> String? + ) throws -> (js: [String], dts: [String]) { + let thunkBuilder = ImportedThunkBuilder() + thunkBuilder.liftSelf() + let returnExpr = try emitCall(thunkBuilder) + let funcLines = thunkBuilder.renderFunction( + name: abiName, + returnExpr: returnExpr, + returnType: .void ) return (funcLines, []) } diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/BridgeJSMacrosPlugin.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/BridgeJSMacrosPlugin.swift new file mode 100644 index 000000000..9a45fa0f0 --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/BridgeJSMacrosPlugin.swift @@ -0,0 +1,12 @@ +import SwiftCompilerPlugin +import SwiftSyntaxMacros + +@main +struct BridgeJSMacrosPlugin: CompilerPlugin { + var providingMacros: [Macro.Type] = [ + JSFunctionMacro.self, + JSGetterMacro.self, + JSSetterMacro.self, + JSClassMacro.self, + ] +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift new file mode 100644 index 000000000..fc7af6cda --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift @@ -0,0 +1,51 @@ +import SwiftSyntax +import SwiftSyntaxBuilder +import SwiftSyntaxMacros +import SwiftDiagnostics + +public enum JSClassMacro {} + +extension JSClassMacro: MemberMacro { + public static func expansion( + of node: AttributeSyntax, + providingMembersOf declaration: some DeclGroupSyntax, + in context: some MacroExpansionContext + ) throws -> [DeclSyntax] { + var members: [DeclSyntax] = [] + + let existingMembers = declaration.memberBlock.members + let hasJSObjectProperty = existingMembers.contains { member in + guard let variable = member.decl.as(VariableDeclSyntax.self) else { return false } + return variable.bindings.contains { binding in + binding.pattern.as(IdentifierPatternSyntax.self)?.identifier.text == "jsObject" + } + } + + if !hasJSObjectProperty { + members.append(DeclSyntax("let jsObject: JSObject")) + } + + let hasUnsafelyWrappingInit = existingMembers.contains { member in + guard let initializer = member.decl.as(InitializerDeclSyntax.self) else { return false } + let parameters = initializer.signature.parameterClause.parameters + guard let firstParam = parameters.first else { return false } + let externalName = firstParam.firstName.text + let internalName = firstParam.secondName?.text + return externalName == "unsafelyWrapping" && internalName == "jsObject" + } + + if !hasUnsafelyWrappingInit { + members.append( + DeclSyntax( + """ + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + """ + ) + ) + } + + return members + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift new file mode 100644 index 000000000..7dfd635f9 --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift @@ -0,0 +1,72 @@ +import SwiftSyntax +import SwiftSyntaxBuilder +import SwiftSyntaxMacros +import SwiftDiagnostics + +public enum JSFunctionMacro {} + +extension JSFunctionMacro: BodyMacro { + public static func expansion( + of node: AttributeSyntax, + providingBodyFor declaration: some DeclSyntaxProtocol & WithOptionalCodeBlockSyntax, + in context: some MacroExpansionContext + ) throws -> [CodeBlockItemSyntax] { + if let functionDecl = declaration.as(FunctionDeclSyntax.self) { + let enclosingTypeName = JSMacroHelper.enclosingTypeName(from: context) + let isStatic = JSMacroHelper.isStatic(functionDecl.modifiers) + let isInstanceMember = enclosingTypeName != nil && !isStatic + + // Strip backticks from function name (e.g., "`prefix`" -> "prefix") + // Backticks are only needed for Swift identifiers, not function names + let name = JSMacroHelper.stripBackticks(functionDecl.name.text) + let glueName = JSMacroHelper.glueName(baseName: name, enclosingTypeName: enclosingTypeName) + + var arguments: [String] = [] + if isInstanceMember { + arguments.append("self.jsObject") + } + arguments.append( + contentsOf: JSMacroHelper.parameterNames(functionDecl.signature.parameterClause.parameters) + ) + + let argsJoined = arguments.joined(separator: ", ") + let call = "\(glueName)(\(argsJoined))" + + let effects = functionDecl.signature.effectSpecifiers + let isAsync = effects?.asyncSpecifier != nil + let isThrows = effects?.throwsClause != nil + let prefix = JSMacroHelper.tryAwaitPrefix(isAsync: isAsync, isThrows: isThrows) + + let isVoid = JSMacroHelper.isVoidReturn(functionDecl.signature.returnClause?.type) + let line = isVoid ? "\(prefix)\(call)" : "return \(prefix)\(call)" + return [CodeBlockItemSyntax(stringLiteral: line)] + } + + if let initializerDecl = declaration.as(InitializerDeclSyntax.self) { + guard let enclosingTypeName = JSMacroHelper.enclosingTypeName(from: context) else { + context.diagnose( + Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedDeclaration) + ) + return [] + } + + let glueName = JSMacroHelper.glueName(baseName: "init", enclosingTypeName: enclosingTypeName) + let parameters = initializerDecl.signature.parameterClause.parameters + let arguments = JSMacroHelper.parameterNames(parameters) + let call = "\(glueName)(\(arguments.joined(separator: ", ")))" + + let effects = initializerDecl.signature.effectSpecifiers + let isAsync = effects?.asyncSpecifier != nil + let isThrows = effects?.throwsClause != nil + let prefix = JSMacroHelper.tryAwaitPrefix(isAsync: isAsync, isThrows: isThrows) + + return [ + CodeBlockItemSyntax(stringLiteral: "let jsObject = \(prefix)\(call)"), + CodeBlockItemSyntax(stringLiteral: "self.init(unsafelyWrapping: jsObject)"), + ] + } + + context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedDeclaration)) + return [] + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift new file mode 100644 index 000000000..b996facfa --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift @@ -0,0 +1,62 @@ +import SwiftSyntax +import SwiftSyntaxBuilder +import SwiftSyntaxMacros +import SwiftDiagnostics + +public enum JSGetterMacro {} + +extension JSGetterMacro: AccessorMacro { + public static func expansion( + of node: AttributeSyntax, + providingAccessorsOf declaration: some DeclSyntaxProtocol, + in context: some MacroExpansionContext + ) throws -> [AccessorDeclSyntax] { + guard let variableDecl = declaration.as(VariableDeclSyntax.self), + let binding = variableDecl.bindings.first, + let identifier = binding.pattern.as(IdentifierPatternSyntax.self) + else { + context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedVariable)) + return [] + } + + let enclosingTypeName = JSMacroHelper.enclosingTypeName(from: context) + let isStatic = JSMacroHelper.isStatic(variableDecl.modifiers) + let isInstanceMember = enclosingTypeName != nil && !isStatic + + // Strip backticks from property name (e.g., "`prefix`" -> "prefix") + // Backticks are only needed for Swift identifiers, not function names + let propertyName = JSMacroHelper.stripBackticks(identifier.identifier.text) + let getterName = JSMacroHelper.glueName( + baseName: propertyName, + enclosingTypeName: enclosingTypeName, + operation: "get" + ) + + var getterArgs: [String] = [] + if isInstanceMember { + getterArgs.append("self.jsObject") + } + let getterCall: CodeBlockItemSyntax = + "return try \(raw: getterName)(\(raw: getterArgs.joined(separator: ", ")))" + + let throwsClause = ThrowsClauseSyntax( + throwsSpecifier: .keyword(.throws), + leftParen: .leftParenToken(), + type: IdentifierTypeSyntax(name: .identifier("JSException")), + rightParen: .rightParenToken() + ) + + return [ + AccessorDeclSyntax( + accessorSpecifier: .keyword(.get), + effectSpecifiers: AccessorEffectSpecifiersSyntax( + asyncSpecifier: nil, + throwsClause: throwsClause + ), + body: CodeBlockSyntax { + getterCall + } + ) + ] + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift new file mode 100644 index 000000000..b10871f6a --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift @@ -0,0 +1,100 @@ +import SwiftSyntax +import SwiftSyntaxBuilder +import SwiftSyntaxMacros +import SwiftDiagnostics + +enum JSMacroMessage: String, DiagnosticMessage { + case unsupportedDeclaration = "@JSFunction can only be applied to functions or initializers." + case unsupportedVariable = "@JSGetter can only be applied to single-variable declarations." + case unsupportedSetterDeclaration = "@JSSetter can only be applied to functions." + case invalidSetterName = + "@JSSetter function name must start with 'set' followed by a property name (e.g., 'setFoo')." + case setterRequiresParameter = "@JSSetter function must have at least one parameter." + + var message: String { rawValue } + var diagnosticID: MessageID { MessageID(domain: "JavaScriptKitMacros", id: rawValue) } + var severity: DiagnosticSeverity { .error } +} + +enum JSMacroHelper { + static func enclosingTypeName(from context: some MacroExpansionContext) -> String? { + for syntax in context.lexicalContext { + if let decl = syntax.as(ClassDeclSyntax.self) { + return decl.name.text + } + if let decl = syntax.as(StructDeclSyntax.self) { + return decl.name.text + } + if let decl = syntax.as(EnumDeclSyntax.self) { + return decl.name.text + } + if let decl = syntax.as(ActorDeclSyntax.self) { + return decl.name.text + } + } + return nil + } + + static func isStatic(_ modifiers: DeclModifierListSyntax?) -> Bool { + guard let modifiers else { return false } + return modifiers.contains { modifier in + modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) + } + } + + static func isVoidReturn(_ returnType: TypeSyntax?) -> Bool { + guard let returnType else { return true } + if let identifier = returnType.as(IdentifierTypeSyntax.self), identifier.name.text == "Void" { + return true + } + if let tuple = returnType.as(TupleTypeSyntax.self), tuple.elements.isEmpty { + return true + } + return false + } + + static func glueName(baseName: String, enclosingTypeName: String?) -> String { + if let enclosingTypeName { + return "_$\(enclosingTypeName)_\(baseName)" + } + return "_$\(baseName)" + } + + static func glueName(baseName: String, enclosingTypeName: String?, operation: String) -> String { + if let enclosingTypeName { + return "_$\(enclosingTypeName)_\(baseName)_\(operation)" + } + return "_$\(baseName)_\(operation)" + } + + static func parameterNames(_ parameters: FunctionParameterListSyntax) -> [String] { + parameters.compactMap { param in + let nameToken = param.secondName ?? param.firstName + let nameText = nameToken.text + return nameText == "_" ? nil : nameText + } + } + + static func tryAwaitPrefix(isAsync: Bool, isThrows: Bool) -> String { + switch (isAsync, isThrows) { + case (true, true): + return "try await " + case (true, false): + return "await " + case (false, true): + return "try " + case (false, false): + return "" + } + } + + /// Strips backticks from an identifier name. + /// Swift identifiers with keywords are escaped with backticks (e.g., `` `prefix` ``), + /// but function names should not include backticks. + static func stripBackticks(_ name: String) -> String { + if name.hasPrefix("`") && name.hasSuffix("`") && name.count > 2 { + return String(name.dropFirst().dropLast()) + } + return name + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift new file mode 100644 index 000000000..bb9fd1f21 --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift @@ -0,0 +1,71 @@ +import SwiftSyntax +import SwiftSyntaxBuilder +import SwiftSyntaxMacros +import SwiftDiagnostics + +public enum JSSetterMacro {} + +extension JSSetterMacro: BodyMacro { + public static func expansion( + of node: AttributeSyntax, + providingBodyFor declaration: some DeclSyntaxProtocol & WithOptionalCodeBlockSyntax, + in context: some MacroExpansionContext + ) throws -> [CodeBlockItemSyntax] { + guard let functionDecl = declaration.as(FunctionDeclSyntax.self) else { + context.diagnose( + Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedSetterDeclaration) + ) + return [] + } + + let functionName = functionDecl.name.text + + // Extract property name from setter function name (e.g., "setFoo" -> "foo") + // Strip backticks if present (e.g., "set`prefix`" -> "prefix") + let rawFunctionName = JSMacroHelper.stripBackticks(functionName) + guard rawFunctionName.hasPrefix("set"), rawFunctionName.count > 3 else { + context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.invalidSetterName)) + return [] + } + + let propertyName = String(rawFunctionName.dropFirst(3)) + guard !propertyName.isEmpty else { + context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.invalidSetterName)) + return [] + } + + // Convert first character to lowercase (e.g., "Foo" -> "foo") + let baseName = propertyName.prefix(1).lowercased() + propertyName.dropFirst() + + let enclosingTypeName = JSMacroHelper.enclosingTypeName(from: context) + let isStatic = JSMacroHelper.isStatic(functionDecl.modifiers) + let isInstanceMember = enclosingTypeName != nil && !isStatic + + let glueName = JSMacroHelper.glueName( + baseName: baseName, + enclosingTypeName: enclosingTypeName, + operation: "set" + ) + + var arguments: [String] = [] + if isInstanceMember { + arguments.append("self.jsObject") + } + + // Get the parameter name(s) - setters typically have one parameter + let parameters = functionDecl.signature.parameterClause.parameters + guard let firstParam = parameters.first else { + context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.setterRequiresParameter)) + return [] + } + + let paramName = firstParam.secondName ?? firstParam.firstName + arguments.append(paramName.text) + + let argsJoined = arguments.joined(separator: ", ") + let call = "\(glueName)(\(argsJoined))" + + // Setters should throw JSException, so always use try + return [CodeBlockItemSyntax(stringLiteral: "try \(call)")] + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index b2dae86c0..e1815fbeb 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -548,7 +548,6 @@ public struct ExportedProperty: Codable, Equatable, Sendable { } public struct ExportedSkeleton: Codable { - public let moduleName: String public let functions: [ExportedFunction] public let classes: [ExportedClass] public let enums: [ExportedEnum] @@ -562,7 +561,6 @@ public struct ExportedSkeleton: Codable { public var exposeToGlobal: Bool public init( - moduleName: String, functions: [ExportedFunction], classes: [ExportedClass], enums: [ExportedEnum], @@ -570,7 +568,6 @@ public struct ExportedSkeleton: Codable { protocols: [ExportedProtocol] = [], exposeToGlobal: Bool ) { - self.moduleName = moduleName self.functions = functions self.classes = classes self.enums = enums @@ -588,6 +585,13 @@ public struct ImportedFunctionSkeleton: Codable { public let returnType: BridgeType public let documentation: String? + public init(name: String, parameters: [Parameter], returnType: BridgeType, documentation: String? = nil) { + self.name = name + self.parameters = parameters + self.returnType = returnType + self.documentation = documentation + } + public func abiName(context: ImportedTypeSkeleton?) -> String { return ABINameGenerator.generateImportedABIName( baseName: name, @@ -599,6 +603,10 @@ public struct ImportedFunctionSkeleton: Codable { public struct ImportedConstructorSkeleton: Codable { public let parameters: [Parameter] + public init(parameters: [Parameter]) { + self.parameters = parameters + } + public func abiName(context: ImportedTypeSkeleton) -> String { return ABINameGenerator.generateImportedABIName( baseName: "init", @@ -607,21 +615,68 @@ public struct ImportedConstructorSkeleton: Codable { } } -public struct ImportedPropertySkeleton: Codable { +public struct ImportedGetterSkeleton: Codable { public let name: String - public let isReadonly: Bool public let type: BridgeType public let documentation: String? + /// Name of the getter function if it's a separate function (from @JSGetter) + public let functionName: String? - public func getterAbiName(context: ImportedTypeSkeleton) -> String { + public init( + name: String, + type: BridgeType, + documentation: String? = nil, + functionName: String? = nil + ) { + self.name = name + self.type = type + self.documentation = documentation + self.functionName = functionName + } + + public func abiName(context: ImportedTypeSkeleton) -> String { + if let functionName = functionName { + return ABINameGenerator.generateImportedABIName( + baseName: functionName, + context: context, + operation: nil + ) + } return ABINameGenerator.generateImportedABIName( baseName: name, context: context, operation: "get" ) } +} - public func setterAbiName(context: ImportedTypeSkeleton) -> String { +public struct ImportedSetterSkeleton: Codable { + public let name: String + public let type: BridgeType + public let documentation: String? + /// Name of the setter function if it's a separate function (from @JSSetter) + public let functionName: String? + + public init( + name: String, + type: BridgeType, + documentation: String? = nil, + functionName: String? = nil + ) { + self.name = name + self.type = type + self.documentation = documentation + self.functionName = functionName + } + + public func abiName(context: ImportedTypeSkeleton) -> String { + if let functionName = functionName { + return ABINameGenerator.generateImportedABIName( + baseName: functionName, + context: context, + operation: nil + ) + } return ABINameGenerator.generateImportedABIName( baseName: name, context: context, @@ -634,25 +689,60 @@ public struct ImportedTypeSkeleton: Codable { public let name: String public let constructor: ImportedConstructorSkeleton? public let methods: [ImportedFunctionSkeleton] - public let properties: [ImportedPropertySkeleton] + public let getters: [ImportedGetterSkeleton] + public let setters: [ImportedSetterSkeleton] public let documentation: String? + + public init( + name: String, + constructor: ImportedConstructorSkeleton? = nil, + methods: [ImportedFunctionSkeleton], + getters: [ImportedGetterSkeleton] = [], + setters: [ImportedSetterSkeleton] = [], + documentation: String? = nil + ) { + self.name = name + self.constructor = constructor + self.methods = methods + self.getters = getters + self.setters = setters + self.documentation = documentation + } } public struct ImportedFileSkeleton: Codable { public let functions: [ImportedFunctionSkeleton] public let types: [ImportedTypeSkeleton] + + public init(functions: [ImportedFunctionSkeleton], types: [ImportedTypeSkeleton]) { + self.functions = functions + self.types = types + } } public struct ImportedModuleSkeleton: Codable { - public let moduleName: String public var children: [ImportedFileSkeleton] - public init(moduleName: String, children: [ImportedFileSkeleton]) { - self.moduleName = moduleName + public init(children: [ImportedFileSkeleton]) { self.children = children } } +// MARK: - Unified Skeleton + +/// Unified skeleton containing both exported and imported API definitions +public struct BridgeJSSkeleton: Codable { + public let moduleName: String + public let exported: ExportedSkeleton? + public let imported: ImportedModuleSkeleton? + + public init(moduleName: String, exported: ExportedSkeleton? = nil, imported: ImportedModuleSkeleton? = nil) { + self.moduleName = moduleName + self.exported = exported + self.imported = imported + } +} + // MARK: - BridgeType extension extension BridgeType { diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index d5a58aba9..1f3aadf1c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -9,6 +9,7 @@ @preconcurrency import class Foundation.JSONDecoder @preconcurrency import class Foundation.ProcessInfo import SwiftParser +import SwiftSyntax #if canImport(BridgeJSCore) import BridgeJSCore @@ -16,8 +17,11 @@ import BridgeJSCore #if canImport(BridgeJSSkeleton) import BridgeJSSkeleton #endif -#if canImport(TS2Skeleton) -import TS2Skeleton +#if canImport(TS2Swift) +import TS2Swift +#endif +#if canImport(BridgeJSUtilities) +import BridgeJSUtilities #endif /// BridgeJS Tool @@ -29,10 +33,7 @@ import TS2Skeleton /// 2. Export: Generate JavaScript bindings for Swift declarations /// /// Usage: -/// For importing TypeScript: -/// $ bridge-js import --module-name --output-swift --output-skeleton --project -/// For exporting Swift: -/// $ bridge-js export --output-swift --output-skeleton +/// $ bridge-js generate --module-name --target-dir --output-swift --output-skeleton [--output-import-swift ] [--output-import-skeleton ] [--project ] ... [...] /// /// This tool is intended to be used through the Swift Package Manager plugin system /// and is not typically called directly by end users. @@ -40,11 +41,10 @@ import TS2Skeleton static func help() -> String { return """ - Usage: \(CommandLine.arguments.first ?? "bridge-js-tool") [options] + Usage: \(CommandLine.arguments.first ?? "bridge-js-tool") generate [options] ... - Subcommands: - import Generate binding code to import TypeScript APIs into Swift - export Generate binding code to export Swift APIs to JavaScript + Generate bridge code for both exporting Swift APIs and importing TypeScript APIs. + Input files can be Swift source files (for export) or macro-annotated Swift files (for import). """ } @@ -69,16 +69,16 @@ import TS2Skeleton ) } switch subcommand { - case "import": + case "generate": let parser = ArgumentParser( singleDashOptions: [:], doubleDashOptions: [ "module-name": OptionRule( - help: "The name of the module to import the TypeScript API into", + help: "The name of the module", required: true ), "always-write": OptionRule( - help: "Always write the output files even if no APIs are imported", + help: "Always write the output files even if no APIs are found", required: false ), "verbose": OptionRule( @@ -89,14 +89,13 @@ import TS2Skeleton help: "The SwiftPM package target directory", required: true ), - "output-swift": OptionRule(help: "The output file path for the Swift source code", required: true), - "output-skeleton": OptionRule( - help: "The output file path for the skeleton of the imported TypeScript APIs", + "output-dir": OptionRule( + help: "The output directory for generated code", required: true ), "project": OptionRule( - help: "The path to the TypeScript project configuration file", - required: true + help: "The path to the TypeScript project configuration file (required for .d.ts files)", + required: false ), ] ) @@ -104,140 +103,90 @@ import TS2Skeleton arguments: Array(arguments.dropFirst()) ) let progress = ProgressReporting(verbose: doubleDashOptions["verbose"] == "true") - var importer = ImportTS(progress: progress, moduleName: doubleDashOptions["module-name"]!) + let moduleName = doubleDashOptions["module-name"]! let targetDirectory = URL(fileURLWithPath: doubleDashOptions["target-dir"]!) + let outputDirectory = URL(fileURLWithPath: doubleDashOptions["output-dir"]!) let config = try BridgeJSConfig.load(targetDirectory: targetDirectory) let nodePath: URL = try config.findTool("node", targetDirectory: targetDirectory) - for inputFile in positionalArguments { - if inputFile.hasSuffix(".json") { - let sourceURL = URL(fileURLWithPath: inputFile) - let skeleton = try JSONDecoder().decode( - ImportedFileSkeleton.self, - from: Data(contentsOf: sourceURL) - ) - importer.addSkeleton(skeleton) - } else if inputFile.hasSuffix(".d.ts") { - let tsconfigPath = URL(fileURLWithPath: doubleDashOptions["project"]!) - try importer.addSourceFile(inputFile, tsconfigPath: tsconfigPath.path, nodePath: nodePath) - } - } - let outputSwift = try importer.finalize() - let shouldWrite = doubleDashOptions["always-write"] == "true" || outputSwift != nil - guard shouldWrite else { - progress.print("No imported TypeScript APIs found") - return + let bridgeJsDtsPath = targetDirectory.appending(path: "bridge-js.d.ts") + if FileManager.default.fileExists(atPath: bridgeJsDtsPath.path) { + guard let tsconfigPath = doubleDashOptions["project"] else { + throw BridgeJSToolError("--project option is required when processing .d.ts files") + } + let bridgeJSMacrosPath = outputDirectory.appending(path: "BridgeJS.Macros.swift") + _ = try invokeTS2Swift( + dtsFile: bridgeJsDtsPath.path, + tsconfigPath: tsconfigPath, + nodePath: nodePath, + progress: progress, + outputPath: bridgeJSMacrosPath.path + ) } - let outputSwiftURL = URL(fileURLWithPath: doubleDashOptions["output-swift"]!) - try FileManager.default.createDirectory( - at: outputSwiftURL.deletingLastPathComponent(), - withIntermediateDirectories: true, - attributes: nil - ) - try (outputSwift ?? "").write(to: outputSwiftURL, atomically: true, encoding: .utf8) - - let outputSkeletonsURL = URL(fileURLWithPath: doubleDashOptions["output-skeleton"]!) - try FileManager.default.createDirectory( - at: outputSkeletonsURL.deletingLastPathComponent(), - withIntermediateDirectories: true, - attributes: nil - ) - let encoder = JSONEncoder() - encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - try encoder.encode(importer.skeleton).write(to: outputSkeletonsURL) - - progress.print( - """ - Imported TypeScript APIs: - - \(outputSwiftURL.path) - - \(outputSkeletonsURL.path) - """ - ) - case "export": - let parser = ArgumentParser( - singleDashOptions: [:], - doubleDashOptions: [ - "module-name": OptionRule( - help: "The name of the module for external function references", - required: true - ), - "target-dir": OptionRule( - help: "The SwiftPM package target directory", - required: true - ), - "output-skeleton": OptionRule( - help: "The output file path for the skeleton of the exported Swift APIs", - required: true - ), - "output-swift": OptionRule(help: "The output file path for the Swift source code", required: true), - "always-write": OptionRule( - help: "Always write the output files even if no APIs are exported", - required: false - ), - "verbose": OptionRule( - help: "Print verbose output", - required: false - ), - ] - ) - let (positionalArguments, _, doubleDashOptions) = try parser.parse( - arguments: Array(arguments.dropFirst()) - ) - let progress = ProgressReporting(verbose: doubleDashOptions["verbose"] == "true") - let targetDirectory = URL(fileURLWithPath: doubleDashOptions["target-dir"]!) - let config = try BridgeJSConfig.load(targetDirectory: targetDirectory) + let inputFiles = inputSwiftFiles(targetDirectory: targetDirectory, positionalArguments: positionalArguments) let exporter = ExportSwift( progress: progress, - moduleName: doubleDashOptions["module-name"]!, + moduleName: moduleName, exposeToGlobal: config.exposeToGlobal ) - for inputFile in positionalArguments.sorted() { - let sourceURL = URL(fileURLWithPath: inputFile) - guard sourceURL.pathExtension == "swift" else { continue } - let sourceContent = try String(contentsOf: sourceURL, encoding: .utf8) - let sourceFile = Parser.parse(source: sourceContent) - try exporter.addSourceFile(sourceFile, sourceURL.path) - } + let importSwift = ImportSwiftMacros(progress: progress, moduleName: moduleName) + + for inputFile in inputFiles.sorted() { + let content = try String(contentsOf: URL(fileURLWithPath: inputFile), encoding: .utf8) + if hasBridgeJSSkipComment(content) { + continue + } - // Finalize the export - let output = try exporter.finalize() - let outputSwiftURL = URL(fileURLWithPath: doubleDashOptions["output-swift"]!) - let outputSkeletonURL = URL(fileURLWithPath: doubleDashOptions["output-skeleton"]!) + let sourceFile = Parser.parse(source: content) + try exporter.addSourceFile(sourceFile, inputFile) + importSwift.addSourceFile(sourceFile, inputFile) + } - let shouldWrite = doubleDashOptions["always-write"] == "true" || output != nil - guard shouldWrite else { - progress.print("No exported Swift APIs found") - return + let importResult = try importSwift.finalize() + let exportResult = try exporter.finalize() + let importSkeleton = importResult.outputSkeleton + + // Combine and write unified Swift output + let outputSwiftURL = outputDirectory.appending(path: "BridgeJS.swift") + let combinedSwift = [exportResult?.outputSwift, importResult.outputSwift].compactMap { $0 } + let outputSwift = combineGeneratedSwift(combinedSwift) + let shouldWrite = doubleDashOptions["always-write"] == "true" || !outputSwift.isEmpty + if shouldWrite { + try FileManager.default.createDirectory( + at: outputSwiftURL.deletingLastPathComponent(), + withIntermediateDirectories: true, + attributes: nil + ) + try outputSwift.write(to: outputSwiftURL, atomically: true, encoding: .utf8) } - // Create the output directory if it doesn't exist - try FileManager.default.createDirectory( - at: outputSwiftURL.deletingLastPathComponent(), - withIntermediateDirectories: true, - attributes: nil + // Write unified skeleton + let outputSkeletonURL = outputDirectory.appending(path: "JavaScript/BridgeJS.json") + let unifiedSkeleton = BridgeJSSkeleton( + moduleName: moduleName, + exported: exportResult?.outputSkeleton, + imported: importSkeleton ) try FileManager.default.createDirectory( at: outputSkeletonURL.deletingLastPathComponent(), withIntermediateDirectories: true, attributes: nil ) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys] + let skeletonData = try encoder.encode(unifiedSkeleton) + try skeletonData.write(to: outputSkeletonURL) - // Write the output Swift file - try (output?.outputSwift ?? "").write(to: outputSwiftURL, atomically: true, encoding: .utf8) - - if let outputSkeleton = output?.outputSkeleton { - // Write the output skeleton file - let encoder = JSONEncoder() - encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - let outputSkeletonData = try encoder.encode(outputSkeleton) - try outputSkeletonData.write(to: outputSkeletonURL) + if exportResult != nil || importResult.outputSwift != nil { + progress.print("Generated BridgeJS code") } - progress.print( + case "export", "import": + throw BridgeJSToolError( """ - Exported Swift APIs: - - \(outputSwiftURL.path) - - \(outputSkeletonURL.path) + Error: Subcommands 'export' and 'import' have been unified into 'generate'. + + \(BridgeJSTool.help()) """ ) default: @@ -264,6 +213,52 @@ private func printStderr(_ message: String) { fputs(message + "\n", stderr) } +private func hasBridgeJSSkipComment(_ content: String) -> Bool { + BridgeJSGeneratedFile.hasSkipComment(content) +} + +private func combineGeneratedSwift(_ pieces: [String]) -> String { + let trimmedPieces = pieces + .map { $0.trimmingCharacters(in: .newlines) } + .filter { !$0.isEmpty } + guard !trimmedPieces.isEmpty else { return "" } + + return ([BridgeJSGeneratedFile.swiftPreamble] + trimmedPieces).joined(separator: "\n\n") +} + +private func recursivelyCollectSwiftFiles(from directory: URL) -> [URL] { + var swiftFiles: [URL] = [] + let fileManager = FileManager.default + + guard + let enumerator = fileManager.enumerator( + at: directory, + includingPropertiesForKeys: [.isRegularFileKey, .isDirectoryKey], + options: [.skipsHiddenFiles] + ) + else { + return [] + } + + for case let fileURL as URL in enumerator { + if fileURL.pathExtension == "swift" { + let resourceValues = try? fileURL.resourceValues(forKeys: [.isRegularFileKey]) + if resourceValues?.isRegularFile == true { + swiftFiles.append(fileURL) + } + } + } + + return swiftFiles.sorted { $0.path < $1.path } +} + +private func inputSwiftFiles(targetDirectory: URL, positionalArguments: [String]) -> [String] { + if positionalArguments.isEmpty { + return recursivelyCollectSwiftFiles(from: targetDirectory).map(\.path) + } + return positionalArguments +} + // MARK: - Minimal Argument Parsing struct OptionRule { diff --git a/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift b/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift index f091e4a3f..1117575ab 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift @@ -1,6 +1,29 @@ +import Foundation + extension String { public var capitalizedFirstLetter: String { guard !isEmpty else { return self } return prefix(1).uppercased() + dropFirst() } } + +public enum BridgeJSGeneratedFile { + public static let skipLine = "// bridge-js: skip" + + public static func hasSkipComment(_ content: String) -> Bool { + content.starts(with: skipLine + "\n") + } + + public static var swiftPreamble: String { + """ + \(skipLine) + // 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) @_spi(Experimental) import JavaScriptKit + """.trimmingCharacters(in: .newlines) + } +} diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/README.md b/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/README.md deleted file mode 100644 index de6806350..000000000 --- a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# ts2skeleton - -This script analyzes the TypeScript type definitions and produces a structured JSON output with skeleton information that can be used to generate Swift bindings. diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/README.md b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/README.md new file mode 100644 index 000000000..b2dbe6a6a --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/README.md @@ -0,0 +1,3 @@ +# ts2swift + +This script analyzes the TypeScript type definitions and produces macro-annotated Swift declarations that can be fed into BridgeJS for glue generation. diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/bin/ts2skeleton.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/bin/ts2swift.js old mode 100755 new mode 100644 similarity index 53% rename from Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/bin/ts2skeleton.js rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/bin/ts2swift.js index ba926a889..cc94fce3c --- a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/bin/ts2skeleton.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/bin/ts2swift.js @@ -2,11 +2,10 @@ // @ts-check /** - * Main entry point for the ts2skeleton tool + * Main entry point for the ts2swift tool * - * This script analyzes the TypeScript type definitions and produces a structured - * JSON output with skeleton information that can be used to generate Swift - * bindings. + * This script analyzes the TypeScript type definitions and produces macro-annotated + * Swift declarations that can be used to generate Swift bindings. */ import { main } from "../src/cli.js" diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/package.json b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json similarity index 69% rename from Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/package.json rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json index 48fb77cfc..d6b34558d 100644 --- a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/package.json +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json @@ -4,6 +4,6 @@ "typescript": "5.8.2" }, "bin": { - "ts2skeleton": "./bin/ts2skeleton.js" + "ts2swift": "./bin/ts2swift.js" } } diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/cli.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js similarity index 90% rename from Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/cli.js rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js index 41f6e4198..28f37e0ec 100644 --- a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/cli.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js @@ -73,7 +73,7 @@ class DiagnosticEngine { } function printUsage() { - console.error('Usage: ts2skeleton -p [-o output.json]'); + console.error('Usage: ts2swift -p [-o output.swift]'); } /** @@ -139,13 +139,14 @@ export function main(args) { } const processor = new TypeProcessor(program.getTypeChecker(), diagnosticEngine); - const results = processor.processTypeDeclarations(program, filePath); + const { content: swiftOutput, hasAny } = processor.processTypeDeclarations(program, filePath); - // Write results to file or stdout - const jsonOutput = JSON.stringify(results, null, 2); if (options.values.output) { - fs.writeFileSync(options.values.output, jsonOutput); + if (hasAny) { + fs.mkdirSync(path.dirname(options.values.output), { recursive: true }); + fs.writeFileSync(options.values.output, swiftOutput); + } } else { - process.stdout.write(jsonOutput, "utf-8"); + process.stdout.write(swiftOutput, "utf-8"); } } diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/index.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/index.d.ts similarity index 100% rename from Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/index.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/index.d.ts diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js similarity index 51% rename from Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/processor.js rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index cdcff719d..a7855797b 100644 --- a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -5,14 +5,10 @@ // @ts-check import ts from 'typescript'; +import path from 'path'; -/** @typedef {import('./index').ImportSkeleton} ImportSkeleton */ -/** @typedef {import('./index').ImportFunctionSkeleton} ImportFunctionSkeleton */ -/** @typedef {import('./index').ImportTypeSkeleton} ImportTypeSkeleton */ -/** @typedef {import('./index').ImportPropertySkeleton} ImportPropertySkeleton */ -/** @typedef {import('./index').ImportConstructorSkeleton} ImportConstructorSkeleton */ -/** @typedef {import('./index').Parameter} Parameter */ -/** @typedef {import('./index').BridgeType} BridgeType */ +/** @typedef {import('./index.d.ts').Parameter} Parameter */ +/** @typedef {import('./index.d.ts').BridgeType} BridgeType */ /** * @typedef {{ @@ -57,21 +53,33 @@ export class TypeProcessor { this.processedTypes = new Map(); /** @type {Map} Seen position by type */ this.seenTypes = new Map(); - /** @type {ImportFunctionSkeleton[]} */ - this.functions = []; - /** @type {ImportTypeSkeleton[]} */ - this.types = []; + /** @type {string[]} Collected Swift code lines */ + this.swiftLines = []; } /** - * Process type declarations from a TypeScript program + * Process type declarations from a TypeScript program and render Swift code * @param {ts.Program} program - TypeScript program * @param {string} inputFilePath - Path to the input file - * @returns {ImportSkeleton} Processed type declarations + * @returns {{ content: string, hasAny: boolean }} Rendered Swift code */ processTypeDeclarations(program, inputFilePath) { - const sourceFiles = program.getSourceFiles().filter( - sf => !sf.isDeclarationFile || sf.fileName === inputFilePath + const normalizedInput = path.resolve(inputFilePath); + const sourceFiles = program.getSourceFiles().filter(sf => { + if (!sf.isDeclarationFile) return true; + return path.resolve(sf.fileName) === normalizedInput; + }); + + // Add prelude + this.swiftLines.push( + "// 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`.", + "", + "import JavaScriptKit", + "" ); for (const sourceFile of sourceFiles) { @@ -88,10 +96,7 @@ export class TypeProcessor { const typeString = this.checker.typeToString(type); const members = type.getProperties(); if (members) { - const type = this.visitStructuredType(typeString, members); - this.types.push(type); - } else { - this.types.push(this.createUnknownType(typeString)); + this.visitStructuredType(typeString, members); } } }); @@ -100,23 +105,11 @@ export class TypeProcessor { } } - return { functions: this.functions, types: this.types }; + const content = this.swiftLines.join("\n").trimEnd() + "\n"; + const hasAny = this.swiftLines.length > 9; // More than just the prelude + return { content, hasAny }; } - /** - * Create an unknown type - * @param {string} typeString - Type string - * @returns {ImportTypeSkeleton} Unknown type - */ - createUnknownType(typeString) { - return { - name: typeString, - documentation: undefined, - properties: [], - methods: [], - constructor: undefined, - }; - } /** * Visit a node and process it @@ -124,50 +117,34 @@ export class TypeProcessor { */ visitNode(node) { if (ts.isFunctionDeclaration(node)) { - const func = this.visitFunctionLikeDecl(node); - if (func && node.name) { - this.functions.push({ ...func, name: node.name.getText() }); - } + this.visitFunctionDeclaration(node); } else if (ts.isClassDeclaration(node)) { - const cls = this.visitClassDecl(node); - if (cls) this.types.push(cls); + this.visitClassDecl(node); } } /** - * Process a function declaration into ImportFunctionSkeleton format - * @param {ts.SignatureDeclaration} node - The function node - * @returns {ImportFunctionSkeleton | null} Processed function + * Visit a function declaration and render Swift code + * @param {ts.FunctionDeclaration} node - The function node * @private */ - visitFunctionLikeDecl(node) { - if (!node.name) return null; + visitFunctionDeclaration(node) { + if (!node.name) return; const name = node.name.getText(); if (!isValidSwiftDeclName(name)) { - return null; + return; } const signature = this.checker.getSignatureFromDeclaration(node); - if (!signature) return null; - - /** @type {Parameter[]} */ - const parameters = []; - for (const p of signature.getParameters()) { - const bridgeType = this.visitSignatureParameter(p, node); - parameters.push(bridgeType); - } - - const returnType = signature.getReturnType(); - const bridgeReturnType = this.visitType(returnType, node); - const documentation = this.getFullJSDocText(node); - - return { - name, - parameters, - returnType: bridgeReturnType, - documentation, - effects: { isAsync: false }, - }; + if (!signature) return; + + const params = this.renderParameters(signature.getParameters(), node); + const returnType = this.renderBridgeType(this.visitType(signature.getReturnType(), node), node); + const effects = this.renderEffects({ isAsync: false }); + const swiftName = this.renderIdentifier(name); + + this.swiftLines.push(`@JSFunction func ${swiftName}(${params}) ${effects} -> ${returnType}`); + this.swiftLines.push(""); } /** @@ -188,25 +165,21 @@ export class TypeProcessor { } /** + * Render constructor parameters * @param {ts.ConstructorDeclaration} node - * @returns {ImportConstructorSkeleton | null} + * @returns {string} Rendered parameters + * @private */ - visitConstructorDecl(node) { + renderConstructorParameters(node) { const signature = this.checker.getSignatureFromDeclaration(node); - if (!signature) return null; - - const parameters = []; - for (const p of signature.getParameters()) { - const bridgeType = this.visitSignatureParameter(p, node); - parameters.push(bridgeType); - } + if (!signature) return ""; - return { parameters }; + return this.renderParameters(signature.getParameters(), node); } /** * @param {ts.PropertyDeclaration | ts.PropertySignature} node - * @returns {ImportPropertySkeleton | null} + * @returns {{ name: string, type: BridgeType, isReadonly: boolean, documentation: string | undefined } | null} */ visitPropertyDecl(node) { if (!node.name) return null; @@ -235,39 +208,29 @@ export class TypeProcessor { } /** + * Visit a class declaration and render Swift code * @param {ts.ClassDeclaration} node - * @returns {ImportTypeSkeleton | null} + * @private */ visitClassDecl(node) { - if (!node.name) return null; + if (!node.name) return; - const name = node.name.text; - const properties = []; - const methods = []; - /** @type {ImportConstructorSkeleton | undefined} */ - let constructor = undefined; + const className = this.renderIdentifier(node.name.text); + this.swiftLines.push(`@JSClass struct ${className}: _JSBridgedClass {`); + // Process members in declaration order for (const member of node.members) { if (ts.isPropertyDeclaration(member)) { - const property = this.visitPropertyDecl(member); - if (property) properties.push(property); + this.renderProperty(member); } else if (ts.isMethodDeclaration(member)) { - const decl = this.visitFunctionLikeDecl(member); - if (decl) methods.push(decl); + this.renderMethod(member); } else if (ts.isConstructorDeclaration(member)) { - const decl = this.visitConstructorDecl(member); - if (decl) constructor = decl; + this.renderConstructor(member); } } - const documentation = this.getFullJSDocText(node); - return { - name, - constructor, - properties, - methods, - documentation, - }; + this.swiftLines.push("}"); + this.swiftLines.push(""); } /** @@ -301,47 +264,51 @@ export class TypeProcessor { } /** + * Visit a structured type (interface) and render Swift code * @param {string} name * @param {ts.Symbol[]} members - * @returns {ImportTypeSkeleton} + * @private */ visitStructuredType(name, members) { - /** @type {ImportPropertySkeleton[]} */ - const properties = []; - /** @type {ImportFunctionSkeleton[]} */ - const methods = []; - /** @type {ImportConstructorSkeleton | undefined} */ - let constructor = undefined; + const typeName = this.renderIdentifier(name); + this.swiftLines.push(`@JSClass struct ${typeName}: _JSBridgedClass {`); + + // Collect all declarations with their positions to preserve order + /** @type {Array<{ decl: ts.Node, symbol: ts.Symbol, position: number }>} */ + const allDecls = []; + for (const symbol of members) { + for (const decl of symbol.getDeclarations() ?? []) { + const sourceFile = decl.getSourceFile(); + const pos = sourceFile ? decl.getStart() : 0; + allDecls.push({ decl, symbol, position: pos }); + } + } + + // Sort by position to preserve declaration order + allDecls.sort((a, b) => a.position - b.position); + + // Process declarations in order + for (const { decl, symbol } of allDecls) { if (symbol.flags & ts.SymbolFlags.Property) { - for (const decl of symbol.getDeclarations() ?? []) { - if (ts.isPropertyDeclaration(decl) || ts.isPropertySignature(decl)) { - const property = this.visitPropertyDecl(decl); - if (property) properties.push(property); - } else if (ts.isMethodSignature(decl)) { - const method = this.visitFunctionLikeDecl(decl); - if (method) methods.push(method); - } + if (ts.isPropertyDeclaration(decl) || ts.isPropertySignature(decl)) { + this.renderProperty(decl); + } else if (ts.isMethodSignature(decl)) { + this.renderMethodSignature(decl); } } else if (symbol.flags & ts.SymbolFlags.Method) { - for (const decl of symbol.getDeclarations() ?? []) { - if (!ts.isMethodSignature(decl)) { - continue; - } - const method = this.visitFunctionLikeDecl(decl); - if (method) methods.push(method); + if (ts.isMethodSignature(decl)) { + this.renderMethodSignature(decl); } } else if (symbol.flags & ts.SymbolFlags.Constructor) { - for (const decl of symbol.getDeclarations() ?? []) { - if (!ts.isConstructorDeclaration(decl)) { - continue; - } - const ctor = this.visitConstructorDecl(decl); - if (ctor) constructor = ctor; + if (ts.isConstructorDeclaration(decl)) { + this.renderConstructor(decl); } } } - return { name, properties, methods, constructor, documentation: undefined }; + + this.swiftLines.push("}"); + this.swiftLines.push(""); } /** @@ -431,6 +398,160 @@ export class TypeProcessor { } return undefined; } + + /** + * Render a property declaration + * @param {ts.PropertyDeclaration | ts.PropertySignature} node + * @private + */ + renderProperty(node) { + const property = this.visitPropertyDecl(node); + if (!property) return; + + const type = this.renderBridgeType(property.type, node); + const name = this.renderIdentifier(property.name); + + // Always render getter + this.swiftLines.push(` @JSGetter var ${name}: ${type}`); + + // Render setter if not readonly + if (!property.isReadonly) { + const capitalizedName = property.name.charAt(0).toUpperCase() + property.name.slice(1); + const needsJSNameField = property.name.charAt(0) != capitalizedName.charAt(0).toLowerCase(); + const setterName = `set${capitalizedName}`; + const annotation = needsJSNameField ? `@JSSetter(jsName: "${property.name}")` : "@JSSetter"; + this.swiftLines.push(` ${annotation} func ${this.renderIdentifier(setterName)}(_ value: ${type}) ${this.renderEffects({ isAsync: false })}`); + } + } + + /** + * Render a method declaration + * @param {ts.MethodDeclaration | ts.MethodSignature} node + * @private + */ + renderMethod(node) { + if (!node.name) return; + const name = node.name.getText(); + if (!isValidSwiftDeclName(name)) return; + + const signature = this.checker.getSignatureFromDeclaration(node); + if (!signature) return; + + const params = this.renderParameters(signature.getParameters(), node); + const returnType = this.renderBridgeType(this.visitType(signature.getReturnType(), node), node); + const effects = this.renderEffects({ isAsync: false }); + const swiftName = this.renderIdentifier(name); + + this.swiftLines.push(` @JSFunction func ${swiftName}(${params}) ${effects} -> ${returnType}`); + } + + /** + * Render a method signature (from interface) + * @param {ts.MethodSignature} node + * @private + */ + renderMethodSignature(node) { + this.renderMethod(node); + } + + /** + * Render a constructor declaration + * @param {ts.ConstructorDeclaration} node + * @private + */ + renderConstructor(node) { + const params = this.renderConstructorParameters(node); + const effects = this.renderEffects({ isAsync: false }); + this.swiftLines.push(` @JSFunction init(${params}) ${effects}`); + } + + /** + * Render function parameters + * @param {ts.Symbol[]} parameters + * @param {ts.Node} node + * @returns {string} + * @private + */ + renderParameters(parameters, node) { + const params = []; + for (const p of parameters) { + const bridgeType = this.visitSignatureParameter(p, node); + const paramName = this.renderIdentifier(p.name); + const type = this.renderBridgeType(bridgeType.type, node); + params.push(`_ ${paramName}: ${type}`); + } + return params.join(", "); + } + + /** + * Render bridge type to Swift type + * @param {BridgeType} bridgeType + * @param {ts.Node} node + * @returns {string} + * @private + */ + renderBridgeType(bridgeType, node) { + if ("int" in bridgeType) return "Int"; + if ("float" in bridgeType) return "Float"; + if ("double" in bridgeType) return "Double"; + if ("string" in bridgeType) return "String"; + if ("bool" in bridgeType) return "Bool"; + if ("void" in bridgeType) return "Void"; + if ("jsObject" in bridgeType) { + const name = "_0" in bridgeType.jsObject ? bridgeType.jsObject._0 : undefined; + return name ? this.renderIdentifier(name) : "JSObject"; + } + return "JSObject"; + } + + /** + * Render effects (async/throws) + * @param {{ isAsync: boolean }} effects + * @returns {string} + * @private + */ + renderEffects(effects) { + const parts = []; + if (effects?.isAsync) { + parts.push("async"); + } + parts.push("throws (JSException)"); + return parts.join(" "); + } + + /** + * Render identifier with backticks if needed + * @param {string} name + * @returns {string} + * @private + */ + renderIdentifier(name) { + if (!name) return name; + if (!isValidSwiftDeclName(name) || isSwiftKeyword(name)) { + return `\`${name}\``; + } + return name; + } +} + + +const SWIFT_KEYWORDS = new Set([ + "associatedtype", "class", "deinit", "enum", "extension", "fileprivate", + "func", "import", "init", "inout", "internal", "let", "open", "operator", + "private", "protocol", "public", "static", "struct", "subscript", "typealias", + "var", "break", "case", "continue", "default", "defer", "do", "else", + "fallthrough", "for", "guard", "if", "in", "repeat", "return", "switch", + "where", "while", "as", "Any", "catch", "false", "is", "nil", "rethrows", + "super", "self", "Self", "throw", "throws", "true", "try", + "prefix", "postfix", "infix" // Contextual keywords for operator declarations +]); + +/** + * @param {string} name + * @returns {boolean} + */ +function isSwiftKeyword(name) { + return SWIFT_KEYWORDS.has(name); } /** diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/TS2Skeleton.swift b/Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift similarity index 65% rename from Plugins/BridgeJS/Sources/TS2Skeleton/TS2Skeleton.swift rename to Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift index c7725faf8..0a69eb702 100644 --- a/Plugins/BridgeJS/Sources/TS2Skeleton/TS2Skeleton.swift +++ b/Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift @@ -1,4 +1,3 @@ -@preconcurrency import class Foundation.JSONDecoder @preconcurrency import class Foundation.Process @preconcurrency import class Foundation.Pipe @preconcurrency import class Foundation.ProcessInfo @@ -11,6 +10,8 @@ @preconcurrency import var Foundation.SIGTERM import protocol Dispatch.DispatchSourceSignal import class Dispatch.DispatchSource +import SwiftParser +import SwiftSyntax #if canImport(BridgeJSCore) import BridgeJSCore @@ -76,48 +77,57 @@ extension BridgeJSConfig { } } -extension ImportTS { - /// Processes a TypeScript definition file and extracts its API information - public mutating func addSourceFile( - _ sourceFile: String, - tsconfigPath: String, - nodePath: URL - ) throws { - let ts2skeletonPath = URL(fileURLWithPath: #filePath) - .deletingLastPathComponent() - .appendingPathComponent("JavaScript") - .appendingPathComponent("bin") - .appendingPathComponent("ts2skeleton.js") - let arguments = [ts2skeletonPath.path, sourceFile, "--project", tsconfigPath] +/// Invokes ts2swift to convert TypeScript definitions to macro-annotated Swift +/// - Parameters: +/// - dtsFile: Path to the TypeScript definition file +/// - tsconfigPath: Path to the TypeScript project configuration file +/// - nodePath: Path to the node executable +/// - progress: Progress reporting instance +/// - outputPath: Optional path to write the output file. If nil, output is collected from stdout (for testing) +/// - Returns: The generated Swift source code (always collected from stdout for return value) +public func invokeTS2Swift( + dtsFile: String, + tsconfigPath: String, + nodePath: URL, + progress: ProgressReporting, + outputPath: String? = nil +) throws -> String { + let ts2swiftPath = URL(fileURLWithPath: #filePath) + .deletingLastPathComponent() + .appendingPathComponent("JavaScript") + .appendingPathComponent("bin") + .appendingPathComponent("ts2swift.js") + var arguments = [ts2swiftPath.path, dtsFile, "--project", tsconfigPath] + if let outputPath = outputPath { + arguments.append(contentsOf: ["--output", outputPath]) + } - progress.print("Running ts2skeleton...") - progress.print(" \(([nodePath.path] + arguments).joined(separator: " "))") + progress.print("Running ts2swift...") + progress.print(" \(([nodePath.path] + arguments).joined(separator: " "))") - let process = Process() - let stdoutPipe = Pipe() - nonisolated(unsafe) var stdoutData = Data() + let process = Process() + let stdoutPipe = Pipe() + nonisolated(unsafe) var stdoutData = Data() - process.executableURL = nodePath - process.arguments = arguments - process.standardOutput = stdoutPipe + process.executableURL = nodePath + process.arguments = arguments + process.standardOutput = stdoutPipe - stdoutPipe.fileHandleForReading.readabilityHandler = { handle in - let data = handle.availableData - if data.count > 0 { - stdoutData.append(data) - } - } - try process.forwardTerminationSignals { - try process.run() - process.waitUntilExit() + stdoutPipe.fileHandleForReading.readabilityHandler = { handle in + let data = handle.availableData + if data.count > 0 { + stdoutData.append(data) } + } + try process.forwardTerminationSignals { + try process.run() + process.waitUntilExit() + } - if process.terminationStatus != 0 { - throw BridgeJSCoreError("ts2skeleton returned \(process.terminationStatus)") - } - let skeleton = try JSONDecoder().decode(ImportedFileSkeleton.self, from: stdoutData) - self.addSkeleton(skeleton) + if process.terminationStatus != 0 { + throw BridgeJSCoreError("ts2swift returned \(process.terminationStatus)") } + return String(decoding: stdoutData, as: UTF8.self) } extension Foundation.Process { diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift new file mode 100644 index 000000000..5997d3052 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift @@ -0,0 +1,289 @@ +import SwiftDiagnostics +import SwiftSyntax +import SwiftSyntaxMacros +import SwiftSyntaxMacrosTestSupport +import Testing +import BridgeJSMacros + +@Suite struct JSClassMacroTests { + private let indentationWidth: Trivia = .spaces(4) + + @Test func emptyStruct() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithExistingJSObject() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + let jsObject: JSObject + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithExistingInit() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithBothExisting() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithMembers() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + var name: String + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + var name: String + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func _class() { + assertMacroExpansion( + """ + @JSClass + class MyClass { + } + """, + expandedSource: """ + class MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func _enum() { + assertMacroExpansion( + """ + @JSClass + enum MyEnum { + } + """, + expandedSource: """ + enum MyEnum { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func _actor() { + assertMacroExpansion( + """ + @JSClass + actor MyActor { + } + """, + expandedSource: """ + actor MyActor { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithDifferentJSObjectName() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + var otherProperty: String + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + var otherProperty: String + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithDifferentInit() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + init(name: String) { + } + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + init(name: String) { + } + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithMultipleMembers() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + var name: String + var age: Int + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + var name: String + var age: Int + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithComment() { + assertMacroExpansion( + """ + /// Documentation comment + @JSClass + struct MyClass { + } + """, + expandedSource: """ + /// Documentation comment + struct MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift new file mode 100644 index 000000000..8cfdd66e0 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift @@ -0,0 +1,377 @@ +import SwiftDiagnostics +import SwiftSyntax +import SwiftSyntaxMacros +import SwiftSyntaxMacrosTestSupport +import Testing +import BridgeJSMacros + +@Suite struct JSFunctionMacroTests { + private let indentationWidth: Trivia = .spaces(4) + + @Test func topLevelFunction() { + assertMacroExpansion( + """ + @JSFunction + func greet(name: String) -> String + """, + expandedSource: """ + func greet(name: String) -> String { + return _$greet(name) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionVoidReturn() { + assertMacroExpansion( + """ + @JSFunction + func log(message: String) + """, + expandedSource: """ + func log(message: String) { + _$log(message) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionWithExplicitVoidReturn() { + assertMacroExpansion( + """ + @JSFunction + func log(message: String) -> Void + """, + expandedSource: """ + func log(message: String) -> Void { + _$log(message) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionWithEmptyTupleReturn() { + assertMacroExpansion( + """ + @JSFunction + func log(message: String) -> () + """, + expandedSource: """ + func log(message: String) -> () { + _$log(message) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionThrows() { + assertMacroExpansion( + """ + @JSFunction + func parse(json: String) throws -> [String: Any] + """, + expandedSource: """ + func parse(json: String) throws -> [String: Any] { + return try _$parse(json) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionAsync() { + assertMacroExpansion( + """ + @JSFunction + func fetch(url: String) async -> String + """, + expandedSource: """ + func fetch(url: String) async -> String { + return await _$fetch(url) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionAsyncThrows() { + assertMacroExpansion( + """ + @JSFunction + func fetch(url: String) async throws -> String + """, + expandedSource: """ + func fetch(url: String) async throws -> String { + return try await _$fetch(url) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionWithUnderscoreParameter() { + assertMacroExpansion( + """ + @JSFunction + func process(_ value: Int) -> Int + """, + expandedSource: """ + func process(_ value: Int) -> Int { + return _$process(value) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionWithMultipleParameters() { + assertMacroExpansion( + """ + @JSFunction + func add(a: Int, b: Int) -> Int + """, + expandedSource: """ + func add(a: Int, b: Int) -> Int { + return _$add(a, b) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func instanceMethod() { + assertMacroExpansion( + """ + struct MyClass { + @JSFunction + func getName() -> String + } + """, + expandedSource: """ + struct MyClass { + func getName() -> String { + return _$MyClass_getName(self.jsObject) + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func staticMethod() { + assertMacroExpansion( + """ + struct MyClass { + @JSFunction + static func create() -> MyClass + } + """, + expandedSource: """ + struct MyClass { + static func create() -> MyClass { + return _$create() + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func classMethod() { + assertMacroExpansion( + """ + class MyClass { + @JSFunction + class func create() -> MyClass + } + """, + expandedSource: """ + class MyClass { + class func create() -> MyClass { + return _$create() + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func initializer() { + assertMacroExpansion( + """ + struct MyClass { + @JSFunction + init(name: String) + } + """, + expandedSource: """ + struct MyClass { + init(name: String) { + let jsObject = _$MyClass_init(name) + self.init(unsafelyWrapping: jsObject) + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func initializerThrows() { + assertMacroExpansion( + """ + struct MyClass { + @JSFunction + init(name: String) throws + } + """, + expandedSource: """ + struct MyClass { + init(name: String) throws { + let jsObject = try _$MyClass_init(name) + self.init(unsafelyWrapping: jsObject) + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func initializerAsyncThrows() { + assertMacroExpansion( + """ + struct MyClass { + @JSFunction + init(name: String) async throws + } + """, + expandedSource: """ + struct MyClass { + init(name: String) async throws { + let jsObject = try await _$MyClass_init(name) + self.init(unsafelyWrapping: jsObject) + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func initializerWithoutEnclosingType() { + assertMacroExpansion( + """ + @JSFunction + init() + """, + expandedSource: """ + init() + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSFunction can only be applied to functions or initializers.", + line: 1, + column: 1 + ) + ], + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func unsupportedDeclaration() { + assertMacroExpansion( + """ + @JSFunction + var property: String + """, + expandedSource: """ + var property: String + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSFunction can only be applied to functions or initializers.", + line: 1, + column: 1 + ) + ], + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func enumInstanceMethod() { + assertMacroExpansion( + """ + enum MyEnum { + @JSFunction + func getValue() -> Int + } + """, + expandedSource: """ + enum MyEnum { + func getValue() -> Int { + return _$MyEnum_getValue(self.jsObject) + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func actorInstanceMethod() { + assertMacroExpansion( + """ + actor MyActor { + @JSFunction + func getValue() -> Int + } + """, + expandedSource: """ + actor MyActor { + func getValue() -> Int { + return _$MyActor_getValue(self.jsObject) + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func functionWithExistingBody() { + assertMacroExpansion( + """ + @JSFunction + func greet(name: String) -> String { + return "Hello, \\(name)" + } + """, + expandedSource: """ + func greet(name: String) -> String { + return _$greet(name) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift new file mode 100644 index 000000000..8c7f3c119 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift @@ -0,0 +1,299 @@ +import SwiftDiagnostics +import SwiftSyntax +import SwiftSyntaxMacros +import SwiftSyntaxMacrosTestSupport +import Testing +import BridgeJSMacros + +@Suite struct JSGetterMacroTests { + private let indentationWidth: Trivia = .spaces(4) + + @Test func topLevelVariable() { + assertMacroExpansion( + """ + @JSGetter + var count: Int + """, + expandedSource: """ + var count: Int { + get throws(JSException) { + return try _$count_get() + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelLet() { + assertMacroExpansion( + """ + @JSGetter + let constant: String + """, + expandedSource: """ + let constant: String { + get throws(JSException) { + return try _$constant_get() + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func instanceProperty() { + assertMacroExpansion( + """ + struct MyClass { + @JSGetter + var name: String + } + """, + expandedSource: """ + struct MyClass { + var name: String { + get throws(JSException) { + return try _$MyClass_name_get(self.jsObject) + } + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func instanceLetProperty() { + assertMacroExpansion( + """ + struct MyClass { + @JSGetter + let id: Int + } + """, + expandedSource: """ + struct MyClass { + let id: Int { + get throws(JSException) { + return try _$MyClass_id_get(self.jsObject) + } + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func staticProperty() { + assertMacroExpansion( + """ + struct MyClass { + @JSGetter + static var version: String + } + """, + expandedSource: """ + struct MyClass { + static var version: String { + get throws(JSException) { + return try _$version_get() + } + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func classProperty() { + assertMacroExpansion( + """ + class MyClass { + @JSGetter + class var version: String + } + """, + expandedSource: """ + class MyClass { + class var version: String { + get throws(JSException) { + return try _$version_get() + } + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func enumProperty() { + assertMacroExpansion( + """ + enum MyEnum { + @JSGetter + var value: Int + } + """, + expandedSource: """ + enum MyEnum { + var value: Int { + get throws(JSException) { + return try _$MyEnum_value_get(self.jsObject) + } + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func actorProperty() { + assertMacroExpansion( + """ + actor MyActor { + @JSGetter + var state: String + } + """, + expandedSource: """ + actor MyActor { + var state: String { + get throws(JSException) { + return try _$MyActor_state_get(self.jsObject) + } + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func variableWithExistingAccessor() { + assertMacroExpansion( + """ + @JSGetter + var count: Int { + return 0 + } + """, + expandedSource: """ + var count: Int { + get { + return 0 + } + get throws(JSException) { + return try _$count_get() + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func variableWithInitializer() { + assertMacroExpansion( + """ + @JSGetter + var count: Int = 0 + """, + expandedSource: """ + var count: Int { + get throws(JSException) { + return try _$count_get() + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func multipleBindings() { + assertMacroExpansion( + """ + @JSGetter + var x: Int, y: Int + """, + expandedSource: """ + var x: Int, y: Int + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSGetter can only be applied to single-variable declarations.", + line: 1, + column: 1, + severity: .error + ) + ], + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func unsupportedDeclaration() { + assertMacroExpansion( + """ + @JSGetter + func test() {} + """, + expandedSource: """ + func test() {} + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSGetter can only be applied to single-variable declarations.", + line: 1, + column: 1, + severity: .error + ) + ], + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func variableWithTrailingComment() { + assertMacroExpansion( + """ + @JSGetter + var count: Int // comment + """, + expandedSource: """ + var count: Int { // comment + get throws(JSException) { + return try _$count_get() + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func variableWithUnderscoreName() { + assertMacroExpansion( + """ + @JSGetter + var _internal: String + """, + expandedSource: """ + var _internal: String { + get throws(JSException) { + return try _$internal_get() + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift new file mode 100644 index 000000000..83289e092 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift @@ -0,0 +1,278 @@ +import SwiftDiagnostics +import SwiftSyntax +import SwiftSyntaxMacros +import SwiftSyntaxMacrosTestSupport +import Testing +import BridgeJSMacros + +@Suite struct JSSetterMacroTests { + private let indentationWidth: Trivia = .spaces(4) + + @Test func topLevelSetter() { + assertMacroExpansion( + """ + @JSSetter + func setFoo(_ value: Foo) throws(JSException) + """, + expandedSource: """ + func setFoo(_ value: Foo) throws(JSException) { + try _$foo_set(value) + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelSetterWithNamedParameter() { + assertMacroExpansion( + """ + @JSSetter + func setCount(count: Int) throws(JSException) + """, + expandedSource: """ + func setCount(count: Int) throws(JSException) { + try _$count_set(count) + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func instanceSetter() { + assertMacroExpansion( + """ + struct MyClass { + @JSSetter + func setName(_ name: String) throws(JSException) + } + """, + expandedSource: """ + struct MyClass { + func setName(_ name: String) throws(JSException) { + try _$MyClass_name_set(self.jsObject, name) + } + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func staticSetter() { + assertMacroExpansion( + """ + struct MyClass { + @JSSetter + static func setVersion(_ version: String) throws(JSException) + } + """, + expandedSource: """ + struct MyClass { + static func setVersion(_ version: String) throws(JSException) { + try _$version_set(version) + } + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func classSetter() { + assertMacroExpansion( + """ + class MyClass { + @JSSetter + class func setConfig(_ config: Config) throws(JSException) + } + """, + expandedSource: """ + class MyClass { + class func setConfig(_ config: Config) throws(JSException) { + try _$config_set(config) + } + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func enumSetter() { + assertMacroExpansion( + """ + enum MyEnum { + @JSSetter + func setValue(_ value: Int) throws(JSException) + } + """, + expandedSource: """ + enum MyEnum { + func setValue(_ value: Int) throws(JSException) { + try _$MyEnum_value_set(self.jsObject, value) + } + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func actorSetter() { + assertMacroExpansion( + """ + actor MyActor { + @JSSetter + func setState(_ state: String) throws(JSException) + } + """, + expandedSource: """ + actor MyActor { + func setState(_ state: String) throws(JSException) { + try _$MyActor_state_set(self.jsObject, state) + } + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func setterWithExistingBody() { + assertMacroExpansion( + """ + @JSSetter + func setFoo(_ value: Foo) throws(JSException) { + print("Setting foo") + } + """, + expandedSource: """ + func setFoo(_ value: Foo) throws(JSException) { + try _$foo_set(value) + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func invalidSetterName() { + assertMacroExpansion( + """ + @JSSetter + func updateFoo(_ value: Foo) throws(JSException) + """, + expandedSource: """ + func updateFoo(_ value: Foo) throws(JSException) + """, + diagnostics: [ + DiagnosticSpec( + message: + "@JSSetter function name must start with 'set' followed by a property name (e.g., 'setFoo').", + line: 1, + column: 1 + ) + ], + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func setterNameTooShort() { + assertMacroExpansion( + """ + @JSSetter + func set(_ value: Foo) throws(JSException) + """, + expandedSource: """ + func set(_ value: Foo) throws(JSException) + """, + diagnostics: [ + DiagnosticSpec( + message: + "@JSSetter function name must start with 'set' followed by a property name (e.g., 'setFoo').", + line: 1, + column: 1 + ) + ], + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func setterWithoutParameter() { + assertMacroExpansion( + """ + @JSSetter + func setFoo() throws(JSException) + """, + expandedSource: """ + func setFoo() throws(JSException) + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSSetter function must have at least one parameter.", + line: 1, + column: 1 + ) + ], + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func unsupportedDeclaration() { + assertMacroExpansion( + """ + @JSSetter + var property: String + """, + expandedSource: """ + var property: String + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSSetter can only be applied to functions.", + line: 1, + column: 1 + ) + ], + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func setterWithMultipleWords() { + assertMacroExpansion( + """ + @JSSetter + func setConnectionTimeout(_ timeout: Int) throws(JSException) + """, + expandedSource: """ + func setConnectionTimeout(_ timeout: Int) throws(JSException) { + try _$connectionTimeout_set(timeout) + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func setterWithSingleLetterProperty() { + assertMacroExpansion( + """ + @JSSetter + func setX(_ x: Int) throws(JSException) + """, + expandedSource: """ + func setX(_ x: Int) throws(JSException) { + try _$x_set(x) + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift index c81a224f8..89f346d2a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift @@ -4,7 +4,8 @@ import SwiftParser import Testing @testable import BridgeJSLink @testable import BridgeJSCore -@testable import TS2Skeleton +@testable import TS2Swift +@testable import BridgeJSSkeleton @Suite struct BridgeJSLinkTests { private func snapshot( @@ -52,26 +53,51 @@ import Testing let name = url.deletingPathExtension().lastPathComponent let (_, outputSkeleton) = try #require(try swiftAPI.finalize()) - let bridgeJSLink: BridgeJSLink = BridgeJSLink(exportedSkeletons: [outputSkeleton], sharedMemory: false) + let bridgeJSLink: BridgeJSLink = BridgeJSLink( + skeletons: [ + BridgeJSSkeleton(moduleName: "TestModule", exported: outputSkeleton), + ], + sharedMemory: false + ) try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Export") } @Test(arguments: collectInputs(extension: ".d.ts")) func snapshotImport(input: String) throws { let url = Self.inputsDirectory.appendingPathComponent(input) + let name = url.deletingPathExtension().deletingPathExtension().lastPathComponent let tsconfigPath = url.deletingLastPathComponent().appendingPathComponent("tsconfig.json") - var importTS = ImportTS(progress: .silent, moduleName: "TestModule") let nodePath = try #require(which("node")) - try importTS.addSourceFile(url.path, tsconfigPath: tsconfigPath.path, nodePath: nodePath) - let name = url.deletingPathExtension().deletingPathExtension().lastPathComponent + let swiftSource = try invokeTS2Swift( + dtsFile: url.path, + tsconfigPath: tsconfigPath.path, + nodePath: nodePath, + progress: .silent + ) - let encoder = JSONEncoder() - encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - let outputSkeletonData = try encoder.encode(importTS.skeleton) + let sourceFile = Parser.parse(source: swiftSource) + let importSwift = ImportSwiftMacros(progress: .silent, moduleName: "TestModule") + importSwift.addSourceFile(sourceFile, "\(name).Macros.swift") + let importResult = try importSwift.finalize() + + var importTS = ImportTS(progress: .silent, moduleName: "TestModule") + for child in importResult.outputSkeleton.children { + importTS.addSkeleton(child) + } + let importSkeleton = importTS.skeleton var bridgeJSLink = BridgeJSLink(sharedMemory: false) - try bridgeJSLink.addImportedSkeletonFile(data: outputSkeletonData) + // Create unified skeleton for test + let unifiedSkeleton = BridgeJSSkeleton( + moduleName: "TestModule", + exported: nil, + imported: importSkeleton + ) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys] + let unifiedData = try encoder.encode(unifiedSkeleton) + try bridgeJSLink.addSkeletonFile(data: unifiedData) try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Import") } @@ -88,7 +114,12 @@ import Testing try swiftAPI.addSourceFile(sourceFile, inputFile) let name = url.deletingPathExtension().lastPathComponent let (_, outputSkeleton) = try #require(try swiftAPI.finalize()) - let bridgeJSLink: BridgeJSLink = BridgeJSLink(exportedSkeletons: [outputSkeleton], sharedMemory: false) + let bridgeJSLink: BridgeJSLink = BridgeJSLink( + skeletons: [ + BridgeJSSkeleton(moduleName: "TestModule", exported: outputSkeleton), + ], + sharedMemory: false + ) try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Global.Export") } @@ -107,7 +138,10 @@ import Testing let (_, privateSkeleton) = try #require(try privateAPI.finalize()) let bridgeJSLink = BridgeJSLink( - exportedSkeletons: [globalSkeleton, privateSkeleton], + skeletons: [ + BridgeJSSkeleton(moduleName: "GlobalModule", exported: globalSkeleton), + BridgeJSSkeleton(moduleName: "PrivateModule", exported: privateSkeleton), + ], sharedMemory: false ) try snapshot(bridgeJSLink: bridgeJSLink, name: "MixedModules.Export") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift index ef642ed3a..f56fbfb6d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift @@ -1,7 +1,8 @@ import Testing import Foundation +import SwiftParser @testable import BridgeJSCore -@testable import TS2Skeleton +@testable import TS2Swift @Suite struct ImportTSTests { static let inputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent().appendingPathComponent( @@ -16,13 +17,37 @@ import Foundation @Test(arguments: collectInputs()) func snapshot(input: String) throws { - var api = ImportTS(progress: .silent, moduleName: "Check") let url = Self.inputsDirectory.appendingPathComponent(input) + let name = url.deletingPathExtension().deletingPathExtension().deletingPathExtension().lastPathComponent let nodePath = try #require(which("node")) let tsconfigPath = url.deletingLastPathComponent().appendingPathComponent("tsconfig.json") - try api.addSourceFile(url.path, tsconfigPath: tsconfigPath.path, nodePath: nodePath) + + // Use the new workflow: invokeTS2Swift -> ImportSwiftMacros -> ImportTS + let swiftSource = try invokeTS2Swift( + dtsFile: url.path, + tsconfigPath: tsconfigPath.path, + nodePath: nodePath, + progress: .silent + ) + try assertSnapshot( + name: name + ".Macros", + filePath: #filePath, + function: #function, + input: swiftSource.data(using: .utf8)!, + fileExtension: "swift" + ) + + let sourceFile = Parser.parse(source: swiftSource) + let importSwift = ImportSwiftMacros(progress: .silent, moduleName: "Check") + importSwift.addSourceFile(sourceFile, "\(name).Macros.swift") + let importResult = try importSwift.finalize() + + var api = ImportTS(progress: .silent, moduleName: "Check") + for child in importResult.outputSkeleton.children { + api.addSkeleton(child) + } + let outputSwift = try #require(try api.finalize()) - let name = url.deletingPathExtension().deletingPathExtension().deletingPathExtension().lastPathComponent try assertSnapshot( name: name, filePath: #filePath, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/WhichTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/WhichTests.swift index 958d4d645..f82b3dfec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/WhichTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/WhichTests.swift @@ -1,6 +1,6 @@ import Testing import Foundation -@testable import TS2Skeleton +@testable import TS2Swift @testable import BridgeJSCore @Suite struct WhichTests { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index a71c8dd71..60435e569 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -237,43 +237,43 @@ export async function createInstantiator(options, swift) { setException(error); } } - TestModule["bjs_WeirdNaming_normalProperty_set"] = function bjs_WeirdNaming_normalProperty_set(self, newValue) { + TestModule["bjs_WeirdNaming_for_get"] = function bjs_WeirdNaming_for_get(self) { try { - const newValueObject = swift.memory.getObject(newValue); - swift.memory.release(newValue); - swift.memory.getObject(self).normalProperty = newValueObject; + let ret = swift.memory.getObject(self).for; + tmpRetBytes = textEncoder.encode(ret); + return tmpRetBytes.length; } catch (error) { setException(error); } } - TestModule["bjs_WeirdNaming_for_get"] = function bjs_WeirdNaming_for_get(self) { + TestModule["bjs_WeirdNaming_Any_get"] = function bjs_WeirdNaming_Any_get(self) { try { - let ret = swift.memory.getObject(self).for; + let ret = swift.memory.getObject(self).Any; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { setException(error); } } - TestModule["bjs_WeirdNaming_for_set"] = function bjs_WeirdNaming_for_set(self, newValue) { + TestModule["bjs_WeirdNaming_normalProperty_set"] = function bjs_WeirdNaming_normalProperty_set(self, newValue) { try { const newValueObject = swift.memory.getObject(newValue); swift.memory.release(newValue); - swift.memory.getObject(self).for = newValueObject; + swift.memory.getObject(self).normalProperty = newValueObject; } catch (error) { setException(error); } } - TestModule["bjs_WeirdNaming_Any_get"] = function bjs_WeirdNaming_Any_get(self) { + TestModule["bjs_WeirdNaming_for_set"] = function bjs_WeirdNaming_for_set(self, newValue) { try { - let ret = swift.memory.getObject(self).Any; - tmpRetBytes = textEncoder.encode(ret); - return tmpRetBytes.length; + const newValueObject = swift.memory.getObject(newValue); + swift.memory.release(newValue); + swift.memory.getObject(self).for = newValueObject; } catch (error) { setException(error); } } - TestModule["bjs_WeirdNaming_Any_set"] = function bjs_WeirdNaming_Any_set(self, newValue) { + TestModule["bjs_WeirdNaming_any_set"] = function bjs_WeirdNaming_any_set(self, newValue) { try { const newValueObject = swift.memory.getObject(newValue); swift.memory.release(newValue); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index 86edf39ab..40a3f4e3f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -244,7 +244,6 @@ export async function createInstantiator(options, swift) { swift.memory.getObject(self).connectionTimeout = newValue; } catch (error) { setException(error); - return 0 } } TestModule["bjs_DatabaseConnection_connect"] = function bjs_DatabaseConnection_connect(self, url) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index 0e2041822..6c44fd008 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -211,22 +211,22 @@ export async function createInstantiator(options, swift) { setException(error); } } - TestModule["bjs_Greeter_name_set"] = function bjs_Greeter_name_set(self, newValue) { + TestModule["bjs_Greeter_age_get"] = function bjs_Greeter_age_get(self) { try { - const newValueObject = swift.memory.getObject(newValue); - swift.memory.release(newValue); - swift.memory.getObject(self).name = newValueObject; + let ret = swift.memory.getObject(self).age; + return ret; } catch (error) { setException(error); + return 0 } } - TestModule["bjs_Greeter_age_get"] = function bjs_Greeter_age_get(self) { + TestModule["bjs_Greeter_name_set"] = function bjs_Greeter_name_set(self, newValue) { try { - let ret = swift.memory.getObject(self).age; - return ret; + const newValueObject = swift.memory.getObject(newValue); + swift.memory.release(newValue); + swift.memory.getObject(self).name = newValueObject; } catch (error) { setException(error); - return 0 } } TestModule["bjs_Greeter_greet"] = function bjs_Greeter_greet(self) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json index 4bb845587..77c5b3678 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json @@ -175,7 +175,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift index 08e384350..4c97553de 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_asyncReturnVoid") @_cdecl("bjs_asyncReturnVoid") public func _bjs_asyncReturnVoid() -> Int32 { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.json index faff44843..97def2060 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.json @@ -140,7 +140,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift index eef86b6d7..05437f540 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_standaloneFunction") @_cdecl("bjs_standaloneFunction") public func _bjs_standaloneFunction(_ b: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.json index a0caf3bc9..acfa4c9ef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.json @@ -140,7 +140,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift index 729520362..fa8e80cd8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_standaloneFunction") @_cdecl("bjs_standaloneFunction") public func _bjs_standaloneFunction(_ b: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.json index aa4242cd7..de5fb19b0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.json @@ -52,7 +52,6 @@ "functions" : [ ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift index 7504b289c..8d697f8ba 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_ClassA_linkedB_get") @_cdecl("bjs_ClassA_linkedB_get") public func _bjs_ClassA_linkedB_get(_ _self: UnsafeMutableRawPointer) -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.json index e6acc7f35..53a5f858c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.json @@ -52,7 +52,6 @@ "functions" : [ ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift index 04130f749..0a0396075 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_ClassB_init") @_cdecl("bjs_ClassB_init") public func _bjs_ClassB_init() -> UnsafeMutableRawPointer { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json index 7e614a324..1a013eed0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json @@ -730,7 +730,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index f624dc33c..d5e5bdc48 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -1,11 +1,3 @@ -// 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 - extension Status: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { return bridgeJSRawValue diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json index f7e57aabd..ab7fbfd9d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json @@ -835,7 +835,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift index 1a1bc9baf..13239108f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift @@ -1,11 +1,3 @@ -// 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 - extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json index 1f4d55046..ca6fabceb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json @@ -311,7 +311,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift index a513a22ab..06c3e1cd8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift @@ -1,11 +1,3 @@ -// 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 - extension Direction: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { return bridgeJSRawValue diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json index 98ded1fe8..42a084c44 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json @@ -406,7 +406,6 @@ "functions" : [ ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift index 66f8e22a6..9683b5307 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift @@ -1,11 +1,3 @@ -// 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 - extension Networking.API.Method: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { return bridgeJSRawValue diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json index 24afb4eb2..23bb06429 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json @@ -406,7 +406,6 @@ "functions" : [ ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift index 66f8e22a6..9683b5307 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift @@ -1,11 +1,3 @@ -// 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 - extension Networking.API.Method: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { return bridgeJSRawValue diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json index b7ea9cd17..078772ff2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json @@ -1489,7 +1489,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift index 5d88fce46..12fdeba04 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift @@ -1,11 +1,3 @@ -// 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 - extension Theme: _BridgedSwiftEnumNoPayload { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json index 995c3efcf..5409a400e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json @@ -67,7 +67,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift index 3e38fee4b..981e01be4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_GlobalAPI_globalFunction") @_cdecl("bjs_GlobalAPI_globalFunction") public func _bjs_GlobalAPI_globalFunction() -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json index c986a903f..bc58d985e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json @@ -67,7 +67,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift index 76a1a6c2a..1e9eae2bf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_PrivateAPI_privateFunction") @_cdecl("bjs_PrivateAPI_privateFunction") public func _bjs_PrivateAPI_privateFunction() -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json index a0b1efea2..eb11e983f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json @@ -173,7 +173,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift index 19fe8ea9f..cb19c6854 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_plainFunction") @_cdecl("bjs_plainFunction") public func _bjs_plainFunction() -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json index 2420d592e..914b7b894 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json @@ -173,7 +173,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift index 19fe8ea9f..cb19c6854 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_plainFunction") @_cdecl("bjs_plainFunction") public func _bjs_plainFunction() -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json index 64aaa295e..b3a4fc2c0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json @@ -690,7 +690,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift index f2f19f9af..88195f37d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_roundTripOptionalClass") @_cdecl("bjs_roundTripOptionalClass") public func _bjs_roundTripOptionalClass(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json index d9edf11c3..ab2539abf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json @@ -60,7 +60,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift index 4f906704f..bb3ea0fd8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_check") @_cdecl("bjs_check") public func _bjs_check(_ a: Int32, _ b: Float32, _ c: Float64, _ d: Int32) -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json index 79ce75dac..e63b4a242 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json @@ -76,7 +76,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift index 63e5f03c3..62b5826d3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_checkInt") @_cdecl("bjs_checkInt") public func _bjs_checkInt() -> Int32 { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json index aa5fcc86b..43d05d9fa 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json @@ -351,7 +351,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift index 96bde51e6..b5b3c8d9e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift @@ -1,11 +1,3 @@ -// 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 - @_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 { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json index c3107394e..b79a59d19 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json @@ -396,7 +396,6 @@ "functions" : [ ], - "moduleName" : "TestModule", "protocols" : [ { "methods" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index 318b908b5..735c225f1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -1,11 +1,3 @@ -// 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 - struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProtocolWrapper { let jsObject: JSObject diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json index 4e8d80d59..3b6937c30 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json @@ -327,7 +327,6 @@ "functions" : [ ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift index 8ea228dc5..8a5b56065 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift @@ -1,11 +1,3 @@ -// 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 - extension Calculator: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { return bridgeJSRawValue diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json index ab399f102..652465dff 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json @@ -327,7 +327,6 @@ "functions" : [ ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift index 8ea228dc5..8a5b56065 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift @@ -1,11 +1,3 @@ -// 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 - extension Calculator: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { return bridgeJSRawValue diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json index 472406ba9..4ec19f83c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json @@ -330,7 +330,6 @@ "functions" : [ ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift index 91577ebfc..6510fd89f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift @@ -1,11 +1,3 @@ -// 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 - extension PropertyEnum: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { return bridgeJSRawValue diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json index 6ef937981..0e8b2de22 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json @@ -330,7 +330,6 @@ "functions" : [ ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift index 91577ebfc..6510fd89f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift @@ -1,11 +1,3 @@ -// 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 - extension PropertyEnum: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { return bridgeJSRawValue diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json index b70151233..9116fd482 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json @@ -58,7 +58,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift index 6e32c00d3..d980f5bc6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_checkString") @_cdecl("bjs_checkString") public func _bjs_checkString(_ aBytes: Int32, _ aLength: Int32) -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json index 39ec8b7a3..01f9ca4b7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json @@ -25,7 +25,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.swift index 0475def5b..1c260ec55 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_checkString") @_cdecl("bjs_checkString") public func _bjs_checkString() -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json index df4975e11..b8f908c2d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json @@ -133,7 +133,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift index 652792106..216dfc684 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_takeGreeter") @_cdecl("bjs_takeGreeter") public func _bjs_takeGreeter(_ greeter: UnsafeMutableRawPointer) -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json index 20015ba25..27627407b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json @@ -1066,7 +1066,6 @@ "functions" : [ ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift index 2e57a8a56..7d0ae15da 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift @@ -1,11 +1,3 @@ -// 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_TestModule_10TestModule10HttpStatusO_Si") fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si(_ callback: Int32, _ param0: Int32) -> Int32 diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json index 498231bf0..c6e430edf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json @@ -86,7 +86,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift index f35fc3b02..a09d312d3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift @@ -1,11 +1,3 @@ -// 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 - extension DataPoint: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> DataPoint { let optFlag = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json index ef42dc6cf..ad47cbf0b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json @@ -25,7 +25,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.swift index 8b865b7d7..37f6d9c96 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_throwsSomething") @_cdecl("bjs_throwsSomething") public func _bjs_throwsSomething() -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json index c80650aff..b6b9c7bcb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json @@ -25,7 +25,6 @@ } } ], - "moduleName" : "TestModule", "protocols" : [ ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.swift index 15e91a0b8..d5bc03b15 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.swift @@ -1,11 +1,3 @@ -// 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 - @_expose(wasm, "bjs_check") @_cdecl("bjs_check") public func _bjs_check() -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift new file mode 100644 index 000000000..e5b2742ae --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift @@ -0,0 +1,13 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func checkArray(_ a: JSObject) throws (JSException) -> Void + +@JSFunction func checkArrayWithLength(_ a: JSObject, _ b: Double) throws (JSException) -> Void + +@JSFunction func checkArray(_ a: JSObject) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift index 56425b208..4e2cec8dc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift @@ -1,11 +1,3 @@ -// 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: "Check", name: "bjs_checkArray") fileprivate func bjs_checkArray(_ a: Int32) -> Void @@ -15,7 +7,7 @@ fileprivate func bjs_checkArray(_ a: Int32) -> Void { } #endif -func checkArray(_ a: JSObject) throws(JSException) -> Void { +func _$checkArray(_ a: JSObject) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() bjs_checkArray(aValue) if let error = _swift_js_take_exception() { @@ -32,7 +24,7 @@ fileprivate func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void { } #endif -func checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void { +func _$checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() let bValue = b.bridgeJSLowerParameter() bjs_checkArrayWithLength(aValue, bValue) @@ -50,7 +42,7 @@ fileprivate func bjs_checkArray(_ a: Int32) -> Void { } #endif -func checkArray(_ a: JSObject) throws(JSException) -> Void { +func _$checkArray(_ a: JSObject) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() bjs_checkArray(aValue) if let error = _swift_js_take_exception() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift new file mode 100644 index 000000000..1f16ba9f1 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift @@ -0,0 +1,21 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func asyncReturnVoid() throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripInt(_ v: Double) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripString(_ v: String) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripBool(_ v: Bool) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripFloat(_ v: Double) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripDouble(_ v: Double) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripJSObject(_ v: JSObject) throws (JSException) -> JSPromise diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift index 41a89ad2f..1cc954b0d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift @@ -1,11 +1,3 @@ -// 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: "Check", name: "bjs_asyncReturnVoid") fileprivate func bjs_asyncReturnVoid() -> Int32 @@ -15,7 +7,7 @@ fileprivate func bjs_asyncReturnVoid() -> Int32 { } #endif -func asyncReturnVoid() throws(JSException) -> JSPromise { +func _$asyncReturnVoid() throws(JSException) -> JSPromise { let ret = bjs_asyncReturnVoid() if let error = _swift_js_take_exception() { throw error @@ -32,7 +24,7 @@ fileprivate func bjs_asyncRoundTripInt(_ v: Float64) -> Int32 { } #endif -func asyncRoundTripInt(_ v: Double) throws(JSException) -> JSPromise { +func _$asyncRoundTripInt(_ v: Double) throws(JSException) -> JSPromise { let vValue = v.bridgeJSLowerParameter() let ret = bjs_asyncRoundTripInt(vValue) if let error = _swift_js_take_exception() { @@ -50,7 +42,7 @@ fileprivate func bjs_asyncRoundTripString(_ v: Int32) -> Int32 { } #endif -func asyncRoundTripString(_ v: String) throws(JSException) -> JSPromise { +func _$asyncRoundTripString(_ v: String) throws(JSException) -> JSPromise { let vValue = v.bridgeJSLowerParameter() let ret = bjs_asyncRoundTripString(vValue) if let error = _swift_js_take_exception() { @@ -68,7 +60,7 @@ fileprivate func bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { } #endif -func asyncRoundTripBool(_ v: Bool) throws(JSException) -> JSPromise { +func _$asyncRoundTripBool(_ v: Bool) throws(JSException) -> JSPromise { let vValue = v.bridgeJSLowerParameter() let ret = bjs_asyncRoundTripBool(vValue) if let error = _swift_js_take_exception() { @@ -86,7 +78,7 @@ fileprivate func bjs_asyncRoundTripFloat(_ v: Float64) -> Int32 { } #endif -func asyncRoundTripFloat(_ v: Double) throws(JSException) -> JSPromise { +func _$asyncRoundTripFloat(_ v: Double) throws(JSException) -> JSPromise { let vValue = v.bridgeJSLowerParameter() let ret = bjs_asyncRoundTripFloat(vValue) if let error = _swift_js_take_exception() { @@ -104,7 +96,7 @@ fileprivate func bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { } #endif -func asyncRoundTripDouble(_ v: Double) throws(JSException) -> JSPromise { +func _$asyncRoundTripDouble(_ v: Double) throws(JSException) -> JSPromise { let vValue = v.bridgeJSLowerParameter() let ret = bjs_asyncRoundTripDouble(vValue) if let error = _swift_js_take_exception() { @@ -122,7 +114,7 @@ fileprivate func bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { } #endif -func asyncRoundTripJSObject(_ v: JSObject) throws(JSException) -> JSPromise { +func _$asyncRoundTripJSObject(_ v: JSObject) throws(JSException) -> JSPromise { let vValue = v.bridgeJSLowerParameter() let ret = bjs_asyncRoundTripJSObject(vValue) if let error = _swift_js_take_exception() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift new file mode 100644 index 000000000..435d5011c --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift @@ -0,0 +1,14 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func returnAnimatable() throws (JSException) -> Animatable + +@JSClass struct Animatable: _JSBridgedClass { + @JSFunction func animate(_ keyframes: JSObject, _ options: JSObject) throws (JSException) -> JSObject + @JSFunction func getAnimations(_ options: JSObject) throws (JSException) -> JSObject +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift index 122771716..fd16bd0d8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift @@ -1,11 +1,3 @@ -// 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: "Check", name: "bjs_returnAnimatable") fileprivate func bjs_returnAnimatable() -> Int32 @@ -15,7 +7,7 @@ fileprivate func bjs_returnAnimatable() -> Int32 { } #endif -func returnAnimatable() throws(JSException) -> Animatable { +func _$returnAnimatable() throws(JSException) -> Animatable { let ret = bjs_returnAnimatable() if let error = _swift_js_take_exception() { throw error @@ -41,32 +33,23 @@ fileprivate func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) - } #endif -struct Animatable: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - func animate(_ keyframes: JSObject, _ options: JSObject) throws(JSException) -> JSObject { - let selfValue = self.bridgeJSLowerParameter() - let keyframesValue = keyframes.bridgeJSLowerParameter() - let optionsValue = options.bridgeJSLowerParameter() - let ret = bjs_Animatable_animate(selfValue, keyframesValue, optionsValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) +func _$Animatable_animate(_ self: JSObject, _ keyframes: JSObject, _ options: JSObject) throws(JSException) -> JSObject { + let selfValue = self.bridgeJSLowerParameter() + let keyframesValue = keyframes.bridgeJSLowerParameter() + let optionsValue = options.bridgeJSLowerParameter() + let ret = bjs_Animatable_animate(selfValue, keyframesValue, optionsValue) + if let error = _swift_js_take_exception() { + throw error } + return JSObject.bridgeJSLiftReturn(ret) +} - func getAnimations(_ options: JSObject) throws(JSException) -> JSObject { - let selfValue = self.bridgeJSLowerParameter() - let optionsValue = options.bridgeJSLowerParameter() - let ret = bjs_Animatable_getAnimations(selfValue, optionsValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) +func _$Animatable_getAnimations(_ self: JSObject, _ options: JSObject) throws(JSException) -> JSObject { + let selfValue = self.bridgeJSLowerParameter() + let optionsValue = options.bridgeJSLowerParameter() + let ret = bjs_Animatable_getAnimations(selfValue, optionsValue) + if let error = _swift_js_take_exception() { + throw error } - + return JSObject.bridgeJSLiftReturn(ret) } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift new file mode 100644 index 000000000..8bd4798df --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift @@ -0,0 +1,26 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func createArrayBuffer() throws (JSException) -> ArrayBufferLike + +@JSClass struct ArrayBufferLike: _JSBridgedClass { + @JSGetter var byteLength: Double + @JSFunction func slice(_ begin: Double, _ end: Double) throws (JSException) -> ArrayBufferLike +} + +@JSFunction func createWeirdObject() throws (JSException) -> WeirdNaming + +@JSClass struct WeirdNaming: _JSBridgedClass { + @JSGetter var normalProperty: String + @JSSetter func setNormalProperty(_ value: String) throws (JSException) + @JSGetter var `for`: String + @JSSetter func setFor(_ value: String) throws (JSException) + @JSGetter var `Any`: String + @JSSetter(jsName: "Any") func setAny(_ value: String) throws (JSException) + @JSFunction func `as`() throws (JSException) -> Void +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift index c78682994..ba9e925e0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift @@ -1,11 +1,3 @@ -// 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: "Check", name: "bjs_createArrayBuffer") fileprivate func bjs_createArrayBuffer() -> Int32 @@ -15,7 +7,7 @@ fileprivate func bjs_createArrayBuffer() -> Int32 { } #endif -func createArrayBuffer() throws(JSException) -> ArrayBufferLike { +func _$createArrayBuffer() throws(JSException) -> ArrayBufferLike { let ret = bjs_createArrayBuffer() if let error = _swift_js_take_exception() { throw error @@ -32,7 +24,7 @@ fileprivate func bjs_createWeirdObject() -> Int32 { } #endif -func createWeirdObject() throws(JSException) -> WeirdNaming { +func _$createWeirdObject() throws(JSException) -> WeirdNaming { let ret = bjs_createWeirdObject() if let error = _swift_js_take_exception() { throw error @@ -58,35 +50,24 @@ fileprivate func bjs_ArrayBufferLike_slice(_ self: Int32, _ begin: Float64, _ en } #endif -struct ArrayBufferLike: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - var byteLength: Double { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_ArrayBufferLike_byteLength_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) - } +func _$ArrayBufferLike_byteLength_get(_ self: JSObject) throws(JSException) -> Double { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_ArrayBufferLike_byteLength_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return Double.bridgeJSLiftReturn(ret) +} - func slice(_ begin: Double, _ end: Double) throws(JSException) -> ArrayBufferLike { - let selfValue = self.bridgeJSLowerParameter() - let beginValue = begin.bridgeJSLowerParameter() - let endValue = end.bridgeJSLowerParameter() - let ret = bjs_ArrayBufferLike_slice(selfValue, beginValue, endValue) - if let error = _swift_js_take_exception() { - throw error - } - return ArrayBufferLike.bridgeJSLiftReturn(ret) +func _$ArrayBufferLike_slice(_ self: JSObject, _ begin: Double, _ end: Double) throws(JSException) -> ArrayBufferLike { + let selfValue = self.bridgeJSLowerParameter() + let beginValue = begin.bridgeJSLowerParameter() + let endValue = end.bridgeJSLowerParameter() + let ret = bjs_ArrayBufferLike_slice(selfValue, beginValue, endValue) + if let error = _swift_js_take_exception() { + throw error } - + return ArrayBufferLike.bridgeJSLiftReturn(ret) } #if arch(wasm32) @@ -99,46 +80,46 @@ fileprivate func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_normalProperty_set") -fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_get") +fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 #else -fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_get") -fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_Any_get") +fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 #else -fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_set") -fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_normalProperty_set") +fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_Any_get") -fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_set") +fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_Any_set") -fileprivate func bjs_WeirdNaming_Any_set(_ self: Int32, _ newValue: Int32) -> Void +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_any_set") +fileprivate func bjs_WeirdNaming_any_set(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_WeirdNaming_Any_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_WeirdNaming_any_set(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -152,79 +133,64 @@ fileprivate func bjs_WeirdNaming_as(_ self: Int32) -> Void { } #endif -struct WeirdNaming: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - var normalProperty: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_WeirdNaming_normalProperty_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$WeirdNaming_normalProperty_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming_normalProperty_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - func setNormalProperty(_ newValue: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_WeirdNaming_normalProperty_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$WeirdNaming_for_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming_for_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - var `for`: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_WeirdNaming_for_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$WeirdNaming_Any_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming_Any_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - func setFor(_ newValue: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_WeirdNaming_for_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$WeirdNaming_normalProperty_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_normalProperty_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - var `Any`: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_WeirdNaming_Any_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$WeirdNaming_for_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_for_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func setAny(_ newValue: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_WeirdNaming_Any_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$WeirdNaming_any_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_any_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func `as`() throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - bjs_WeirdNaming_as(selfValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$WeirdNaming_as(_ self: JSObject) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + bjs_WeirdNaming_as(selfValue) + if let error = _swift_js_take_exception() { + throw error } - } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift new file mode 100644 index 000000000..0d5635c35 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift @@ -0,0 +1,33 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func createDatabaseConnection(_ config: JSObject) throws (JSException) -> DatabaseConnection + +@JSClass struct DatabaseConnection: _JSBridgedClass { + @JSFunction func connect(_ url: String) throws (JSException) -> Void + @JSFunction func execute(_ query: String) throws (JSException) -> JSObject + @JSGetter var isConnected: Bool + @JSGetter var connectionTimeout: Double + @JSSetter func setConnectionTimeout(_ value: Double) throws (JSException) +} + +@JSFunction func createLogger(_ level: String) throws (JSException) -> Logger + +@JSClass struct Logger: _JSBridgedClass { + @JSFunction func log(_ message: String) throws (JSException) -> Void + @JSFunction func error(_ message: String, _ error: JSObject) throws (JSException) -> Void + @JSGetter var level: String +} + +@JSFunction func getConfigManager() throws (JSException) -> ConfigManager + +@JSClass struct ConfigManager: _JSBridgedClass { + @JSFunction func get(_ key: String) throws (JSException) -> JSObject + @JSFunction func set(_ key: String, _ value: JSObject) throws (JSException) -> Void + @JSGetter var configPath: String +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift index 1f8a14800..1c1418af8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift @@ -1,11 +1,3 @@ -// 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: "Check", name: "bjs_createDatabaseConnection") fileprivate func bjs_createDatabaseConnection(_ config: Int32) -> Int32 @@ -15,7 +7,7 @@ fileprivate func bjs_createDatabaseConnection(_ config: Int32) -> Int32 { } #endif -func createDatabaseConnection(_ config: JSObject) throws(JSException) -> DatabaseConnection { +func _$createDatabaseConnection(_ config: JSObject) throws(JSException) -> DatabaseConnection { let configValue = config.bridgeJSLowerParameter() let ret = bjs_createDatabaseConnection(configValue) if let error = _swift_js_take_exception() { @@ -33,7 +25,7 @@ fileprivate func bjs_createLogger(_ level: Int32) -> Int32 { } #endif -func createLogger(_ level: String) throws(JSException) -> Logger { +func _$createLogger(_ level: String) throws(JSException) -> Logger { let levelValue = level.bridgeJSLowerParameter() let ret = bjs_createLogger(levelValue) if let error = _swift_js_take_exception() { @@ -51,7 +43,7 @@ fileprivate func bjs_getConfigManager() -> Int32 { } #endif -func getConfigManager() throws(JSException) -> ConfigManager { +func _$getConfigManager() throws(JSException) -> ConfigManager { let ret = bjs_getConfigManager() if let error = _swift_js_take_exception() { throw error @@ -104,63 +96,50 @@ fileprivate func bjs_DatabaseConnection_execute(_ self: Int32, _ query: Int32) - } #endif -struct DatabaseConnection: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - var isConnected: Bool { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_DatabaseConnection_isConnected_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) - } +func _$DatabaseConnection_isConnected_get(_ self: JSObject) throws(JSException) -> Bool { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_DatabaseConnection_isConnected_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return Bool.bridgeJSLiftReturn(ret) +} - var connectionTimeout: Double { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_DatabaseConnection_connectionTimeout_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) - } +func _$DatabaseConnection_connectionTimeout_get(_ self: JSObject) throws(JSException) -> Double { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_DatabaseConnection_connectionTimeout_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return Double.bridgeJSLiftReturn(ret) +} - func setConnectionTimeout(_ newValue: Double) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_DatabaseConnection_connectionTimeout_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$DatabaseConnection_connectionTimeout_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_DatabaseConnection_connectionTimeout_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func connect(_ url: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let urlValue = url.bridgeJSLowerParameter() - bjs_DatabaseConnection_connect(selfValue, urlValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$DatabaseConnection_connect(_ self: JSObject, _ url: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let urlValue = url.bridgeJSLowerParameter() + bjs_DatabaseConnection_connect(selfValue, urlValue) + if let error = _swift_js_take_exception() { + throw error } +} - func execute(_ query: String) throws(JSException) -> JSObject { - let selfValue = self.bridgeJSLowerParameter() - let queryValue = query.bridgeJSLowerParameter() - let ret = bjs_DatabaseConnection_execute(selfValue, queryValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) +func _$DatabaseConnection_execute(_ self: JSObject, _ query: String) throws(JSException) -> JSObject { + let selfValue = self.bridgeJSLowerParameter() + let queryValue = query.bridgeJSLowerParameter() + let ret = bjs_DatabaseConnection_execute(selfValue, queryValue) + if let error = _swift_js_take_exception() { + throw error } - + return JSObject.bridgeJSLiftReturn(ret) } #if arch(wasm32) @@ -190,43 +169,32 @@ fileprivate func bjs_Logger_error(_ self: Int32, _ message: Int32, _ error: Int3 } #endif -struct Logger: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - var level: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Logger_level_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$Logger_level_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Logger_level_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - func log(_ message: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let messageValue = message.bridgeJSLowerParameter() - bjs_Logger_log(selfValue, messageValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$Logger_log(_ self: JSObject, _ message: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let messageValue = message.bridgeJSLowerParameter() + bjs_Logger_log(selfValue, messageValue) + if let error = _swift_js_take_exception() { + throw error } +} - func error(_ message: String, _ error: JSObject) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let messageValue = message.bridgeJSLowerParameter() - let errorValue = error.bridgeJSLowerParameter() - bjs_Logger_error(selfValue, messageValue, errorValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$Logger_error(_ self: JSObject, _ message: String, _ error: JSObject) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let messageValue = message.bridgeJSLowerParameter() + let errorValue = error.bridgeJSLowerParameter() + bjs_Logger_error(selfValue, messageValue, errorValue) + if let error = _swift_js_take_exception() { + throw error } - } #if arch(wasm32) @@ -256,42 +224,31 @@ fileprivate func bjs_ConfigManager_set(_ self: Int32, _ key: Int32, _ value: Int } #endif -struct ConfigManager: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - var configPath: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_ConfigManager_configPath_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$ConfigManager_configPath_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_ConfigManager_configPath_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - func get(_ key: String) throws(JSException) -> JSObject { - let selfValue = self.bridgeJSLowerParameter() - let keyValue = key.bridgeJSLowerParameter() - let ret = bjs_ConfigManager_get(selfValue, keyValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) +func _$ConfigManager_get(_ self: JSObject, _ key: String) throws(JSException) -> JSObject { + let selfValue = self.bridgeJSLowerParameter() + let keyValue = key.bridgeJSLowerParameter() + let ret = bjs_ConfigManager_get(selfValue, keyValue) + if let error = _swift_js_take_exception() { + throw error } + return JSObject.bridgeJSLiftReturn(ret) +} - func set(_ key: String, _ value: JSObject) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let keyValue = key.bridgeJSLowerParameter() - let valueValue = value.bridgeJSLowerParameter() - bjs_ConfigManager_set(selfValue, keyValue, valueValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$ConfigManager_set(_ self: JSObject, _ key: String, _ value: JSObject) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let keyValue = key.bridgeJSLowerParameter() + let valueValue = value.bridgeJSLowerParameter() + bjs_ConfigManager_set(selfValue, keyValue, valueValue) + if let error = _swift_js_take_exception() { + throw error } - } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift new file mode 100644 index 000000000..6ede7fabc --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift @@ -0,0 +1,9 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func check(_ a: Double, _ b: Bool) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift index 90088799d..6d59ca52f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift @@ -1,11 +1,3 @@ -// 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: "Check", name: "bjs_check") fileprivate func bjs_check(_ a: Float64, _ b: Int32) -> Void @@ -15,7 +7,7 @@ fileprivate func bjs_check(_ a: Float64, _ b: Int32) -> Void { } #endif -func check(_ a: Double, _ b: Bool) throws(JSException) -> Void { +func _$check(_ a: Double, _ b: Bool) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() let bValue = b.bridgeJSLowerParameter() bjs_check(aValue, bValue) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift new file mode 100644 index 000000000..198c44c91 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift @@ -0,0 +1,11 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func checkNumber() throws (JSException) -> Double + +@JSFunction func checkBoolean() throws (JSException) -> Bool diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift index 6424329b5..17f536ba5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift @@ -1,11 +1,3 @@ -// 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: "Check", name: "bjs_checkNumber") fileprivate func bjs_checkNumber() -> Float64 @@ -15,7 +7,7 @@ fileprivate func bjs_checkNumber() -> Float64 { } #endif -func checkNumber() throws(JSException) -> Double { +func _$checkNumber() throws(JSException) -> Double { let ret = bjs_checkNumber() if let error = _swift_js_take_exception() { throw error @@ -32,7 +24,7 @@ fileprivate func bjs_checkBoolean() -> Int32 { } #endif -func checkBoolean() throws(JSException) -> Bool { +func _$checkBoolean() throws(JSException) -> Bool { let ret = bjs_checkBoolean() if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift new file mode 100644 index 000000000..46643d1ee --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift @@ -0,0 +1,11 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func checkString(_ a: String) throws (JSException) -> Void + +@JSFunction func checkStringWithLength(_ a: String, _ b: Double) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift index 35502a7cd..694c44e06 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift @@ -1,11 +1,3 @@ -// 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: "Check", name: "bjs_checkString") fileprivate func bjs_checkString(_ a: Int32) -> Void @@ -15,7 +7,7 @@ fileprivate func bjs_checkString(_ a: Int32) -> Void { } #endif -func checkString(_ a: String) throws(JSException) -> Void { +func _$checkString(_ a: String) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() bjs_checkString(aValue) if let error = _swift_js_take_exception() { @@ -32,7 +24,7 @@ fileprivate func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void { } #endif -func checkStringWithLength(_ a: String, _ b: Double) throws(JSException) -> Void { +func _$checkStringWithLength(_ a: String, _ b: Double) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() let bValue = b.bridgeJSLowerParameter() bjs_checkStringWithLength(aValue, bValue) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift new file mode 100644 index 000000000..0d2b146cb --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift @@ -0,0 +1,9 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func checkString() throws (JSException) -> String diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift index 638eedb05..bde90ea74 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift @@ -1,11 +1,3 @@ -// 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: "Check", name: "bjs_checkString") fileprivate func bjs_checkString() -> Int32 @@ -15,7 +7,7 @@ fileprivate func bjs_checkString() -> Int32 { } #endif -func checkString() throws(JSException) -> String { +func _$checkString() throws(JSException) -> String { let ret = bjs_checkString() if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift new file mode 100644 index 000000000..7149a24a3 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift @@ -0,0 +1,22 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func createTS2Skeleton() throws (JSException) -> TypeScriptProcessor + +@JSClass struct TypeScriptProcessor: _JSBridgedClass { + @JSFunction func convert(_ ts: String) throws (JSException) -> String + @JSFunction func validate(_ ts: String) throws (JSException) -> Bool + @JSGetter var version: String +} + +@JSFunction func createCodeGenerator(_ format: String) throws (JSException) -> CodeGenerator + +@JSClass struct CodeGenerator: _JSBridgedClass { + @JSFunction func generate(_ input: JSObject) throws (JSException) -> String + @JSGetter var outputFormat: String +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift index 26d37a909..54d3b9156 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift @@ -1,11 +1,3 @@ -// 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: "Check", name: "bjs_createTS2Skeleton") fileprivate func bjs_createTS2Skeleton() -> Int32 @@ -15,7 +7,7 @@ fileprivate func bjs_createTS2Skeleton() -> Int32 { } #endif -func createTS2Skeleton() throws(JSException) -> TypeScriptProcessor { +func _$createTS2Skeleton() throws(JSException) -> TypeScriptProcessor { let ret = bjs_createTS2Skeleton() if let error = _swift_js_take_exception() { throw error @@ -32,7 +24,7 @@ fileprivate func bjs_createCodeGenerator(_ format: Int32) -> Int32 { } #endif -func createCodeGenerator(_ format: String) throws(JSException) -> CodeGenerator { +func _$createCodeGenerator(_ format: String) throws(JSException) -> CodeGenerator { let formatValue = format.bridgeJSLowerParameter() let ret = bjs_createCodeGenerator(formatValue) if let error = _swift_js_take_exception() { @@ -68,44 +60,33 @@ fileprivate func bjs_TypeScriptProcessor_validate(_ self: Int32, _ ts: Int32) -> } #endif -struct TypeScriptProcessor: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - var version: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_TypeScriptProcessor_version_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$TypeScriptProcessor_version_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_TypeScriptProcessor_version_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - func convert(_ ts: String) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let tsValue = ts.bridgeJSLowerParameter() - let ret = bjs_TypeScriptProcessor_convert(selfValue, tsValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) +func _$TypeScriptProcessor_convert(_ self: JSObject, _ ts: String) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let tsValue = ts.bridgeJSLowerParameter() + let ret = bjs_TypeScriptProcessor_convert(selfValue, tsValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - func validate(_ ts: String) throws(JSException) -> Bool { - let selfValue = self.bridgeJSLowerParameter() - let tsValue = ts.bridgeJSLowerParameter() - let ret = bjs_TypeScriptProcessor_validate(selfValue, tsValue) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) +func _$TypeScriptProcessor_validate(_ self: JSObject, _ ts: String) throws(JSException) -> Bool { + let selfValue = self.bridgeJSLowerParameter() + let tsValue = ts.bridgeJSLowerParameter() + let ret = bjs_TypeScriptProcessor_validate(selfValue, tsValue) + if let error = _swift_js_take_exception() { + throw error } - + return Bool.bridgeJSLiftReturn(ret) } #if arch(wasm32) @@ -126,32 +107,21 @@ fileprivate func bjs_CodeGenerator_generate(_ self: Int32, _ input: Int32) -> In } #endif -struct CodeGenerator: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - var outputFormat: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_CodeGenerator_outputFormat_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$CodeGenerator_outputFormat_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_CodeGenerator_outputFormat_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - func generate(_ input: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let inputValue = input.bridgeJSLowerParameter() - let ret = bjs_CodeGenerator_generate(selfValue, inputValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) +func _$CodeGenerator_generate(_ self: JSObject, _ input: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let inputValue = input.bridgeJSLowerParameter() + let ret = bjs_CodeGenerator_generate(selfValue, inputValue) + if let error = _swift_js_take_exception() { + throw error } - + return String.bridgeJSLiftReturn(ret) } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift new file mode 100644 index 000000000..5724d9d47 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift @@ -0,0 +1,9 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func checkSimple(_ a: Double) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift index afd99723e..0b5d0c40d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift @@ -1,11 +1,3 @@ -// 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: "Check", name: "bjs_checkSimple") fileprivate func bjs_checkSimple(_ a: Float64) -> Void @@ -15,7 +7,7 @@ fileprivate func bjs_checkSimple(_ a: Float64) -> Void { } #endif -func checkSimple(_ a: Double) throws(JSException) -> Void { +func _$checkSimple(_ a: Double) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() bjs_checkSimple(aValue) if let error = _swift_js_take_exception() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift new file mode 100644 index 000000000..9f33c11e1 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift @@ -0,0 +1,16 @@ +// 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`. + +import JavaScriptKit + +@JSClass struct Greeter: _JSBridgedClass { + @JSGetter var name: String + @JSSetter func setName(_ value: String) throws (JSException) + @JSGetter var age: Double + @JSFunction init(_ name: String) throws (JSException) + @JSFunction func greet() throws (JSException) -> String + @JSFunction func changeName(_ name: String) throws (JSException) -> Void +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift index 6d1bdca34..67c778975 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift @@ -1,11 +1,3 @@ -// 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: "Check", name: "bjs_Greeter_init") fileprivate func bjs_Greeter_init(_ name: Int32) -> Int32 @@ -25,19 +17,19 @@ fileprivate func bjs_Greeter_name_get(_ self: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Greeter_name_set") -fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void +@_extern(wasm, module: "Check", name: "bjs_Greeter_age_get") +fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 #else -fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Greeter_age_get") -fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 +@_extern(wasm, module: "Check", name: "bjs_Greeter_name_set") +fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 { +fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -60,69 +52,56 @@ fileprivate func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void { } #endif -struct Greeter: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - init(_ name: String) throws(JSException) { - let nameValue = name.bridgeJSLowerParameter() - let ret = bjs_Greeter_init(nameValue) - if let error = _swift_js_take_exception() { - throw error - } - self.jsObject = JSObject(id: UInt32(bitPattern: ret)) +func _$Greeter_init(_ name: String) throws(JSException) -> JSObject { + let nameValue = name.bridgeJSLowerParameter() + let ret = bjs_Greeter_init(nameValue) + if let error = _swift_js_take_exception() { + throw error } + return JSObject.bridgeJSLiftReturn(ret) +} - var name: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Greeter_name_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$Greeter_name_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Greeter_name_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - func setName(_ newValue: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_Greeter_name_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$Greeter_age_get(_ self: JSObject) throws(JSException) -> Double { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Greeter_age_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return Double.bridgeJSLiftReturn(ret) +} - var age: Double { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Greeter_age_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) - } +func _$Greeter_name_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_Greeter_name_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func greet() throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Greeter_greet(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) +func _$Greeter_greet(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Greeter_greet(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - func changeName(_ name: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let nameValue = name.bridgeJSLowerParameter() - bjs_Greeter_changeName(selfValue, nameValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$Greeter_changeName(_ self: JSObject, _ name: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let nameValue = name.bridgeJSLowerParameter() + bjs_Greeter_changeName(selfValue, nameValue) + if let error = _swift_js_take_exception() { + throw error } - } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift new file mode 100644 index 000000000..1fe58af34 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift @@ -0,0 +1,9 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func check() throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift index 511678471..2a2622ce0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift @@ -1,11 +1,3 @@ -// 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: "Check", name: "bjs_check") fileprivate func bjs_check() -> Void @@ -15,7 +7,7 @@ fileprivate func bjs_check() -> Void { } #endif -func check() throws(JSException) -> Void { +func _$check() throws(JSException) -> Void { bjs_check() if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/PackageToJS/Sources/PackageToJS.swift b/Plugins/PackageToJS/Sources/PackageToJS.swift index ec9840439..ea99f0b09 100644 --- a/Plugins/PackageToJS/Sources/PackageToJS.swift +++ b/Plugins/PackageToJS/Sources/PackageToJS.swift @@ -602,19 +602,21 @@ struct PackagingPlanner { let bridgeDts = outputDir.appending(path: "bridge-js.d.ts") packageInputs.append( make.addTask(inputFiles: exportedSkeletons + importedSkeletons, output: bridgeJs) { _, scope in - let link = try BridgeJSLink( - exportedSkeletons: exportedSkeletons.map { - let decoder = JSONDecoder() - let data = try Data(contentsOf: URL(fileURLWithPath: scope.resolve(path: $0).path)) - return try decoder.decode(ExportedSkeleton.self, from: data) - }, - importedSkeletons: importedSkeletons.map { - let decoder = JSONDecoder() - let data = try Data(contentsOf: URL(fileURLWithPath: scope.resolve(path: $0).path)) - return try decoder.decode(ImportedModuleSkeleton.self, from: data) - }, + var link = BridgeJSLink( + exportedSkeletons: [], + importedSkeletons: [], sharedMemory: Self.isSharedMemoryEnabled(triple: triple) ) + + // Decode unified skeleton format + // Unified skeleton files can contain both exported and imported parts + // Deduplicate file paths since we may have the same file in both lists + let allSkeletonPaths = Set(exportedSkeletons + importedSkeletons) + for skeletonPath in allSkeletonPaths { + let data = try Data(contentsOf: URL(fileURLWithPath: scope.resolve(path: skeletonPath).path)) + try link.addSkeletonFile(data: data) + } + let (outputJs, outputDts) = try link.link() try system.writeFile(atPath: scope.resolve(path: bridgeJs).path, content: Data(outputJs.utf8)) try system.writeFile(atPath: scope.resolve(path: bridgeDts).path, content: Data(outputDts.utf8)) diff --git a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift index 709dc8f3a..32271f243 100644 --- a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift +++ b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift @@ -166,7 +166,7 @@ struct PackageToJSPlugin: CommandPlugin { } } - static let JAVASCRIPTKIT_PRODUCT_ID: Product.ID = "JavaScriptKit" + static let JAVASCRIPTEVENTLOOP_PRODUCT_ID: Product.ID = "JavaScriptEventLoop" func performBuildCommand(context: PluginContext, arguments: [String]) throws { if arguments.contains(where: { ["-h", "--help"].contains($0) }) { @@ -396,7 +396,11 @@ struct PackageToJSPlugin: CommandPlugin { guard let selfPackage = findPackageInDependencies( package: package, - including: Self.JAVASCRIPTKIT_PRODUCT_ID + // NOTE: We use JavaScriptEventLoop product to find the JavaScriptKit package + // instead of JavaScriptKit product because SwiftPM in 6.0 does not returns + // product information for JavaScriptKit product for some reason (very likely + // a bug in SwiftPM). + including: Self.JAVASCRIPTEVENTLOOP_PRODUCT_ID ) else { throw PackageToJSError("Failed to find JavaScriptKit in dependencies!?") @@ -702,10 +706,8 @@ class SkeletonCollector { private var visitedProducts: Set = [] private var visitedTargets: Set = [] - var exportedSkeletons: [URL] = [] - var importedSkeletons: [URL] = [] - let exportedSkeletonFile = "BridgeJS.ExportSwift.json" - let importedSkeletonFile = "BridgeJS.ImportTS.json" + var skeletons: [URL] = [] + let skeletonFile = "BridgeJS.json" let context: PluginContext init(context: PluginContext) { @@ -717,7 +719,9 @@ class SkeletonCollector { return ([], []) } visit(product: product, package: context.package) - return (exportedSkeletons, importedSkeletons) + // Unified skeleton files contain both exported and imported parts + // Return the same list for both since BridgeJSLink.addSkeletonFile handles the unified format + return (skeletons, skeletons) } func collectFromTests() -> (exportedSkeletons: [URL], importedSkeletons: [URL]) { @@ -728,7 +732,9 @@ class SkeletonCollector { for test in tests { visit(target: test, package: context.package) } - return (exportedSkeletons, importedSkeletons) + // Unified skeleton files contain both exported and imported parts + // Return the same list for both since BridgeJSLink.addSkeletonFile handles the unified format + return (skeletons, skeletons) } private func visit(product: Product, package: Package) { @@ -742,6 +748,11 @@ class SkeletonCollector { private func visit(target: Target, package: Package) { if visitedTargets.contains(target.id) { return } visitedTargets.insert(target.id) + if let sourceModuleTarget = target as? SourceModuleTarget { + if sourceModuleTarget.kind == .macro { + return + } + } if let target = target as? SwiftSourceModuleTarget { let directories = [ target.directoryURL.appending(path: "Generated/JavaScript"), @@ -751,13 +762,9 @@ class SkeletonCollector { .appending(path: "outputs/\(package.id)/\(target.name)/destination/BridgeJS"), ] for directory in directories { - let exportedSkeletonURL = directory.appending(path: exportedSkeletonFile) - let importedSkeletonURL = directory.appending(path: importedSkeletonFile) - if FileManager.default.fileExists(atPath: exportedSkeletonURL.path) { - exportedSkeletons.append(exportedSkeletonURL) - } - if FileManager.default.fileExists(atPath: importedSkeletonURL.path) { - importedSkeletons.append(importedSkeletonURL) + let skeletonURL = directory.appending(path: skeletonFile) + if FileManager.default.fileExists(atPath: skeletonURL.path) { + skeletons.append(skeletonURL) } } } diff --git a/Sources/BridgeJSMacros b/Sources/BridgeJSMacros new file mode 120000 index 000000000..2d3d8a4ab --- /dev/null +++ b/Sources/BridgeJSMacros @@ -0,0 +1 @@ +../Plugins/BridgeJS/Sources/BridgeJSMacros \ No newline at end of file diff --git a/Sources/BridgeJSTool/TS2Skeleton b/Sources/BridgeJSTool/TS2Skeleton deleted file mode 120000 index c41c12804..000000000 --- a/Sources/BridgeJSTool/TS2Skeleton +++ /dev/null @@ -1 +0,0 @@ -../../Plugins/BridgeJS/Sources/TS2Skeleton \ No newline at end of file diff --git a/Sources/BridgeJSTool/TS2Swift b/Sources/BridgeJSTool/TS2Swift new file mode 120000 index 000000000..6d9b4332e --- /dev/null +++ b/Sources/BridgeJSTool/TS2Swift @@ -0,0 +1 @@ +../../Plugins/BridgeJS/Sources/TS2Swift \ No newline at end of file diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Ahead-of-Time-Code-Generation.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Ahead-of-Time-Code-Generation.md index e3f52885c..ee6ac3047 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Ahead-of-Time-Code-Generation.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Ahead-of-Time-Code-Generation.md @@ -111,9 +111,8 @@ This command will: For example, with a target named "MyApp", it will create: ``` -Sources/MyApp/Generated/ExportSwift.swift # Generated code for Swift exports -Sources/MyApp/Generated/ImportTS.swift # Generated code for TypeScript imports -Sources/MyApp/Generated/JavaScript/ # Generated JSON skeletons +Sources/MyApp/Generated/BridgeJS.swift # Generated code for both exports and imports +Sources/MyApp/Generated/JavaScript/BridgeJS.json # Unified skeleton JSON ``` ### Step 6: Add Generated Files to Version Control diff --git a/Sources/JavaScriptKit/Macros.swift b/Sources/JavaScriptKit/Macros.swift index b8a44a08c..9e11db3b4 100644 --- a/Sources/JavaScriptKit/Macros.swift +++ b/Sources/JavaScriptKit/Macros.swift @@ -107,3 +107,81 @@ public enum JSEnumStyle: 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 + +/// A macro that generates a Swift getter that reads a value from JavaScript. +/// +/// This macro is used by BridgeJS-generated Swift declarations. +/// +/// Example: +/// +/// ```swift +/// @_spi(Experimental) import JavaScriptKit +/// +/// @JSGetter var count: Int +/// +/// struct Greeter { +/// @JSGetter var name: String +/// } +/// ``` +@attached(accessor) +@_spi(Experimental) +public macro JSGetter() = + #externalMacro(module: "BridgeJSMacros", type: "JSGetterMacro") + +/// A macro that generates a Swift function body that writes a value to JavaScript. +/// +/// This macro is used by BridgeJS-generated Swift declarations. +/// +/// - Parameter jsName: An optional string that specifies the name of the JavaScript property to write to. +/// If not provided, automatically derived from the Swift property name. (e.g. "setName" -> "name") +/// +/// Example: +/// +/// ```swift +/// @_spi(Experimental) import JavaScriptKit +/// +/// @JSSetter func setName(_ value: String) throws (JSException) +/// ``` +@attached(body) +@_spi(Experimental) +public macro JSSetter(jsName: String? = nil) = + #externalMacro(module: "BridgeJSMacros", type: "JSSetterMacro") + +/// A macro that generates a Swift function body that calls a JavaScript function. +/// +/// This macro is used by BridgeJS-generated Swift declarations. +/// +/// Example: +/// +/// ```swift +/// @_spi(Experimental) import JavaScriptKit +/// +/// @JSFunction func greet() throws (JSException) -> String +/// @JSFunction init(_ name: String) throws (JSException) +/// ``` +@attached(body) +@_spi(Experimental) +public macro JSFunction() = + #externalMacro(module: "BridgeJSMacros", type: "JSFunctionMacro") + +/// A macro that adds bridging members for a Swift type that represents a JavaScript class. +/// +/// This macro is used by BridgeJS-generated Swift declarations. +/// +/// Example: +/// +/// ```swift +/// @_spi(Experimental) import JavaScriptKit +/// +/// @JSClass +/// struct JsGreeter: _JSBridgedClass { +/// @JSGetter var name: String +/// @JSSetter func setName(_ value: String) throws (JSException) +/// @JSFunction init(_ name: String) throws (JSException) +/// @JSFunction func greet() throws (JSException) -> String +/// } +/// ``` +@attached(member, names: arbitrary) +@_spi(Experimental) +public macro JSClass() = + #externalMacro(module: "BridgeJSMacros", type: "JSClassMacro") diff --git a/Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift similarity index 99% rename from Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift rename to Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift index 09cd79ecc..3a41f337e 100644 --- a/Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift @@ -1,10 +1,11 @@ +// 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 +@_spi(BridgeJS) @_spi(Experimental) import JavaScriptKit extension GlobalNetworking.API.CallMethod: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { diff --git a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json deleted file mode 100644 index 955b78f69..000000000 --- a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ /dev/null @@ -1,540 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_TestHTTPServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_TestHTTPServer_call", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "call", - "namespace" : [ - "GlobalNetworking", - "API" - ], - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "GlobalNetworking.API.CallMethod" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "TestHTTPServer", - "namespace" : [ - "GlobalNetworking", - "API" - ], - "properties" : [ - - ], - "swiftCallName" : "GlobalNetworking.API.TestHTTPServer" - }, - { - "constructor" : { - "abiName" : "bjs_TestInternalServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_TestInternalServer_call", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "call", - "namespace" : [ - "GlobalNetworking", - "APIV2", - "Internal" - ], - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "Internal.SupportedServerMethod" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "TestInternalServer", - "namespace" : [ - "GlobalNetworking", - "APIV2", - "Internal" - ], - "properties" : [ - - ], - "swiftCallName" : "Internal.TestInternalServer" - }, - { - "constructor" : { - "abiName" : "bjs_PublicConverter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_PublicConverter_toString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "toString", - "namespace" : [ - "GlobalUtils" - ], - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "PublicConverter", - "namespace" : [ - "GlobalUtils" - ], - "properties" : [ - - ], - "swiftCallName" : "GlobalUtils.PublicConverter" - } - ], - "enums" : [ - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "GlobalNetworking", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalNetworking", - "tsFullPath" : "GlobalNetworking" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "API", - "namespace" : [ - "GlobalNetworking" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalNetworking.API", - "tsFullPath" : "GlobalNetworking.API" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "get" - }, - { - "associatedValues" : [ - - ], - "name" : "post" - }, - { - "associatedValues" : [ - - ], - "name" : "put" - }, - { - "associatedValues" : [ - - ], - "name" : "delete" - } - ], - "emitStyle" : "const", - "name" : "CallMethod", - "namespace" : [ - "GlobalNetworking", - "API" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalNetworking.API.CallMethod", - "tsFullPath" : "GlobalNetworking.API.CallMethod" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "GlobalConfiguration", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalConfiguration", - "tsFullPath" : "GlobalConfiguration" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "debug", - "rawValue" : "debug" - }, - { - "associatedValues" : [ - - ], - "name" : "info", - "rawValue" : "info" - }, - { - "associatedValues" : [ - - ], - "name" : "warning", - "rawValue" : "warning" - }, - { - "associatedValues" : [ - - ], - "name" : "error", - "rawValue" : "error" - } - ], - "emitStyle" : "const", - "name" : "PublicLogLevel", - "namespace" : [ - "GlobalConfiguration" - ], - "rawType" : "String", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalConfiguration.PublicLogLevel", - "tsFullPath" : "GlobalConfiguration.PublicLogLevel" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "http", - "rawValue" : "80" - }, - { - "associatedValues" : [ - - ], - "name" : "https", - "rawValue" : "443" - }, - { - "associatedValues" : [ - - ], - "name" : "development", - "rawValue" : "3000" - } - ], - "emitStyle" : "const", - "name" : "AvailablePort", - "namespace" : [ - "GlobalConfiguration" - ], - "rawType" : "Int", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalConfiguration.AvailablePort", - "tsFullPath" : "GlobalConfiguration.AvailablePort" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Internal", - "namespace" : [ - "GlobalNetworking", - "APIV2" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Internal", - "tsFullPath" : "GlobalNetworking.APIV2.Internal" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "get" - }, - { - "associatedValues" : [ - - ], - "name" : "post" - } - ], - "emitStyle" : "const", - "name" : "SupportedServerMethod", - "namespace" : [ - "GlobalNetworking", - "APIV2", - "Internal" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Internal.SupportedServerMethod", - "tsFullPath" : "GlobalNetworking.APIV2.Internal.SupportedServerMethod" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "GlobalStaticPropertyNamespace", - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "namespaceProperty", - "namespace" : [ - "GlobalStaticPropertyNamespace" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "namespaceConstant", - "namespace" : [ - "GlobalStaticPropertyNamespace" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "GlobalStaticPropertyNamespace", - "tsFullPath" : "GlobalStaticPropertyNamespace" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "NestedProperties", - "namespace" : [ - "GlobalStaticPropertyNamespace" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "nestedProperty", - "namespace" : [ - "GlobalStaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "nestedConstant", - "namespace" : [ - "GlobalStaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "nestedDouble", - "namespace" : [ - "GlobalStaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "GlobalStaticPropertyNamespace.NestedProperties", - "tsFullPath" : "GlobalStaticPropertyNamespace.NestedProperties" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "GlobalUtils", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalUtils", - "tsFullPath" : "GlobalUtils" - } - ], - "exposeToGlobal" : true, - "functions" : [ - - ], - "moduleName" : "BridgeJSGlobalTests", - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json new file mode 100644 index 000000000..3e7f4a6dd --- /dev/null +++ b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json @@ -0,0 +1,554 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_TestHTTPServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_TestHTTPServer_call", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "call", + "namespace" : [ + "GlobalNetworking", + "API" + ], + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "GlobalNetworking.API.CallMethod" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "TestHTTPServer", + "namespace" : [ + "GlobalNetworking", + "API" + ], + "properties" : [ + + ], + "swiftCallName" : "GlobalNetworking.API.TestHTTPServer" + }, + { + "constructor" : { + "abiName" : "bjs_TestInternalServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_TestInternalServer_call", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "call", + "namespace" : [ + "GlobalNetworking", + "APIV2", + "Internal" + ], + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "Internal.SupportedServerMethod" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "TestInternalServer", + "namespace" : [ + "GlobalNetworking", + "APIV2", + "Internal" + ], + "properties" : [ + + ], + "swiftCallName" : "Internal.TestInternalServer" + }, + { + "constructor" : { + "abiName" : "bjs_PublicConverter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_PublicConverter_toString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "toString", + "namespace" : [ + "GlobalUtils" + ], + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "PublicConverter", + "namespace" : [ + "GlobalUtils" + ], + "properties" : [ + + ], + "swiftCallName" : "GlobalUtils.PublicConverter" + } + ], + "enums" : [ + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "GlobalNetworking", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalNetworking", + "tsFullPath" : "GlobalNetworking" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "API", + "namespace" : [ + "GlobalNetworking" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalNetworking.API", + "tsFullPath" : "GlobalNetworking.API" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "get" + }, + { + "associatedValues" : [ + + ], + "name" : "post" + }, + { + "associatedValues" : [ + + ], + "name" : "put" + }, + { + "associatedValues" : [ + + ], + "name" : "delete" + } + ], + "emitStyle" : "const", + "name" : "CallMethod", + "namespace" : [ + "GlobalNetworking", + "API" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalNetworking.API.CallMethod", + "tsFullPath" : "GlobalNetworking.API.CallMethod" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "GlobalConfiguration", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalConfiguration", + "tsFullPath" : "GlobalConfiguration" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "debug", + "rawValue" : "debug" + }, + { + "associatedValues" : [ + + ], + "name" : "info", + "rawValue" : "info" + }, + { + "associatedValues" : [ + + ], + "name" : "warning", + "rawValue" : "warning" + }, + { + "associatedValues" : [ + + ], + "name" : "error", + "rawValue" : "error" + } + ], + "emitStyle" : "const", + "name" : "PublicLogLevel", + "namespace" : [ + "GlobalConfiguration" + ], + "rawType" : "String", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalConfiguration.PublicLogLevel", + "tsFullPath" : "GlobalConfiguration.PublicLogLevel" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "http", + "rawValue" : "80" + }, + { + "associatedValues" : [ + + ], + "name" : "https", + "rawValue" : "443" + }, + { + "associatedValues" : [ + + ], + "name" : "development", + "rawValue" : "3000" + } + ], + "emitStyle" : "const", + "name" : "AvailablePort", + "namespace" : [ + "GlobalConfiguration" + ], + "rawType" : "Int", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalConfiguration.AvailablePort", + "tsFullPath" : "GlobalConfiguration.AvailablePort" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Internal", + "namespace" : [ + "GlobalNetworking", + "APIV2" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Internal", + "tsFullPath" : "GlobalNetworking.APIV2.Internal" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "get" + }, + { + "associatedValues" : [ + + ], + "name" : "post" + } + ], + "emitStyle" : "const", + "name" : "SupportedServerMethod", + "namespace" : [ + "GlobalNetworking", + "APIV2", + "Internal" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Internal.SupportedServerMethod", + "tsFullPath" : "GlobalNetworking.APIV2.Internal.SupportedServerMethod" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "GlobalStaticPropertyNamespace", + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "namespaceProperty", + "namespace" : [ + "GlobalStaticPropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "namespaceConstant", + "namespace" : [ + "GlobalStaticPropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "GlobalStaticPropertyNamespace", + "tsFullPath" : "GlobalStaticPropertyNamespace" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "NestedProperties", + "namespace" : [ + "GlobalStaticPropertyNamespace" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedProperty", + "namespace" : [ + "GlobalStaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "nestedConstant", + "namespace" : [ + "GlobalStaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedDouble", + "namespace" : [ + "GlobalStaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "GlobalStaticPropertyNamespace.NestedProperties", + "tsFullPath" : "GlobalStaticPropertyNamespace.NestedProperties" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "GlobalUtils", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalUtils", + "tsFullPath" : "GlobalUtils" + } + ], + "exposeToGlobal" : true, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "BridgeJSGlobalTests" +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift deleted file mode 100644 index e75febb86..000000000 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift +++ /dev/null @@ -1,271 +0,0 @@ -// 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: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripVoid") -fileprivate func bjs_jsRoundTripVoid() -> Void -#else -fileprivate func bjs_jsRoundTripVoid() -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -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(_ v: Float64) -> Float64 -#else -fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif - -func jsRoundTripNumber(_ v: Double) throws(JSException) -> Double { - let ret = bjs_jsRoundTripNumber(v.bridgeJSLowerParameter()) - 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(_ v: Int32) -> Int32 -#else -fileprivate func bjs_jsRoundTripBool(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func jsRoundTripBool(_ v: Bool) throws(JSException) -> Bool { - let ret = bjs_jsRoundTripBool(v.bridgeJSLowerParameter()) - 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(_ v: Int32) -> Int32 -#else -fileprivate func bjs_jsRoundTripString(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func jsRoundTripString(_ v: String) throws(JSException) -> String { - let ret = bjs_jsRoundTripString(v.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrVoid") -fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void -#else -fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void { - bjs_jsThrowOrVoid(shouldThrow.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrNumber") -fileprivate func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 -#else -fileprivate func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif - -func jsThrowOrNumber(_ shouldThrow: Bool) throws(JSException) -> Double { - let ret = bjs_jsThrowOrNumber(shouldThrow.bridgeJSLowerParameter()) - 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(_ shouldThrow: Int32) -> Int32 -#else -fileprivate func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func jsThrowOrBool(_ shouldThrow: Bool) throws(JSException) -> Bool { - let ret = bjs_jsThrowOrBool(shouldThrow.bridgeJSLowerParameter()) - 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(_ shouldThrow: Int32) -> Int32 -#else -fileprivate func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func jsThrowOrString(_ shouldThrow: Bool) throws(JSException) -> String { - let ret = bjs_jsThrowOrString(shouldThrow.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_runAsyncWorks") -fileprivate func bjs_runAsyncWorks() -> Int32 -#else -fileprivate func bjs_runAsyncWorks() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func runAsyncWorks() throws(JSException) -> JSPromise { - let ret = bjs_runAsyncWorks() - if let error = _swift_js_take_exception() { - throw error - } - return JSPromise.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_init") -fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_get") -fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_set") -fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void -#else -fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_prefix_get") -fileprivate func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_greet") -fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_changeName") -fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void -#else -fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -struct JsGreeter: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - init(_ name: String, _ prefix: String) throws(JSException) { - let ret = bjs_JsGreeter_init(name.bridgeJSLowerParameter(), prefix.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - self.jsObject = JSObject(id: UInt32(bitPattern: ret)) - } - - var name: String { - get throws(JSException) { - let ret = bjs_JsGreeter_name_get(self.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } - } - - func setName(_ newValue: String) throws(JSException) -> Void { - bjs_JsGreeter_name_set(self.bridgeJSLowerParameter(), newValue.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - } - - var prefix: String { - get throws(JSException) { - let ret = bjs_JsGreeter_prefix_get(self.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } - } - - func greet() throws(JSException) -> String { - let ret = bjs_JsGreeter_greet(self.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } - - func changeName(_ name: String) throws(JSException) -> Void { - bjs_JsGreeter_changeName(self.bridgeJSLowerParameter(), name.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - } - -} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift new file mode 100644 index 000000000..1f06bd2a9 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -0,0 +1,34 @@ +// 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`. + +import JavaScriptKit + +@JSFunction func jsRoundTripVoid() throws (JSException) -> Void + +@JSFunction func jsRoundTripNumber(_ v: Double) throws (JSException) -> Double + +@JSFunction func jsRoundTripBool(_ v: Bool) throws (JSException) -> Bool + +@JSFunction func jsRoundTripString(_ v: String) throws (JSException) -> String + +@JSFunction func jsThrowOrVoid(_ shouldThrow: Bool) throws (JSException) -> Void + +@JSFunction func jsThrowOrNumber(_ shouldThrow: Bool) throws (JSException) -> Double + +@JSFunction func jsThrowOrBool(_ shouldThrow: Bool) throws (JSException) -> Bool + +@JSFunction func jsThrowOrString(_ shouldThrow: Bool) throws (JSException) -> String + +@JSClass struct JsGreeter: _JSBridgedClass { + @JSGetter var name: String + @JSSetter func setName(_ value: String) throws (JSException) + @JSGetter var `prefix`: String + @JSFunction init(_ name: String, _ `prefix`: String) throws (JSException) + @JSFunction func greet() throws (JSException) -> String + @JSFunction func changeName(_ name: String) throws (JSException) -> Void +} + +@JSFunction func runAsyncWorks() throws (JSException) -> JSPromise diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift similarity index 96% rename from Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift rename to Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 0a95e88f9..e4b4bf08b 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -1,10 +1,11 @@ +// 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 +@_spi(BridgeJS) @_spi(Experimental) import JavaScriptKit #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") @@ -6163,4 +6164,271 @@ fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int3 fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripVoid") +fileprivate func bjs_jsRoundTripVoid() -> Void +#else +fileprivate func bjs_jsRoundTripVoid() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +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(_ v: Float64) -> Float64 +#else +fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +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(_ v: Int32) -> Int32 +#else +fileprivate func bjs_jsRoundTripBool(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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(_ v: Int32) -> Int32 +#else +fileprivate func bjs_jsRoundTripString(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripString(_ v: String) throws(JSException) -> String { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_jsRoundTripString(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrVoid") +fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void +#else +fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +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(_ shouldThrow: Int32) -> Float64 +#else +fileprivate func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +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(_ shouldThrow: Int32) -> Int32 +#else +fileprivate func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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(_ shouldThrow: Int32) -> Int32 +#else +fileprivate func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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_runAsyncWorks") +fileprivate func bjs_runAsyncWorks() -> Int32 +#else +fileprivate func bjs_runAsyncWorks() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$runAsyncWorks() throws(JSException) -> JSPromise { + let ret = bjs_runAsyncWorks() + if let error = _swift_js_take_exception() { + throw error + } + return JSPromise.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_init") +fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_get") +fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_prefix_get") +fileprivate func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_set") +fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_greet") +fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_changeName") +fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void +#else +fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$JsGreeter_init(_ name: String, _ prefix: String) throws(JSException) -> JSObject { + let nameValue = name.bridgeJSLowerParameter() + let prefixValue = prefix.bridgeJSLowerParameter() + let ret = bjs_JsGreeter_init(nameValue, prefixValue) + 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() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_JsGreeter_name_set(selfValue, newValueValue) + 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() + let nameValue = name.bridgeJSLowerParameter() + bjs_JsGreeter_changeName(selfValue, nameValue) + if let error = _swift_js_take_exception() { + throw error + } +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json deleted file mode 100644 index 872af0251..000000000 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ /dev/null @@ -1,8923 +0,0 @@ -{ - "classes" : [ - { - "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" : { - - } - } - } - } - } - } - ], - "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" : { - - } - } - } - } - } - }, - { - "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" - } - } - } - } - }, - "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" : { - - } - } - } - } - } - } - ], - "name" : "Greeter", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "Greeter" - }, - { - "methods" : [ - { - "abiName" : "bjs_Calculator_square", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "square", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_Calculator_add", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "add", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "int" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - } - ], - "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_Converter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_Converter_toString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "toString", - "namespace" : [ - "Utils" - ], - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "Converter", - "namespace" : [ - "Utils" - ], - "properties" : [ - - ], - "swiftCallName" : "Utils.Converter" - }, - { - "constructor" : { - "abiName" : "bjs_HTTPServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_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_TestServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_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_OptionalPropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "optionalName", - "name" : "optionalName", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "OptionalPropertyHolder", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalName", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalAge", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalGreeter", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "swiftCallName" : "OptionalPropertyHolder" - }, - { - "constructor" : { - "abiName" : "bjs_SimplePropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "SimplePropertyHolder", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "swiftCallName" : "SimplePropertyHolder" - }, - { - "constructor" : { - "abiName" : "bjs_PropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "intValue", - "name" : "intValue", - "type" : { - "int" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "computedReadWrite", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "observedProperty", - "type" : { - "int" : { - - } - } - } - ], - "swiftCallName" : "PropertyHolder" - }, - { - "methods" : [ - { - "abiName" : "bjs_MathUtils_static_add", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "add", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "int" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "className" : { - "_0" : "MathUtils" - } - } - }, - { - "abiName" : "bjs_MathUtils_static_substract", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "substract", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "int" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "className" : { - "_0" : "MathUtils" - } - } - } - ], - "name" : "MathUtils", - "properties" : [ - - ], - "swiftCallName" : "MathUtils" - }, - { - "constructor" : { - "abiName" : "bjs_ConstructorDefaults_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" : { - "int" : { - - } - } - }, - { - "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" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_ConstructorDefaults_describe", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "describe", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "ConstructorDefaults", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "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" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "swiftCallName" : "ConstructorDefaults" - }, - { - "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" : { - "int" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "optionalString", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "optionalInt", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "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" : { - "int" : { - - } - } - } - ], - "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" : { - "int" : { - - } - } - }, - { - "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" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "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" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorOptionalTag", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorOptionalTag", - "parameters" : [ - { - "label" : "_", - "name" : "tag", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorOptionalCount", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorOptionalCount", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorOptionalCount", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorOptionalCount", - "parameters" : [ - { - "label" : "_", - "name" : "count", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorDirection", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorDirection", - "parameters" : [ - { - "label" : "_", - "name" : "direction", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorTheme", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorTheme", - "parameters" : [ - { - "label" : "_", - "name" : "theme", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorHttpStatus", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorHttpStatus", - "parameters" : [ - { - "label" : "_", - "name" : "status", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorAPIResult", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "apiResult", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "DataProcessorManager", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "processor", - "type" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "backupProcessor", - "type" : { - "optional" : { - "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - } - } - } - } - ], - "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" : { - "int" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_getValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getValue", - "parameters" : [ - - ], - "returnType" : { - "int" : { - - } - } - }, - { - "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" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_createOptionalGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createOptionalGreeter", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_handleAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "handleAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_getAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getAPIResult", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "name" : "SwiftDataProcessor", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalTag", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalCount", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "direction", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalTheme", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "httpStatus", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "apiResult", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "helper", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalHelper", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "swiftCallName" : "SwiftDataProcessor" - }, - { - "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" : { - - } - } - } - } - } - } - ] - }, - "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" : [ - { - "int" : { - - } - }, - { - "string" : { - - } - }, - { - "double" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "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" : { - - } - } - } - } - } - }, - { - "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" : [ - { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "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" : [ - { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "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" : [ - { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "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" : [ - { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - }, - { - "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" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - } - } - }, - { - "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" : { - - } - } - } - } - } - } - ], - "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" : { - - } - } - } - } - } - } - ], - "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" : { - "int" : { - - } - } - } - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "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" : { - - } - } - } - } - } - } - ], - "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" : { - - } - } - } - } - } - }, - { - "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" : { - - } - } - } - } - } - }, - { - "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" : { - "int" : { - - } - } - } - } - } - }, - { - "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" : { - - } - } - } - } - } - }, - { - "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" : [ - { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "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" : [ - { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "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" : [ - { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "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" : [ - { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "name" : "TextProcessor", - "properties" : [ - - ], - "swiftCallName" : "TextProcessor" - }, - { - "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" : { - "optional" : { - "_0" : { - "swiftStruct" : { - "_0" : "Config" - } - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "Container", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "location", - "type" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "config", - "type" : { - "optional" : { - "_0" : { - "swiftStruct" : { - "_0" : "Config" - } - } - } - } - } - ], - "swiftCallName" : "Container" - } - ], - "enums" : [ - { - "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" : "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" : "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" : { - "int" : { - - } - } - } - ], - "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" : { - "int" : { - - } - } - } - ], - "name" : "error" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "location" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "status" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - } - ], - "name" : "coordinates" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - } - ], - "name" : "failure" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - } - ], - "name" : "failure" - } - ], - "emitStyle" : "const", - "name" : "NetworkingResult", - "namespace" : [ - "API" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "API.NetworkingResult", - "tsFullPath" : "API.NetworkingResult" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "name" : "failure" - }, - { - "associatedValues" : [ - { - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - }, - { - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "name" : "status" - } - ], - "emitStyle" : "const", - "name" : "APIOptionalResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "APIOptionalResult", - "tsFullPath" : "APIOptionalResult" - }, - { - "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" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "enumName" : { - "_0" : "StaticCalculator" - } - } - } - ], - "staticProperties" : [ - - ], - "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" : { - - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "StaticUtils.Nested", - "tsFullPath" : "StaticUtils.Nested" - }, - { - "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" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "enumBool", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "enumVariable", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "computedReadonly", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "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" : { - - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "namespaceConstant", - "namespace" : [ - "StaticPropertyNamespace" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "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" : { - - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "nestedConstant", - "namespace" : [ - "StaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "nestedDouble", - "namespace" : [ - "StaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "StaticPropertyNamespace.NestedProperties", - "tsFullPath" : "StaticPropertyNamespace.NestedProperties" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_roundTripVoid", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripVoid", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_roundTripInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripInt", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "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_roundTripJSObject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripJSObject", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "jsObject" : { - - } - } - } - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - }, - { - "label" : "y", - "name" : "y", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "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_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_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" : { - "int" : { - - } - } - } - ], - "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" : { - "int" : { - - } - } - } - ], - "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" : { - "int" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - }, - { - "label" : "_", - "name" : "count2", - "type" : { - "int" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - } - ], - "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" : { - "int" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - } - ], - "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_roundTripOptionalString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalString", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalInt", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalBool", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalBool", - "parameters" : [ - { - "label" : "flag", - "name" : "flag", - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalFloat", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalFloat", - "parameters" : [ - { - "label" : "number", - "name" : "number", - "type" : { - "optional" : { - "_0" : { - "float" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "float" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalDouble", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalDouble", - "parameters" : [ - { - "label" : "precision", - "name" : "precision", - "type" : { - "optional" : { - "_0" : { - "double" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "double" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalSyntax", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalSyntax", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalMixSyntax", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalMixSyntax", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalSwiftSyntax", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalSwiftSyntax", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalWithSpaces", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalWithSpaces", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "double" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "double" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTypeAlias", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTypeAlias", - "parameters" : [ - { - "label" : "age", - "name" : "age", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalStatus", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTheme", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalHttpStatus", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTSDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTSDirection", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTSTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTSTheme", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalNetworkingAPIMethod", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalNetworkingAPIMethod", - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalAPIResult", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - }, - { - "abiName" : "bjs_compareAPIResults", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "compareAPIResults", - "parameters" : [ - { - "label" : "_", - "name" : "r1", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - }, - { - "label" : "_", - "name" : "r2", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_roundTripOptionalComplexResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalComplexResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalClass", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalAPIOptionalResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalAPIOptionalResult", - "parameters" : [ - { - "label" : "result", - "name" : "result", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" - } - } - } - } - }, - { - "abiName" : "bjs_createPropertyHolder", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createPropertyHolder", - "parameters" : [ - { - "label" : "intValue", - "name" : "intValue", - "type" : { - "int" : { - - } - } - }, - { - "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_testStringDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testStringDefault", - "parameters" : [ - { - "defaultValue" : { - "string" : { - "_0" : "Hello World" - } - }, - "label" : "message", - "name" : "message", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_testIntDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testIntDefault", - "parameters" : [ - { - "defaultValue" : { - "int" : { - "_0" : 42 - } - }, - "label" : "count", - "name" : "count", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_testBoolDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testBoolDefault", - "parameters" : [ - { - "defaultValue" : { - "bool" : { - "_0" : true - } - }, - "label" : "flag", - "name" : "flag", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_testOptionalDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testOptionalDefault", - "parameters" : [ - { - "defaultValue" : { - "null" : { - - } - }, - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_testMultipleDefaults", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testMultipleDefaults", - "parameters" : [ - { - "defaultValue" : { - "string" : { - "_0" : "Default Title" - } - }, - "label" : "title", - "name" : "title", - "type" : { - "string" : { - - } - } - }, - { - "defaultValue" : { - "int" : { - "_0" : -10 - } - }, - "label" : "count", - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "defaultValue" : { - "bool" : { - "_0" : false - } - }, - "label" : "enabled", - "name" : "enabled", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_testSimpleEnumDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testSimpleEnumDefault", - "parameters" : [ - { - "defaultValue" : { - "enumCase" : { - "_0" : "Status", - "_1" : "success" - } - }, - "label" : "status", - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Status" - } - } - }, - { - "abiName" : "bjs_testDirectionDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testDirectionDefault", - "parameters" : [ - { - "defaultValue" : { - "enumCase" : { - "_0" : "Direction", - "_1" : "north" - } - }, - "label" : "direction", - "name" : "direction", - "type" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Direction" - } - } - }, - { - "abiName" : "bjs_testRawStringEnumDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testRawStringEnumDefault", - "parameters" : [ - { - "defaultValue" : { - "enumCase" : { - "_0" : "Theme", - "_1" : "light" - } - }, - "label" : "theme", - "name" : "theme", - "type" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_testComplexInit", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testComplexInit", - "parameters" : [ - { - "defaultValue" : { - "objectWithArguments" : { - "_0" : "Greeter", - "_1" : [ - { - "string" : { - "_0" : "DefaultGreeter" - } - } - ] - } - }, - "label" : "greeter", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_testEmptyInit", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testEmptyInit", - "parameters" : [ - { - "defaultValue" : { - "object" : { - "_0" : "StaticPropertyHolder" - } - }, - "label" : "_", - "name" : "object", - "type" : { - "swiftHeapObject" : { - "_0" : "StaticPropertyHolder" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "StaticPropertyHolder" - } - } - }, - { - "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" : { - - } - } - } - } - } - } - ], - "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" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_makeAdder", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAdder", - "parameters" : [ - { - "label" : "base", - "name" : "base", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "int" : { - - } - } - ], - "returnType" : { - "int" : { - - } - } - } - } - } - }, - { - "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_roundTripDataPoint", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripDataPoint", - "parameters" : [ - { - "label" : "_", - "name" : "data", - "type" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - }, - { - "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_updateValidationReport", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "updateValidationReport", - "parameters" : [ - { - "label" : "_", - "name" : "newResult", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - }, - { - "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" - } - } - } - ], - "moduleName" : "BridgeJSRuntimeTests", - "protocols" : [ - { - "methods" : [ - { - "abiName" : "bjs_DataProcessor_increment", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "increment", - "parameters" : [ - { - "label" : "by", - "name" : "amount", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_getValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getValue", - "parameters" : [ - - ], - "returnType" : { - "int" : { - - } - } - }, - { - "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" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_createOptionalGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createOptionalGreeter", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessor_handleAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "handleAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_getAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getAPIResult", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "name" : "DataProcessor", - "properties" : [ - { - "isReadonly" : false, - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "name" : "optionalTag", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "optionalCount", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "direction", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "optionalTheme", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "httpStatus", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "apiResult", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "helper", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "isReadonly" : false, - "name" : "optionalHelper", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ] - } - ], - "structs" : [ - { - "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" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "label" : "optFlag", - "name" : "optFlag", - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ] - }, - "methods" : [ - - ], - "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" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optFlag", - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "swiftCallName" : "DataPoint" - }, - { - "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" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "swiftCallName" : "Address" - }, - { - "methods" : [ - - ], - "name" : "Contact", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "age", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "address", - "type" : { - "swiftStruct" : { - "_0" : "Address" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "email", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "secondaryAddress", - "type" : { - "optional" : { - "_0" : { - "swiftStruct" : { - "_0" : "Address" - } - } - } - } - } - ], - "swiftCallName" : "Contact" - }, - { - "methods" : [ - - ], - "name" : "Config", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "theme", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "direction", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - } - ], - "swiftCallName" : "Config" - }, - { - "methods" : [ - - ], - "name" : "SessionData", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "id", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "owner", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "swiftCallName" : "SessionData" - }, - { - "methods" : [ - - ], - "name" : "ValidationReport", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "id", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "status", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "outcome", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "swiftCallName" : "ValidationReport" - }, - { - "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" : { - - } - } - }, - { - "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" : [ - - ], - "name" : "ConfigStruct", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "value", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "defaultConfig", - "staticContext" : { - "structName" : { - "_0" : "ConfigStruct" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "maxRetries", - "staticContext" : { - "structName" : { - "_0" : "ConfigStruct" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "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" - } - ] -} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json deleted file mode 100644 index 82515fecb..000000000 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "children" : [ - { - "functions" : [ - { - "name" : "jsRoundTripVoid", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "name" : "jsRoundTripNumber", - "parameters" : [ - { - "name" : "v", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "name" : "jsRoundTripBool", - "parameters" : [ - { - "name" : "v", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "name" : "jsRoundTripString", - "parameters" : [ - { - "name" : "v", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "name" : "jsThrowOrVoid", - "parameters" : [ - { - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "name" : "jsThrowOrNumber", - "parameters" : [ - { - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "name" : "jsThrowOrBool", - "parameters" : [ - { - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "name" : "jsThrowOrString", - "parameters" : [ - { - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "name" : "runAsyncWorks", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - "_0" : "JSPromise" - } - } - } - ], - "types" : [ - { - "constructor" : { - "parameters" : [ - { - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ] - }, - "methods" : [ - { - "name" : "greet", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "name" : "changeName", - "parameters" : [ - { - "name" : "name", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "JsGreeter", - "properties" : [ - { - "isReadonly" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ] - } - ] - } - ], - "moduleName" : "BridgeJSRuntimeTests" -} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json new file mode 100644 index 000000000..727508f3c --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -0,0 +1,9182 @@ +{ + "exported" : { + "classes" : [ + { + "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" : { + + } + } + } + } + } + } + ], + "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" : { + + } + } + } + } + } + }, + { + "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" + } + } + } + } + }, + "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" : { + + } + } + } + } + } + } + ], + "name" : "Greeter", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "Greeter" + }, + { + "methods" : [ + { + "abiName" : "bjs_Calculator_square", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "square", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_Calculator_add", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "add", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "int" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + } + ], + "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_Converter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_Converter_toString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "toString", + "namespace" : [ + "Utils" + ], + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Converter", + "namespace" : [ + "Utils" + ], + "properties" : [ + + ], + "swiftCallName" : "Utils.Converter" + }, + { + "constructor" : { + "abiName" : "bjs_HTTPServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_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_TestServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_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_OptionalPropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "optionalName", + "name" : "optionalName", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "OptionalPropertyHolder", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalName", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalAge", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalGreeter", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "swiftCallName" : "OptionalPropertyHolder" + }, + { + "constructor" : { + "abiName" : "bjs_SimplePropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "SimplePropertyHolder", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "SimplePropertyHolder" + }, + { + "constructor" : { + "abiName" : "bjs_PropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "intValue", + "name" : "intValue", + "type" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "computedReadWrite", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "observedProperty", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "PropertyHolder" + }, + { + "methods" : [ + { + "abiName" : "bjs_MathUtils_static_add", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "add", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "int" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "className" : { + "_0" : "MathUtils" + } + } + }, + { + "abiName" : "bjs_MathUtils_static_substract", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "substract", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "int" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "className" : { + "_0" : "MathUtils" + } + } + } + ], + "name" : "MathUtils", + "properties" : [ + + ], + "swiftCallName" : "MathUtils" + }, + { + "constructor" : { + "abiName" : "bjs_ConstructorDefaults_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" : { + "int" : { + + } + } + }, + { + "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" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_ConstructorDefaults_describe", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "describe", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "ConstructorDefaults", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "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" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "swiftCallName" : "ConstructorDefaults" + }, + { + "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" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "optionalString", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "optionalInt", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "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" : { + "int" : { + + } + } + } + ], + "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" : { + "int" : { + + } + } + }, + { + "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" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "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" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorOptionalTag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorOptionalTag", + "parameters" : [ + { + "label" : "_", + "name" : "tag", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorOptionalCount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorOptionalCount", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorOptionalCount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorOptionalCount", + "parameters" : [ + { + "label" : "_", + "name" : "count", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorDirection", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorDirection", + "parameters" : [ + { + "label" : "_", + "name" : "direction", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorTheme", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorTheme", + "parameters" : [ + { + "label" : "_", + "name" : "theme", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorHttpStatus", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "status", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorAPIResult", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "apiResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "DataProcessorManager", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "processor", + "type" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "backupProcessor", + "type" : { + "optional" : { + "_0" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + } + } + } + ], + "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" : { + "int" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_getValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getValue", + "parameters" : [ + + ], + "returnType" : { + "int" : { + + } + } + }, + { + "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" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_createOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createOptionalGreeter", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_handleAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "handleAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_getAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getAPIResult", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "name" : "SwiftDataProcessor", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalTag", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalCount", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "direction", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalTheme", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "httpStatus", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "apiResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "helper", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalHelper", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "swiftCallName" : "SwiftDataProcessor" + }, + { + "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" : { + + } + } + } + } + } + } + ] + }, + "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" : [ + { + "int" : { + + } + }, + { + "string" : { + + } + }, + { + "double" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "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" : { + + } + } + } + } + } + }, + { + "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" : [ + { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "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" : [ + { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "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" : [ + { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "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" : [ + { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "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" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + } + } + }, + { + "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" : { + + } + } + } + } + } + } + ], + "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" : { + + } + } + } + } + } + } + ], + "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" : { + "int" : { + + } + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "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" : { + + } + } + } + } + } + } + ], + "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" : { + + } + } + } + } + } + }, + { + "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" : { + + } + } + } + } + } + }, + { + "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" : { + "int" : { + + } + } + } + } + } + }, + { + "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" : { + + } + } + } + } + } + }, + { + "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" : [ + { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "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" : [ + { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "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" : [ + { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "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" : [ + { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "name" : "TextProcessor", + "properties" : [ + + ], + "swiftCallName" : "TextProcessor" + }, + { + "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" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "Container", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "location", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "config", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } + } + ], + "swiftCallName" : "Container" + } + ], + "enums" : [ + { + "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" : "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" : "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" : { + "int" : { + + } + } + } + ], + "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" : { + "int" : { + + } + } + } + ], + "name" : "error" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "location" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "status" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + } + ], + "name" : "coordinates" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + } + ], + "name" : "failure" + } + ], + "emitStyle" : "const", + "name" : "NetworkingResult", + "namespace" : [ + "API" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "API.NetworkingResult", + "tsFullPath" : "API.NetworkingResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ + { + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "name" : "status" + } + ], + "emitStyle" : "const", + "name" : "APIOptionalResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "APIOptionalResult", + "tsFullPath" : "APIOptionalResult" + }, + { + "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" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "enumName" : { + "_0" : "StaticCalculator" + } + } + } + ], + "staticProperties" : [ + + ], + "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" : { + + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "StaticUtils.Nested", + "tsFullPath" : "StaticUtils.Nested" + }, + { + "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" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "enumBool", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "enumVariable", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "computedReadonly", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "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" : { + + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "namespaceConstant", + "namespace" : [ + "StaticPropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "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" : { + + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "nestedConstant", + "namespace" : [ + "StaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedDouble", + "namespace" : [ + "StaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "StaticPropertyNamespace.NestedProperties", + "tsFullPath" : "StaticPropertyNamespace.NestedProperties" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_roundTripVoid", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripVoid", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_roundTripInt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripInt", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "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_roundTripJSObject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripJSObject", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + }, + { + "label" : "y", + "name" : "y", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "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_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_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" : { + "int" : { + + } + } + } + ], + "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" : { + "int" : { + + } + } + } + ], + "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" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + }, + { + "label" : "_", + "name" : "count2", + "type" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + } + ], + "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" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + } + ], + "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_roundTripOptionalString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalString", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalInt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalInt", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalBool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalBool", + "parameters" : [ + { + "label" : "flag", + "name" : "flag", + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalFloat", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalFloat", + "parameters" : [ + { + "label" : "number", + "name" : "number", + "type" : { + "optional" : { + "_0" : { + "float" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "float" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalDouble", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalDouble", + "parameters" : [ + { + "label" : "precision", + "name" : "precision", + "type" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalSyntax", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalSyntax", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalMixSyntax", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalMixSyntax", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalSwiftSyntax", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalSwiftSyntax", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalWithSpaces", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalWithSpaces", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalTypeAlias", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTypeAlias", + "parameters" : [ + { + "label" : "age", + "name" : "age", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalStatus", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTheme", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalHttpStatus", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalTSDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTSDirection", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalTSTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTSTheme", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalNetworkingAPIMethod", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalNetworkingAPIMethod", + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalAPIResult", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "abiName" : "bjs_compareAPIResults", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "compareAPIResults", + "parameters" : [ + { + "label" : "_", + "name" : "r1", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "label" : "_", + "name" : "r2", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_roundTripOptionalComplexResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalComplexResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalClass", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalAPIOptionalResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalAPIOptionalResult", + "parameters" : [ + { + "label" : "result", + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + } + } + } + }, + { + "abiName" : "bjs_createPropertyHolder", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createPropertyHolder", + "parameters" : [ + { + "label" : "intValue", + "name" : "intValue", + "type" : { + "int" : { + + } + } + }, + { + "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_testStringDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testStringDefault", + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "Hello World" + } + }, + "label" : "message", + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_testIntDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testIntDefault", + "parameters" : [ + { + "defaultValue" : { + "int" : { + "_0" : 42 + } + }, + "label" : "count", + "name" : "count", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_testBoolDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testBoolDefault", + "parameters" : [ + { + "defaultValue" : { + "bool" : { + "_0" : true + } + }, + "label" : "flag", + "name" : "flag", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_testOptionalDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testOptionalDefault", + "parameters" : [ + { + "defaultValue" : { + "null" : { + + } + }, + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testMultipleDefaults", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testMultipleDefaults", + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "Default Title" + } + }, + "label" : "title", + "name" : "title", + "type" : { + "string" : { + + } + } + }, + { + "defaultValue" : { + "int" : { + "_0" : -10 + } + }, + "label" : "count", + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "defaultValue" : { + "bool" : { + "_0" : false + } + }, + "label" : "enabled", + "name" : "enabled", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_testSimpleEnumDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testSimpleEnumDefault", + "parameters" : [ + { + "defaultValue" : { + "enumCase" : { + "_0" : "Status", + "_1" : "success" + } + }, + "label" : "status", + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Status" + } + } + }, + { + "abiName" : "bjs_testDirectionDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testDirectionDefault", + "parameters" : [ + { + "defaultValue" : { + "enumCase" : { + "_0" : "Direction", + "_1" : "north" + } + }, + "label" : "direction", + "name" : "direction", + "type" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Direction" + } + } + }, + { + "abiName" : "bjs_testRawStringEnumDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testRawStringEnumDefault", + "parameters" : [ + { + "defaultValue" : { + "enumCase" : { + "_0" : "Theme", + "_1" : "light" + } + }, + "label" : "theme", + "name" : "theme", + "type" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_testComplexInit", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testComplexInit", + "parameters" : [ + { + "defaultValue" : { + "objectWithArguments" : { + "_0" : "Greeter", + "_1" : [ + { + "string" : { + "_0" : "DefaultGreeter" + } + } + ] + } + }, + "label" : "greeter", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_testEmptyInit", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testEmptyInit", + "parameters" : [ + { + "defaultValue" : { + "object" : { + "_0" : "StaticPropertyHolder" + } + }, + "label" : "_", + "name" : "object", + "type" : { + "swiftHeapObject" : { + "_0" : "StaticPropertyHolder" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "StaticPropertyHolder" + } + } + }, + { + "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" : { + + } + } + } + } + } + } + ], + "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" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_makeAdder", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAdder", + "parameters" : [ + { + "label" : "base", + "name" : "base", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + }, + { + "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_roundTripDataPoint", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDataPoint", + "parameters" : [ + { + "label" : "_", + "name" : "data", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + }, + { + "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_updateValidationReport", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "updateValidationReport", + "parameters" : [ + { + "label" : "_", + "name" : "newResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "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" + } + } + } + ], + "protocols" : [ + { + "methods" : [ + { + "abiName" : "bjs_DataProcessor_increment", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "increment", + "parameters" : [ + { + "label" : "by", + "name" : "amount", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_getValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getValue", + "parameters" : [ + + ], + "returnType" : { + "int" : { + + } + } + }, + { + "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" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_createOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createOptionalGreeter", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessor_handleAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "handleAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_getAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getAPIResult", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "name" : "DataProcessor", + "properties" : [ + { + "isReadonly" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "name" : "optionalTag", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "optionalCount", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "direction", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "optionalTheme", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "httpStatus", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "apiResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "helper", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "isReadonly" : false, + "name" : "optionalHelper", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ] + } + ], + "structs" : [ + { + "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" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "label" : "optFlag", + "name" : "optFlag", + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ] + }, + "methods" : [ + + ], + "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" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optFlag", + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "swiftCallName" : "DataPoint" + }, + { + "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" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "swiftCallName" : "Address" + }, + { + "methods" : [ + + ], + "name" : "Contact", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "age", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "address", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "email", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "secondaryAddress", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Address" + } + } + } + } + } + ], + "swiftCallName" : "Contact" + }, + { + "methods" : [ + + ], + "name" : "Config", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "theme", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "direction", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + ], + "swiftCallName" : "Config" + }, + { + "methods" : [ + + ], + "name" : "SessionData", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "owner", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "swiftCallName" : "SessionData" + }, + { + "methods" : [ + + ], + "name" : "ValidationReport", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "status", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "outcome", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "swiftCallName" : "ValidationReport" + }, + { + "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" : { + + } + } + }, + { + "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" : [ + + ], + "name" : "ConfigStruct", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "value", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "defaultConfig", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "maxRetries", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "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" + } + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + + ], + "types" : [ + + ] + }, + { + "functions" : [ + { + "name" : "jsRoundTripVoid", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "jsRoundTripNumber", + "parameters" : [ + { + "name" : "v", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "name" : "jsRoundTripBool", + "parameters" : [ + { + "name" : "v", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "name" : "jsRoundTripString", + "parameters" : [ + { + "name" : "v", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "name" : "jsThrowOrVoid", + "parameters" : [ + { + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "jsThrowOrNumber", + "parameters" : [ + { + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "name" : "jsThrowOrBool", + "parameters" : [ + { + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "name" : "jsThrowOrString", + "parameters" : [ + { + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "name" : "runAsyncWorks", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "JSPromise" + } + } + } + ], + "types" : [ + { + "constructor" : { + "parameters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ] + }, + "getters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "methods" : [ + { + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "name" : "changeName", + "parameters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "JsGreeter", + "setters" : [ + { + "functionName" : "name_set", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + } + ] + }, + { + "functions" : [ + + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "BridgeJSRuntimeTests" +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts index e69de29bb..86a72ca05 100644 --- a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts +++ b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts @@ -0,0 +1,18 @@ +export function jsRoundTripVoid(): void +export function jsRoundTripNumber(v: number): number +export function jsRoundTripBool(v: boolean): boolean +export function jsRoundTripString(v: string): string +export function jsThrowOrVoid(shouldThrow: boolean): void +export function jsThrowOrNumber(shouldThrow: boolean): number +export function jsThrowOrBool(shouldThrow: boolean): boolean +export function jsThrowOrString(shouldThrow: boolean): string + +export class JsGreeter { + name: string; + readonly prefix: string; + constructor(name: string, prefix: string); + greet(): string; + changeName(name: string): void; +} + +export function runAsyncWorks(): Promise; \ No newline at end of file diff --git a/Utilities/bridge-js-generate.sh b/Utilities/bridge-js-generate.sh index b79befa2b..22182d24b 100755 --- a/Utilities/bridge-js-generate.sh +++ b/Utilities/bridge-js-generate.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash -env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package plugin --allow-writing-to-package-directory bridge-js -env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --package-path ./Benchmarks plugin --allow-writing-to-package-directory bridge-js -env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --package-path ./Examples/PlayBridgeJS plugin --allow-writing-to-package-directory bridge-js +set -euxo pipefail +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 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 4f3b593d95b25aebb143faed5af1b57777fcb547 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 17 Jan 2026 16:25:50 +0900 Subject: [PATCH 068/252] BridgeJS: Fix PackageToJS build --- .../Sources/Generated/BridgeJS.Macros.swift | 2 +- Benchmarks/Sources/Generated/BridgeJS.swift | 2 +- .../Generated/BridgeJS.Macros.swift | 2 +- .../PlayBridgeJS/Generated/BridgeJS.swift | 2 +- .../Sources/PlayBridgeJS/main.swift | 19 +++-- .../BridgeJSCore/ImportSwiftMacros.swift | 72 +++++++++++-------- .../Sources/BridgeJSTool/BridgeJSTool.swift | 3 +- .../Sources/BridgeJSUtilities/Utilities.swift | 8 +-- .../TS2Swift/JavaScript/src/processor.js | 16 ++--- .../BridgeJSToolTests/BridgeJSLinkTests.swift | 4 +- .../ImportTSTests/ArrayParameter.Macros.swift | 2 +- .../ImportTSTests/Async.Macros.swift | 2 +- .../ImportTSTests/Interface.Macros.swift | 2 +- .../InvalidPropertyNames.Macros.swift | 2 +- .../MultipleImportedTypes.Macros.swift | 2 +- .../PrimitiveParameters.Macros.swift | 2 +- .../PrimitiveReturn.Macros.swift | 2 +- .../StringParameter.Macros.swift | 2 +- .../ImportTSTests/StringReturn.Macros.swift | 2 +- .../TS2SkeletonLike.Macros.swift | 2 +- .../ImportTSTests/TypeAlias.Macros.swift | 2 +- .../TypeScriptClass.Macros.swift | 2 +- .../VoidParameterVoidReturn.Macros.swift | 2 +- Plugins/PackageToJS/Sources/PackageToJS.swift | 29 +++----- .../Sources/PackageToJSPlugin.swift | 30 +++----- .../Generated/BridgeJS.swift | 2 +- .../Generated/BridgeJS.Macros.swift | 2 +- .../Generated/BridgeJS.swift | 2 +- 28 files changed, 109 insertions(+), 112 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.Macros.swift b/Benchmarks/Sources/Generated/BridgeJS.Macros.swift index c96789495..bc2ceb32b 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.Macros.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func benchmarkHelperNoop() throws (JSException) -> Void diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index b80dbb56a..85d81f4a2 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -5,7 +5,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(BridgeJS) @_spi(Experimental) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift index feb0a2ead..053db4472 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func createTS2Swift() throws (JSException) -> TS2Swift diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift index 469f13de9..e1975b2d8 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift @@ -5,7 +5,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(BridgeJS) @_spi(Experimental) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @_expose(wasm, "bjs_PlayBridgeJS_init") @_cdecl("bjs_PlayBridgeJS_init") diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift index b82fc6f43..812c34260 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift @@ -17,11 +17,12 @@ import class Foundation.JSONDecoder } func _update(swiftSource: String, dtsSource: String) throws -> PlayBridgeJSOutput { - let exportSwift = ExportSwift(progress: .silent, moduleName: "Playground", exposeToGlobal: false) + let moduleName = "Playground" + let exportSwift = ExportSwift(progress: .silent, moduleName: moduleName, exposeToGlobal: false) let sourceFile = Parser.parse(source: swiftSource) try exportSwift.addSourceFile(sourceFile, "Playground.swift") let exportResult = try exportSwift.finalize() - var importTS = ImportTS(progress: .silent, moduleName: "Playground") + var importTS = ImportTS(progress: .silent, moduleName: moduleName) let ts2swift = try createTS2Swift() let skeletonJSONString = try ts2swift.convert(dtsSource) let decoder = JSONDecoder() @@ -32,16 +33,12 @@ import class Foundation.JSONDecoder importTS.addSkeleton(importSkeleton) let importSwiftGlue = try importTS.finalize() - let linker = BridgeJSLink( - exportedSkeletons: exportResult.map { [$0.outputSkeleton] } ?? [], - importedSkeletons: [ - ImportedModuleSkeleton( - moduleName: "Playground", - children: [importSkeleton] - ) - ], - sharedMemory: false + let skeleton = BridgeJSSkeleton( + moduleName: moduleName, + exported: exportResult.map { $0.outputSkeleton }, + imported: ImportedModuleSkeleton(children: [importSkeleton]) ) + let linker = BridgeJSLink(skeletons: [skeleton], sharedMemory: false) let linked = try linker.link() return PlayBridgeJSOutput( diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift index 90e3d7313..b4c5820df 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift @@ -155,7 +155,6 @@ public final class ImportSwiftMacros { } } - /// Extracts the jsName argument value from a @JSSetter attribute, if present. static func extractJSName(from attribute: AttributeSyntax) -> String? { guard let arguments = attribute.arguments?.as(LabeledExprListSyntax.self) else { @@ -163,8 +162,8 @@ public final class ImportSwiftMacros { } for argument in arguments { if argument.label?.text == "jsName", - let stringLiteral = argument.expression.as(StringLiteralExprSyntax.self), - let segment = stringLiteral.segments.first?.as(StringSegmentSyntax.self) + let stringLiteral = argument.expression.as(StringLiteralExprSyntax.self), + let segment = stringLiteral.segments.first?.as(StringSegmentSyntax.self) { return segment.content.text } @@ -217,7 +216,8 @@ public final class ImportSwiftMacros { jsSetter: AttributeSyntax, enclosingTypeName: String? ) -> SetterValidationResult? { - guard let effects = validateEffects(node.signature.effectSpecifiers, node: node, attributeName: "JSSetter") else { + guard let effects = validateEffects(node.signature.effectSpecifiers, node: node, attributeName: "JSSetter") + else { return nil } @@ -270,7 +270,8 @@ public final class ImportSwiftMacros { return (propertyName: propertyName, functionBaseName: functionBaseName) } - let rawFunctionName = functionName.hasPrefix("`") && functionName.hasSuffix("`") && functionName.count > 2 + let rawFunctionName = + functionName.hasPrefix("`") && functionName.hasSuffix("`") && functionName.count > 2 ? String(functionName.dropFirst().dropLast()) : functionName @@ -367,7 +368,8 @@ public final class ImportSwiftMacros { private func handleTopLevelFunction(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { if AttributeChecker.hasJSFunctionAttribute(node.attributes), - let function = parseFunction(node, enclosingTypeName: nil, isStaticMember: true) { + let function = parseFunction(node, enclosingTypeName: nil, isStaticMember: true) + { importedFunctions.append(function) return .skipChildren } @@ -392,9 +394,13 @@ public final class ImportSwiftMacros { ) -> Bool { if AttributeChecker.hasJSFunctionAttribute(node.attributes) { if isStaticMember { - parseFunction(node, enclosingTypeName: typeName, isStaticMember: true).map { importedFunctions.append($0) } + parseFunction(node, enclosingTypeName: typeName, isStaticMember: true).map { + importedFunctions.append($0) + } } else { - parseFunction(node, enclosingTypeName: typeName, isStaticMember: false).map { type.methods.append($0) } + parseFunction(node, enclosingTypeName: typeName, isStaticMember: false).map { + type.methods.append($0) + } } return true } @@ -404,11 +410,13 @@ public final class ImportSwiftMacros { errors.append( DiagnosticError( node: node, - message: "@JSSetter is not supported for static members. Use it only for instance members in @JSClass types." + message: + "@JSSetter is not supported for static members. Use it only for instance members in @JSClass types." ) ) } else if let jsSetter = AttributeChecker.firstJSSetterAttribute(node.attributes), - let setter = parseSetterSkeleton(jsSetter, node, enclosingTypeName: typeName) { + let setter = parseSetterSkeleton(jsSetter, node, enclosingTypeName: typeName) + { type.setters.append(setter) } return true @@ -440,7 +448,8 @@ public final class ImportSwiftMacros { errors.append( DiagnosticError( node: node, - message: "@JSGetter is not supported for static members. Use it only for instance members in @JSClass types." + message: + "@JSGetter is not supported for static members. Use it only for instance members in @JSClass types." ) ) } else if let getter = parseGetterSkeleton(node, enclosingTypeName: typeName) { @@ -481,29 +490,32 @@ public final class ImportSwiftMacros { } } - // MARK: - Member Collection private func collectStaticMembers(in members: MemberBlockItemListSyntax, typeName: String) { for member in members { if let function = member.decl.as(FunctionDeclSyntax.self) { if AttributeChecker.hasJSFunctionAttribute(function.attributes), - let parsed = parseFunction(function, enclosingTypeName: typeName, isStaticMember: true) { + let parsed = parseFunction(function, enclosingTypeName: typeName, isStaticMember: true) + { importedFunctions.append(parsed) } else if AttributeChecker.hasJSSetterAttribute(function.attributes) { errors.append( DiagnosticError( node: function, - message: "@JSSetter is not supported for static members. Use it only for instance members in @JSClass types." + message: + "@JSSetter is not supported for static members. Use it only for instance members in @JSClass types." ) ) } } else if let variable = member.decl.as(VariableDeclSyntax.self), - AttributeChecker.hasJSGetterAttribute(variable.attributes) { + AttributeChecker.hasJSGetterAttribute(variable.attributes) + { errors.append( DiagnosticError( node: variable, - message: "@JSGetter is not supported for static members. Use it only for instance members in @JSClass types." + message: + "@JSGetter is not supported for static members. Use it only for instance members in @JSClass types." ) ) } @@ -516,7 +528,10 @@ public final class ImportSwiftMacros { _ initializer: InitializerDeclSyntax, typeName: String ) -> ImportedConstructorSkeleton? { - guard validateEffects(initializer.signature.effectSpecifiers, node: initializer, attributeName: "JSFunction") != nil else { + guard + validateEffects(initializer.signature.effectSpecifiers, node: initializer, attributeName: "JSFunction") + != nil + else { return nil } return ImportedConstructorSkeleton( @@ -532,7 +547,8 @@ public final class ImportSwiftMacros { enclosingTypeName: String?, isStaticMember: Bool ) -> ImportedFunctionSkeleton? { - guard validateEffects(node.signature.effectSpecifiers, node: node, attributeName: "JSFunction") != nil else { + guard validateEffects(node.signature.effectSpecifiers, node: node, attributeName: "JSFunction") != nil + else { return nil } @@ -562,15 +578,15 @@ public final class ImportSwiftMacros { ) } - /// Extracts property info from a VariableDeclSyntax (binding, identifier, type) private func extractPropertyInfo( _ node: VariableDeclSyntax, errorMessage: String = "@JSGetter must declare a single stored property with an explicit type." ) -> (identifier: IdentifierPatternSyntax, type: TypeSyntax)? { guard let binding = node.bindings.first, - let identifier = binding.pattern.as(IdentifierPatternSyntax.self), - let typeAnnotation = binding.typeAnnotation else { + let identifier = binding.pattern.as(IdentifierPatternSyntax.self), + let typeAnnotation = binding.typeAnnotation + else { errors.append(DiagnosticError(node: node, message: errorMessage)) return nil } @@ -605,11 +621,13 @@ public final class ImportSwiftMacros { } let functionName = node.name.text - guard let (propertyName, functionBaseName) = PropertyNameResolver.resolve( - functionName: functionName, - jsName: validation.jsName, - normalizeIdentifier: normalizeIdentifier - ) else { + guard + let (propertyName, functionBaseName) = PropertyNameResolver.resolve( + functionName: functionName, + jsName: validation.jsName, + normalizeIdentifier: normalizeIdentifier + ) + else { return nil } @@ -621,7 +639,6 @@ public final class ImportSwiftMacros { ) } - // MARK: - Type and Parameter Parsing private func parseParameters( @@ -648,7 +665,6 @@ public final class ImportSwiftMacros { } } - private func parseType(_ type: TypeSyntax, enclosingTypeName: String?) -> BridgeType { guard let identifier = type.as(IdentifierTypeSyntax.self) else { errors.append( diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index 1f3aadf1c..eb6927852 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -218,7 +218,8 @@ private func hasBridgeJSSkipComment(_ content: String) -> Bool { } private func combineGeneratedSwift(_ pieces: [String]) -> String { - let trimmedPieces = pieces + let trimmedPieces = + pieces .map { $0.trimmingCharacters(in: .newlines) } .filter { !$0.isEmpty } guard !trimmedPieces.isEmpty else { return "" } diff --git a/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift b/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift index 1117575ab..2791aa5be 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift @@ -1,5 +1,3 @@ -import Foundation - extension String { public var capitalizedFirstLetter: String { guard !isEmpty else { return self } @@ -8,6 +6,7 @@ extension String { } public enum BridgeJSGeneratedFile { + /// The magic comment to skip processing by BridgeJS. public static let skipLine = "// bridge-js: skip" public static func hasSkipComment(_ content: String) -> Bool { @@ -15,6 +14,7 @@ public enum BridgeJSGeneratedFile { } public static var swiftPreamble: String { + // The generated Swift file itself should not be processed by BridgeJS again. """ \(skipLine) // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, @@ -23,7 +23,7 @@ public enum BridgeJSGeneratedFile { // To update this file, just rebuild your project or run // `swift package bridge-js`. - @_spi(BridgeJS) @_spi(Experimental) import JavaScriptKit - """.trimmingCharacters(in: .newlines) + @_spi(BridgeJS) import JavaScriptKit + """ } } diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index a7855797b..7a21d3619 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -78,7 +78,7 @@ export class TypeProcessor { "// To update this file, just rebuild your project or run", "// `swift package bridge-js`.", "", - "import JavaScriptKit", + "@_spi(Experimental) import JavaScriptKit", "" ); @@ -142,7 +142,7 @@ export class TypeProcessor { const returnType = this.renderBridgeType(this.visitType(signature.getReturnType(), node), node); const effects = this.renderEffects({ isAsync: false }); const swiftName = this.renderIdentifier(name); - + this.swiftLines.push(`@JSFunction func ${swiftName}(${params}) ${effects} -> ${returnType}`); this.swiftLines.push(""); } @@ -276,7 +276,7 @@ export class TypeProcessor { // Collect all declarations with their positions to preserve order /** @type {Array<{ decl: ts.Node, symbol: ts.Symbol, position: number }>} */ const allDecls = []; - + for (const symbol of members) { for (const decl of symbol.getDeclarations() ?? []) { const sourceFile = decl.getSourceFile(); @@ -284,10 +284,10 @@ export class TypeProcessor { allDecls.push({ decl, symbol, position: pos }); } } - + // Sort by position to preserve declaration order allDecls.sort((a, b) => a.position - b.position); - + // Process declarations in order for (const { decl, symbol } of allDecls) { if (symbol.flags & ts.SymbolFlags.Property) { @@ -410,10 +410,10 @@ export class TypeProcessor { const type = this.renderBridgeType(property.type, node); const name = this.renderIdentifier(property.name); - + // Always render getter this.swiftLines.push(` @JSGetter var ${name}: ${type}`); - + // Render setter if not readonly if (!property.isReadonly) { const capitalizedName = property.name.charAt(0).toUpperCase() + property.name.slice(1); @@ -441,7 +441,7 @@ export class TypeProcessor { const returnType = this.renderBridgeType(this.visitType(signature.getReturnType(), node), node); const effects = this.renderEffects({ isAsync: false }); const swiftName = this.renderIdentifier(name); - + this.swiftLines.push(` @JSFunction func ${swiftName}(${params}) ${effects} -> ${returnType}`); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift index 89f346d2a..0485adfca 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift @@ -55,7 +55,7 @@ import Testing let (_, outputSkeleton) = try #require(try swiftAPI.finalize()) let bridgeJSLink: BridgeJSLink = BridgeJSLink( skeletons: [ - BridgeJSSkeleton(moduleName: "TestModule", exported: outputSkeleton), + BridgeJSSkeleton(moduleName: "TestModule", exported: outputSkeleton) ], sharedMemory: false ) @@ -116,7 +116,7 @@ import Testing let (_, outputSkeleton) = try #require(try swiftAPI.finalize()) let bridgeJSLink: BridgeJSLink = BridgeJSLink( skeletons: [ - BridgeJSSkeleton(moduleName: "TestModule", exported: outputSkeleton), + BridgeJSSkeleton(moduleName: "TestModule", exported: outputSkeleton) ], sharedMemory: false ) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift index e5b2742ae..cf1118df0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func checkArray(_ a: JSObject) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift index 1f16ba9f1..dd0377377 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func asyncReturnVoid() throws (JSException) -> JSPromise diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift index 435d5011c..1017ded74 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func returnAnimatable() throws (JSException) -> Animatable diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift index 8bd4798df..ee6360203 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func createArrayBuffer() throws (JSException) -> ArrayBufferLike diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift index 0d5635c35..64317b792 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func createDatabaseConnection(_ config: JSObject) throws (JSException) -> DatabaseConnection diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift index 6ede7fabc..eea42f30d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift @@ -4,6 +4,6 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func check(_ a: Double, _ b: Bool) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift index 198c44c91..15867131d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func checkNumber() throws (JSException) -> Double diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift index 46643d1ee..38fe0dd2b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func checkString(_ a: String) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift index 0d2b146cb..60aae03c4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift @@ -4,6 +4,6 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func checkString() throws (JSException) -> String diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift index 7149a24a3..39998492a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func createTS2Skeleton() throws (JSException) -> TypeScriptProcessor diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift index 5724d9d47..62b2b4663 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift @@ -4,6 +4,6 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func checkSimple(_ a: Double) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift index 9f33c11e1..4026e0078 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSClass struct Greeter: _JSBridgedClass { @JSGetter var name: String diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift index 1fe58af34..b3a7fc6f6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift @@ -4,6 +4,6 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func check() throws (JSException) -> Void diff --git a/Plugins/PackageToJS/Sources/PackageToJS.swift b/Plugins/PackageToJS/Sources/PackageToJS.swift index ea99f0b09..268f3f200 100644 --- a/Plugins/PackageToJS/Sources/PackageToJS.swift +++ b/Plugins/PackageToJS/Sources/PackageToJS.swift @@ -394,10 +394,8 @@ struct PackagingPlanner { let selfPackageDir: BuildPath /// The path of this file itself, used to capture changes of planner code let selfPath: BuildPath - /// The exported API skeletons source files - let exportedSkeletons: [BuildPath] - /// The imported API skeletons source files - let importedSkeletons: [BuildPath] + /// The BridgeJS API skeletons source files + let skeletons: [BuildPath] /// The directory for the final output let outputDir: BuildPath /// The directory for intermediate files @@ -418,8 +416,7 @@ struct PackagingPlanner { packageId: String, intermediatesDir: BuildPath, selfPackageDir: BuildPath, - exportedSkeletons: [BuildPath], - importedSkeletons: [BuildPath], + skeletons: [BuildPath], outputDir: BuildPath, wasmProductArtifact: BuildPath, wasmFilename: String, @@ -431,8 +428,7 @@ struct PackagingPlanner { self.options = options self.packageId = packageId self.selfPackageDir = selfPackageDir - self.exportedSkeletons = exportedSkeletons - self.importedSkeletons = importedSkeletons + self.skeletons = skeletons self.outputDir = outputDir self.intermediatesDir = intermediatesDir self.wasmFilename = wasmFilename @@ -592,7 +588,7 @@ struct PackagingPlanner { ) packageInputs.append(packageJsonTask) - if exportedSkeletons.count > 0 || importedSkeletons.count > 0 { + if skeletons.count > 0 { if ProcessInfo.processInfo.environment["JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS"] == nil { fatalError( "BridgeJS is still an experimental feature. Set the environment variable JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 to enable." @@ -601,18 +597,13 @@ struct PackagingPlanner { let bridgeJs = outputDir.appending(path: "bridge-js.js") let bridgeDts = outputDir.appending(path: "bridge-js.d.ts") packageInputs.append( - make.addTask(inputFiles: exportedSkeletons + importedSkeletons, output: bridgeJs) { _, scope in + make.addTask(inputFiles: skeletons, output: bridgeJs) { _, scope in var link = BridgeJSLink( - exportedSkeletons: [], - importedSkeletons: [], sharedMemory: Self.isSharedMemoryEnabled(triple: triple) ) - // Decode unified skeleton format - // Unified skeleton files can contain both exported and imported parts - // Deduplicate file paths since we may have the same file in both lists - let allSkeletonPaths = Set(exportedSkeletons + importedSkeletons) - for skeletonPath in allSkeletonPaths { + // Decode skeleton format + for skeletonPath in skeletons { let data = try Data(contentsOf: URL(fileURLWithPath: scope.resolve(path: skeletonPath).path)) try link.addSkeletonFile(data: data) } @@ -734,8 +725,8 @@ struct PackagingPlanner { "USE_SHARED_MEMORY": Self.isSharedMemoryEnabled(triple: triple), "IS_WASI": triple.hasPrefix("wasm32-unknown-wasi"), "USE_WASI_CDN": options.useCDN, - "HAS_BRIDGE": exportedSkeletons.count > 0 || importedSkeletons.count > 0, - "HAS_IMPORTS": importedSkeletons.count > 0, + "HAS_BRIDGE": skeletons.count > 0, + "HAS_IMPORTS": skeletons.count > 0, "TARGET_DEFAULT_PLATFORM_NODE": options.defaultPlatform == .node, "TARGET_DEFAULT_PLATFORM_BROWSER": options.defaultPlatform == .browser, ] diff --git a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift index 32271f243..3cbd29014 100644 --- a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift +++ b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift @@ -199,7 +199,7 @@ struct PackageToJSPlugin: CommandPlugin { exit(1) } let skeletonCollector = SkeletonCollector(context: context) - let (exportedSkeletons, importedSkeletons) = skeletonCollector.collectFromProduct(name: productName) + let skeletons = skeletonCollector.collectFromProduct(name: productName) let productArtifact = try build.findWasmArtifact(for: productName) let outputDir = if let outputPath = buildOptions.packageOptions.outputPath { @@ -215,8 +215,7 @@ struct PackageToJSPlugin: CommandPlugin { options: buildOptions.packageOptions, context: context, selfPackage: selfPackage, - exportedSkeletons: exportedSkeletons, - importedSkeletons: importedSkeletons, + skeletons: skeletons, outputDir: outputDir, wasmProductArtifact: productArtifact, wasmFilename: productArtifact.lastPathComponent @@ -263,7 +262,7 @@ struct PackageToJSPlugin: CommandPlugin { } let skeletonCollector = SkeletonCollector(context: context) - let (exportedSkeletons, importedSkeletons) = skeletonCollector.collectFromTests() + let skeletons = skeletonCollector.collectFromTests() // NOTE: Find the product artifact from the default build directory // because PackageManager.BuildResult doesn't include the @@ -300,8 +299,7 @@ struct PackageToJSPlugin: CommandPlugin { options: testOptions.packageOptions, context: context, selfPackage: selfPackage, - exportedSkeletons: exportedSkeletons, - importedSkeletons: importedSkeletons, + skeletons: skeletons, outputDir: outputDir, wasmProductArtifact: productArtifact, // If the product artifact doesn't have a .wasm extension, add it @@ -714,17 +712,15 @@ class SkeletonCollector { self.context = context } - func collectFromProduct(name: String) -> (exportedSkeletons: [URL], importedSkeletons: [URL]) { + func collectFromProduct(name: String) -> [URL] { guard let product = context.package.products.first(where: { $0.name == name }) else { - return ([], []) + return [] } visit(product: product, package: context.package) - // Unified skeleton files contain both exported and imported parts - // Return the same list for both since BridgeJSLink.addSkeletonFile handles the unified format - return (skeletons, skeletons) + return skeletons } - func collectFromTests() -> (exportedSkeletons: [URL], importedSkeletons: [URL]) { + func collectFromTests() -> [URL] { let tests = context.package.targets.filter { guard let target = $0 as? SwiftSourceModuleTarget else { return false } return target.kind == .test @@ -732,9 +728,7 @@ class SkeletonCollector { for test in tests { visit(target: test, package: context.package) } - // Unified skeleton files contain both exported and imported parts - // Return the same list for both since BridgeJSLink.addSkeletonFile handles the unified format - return (skeletons, skeletons) + return skeletons } private func visit(product: Product, package: Package) { @@ -794,8 +788,7 @@ extension PackagingPlanner { options: PackageToJS.PackageOptions, context: PluginContext, selfPackage: Package, - exportedSkeletons: [URL], - importedSkeletons: [URL], + skeletons: [URL], outputDir: URL, wasmProductArtifact: URL, wasmFilename: String @@ -810,8 +803,7 @@ extension PackagingPlanner { absolute: context.pluginWorkDirectoryURL.appending(path: outputBaseName + ".tmp").path ), selfPackageDir: BuildPath(absolute: selfPackage.directoryURL.path), - exportedSkeletons: exportedSkeletons.map { BuildPath(absolute: $0.path) }, - importedSkeletons: importedSkeletons.map { BuildPath(absolute: $0.path) }, + skeletons: skeletons.map { BuildPath(absolute: $0.path) }, outputDir: BuildPath(absolute: outputDir.path), wasmProductArtifact: BuildPath(absolute: wasmProductArtifact.path), wasmFilename: wasmFilename, diff --git a/Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift b/Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift index 3a41f337e..aaa5f1b8a 100644 --- a/Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift @@ -5,7 +5,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(BridgeJS) @_spi(Experimental) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit extension GlobalNetworking.API.CallMethod: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index 1f06bd2a9..f65f5d23c 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit @JSFunction func jsRoundTripVoid() throws (JSException) -> Void diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index e4b4bf08b..1b39e77b8 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -5,7 +5,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(BridgeJS) @_spi(Experimental) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") From 233f1dc944a923bc38aaed13a79a00c9d42af894 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 17 Jan 2026 17:08:17 +0900 Subject: [PATCH 069/252] BridgeJS: Fix PlayBridgeJS build --- .../PlayBridgeJS/Sources/JavaScript/app.js | 6 ++-- .../PlayBridgeJS/Sources/JavaScript/editor.js | 22 ++++++------ .../Sources/JavaScript/processor.js | 2 +- .../PlayBridgeJS/Generated/BridgeJS.swift | 16 ++++----- .../Generated/JavaScript/BridgeJS.json | 8 ++--- .../Sources/PlayBridgeJS/main.swift | 36 +++++++++---------- Examples/PlayBridgeJS/index.html | 12 +++---- .../TS2Swift/JavaScript/src/processor.js | 9 ++--- .../BridgeJSToolTests/ImportTSTests.swift | 8 +---- 9 files changed, 53 insertions(+), 66 deletions(-) diff --git a/Examples/PlayBridgeJS/Sources/JavaScript/app.js b/Examples/PlayBridgeJS/Sources/JavaScript/app.js index b82810238..7da78e038 100644 --- a/Examples/PlayBridgeJS/Sources/JavaScript/app.js +++ b/Examples/PlayBridgeJS/Sources/JavaScript/app.js @@ -250,9 +250,9 @@ export class BridgeJSPlayground { // Process the TypeScript definitions to generate skeleton const processor = new TypeProcessor(tsProgram.getTypeChecker(), diagnosticEngine); - const skeleton = processor.processTypeDeclarations(tsProgram, virtualFilePath); + const { content } = processor.processTypeDeclarations(tsProgram, virtualFilePath); - return JSON.stringify(skeleton); + return content; } } } @@ -340,4 +340,4 @@ export class BridgeJSPlayground { this.progressBar.classList.add('hidden'); } } -} \ No newline at end of file +} diff --git a/Examples/PlayBridgeJS/Sources/JavaScript/editor.js b/Examples/PlayBridgeJS/Sources/JavaScript/editor.js index dabe7dc5b..dc3d362eb 100644 --- a/Examples/PlayBridgeJS/Sources/JavaScript/editor.js +++ b/Examples/PlayBridgeJS/Sources/JavaScript/editor.js @@ -38,20 +38,20 @@ export class EditorSystem { modelUri: 'Playground.d.ts' }, { - key: 'import-glue', - id: 'importGlueOutput', + key: 'swift-import-macros', + id: 'swiftImportMacrosOutput', language: 'swift', - placeholder: '// Import Swift Glue will appear here...', + placeholder: '// Import Swift Macros will appear here...', readOnly: true, - modelUri: 'ImportTS.swift' + modelUri: 'BridgeJS.Macros.swift' }, { - key: 'export-glue', - id: 'exportGlueOutput', + key: 'swift-glue', + id: 'swiftGlueOutput', language: 'swift', - placeholder: '// Export Swift Glue will appear here...', + placeholder: '// Swift Glue will appear here...', readOnly: true, - modelUri: 'ExportTS.swift' + modelUri: 'BridgeJS.swift' }, { key: 'js-generated', @@ -206,8 +206,8 @@ export class EditorSystem { updateOutputs(result) { const outputMap = { - 'import-glue': () => result.importSwiftGlue(), - 'export-glue': () => result.exportSwiftGlue(), + 'swift-glue': () => result.swiftGlue(), + 'swift-import-macros': () => result.importSwiftMacroDecls(), 'js-generated': () => result.outputJs(), 'dts-generated': () => result.outputDts() }; @@ -238,4 +238,4 @@ export class EditorSystem { getActiveTabs() { return this.activeTabs; } -} \ No newline at end of file +} diff --git a/Examples/PlayBridgeJS/Sources/JavaScript/processor.js b/Examples/PlayBridgeJS/Sources/JavaScript/processor.js index 61c833925..646254cd4 120000 --- a/Examples/PlayBridgeJS/Sources/JavaScript/processor.js +++ b/Examples/PlayBridgeJS/Sources/JavaScript/processor.js @@ -1 +1 @@ -../../../../Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/processor.js \ No newline at end of file +../../../../Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift index e1975b2d8..f97c181d9 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift @@ -90,22 +90,22 @@ public func _bjs_PlayBridgeJSOutput_outputDts(_ _self: UnsafeMutableRawPointer) #endif } -@_expose(wasm, "bjs_PlayBridgeJSOutput_importSwiftGlue") -@_cdecl("bjs_PlayBridgeJSOutput_importSwiftGlue") -public func _bjs_PlayBridgeJSOutput_importSwiftGlue(_ _self: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_PlayBridgeJSOutput_importSwiftMacroDecls") +@_cdecl("bjs_PlayBridgeJSOutput_importSwiftMacroDecls") +public func _bjs_PlayBridgeJSOutput_importSwiftMacroDecls(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).importSwiftGlue() + let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).importSwiftMacroDecls() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_PlayBridgeJSOutput_exportSwiftGlue") -@_cdecl("bjs_PlayBridgeJSOutput_exportSwiftGlue") -public func _bjs_PlayBridgeJSOutput_exportSwiftGlue(_ _self: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_PlayBridgeJSOutput_swiftGlue") +@_cdecl("bjs_PlayBridgeJSOutput_swiftGlue") +public func _bjs_PlayBridgeJSOutput_swiftGlue(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).exportSwiftGlue() + let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).swiftGlue() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json index c1cf453d3..1cf8e64c6 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json @@ -92,13 +92,13 @@ } }, { - "abiName" : "bjs_PlayBridgeJSOutput_importSwiftGlue", + "abiName" : "bjs_PlayBridgeJSOutput_importSwiftMacroDecls", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "importSwiftGlue", + "name" : "importSwiftMacroDecls", "parameters" : [ ], @@ -109,13 +109,13 @@ } }, { - "abiName" : "bjs_PlayBridgeJSOutput_exportSwiftGlue", + "abiName" : "bjs_PlayBridgeJSOutput_swiftGlue", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "exportSwiftGlue", + "name" : "swiftGlue", "parameters" : [ ], diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift index 812c34260..e7f70311d 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift @@ -22,21 +22,17 @@ import class Foundation.JSONDecoder let sourceFile = Parser.parse(source: swiftSource) try exportSwift.addSourceFile(sourceFile, "Playground.swift") let exportResult = try exportSwift.finalize() - var importTS = ImportTS(progress: .silent, moduleName: moduleName) let ts2swift = try createTS2Swift() - let skeletonJSONString = try ts2swift.convert(dtsSource) - let decoder = JSONDecoder() - let importSkeleton = try decoder.decode( - ImportedFileSkeleton.self, - from: skeletonJSONString.data(using: .utf8)! - ) - importTS.addSkeleton(importSkeleton) - let importSwiftGlue = try importTS.finalize() - + let importSwiftMacroDecls = try ts2swift.convert(dtsSource) + let importSwift = ImportSwiftMacros(progress: .silent, moduleName: moduleName) + let importSourceFile = Parser.parse(source: importSwiftMacroDecls) + importSwift.addSourceFile(importSourceFile, "Playground.Macros.swift") + importSwift.addSourceFile(sourceFile, "Playground.swift") + let importResult = try importSwift.finalize() let skeleton = BridgeJSSkeleton( moduleName: moduleName, exported: exportResult.map { $0.outputSkeleton }, - imported: ImportedModuleSkeleton(children: [importSkeleton]) + imported: importResult.outputSkeleton ) let linker = BridgeJSLink(skeletons: [skeleton], sharedMemory: false) let linked = try linker.link() @@ -44,8 +40,8 @@ import class Foundation.JSONDecoder return PlayBridgeJSOutput( outputJs: linked.outputJs, outputDts: linked.outputDts, - importSwiftGlue: importSwiftGlue ?? "", - exportSwiftGlue: exportResult?.outputSwift ?? "" + importSwiftMacroDecls: importSwiftMacroDecls, + swiftGlue: (importResult.outputSwift ?? "") + "\n\n" + (exportResult?.outputSwift ?? "") ) } } @@ -53,18 +49,18 @@ import class Foundation.JSONDecoder @JS class PlayBridgeJSOutput { let _outputJs: String let _outputDts: String - let _importSwiftGlue: String - let _exportSwiftGlue: String + let _importSwiftMacroDecls: String + let _swiftGlue: String - init(outputJs: String, outputDts: String, importSwiftGlue: String, exportSwiftGlue: String) { + init(outputJs: String, outputDts: String, importSwiftMacroDecls: String, swiftGlue: String) { self._outputJs = outputJs self._outputDts = outputDts - self._importSwiftGlue = importSwiftGlue - self._exportSwiftGlue = exportSwiftGlue + self._importSwiftMacroDecls = importSwiftMacroDecls + self._swiftGlue = swiftGlue } @JS func outputJs() -> String { self._outputJs } @JS func outputDts() -> String { self._outputDts } - @JS func importSwiftGlue() -> String { self._importSwiftGlue } - @JS func exportSwiftGlue() -> String { self._exportSwiftGlue } + @JS func importSwiftMacroDecls() -> String { self._importSwiftMacroDecls } + @JS func swiftGlue() -> String { self._swiftGlue } } diff --git a/Examples/PlayBridgeJS/index.html b/Examples/PlayBridgeJS/index.html index 799c36a19..1dd07fe2a 100644 --- a/Examples/PlayBridgeJS/index.html +++ b/Examples/PlayBridgeJS/index.html @@ -84,15 +84,15 @@

        Output

        + - - +
        -
        -
        +
        +
        -
        -
        +
        +
        diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 7a21d3619..830c0d0a8 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -5,7 +5,6 @@ // @ts-check import ts from 'typescript'; -import path from 'path'; /** @typedef {import('./index.d.ts').Parameter} Parameter */ /** @typedef {import('./index.d.ts').BridgeType} BridgeType */ @@ -64,11 +63,9 @@ export class TypeProcessor { * @returns {{ content: string, hasAny: boolean }} Rendered Swift code */ processTypeDeclarations(program, inputFilePath) { - const normalizedInput = path.resolve(inputFilePath); - const sourceFiles = program.getSourceFiles().filter(sf => { - if (!sf.isDeclarationFile) return true; - return path.resolve(sf.fileName) === normalizedInput; - }); + const sourceFiles = program.getSourceFiles().filter( + sf => !sf.isDeclarationFile || sf.fileName === inputFilePath + ); // Add prelude this.swiftLines.push( diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift index f56fbfb6d..0a3101f11 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift @@ -22,7 +22,6 @@ import SwiftParser let nodePath = try #require(which("node")) let tsconfigPath = url.deletingLastPathComponent().appendingPathComponent("tsconfig.json") - // Use the new workflow: invokeTS2Swift -> ImportSwiftMacros -> ImportTS let swiftSource = try invokeTS2Swift( dtsFile: url.path, tsconfigPath: tsconfigPath.path, @@ -42,12 +41,7 @@ import SwiftParser importSwift.addSourceFile(sourceFile, "\(name).Macros.swift") let importResult = try importSwift.finalize() - var api = ImportTS(progress: .silent, moduleName: "Check") - for child in importResult.outputSkeleton.children { - api.addSkeleton(child) - } - - let outputSwift = try #require(try api.finalize()) + let outputSwift = try #require(importResult.outputSwift) try assertSnapshot( name: name, filePath: #filePath, From 61290eb0abc93daf877bd8d4e4e4dd9f84d859b5 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 17 Jan 2026 17:51:30 +0900 Subject: [PATCH 070/252] BridgeJS: Fix PackagingPlannerTests build --- Plugins/PackageToJS/Tests/PackagingPlannerTests.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Plugins/PackageToJS/Tests/PackagingPlannerTests.swift b/Plugins/PackageToJS/Tests/PackagingPlannerTests.swift index 03fc4c9cc..3e0d67a3e 100644 --- a/Plugins/PackageToJS/Tests/PackagingPlannerTests.swift +++ b/Plugins/PackageToJS/Tests/PackagingPlannerTests.swift @@ -65,8 +65,7 @@ import Testing packageId: "test", intermediatesDir: BuildPath(prefix: "INTERMEDIATES"), selfPackageDir: BuildPath(prefix: "SELF_PACKAGE"), - exportedSkeletons: [], - importedSkeletons: [], + skeletons: [], outputDir: BuildPath(prefix: "OUTPUT"), wasmProductArtifact: BuildPath(prefix: "WASM_PRODUCT_ARTIFACT"), wasmFilename: "main.wasm", @@ -96,8 +95,7 @@ import Testing packageId: "test", intermediatesDir: BuildPath(prefix: "INTERMEDIATES"), selfPackageDir: BuildPath(prefix: "SELF_PACKAGE"), - exportedSkeletons: [], - importedSkeletons: [], + skeletons: [], outputDir: BuildPath(prefix: "OUTPUT"), wasmProductArtifact: BuildPath(prefix: "WASM_PRODUCT_ARTIFACT"), wasmFilename: "main.wasm", From 702b9668de51069bf946356615f22af4032cff5f Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 17 Jan 2026 20:29:48 +0900 Subject: [PATCH 071/252] PackageToJS: Use toolset file to set linker flags in tests -Xlinker options are passed to host linker as well (for linking macro plugins), which causes issues. Use a toolset file to set the options only for the target being built. --- Plugins/PackageToJS/Package.swift | 2 +- Plugins/PackageToJS/Tests/ExampleTests.swift | 7 +++---- Plugins/PackageToJS/Tests/Inputs/example-toolset.json | 6 ++++++ 3 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 Plugins/PackageToJS/Tests/Inputs/example-toolset.json diff --git a/Plugins/PackageToJS/Package.swift b/Plugins/PackageToJS/Package.swift index 57ccf3cf9..fc3faa81c 100644 --- a/Plugins/PackageToJS/Package.swift +++ b/Plugins/PackageToJS/Package.swift @@ -10,7 +10,7 @@ let package = Package( .testTarget( name: "PackageToJSTests", dependencies: ["PackageToJS"], - exclude: ["__Snapshots__"] + exclude: ["__Snapshots__", "Inputs"] ), ] ) diff --git a/Plugins/PackageToJS/Tests/ExampleTests.swift b/Plugins/PackageToJS/Tests/ExampleTests.swift index 6e2b4e1c2..01c02c193 100644 --- a/Plugins/PackageToJS/Tests/ExampleTests.swift +++ b/Plugins/PackageToJS/Tests/ExampleTests.swift @@ -236,10 +236,9 @@ extension Trait where Self == ConditionTrait { /// FIXME: swift-testing uses too much stack space, so we need to increase the stack size for tests using swift-testing. static var stackSizeLinkerFlags: [String] { [ - "-Xlinker", "--stack-first", - "-Xlinker", "-z", - "-Xlinker", "stack-size=524288", - "-Xlinker", "--global-base=524288", + "--toolset", + URL(fileURLWithPath: #filePath).deletingLastPathComponent().appending(path: "Inputs/example-toolset.json") + .path, ] } diff --git a/Plugins/PackageToJS/Tests/Inputs/example-toolset.json b/Plugins/PackageToJS/Tests/Inputs/example-toolset.json new file mode 100644 index 000000000..307777db3 --- /dev/null +++ b/Plugins/PackageToJS/Tests/Inputs/example-toolset.json @@ -0,0 +1,6 @@ +{ + "schemaVersion" : "1.0", + "linker": { + "extraCLIOptions": ["--stack-first", "-z", "stack-size=524288", "--global-base=524288"] + } +} From c97a618451469cbd1cfad31bbfcb25f615c1a0a2 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 20 Jan 2026 22:26:28 +0700 Subject: [PATCH 072/252] chore: Update main README.md to highlight BridgeJS and link more articles from Documentation --- README.md | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c18cc1ccf..6a0acaa27 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # JavaScriptKit [![Run unit tests](https://github.com/swiftwasm/JavaScriptKit/actions/workflows/test.yml/badge.svg)](https://github.com/swiftwasm/JavaScriptKit/actions/workflows/test.yml) -[![](https://img.shields.io/badge/docc-read_documentation-blue)](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation) +[![Documentation](https://img.shields.io/badge/docc-read_documentation-blue)](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation) Swift framework to interact with JavaScript through WebAssembly. @@ -40,7 +40,81 @@ button.onclick = .object(JSClosure { _ in _ = document.body.appendChild(button) ``` -Check out the [examples](https://github.com/swiftwasm/JavaScriptKit/tree/main/Examples) for more detailed usage. +**Learn more:** [JavaScript Interop Cheat Sheet](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/javascript-interop-cheat-sheet) + +## BridgeJS Plugin + +> **Note:** BridgeJS is experimental. APIs may change in future releases. + +BridgeJS provides easy interoperability between Swift and JavaScript/TypeScript. It enables: + +- **Exporting Swift APIs to JavaScript**: Make your Swift code callable from JavaScript +- **Importing TypeScript APIs into Swift**: Use JavaScript APIs with type safety in Swift + +For architecture details, see the [BridgeJS Plugin README](Plugins/BridgeJS/README.md). + +### Exporting Swift to JavaScript + +Mark Swift code with `@JS` to make it callable from JavaScript: + +```swift +import JavaScriptKit + +@JS class Greeter { + @JS var name: String + + @JS init(name: String) { + self.name = name + } + + @JS func greet() -> String { + return "Hello, \(name)!" + } +} +``` + +**JavaScript usage:** +```javascript +const greeter = new exports.Greeter("World"); +console.log(greeter.greet()); // "Hello, World!" +``` + +**Learn more:** [Exporting Swift to JavaScript](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/exporting-swift-to-javascript) + +### Importing TypeScript into Swift + +Define TypeScript interfaces and BridgeJS generates type-safe Swift bindings: + +```typescript +// bridge-js.d.ts +interface Document { + title: string; + getElementById(id: string): HTMLElement; + createElement(tagName: string): HTMLElement; +} + +export function getDocument(): Document; +``` + +**Swift usage:** +```swift +@JS func run() throws(JSException) { + let document = try getDocument() + try document.setTitle("My Swift App") + let button = try document.createElement("button") + try button.setInnerText("Click Me") +} +``` + +**Learn more:** [Importing TypeScript into Swift](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/importing-typescript-into-swift) + +### Try It Online + +Use the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/) to preview what interfaces will be exposed on the Swift/TypeScript sides. + +## Examples + +Check out the [examples](https://github.com/swiftwasm/JavaScriptKit/tree/main/Examples) for more detailed usage patterns. ## Contributing From 58f2f1b4c93b29d748e0f6e043125cc5ebba51ef Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 21 Jan 2026 16:40:00 +0900 Subject: [PATCH 073/252] - Updated `@JSClass` to synthesize `_JSBridgedClass` conformance via an attached extension (`Sources/JavaScriptKit/Macros.swift:176`, `Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift:56`). - Removed `: _JSBridgedClass` from TS2Swift output so generated wrappers are just `@JSClass struct Name { ... }` (`Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js:216`). - Updated BridgeJS snapshots + generated fixtures to match (`Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/*.Macros.swift`, `Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift:25`, `Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift:11`). - `swift test --package-path ./Plugins/BridgeJS` now passes (after installing JS deps with `npm ci`). --- .../Generated/BridgeJS.Macros.swift | 2 +- .../Sources/BridgeJSMacros/JSClassMacro.swift | 18 ++++ .../TS2Swift/JavaScript/src/processor.js | 4 +- .../JSClassMacroTests.swift | 85 ++++++++++++++++--- .../ImportTSTests/Interface.Macros.swift | 2 +- .../InvalidPropertyNames.Macros.swift | 4 +- .../MultipleImportedTypes.Macros.swift | 6 +- .../TS2SkeletonLike.Macros.swift | 4 +- .../TypeScriptClass.Macros.swift | 2 +- Sources/JavaScriptKit/JSBridgedType.swift | 2 +- Sources/JavaScriptKit/Macros.swift | 3 +- .../Generated/BridgeJS.Macros.swift | 2 +- 12 files changed, 107 insertions(+), 27 deletions(-) diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift index 053db4472..221302716 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift @@ -8,6 +8,6 @@ @JSFunction func createTS2Swift() throws (JSException) -> TS2Swift -@JSClass struct TS2Swift: _JSBridgedClass { +@JSClass struct TS2Swift { @JSFunction func convert(_ ts: String) throws (JSException) -> String } diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift index fc7af6cda..060d2269b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift @@ -9,6 +9,7 @@ extension JSClassMacro: MemberMacro { public static func expansion( of node: AttributeSyntax, providingMembersOf declaration: some DeclGroupSyntax, + conformingTo protocols: [TypeSyntax], in context: some MacroExpansionContext ) throws -> [DeclSyntax] { var members: [DeclSyntax] = [] @@ -49,3 +50,20 @@ extension JSClassMacro: MemberMacro { return members } } + +extension JSClassMacro: ExtensionMacro { + public static func expansion( + of node: AttributeSyntax, + attachedTo declaration: some DeclGroupSyntax, + providingExtensionsOf type: some TypeSyntaxProtocol, + conformingTo protocols: [TypeSyntax], + in context: some MacroExpansionContext + ) throws -> [ExtensionDeclSyntax] { + guard !protocols.isEmpty else { return [] } + + let conformanceList = protocols.map { $0.trimmed.description }.joined(separator: ", ") + return [ + try ExtensionDeclSyntax("extension \(type.trimmed): \(raw: conformanceList) {}") + ] + } +} diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 830c0d0a8..47a4a1ac1 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -213,7 +213,7 @@ export class TypeProcessor { if (!node.name) return; const className = this.renderIdentifier(node.name.text); - this.swiftLines.push(`@JSClass struct ${className}: _JSBridgedClass {`); + this.swiftLines.push(`@JSClass struct ${className} {`); // Process members in declaration order for (const member of node.members) { @@ -268,7 +268,7 @@ export class TypeProcessor { */ visitStructuredType(name, members) { const typeName = this.renderIdentifier(name); - this.swiftLines.push(`@JSClass struct ${typeName}: _JSBridgedClass {`); + this.swiftLines.push(`@JSClass struct ${typeName} {`); // Collect all declarations with their positions to preserve order /** @type {Array<{ decl: ts.Node, symbol: ts.Symbol, position: number }>} */ diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift index 5997d3052..95e3893ed 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift @@ -1,5 +1,6 @@ import SwiftDiagnostics import SwiftSyntax +import SwiftSyntaxMacroExpansion import SwiftSyntaxMacros import SwiftSyntaxMacrosTestSupport import Testing @@ -7,6 +8,9 @@ import BridgeJSMacros @Suite struct JSClassMacroTests { private let indentationWidth: Trivia = .spaces(4) + private let macroSpecs: [String: MacroSpec] = [ + "JSClass": MacroSpec(type: JSClassMacro.self, conformances: ["_JSBridgedClass"]) + ] @Test func emptyStruct() { assertMacroExpansion( @@ -23,8 +27,11 @@ import BridgeJSMacros self.jsObject = jsObject } } + + extension MyClass: _JSBridgedClass { + } """, - macros: ["JSClass": JSClassMacro.self], + macroSpecs: macroSpecs, indentationWidth: indentationWidth ) } @@ -45,8 +52,11 @@ import BridgeJSMacros self.jsObject = jsObject } } + + extension MyClass: _JSBridgedClass { + } """, - macros: ["JSClass": JSClassMacro.self], + macroSpecs: macroSpecs, indentationWidth: indentationWidth ) } @@ -69,8 +79,11 @@ import BridgeJSMacros self.jsObject = jsObject } } + + extension MyClass: _JSBridgedClass { + } """, - macros: ["JSClass": JSClassMacro.self], + macroSpecs: macroSpecs, indentationWidth: indentationWidth ) } @@ -95,8 +108,11 @@ import BridgeJSMacros self.jsObject = jsObject } } + + extension MyClass: _JSBridgedClass { + } """, - macros: ["JSClass": JSClassMacro.self], + macroSpecs: macroSpecs, indentationWidth: indentationWidth ) } @@ -119,8 +135,11 @@ import BridgeJSMacros self.jsObject = jsObject } } + + extension MyClass: _JSBridgedClass { + } """, - macros: ["JSClass": JSClassMacro.self], + macroSpecs: macroSpecs, indentationWidth: indentationWidth ) } @@ -140,8 +159,11 @@ import BridgeJSMacros self.jsObject = jsObject } } + + extension MyClass: _JSBridgedClass { + } """, - macros: ["JSClass": JSClassMacro.self], + macroSpecs: macroSpecs, indentationWidth: indentationWidth ) } @@ -161,8 +183,11 @@ import BridgeJSMacros self.jsObject = jsObject } } + + extension MyEnum: _JSBridgedClass { + } """, - macros: ["JSClass": JSClassMacro.self], + macroSpecs: macroSpecs, indentationWidth: indentationWidth ) } @@ -182,8 +207,11 @@ import BridgeJSMacros self.jsObject = jsObject } } + + extension MyActor: _JSBridgedClass { + } """, - macros: ["JSClass": JSClassMacro.self], + macroSpecs: macroSpecs, indentationWidth: indentationWidth ) } @@ -206,8 +234,11 @@ import BridgeJSMacros self.jsObject = jsObject } } + + extension MyClass: _JSBridgedClass { + } """, - macros: ["JSClass": JSClassMacro.self], + macroSpecs: macroSpecs, indentationWidth: indentationWidth ) } @@ -232,8 +263,11 @@ import BridgeJSMacros self.jsObject = jsObject } } + + extension MyClass: _JSBridgedClass { + } """, - macros: ["JSClass": JSClassMacro.self], + macroSpecs: macroSpecs, indentationWidth: indentationWidth ) } @@ -258,8 +292,11 @@ import BridgeJSMacros self.jsObject = jsObject } } + + extension MyClass: _JSBridgedClass { + } """, - macros: ["JSClass": JSClassMacro.self], + macroSpecs: macroSpecs, indentationWidth: indentationWidth ) } @@ -281,8 +318,32 @@ import BridgeJSMacros self.jsObject = jsObject } } + + extension MyClass: _JSBridgedClass { + } + """, + macroSpecs: macroSpecs, + indentationWidth: indentationWidth + ) + } + + @Test func structAlreadyConforms() { + assertMacroExpansion( + """ + @JSClass + struct MyClass: _JSBridgedClass { + } + """, + expandedSource: """ + struct MyClass: _JSBridgedClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } """, - macros: ["JSClass": JSClassMacro.self], + macroSpecs: macroSpecs, indentationWidth: indentationWidth ) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift index 1017ded74..5d13234ca 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift @@ -8,7 +8,7 @@ @JSFunction func returnAnimatable() throws (JSException) -> Animatable -@JSClass struct Animatable: _JSBridgedClass { +@JSClass struct Animatable { @JSFunction func animate(_ keyframes: JSObject, _ options: JSObject) throws (JSException) -> JSObject @JSFunction func getAnimations(_ options: JSObject) throws (JSException) -> JSObject } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift index ee6360203..6fa9b6d8c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift @@ -8,14 +8,14 @@ @JSFunction func createArrayBuffer() throws (JSException) -> ArrayBufferLike -@JSClass struct ArrayBufferLike: _JSBridgedClass { +@JSClass struct ArrayBufferLike { @JSGetter var byteLength: Double @JSFunction func slice(_ begin: Double, _ end: Double) throws (JSException) -> ArrayBufferLike } @JSFunction func createWeirdObject() throws (JSException) -> WeirdNaming -@JSClass struct WeirdNaming: _JSBridgedClass { +@JSClass struct WeirdNaming { @JSGetter var normalProperty: String @JSSetter func setNormalProperty(_ value: String) throws (JSException) @JSGetter var `for`: String diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift index 64317b792..47efcbc84 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift @@ -8,7 +8,7 @@ @JSFunction func createDatabaseConnection(_ config: JSObject) throws (JSException) -> DatabaseConnection -@JSClass struct DatabaseConnection: _JSBridgedClass { +@JSClass struct DatabaseConnection { @JSFunction func connect(_ url: String) throws (JSException) -> Void @JSFunction func execute(_ query: String) throws (JSException) -> JSObject @JSGetter var isConnected: Bool @@ -18,7 +18,7 @@ @JSFunction func createLogger(_ level: String) throws (JSException) -> Logger -@JSClass struct Logger: _JSBridgedClass { +@JSClass struct Logger { @JSFunction func log(_ message: String) throws (JSException) -> Void @JSFunction func error(_ message: String, _ error: JSObject) throws (JSException) -> Void @JSGetter var level: String @@ -26,7 +26,7 @@ @JSFunction func getConfigManager() throws (JSException) -> ConfigManager -@JSClass struct ConfigManager: _JSBridgedClass { +@JSClass struct ConfigManager { @JSFunction func get(_ key: String) throws (JSException) -> JSObject @JSFunction func set(_ key: String, _ value: JSObject) throws (JSException) -> Void @JSGetter var configPath: String diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift index 39998492a..e0d6c9d24 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift @@ -8,7 +8,7 @@ @JSFunction func createTS2Skeleton() throws (JSException) -> TypeScriptProcessor -@JSClass struct TypeScriptProcessor: _JSBridgedClass { +@JSClass struct TypeScriptProcessor { @JSFunction func convert(_ ts: String) throws (JSException) -> String @JSFunction func validate(_ ts: String) throws (JSException) -> Bool @JSGetter var version: String @@ -16,7 +16,7 @@ @JSFunction func createCodeGenerator(_ format: String) throws (JSException) -> CodeGenerator -@JSClass struct CodeGenerator: _JSBridgedClass { +@JSClass struct CodeGenerator { @JSFunction func generate(_ input: JSObject) throws (JSException) -> String @JSGetter var outputFormat: String } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift index 4026e0078..1fbf3376d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift @@ -6,7 +6,7 @@ @_spi(Experimental) import JavaScriptKit -@JSClass struct Greeter: _JSBridgedClass { +@JSClass struct Greeter { @JSGetter var name: String @JSSetter func setName(_ value: String) throws (JSException) @JSGetter var age: Double diff --git a/Sources/JavaScriptKit/JSBridgedType.swift b/Sources/JavaScriptKit/JSBridgedType.swift index 8f5cf55a2..bb23cc00c 100644 --- a/Sources/JavaScriptKit/JSBridgedType.swift +++ b/Sources/JavaScriptKit/JSBridgedType.swift @@ -15,7 +15,7 @@ extension JSBridgedType { /// A protocol that Swift classes that are exposed to JavaScript via `@JS class` conform to. /// -/// The conformance is automatically synthesized by the BridgeJS code generator. +/// The conformance is automatically synthesized by `@JSClass` for BridgeJS-generated declarations. public protocol _JSBridgedClass { /// The JavaScript object wrapped by this instance. /// You may assume that `jsObject instanceof Self.constructor == true` diff --git a/Sources/JavaScriptKit/Macros.swift b/Sources/JavaScriptKit/Macros.swift index 9e11db3b4..8cc3dbc64 100644 --- a/Sources/JavaScriptKit/Macros.swift +++ b/Sources/JavaScriptKit/Macros.swift @@ -174,7 +174,7 @@ public macro JSFunction() = /// @_spi(Experimental) import JavaScriptKit /// /// @JSClass -/// struct JsGreeter: _JSBridgedClass { +/// struct JsGreeter { /// @JSGetter var name: String /// @JSSetter func setName(_ value: String) throws (JSException) /// @JSFunction init(_ name: String) throws (JSException) @@ -182,6 +182,7 @@ public macro JSFunction() = /// } /// ``` @attached(member, names: arbitrary) +@attached(extension, conformances: _JSBridgedClass) @_spi(Experimental) public macro JSClass() = #externalMacro(module: "BridgeJSMacros", type: "JSClassMacro") diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index f65f5d23c..2ad11fd9b 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -22,7 +22,7 @@ @JSFunction func jsThrowOrString(_ shouldThrow: Bool) throws (JSException) -> String -@JSClass struct JsGreeter: _JSBridgedClass { +@JSClass struct JsGreeter { @JSGetter var name: String @JSSetter func setName(_ value: String) throws (JSException) @JSGetter var `prefix`: String From 4c0d367915291273feba3157dd76566f3bd684bd Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 21 Jan 2026 19:46:13 +0700 Subject: [PATCH 074/252] chore: Minor updates to BridgeJS documentation (#503) --- Plugins/BridgeJS/README.md | 108 ++++++++---- .../Exporting-Swift/Exporting-Swift-Class.md | 11 ++ .../Exporting-Swift-Closure.md | 16 +- .../Exporting-Swift-Default-Parameters.md | 1 + .../Exporting-Swift/Exporting-Swift-Enum.md | 156 +++++++----------- .../Exporting-Swift-Optional.md | 4 +- .../Exporting-Swift-Protocols.md | 104 +++++------- .../Exporting-Swift-Static-Functions.md | 6 +- .../Exporting-Swift-Static-Properties.md | 6 +- .../Exporting-Swift/Exporting-Swift-Struct.md | 66 ++++---- .../Exporting-Swift/Using-Namespace.md | 12 +- 11 files changed, 248 insertions(+), 242 deletions(-) diff --git a/Plugins/BridgeJS/README.md b/Plugins/BridgeJS/README.md index 0cc4ceba9..29d7df2e1 100644 --- a/Plugins/BridgeJS/README.md +++ b/Plugins/BridgeJS/README.md @@ -4,7 +4,7 @@ > This feature is still experimental, and the API may change frequently. Use at your own risk with `JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1` environment variable. > [!NOTE] -> This documentation is intended for JavaScriptKit developers, not JavaScriptKit users. +> This documentation is intended for JavaScriptKit developers, not JavaScriptKit users. For user documentation, see [Exporting Swift to JavaScript](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/exporting-swift-to-javascript) and [Importing TypeScript into Swift](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/importing-typescript-into-swift). ## Overview @@ -14,6 +14,7 @@ BridgeJS provides easy interoperability between Swift and JavaScript/TypeScript. 2. **Exporting Swift APIs to JavaScript**: Make your Swift APIs available to JavaScript code The workflow is: + 1. `ts2swift` converts TypeScript definitions (`bridge-js.d.ts`) to macro-annotated Swift declarations (`BridgeJS.Macros.swift`) 2. `bridge-js generate` processes both Swift source files (for export) and macro-annotated Swift files (for import) to generate: - `BridgeJS.swift` (Swift glue code) @@ -59,27 +60,53 @@ graph LR ## Type Mapping -### Primitive Type Conversions - -TBD - -| Swift Type | JS Type | Wasm Core Type | -|:--------------|:-----------|:---------------| -| `Int` | `number` | `i32` | -| `UInt` | `number` | `i32` | -| `Int8` | `number` | `i32` | -| `UInt8` | `number` | `i32` | -| `Int16` | `number` | `i32` | -| `UInt16` | `number` | `i32` | -| `Int32` | `number` | `i32` | -| `UInt32` | `number` | `i32` | -| `Int64` | `bigint` | `i64` | -| `UInt64` | `bigint` | `i64` | -| `Float` | `number` | `f32` | -| `Double` | `number` | `f64` | -| `Bool` | `boolean` | `i32` | -| `Void` | `void` | - | -| `String` | `string` | `i32` | +### Primitive Types + +| Swift Type | TypeScript Type | Wasm Core Type | +|:--------------|:----------------|:---------------| +| `Int` | `number` | `i32` | +| `UInt` | `number` | `i32` | +| `Int8` | `number` | `i32` | +| `UInt8` | `number` | `i32` | +| `Int16` | `number` | `i32` | +| `UInt16` | `number` | `i32` | +| `Int32` | `number` | `i32` | +| `UInt32` | `number` | `i32` | +| `Int64` | `bigint` | `i64` | +| `UInt64` | `bigint` | `i64` | +| `Float` | `number` | `f32` | +| `Double` | `number` | `f64` | +| `Bool` | `boolean` | `i32` | +| `Void` | `void` | - | + +### Complex Types + +| Swift Type | TypeScript Type | Semantics | Status | +|:-----------|:----------------|:----------|:-------| +| `String` | `string` | Copy | ✅ | +| `@JS class` | `interface` + constructor | Reference (pointer) | ✅ | +| `@JS struct` | `interface` | Copy (fields via stacks) | ✅ | +| `@JS enum` (case) | const object + tag type | Copy (integer) | ✅ | +| `@JS enum` (raw value) | const object + tag type | Copy (raw value) | ✅ | +| `@JS enum` (associated) | discriminated union | Copy (fields via stacks) | ✅ | +| `@JS protocol` | `interface` | Reference (wrapper) | ✅ | +| `Optional` | `T \| null` | Depends on T | ✅ | +| `(T) -> U` | `(arg: T) => U` | Reference (boxed) | ✅ | +| `JSObject` | `any` / `object` | Reference | ✅ | +| `Array` | `T[]` | Copy | ✅ | +| `Array>` | `T[][]` | Copy | ✅ | +| `Dictionary` | `Record` | - | [#495](https://github.com/swiftwasm/JavaScriptKit/issues/495) | +| `Set` | `Set` | - | [#397](https://github.com/swiftwasm/JavaScriptKit/issues/397) | +| `Foundation.URL` | `string` | - | [#496](https://github.com/swiftwasm/JavaScriptKit/issues/496) | +| Generics | - | - | [#398](https://github.com/swiftwasm/JavaScriptKit/issues/398) | + +### Import-specific (TypeScript → Swift) + +| TypeScript Type | Swift Type | Status | +|:----------------|:-----------|:-------| +| `T \| null` | `Optional` | [#475](https://github.com/swiftwasm/JavaScriptKit/issues/475) | +| `T \| undefined` | `Optional` | [#475](https://github.com/swiftwasm/JavaScriptKit/issues/475) | +| `enum` | `@JS enum` | [#489](https://github.com/swiftwasm/JavaScriptKit/issues/489) | ## Type Modeling @@ -109,23 +136,37 @@ The ABI will not be stable, and not meant to be interposed by other tools. ### Parameter Passing -Parameter passing follows Wasm calling conventions, with custom handling for complex types like strings and objects. +Parameter passing follows Wasm calling conventions, with custom handling for complex types: -TBD +- **Primitives**: Passed directly as Wasm arguments (`i32`, `i64`, `f32`, `f64`) +- **Strings**: UTF-8 bytes stored in `swift.memory`, ID + length passed as Wasm arguments +- **Swift Classes**: Raw Swift heap pointer passed as `i32` +- **JSObjects**: Object stored in `swift.memory.heap`, object ID passed as `i32` +- **Structs/Arrays**: Fields/elements pushed to type-specific stacks, Swift pops in reverse order +- **Closures**: Boxed and retained in memory, handle passed as `i32` ### Return Values -TBD +Return values use direct Wasm returns for primitives, and imported intrinsic functions for complex types: + +- **Primitives**: Returned directly via Wasm return value +- **Strings**: Swift writes UTF-8 bytes to shared memory, JS decodes +- **Swift Classes**: Pointer returned directly, JS wraps in `SwiftHeapObject` with `FinalizationRegistry` +- **Structs/Arrays**: Swift pushes fields/elements to type-specific stacks, JS reconstructs + +### Memory Management + +- **Swift Classes**: Live on Swift heap. JS holds pointer wrapped in `SwiftHeapObject`. `FinalizationRegistry` calls `deinit` on GC. Optional `release()` for deterministic cleanup. +- **JSObjects**: Live in `swift.memory.heap` (JS side). Swift holds ID wrapped in `JSObject`. Reference counted via `retain`/`release`. +- **Structs/Arrays/Enums**: Copy semantics - data serialized across boundary. No cleanup needed. +- **Closures**: Boxed on source side, released when GC'd on either side. + +For detailed semantics, see the [How It Works sections](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/exporting-swift-class#How-It-Works) in the user documentation. ## Future Work -- [ ] Struct on parameter or return type -- [ ] Throws functions -- [ ] Async functions - [ ] Cast between TS interface -- [ ] Closure support -- [ ] Simplify constructor pattern - * https://github.com/ocsigen/ts2ocaml/blob/main/docs/js_of_ocaml.md#feature-immediate-constructor +- [ ] Simplify constructor pattern ([reference](https://github.com/ocsigen/ts2ocaml/blob/main/docs/js_of_ocaml.md#feature-immediate-constructor)) ```typescript interface Foo = { someMethod(value: number): void; @@ -141,3 +182,8 @@ TBD ``` - [ ] Use `externref` once it's widely available - [ ] Test SwiftObject roundtrip +- [ ] Import TS `enum` as Swift enum ([#489](https://github.com/swiftwasm/JavaScriptKit/issues/489)) +- [ ] Support `T | null` and `T | undefined` imports ([#475](https://github.com/swiftwasm/JavaScriptKit/issues/475)) +- [ ] Support `@JS var` for global scope imports ([#466](https://github.com/swiftwasm/JavaScriptKit/issues/466)) +- [ ] Support `export { thing } from 'pkg'` form ([#437](https://github.com/swiftwasm/JavaScriptKit/issues/437)) +- [ ] Support imported TS type usage on exported interface ([#497](https://github.com/swiftwasm/JavaScriptKit/issues/497)) diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Class.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Class.md index 3a4df4ae2..3e44581fa 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Class.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Class.md @@ -76,6 +76,17 @@ export type Exports = { } ``` +## How It Works + +Classes use **reference semantics** when crossing the Swift/JavaScript boundary: + +1. **Object Creation**: When you create a class instance (via `new` in JS), the object lives on the Swift heap +2. **Reference Passing**: JavaScript receives a reference (handle) to the Swift object, not a copy +3. **Shared State**: Changes made through either Swift or JavaScript affect the same object +4. **Memory Management**: `FinalizationRegistry` automatically releases Swift objects when they're garbage collected in JavaScript. You can optionally call `release()` for deterministic cleanup. + +This differs from structs, which use copy semantics and transfer data by value. + ## Supported Features | Swift Feature | Status | diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md index 498e6c077..fe934ddba 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md @@ -1,4 +1,4 @@ -# Exporting Swift Closures +# Exporting Swift Closures to JS Learn how to use closure/function types as parameters and return values in BridgeJS. @@ -89,18 +89,20 @@ export type Exports = { } ``` -## Memory Management +## How It Works -When JavaScript passes a function to Swift, it's automatically stored in `swift.memory` with reference counting. When Swift's closure wrapper is deallocated by ARC, the JavaScript function is released. +Closures use **reference semantics** when crossing the Swift/JavaScript boundary: -When Swift returns a closure to JavaScript, the Swift closure is boxed and automatically released when the JavaScript function is garbage collected. +1. **JavaScript → Swift**: When JavaScript passes a function to Swift, it's stored in `swift.memory` with reference counting. When Swift's closure wrapper is deallocated by ARC, the JavaScript function is released. +2. **Swift → JavaScript**: When Swift returns a closure to JavaScript, the Swift closure is boxed and automatically released when the JavaScript function is garbage collected. +3. **Memory Management**: Both directions use automatic memory management via `FinalizationRegistry` - no manual cleanup required. -Both directions use automatic memory management - no manual cleanup required. +This differs from structs and arrays, which use copy semantics and transfer data by value. ## Supported Features -| Feature | Status | -|:--------|:-------| +| Swift Feature | Status | +|:--------------|:-------| | Closure Parameters with Supported Types `(String, Int) -> Person` | ✅ | | Closure Return Value with Supported Types `() -> Person` | ✅ | | `@escaping` closures | ✅ | diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md index 9eec622f0..21925685d 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md @@ -143,6 +143,7 @@ custom.release(); ``` **Requirements:** + - Constructor/initializer arguments must be literal values (`"text"`, `42`, `true`, `false`, `nil`) - Struct initializers must use labeled arguments (e.g., `Point(x: 1.0, y: 2.0)`) - Complex expressions, computed properties, or method calls are not supported diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Enum.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Enum.md index 93c1fdd26..3dda2b9c5 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Enum.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Enum.md @@ -19,9 +19,7 @@ BridgeJS generates separate objects with descriptive naming for `.const` enums: - **`EnumNameTag`**: Represents the union type for enums - **`EnumNameObject`**: Object type for all const-style enums, contains static members for enums with methods/properties or references the values type for simple enums -#### Case Enums - -**Swift Definition:** +### Case Enums ```swift @JS enum Direction { @@ -45,7 +43,7 @@ BridgeJS generates separate objects with descriptive naming for `.const` enums: } ``` -**Generated TypeScript Declaration:** +Generated TypeScript declarations: ```typescript // Const object style (default) @@ -73,7 +71,7 @@ export const StatusValues: { export type StatusTag = typeof StatusValues[keyof typeof StatusValues]; ``` -**Usage in TypeScript:** +In TypeScript: ```typescript const direction: DirectionTag = DirectionValues.North; @@ -100,66 +98,9 @@ function handleDirection(direction: DirectionTag) { } ``` -BridgeJS also generates convenience initializers and computed properties for each case-style enum, allowing the rest of the Swift glue code to remain minimal and consistent. This avoids repetitive switch statements in every function that passes enum values between JavaScript and Swift. +### Raw Value Enums -```swift -extension Direction { - init?(bridgeJSRawValue: Int32) { - switch bridgeJSRawValue { - case 0: - self = .north - case 1: - self = .south - case 2: - self = .east - case 3: - self = .west - default: - return nil - } - } - - var bridgeJSRawValue: Int32 { - switch self { - case .north: - return 0 - case .south: - return 1 - case .east: - return 2 - case .west: - return 3 - } - } -} -... -@_expose(wasm, "bjs_setDirection") -@_cdecl("bjs_setDirection") -public func _bjs_setDirection(direction: Int32) -> Void { - #if arch(wasm32) - setDirection(_: Direction(bridgeJSRawValue: direction)!) - #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.bridgeJSRawValue - #else - fatalError("Only available on WebAssembly") - #endif -} -``` - -#### Raw Value Enums - -##### String Raw Values - -**Swift Definition:** +#### String Raw Values ```swift // Default const object style @@ -177,7 +118,7 @@ public func _bjs_getDirection() -> Int32 { } ``` -**Generated TypeScript Declaration:** +Generated TypeScript declarations: ```typescript // Const object style (default) @@ -196,7 +137,7 @@ export enum TSTheme { } ``` -**Usage in TypeScript:** +In TypeScript: ```typescript // Raw value enums work similarly to case enums @@ -209,9 +150,7 @@ const currentTheme: ThemeTag = exports.getTheme(); const status: HttpStatusTag = exports.processTheme(ThemeValues.Auto); ``` -##### Integer Raw Values - -**Swift Definition:** +#### Integer Raw Values ```swift // Default const object style @@ -237,7 +176,7 @@ const status: HttpStatusTag = exports.processTheme(ThemeValues.Auto); } ``` -**Generated TypeScript Declaration:** +Generated TypeScript declarations: ```typescript // Const object style (default) @@ -265,7 +204,7 @@ export const PriorityValues: { export type PriorityTag = typeof PriorityValues[keyof typeof PriorityValues]; ``` -**Usage in TypeScript:** +In TypeScript: ```typescript const status: HttpStatusTag = HttpStatusValues.Ok; @@ -280,9 +219,7 @@ const convertedPriority: PriorityTag = exports.convertPriority(HttpStatusValues. ### Namespace Enums -Namespace enums are empty enums (containing no cases) used for organizing related types and functions into hierarchical namespaces. - -**Swift Definition:** +Namespace enums are empty enums (containing no cases) used for organizing related types and functions into hierarchical namespaces. See for more details on namespace organization. ```swift @JS enum Utils { @@ -325,7 +262,7 @@ enum Internal { } ``` -**Generated TypeScript Declaration:** +Generated TypeScript declarations: ```typescript declare global { @@ -364,7 +301,7 @@ declare global { } ``` -**Usage in TypeScript:** +In TypeScript: ```typescript // Access nested classes through namespaces (no globalThis prefix needed) @@ -386,7 +323,7 @@ Things to remember when using enums for namespacing: 2. Top-level enums can use `@JS(namespace: "Custom.Path")` to place themselves in custom namespaces, which will be used as "base namespace" for all nested elements as well 3. Classes and enums nested within namespace enums **cannot** use `@JS(namespace:)` - this would create conflicting namespace declarations -**Invalid Usage:** +Invalid usage: ```swift @JS enum Utils { @@ -397,7 +334,7 @@ Things to remember when using enums for namespacing: } ``` -**Valid Usage:** +Valid usage: ```swift // Valid - top-level enum with explicit namespace @@ -409,12 +346,10 @@ enum Helper { } ``` -#### Associated Value Enums +### Associated Value Enums Associated value enums are supported and allow you to pass data along with each enum case. BridgeJS generates TypeScript discriminated union types. Associated values are encoded into a binary format for efficient transfer between JavaScript and WebAssembly -**Swift Definition:** - ```swift @JS enum APIResult { @@ -440,7 +375,7 @@ enum ComplexResult { @JS func getResult() -> APIResult ``` -**Generated TypeScript Declaration:** +Generated TypeScript declarations: ```typescript export const APIResultValues: { @@ -482,7 +417,7 @@ export type ComplexResultTag = { tag: typeof ComplexResultValues.Tag.Info } ``` -**Usage in TypeScript:** +In TypeScript: ```typescript const successResult: APIResultTag = { @@ -528,21 +463,54 @@ function processResult(result: APIResultTag) { } ``` -**Supported Features:** +## How It Works + +Enums use **copy semantics** when crossing the Swift/JavaScript boundary: + +1. **Case Enums**: Passed as integer tag values (0, 1, 2, ...) representing each case +2. **Raw Value Enums**: Passed using their raw value type (string or integer) +3. **Associated Value Enums**: Tag value passed directly, associated data pushed to type-specific stacks and reconstructed on the receiving side + +BridgeJS generates convenience initializers and computed properties for each enum, keeping the glue code minimal and consistent: + +```swift +extension Direction { + init?(bridgeJSRawValue: Int32) { + switch bridgeJSRawValue { + case 0: self = .north + case 1: self = .south + // ... + default: return nil + } + } + + var bridgeJSRawValue: Int32 { + switch self { + case .north: return 0 + case .south: return 1 + // ... + } + } +} +``` + +This differs from classes, which use reference semantics and share state across the boundary. + +## Supported Features | Swift Feature | Status | |:--------------|:-------| -| Associated values: `String` | ✅ | -| Associated values: `Int` | ✅ | -| Associated values: `Bool` | ✅ | -| Associated values: `Float` | ✅ | -| Associated values: `Double` | ✅ | +| Case enums | ✅ | +| Raw value enums (`String`) | ✅ | +| Raw value enums (`Int`, `Int32`, etc.) | ✅ | +| Namespace enums (empty enums) | ✅ | +| Associated value enums | ✅ | +| `.tsEnum` style option | ✅ | +| Static functions | ✅ | +| Static properties | ✅ | +| Associated values: `String`, `Int`, `Bool`, `Float`, `Double` | ✅ | | Associated values: Custom classes/structs | ❌ | | Associated values: Other enums | ❌ | | Associated values: Arrays/Collections | ❌ | | Associated values: Optionals | ❌ | -| Use as exported function parameters | ✅ | -| Use as exported function return values | ✅ | -| Use as imported function parameters | ❌ | -| Use as imported function return values | ❌ | -| Namespace support | ✅ | +| Generics | ❌ | diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Optional.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Optional.md index 24b04d74e..91fdc3472 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Optional.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Optional.md @@ -112,8 +112,8 @@ export type UserProfile = { ## Supported Features -| Swift Optional Feature | Status | -|:----------------------|:-------| +| Swift Feature | Status | +|:--------------|:-------| | Optional primitive parameters: `Int?`, `String?`, etc. | ✅ | | Optional primitive return values | ✅ | | Optional object parameters: `MyClass?`, `JSObject?` | ✅ | diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md index 4dba78c38..111b1f052 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md @@ -1,4 +1,4 @@ -# Exporting Swift Protocols +# Exporting Swift Protocols to JS Learn how to expose Swift protocols to JavaScript as TypeScript interfaces. @@ -114,63 +114,6 @@ export type Exports = { } ``` -## Generated Wrapper - -BridgeJS generates a Swift wrapper struct for each `@JS` protocol. This wrapper holds a `JSObject` reference and forwards protocol method calls to the JavaScript implementation: - -```swift -struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { - let jsObject: JSObject - - var count: Int { - get { - @_extern(wasm, module: "TestModule", name: "bjs_Counter_count_get") - func _extern_get(this: Int32) -> Int32 - let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) - return Int.bridgeJSLiftReturn(ret) - } - set { - @_extern(wasm, module: "TestModule", name: "bjs_Counter_count_set") - func _extern_set(this: Int32, value: Int32) - _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) - } - } - - var name: String { - @_extern(wasm, module: "TestModule", name: "bjs_Counter_name_get") - func _extern_get(this: Int32) - _extern_get(this: Int32(bitPattern: jsObject.id)) - return String.bridgeJSLiftReturn() - } - - func increment(by amount: Int) { - @_extern(wasm, module: "TestModule", name: "bjs_Counter_increment") - func _extern_increment(this: Int32, amount: Int32) - _extern_increment( - this: Int32(bitPattern: jsObject.id), - amount: amount.bridgeJSLowerParameter() - ) - } - - func reset() { - @_extern(wasm, module: "TestModule", name: "bjs_Counter_reset") - func _extern_reset(this: Int32) - _extern_reset(this: Int32(bitPattern: jsObject.id)) - } - - func getValue() -> Int { - @_extern(wasm, module: "TestModule", name: "bjs_Counter_getValue") - func _extern_getValue(this: Int32) -> Int32 - let ret = _extern_getValue(this: Int32(bitPattern: jsObject.id)) - return Int.bridgeJSLiftReturn(ret) - } - - static func bridgeJSLiftParameter(_ value: Int32) -> Self { - return AnyCounter(jsObject: JSObject(id: UInt32(bitPattern: value))) - } -} -``` - ## Swift Implementation You can also implement protocols in Swift and use them from JavaScript: @@ -223,12 +166,47 @@ console.log(counter.getValue()); // 0 ## How It Works -When you pass a JavaScript object implementing a protocol to Swift: +Protocols use **reference semantics** when crossing the Swift/JavaScript boundary: + +1. **JavaScript → Swift**: The JavaScript object is stored in JavaScriptKit's memory heap and its ID is passed as an `Int32` to Swift +2. **Wrapper Generation**: BridgeJS generates an `Any{ProtocolName}` wrapper struct that holds a `JSObject` reference and forwards protocol method calls through WASM to the JavaScript implementation +3. **Swift → JavaScript**: When returning a Swift protocol implementation to JavaScript, the object is stored on the Swift heap and JavaScript receives a reference +4. **Memory Management**: `FinalizationRegistry` automatically handles cleanup. The `JSObject` reference keeps the JavaScript object alive, and when the Swift wrapper is deallocated, the JavaScript object is released. + +### Generated Wrapper + +BridgeJS generates a Swift wrapper struct for each `@JS` protocol: + +```swift +struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { + let jsObject: JSObject -1. **JavaScript Side**: The object is stored in JavaScriptKit's memory heap and its ID is passed as an `Int32` to Swift -2. **Swift Side**: BridgeJS creates an `Any{ProtocolName}` wrapper that holds a `JSObject` reference -3. **Method Calls**: Protocol method calls are forwarded through WASM to the JavaScript implementation -4. **Memory Management**: The `JSObject` reference keeps the JavaScript object alive using JavaScriptKit's retain/release system. When the Swift wrapper is deallocated, the JavaScript object is automatically released. + var count: Int { + get { + @_extern(wasm, module: "TestModule", name: "bjs_Counter_count_get") + func _extern_get(this: Int32) -> Int32 + let ret = _extern_get(this: Int32(bitPattern: jsObject.id)) + return Int.bridgeJSLiftReturn(ret) + } + set { + @_extern(wasm, module: "TestModule", name: "bjs_Counter_count_set") + func _extern_set(this: Int32, value: Int32) + _extern_set(this: Int32(bitPattern: jsObject.id), value: newValue.bridgeJSLowerParameter()) + } + } + + func increment(by amount: Int) { + @_extern(wasm, module: "TestModule", name: "bjs_Counter_increment") + func _extern_increment(this: Int32, amount: Int32) + _extern_increment( + this: Int32(bitPattern: jsObject.id), + amount: amount.bridgeJSLowerParameter() + ) + } + + // ... other protocol requirements +} +``` ## Supported Features diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Functions.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Functions.md index 8602d937d..00e7c1f22 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Functions.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Functions.md @@ -122,7 +122,7 @@ const result: number = exports.Calculator.square(5); // 25 ## Namespace Enum Static Functions -Namespace enums organize related utility functions and are assigned to `globalThis`: +Namespace enums organize related utility functions and are assigned to `globalThis`. See for more details on namespace organization. ```swift @JS enum Utils { @@ -156,8 +156,8 @@ const result: string = Utils.String.uppercase("world"); ## Supported Features -| Swift Static Function Feature | Status | -|:------------------------------|:-------| +| Swift Feature | Status | +|:--------------|:-------| | Class `static func` | ✅ | | Class `class func` | ✅ | | Enum `static func` | ✅ | diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Properties.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Properties.md index 097f644bf..4110e6166 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Properties.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Properties.md @@ -128,7 +128,7 @@ exports.PropertyEnum.enumProperty = "updated"; ## Namespace Enum Static Properties -Namespace enums organize related static properties and are assigned to `globalThis`: +Namespace enums organize related static properties and are assigned to `globalThis`. See for more details on namespace organization. ```swift @JS enum PropertyNamespace { @@ -173,8 +173,8 @@ const value: number = PropertyNamespace.Nested.nestedProperty; ## Supported Features -| Swift Static Property Feature | Status | -|:------------------------------|:-------| +| Swift Feature | Status | +|:--------------|:-------| | Class `static let` | ✅ | | Class `static var` | ✅ | | Class `class var` | ✅ | diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md index e20a324c2..236b822ab 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md @@ -104,33 +104,9 @@ exports.Config.defaultTimeout = 60.0; console.log(exports.Config.maxRetries); // 3 (readonly) ``` -## Struct Methods +## Struct Methods and Initializers -Structs can have instance and static methods, both require @JS annotation: - -```swift -@JS struct Calculator { - @JS func add(a: Double, b: Double) -> Double { - return a + b - } - - @JS static func multiply(x: Double, y: Double) -> Double { - return x * y - } -} -``` - -In JavaScript: - -```javascript -const calc = {}; -console.log(exports.useMathOperations(calc, 5.0, 3.0)); // Uses instance methods -console.log(exports.Calculator.multiply(4.0, 5.0)); // Static method -``` - -## Struct Initializers - -Struct initializers are exported as static `init` methods, not constructors: +Structs can have instance methods, static methods, and initializers. All require `@JS` annotation: ```swift @JS struct Point { @@ -141,30 +117,46 @@ Struct initializers are exported as static `init` methods, not constructors: self.x = x self.y = y } + + @JS func distanceFromOrigin() -> Double { + return (x * x + y * y).squareRoot() + } + + @JS static func origin() -> Point { + return Point(x: 0, y: 0) + } } ``` In JavaScript: ```javascript -const point = exports.Point.init(10.0, 20.0); -console.log(point.x); // 10.0 +// Create via static init method (not constructor) +const point = exports.Point.init(3.0, 4.0); +console.log(point.distanceFromOrigin()); // 5.0 + +// Static method +const origin = exports.Point.origin(); +console.log(origin.x); // 0.0 ``` -This differs from classes, where `@JS init` maps to a JavaScript constructor using `new`: +Note: Struct initializers are exported as static `init` methods. This differs from classes, where `@JS init` maps to a JavaScript constructor using `new`. -```javascript -// Class: uses `new` -const cart = new exports.ShoppingCart(); +## How It Works -// Struct: uses static `init` method -const point = exports.Point.init(10.0, 20.0); -``` +Structs use **copy semantics** when crossing the Swift/JavaScript boundary: + +1. **Data Transfer**: Struct fields are pushed to type-specific stacks and reconstructed as plain JavaScript objects +2. **No Shared State**: Each side has its own copy - modifications don't affect the other +3. **No Memory Management**: No `release()` needed since there's no shared reference +4. **Plain Objects**: In JavaScript, structs become plain objects matching the TypeScript interface + +This differs from classes, which use reference semantics and share state across the boundary. ## Supported Features -| Feature | Status | -|:--------|:-------| +| Swift Feature | Status | +|:--------------|:-------| | Stored fields with supported types | ✅ | | Optional fields | ✅ | | Nested structs | ✅ | diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md index 0c4027b77..057b5f030 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md @@ -8,7 +8,11 @@ Learn how to organize exported Swift code into JavaScript namespaces. The `@JS` macro supports organizing your exported Swift code into namespaces using dot-separated strings. This allows you to create hierarchical structures in JavaScript that mirror your Swift code organization. -### Functions with Namespaces +There are two ways to create namespaces: +1. **`@JS(namespace:)`** - Explicitly specify a namespace for functions, classes, or enums +2. **Namespace enums** - Use empty enums to create implicit namespace hierarchies (see ) + +## Functions with Namespaces You can export functions to specific namespaces by providing a namespace parameter: @@ -49,7 +53,7 @@ declare global { } ``` -### Classes with Namespaces +## Classes with Namespaces For classes, you only need to specify the namespace on the top-level class declaration. All exported methods within the class will be part of that namespace: @@ -117,3 +121,7 @@ export interface Greeter extends SwiftHeapObject { ``` Using namespaces can be preferable for projects with many global functions, as they help prevent naming collisions. Namespaces also provide intuitive hierarchies for organizing your exported Swift code, and they do not affect the code generated by `@JS` declarations without namespaces. + +## See Also + +- - Namespace enums section From 724e62e51137bbd5e2f0faa9526c2dbaf162e312 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 21 Jan 2026 22:21:11 +0800 Subject: [PATCH 075/252] [BridgeJS] Support @JS var declarations for global scope imports (#505) --- Plugins/BridgeJS/Package.swift | 2 +- .../BridgeJSCore/ImportSwiftMacros.swift | 13 +- .../Sources/BridgeJSCore/ImportTS.swift | 22 ++ .../Sources/BridgeJSLink/BridgeJSLink.swift | 44 ++++ .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 44 +++- .../BridgeJSToolTests/BridgeJSLinkTests.swift | 38 +++ .../ImportMacroInputs/GlobalGetter.swift | 6 + .../GlobalGetter.ImportMacros.d.ts | 21 ++ .../GlobalGetter.ImportMacros.js | 231 ++++++++++++++++++ 9 files changed, 410 insertions(+), 11 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/GlobalGetter.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js diff --git a/Plugins/BridgeJS/Package.swift b/Plugins/BridgeJS/Package.swift index 63c74c53e..a4385bd37 100644 --- a/Plugins/BridgeJS/Package.swift +++ b/Plugins/BridgeJS/Package.swift @@ -55,7 +55,7 @@ let package = Package( "BridgeJSLink", "TS2Swift", ], - exclude: ["__Snapshots__", "Inputs", "MultifileInputs"] + exclude: ["__Snapshots__", "Inputs", "MultifileInputs", "ImportMacroInputs"] ), .macro( name: "BridgeJSMacros", diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift index b4c5820df..db6b983e1 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift @@ -44,7 +44,8 @@ public final class ImportSwiftMacros { importedFiles.append( ImportedFileSkeleton( functions: collector.importedFunctions, - types: collector.importedTypes + types: collector.importedTypes, + globalGetters: collector.importedGlobalGetters ) ) } @@ -94,6 +95,7 @@ public final class ImportSwiftMacros { fileprivate final class APICollector: SyntaxAnyVisitor { var importedFunctions: [ImportedFunctionSkeleton] = [] var importedTypes: [ImportedTypeSkeleton] = [] + var importedGlobalGetters: [ImportedGetterSkeleton] = [] var errors: [DiagnosticError] = [] private let inputFilePath: String @@ -432,12 +434,9 @@ public final class ImportSwiftMacros { switch state { case .topLevel: - errors.append( - DiagnosticError( - node: node, - message: "@JSGetter is not supported at top-level. Use it only in @JSClass types." - ) - ) + if let getter = parseGetterSkeleton(node, enclosingTypeName: nil) { + importedGlobalGetters.append(getter) + } return .skipChildren case .jsClassBody(let typeName): diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 402e6e671..675708c45 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -36,6 +36,10 @@ public struct ImportTS { public func finalize() throws -> String? { var decls: [DeclSyntax] = [] for skeleton in self.skeleton.children { + for getter in skeleton.globalGetters { + let getterDecls = try renderSwiftGlobalGetter(getter, topLevelDecls: &decls) + decls.append(contentsOf: getterDecls) + } for function in skeleton.functions { let thunkDecls = try renderSwiftThunk(function, topLevelDecls: &decls) decls.append(contentsOf: thunkDecls) @@ -54,6 +58,24 @@ public struct ImportTS { return decls.map { $0.formatted(using: format).description }.joined(separator: "\n\n") } + func renderSwiftGlobalGetter( + _ getter: ImportedGetterSkeleton, + topLevelDecls: inout [DeclSyntax] + ) throws -> [DeclSyntax] { + let builder = CallJSEmission(moduleName: moduleName, abiName: getter.abiName(context: nil)) + try builder.call(returnType: getter.type) + try builder.liftReturnValue(returnType: getter.type) + topLevelDecls.append(builder.renderImportDecl()) + return [ + builder.renderThunkDecl( + name: "_$\(getter.name)_get", + parameters: [], + returnType: getter.type + ) + .with(\.leadingTrivia, Self.renderDocumentation(documentation: getter.documentation)) + ] + } + class CallJSEmission { let abiName: String let moduleName: String diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index d6103f7de..1f55eb187 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -172,6 +172,9 @@ struct BridgeJSLink { guard let imported = unified.imported else { continue } let importObjectBuilder = ImportObjectBuilder(moduleName: unified.moduleName) for fileSkeleton in imported.children { + for getter in fileSkeleton.globalGetters { + try renderImportedGlobalGetter(importObjectBuilder: importObjectBuilder, getter: getter) + } for function in fileSkeleton.functions { try renderImportedFunction(importObjectBuilder: importObjectBuilder, function: function) } @@ -2142,6 +2145,31 @@ extension BridgeJSLink { body.write("\(call);") } + func getImportProperty(name: String, returnType: BridgeType) throws -> String? { + if returnType == .void { + throw BridgeJSLinkError(message: "Void is not supported for imported JS properties") + } + + let loweringFragment = try IntrinsicJSFragment.lowerReturn(type: returnType, context: context) + let expr = "imports[\"\(name)\"]" + + let returnExpr: String? + if loweringFragment.parameters.count == 0 { + body.write("\(expr);") + returnExpr = nil + } else { + let resultVariable = scope.variable("ret") + body.write("let \(resultVariable) = \(expr);") + returnExpr = resultVariable + } + + return try lowerReturnValue( + returnType: returnType, + returnExpr: returnExpr, + loweringFragment: loweringFragment + ) + } + private func lowerReturnValue( returnType: BridgeType, returnExpr: String?, @@ -2881,6 +2909,22 @@ extension BridgeJSLink { importObjectBuilder.assignToImportObject(name: function.abiName(context: nil), function: funcLines) } + func renderImportedGlobalGetter( + importObjectBuilder: ImportObjectBuilder, + getter: ImportedGetterSkeleton + ) throws { + let thunkBuilder = ImportedThunkBuilder() + let returnExpr = try thunkBuilder.getImportProperty(name: getter.name, returnType: getter.type) + let abiName = getter.abiName(context: nil) + let funcLines = thunkBuilder.renderFunction( + name: abiName, + returnExpr: returnExpr, + returnType: getter.type + ) + importObjectBuilder.appendDts(["readonly \(getter.name): \(getter.type.tsType);"]) + importObjectBuilder.assignToImportObject(name: abiName, function: funcLines) + } + func renderImportedType( importObjectBuilder: ImportObjectBuilder, type: ImportedTypeSkeleton diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index e1815fbeb..10f06802d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -634,7 +634,7 @@ public struct ImportedGetterSkeleton: Codable { self.functionName = functionName } - public func abiName(context: ImportedTypeSkeleton) -> String { + public func abiName(context: ImportedTypeSkeleton?) -> String { if let functionName = functionName { return ABINameGenerator.generateImportedABIName( baseName: functionName, @@ -669,7 +669,7 @@ public struct ImportedSetterSkeleton: Codable { self.functionName = functionName } - public func abiName(context: ImportedTypeSkeleton) -> String { + public func abiName(context: ImportedTypeSkeleton?) -> String { if let functionName = functionName { return ABINameGenerator.generateImportedABIName( baseName: functionName, @@ -713,10 +713,48 @@ public struct ImportedTypeSkeleton: Codable { public struct ImportedFileSkeleton: Codable { public let functions: [ImportedFunctionSkeleton] public let types: [ImportedTypeSkeleton] + /// Global-scope imported properties (e.g. `@JSGetter var console: JSConsole`) + public let globalGetters: [ImportedGetterSkeleton] + /// Global-scope imported properties (future use; not currently emitted by macros) + public let globalSetters: [ImportedSetterSkeleton] - public init(functions: [ImportedFunctionSkeleton], types: [ImportedTypeSkeleton]) { + public init( + functions: [ImportedFunctionSkeleton], + types: [ImportedTypeSkeleton], + globalGetters: [ImportedGetterSkeleton] = [], + globalSetters: [ImportedSetterSkeleton] = [] + ) { self.functions = functions self.types = types + self.globalGetters = globalGetters + self.globalSetters = globalSetters + } + + private enum CodingKeys: String, CodingKey { + case functions + case types + case globalGetters + case globalSetters + } + + public init(from decoder: any Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.functions = try container.decode([ImportedFunctionSkeleton].self, forKey: .functions) + self.types = try container.decode([ImportedTypeSkeleton].self, forKey: .types) + self.globalGetters = try container.decodeIfPresent([ImportedGetterSkeleton].self, forKey: .globalGetters) ?? [] + self.globalSetters = try container.decodeIfPresent([ImportedSetterSkeleton].self, forKey: .globalSetters) ?? [] + } + + public func encode(to encoder: any Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(functions, forKey: .functions) + try container.encode(types, forKey: .types) + if !globalGetters.isEmpty { + try container.encode(globalGetters, forKey: .globalGetters) + } + if !globalSetters.isEmpty { + try container.encode(globalSetters, forKey: .globalSetters) + } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift index 0485adfca..4cb46124d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift @@ -38,12 +38,21 @@ import Testing "Inputs" ) + static let importMacroInputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent() + .appendingPathComponent("ImportMacroInputs") + static func collectInputs(extension: String) -> [String] { let fileManager = FileManager.default let inputs = try! fileManager.contentsOfDirectory(atPath: Self.inputsDirectory.path) return inputs.filter { $0.hasSuffix(`extension`) } } + static func collectImportMacroInputs() -> [String] { + let fileManager = FileManager.default + let inputs = try! fileManager.contentsOfDirectory(atPath: Self.importMacroInputsDirectory.path) + return inputs.filter { $0.hasSuffix(".swift") } + } + @Test(arguments: collectInputs(extension: ".swift")) func snapshotExport(input: String) throws { let url = Self.inputsDirectory.appendingPathComponent(input) @@ -101,6 +110,35 @@ import Testing try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Import") } + @Test(arguments: collectImportMacroInputs()) + func snapshotImportMacroInput(input: String) throws { + let url = Self.importMacroInputsDirectory.appendingPathComponent(input) + let name = url.deletingPathExtension().lastPathComponent + + let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) + let importSwift = ImportSwiftMacros(progress: .silent, moduleName: "TestModule") + importSwift.addSourceFile(sourceFile, "\(name).swift") + let importResult = try importSwift.finalize() + + var importTS = ImportTS(progress: .silent, moduleName: "TestModule") + for child in importResult.outputSkeleton.children { + importTS.addSkeleton(child) + } + let importSkeleton = importTS.skeleton + + var bridgeJSLink = BridgeJSLink(sharedMemory: false) + let unifiedSkeleton = BridgeJSSkeleton( + moduleName: "TestModule", + exported: nil, + imported: importSkeleton + ) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys] + let unifiedData = try encoder.encode(unifiedSkeleton) + try bridgeJSLink.addSkeletonFile(data: unifiedData) + try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".ImportMacros") + } + @Test(arguments: [ "Namespaces.swift", "StaticFunctions.swift", diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/GlobalGetter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/GlobalGetter.swift new file mode 100644 index 000000000..fe3f7b068 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/GlobalGetter.swift @@ -0,0 +1,6 @@ +@JSClass +struct JSConsole { + @JSFunction func log(_ message: String) throws(JSException) +} + +@JSGetter var console: JSConsole diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.d.ts new file mode 100644 index 000000000..312f56786 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.d.ts @@ -0,0 +1,21 @@ +// 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 interface JSConsole { + log(message: string): void; +} +export type Exports = { +} +export type Imports = { + readonly console: JSConsole; +} +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/GlobalGetter.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js new file mode 100644 index 000000000..89aa3af9d --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js @@ -0,0 +1,231 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_console_get"] = function bjs_console_get() { + try { + let ret = imports["console"]; + return swift.memory.retain(ret); + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_JSConsole_log"] = function bjs_JSConsole_log(self, message) { + try { + const messageObject = swift.memory.getObject(message); + swift.memory.release(message); + swift.memory.getObject(self).log(messageObject); + } catch (error) { + setException(error); + } + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + const exports = { + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file From 8ea5ebb99e69c9182785b63e7f7b405beaf2b25c Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 22 Jan 2026 10:59:17 +0900 Subject: [PATCH 076/252] TS2Swift: Remove unused type definitions --- .../TS2Swift/JavaScript/src/index.d.ts | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/index.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/index.d.ts index b53e2420c..e5af49d9e 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/index.d.ts +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/index.d.ts @@ -11,39 +11,3 @@ export type Parameter = { name: string; type: BridgeType; } - -export type Effects = { - isAsync: boolean; -} - -export type ImportFunctionSkeleton = { - name: string; - parameters: Parameter[]; - returnType: BridgeType; - effects: Effects; - documentation: string | undefined; -} - -export type ImportConstructorSkeleton = { - parameters: Parameter[]; -} - -export type ImportPropertySkeleton = { - name: string; - type: BridgeType; - isReadonly: boolean; - documentation: string | undefined; -} - -export type ImportTypeSkeleton = { - name: string; - documentation: string | undefined; - constructor?: ImportConstructorSkeleton; - properties: ImportPropertySkeleton[]; - methods: ImportFunctionSkeleton[]; -} - -export type ImportSkeleton = { - functions: ImportFunctionSkeleton[]; - types: ImportTypeSkeleton[]; -} From e97074013fc1220f9389e9c28aae2c580e0e929b Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 22 Jan 2026 13:44:48 +0800 Subject: [PATCH 077/252] [BridgeJS][ImportTS] Support `export { thing } from "pkg"` form in `bridge-js.d.ts` (#506) --- .../TS2Swift/JavaScript/src/processor.js | 66 +++++ .../Inputs/ReExportFrom.d.ts | 2 + .../Inputs/Support/ReExportTarget.d.ts | 7 + .../ReExportFrom.Import.d.ts | 24 ++ .../BridgeJSLinkTests/ReExportFrom.Import.js | 241 ++++++++++++++++++ .../ImportTSTests/ReExportFrom.Macros.swift | 14 + .../ImportTSTests/ReExportFrom.swift | 53 ++++ 7 files changed, 407 insertions(+) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ReExportFrom.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Support/ReExportTarget.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.swift diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 47a4a1ac1..47b921764 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -54,6 +54,9 @@ export class TypeProcessor { this.seenTypes = new Map(); /** @type {string[]} Collected Swift code lines */ this.swiftLines = []; + + /** @type {Set} */ + this.visitedDeclarationKeys = new Set(); } /** @@ -117,6 +120,69 @@ export class TypeProcessor { this.visitFunctionDeclaration(node); } else if (ts.isClassDeclaration(node)) { this.visitClassDecl(node); + } else if (ts.isExportDeclaration(node)) { + this.visitExportDeclaration(node); + } + } + + /** + * Visit an export declaration and process re-exports like: + * - export { Thing } from "./module"; + * - export { Thing as Alias } from "./module"; + * - export * from "./module"; + * @param {ts.ExportDeclaration} node + */ + visitExportDeclaration(node) { + if (!node.moduleSpecifier) return; + + const moduleSymbol = this.checker.getSymbolAtLocation(node.moduleSpecifier); + if (!moduleSymbol) { + this.diagnosticEngine.print("warning", "Failed to resolve module for export declaration", node); + return; + } + + /** @type {ts.Symbol[]} */ + let targetSymbols = []; + + if (!node.exportClause) { + // export * from "..." + targetSymbols = this.checker.getExportsOfModule(moduleSymbol); + } else if (ts.isNamedExports(node.exportClause)) { + const moduleExports = this.checker.getExportsOfModule(moduleSymbol); + for (const element of node.exportClause.elements) { + const originalName = element.propertyName?.text ?? element.name.text; + + const match = moduleExports.find(s => s.name === originalName); + if (match) { + targetSymbols.push(match); + continue; + } + + // Fallback for unusual bindings/resolution failures. + const fallback = this.checker.getSymbolAtLocation(element.propertyName ?? element.name); + if (fallback) { + targetSymbols.push(fallback); + continue; + } + + this.diagnosticEngine.print("warning", `Failed to resolve re-exported symbol '${originalName}'`, node); + } + } else { + // export * as ns from "..." is not currently supported by BridgeJS imports. + return; + } + + for (const symbol of targetSymbols) { + const declarations = symbol.getDeclarations() ?? []; + for (const declaration of declarations) { + // Avoid duplicate emission when the same declaration is reached via multiple re-exports. + const sourceFile = declaration.getSourceFile(); + const key = `${sourceFile.fileName}:${declaration.pos}:${declaration.end}`; + if (this.visitedDeclarationKeys.has(key)) continue; + this.visitedDeclarationKeys.add(key); + + this.visitNode(declaration); + } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ReExportFrom.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ReExportFrom.d.ts new file mode 100644 index 000000000..0614f14c3 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ReExportFrom.d.ts @@ -0,0 +1,2 @@ +export { jsRoundTripNumber } from "./Support/ReExportTarget" +export { JsGreeter } from "./Support/ReExportTarget" diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Support/ReExportTarget.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Support/ReExportTarget.d.ts new file mode 100644 index 000000000..1867b1979 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Support/ReExportTarget.d.ts @@ -0,0 +1,7 @@ +export function jsRoundTripNumber(v: number): number + +export class JsGreeter { + constructor(name: string); + greet(): string; +} + diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.d.ts new file mode 100644 index 000000000..db6d2be05 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.d.ts @@ -0,0 +1,24 @@ +// 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 interface JsGreeter { + greet(): string; +} +export type Exports = { +} +export type Imports = { + jsRoundTripNumber(v: number): number; + JsGreeter: { + new(name: string): JsGreeter; + } +} +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/ReExportFrom.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js new file mode 100644 index 000000000..4a13f2d7d --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js @@ -0,0 +1,241 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_jsRoundTripNumber"] = function bjs_jsRoundTripNumber(v) { + try { + let ret = imports.jsRoundTripNumber(v); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_JsGreeter_init"] = function bjs_JsGreeter_init(name) { + try { + const nameObject = swift.memory.getObject(name); + swift.memory.release(name); + return swift.memory.retain(new imports.JsGreeter(nameObject)); + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_JsGreeter_greet"] = function bjs_JsGreeter_greet(self) { + try { + let ret = swift.memory.getObject(self).greet(); + tmpRetBytes = textEncoder.encode(ret); + return tmpRetBytes.length; + } catch (error) { + setException(error); + } + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + const exports = { + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.Macros.swift new file mode 100644 index 000000000..0c0dfb362 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.Macros.swift @@ -0,0 +1,14 @@ +// 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(Experimental) import JavaScriptKit + +@JSFunction func jsRoundTripNumber(_ v: Double) throws (JSException) -> Double + +@JSClass struct JsGreeter { + @JSFunction init(_ name: String) throws (JSException) + @JSFunction func greet() throws (JSException) -> String +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.swift new file mode 100644 index 000000000..01c2b1e6e --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.swift @@ -0,0 +1,53 @@ +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_jsRoundTripNumber") +fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 +#else +fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +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: "Check", name: "bjs_JsGreeter_init") +fileprivate func bjs_JsGreeter_init(_ name: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_init(_ name: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_JsGreeter_greet") +fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$JsGreeter_init(_ name: String) throws(JSException) -> JSObject { + let nameValue = name.bridgeJSLowerParameter() + let ret = bjs_JsGreeter_init(nameValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +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) +} \ No newline at end of file From 549ee5df7bd67c6a7b19d7c940d2c3dd17704bfb Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Thu, 22 Jan 2026 22:25:51 +0000 Subject: [PATCH 078/252] Test building `BridgeJSTool` on macOS on CI (#511) --- .github/workflows/test.yml | 3 +++ Package.swift | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0ee5bf317..5d7e40337 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -70,6 +70,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v6 + - run: swift build --product BridgeJSTool + env: + DEVELOPER_DIR: /Applications/${{ matrix.xcode }}.app/Contents/Developer/ - run: swift build --package-path ./Examples/Basic env: DEVELOPER_DIR: /Applications/${{ matrix.xcode }}.app/Contents/Developer/ diff --git a/Package.swift b/Package.swift index 521b543cc..7dac6fbae 100644 --- a/Package.swift +++ b/Package.swift @@ -20,7 +20,7 @@ let testingLinkerFlags: [LinkerSetting] = [ let package = Package( name: "JavaScriptKit", platforms: [ - .macOS(.v10_15), + .macOS(.v13), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), @@ -37,7 +37,7 @@ let package = Package( .plugin(name: "BridgeJSCommandPlugin", targets: ["BridgeJSCommandPlugin"]), ], dependencies: [ - .package(url: "https://github.com/swiftlang/swift-syntax", "600.0.0"..<"603.0.0") + .package(url: "https://github.com/swiftlang/swift-syntax", "600.0.0"..<"601.0.0") ], targets: [ .target( From fdc474e71fbc8244437ecc07115782e90a878387 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 23 Jan 2026 14:37:44 +0800 Subject: [PATCH 079/252] PlayBridgeJS: Stop using fixed heights --- .../PlayBridgeJS/Sources/JavaScript/styles.css | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Examples/PlayBridgeJS/Sources/JavaScript/styles.css b/Examples/PlayBridgeJS/Sources/JavaScript/styles.css index da62834ee..ab943c6e0 100644 --- a/Examples/PlayBridgeJS/Sources/JavaScript/styles.css +++ b/Examples/PlayBridgeJS/Sources/JavaScript/styles.css @@ -49,13 +49,12 @@ body { background-color: var(--color-fill); color: var(--color-text); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif; - height: 100vh; - overflow: hidden; + min-height: 100vh; line-height: 1.5; } .container { - height: 100vh; + min-height: 100vh; padding: 24px; display: flex; flex-direction: column; @@ -383,15 +382,26 @@ body { } @media (max-width: 768px) { + body { + overflow: auto; + } + .main-content { grid-template-columns: 1fr; gap: 16px; + flex: none; } .container { + height: auto; + min-height: 100vh; padding: 12px; } + .editor-container { + min-height: 300px; + } + .header h1 { font-size: 24px; } From d0e75f1fd266a7de8474c1ae7d726eddb0a9d788 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 23 Jan 2026 21:32:29 +0800 Subject: [PATCH 080/252] BridgeJS: Relax SwiftSyntax version constraint to support 602 and 603 (#513) --- Package.swift | 2 +- .../Sources/BridgeJSCore/ExportSwift.swift | 12 +++++++ .../Sources/BridgeJSCore/ImportTS.swift | 32 ++++++++++++++----- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/Package.swift b/Package.swift index 7dac6fbae..a513ec406 100644 --- a/Package.swift +++ b/Package.swift @@ -37,7 +37,7 @@ let package = Package( .plugin(name: "BridgeJSCommandPlugin", targets: ["BridgeJSCommandPlugin"]), ], dependencies: [ - .package(url: "https://github.com/swiftlang/swift-syntax", "600.0.0"..<"601.0.0") + .package(url: "https://github.com/swiftlang/swift-syntax", "600.0.0"..<"603.0.0") ], targets: [ .target( diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index b9b9e0634..bb51ebafc 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -2528,9 +2528,21 @@ struct ClosureCodegen { capture: ClosureCaptureClauseSyntax( leftSquare: .leftSquareToken(), items: ClosureCaptureListSyntax { + #if canImport(SwiftSyntax602) + ClosureCaptureSyntax( + name: .identifier("", presence: .missing), + initializer: InitializerClauseSyntax( + equal: .equalToken(presence: .missing), + nil, + value: ExprSyntax("callback") + ), + trailingTrivia: nil + ) + #else ClosureCaptureSyntax( expression: ExprSyntax("callback") ) + #endif }, rightSquare: .rightSquareToken() ), diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 675708c45..0ca301b68 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -734,16 +734,32 @@ enum SwiftCodePattern { /// Builds the standard @_expose and @_cdecl attributes for WebAssembly-exposed functions static func buildExposeAttributes(abiName: String) -> AttributeListSyntax { return AttributeListSyntax { + #if canImport(SwiftSyntax602) + let exposeAttrArgs = AttributeSyntax.Arguments.argumentList( + [ + LabeledExprSyntax(label: nil, expression: DeclReferenceExprSyntax(baseName: "wasm")), + LabeledExprSyntax(label: nil, expression: StringLiteralExprSyntax(content: abiName)), + ] + ) + let cdeclAttrArgs = AttributeSyntax.Arguments.argumentList( + [ + LabeledExprSyntax(label: nil, expression: StringLiteralExprSyntax(content: abiName)) + ] + ) + #else + let exposeAttrArgs = AttributeSyntax.Arguments.exposeAttributeArguments( + ExposeAttributeArgumentsSyntax( + language: .identifier("wasm"), + comma: .commaToken(), + cxxName: StringLiteralExprSyntax(content: abiName) + ) + ) + let cdeclAttrArgs = AttributeSyntax.Arguments.string(StringLiteralExprSyntax(content: abiName)) + #endif AttributeSyntax( attributeName: IdentifierTypeSyntax(name: .identifier("_expose")), leftParen: .leftParenToken(), - arguments: .exposeAttributeArguments( - ExposeAttributeArgumentsSyntax( - language: .identifier("wasm"), - comma: .commaToken(), - cxxName: StringLiteralExprSyntax(content: abiName) - ) - ), + arguments: exposeAttrArgs, rightParen: .rightParenToken() ) .with(\.trailingTrivia, .newline) @@ -751,7 +767,7 @@ enum SwiftCodePattern { AttributeSyntax( attributeName: IdentifierTypeSyntax(name: .identifier("_cdecl")), leftParen: .leftParenToken(), - arguments: .string(StringLiteralExprSyntax(content: abiName)), + arguments: cdeclAttrArgs, rightParen: .rightParenToken() ) .with(\.trailingTrivia, .newline) From 1f3ba606c1031dca66427e1be06e041117ca2002 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sun, 25 Jan 2026 09:49:38 +0800 Subject: [PATCH 081/252] Build: Enforce SWIFT_SDK_ID is set for unittest target The default value for SWIFT_SDK_ID in the Makefile was causing confusion when developers ran `make unittest` without the env var set, leading to unexpected SDK usage. --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c46431dd1..0c5d0122a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -SWIFT_SDK_ID ?= wasm32-unknown-wasi +SWIFT_SDK_ID ?= .PHONY: bootstrap bootstrap: @@ -7,6 +7,10 @@ bootstrap: .PHONY: unittest unittest: @echo Running unit tests + @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 SWIFT_SDK_ID='."; \ + exit 2; \ + } env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --swift-sdk "$(SWIFT_SDK_ID)" \ --disable-sandbox \ js test --prelude ./Tests/prelude.mjs -Xnode --expose-gc From 222b12c37a64ba0cb11dc4ea872036e3ba1d6e9f Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sun, 25 Jan 2026 10:03:34 +0800 Subject: [PATCH 082/252] BridgeJS: Remove adhoc `exportedProtocolNameByKey` recording TypeDeclResolver should be responsible for handling this --- Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift | 8 -------- .../BridgeJS/Sources/BridgeJSCore/TypeDeclResolver.swift | 6 ++++++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index bb51ebafc..d9564aff4 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -26,7 +26,6 @@ public class ExportSwift { private var exportedEnums: [ExportedEnum] = [] private var exportedStructs: [ExportedStruct] = [] private var exportedProtocols: [ExportedProtocol] = [] - private var exportedProtocolNameByKey: [String: String] = [:] private var typeDeclResolver: TypeDeclResolver = TypeDeclResolver() private var sourceFiles: [(sourceFile: SourceFileSyntax, inputFilePath: String)] = [] @@ -1136,8 +1135,6 @@ public class ExportSwift { stateStack.pop() - parent.exportedProtocolNameByKey[protocolUniqueKey] = name - return .skipChildren } @@ -1598,11 +1595,6 @@ public class ExportSwift { return primitiveType } - let protocolKey = typeName - if let protocolName = exportedProtocolNameByKey[protocolKey] { - return .swiftProtocol(protocolName) - } - guard let typeDecl = typeDeclResolver.resolve(type) else { return nil } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/TypeDeclResolver.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/TypeDeclResolver.swift index 33e36a4a2..975c0c9dc 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/TypeDeclResolver.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/TypeDeclResolver.swift @@ -63,6 +63,12 @@ class TypeDeclResolver { override func visitPost(_ node: EnumDeclSyntax) { visitPostNominalDecl() } + override func visit(_ node: ProtocolDeclSyntax) -> SyntaxVisitorContinueKind { + return visitNominalDecl(node) + } + override func visitPost(_ node: ProtocolDeclSyntax) { + visitPostNominalDecl() + } override func visit(_ node: TypeAliasDeclSyntax) -> SyntaxVisitorContinueKind { let name = node.name.text From a2b9900616d1e073ed05721d1f7963da27d590e1 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sun, 25 Jan 2026 10:11:56 +0800 Subject: [PATCH 083/252] BridgeJS: Merge small core files into single Misc.swift Ugry hack to allow me to add new files later without paying build time penalty... --- .../BridgeJSCore/BridgeJSCoreError.swift | 7 --- .../BridgeJSCore/DiagnosticError.swift | 23 ------- .../{BridgeJSConfig.swift => Misc.swift} | 60 +++++++++++++++++++ .../BridgeJSCore/ProgressReporting.swift | 19 ------ 4 files changed, 60 insertions(+), 49 deletions(-) delete mode 100644 Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSCoreError.swift delete mode 100644 Plugins/BridgeJS/Sources/BridgeJSCore/DiagnosticError.swift rename Plugins/BridgeJS/Sources/BridgeJSCore/{BridgeJSConfig.swift => Misc.swift} (67%) delete mode 100644 Plugins/BridgeJS/Sources/BridgeJSCore/ProgressReporting.swift diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSCoreError.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSCoreError.swift deleted file mode 100644 index 9cbec438e..000000000 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSCoreError.swift +++ /dev/null @@ -1,7 +0,0 @@ -public struct BridgeJSCoreError: Swift.Error, CustomStringConvertible { - public let description: String - - public init(_ message: String) { - self.description = message - } -} diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/DiagnosticError.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/DiagnosticError.swift deleted file mode 100644 index 2688f8da2..000000000 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/DiagnosticError.swift +++ /dev/null @@ -1,23 +0,0 @@ -import SwiftSyntax - -struct DiagnosticError: Error { - let node: Syntax - let message: String - let hint: String? - - init(node: some SyntaxProtocol, message: String, hint: String? = nil) { - self.node = Syntax(node) - self.message = message - self.hint = hint - } - - func formattedDescription(fileName: String) -> String { - let locationConverter = SourceLocationConverter(fileName: fileName, tree: node.root) - let location = locationConverter.location(for: node.position) - var description = "\(fileName):\(location.line):\(location.column): error: \(message)" - if let hint { - description += "\nHint: \(hint)" - } - return description - } -} diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSConfig.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift similarity index 67% rename from Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSConfig.swift rename to Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift index 56646b59c..e11bd4058 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSConfig.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift @@ -1,3 +1,63 @@ +// MARK: - ProgressReporting + +public struct ProgressReporting { + let print: (String) -> Void + + public init(verbose: Bool) { + self.init(print: verbose ? { Swift.print($0) } : { _ in }) + } + + private init(print: @escaping (String) -> Void) { + self.print = print + } + + public static var silent: ProgressReporting { + return ProgressReporting(print: { _ in }) + } + + public func print(_ message: String) { + self.print(message) + } +} + +// MARK: - DiagnosticError + +import SwiftSyntax + +struct DiagnosticError: Error { + let node: Syntax + let message: String + let hint: String? + + init(node: some SyntaxProtocol, message: String, hint: String? = nil) { + self.node = Syntax(node) + self.message = message + self.hint = hint + } + + func formattedDescription(fileName: String) -> String { + let locationConverter = SourceLocationConverter(fileName: fileName, tree: node.root) + let location = locationConverter.location(for: node.position) + var description = "\(fileName):\(location.line):\(location.column): error: \(message)" + if let hint { + description += "\nHint: \(hint)" + } + return description + } +} + +// MARK: - BridgeJSCoreError + +public struct BridgeJSCoreError: Swift.Error, CustomStringConvertible { + public let description: String + + public init(_ message: String) { + self.description = message + } +} + +// MARK: - BridgeJSConfig + import struct Foundation.URL import struct Foundation.Data import class Foundation.FileManager diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ProgressReporting.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ProgressReporting.swift deleted file mode 100644 index d1a2aa6d8..000000000 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ProgressReporting.swift +++ /dev/null @@ -1,19 +0,0 @@ -public struct ProgressReporting { - let print: (String) -> Void - - public init(verbose: Bool) { - self.init(print: verbose ? { Swift.print($0) } : { _ in }) - } - - private init(print: @escaping (String) -> Void) { - self.print = print - } - - public static var silent: ProgressReporting { - return ProgressReporting(print: { _ in }) - } - - public func print(_ message: String) { - self.print(message) - } -} From de0928b7539b1f4e5cba012a73b35c7e4b07378b Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 26 Jan 2026 11:40:16 +0800 Subject: [PATCH 084/252] Add SwiftToSkeleton unified Swift-to-skeleton API (#516) * Add SwiftToSkeleton unified Swift-to-skeleton API Now ExportSwift/ImportTS are not responsible for collecting macro-annotated decls and produce skeletons. * PlayBridgeJS: Update to use SwiftToSkeleton --- .../Sources/PlayBridgeJS/main.swift | 33 +- .../Sources/BridgeJSCore/ExportSwift.swift | 1682 +----------- .../BridgeJSCore/ImportSwiftMacros.swift | 710 ----- .../Sources/BridgeJSCore/ImportTS.swift | 9 +- .../BridgeJSCore/SwiftToSkeleton.swift | 2300 +++++++++++++++++ .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 19 +- .../Sources/BridgeJSTool/BridgeJSTool.swift | 38 +- .../BridgeJSToolTests/BridgeJSLinkTests.swift | 78 +- .../BridgeJSToolTests/ExportSwiftTests.swift | 53 +- .../BridgeJSToolTests/ImportTSTests.swift | 11 +- .../Generated/JavaScript/BridgeJS.json | 12 - 11 files changed, 2437 insertions(+), 2508 deletions(-) delete mode 100644 Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift create mode 100644 Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift index e7f70311d..80572962a 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift @@ -18,22 +18,27 @@ import class Foundation.JSONDecoder func _update(swiftSource: String, dtsSource: String) throws -> PlayBridgeJSOutput { let moduleName = "Playground" - let exportSwift = ExportSwift(progress: .silent, moduleName: moduleName, exposeToGlobal: false) - let sourceFile = Parser.parse(source: swiftSource) - try exportSwift.addSourceFile(sourceFile, "Playground.swift") - let exportResult = try exportSwift.finalize() + + let swiftToSkeleton = SwiftToSkeleton(progress: .silent, moduleName: moduleName, exposeToGlobal: false) + swiftToSkeleton.addSourceFile(Parser.parse(source: swiftSource), inputFilePath: "Playground.swift") + let ts2swift = try createTS2Swift() let importSwiftMacroDecls = try ts2swift.convert(dtsSource) - let importSwift = ImportSwiftMacros(progress: .silent, moduleName: moduleName) - let importSourceFile = Parser.parse(source: importSwiftMacroDecls) - importSwift.addSourceFile(importSourceFile, "Playground.Macros.swift") - importSwift.addSourceFile(sourceFile, "Playground.swift") - let importResult = try importSwift.finalize() - let skeleton = BridgeJSSkeleton( - moduleName: moduleName, - exported: exportResult.map { $0.outputSkeleton }, - imported: importResult.outputSkeleton + swiftToSkeleton.addSourceFile( + Parser.parse(source: importSwiftMacroDecls), + inputFilePath: "Playground.Macros.swift" ) + + let skeleton = try swiftToSkeleton.finalize() + + let exportResult = try skeleton.exported.flatMap { + let exportSwift = ExportSwift(progress: .silent, moduleName: moduleName, skeleton: $0) + return try exportSwift.finalize() + } + let importResult = try skeleton.imported.flatMap { + let importTS = ImportTS(progress: .silent, moduleName: moduleName, skeleton: $0) + return try importTS.finalize() + } let linker = BridgeJSLink(skeletons: [skeleton], sharedMemory: false) let linked = try linker.link() @@ -41,7 +46,7 @@ import class Foundation.JSONDecoder outputJs: linked.outputJs, outputDts: linked.outputDts, importSwiftMacroDecls: importSwiftMacroDecls, - swiftGlue: (importResult.outputSwift ?? "") + "\n\n" + (exportResult?.outputSwift ?? "") + swiftGlue: (importResult ?? "") + "\n\n" + (exportResult ?? "") ) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index d9564aff4..18d529d3e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -21,1651 +21,39 @@ public class ExportSwift { let progress: ProgressReporting let moduleName: String private let exposeToGlobal: Bool - private var exportedFunctions: [ExportedFunction] = [] - private var exportedClasses: [ExportedClass] = [] - private var exportedEnums: [ExportedEnum] = [] - private var exportedStructs: [ExportedStruct] = [] - private var exportedProtocols: [ExportedProtocol] = [] - private var typeDeclResolver: TypeDeclResolver = TypeDeclResolver() + private var skeleton: ExportedSkeleton private var sourceFiles: [(sourceFile: SourceFileSyntax, inputFilePath: String)] = [] - public init(progress: ProgressReporting, moduleName: String, exposeToGlobal: Bool) { + public init(progress: ProgressReporting, moduleName: String, skeleton: ExportedSkeleton) { self.progress = progress self.moduleName = moduleName - self.exposeToGlobal = exposeToGlobal + self.exposeToGlobal = skeleton.exposeToGlobal + self.skeleton = skeleton } - /// Processes a Swift source file to find declarations marked with @JS - /// - /// - Parameters: - /// - sourceFile: The parsed Swift source file to process - /// - inputFilePath: The file path for error reporting - public func addSourceFile(_ sourceFile: SourceFileSyntax, _ inputFilePath: String) throws { - // First, register type declarations before walking for exposed APIs - typeDeclResolver.addSourceFile(sourceFile) - sourceFiles.append((sourceFile, inputFilePath)) - } - - /// Finalizes the export process and generates the bridge code - /// - /// - Parameters: - /// - exposeToGlobal: Whether to expose exported APIs to the global namespace (default: false) - /// - Returns: A tuple containing the generated Swift code and a skeleton - /// describing the exported APIs - public func finalize() throws -> (outputSwift: String, outputSkeleton: ExportedSkeleton)? { - // Walk through each source file and collect exported APIs - var perSourceErrors: [(inputFilePath: String, errors: [DiagnosticError])] = [] - for (sourceFile, inputFilePath) in sourceFiles { - progress.print("Processing \(inputFilePath)") - let errors = try parseSingleFile(sourceFile) - if errors.count > 0 { - perSourceErrors.append((inputFilePath: inputFilePath, errors: errors)) - } - } - - if !perSourceErrors.isEmpty { - // Aggregate and throw all errors - var allErrors: [String] = [] - for (inputFilePath, errors) in perSourceErrors { - for error in errors { - allErrors.append(error.formattedDescription(fileName: inputFilePath)) - } - } - throw BridgeJSCoreError(allErrors.joined(separator: "\n")) - } - - guard let outputSwift = try renderSwiftGlue() else { - return nil - } - return ( - outputSwift: outputSwift, - outputSkeleton: ExportedSkeleton( - functions: exportedFunctions, - classes: exportedClasses, - enums: exportedEnums, - structs: exportedStructs, - protocols: exportedProtocols, - exposeToGlobal: exposeToGlobal - ) - ) - } - - fileprivate final class APICollector: SyntaxAnyVisitor { - var exportedFunctions: [ExportedFunction] = [] - /// The names of the exported classes, in the order they were written in the source file - var exportedClassNames: [String] = [] - var exportedClassByName: [String: ExportedClass] = [:] - /// The names of the exported enums, in the order they were written in the source file - var exportedEnumNames: [String] = [] - var exportedEnumByName: [String: ExportedEnum] = [:] - /// The names of the exported protocols, in the order they were written in the source file - var exportedProtocolNames: [String] = [] - var exportedProtocolByName: [String: ExportedProtocol] = [:] - /// The names of the exported structs, in the order they were written in the source file - var exportedStructNames: [String] = [] - var exportedStructByName: [String: ExportedStruct] = [:] - var errors: [DiagnosticError] = [] - - /// Creates a unique key by combining name and namespace - private func makeKey(name: String, namespace: [String]?) -> String { - if let namespace = namespace, !namespace.isEmpty { - return "\(namespace.joined(separator: ".")).\(name)" - } else { - return name - } - } - - struct NamespaceResolution { - let namespace: [String]? - let isValid: Bool - } - - /// Resolves and validates namespace from both @JS attribute and computed (nested) namespace - /// Returns the effective namespace and whether validation succeeded - private func resolveNamespace( - from jsAttribute: AttributeSyntax, - for node: some SyntaxProtocol, - declarationType: String - ) -> NamespaceResolution { - let attributeNamespace = extractNamespace(from: jsAttribute) - let computedNamespace = computeNamespace(for: node) - - if computedNamespace != nil && attributeNamespace != nil { - diagnose( - node: jsAttribute, - message: "Nested \(declarationType)s cannot specify their own namespace", - hint: - "Remove the namespace from @JS attribute - nested \(declarationType)s inherit namespace from parent" - ) - return NamespaceResolution(namespace: nil, isValid: false) - } - - return NamespaceResolution(namespace: computedNamespace ?? attributeNamespace, isValid: true) - } - - enum State { - case topLevel - case classBody(name: String, key: String) - case enumBody(name: String, key: String) - case protocolBody(name: String, key: String) - case structBody(name: String, key: String) - } - - struct StateStack { - private var states: [State] - var current: State { - return states.last! - } - - init(_ initialState: State) { - self.states = [initialState] - } - mutating func push(state: State) { - states.append(state) - } - - mutating func pop() { - _ = states.removeLast() - } - } - - var stateStack: StateStack = StateStack(.topLevel) - var state: State { - return stateStack.current - } - let parent: ExportSwift - - init(parent: ExportSwift) { - self.parent = parent - super.init(viewMode: .sourceAccurate) - } - - private func diagnose(node: some SyntaxProtocol, message: String, hint: String? = nil) { - errors.append(DiagnosticError(node: node, message: message, hint: hint)) - } - - private func diagnoseUnsupportedType(node: some SyntaxProtocol, type: String) { - diagnose( - node: node, - message: "Unsupported type: \(type)", - hint: "Only primitive types and types defined in the same module are allowed" - ) - } - - private func diagnoseNestedOptional(node: some SyntaxProtocol, type: String) { - diagnose( - node: node, - message: "Nested optional types are not supported: \(type)", - hint: "Use a single optional like String? instead of String?? or Optional>" - ) - } - - /// Detects whether given expression is supported as default parameter value - private func isSupportedDefaultValueExpression(_ initClause: InitializerClauseSyntax) -> Bool { - let expression = initClause.value - - // Function calls are checked later in extractDefaultValue (as constructors are allowed) - if expression.is(ArrayExprSyntax.self) { return false } - if expression.is(DictionaryExprSyntax.self) { return false } - if expression.is(BinaryOperatorExprSyntax.self) { return false } - if expression.is(ClosureExprSyntax.self) { return false } - - // Method call chains (e.g., obj.foo()) - if let memberExpression = expression.as(MemberAccessExprSyntax.self), - memberExpression.base?.is(FunctionCallExprSyntax.self) == true - { - return false - } - - return true - } - - /// Extract enum case value from member access expression - private func extractEnumCaseValue( - from memberExpr: MemberAccessExprSyntax, - type: BridgeType - ) -> DefaultValue? { - let caseName = memberExpr.declName.baseName.text - - let enumName: String? - switch type { - case .caseEnum(let name), .rawValueEnum(let name, _), .associatedValueEnum(let name): - enumName = name - case .optional(let wrappedType): - switch wrappedType { - case .caseEnum(let name), .rawValueEnum(let name, _), .associatedValueEnum(let name): - enumName = name - default: - return nil - } - default: - return nil - } - - guard let enumName = enumName else { return nil } - - if memberExpr.base == nil { - return .enumCase(enumName, caseName) - } - - if let baseExpr = memberExpr.base?.as(DeclReferenceExprSyntax.self) { - let baseName = baseExpr.baseName.text - let lastComponent = enumName.split(separator: ".").last.map(String.init) ?? enumName - if baseName == enumName || baseName == lastComponent { - return .enumCase(enumName, caseName) - } - } - - return nil - } - - /// Extracts default value from parameter's default value clause - private func extractDefaultValue( - from defaultClause: InitializerClauseSyntax?, - type: BridgeType - ) -> DefaultValue? { - guard let defaultClause = defaultClause else { - return nil - } - - if !isSupportedDefaultValueExpression(defaultClause) { - diagnose( - node: defaultClause, - message: "Complex default parameter expressions are not supported", - hint: "Use simple literal values (e.g., \"text\", 42, true, nil) or simple constants" - ) - return nil - } - - let expr = defaultClause.value - - if expr.is(NilLiteralExprSyntax.self) { - guard case .optional(_) = type else { - diagnose( - node: expr, - message: "nil is only valid for optional parameters", - hint: "Make the parameter optional by adding ? to the type" - ) - return nil - } - return .null - } - - if let memberExpr = expr.as(MemberAccessExprSyntax.self), - let enumValue = extractEnumCaseValue(from: memberExpr, type: type) - { - return enumValue - } - - if let funcCall = expr.as(FunctionCallExprSyntax.self) { - return extractConstructorDefaultValue(from: funcCall, type: type) - } - - if let literalValue = extractLiteralValue(from: expr, type: type) { - return literalValue - } - - diagnose( - node: expr, - message: "Unsupported default parameter value expression", - hint: "Use simple literal values like \"text\", 42, true, false, nil, or enum cases like .caseName" - ) - return nil - } - - /// Extracts default value from a constructor call expression - private func extractConstructorDefaultValue( - from funcCall: FunctionCallExprSyntax, - type: BridgeType - ) -> DefaultValue? { - guard let calledExpr = funcCall.calledExpression.as(DeclReferenceExprSyntax.self) else { - diagnose( - node: funcCall, - message: "Complex constructor expressions are not supported", - hint: "Use a simple constructor call like ClassName() or ClassName(arg: value)" - ) - return nil - } - - let typeName = calledExpr.baseName.text - - let isStructType: Bool - let expectedTypeName: String? - switch type { - case .swiftStruct(let name), .optional(.swiftStruct(let name)): - isStructType = true - expectedTypeName = name.split(separator: ".").last.map(String.init) - case .swiftHeapObject(let name), .optional(.swiftHeapObject(let name)): - isStructType = false - expectedTypeName = name.split(separator: ".").last.map(String.init) - default: - diagnose( - node: funcCall, - message: "Constructor calls are only supported for class and struct types", - hint: "Parameter type should be a Swift class or struct" - ) - return nil - } - - guard let expectedTypeName = expectedTypeName, typeName == expectedTypeName else { - diagnose( - node: funcCall, - message: "Constructor type name '\(typeName)' doesn't match parameter type", - hint: "Ensure the constructor matches the parameter type" - ) - return nil - } - - if isStructType { - // For structs, extract field name/value pairs - var fields: [DefaultValueField] = [] - for argument in funcCall.arguments { - guard let fieldName = argument.label?.text else { - diagnose( - node: argument, - message: "Struct initializer arguments must have labels", - hint: "Use labeled arguments like MyStruct(x: 1, y: 2)" - ) - return nil - } - guard let fieldValue = extractLiteralValue(from: argument.expression) else { - diagnose( - node: argument.expression, - message: "Struct field value must be a literal", - hint: "Use simple literals like \"text\", 42, true, false in struct fields" - ) - return nil - } - fields.append(DefaultValueField(name: fieldName, value: fieldValue)) - } - return .structLiteral(typeName, fields) - } else { - if funcCall.arguments.isEmpty { - return .object(typeName) - } - - var constructorArgs: [DefaultValue] = [] - for argument in funcCall.arguments { - guard let argValue = extractLiteralValue(from: argument.expression) else { - diagnose( - node: argument.expression, - message: "Constructor argument must be a literal value", - hint: "Use simple literals like \"text\", 42, true, false in constructor arguments" - ) - return nil - } - constructorArgs.append(argValue) - } - return .objectWithArguments(typeName, constructorArgs) - } - } - - /// Extracts a literal value from an expression with optional type checking - private func extractLiteralValue(from expr: ExprSyntax, type: BridgeType? = nil) -> DefaultValue? { - if expr.is(NilLiteralExprSyntax.self) { - return .null - } - - if let stringLiteral = expr.as(StringLiteralExprSyntax.self), - let segment = stringLiteral.segments.first?.as(StringSegmentSyntax.self) - { - let value = DefaultValue.string(segment.content.text) - if let type = type, !type.isCompatibleWith(.string) { - return nil - } - return value - } - - if let boolLiteral = expr.as(BooleanLiteralExprSyntax.self) { - let value = DefaultValue.bool(boolLiteral.literal.text == "true") - if let type = type, !type.isCompatibleWith(.bool) { - return nil - } - return value - } - - var numericExpr = expr - var isNegative = false - if let prefixExpr = expr.as(PrefixOperatorExprSyntax.self), - prefixExpr.operator.text == "-" - { - numericExpr = prefixExpr.expression - isNegative = true - } - - if let intLiteral = numericExpr.as(IntegerLiteralExprSyntax.self), - let intValue = Int(intLiteral.literal.text) - { - let value = DefaultValue.int(isNegative ? -intValue : intValue) - if let type = type, !type.isCompatibleWith(.int) { - return nil - } - return value - } - - if let floatLiteral = numericExpr.as(FloatLiteralExprSyntax.self) { - if let floatValue = Float(floatLiteral.literal.text) { - let value = DefaultValue.float(isNegative ? -floatValue : floatValue) - if type == nil || type?.isCompatibleWith(.float) == true { - return value - } - } - if let doubleValue = Double(floatLiteral.literal.text) { - let value = DefaultValue.double(isNegative ? -doubleValue : doubleValue) - if type == nil || type?.isCompatibleWith(.double) == true { - return value - } - } - } - - return nil - } - - /// Shared parameter parsing logic used by functions, initializers, and protocol methods - private func parseParameters( - from parameterClause: FunctionParameterClauseSyntax, - allowDefaults: Bool = true - ) -> [Parameter] { - var parameters: [Parameter] = [] - - for param in parameterClause.parameters { - let resolvedType = self.parent.lookupType(for: param.type) - if let type = resolvedType, case .closure(let signature) = type { - if signature.isAsync { - diagnose( - node: param.type, - message: "Async is not supported for Swift closures yet." - ) - continue - } - if signature.isThrows { - diagnose( - node: param.type, - message: "Throws is not supported for Swift closures yet." - ) - continue - } - } - if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { - diagnoseNestedOptional(node: param.type, type: param.type.trimmedDescription) - continue - } - if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { - diagnoseNestedOptional(node: param.type, type: param.type.trimmedDescription) - continue - } - - guard let type = resolvedType else { - diagnoseUnsupportedType(node: param.type, type: param.type.trimmedDescription) - continue - } - - let name = param.secondName?.text ?? param.firstName.text - let label = param.firstName.text - - let defaultValue: DefaultValue? - if allowDefaults { - defaultValue = extractDefaultValue(from: param.defaultValue, type: type) - } else { - defaultValue = nil - } - - parameters.append(Parameter(label: label, name: name, type: type, defaultValue: defaultValue)) - } - - return parameters - } - - override func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { - guard node.attributes.hasJSAttribute() else { - return .skipChildren - } - - let isStatic = node.modifiers.contains { modifier in - modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) - } - - switch state { - case .topLevel: - if isStatic { - diagnose(node: node, message: "Top-level functions cannot be static") - return .skipChildren - } - if let exportedFunction = visitFunction(node: node, isStatic: false) { - exportedFunctions.append(exportedFunction) - } - return .skipChildren - case .classBody(let className, let classKey): - if let exportedFunction = visitFunction( - node: node, - isStatic: isStatic, - className: className, - classKey: classKey - ) { - exportedClassByName[classKey]?.methods.append(exportedFunction) - } - return .skipChildren - case .enumBody(let enumName, let enumKey): - if !isStatic { - diagnose(node: node, message: "Only static functions are supported in enums") - return .skipChildren - } - if let exportedFunction = visitFunction(node: node, isStatic: isStatic, enumName: enumName) { - if var currentEnum = exportedEnumByName[enumKey] { - currentEnum.staticMethods.append(exportedFunction) - exportedEnumByName[enumKey] = currentEnum - } - } - return .skipChildren - case .protocolBody(_, _): - // Protocol methods are handled in visitProtocolMethod during protocol parsing - return .skipChildren - case .structBody(let structName, let structKey): - if let exportedFunction = visitFunction(node: node, isStatic: isStatic, structName: structName) { - if var currentStruct = exportedStructByName[structKey] { - currentStruct.methods.append(exportedFunction) - exportedStructByName[structKey] = currentStruct - } - } - return .skipChildren - } - } - - private func visitFunction( - node: FunctionDeclSyntax, - isStatic: Bool, - className: String? = nil, - classKey: String? = nil, - enumName: String? = nil, - structName: String? = nil - ) -> ExportedFunction? { - guard let jsAttribute = node.attributes.firstJSAttribute else { - return nil - } - - let name = node.name.text - - let attributeNamespace = extractNamespace(from: jsAttribute) - let computedNamespace = computeNamespace(for: node) - - let finalNamespace: [String]? - - if let computed = computedNamespace, !computed.isEmpty { - finalNamespace = computed - } else { - finalNamespace = attributeNamespace - } - - if attributeNamespace != nil, case .classBody = state { - diagnose( - node: jsAttribute, - message: "Namespace is only needed in top-level declaration", - hint: "Remove the namespace from @JS attribute or move this function to top-level" - ) - } - - if attributeNamespace != nil, case .enumBody = state { - diagnose( - node: jsAttribute, - message: "Namespace is not supported for enum static functions", - hint: "Remove the namespace from @JS attribute - enum functions inherit namespace from enum" - ) - } - - let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: true) - let returnType: BridgeType - if let returnClause = node.signature.returnClause { - let resolvedType = self.parent.lookupType(for: returnClause.type) - - if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { - diagnoseNestedOptional(node: returnClause.type, type: returnClause.type.trimmedDescription) - return nil - } - - guard let type = resolvedType else { - diagnoseUnsupportedType(node: returnClause.type, type: returnClause.type.trimmedDescription) - return nil - } - returnType = type - } else { - returnType = .void - } - - let abiName: String - let staticContext: StaticContext? - - switch state { - case .topLevel: - staticContext = nil - case .classBody(let className, _): - if isStatic { - staticContext = .className(className) - } else { - staticContext = nil - } - case .enumBody(let enumName, let enumKey): - if !isStatic { - diagnose(node: node, message: "Only static functions are supported in enums") - return nil - } - - let isNamespaceEnum = exportedEnumByName[enumKey]?.cases.isEmpty ?? true - staticContext = isNamespaceEnum ? .namespaceEnum : .enumName(enumName) - case .protocolBody(_, _): - return nil - case .structBody(let structName, _): - if isStatic { - staticContext = .structName(structName) - } else { - staticContext = nil - } - } - - let classNameForABI: String? - switch state { - case .classBody(let className, _): - classNameForABI = className - case .structBody(let structName, _): - classNameForABI = structName - default: - classNameForABI = nil - } - abiName = ABINameGenerator.generateABIName( - baseName: name, - namespace: finalNamespace, - staticContext: isStatic ? staticContext : nil, - className: classNameForABI - ) - - guard let effects = collectEffects(signature: node.signature, isStatic: isStatic) else { - return nil - } - - return ExportedFunction( - name: name, - abiName: abiName, - parameters: parameters, - returnType: returnType, - effects: effects, - namespace: finalNamespace, - staticContext: staticContext - ) - } - - private func collectEffects(signature: FunctionSignatureSyntax, isStatic: Bool = false) -> Effects? { - let isAsync = signature.effectSpecifiers?.asyncSpecifier != nil - var isThrows = false - if let throwsClause: ThrowsClauseSyntax = signature.effectSpecifiers?.throwsClause { - // Limit the thrown type to JSException for now - guard let thrownType = throwsClause.type else { - diagnose( - node: throwsClause, - message: "Thrown type is not specified, only JSException is supported for now" - ) - return nil - } - guard thrownType.trimmedDescription == "JSException" else { - diagnose( - node: throwsClause, - message: "Only JSException is supported for thrown type, got \(thrownType.trimmedDescription)" - ) - return nil - } - isThrows = true - } - return Effects(isAsync: isAsync, isThrows: isThrows, isStatic: isStatic) - } - - private func extractNamespace( - from jsAttribute: AttributeSyntax - ) -> [String]? { - guard let arguments = jsAttribute.arguments?.as(LabeledExprListSyntax.self) else { - return nil - } - - guard let namespaceArg = arguments.first(where: { $0.label?.text == "namespace" }), - let stringLiteral = namespaceArg.expression.as(StringLiteralExprSyntax.self), - let namespaceString = stringLiteral.segments.first?.as(StringSegmentSyntax.self)?.content.text - else { - return nil - } - - return namespaceString.split(separator: ".").map(String.init) - } - - private func extractEnumStyle( - from jsAttribute: AttributeSyntax - ) -> EnumEmitStyle? { - guard let arguments = jsAttribute.arguments?.as(LabeledExprListSyntax.self), - let styleArg = arguments.first(where: { $0.label?.text == "enumStyle" }) - else { - return nil - } - let text = styleArg.expression.trimmedDescription - if text.contains("tsEnum") { - return .tsEnum - } - if text.contains("const") { - return .const - } - return nil - } - - override func visit(_ node: InitializerDeclSyntax) -> SyntaxVisitorContinueKind { - guard let jsAttribute = node.attributes.firstJSAttribute else { return .skipChildren } - - switch state { - case .classBody(let className, let classKey): - if extractNamespace(from: jsAttribute) != nil { - diagnose( - node: jsAttribute, - message: "Namespace is not supported for initializer declarations", - hint: "Remove the namespace from @JS attribute" - ) - } - - let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: true) - - guard let effects = collectEffects(signature: node.signature) else { - return .skipChildren - } - - let constructor = ExportedConstructor( - abiName: "bjs_\(className)_init", - parameters: parameters, - effects: effects - ) - exportedClassByName[classKey]?.constructor = constructor - - case .structBody(let structName, let structKey): - if extractNamespace(from: jsAttribute) != nil { - diagnose( - node: jsAttribute, - message: "Namespace is not supported for initializer declarations", - hint: "Remove the namespace from @JS attribute" - ) - } - - let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: true) - - guard let effects = collectEffects(signature: node.signature) else { - return .skipChildren - } - - let constructor = ExportedConstructor( - abiName: "bjs_\(structName)_init", - parameters: parameters, - effects: effects - ) - exportedStructByName[structKey]?.constructor = constructor - - case .enumBody(_, _): - diagnose(node: node, message: "Initializers are not supported inside enums") - - case .topLevel, .protocolBody(_, _): - diagnose(node: node, message: "@JS init must be inside a @JS class or struct") - } - - return .skipChildren - } - - override func visit(_ node: VariableDeclSyntax) -> SyntaxVisitorContinueKind { - guard let jsAttribute = node.attributes.firstJSAttribute else { return .skipChildren } - - let isStatic = node.modifiers.contains { modifier in - modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) - } - - let attributeNamespace = extractNamespace(from: jsAttribute) - if attributeNamespace != nil { - diagnose( - node: jsAttribute, - message: "Namespace parameter within @JS attribute is not supported for property declarations", - hint: - "Remove the namespace from @JS attribute. If you need dedicated namespace, consider using a nested enum or class instead." - ) - } - - let computedNamespace = computeNamespace(for: node) - let finalNamespace: [String]? - - if let computed = computedNamespace, !computed.isEmpty { - finalNamespace = computed - } else { - finalNamespace = nil - } - - // Determine static context and validate placement - let staticContext: StaticContext? - - switch state { - case .classBody(let className, _): - staticContext = isStatic ? .className(className) : nil - case .enumBody(let enumName, let enumKey): - if !isStatic { - diagnose(node: node, message: "Only static properties are supported in enums") - return .skipChildren - } - let isNamespaceEnum = exportedEnumByName[enumKey]?.cases.isEmpty ?? true - staticContext = isStatic ? (isNamespaceEnum ? .namespaceEnum : .enumName(enumName)) : nil - case .topLevel: - diagnose(node: node, message: "@JS var must be inside a @JS class or enum") - return .skipChildren - case .protocolBody(let protocolName, let protocolKey): - return visitProtocolProperty(node: node, protocolName: protocolName, protocolKey: protocolKey) - case .structBody(let structName, _): - if isStatic { - staticContext = .structName(structName) - } else { - diagnose(node: node, message: "@JS var must be static in structs (instance fields don't need @JS)") - return .skipChildren - } - } - - // Process each binding (variable declaration) - for binding in node.bindings { - guard let pattern = binding.pattern.as(IdentifierPatternSyntax.self) else { - diagnose(node: binding.pattern, message: "Complex patterns not supported for @JS properties") - continue - } - - let propertyName = pattern.identifier.text - - guard let typeAnnotation = binding.typeAnnotation else { - diagnose(node: binding, message: "@JS property must have explicit type annotation") - continue - } - - guard let propertyType = self.parent.lookupType(for: typeAnnotation.type) else { - diagnoseUnsupportedType(node: typeAnnotation.type, type: typeAnnotation.type.trimmedDescription) - continue - } - - // Check if property is readonly - let isLet = node.bindingSpecifier.tokenKind == .keyword(.let) - let isGetterOnly = node.bindings.contains(where: { self.hasOnlyGetter($0.accessorBlock) }) - - let isReadonly = isLet || isGetterOnly - - let exportedProperty = ExportedProperty( - name: propertyName, - type: propertyType, - isReadonly: isReadonly, - isStatic: isStatic, - namespace: finalNamespace, - staticContext: staticContext - ) - - if case .enumBody(_, let key) = state { - if var currentEnum = exportedEnumByName[key] { - currentEnum.staticProperties.append(exportedProperty) - exportedEnumByName[key] = currentEnum - } - } else if case .structBody(_, let key) = state { - exportedStructByName[key]?.properties.append(exportedProperty) - } else if case .classBody(_, let key) = state { - exportedClassByName[key]?.properties.append(exportedProperty) - } - } - - return .skipChildren - } - - override func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind { - let name = node.name.text - - guard let jsAttribute = node.attributes.firstJSAttribute else { - return .skipChildren - } - - let namespaceResult = resolveNamespace(from: jsAttribute, for: node, declarationType: "class") - guard namespaceResult.isValid else { - return .skipChildren - } - let swiftCallName = ExportSwift.computeSwiftCallName(for: node, itemName: name) - let explicitAccessControl = computeExplicitAtLeastInternalAccessControl( - for: node, - message: "Class visibility must be at least internal" - ) - let exportedClass = ExportedClass( - name: name, - swiftCallName: swiftCallName, - explicitAccessControl: explicitAccessControl, - constructor: nil, - methods: [], - properties: [], - namespace: namespaceResult.namespace - ) - let uniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) - - stateStack.push(state: .classBody(name: name, key: uniqueKey)) - exportedClassByName[uniqueKey] = exportedClass - exportedClassNames.append(uniqueKey) - return .visitChildren - } - - override func visitPost(_ node: ClassDeclSyntax) { - // Make sure we pop the state stack only if we're in a class body state (meaning we successfully pushed) - if case .classBody(_, _) = stateStack.current { - stateStack.pop() - } - } - - override func visit(_ node: EnumDeclSyntax) -> SyntaxVisitorContinueKind { - guard let jsAttribute = node.attributes.firstJSAttribute else { - return .skipChildren - } - - let name = node.name.text - - let rawType: String? = node.inheritanceClause?.inheritedTypes.first { inheritedType in - let typeName = inheritedType.type.trimmedDescription - return Constants.supportedRawTypes.contains(typeName) - }?.type.trimmedDescription - - let namespaceResult = resolveNamespace(from: jsAttribute, for: node, declarationType: "enum") - guard namespaceResult.isValid else { - return .skipChildren - } - let emitStyle = extractEnumStyle(from: jsAttribute) ?? .const - let swiftCallName = ExportSwift.computeSwiftCallName(for: node, itemName: name) - let explicitAccessControl = computeExplicitAtLeastInternalAccessControl( - for: node, - message: "Enum visibility must be at least internal" - ) - - let tsFullPath: String - if let namespace = namespaceResult.namespace, !namespace.isEmpty { - tsFullPath = namespace.joined(separator: ".") + "." + name - } else { - tsFullPath = name - } - - // Create enum directly in dictionary - let exportedEnum = ExportedEnum( - name: name, - swiftCallName: swiftCallName, - tsFullPath: tsFullPath, - explicitAccessControl: explicitAccessControl, - cases: [], // Will be populated in visit(EnumCaseDeclSyntax) - rawType: SwiftEnumRawType(rawType), - namespace: namespaceResult.namespace, - emitStyle: emitStyle, - staticMethods: [], - staticProperties: [] - ) - - let enumUniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) - exportedEnumByName[enumUniqueKey] = exportedEnum - exportedEnumNames.append(enumUniqueKey) - - stateStack.push(state: .enumBody(name: name, key: enumUniqueKey)) - - return .visitChildren - } - - override func visitPost(_ node: EnumDeclSyntax) { - guard let jsAttribute = node.attributes.firstJSAttribute else { - // Only pop if we have a valid enum that was processed - if case .enumBody(_, _) = stateStack.current { - stateStack.pop() - } - return - } - - guard case .enumBody(_, let enumKey) = stateStack.current else { - return - } - - guard let exportedEnum = exportedEnumByName[enumKey] else { - stateStack.pop() - return - } - - let emitStyle = exportedEnum.emitStyle - - if case .tsEnum = emitStyle { - if exportedEnum.rawType == .bool { - diagnose( - node: jsAttribute, - message: "TypeScript enum style is not supported for Bool raw-value enums", - hint: "Use enumStyle: .const or change the raw type to String or a numeric type" - ) - } - if !exportedEnum.staticMethods.isEmpty { - diagnose( - node: jsAttribute, - message: "TypeScript enum style does not support static functions", - hint: "Use enumStyle: .const to generate a const object that supports static functions" - ) - } - } - - if exportedEnum.cases.contains(where: { !$0.associatedValues.isEmpty }) { - if case .tsEnum = emitStyle { - diagnose( - node: jsAttribute, - message: "TypeScript enum style is not supported for associated value enums", - hint: "Use enumStyle: .const in order to map associated-value enums" - ) - } - for enumCase in exportedEnum.cases { - for associatedValue in enumCase.associatedValues { - switch associatedValue.type { - case .string, .int, .float, .double, .bool: - break - case .optional(let wrappedType): - switch wrappedType { - case .string, .int, .float, .double, .bool: - break - default: - diagnose( - node: node, - message: "Unsupported associated value type: \(associatedValue.type.swiftType)", - hint: - "Only primitive types and optional primitives (String?, Int?, Float?, Double?, Bool?) are supported in associated-value enums" - ) - } - default: - diagnose( - node: node, - message: "Unsupported associated value type: \(associatedValue.type.swiftType)", - hint: - "Only primitive types and optional primitives (String?, Int?, Float?, Double?, Bool?) are supported in associated-value enums" - ) - } - } - } - } - - stateStack.pop() - } - - override func visit(_ node: ProtocolDeclSyntax) -> SyntaxVisitorContinueKind { - guard let jsAttribute = node.attributes.firstJSAttribute else { - return .skipChildren - } - - let name = node.name.text - - let namespaceResult = resolveNamespace(from: jsAttribute, for: node, declarationType: "protocol") - guard namespaceResult.isValid else { - return .skipChildren - } - _ = computeExplicitAtLeastInternalAccessControl( - for: node, - message: "Protocol visibility must be at least internal" - ) - - let protocolUniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) - - exportedProtocolByName[protocolUniqueKey] = ExportedProtocol( - name: name, - methods: [], - properties: [], - namespace: namespaceResult.namespace - ) - - stateStack.push(state: .protocolBody(name: name, key: protocolUniqueKey)) - - var methods: [ExportedFunction] = [] - for member in node.memberBlock.members { - if let funcDecl = member.decl.as(FunctionDeclSyntax.self) { - if let exportedFunction = visitProtocolMethod( - node: funcDecl, - protocolName: name, - namespace: namespaceResult.namespace - ) { - methods.append(exportedFunction) - } - } else if let varDecl = member.decl.as(VariableDeclSyntax.self) { - _ = visitProtocolProperty(node: varDecl, protocolName: name, protocolKey: protocolUniqueKey) - } - } - - let exportedProtocol = ExportedProtocol( - name: name, - methods: methods, - properties: exportedProtocolByName[protocolUniqueKey]?.properties ?? [], - namespace: namespaceResult.namespace - ) - - exportedProtocolByName[protocolUniqueKey] = exportedProtocol - exportedProtocolNames.append(protocolUniqueKey) - - stateStack.pop() - - return .skipChildren - } - - override func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind { - guard let jsAttribute = node.attributes.firstJSAttribute else { - return .skipChildren - } - - let name = node.name.text - - let namespaceResult = resolveNamespace(from: jsAttribute, for: node, declarationType: "struct") - guard namespaceResult.isValid else { - return .skipChildren - } - let swiftCallName = ExportSwift.computeSwiftCallName(for: node, itemName: name) - let explicitAccessControl = computeExplicitAtLeastInternalAccessControl( - for: node, - message: "Struct visibility must be at least internal" - ) - - var properties: [ExportedProperty] = [] - - // Process all variables in struct as readonly (value semantics) and don't require @JS - for member in node.memberBlock.members { - if let varDecl = member.decl.as(VariableDeclSyntax.self) { - let isStatic = varDecl.modifiers.contains { modifier in - modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) - } - - // Handled with error in visitVariable - if varDecl.attributes.hasJSAttribute() { - continue - } - // Skips static non-@JS properties - if isStatic { - continue - } - - for binding in varDecl.bindings { - guard let pattern = binding.pattern.as(IdentifierPatternSyntax.self) else { - continue - } - - let fieldName = pattern.identifier.text - - guard let typeAnnotation = binding.typeAnnotation else { - diagnose(node: binding, message: "Struct field must have explicit type annotation") - continue - } - - guard let fieldType = self.parent.lookupType(for: typeAnnotation.type) else { - diagnoseUnsupportedType( - node: typeAnnotation.type, - type: typeAnnotation.type.trimmedDescription - ) - continue - } - - let property = ExportedProperty( - name: fieldName, - type: fieldType, - isReadonly: true, - isStatic: false, - namespace: namespaceResult.namespace, - staticContext: nil - ) - properties.append(property) - } - } - } - - let structUniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) - let exportedStruct = ExportedStruct( - name: name, - swiftCallName: swiftCallName, - explicitAccessControl: explicitAccessControl, - properties: properties, - methods: [], - namespace: namespaceResult.namespace - ) - - exportedStructByName[structUniqueKey] = exportedStruct - exportedStructNames.append(structUniqueKey) - - stateStack.push(state: .structBody(name: name, key: structUniqueKey)) - - return .visitChildren - } - - override func visitPost(_ node: StructDeclSyntax) { - if case .structBody(_, _) = stateStack.current { - stateStack.pop() - } - } - - private func visitProtocolMethod( - node: FunctionDeclSyntax, - protocolName: String, - namespace: [String]? - ) -> ExportedFunction? { - let name = node.name.text - - let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: false) - - let returnType: BridgeType - if let returnClause = node.signature.returnClause { - let resolvedType = self.parent.lookupType(for: returnClause.type) - - if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { - diagnoseNestedOptional(node: returnClause.type, type: returnClause.type.trimmedDescription) - return nil - } - - guard let type = resolvedType else { - diagnoseUnsupportedType(node: returnClause.type, type: returnClause.type.trimmedDescription) - return nil - } - returnType = type - } else { - returnType = .void - } - - let abiName = ABINameGenerator.generateABIName( - baseName: name, - namespace: namespace, - className: protocolName - ) - - guard let effects = collectEffects(signature: node.signature) else { - return nil - } - - return ExportedFunction( - name: name, - abiName: abiName, - parameters: parameters, - returnType: returnType, - effects: effects, - namespace: namespace, - staticContext: nil - ) - } - - private func visitProtocolProperty( - node: VariableDeclSyntax, - protocolName: String, - protocolKey: String - ) -> SyntaxVisitorContinueKind { - for binding in node.bindings { - guard let pattern = binding.pattern.as(IdentifierPatternSyntax.self) else { - diagnose(node: binding.pattern, message: "Complex patterns not supported for protocol properties") - continue - } - - let propertyName = pattern.identifier.text - - guard let typeAnnotation = binding.typeAnnotation else { - diagnose(node: binding, message: "Protocol property must have explicit type annotation") - continue - } - - guard let propertyType = self.parent.lookupType(for: typeAnnotation.type) else { - diagnoseUnsupportedType(node: typeAnnotation.type, type: typeAnnotation.type.trimmedDescription) - continue - } - - guard let accessorBlock = binding.accessorBlock else { - diagnose( - node: binding, - message: "Protocol property must specify { get } or { get set }", - hint: "Add { get } for readonly or { get set } for readwrite property" - ) - continue - } - - let isReadonly = hasOnlyGetter(accessorBlock) - - let exportedProperty = ExportedProtocolProperty( - name: propertyName, - type: propertyType, - isReadonly: isReadonly - ) - - if var currentProtocol = exportedProtocolByName[protocolKey] { - var properties = currentProtocol.properties - properties.append(exportedProperty) - - currentProtocol = ExportedProtocol( - name: currentProtocol.name, - methods: currentProtocol.methods, - properties: properties, - namespace: currentProtocol.namespace - ) - exportedProtocolByName[protocolKey] = currentProtocol - } - } - - return .skipChildren - } - - private func hasOnlyGetter(_ accessorBlock: AccessorBlockSyntax?) -> Bool { - switch accessorBlock?.accessors { - case .accessors(let accessors): - // Has accessors - check if it only has a getter (no setter, willSet, or didSet) - return !accessors.contains(where: { accessor in - let tokenKind = accessor.accessorSpecifier.tokenKind - return tokenKind == .keyword(.set) || tokenKind == .keyword(.willSet) - || tokenKind == .keyword(.didSet) - }) - case .getter: - // Has only a getter block - return true - case nil: - // No accessor block - this is a stored property, not readonly - return false - } - } - - override func visit(_ node: EnumCaseDeclSyntax) -> SyntaxVisitorContinueKind { - guard case .enumBody(_, let enumKey) = stateStack.current else { - return .visitChildren - } - - for element in node.elements { - let caseName = element.name.text - let rawValue: String? - var associatedValues: [AssociatedValue] = [] - - if exportedEnumByName[enumKey]?.rawType != nil { - if let stringLiteral = element.rawValue?.value.as(StringLiteralExprSyntax.self) { - rawValue = stringLiteral.segments.first?.as(StringSegmentSyntax.self)?.content.text - } else if let boolLiteral = element.rawValue?.value.as(BooleanLiteralExprSyntax.self) { - rawValue = boolLiteral.literal.text - } else { - var numericExpr = element.rawValue?.value - var isNegative = false - - // Check for prefix operator (for negative numbers) - if let prefixExpr = numericExpr?.as(PrefixOperatorExprSyntax.self), - prefixExpr.operator.text == "-" - { - numericExpr = prefixExpr.expression - isNegative = true - } - - if let intLiteral = numericExpr?.as(IntegerLiteralExprSyntax.self) { - rawValue = isNegative ? "-\(intLiteral.literal.text)" : intLiteral.literal.text - } else if let floatLiteral = numericExpr?.as(FloatLiteralExprSyntax.self) { - rawValue = isNegative ? "-\(floatLiteral.literal.text)" : floatLiteral.literal.text - } else { - rawValue = nil - } - } - } else { - rawValue = nil - } - if let parameterClause = element.parameterClause { - for param in parameterClause.parameters { - guard let bridgeType = parent.lookupType(for: param.type) else { - diagnose( - node: param.type, - message: "Unsupported associated value type: \(param.type.trimmedDescription)", - hint: "Only primitive types and types defined in the same module are allowed" - ) - continue - } - - let label = param.firstName?.text - associatedValues.append(AssociatedValue(label: label, type: bridgeType)) - } - } - let enumCase = EnumCase( - name: caseName, - rawValue: rawValue, - associatedValues: associatedValues - ) - exportedEnumByName[enumKey]?.cases.append(enumCase) - } - - return .visitChildren - } - - /// Computes namespace by walking up the AST hierarchy to find parent namespace enums - /// If parent enum is a namespace enum (no cases) then it will be used as part of namespace for given node - /// - /// - /// Method allows for explicit namespace for top level enum, it will be used as base namespace and will concat enum name - private func computeNamespace(for node: some SyntaxProtocol) -> [String]? { - var namespace: [String] = [] - var currentNode: Syntax? = node.parent - - while let parent = currentNode { - if let enumDecl = parent.as(EnumDeclSyntax.self), - enumDecl.attributes.hasJSAttribute() - { - let isNamespaceEnum = !enumDecl.memberBlock.members.contains { member in - member.decl.is(EnumCaseDeclSyntax.self) - } - if isNamespaceEnum { - namespace.insert(enumDecl.name.text, at: 0) - - if let jsAttribute = enumDecl.attributes.firstJSAttribute, - let explicitNamespace = extractNamespace(from: jsAttribute) - { - namespace = explicitNamespace + namespace - break - } - } - } - currentNode = parent.parent - } - - return namespace.isEmpty ? nil : namespace - } - - /// Requires the node to have at least internal access control. - private func computeExplicitAtLeastInternalAccessControl( - for node: some WithModifiersSyntax, - message: String - ) -> String? { - guard let accessControl = node.explicitAccessControl else { - return nil - } - guard accessControl.isAtLeastInternal else { - diagnose( - node: accessControl, - message: message, - hint: "Use `internal`, `package` or `public` access control" - ) - return nil - } - return accessControl.name.text - } - } - - func parseSingleFile(_ sourceFile: SourceFileSyntax) throws -> [DiagnosticError] { - let collector = APICollector(parent: self) - collector.walk(sourceFile) - exportedFunctions.append(contentsOf: collector.exportedFunctions) - exportedClasses.append( - contentsOf: collector.exportedClassNames.map { - collector.exportedClassByName[$0]! - } - ) - exportedEnums.append( - contentsOf: collector.exportedEnumNames.map { - collector.exportedEnumByName[$0]! - } - ) - exportedProtocols.append( - contentsOf: collector.exportedProtocolNames.map { - collector.exportedProtocolByName[$0]! - } - ) - exportedStructs.append( - contentsOf: collector.exportedStructNames.map { - collector.exportedStructByName[$0]! - } - ) - - return collector.errors - } - - /// Computes the full Swift call name by walking up the AST hierarchy to find all parent enums - /// This generates the qualified name needed for Swift code generation (e.g., "Networking.API.HTTPServer") - private static func computeSwiftCallName(for node: some SyntaxProtocol, itemName: String) -> String { - var swiftPath: [String] = [] - var currentNode: Syntax? = node.parent - - while let parent = currentNode { - if let enumDecl = parent.as(EnumDeclSyntax.self), - enumDecl.attributes.hasJSAttribute() - { - swiftPath.insert(enumDecl.name.text, at: 0) - } - currentNode = parent.parent - } - - if swiftPath.isEmpty { - return itemName - } else { - return swiftPath.joined(separator: ".") + "." + itemName - } - } - - func lookupType(for type: TypeSyntax) -> BridgeType? { - if let attributedType = type.as(AttributedTypeSyntax.self) { - return lookupType(for: attributedType.baseType) - } - - // (T1, T2, ...) -> R - if let functionType = type.as(FunctionTypeSyntax.self) { - var parameters: [BridgeType] = [] - for param in functionType.parameters { - guard let paramType = lookupType(for: param.type) else { - return nil - } - parameters.append(paramType) - } - - guard let returnType = lookupType(for: functionType.returnClause.type) else { - return nil - } - - let isAsync = functionType.effectSpecifiers?.asyncSpecifier != nil - let isThrows = functionType.effectSpecifiers?.throwsClause != nil - - return .closure( - ClosureSignature( - parameters: parameters, - returnType: returnType, - moduleName: moduleName, - isAsync: isAsync, - isThrows: isThrows - ) - ) - } - - // T? - if let optionalType = type.as(OptionalTypeSyntax.self) { - let wrappedType = optionalType.wrappedType - if let baseType = lookupType(for: wrappedType) { - return .optional(baseType) - } - } - // Optional - if let identifierType = type.as(IdentifierTypeSyntax.self), - identifierType.name.text == "Optional", - let genericArgs = identifierType.genericArgumentClause?.arguments, - genericArgs.count == 1, - let argType = TypeSyntax(genericArgs.first?.argument) - { - if let baseType = lookupType(for: argType) { - return .optional(baseType) - } - } - // Swift.Optional - if let memberType = type.as(MemberTypeSyntax.self), - let baseType = memberType.baseType.as(IdentifierTypeSyntax.self), - baseType.name.text == "Swift", - memberType.name.text == "Optional", - let genericArgs = memberType.genericArgumentClause?.arguments, - genericArgs.count == 1, - let argType = TypeSyntax(genericArgs.first?.argument) - { - if let wrappedType = lookupType(for: argType) { - return .optional(wrappedType) - } - } - if let aliasDecl = typeDeclResolver.resolveTypeAlias(type) { - if let resolvedType = lookupType(for: aliasDecl.initializer.value) { - return resolvedType - } - } - - let typeName = type.trimmedDescription - if let primitiveType = BridgeType(swiftType: typeName) { - return primitiveType - } - - guard let typeDecl = typeDeclResolver.resolve(type) else { - return nil - } - - if typeDecl.is(ProtocolDeclSyntax.self) { - let swiftCallName = ExportSwift.computeSwiftCallName(for: typeDecl, itemName: typeDecl.name.text) - return .swiftProtocol(swiftCallName) - } - - if let enumDecl = typeDecl.as(EnumDeclSyntax.self) { - let swiftCallName = ExportSwift.computeSwiftCallName(for: enumDecl, itemName: enumDecl.name.text) - let rawTypeString = enumDecl.inheritanceClause?.inheritedTypes.first { inheritedType in - let typeName = inheritedType.type.trimmedDescription - return Constants.supportedRawTypes.contains(typeName) - }?.type.trimmedDescription - - if let rawType = SwiftEnumRawType(rawTypeString) { - return .rawValueEnum(swiftCallName, rawType) - } else { - let hasAnyCases = enumDecl.memberBlock.members.contains { member in - member.decl.is(EnumCaseDeclSyntax.self) - } - if !hasAnyCases { - return .namespaceEnum(swiftCallName) - } - let hasAssociatedValues = - enumDecl.memberBlock.members.contains { member in - guard let caseDecl = member.decl.as(EnumCaseDeclSyntax.self) else { return false } - return caseDecl.elements.contains { element in - if let params = element.parameterClause?.parameters { - return !params.isEmpty - } - return false - } - } - if hasAssociatedValues { - return .associatedValueEnum(swiftCallName) - } else { - return .caseEnum(swiftCallName) - } - } - } - - if let structDecl = typeDecl.as(StructDeclSyntax.self) { - let swiftCallName = ExportSwift.computeSwiftCallName(for: structDecl, itemName: structDecl.name.text) - return .swiftStruct(swiftCallName) - } - - guard typeDecl.is(ClassDeclSyntax.self) || typeDecl.is(ActorDeclSyntax.self) else { + /// Finalizes the export process and generates the bridge code + /// + /// - Parameters: + /// - exposeToGlobal: Whether to expose exported APIs to the global namespace (default: false) + /// - Returns: A tuple containing the generated Swift code and a skeleton + /// describing the exported APIs + public func finalize() throws -> String? { + guard let outputSwift = try renderSwiftGlue() else { return nil } - let swiftCallName = ExportSwift.computeSwiftCallName(for: typeDecl, itemName: typeDecl.name.text) - return .swiftHeapObject(swiftCallName) + return outputSwift } func renderSwiftGlue() throws -> String? { var decls: [DeclSyntax] = [] - guard - exportedFunctions.count > 0 || exportedClasses.count > 0 || exportedEnums.count > 0 - || exportedProtocols.count > 0 || exportedStructs.count > 0 - else { - return nil - } let closureCodegen = ClosureCodegen() var closureSignatures: Set = [] - for function in exportedFunctions { + for function in skeleton.functions { closureCodegen.collectClosureSignatures(from: function.parameters, into: &closureSignatures) closureCodegen.collectClosureSignatures(from: function.returnType, into: &closureSignatures) } - for klass in exportedClasses { + for klass in skeleton.classes { if let constructor = klass.constructor { closureCodegen.collectClosureSignatures(from: constructor.parameters, into: &closureSignatures) } @@ -1684,12 +72,12 @@ public class ExportSwift { } let protocolCodegen = ProtocolCodegen() - for proto in exportedProtocols { + for proto in skeleton.protocols { decls.append(contentsOf: try protocolCodegen.renderProtocolWrapper(proto, moduleName: moduleName)) } let enumCodegen = EnumCodegen() - for enumDef in exportedEnums { + for enumDef in skeleton.enums { if let enumHelpers = enumCodegen.renderEnumHelpers(enumDef) { decls.append(enumHelpers) } @@ -1709,15 +97,15 @@ public class ExportSwift { } let structCodegen = StructCodegen() - for structDef in exportedStructs { + for structDef in skeleton.structs { decls.append(structCodegen.renderStructHelpers(structDef)) decls.append(contentsOf: try renderSingleExportedStruct(struct: structDef)) } - for function in exportedFunctions { + for function in skeleton.functions { decls.append(try renderSingleExportedFunction(function: function)) } - for klass in exportedClasses { + for klass in skeleton.classes { decls.append(contentsOf: try renderSingleExportedClass(klass: klass)) } let format = BasicFormat() @@ -3286,22 +1674,6 @@ struct ProtocolCodegen { } } -fileprivate enum Constants { - static let supportedRawTypes = SwiftEnumRawType.allCases.map { $0.rawValue } -} - -extension AttributeListSyntax { - fileprivate func hasJSAttribute() -> Bool { - firstJSAttribute != nil - } - - fileprivate var firstJSAttribute: AttributeSyntax? { - first(where: { - $0.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JS" - })?.as(AttributeSyntax.self) - } -} - extension BridgeType { init?(swiftType: String) { switch swiftType { @@ -3523,17 +1895,3 @@ extension WithModifiersSyntax { } } } - -fileprivate extension BridgeType { - /// Returns true if a value of `expectedType` can be assigned to this type. - func isCompatibleWith(_ expectedType: BridgeType) -> Bool { - switch (self, expectedType) { - case let (lhs, rhs) where lhs == rhs: - return true - case (.optional(let wrapped), expectedType): - return wrapped == expectedType - default: - return false - } - } -} diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift deleted file mode 100644 index db6b983e1..000000000 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift +++ /dev/null @@ -1,710 +0,0 @@ -import SwiftSyntax -#if canImport(BridgeJSSkeleton) -import BridgeJSSkeleton -#endif -#if canImport(BridgeJSUtilities) -import BridgeJSUtilities -#endif - -/// Collects macro-annotated Swift declarations and produces ImportedModuleSkeleton. -public final class ImportSwiftMacros { - let progress: ProgressReporting - let moduleName: String - private var sourceFiles: [(sourceFile: SourceFileSyntax, inputFilePath: String)] = [] - - public init(progress: ProgressReporting, moduleName: String) { - self.progress = progress - self.moduleName = moduleName - } - - /// Processes a Swift source file to find declarations marked with @JSFunction/@JSGetter/@JSSetter/@JSClass - /// - /// - Parameters: - /// - sourceFile: The parsed Swift source file to process - /// - inputFilePath: The file path for error reporting - public func addSourceFile(_ sourceFile: SourceFileSyntax, _ inputFilePath: String) { - sourceFiles.append((sourceFile, inputFilePath)) - } - - /// Finalizes the import process and generates the bridge code plus skeleton. - public func finalize() throws -> (outputSwift: String?, outputSkeleton: ImportedModuleSkeleton) { - var perSourceErrors: [(inputFilePath: String, errors: [DiagnosticError])] = [] - var importedFiles: [ImportedFileSkeleton] = [] - - for (sourceFile, inputFilePath) in sourceFiles { - progress.print("Processing \(inputFilePath)") - let collector = APICollector( - inputFilePath: inputFilePath, - knownJSClassNames: Self.collectJSClassNames(from: sourceFile) - ) - collector.walk(sourceFile) - if !collector.errors.isEmpty { - perSourceErrors.append((inputFilePath: inputFilePath, errors: collector.errors)) - } - importedFiles.append( - ImportedFileSkeleton( - functions: collector.importedFunctions, - types: collector.importedTypes, - globalGetters: collector.importedGlobalGetters - ) - ) - } - - if !perSourceErrors.isEmpty { - let allErrors = perSourceErrors.flatMap { inputFilePath, errors in - errors.map { $0.formattedDescription(fileName: inputFilePath) } - } - throw BridgeJSCoreError(allErrors.joined(separator: "\n")) - } - - let moduleSkeleton = ImportedModuleSkeleton(children: importedFiles) - - var importer = ImportTS(progress: progress, moduleName: moduleName) - for skeleton in importedFiles { - importer.addSkeleton(skeleton) - } - let outputSwift = try importer.finalize() - return (outputSwift: outputSwift, outputSkeleton: moduleSkeleton) - } - - private static func collectJSClassNames(from sourceFile: SourceFileSyntax) -> Set { - let collector = JSImportTypeNameCollector(viewMode: .sourceAccurate) - collector.walk(sourceFile) - return collector.typeNames - } - - private final class JSImportTypeNameCollector: SyntaxAnyVisitor { - var typeNames: Set = [] - - private func visitTypeDecl(_ attributes: AttributeListSyntax?, _ name: String) -> SyntaxVisitorContinueKind { - if APICollector.AttributeChecker.hasJSClassAttribute(attributes) { - typeNames.insert(name) - } - return .visitChildren - } - - override func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind { - visitTypeDecl(node.attributes, node.name.text) - } - - override func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind { - visitTypeDecl(node.attributes, node.name.text) - } - } - - fileprivate final class APICollector: SyntaxAnyVisitor { - var importedFunctions: [ImportedFunctionSkeleton] = [] - var importedTypes: [ImportedTypeSkeleton] = [] - var importedGlobalGetters: [ImportedGetterSkeleton] = [] - var errors: [DiagnosticError] = [] - - private let inputFilePath: String - private var jsClassNames: Set - - // MARK: - State Management - - enum State { - case topLevel - case jsClassBody(name: String) - } - - private var stateStack: [State] = [.topLevel] - var state: State { - return stateStack.last! - } - - // Current type being collected (when in jsClassBody state) - private struct CurrentType { - let name: String - var constructor: ImportedConstructorSkeleton? - var methods: [ImportedFunctionSkeleton] - var getters: [ImportedGetterSkeleton] - var setters: [ImportedSetterSkeleton] - } - private var currentType: CurrentType? - - // MARK: - Attribute Checking - - /// Helper struct for checking and extracting attributes - fileprivate struct AttributeChecker { - static func hasJSFunctionAttribute(_ attributes: AttributeListSyntax?) -> Bool { - hasAttribute(attributes, name: "JSFunction") - } - - static func hasJSGetterAttribute(_ attributes: AttributeListSyntax?) -> Bool { - hasAttribute(attributes, name: "JSGetter") - } - - static func hasJSSetterAttribute(_ attributes: AttributeListSyntax?) -> Bool { - hasAttribute(attributes, name: "JSSetter") - } - - static func firstJSSetterAttribute(_ attributes: AttributeListSyntax?) -> AttributeSyntax? { - attributes?.first { attribute in - attribute.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JSSetter" - }?.as(AttributeSyntax.self) - } - - static func hasJSClassAttribute(_ attributes: AttributeListSyntax?) -> Bool { - hasAttribute(attributes, name: "JSClass") - } - - static func hasAttribute(_ attributes: AttributeListSyntax?, name: String) -> Bool { - guard let attributes else { return false } - return attributes.contains { attribute in - guard let syntax = attribute.as(AttributeSyntax.self) else { return false } - return syntax.attributeName.trimmedDescription == name - } - } - - /// Extracts the jsName argument value from a @JSSetter attribute, if present. - static func extractJSName(from attribute: AttributeSyntax) -> String? { - guard let arguments = attribute.arguments?.as(LabeledExprListSyntax.self) else { - return nil - } - for argument in arguments { - if argument.label?.text == "jsName", - let stringLiteral = argument.expression.as(StringLiteralExprSyntax.self), - let segment = stringLiteral.segments.first?.as(StringSegmentSyntax.self) - { - return segment.content.text - } - } - return nil - } - } - - // MARK: - Validation Helpers - - /// Common validation result for setter functions - private struct SetterValidationResult { - let effects: Effects - let jsName: String? - let firstParam: FunctionParameterSyntax - let valueType: BridgeType - } - - /// Validates effects (throws required, async not supported) - private func validateEffects( - _ effects: FunctionEffectSpecifiersSyntax?, - node: some SyntaxProtocol, - attributeName: String - ) -> Effects? { - guard let effects = parseEffects(effects) else { - errors.append( - DiagnosticError( - node: node, - message: "@\(attributeName) declarations must be throws.", - hint: "Declare the function as 'throws (JSException)'." - ) - ) - return nil - } - if effects.isAsync { - errors.append( - DiagnosticError( - node: node, - message: "@\(attributeName) declarations do not support async yet." - ) - ) - return nil - } - return effects - } - - /// Validates a setter function and extracts common information - private func validateSetter( - _ node: FunctionDeclSyntax, - jsSetter: AttributeSyntax, - enclosingTypeName: String? - ) -> SetterValidationResult? { - guard let effects = validateEffects(node.signature.effectSpecifiers, node: node, attributeName: "JSSetter") - else { - return nil - } - - let jsName = AttributeChecker.extractJSName(from: jsSetter) - let parameters = node.signature.parameterClause.parameters - - guard let firstParam = parameters.first else { - errors.append( - DiagnosticError( - node: node, - message: "@JSSetter function must have at least one parameter." - ) - ) - return nil - } - - if firstParam.type.is(MissingTypeSyntax.self) { - errors.append( - DiagnosticError( - node: firstParam, - message: "All @JSSetter parameters must have explicit types." - ) - ) - return nil - } - - return SetterValidationResult( - effects: effects, - jsName: jsName, - firstParam: firstParam, - valueType: parseType(firstParam.type, enclosingTypeName: enclosingTypeName) - ) - } - - // MARK: - Property Name Resolution - - /// Helper for resolving property names from setter function names and jsName attributes - private struct PropertyNameResolver { - /// Resolves property name and function base name from a setter function and optional jsName - /// - Returns: (propertyName, functionBaseName) where propertyName preserves case for getter matching, - /// and functionBaseName has lowercase first char for ABI generation - static func resolve( - functionName: String, - jsName: String?, - normalizeIdentifier: (String) -> String - ) -> (propertyName: String, functionBaseName: String)? { - if let jsName = jsName { - let propertyName = normalizeIdentifier(jsName) - let functionBaseName = propertyName.prefix(1).lowercased() + propertyName.dropFirst() - return (propertyName: propertyName, functionBaseName: functionBaseName) - } - - let rawFunctionName = - functionName.hasPrefix("`") && functionName.hasSuffix("`") && functionName.count > 2 - ? String(functionName.dropFirst().dropLast()) - : functionName - - guard rawFunctionName.hasPrefix("set"), rawFunctionName.count > 3 else { - return nil - } - - let derivedPropertyName = String(rawFunctionName.dropFirst(3)) - let normalized = normalizeIdentifier(derivedPropertyName) - let propertyName = normalized.prefix(1).lowercased() + normalized.dropFirst() - return (propertyName: propertyName, functionBaseName: propertyName) - } - } - - init(inputFilePath: String, knownJSClassNames: Set) { - self.inputFilePath = inputFilePath - self.jsClassNames = knownJSClassNames - super.init(viewMode: .sourceAccurate) - } - - private func enterJSClass(_ typeName: String) { - stateStack.append(.jsClassBody(name: typeName)) - currentType = CurrentType(name: typeName, constructor: nil, methods: [], getters: [], setters: []) - } - - private func exitJSClass() { - if case .jsClassBody(let typeName) = state, let type = currentType, type.name == typeName { - importedTypes.append( - ImportedTypeSkeleton( - name: type.name, - constructor: type.constructor, - methods: type.methods, - getters: type.getters, - setters: type.setters, - documentation: nil - ) - ) - currentType = nil - } - stateStack.removeLast() - } - - override func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind { - if AttributeChecker.hasJSClassAttribute(node.attributes) { - enterJSClass(node.name.text) - } - return .visitChildren - } - - override func visitPost(_ node: StructDeclSyntax) { - if AttributeChecker.hasJSClassAttribute(node.attributes) { - exitJSClass() - } - } - - override func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind { - if AttributeChecker.hasJSClassAttribute(node.attributes) { - enterJSClass(node.name.text) - } - return .visitChildren - } - - override func visitPost(_ node: ClassDeclSyntax) { - if AttributeChecker.hasJSClassAttribute(node.attributes) { - exitJSClass() - } - } - - // MARK: - Visitor Methods - - override func visit(_ node: ExtensionDeclSyntax) -> SyntaxVisitorContinueKind { - let typeName = node.extendedType.trimmedDescription - collectStaticMembers(in: node.memberBlock.members, typeName: typeName) - return .skipChildren - } - - override func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { - switch state { - case .topLevel: - return handleTopLevelFunction(node) - - case .jsClassBody(let typeName): - guard var type = currentType, type.name == typeName else { - return .skipChildren - } - let isStaticMember = isStatic(node.modifiers) - let handled = handleClassFunction(node, typeName: typeName, isStaticMember: isStaticMember, type: &type) - if handled { - currentType = type - } - return .skipChildren - } - } - - private func handleTopLevelFunction(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { - if AttributeChecker.hasJSFunctionAttribute(node.attributes), - let function = parseFunction(node, enclosingTypeName: nil, isStaticMember: true) - { - importedFunctions.append(function) - return .skipChildren - } - // Top-level setters are not supported - if AttributeChecker.hasJSSetterAttribute(node.attributes) { - errors.append( - DiagnosticError( - node: node, - message: "@JSSetter is not supported at top-level. Use it only in @JSClass types." - ) - ) - return .skipChildren - } - return .visitChildren - } - - private func handleClassFunction( - _ node: FunctionDeclSyntax, - typeName: String, - isStaticMember: Bool, - type: inout CurrentType - ) -> Bool { - if AttributeChecker.hasJSFunctionAttribute(node.attributes) { - if isStaticMember { - parseFunction(node, enclosingTypeName: typeName, isStaticMember: true).map { - importedFunctions.append($0) - } - } else { - parseFunction(node, enclosingTypeName: typeName, isStaticMember: false).map { - type.methods.append($0) - } - } - return true - } - - if AttributeChecker.hasJSSetterAttribute(node.attributes) { - if isStaticMember { - errors.append( - DiagnosticError( - node: node, - message: - "@JSSetter is not supported for static members. Use it only for instance members in @JSClass types." - ) - ) - } else if let jsSetter = AttributeChecker.firstJSSetterAttribute(node.attributes), - let setter = parseSetterSkeleton(jsSetter, node, enclosingTypeName: typeName) - { - type.setters.append(setter) - } - return true - } - - return false - } - - override func visit(_ node: VariableDeclSyntax) -> SyntaxVisitorContinueKind { - guard AttributeChecker.hasJSGetterAttribute(node.attributes) else { - return .visitChildren - } - - switch state { - case .topLevel: - if let getter = parseGetterSkeleton(node, enclosingTypeName: nil) { - importedGlobalGetters.append(getter) - } - return .skipChildren - - case .jsClassBody(let typeName): - guard var type = currentType, type.name == typeName else { - return .skipChildren - } - if isStatic(node.modifiers) { - errors.append( - DiagnosticError( - node: node, - message: - "@JSGetter is not supported for static members. Use it only for instance members in @JSClass types." - ) - ) - } else if let getter = parseGetterSkeleton(node, enclosingTypeName: typeName) { - type.getters.append(getter) - currentType = type - } - return .skipChildren - } - } - - override func visit(_ node: InitializerDeclSyntax) -> SyntaxVisitorContinueKind { - guard AttributeChecker.hasJSFunctionAttribute(node.attributes) else { - return .visitChildren - } - - switch state { - case .topLevel: - return .visitChildren - - case .jsClassBody(let typeName): - guard var type = currentType, type.name == typeName else { - return .skipChildren - } - if type.constructor != nil { - errors.append( - DiagnosticError( - node: node, - message: "Only one @JSFunction initializer is supported in @JSClass types." - ) - ) - return .skipChildren - } - if let parsed = parseConstructor(node, typeName: typeName) { - type.constructor = parsed - currentType = type - } - return .skipChildren - } - } - - // MARK: - Member Collection - - private func collectStaticMembers(in members: MemberBlockItemListSyntax, typeName: String) { - for member in members { - if let function = member.decl.as(FunctionDeclSyntax.self) { - if AttributeChecker.hasJSFunctionAttribute(function.attributes), - let parsed = parseFunction(function, enclosingTypeName: typeName, isStaticMember: true) - { - importedFunctions.append(parsed) - } else if AttributeChecker.hasJSSetterAttribute(function.attributes) { - errors.append( - DiagnosticError( - node: function, - message: - "@JSSetter is not supported for static members. Use it only for instance members in @JSClass types." - ) - ) - } - } else if let variable = member.decl.as(VariableDeclSyntax.self), - AttributeChecker.hasJSGetterAttribute(variable.attributes) - { - errors.append( - DiagnosticError( - node: variable, - message: - "@JSGetter is not supported for static members. Use it only for instance members in @JSClass types." - ) - ) - } - } - } - - // MARK: - Parsing Methods - - private func parseConstructor( - _ initializer: InitializerDeclSyntax, - typeName: String - ) -> ImportedConstructorSkeleton? { - guard - validateEffects(initializer.signature.effectSpecifiers, node: initializer, attributeName: "JSFunction") - != nil - else { - return nil - } - return ImportedConstructorSkeleton( - parameters: parseParameters( - from: initializer.signature.parameterClause, - enclosingTypeName: typeName - ) - ) - } - - private func parseFunction( - _ node: FunctionDeclSyntax, - enclosingTypeName: String?, - isStaticMember: Bool - ) -> ImportedFunctionSkeleton? { - guard validateEffects(node.signature.effectSpecifiers, node: node, attributeName: "JSFunction") != nil - else { - return nil - } - - let baseName = normalizeIdentifier(node.name.text) - let name: String - if isStaticMember, let enclosingTypeName { - name = "\(enclosingTypeName)_\(baseName)" - } else { - name = baseName - } - - let parameters = parseParameters( - from: node.signature.parameterClause, - enclosingTypeName: enclosingTypeName - ) - let returnType: BridgeType - if let returnTypeSyntax = node.signature.returnClause?.type { - returnType = parseType(returnTypeSyntax, enclosingTypeName: enclosingTypeName) - } else { - returnType = .void - } - return ImportedFunctionSkeleton( - name: name, - parameters: parameters, - returnType: returnType, - documentation: nil - ) - } - - /// Extracts property info from a VariableDeclSyntax (binding, identifier, type) - private func extractPropertyInfo( - _ node: VariableDeclSyntax, - errorMessage: String = "@JSGetter must declare a single stored property with an explicit type." - ) -> (identifier: IdentifierPatternSyntax, type: TypeSyntax)? { - guard let binding = node.bindings.first, - let identifier = binding.pattern.as(IdentifierPatternSyntax.self), - let typeAnnotation = binding.typeAnnotation - else { - errors.append(DiagnosticError(node: node, message: errorMessage)) - return nil - } - return (identifier, typeAnnotation.type) - } - - private func parseGetterSkeleton( - _ node: VariableDeclSyntax, - enclosingTypeName: String? - ) -> ImportedGetterSkeleton? { - guard let (identifier, type) = extractPropertyInfo(node) else { - return nil - } - let propertyType = parseType(type, enclosingTypeName: enclosingTypeName) - let propertyName = normalizeIdentifier(identifier.identifier.text) - return ImportedGetterSkeleton( - name: propertyName, - type: propertyType, - documentation: nil, - functionName: nil - ) - } - - /// Parses a setter as part of a type's property system (for instance setters) - private func parseSetterSkeleton( - _ jsSetter: AttributeSyntax, - _ node: FunctionDeclSyntax, - enclosingTypeName: String? - ) -> ImportedSetterSkeleton? { - guard let validation = validateSetter(node, jsSetter: jsSetter, enclosingTypeName: enclosingTypeName) else { - return nil - } - - let functionName = node.name.text - guard - let (propertyName, functionBaseName) = PropertyNameResolver.resolve( - functionName: functionName, - jsName: validation.jsName, - normalizeIdentifier: normalizeIdentifier - ) - else { - return nil - } - - return ImportedSetterSkeleton( - name: propertyName, - type: validation.valueType, - documentation: nil, - functionName: "\(functionBaseName)_set" - ) - } - - // MARK: - Type and Parameter Parsing - - private func parseParameters( - from clause: FunctionParameterClauseSyntax, - enclosingTypeName: String? - ) -> [Parameter] { - clause.parameters.compactMap { param in - let type = param.type - if type.is(MissingTypeSyntax.self) { - errors.append( - DiagnosticError( - node: param, - message: "All @JSFunction parameters must have explicit types." - ) - ) - return nil - } - let nameToken = param.secondName ?? param.firstName - let name = normalizeIdentifier(nameToken.text) - let labelToken = param.secondName == nil ? nil : param.firstName - let label = labelToken?.text == "_" ? nil : labelToken?.text - let bridgeType = parseType(type, enclosingTypeName: enclosingTypeName) - return Parameter(label: label, name: name, type: bridgeType) - } - } - - private func parseType(_ type: TypeSyntax, enclosingTypeName: String?) -> BridgeType { - guard let identifier = type.as(IdentifierTypeSyntax.self) else { - errors.append( - DiagnosticError( - node: type, - message: "Unsupported @JS type '\(type.trimmedDescription)'." - ) - ) - return .void - } - - let name = normalizeIdentifier(identifier.name.text) - if name == "Self", let enclosingTypeName { - return .jsObject(enclosingTypeName) - } - return BridgeType(swiftType: name) ?? .jsObject(name) - } - - // MARK: - Helper Methods - - private func parseEffects(_ effects: FunctionEffectSpecifiersSyntax?) -> Effects? { - let isThrows = effects?.throwsClause != nil - let isAsync = effects?.asyncSpecifier != nil - guard isThrows else { - return nil - } - return Effects(isAsync: isAsync, isThrows: isThrows) - } - - private func isStatic(_ modifiers: DeclModifierListSyntax?) -> Bool { - guard let modifiers else { return false } - return modifiers.contains { modifier in - modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) - } - } - - private func normalizeIdentifier(_ name: String) -> String { - guard name.hasPrefix("`"), name.hasSuffix("`"), name.count >= 2 else { - return name - } - return String(name.dropFirst().dropLast()) - } - } -} diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 0ca301b68..27f5a7c51 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -21,15 +21,10 @@ public struct ImportTS { public private(set) var skeleton: ImportedModuleSkeleton private let moduleName: String - public init(progress: ProgressReporting, moduleName: String) { + public init(progress: ProgressReporting, moduleName: String, skeleton: ImportedModuleSkeleton) { self.progress = progress self.moduleName = moduleName - self.skeleton = ImportedModuleSkeleton(children: []) - } - - /// Adds a skeleton to the importer's state - public mutating func addSkeleton(_ skeleton: ImportedFileSkeleton) { - self.skeleton.children.append(skeleton) + self.skeleton = skeleton } /// Finalizes the import process and generates Swift code diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift new file mode 100644 index 000000000..71132568b --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -0,0 +1,2300 @@ +import SwiftSyntax +import SwiftSyntaxBuilder +#if canImport(BridgeJSUtilities) +import BridgeJSUtilities +#endif +#if canImport(BridgeJSSkeleton) +import BridgeJSSkeleton +#endif + +/// Builds BridgeJS skeletons from Swift source files using SwiftSyntax walk for API collection. +/// +/// This is a shared entry point for producing: +/// - exported skeletons from `@JS` declarations +/// - imported skeletons from `@JSFunction/@JSGetter/@JSSetter/@JSClass` macro signatures +public final class SwiftToSkeleton { + public let progress: ProgressReporting + public let moduleName: String + public let exposeToGlobal: Bool + + private var sourceFiles: [(sourceFile: SourceFileSyntax, inputFilePath: String)] = [] + let typeDeclResolver: TypeDeclResolver + + public init(progress: ProgressReporting, moduleName: String, exposeToGlobal: Bool) { + self.progress = progress + self.moduleName = moduleName + self.exposeToGlobal = exposeToGlobal + self.typeDeclResolver = TypeDeclResolver() + } + + public func addSourceFile(_ sourceFile: SourceFileSyntax, inputFilePath: String) { + self.typeDeclResolver.addSourceFile(sourceFile) + sourceFiles.append((sourceFile, inputFilePath)) + } + + public func finalize() throws -> BridgeJSSkeleton { + var perSourceErrors: [(inputFilePath: String, errors: [DiagnosticError])] = [] + var importedFiles: [ImportedFileSkeleton] = [] + var exported = ExportedSkeleton(functions: [], classes: [], enums: [], exposeToGlobal: exposeToGlobal) + + for (sourceFile, inputFilePath) in sourceFiles { + progress.print("Processing \(inputFilePath)") + + let exportCollector = ExportSwiftAPICollector(parent: self) + exportCollector.walk(sourceFile) + + let typeNameCollector = ImportSwiftMacrosJSImportTypeNameCollector(viewMode: .sourceAccurate) + typeNameCollector.walk(sourceFile) + let importCollector = ImportSwiftMacrosAPICollector( + inputFilePath: inputFilePath, + knownJSClassNames: typeNameCollector.typeNames + ) + importCollector.walk(sourceFile) + + if !exportCollector.errors.isEmpty || !importCollector.errors.isEmpty { + perSourceErrors.append( + (inputFilePath: inputFilePath, errors: exportCollector.errors + importCollector.errors) + ) + } + + importedFiles.append( + ImportedFileSkeleton( + functions: importCollector.importedFunctions, + types: importCollector.importedTypes, + globalGetters: importCollector.importedGlobalGetters + ) + ) + exportCollector.finalize(&exported) + } + + if !perSourceErrors.isEmpty { + let allErrors = perSourceErrors.flatMap { inputFilePath, errors in + errors.map { $0.formattedDescription(fileName: inputFilePath) } + } + throw BridgeJSCoreError(allErrors.joined(separator: "\n")) + } + let importedSkeleton: ImportedModuleSkeleton? = { + let module = ImportedModuleSkeleton(children: importedFiles) + if module.children.allSatisfy({ $0.functions.isEmpty && $0.types.isEmpty && $0.globalGetters.isEmpty }) { + return nil + } + return module + }() + + return BridgeJSSkeleton(moduleName: moduleName, exported: exported, imported: importedSkeleton) + } + + func lookupType(for type: TypeSyntax) -> BridgeType? { + if let attributedType = type.as(AttributedTypeSyntax.self) { + return lookupType(for: attributedType.baseType) + } + + // (T1, T2, ...) -> R + if let functionType = type.as(FunctionTypeSyntax.self) { + var parameters: [BridgeType] = [] + for param in functionType.parameters { + guard let paramType = lookupType(for: param.type) else { + return nil + } + parameters.append(paramType) + } + + guard let returnType = lookupType(for: functionType.returnClause.type) else { + return nil + } + + let isAsync = functionType.effectSpecifiers?.asyncSpecifier != nil + let isThrows = functionType.effectSpecifiers?.throwsClause != nil + + return .closure( + ClosureSignature( + parameters: parameters, + returnType: returnType, + moduleName: moduleName, + isAsync: isAsync, + isThrows: isThrows + ) + ) + } + + // T? + if let optionalType = type.as(OptionalTypeSyntax.self) { + let wrappedType = optionalType.wrappedType + if let baseType = lookupType(for: wrappedType) { + return .optional(baseType) + } + } + // Optional + if let identifierType = type.as(IdentifierTypeSyntax.self), + identifierType.name.text == "Optional", + let genericArgs = identifierType.genericArgumentClause?.arguments, + genericArgs.count == 1, + let argType = TypeSyntax(genericArgs.first?.argument) + { + if let baseType = lookupType(for: argType) { + return .optional(baseType) + } + } + // Swift.Optional + if let memberType = type.as(MemberTypeSyntax.self), + let baseType = memberType.baseType.as(IdentifierTypeSyntax.self), + baseType.name.text == "Swift", + memberType.name.text == "Optional", + let genericArgs = memberType.genericArgumentClause?.arguments, + genericArgs.count == 1, + let argType = TypeSyntax(genericArgs.first?.argument) + { + if let wrappedType = lookupType(for: argType) { + return .optional(wrappedType) + } + } + if let aliasDecl = typeDeclResolver.resolveTypeAlias(type) { + if let resolvedType = lookupType(for: aliasDecl.initializer.value) { + return resolvedType + } + } + + let typeName = type.trimmedDescription + if let primitiveType = BridgeType(swiftType: typeName) { + return primitiveType + } + + guard let typeDecl = typeDeclResolver.resolve(type) else { + return nil + } + + if typeDecl.is(ProtocolDeclSyntax.self) { + let swiftCallName = SwiftToSkeleton.computeSwiftCallName(for: typeDecl, itemName: typeDecl.name.text) + return .swiftProtocol(swiftCallName) + } + + if let enumDecl = typeDecl.as(EnumDeclSyntax.self) { + let swiftCallName = SwiftToSkeleton.computeSwiftCallName(for: enumDecl, itemName: enumDecl.name.text) + let rawTypeString = enumDecl.inheritanceClause?.inheritedTypes.first { inheritedType in + let typeName = inheritedType.type.trimmedDescription + return ExportSwiftConstants.supportedRawTypes.contains(typeName) + }?.type.trimmedDescription + + if let rawType = SwiftEnumRawType(rawTypeString) { + return .rawValueEnum(swiftCallName, rawType) + } else { + let hasAnyCases = enumDecl.memberBlock.members.contains { member in + member.decl.is(EnumCaseDeclSyntax.self) + } + if !hasAnyCases { + return .namespaceEnum(swiftCallName) + } + let hasAssociatedValues = + enumDecl.memberBlock.members.contains { member in + guard let caseDecl = member.decl.as(EnumCaseDeclSyntax.self) else { return false } + return caseDecl.elements.contains { element in + if let params = element.parameterClause?.parameters { + return !params.isEmpty + } + return false + } + } + if hasAssociatedValues { + return .associatedValueEnum(swiftCallName) + } else { + return .caseEnum(swiftCallName) + } + } + } + + if let structDecl = typeDecl.as(StructDeclSyntax.self) { + let swiftCallName = SwiftToSkeleton.computeSwiftCallName(for: structDecl, itemName: structDecl.name.text) + return .swiftStruct(swiftCallName) + } + + guard typeDecl.is(ClassDeclSyntax.self) || typeDecl.is(ActorDeclSyntax.self) else { + return nil + } + let swiftCallName = SwiftToSkeleton.computeSwiftCallName(for: typeDecl, itemName: typeDecl.name.text) + return .swiftHeapObject(swiftCallName) + } + + /// Computes the full Swift call name by walking up the AST hierarchy to find all parent enums + /// This generates the qualified name needed for Swift code generation (e.g., "Networking.API.HTTPServer") + fileprivate static func computeSwiftCallName(for node: some SyntaxProtocol, itemName: String) -> String { + var swiftPath: [String] = [] + var currentNode: Syntax? = node.parent + + while let parent = currentNode { + if let enumDecl = parent.as(EnumDeclSyntax.self), + enumDecl.attributes.hasJSAttribute() + { + swiftPath.insert(enumDecl.name.text, at: 0) + } + currentNode = parent.parent + } + + if swiftPath.isEmpty { + return itemName + } else { + return swiftPath.joined(separator: ".") + "." + itemName + } + } + +} + +private enum ExportSwiftConstants { + static let supportedRawTypes = SwiftEnumRawType.allCases.map { $0.rawValue } +} + +extension AttributeListSyntax { + func hasJSAttribute() -> Bool { + firstJSAttribute != nil + } + + var firstJSAttribute: AttributeSyntax? { + first(where: { + $0.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JS" + })?.as(AttributeSyntax.self) + } +} + +private final class ExportSwiftAPICollector: SyntaxAnyVisitor { + var exportedFunctions: [ExportedFunction] = [] + /// The names of the exported classes, in the order they were written in the source file + var exportedClassNames: [String] = [] + var exportedClassByName: [String: ExportedClass] = [:] + /// The names of the exported enums, in the order they were written in the source file + var exportedEnumNames: [String] = [] + var exportedEnumByName: [String: ExportedEnum] = [:] + /// The names of the exported protocols, in the order they were written in the source file + var exportedProtocolNames: [String] = [] + var exportedProtocolByName: [String: ExportedProtocol] = [:] + /// The names of the exported structs, in the order they were written in the source file + var exportedStructNames: [String] = [] + var exportedStructByName: [String: ExportedStruct] = [:] + var errors: [DiagnosticError] = [] + + func finalize(_ result: inout ExportedSkeleton) { + result.functions.append(contentsOf: exportedFunctions) + result.classes.append(contentsOf: exportedClassNames.map { exportedClassByName[$0]! }) + result.enums.append(contentsOf: exportedEnumNames.map { exportedEnumByName[$0]! }) + result.structs.append(contentsOf: exportedStructNames.map { exportedStructByName[$0]! }) + result.protocols.append(contentsOf: exportedProtocolNames.map { exportedProtocolByName[$0]! }) + } + + /// Creates a unique key by combining name and namespace + private func makeKey(name: String, namespace: [String]?) -> String { + if let namespace = namespace, !namespace.isEmpty { + return "\(namespace.joined(separator: ".")).\(name)" + } else { + return name + } + } + + struct NamespaceResolution { + let namespace: [String]? + let isValid: Bool + } + + /// Resolves and validates namespace from both @JS attribute and computed (nested) namespace + /// Returns the effective namespace and whether validation succeeded + private func resolveNamespace( + from jsAttribute: AttributeSyntax, + for node: some SyntaxProtocol, + declarationType: String + ) -> NamespaceResolution { + let attributeNamespace = extractNamespace(from: jsAttribute) + let computedNamespace = computeNamespace(for: node) + + if computedNamespace != nil && attributeNamespace != nil { + diagnose( + node: jsAttribute, + message: "Nested \(declarationType)s cannot specify their own namespace", + hint: + "Remove the namespace from @JS attribute - nested \(declarationType)s inherit namespace from parent" + ) + return NamespaceResolution(namespace: nil, isValid: false) + } + + return NamespaceResolution(namespace: computedNamespace ?? attributeNamespace, isValid: true) + } + + enum State { + case topLevel + case classBody(name: String, key: String) + case enumBody(name: String, key: String) + case protocolBody(name: String, key: String) + case structBody(name: String, key: String) + } + + struct StateStack { + private var states: [State] + var current: State { + return states.last! + } + + init(_ initialState: State) { + self.states = [initialState] + } + mutating func push(state: State) { + states.append(state) + } + + mutating func pop() { + _ = states.removeLast() + } + } + + var stateStack: StateStack = StateStack(.topLevel) + var state: State { + return stateStack.current + } + let parent: SwiftToSkeleton + + init(parent: SwiftToSkeleton) { + self.parent = parent + super.init(viewMode: .sourceAccurate) + } + + private func diagnose(node: some SyntaxProtocol, message: String, hint: String? = nil) { + errors.append(DiagnosticError(node: node, message: message, hint: hint)) + } + + private func diagnoseUnsupportedType(node: some SyntaxProtocol, type: String) { + diagnose( + node: node, + message: "Unsupported type: \(type)", + hint: "Only primitive types and types defined in the same module are allowed" + ) + } + + private func diagnoseNestedOptional(node: some SyntaxProtocol, type: String) { + diagnose( + node: node, + message: "Nested optional types are not supported: \(type)", + hint: "Use a single optional like String? instead of String?? or Optional>" + ) + } + + /// Detects whether given expression is supported as default parameter value + private func isSupportedDefaultValueExpression(_ initClause: InitializerClauseSyntax) -> Bool { + let expression = initClause.value + + // Function calls are checked later in extractDefaultValue (as constructors are allowed) + if expression.is(ArrayExprSyntax.self) { return false } + if expression.is(DictionaryExprSyntax.self) { return false } + if expression.is(BinaryOperatorExprSyntax.self) { return false } + if expression.is(ClosureExprSyntax.self) { return false } + + // Method call chains (e.g., obj.foo()) + if let memberExpression = expression.as(MemberAccessExprSyntax.self), + memberExpression.base?.is(FunctionCallExprSyntax.self) == true + { + return false + } + + return true + } + + /// Extract enum case value from member access expression + private func extractEnumCaseValue( + from memberExpr: MemberAccessExprSyntax, + type: BridgeType + ) -> DefaultValue? { + let caseName = memberExpr.declName.baseName.text + + let enumName: String? + switch type { + case .caseEnum(let name), .rawValueEnum(let name, _), .associatedValueEnum(let name): + enumName = name + case .optional(let wrappedType): + switch wrappedType { + case .caseEnum(let name), .rawValueEnum(let name, _), .associatedValueEnum(let name): + enumName = name + default: + return nil + } + default: + return nil + } + + guard let enumName = enumName else { return nil } + + if memberExpr.base == nil { + return .enumCase(enumName, caseName) + } + + if let baseExpr = memberExpr.base?.as(DeclReferenceExprSyntax.self) { + let baseName = baseExpr.baseName.text + let lastComponent = enumName.split(separator: ".").last.map(String.init) ?? enumName + if baseName == enumName || baseName == lastComponent { + return .enumCase(enumName, caseName) + } + } + + return nil + } + + /// Extracts default value from parameter's default value clause + private func extractDefaultValue( + from defaultClause: InitializerClauseSyntax?, + type: BridgeType + ) -> DefaultValue? { + guard let defaultClause = defaultClause else { + return nil + } + + if !isSupportedDefaultValueExpression(defaultClause) { + diagnose( + node: defaultClause, + message: "Complex default parameter expressions are not supported", + hint: "Use simple literal values (e.g., \"text\", 42, true, nil) or simple constants" + ) + return nil + } + + let expr = defaultClause.value + + if expr.is(NilLiteralExprSyntax.self) { + guard case .optional(_) = type else { + diagnose( + node: expr, + message: "nil is only valid for optional parameters", + hint: "Make the parameter optional by adding ? to the type" + ) + return nil + } + return .null + } + + if let memberExpr = expr.as(MemberAccessExprSyntax.self), + let enumValue = extractEnumCaseValue(from: memberExpr, type: type) + { + return enumValue + } + + if let funcCall = expr.as(FunctionCallExprSyntax.self) { + return extractConstructorDefaultValue(from: funcCall, type: type) + } + + if let literalValue = extractLiteralValue(from: expr, type: type) { + return literalValue + } + + diagnose( + node: expr, + message: "Unsupported default parameter value expression", + hint: "Use simple literal values like \"text\", 42, true, false, nil, or enum cases like .caseName" + ) + return nil + } + + /// Extracts default value from a constructor call expression + private func extractConstructorDefaultValue( + from funcCall: FunctionCallExprSyntax, + type: BridgeType + ) -> DefaultValue? { + guard let calledExpr = funcCall.calledExpression.as(DeclReferenceExprSyntax.self) else { + diagnose( + node: funcCall, + message: "Complex constructor expressions are not supported", + hint: "Use a simple constructor call like ClassName() or ClassName(arg: value)" + ) + return nil + } + + let typeName = calledExpr.baseName.text + + let isStructType: Bool + let expectedTypeName: String? + switch type { + case .swiftStruct(let name), .optional(.swiftStruct(let name)): + isStructType = true + expectedTypeName = name.split(separator: ".").last.map(String.init) + case .swiftHeapObject(let name), .optional(.swiftHeapObject(let name)): + isStructType = false + expectedTypeName = name.split(separator: ".").last.map(String.init) + default: + diagnose( + node: funcCall, + message: "Constructor calls are only supported for class and struct types", + hint: "Parameter type should be a Swift class or struct" + ) + return nil + } + + guard let expectedTypeName = expectedTypeName, typeName == expectedTypeName else { + diagnose( + node: funcCall, + message: "Constructor type name '\(typeName)' doesn't match parameter type", + hint: "Ensure the constructor matches the parameter type" + ) + return nil + } + + if isStructType { + // For structs, extract field name/value pairs + var fields: [DefaultValueField] = [] + for argument in funcCall.arguments { + guard let fieldName = argument.label?.text else { + diagnose( + node: argument, + message: "Struct initializer arguments must have labels", + hint: "Use labeled arguments like MyStruct(x: 1, y: 2)" + ) + return nil + } + guard let fieldValue = extractLiteralValue(from: argument.expression) else { + diagnose( + node: argument.expression, + message: "Struct field value must be a literal", + hint: "Use simple literals like \"text\", 42, true, false in struct fields" + ) + return nil + } + fields.append(DefaultValueField(name: fieldName, value: fieldValue)) + } + return .structLiteral(typeName, fields) + } else { + if funcCall.arguments.isEmpty { + return .object(typeName) + } + + var constructorArgs: [DefaultValue] = [] + for argument in funcCall.arguments { + guard let argValue = extractLiteralValue(from: argument.expression) else { + diagnose( + node: argument.expression, + message: "Constructor argument must be a literal value", + hint: "Use simple literals like \"text\", 42, true, false in constructor arguments" + ) + return nil + } + constructorArgs.append(argValue) + } + return .objectWithArguments(typeName, constructorArgs) + } + } + + /// Extracts a literal value from an expression with optional type checking + private func extractLiteralValue(from expr: ExprSyntax, type: BridgeType? = nil) -> DefaultValue? { + if expr.is(NilLiteralExprSyntax.self) { + return .null + } + + if let stringLiteral = expr.as(StringLiteralExprSyntax.self), + let segment = stringLiteral.segments.first?.as(StringSegmentSyntax.self) + { + let value = DefaultValue.string(segment.content.text) + if let type = type, !type.isCompatibleWith(.string) { + return nil + } + return value + } + + if let boolLiteral = expr.as(BooleanLiteralExprSyntax.self) { + let value = DefaultValue.bool(boolLiteral.literal.text == "true") + if let type = type, !type.isCompatibleWith(.bool) { + return nil + } + return value + } + + var numericExpr = expr + var isNegative = false + if let prefixExpr = expr.as(PrefixOperatorExprSyntax.self), + prefixExpr.operator.text == "-" + { + numericExpr = prefixExpr.expression + isNegative = true + } + + if let intLiteral = numericExpr.as(IntegerLiteralExprSyntax.self), + let intValue = Int(intLiteral.literal.text) + { + let value = DefaultValue.int(isNegative ? -intValue : intValue) + if let type = type, !type.isCompatibleWith(.int) { + return nil + } + return value + } + + if let floatLiteral = numericExpr.as(FloatLiteralExprSyntax.self) { + if let floatValue = Float(floatLiteral.literal.text) { + let value = DefaultValue.float(isNegative ? -floatValue : floatValue) + if type == nil || type?.isCompatibleWith(.float) == true { + return value + } + } + if let doubleValue = Double(floatLiteral.literal.text) { + let value = DefaultValue.double(isNegative ? -doubleValue : doubleValue) + if type == nil || type?.isCompatibleWith(.double) == true { + return value + } + } + } + + return nil + } + + /// Shared parameter parsing logic used by functions, initializers, and protocol methods + private func parseParameters( + from parameterClause: FunctionParameterClauseSyntax, + allowDefaults: Bool = true + ) -> [Parameter] { + var parameters: [Parameter] = [] + + for param in parameterClause.parameters { + let resolvedType = self.parent.lookupType(for: param.type) + if let type = resolvedType, case .closure(let signature) = type { + if signature.isAsync { + diagnose( + node: param.type, + message: "Async is not supported for Swift closures yet." + ) + continue + } + if signature.isThrows { + diagnose( + node: param.type, + message: "Throws is not supported for Swift closures yet." + ) + continue + } + } + if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { + diagnoseNestedOptional(node: param.type, type: param.type.trimmedDescription) + continue + } + if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { + diagnoseNestedOptional(node: param.type, type: param.type.trimmedDescription) + continue + } + + guard let type = resolvedType else { + diagnoseUnsupportedType(node: param.type, type: param.type.trimmedDescription) + continue + } + + let name = param.secondName?.text ?? param.firstName.text + let label = param.firstName.text + + let defaultValue: DefaultValue? + if allowDefaults { + defaultValue = extractDefaultValue(from: param.defaultValue, type: type) + } else { + defaultValue = nil + } + + parameters.append(Parameter(label: label, name: name, type: type, defaultValue: defaultValue)) + } + + return parameters + } + + override func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { + guard node.attributes.hasJSAttribute() else { + return .skipChildren + } + + let isStatic = node.modifiers.contains { modifier in + modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) + } + + switch state { + case .topLevel: + if isStatic { + diagnose(node: node, message: "Top-level functions cannot be static") + return .skipChildren + } + if let exportedFunction = visitFunction(node: node, isStatic: false) { + exportedFunctions.append(exportedFunction) + } + return .skipChildren + case .classBody(let className, let classKey): + if let exportedFunction = visitFunction( + node: node, + isStatic: isStatic, + className: className, + classKey: classKey + ) { + exportedClassByName[classKey]?.methods.append(exportedFunction) + } + return .skipChildren + case .enumBody(let enumName, let enumKey): + if !isStatic { + diagnose(node: node, message: "Only static functions are supported in enums") + return .skipChildren + } + if let exportedFunction = visitFunction(node: node, isStatic: isStatic, enumName: enumName) { + if var currentEnum = exportedEnumByName[enumKey] { + currentEnum.staticMethods.append(exportedFunction) + exportedEnumByName[enumKey] = currentEnum + } + } + return .skipChildren + case .protocolBody(_, _): + // Protocol methods are handled in visitProtocolMethod during protocol parsing + return .skipChildren + case .structBody(let structName, let structKey): + if let exportedFunction = visitFunction(node: node, isStatic: isStatic, structName: structName) { + if var currentStruct = exportedStructByName[structKey] { + currentStruct.methods.append(exportedFunction) + exportedStructByName[structKey] = currentStruct + } + } + return .skipChildren + } + } + + private func visitFunction( + node: FunctionDeclSyntax, + isStatic: Bool, + className: String? = nil, + classKey: String? = nil, + enumName: String? = nil, + structName: String? = nil + ) -> ExportedFunction? { + guard let jsAttribute = node.attributes.firstJSAttribute else { + return nil + } + + let name = node.name.text + + let attributeNamespace = extractNamespace(from: jsAttribute) + let computedNamespace = computeNamespace(for: node) + + let finalNamespace: [String]? + + if let computed = computedNamespace, !computed.isEmpty { + finalNamespace = computed + } else { + finalNamespace = attributeNamespace + } + + if attributeNamespace != nil, case .classBody = state { + diagnose( + node: jsAttribute, + message: "Namespace is only needed in top-level declaration", + hint: "Remove the namespace from @JS attribute or move this function to top-level" + ) + } + + if attributeNamespace != nil, case .enumBody = state { + diagnose( + node: jsAttribute, + message: "Namespace is not supported for enum static functions", + hint: "Remove the namespace from @JS attribute - enum functions inherit namespace from enum" + ) + } + + let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: true) + let returnType: BridgeType + if let returnClause = node.signature.returnClause { + let resolvedType = self.parent.lookupType(for: returnClause.type) + + if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { + diagnoseNestedOptional(node: returnClause.type, type: returnClause.type.trimmedDescription) + return nil + } + + guard let type = resolvedType else { + diagnoseUnsupportedType(node: returnClause.type, type: returnClause.type.trimmedDescription) + return nil + } + returnType = type + } else { + returnType = .void + } + + let abiName: String + let staticContext: StaticContext? + + switch state { + case .topLevel: + staticContext = nil + case .classBody(let className, _): + if isStatic { + staticContext = .className(className) + } else { + staticContext = nil + } + case .enumBody(let enumName, let enumKey): + if !isStatic { + diagnose(node: node, message: "Only static functions are supported in enums") + return nil + } + + let isNamespaceEnum = exportedEnumByName[enumKey]?.cases.isEmpty ?? true + staticContext = isNamespaceEnum ? .namespaceEnum : .enumName(enumName) + case .protocolBody(_, _): + return nil + case .structBody(let structName, _): + if isStatic { + staticContext = .structName(structName) + } else { + staticContext = nil + } + } + + let classNameForABI: String? + switch state { + case .classBody(let className, _): + classNameForABI = className + case .structBody(let structName, _): + classNameForABI = structName + default: + classNameForABI = nil + } + abiName = ABINameGenerator.generateABIName( + baseName: name, + namespace: finalNamespace, + staticContext: isStatic ? staticContext : nil, + className: classNameForABI + ) + + guard let effects = collectEffects(signature: node.signature, isStatic: isStatic) else { + return nil + } + + return ExportedFunction( + name: name, + abiName: abiName, + parameters: parameters, + returnType: returnType, + effects: effects, + namespace: finalNamespace, + staticContext: staticContext + ) + } + + private func collectEffects(signature: FunctionSignatureSyntax, isStatic: Bool = false) -> Effects? { + let isAsync = signature.effectSpecifiers?.asyncSpecifier != nil + var isThrows = false + if let throwsClause: ThrowsClauseSyntax = signature.effectSpecifiers?.throwsClause { + // Limit the thrown type to JSException for now + guard let thrownType = throwsClause.type else { + diagnose( + node: throwsClause, + message: "Thrown type is not specified, only JSException is supported for now" + ) + return nil + } + guard thrownType.trimmedDescription == "JSException" else { + diagnose( + node: throwsClause, + message: "Only JSException is supported for thrown type, got \(thrownType.trimmedDescription)" + ) + return nil + } + isThrows = true + } + return Effects(isAsync: isAsync, isThrows: isThrows, isStatic: isStatic) + } + + private func extractNamespace( + from jsAttribute: AttributeSyntax + ) -> [String]? { + guard let arguments = jsAttribute.arguments?.as(LabeledExprListSyntax.self) else { + return nil + } + + guard let namespaceArg = arguments.first(where: { $0.label?.text == "namespace" }), + let stringLiteral = namespaceArg.expression.as(StringLiteralExprSyntax.self), + let namespaceString = stringLiteral.segments.first?.as(StringSegmentSyntax.self)?.content.text + else { + return nil + } + + return namespaceString.split(separator: ".").map(String.init) + } + + private func extractEnumStyle( + from jsAttribute: AttributeSyntax + ) -> EnumEmitStyle? { + guard let arguments = jsAttribute.arguments?.as(LabeledExprListSyntax.self), + let styleArg = arguments.first(where: { $0.label?.text == "enumStyle" }) + else { + return nil + } + let text = styleArg.expression.trimmedDescription + if text.contains("tsEnum") { + return .tsEnum + } + if text.contains("const") { + return .const + } + return nil + } + + override func visit(_ node: InitializerDeclSyntax) -> SyntaxVisitorContinueKind { + guard let jsAttribute = node.attributes.firstJSAttribute else { return .skipChildren } + + switch state { + case .classBody(let className, let classKey): + if extractNamespace(from: jsAttribute) != nil { + diagnose( + node: jsAttribute, + message: "Namespace is not supported for initializer declarations", + hint: "Remove the namespace from @JS attribute" + ) + } + + let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: true) + + guard let effects = collectEffects(signature: node.signature) else { + return .skipChildren + } + + let constructor = ExportedConstructor( + abiName: "bjs_\(className)_init", + parameters: parameters, + effects: effects + ) + exportedClassByName[classKey]?.constructor = constructor + + case .structBody(let structName, let structKey): + if extractNamespace(from: jsAttribute) != nil { + diagnose( + node: jsAttribute, + message: "Namespace is not supported for initializer declarations", + hint: "Remove the namespace from @JS attribute" + ) + } + + let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: true) + + guard let effects = collectEffects(signature: node.signature) else { + return .skipChildren + } + + let constructor = ExportedConstructor( + abiName: "bjs_\(structName)_init", + parameters: parameters, + effects: effects + ) + exportedStructByName[structKey]?.constructor = constructor + + case .enumBody(_, _): + diagnose(node: node, message: "Initializers are not supported inside enums") + + case .topLevel, .protocolBody(_, _): + diagnose(node: node, message: "@JS init must be inside a @JS class or struct") + } + + return .skipChildren + } + + override func visit(_ node: VariableDeclSyntax) -> SyntaxVisitorContinueKind { + guard let jsAttribute = node.attributes.firstJSAttribute else { return .skipChildren } + + let isStatic = node.modifiers.contains { modifier in + modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) + } + + let attributeNamespace = extractNamespace(from: jsAttribute) + if attributeNamespace != nil { + diagnose( + node: jsAttribute, + message: "Namespace parameter within @JS attribute is not supported for property declarations", + hint: + "Remove the namespace from @JS attribute. If you need dedicated namespace, consider using a nested enum or class instead." + ) + } + + let computedNamespace = computeNamespace(for: node) + let finalNamespace: [String]? + + if let computed = computedNamespace, !computed.isEmpty { + finalNamespace = computed + } else { + finalNamespace = nil + } + + // Determine static context and validate placement + let staticContext: StaticContext? + + switch state { + case .classBody(let className, _): + staticContext = isStatic ? .className(className) : nil + case .enumBody(let enumName, let enumKey): + if !isStatic { + diagnose(node: node, message: "Only static properties are supported in enums") + return .skipChildren + } + let isNamespaceEnum = exportedEnumByName[enumKey]?.cases.isEmpty ?? true + staticContext = isStatic ? (isNamespaceEnum ? .namespaceEnum : .enumName(enumName)) : nil + case .topLevel: + diagnose(node: node, message: "@JS var must be inside a @JS class or enum") + return .skipChildren + case .protocolBody(let protocolName, let protocolKey): + return visitProtocolProperty(node: node, protocolName: protocolName, protocolKey: protocolKey) + case .structBody(let structName, _): + if isStatic { + staticContext = .structName(structName) + } else { + diagnose(node: node, message: "@JS var must be static in structs (instance fields don't need @JS)") + return .skipChildren + } + } + + // Process each binding (variable declaration) + for binding in node.bindings { + guard let pattern = binding.pattern.as(IdentifierPatternSyntax.self) else { + diagnose(node: binding.pattern, message: "Complex patterns not supported for @JS properties") + continue + } + + let propertyName = pattern.identifier.text + + guard let typeAnnotation = binding.typeAnnotation else { + diagnose(node: binding, message: "@JS property must have explicit type annotation") + continue + } + + guard let propertyType = self.parent.lookupType(for: typeAnnotation.type) else { + diagnoseUnsupportedType(node: typeAnnotation.type, type: typeAnnotation.type.trimmedDescription) + continue + } + + // Check if property is readonly + let isLet = node.bindingSpecifier.tokenKind == .keyword(.let) + let isGetterOnly = node.bindings.contains(where: { self.hasOnlyGetter($0.accessorBlock) }) + + let isReadonly = isLet || isGetterOnly + + let exportedProperty = ExportedProperty( + name: propertyName, + type: propertyType, + isReadonly: isReadonly, + isStatic: isStatic, + namespace: finalNamespace, + staticContext: staticContext + ) + + if case .enumBody(_, let key) = state { + if var currentEnum = exportedEnumByName[key] { + currentEnum.staticProperties.append(exportedProperty) + exportedEnumByName[key] = currentEnum + } + } else if case .structBody(_, let key) = state { + exportedStructByName[key]?.properties.append(exportedProperty) + } else if case .classBody(_, let key) = state { + exportedClassByName[key]?.properties.append(exportedProperty) + } + } + + return .skipChildren + } + + override func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind { + let name = node.name.text + + guard let jsAttribute = node.attributes.firstJSAttribute else { + return .skipChildren + } + + let namespaceResult = resolveNamespace(from: jsAttribute, for: node, declarationType: "class") + guard namespaceResult.isValid else { + return .skipChildren + } + let swiftCallName = SwiftToSkeleton.computeSwiftCallName(for: node, itemName: name) + let explicitAccessControl = computeExplicitAtLeastInternalAccessControl( + for: node, + message: "Class visibility must be at least internal" + ) + let exportedClass = ExportedClass( + name: name, + swiftCallName: swiftCallName, + explicitAccessControl: explicitAccessControl, + constructor: nil, + methods: [], + properties: [], + namespace: namespaceResult.namespace + ) + let uniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) + + stateStack.push(state: .classBody(name: name, key: uniqueKey)) + exportedClassByName[uniqueKey] = exportedClass + exportedClassNames.append(uniqueKey) + return .visitChildren + } + + override func visitPost(_ node: ClassDeclSyntax) { + // Make sure we pop the state stack only if we're in a class body state (meaning we successfully pushed) + if case .classBody(_, _) = stateStack.current { + stateStack.pop() + } + } + + override func visit(_ node: EnumDeclSyntax) -> SyntaxVisitorContinueKind { + guard let jsAttribute = node.attributes.firstJSAttribute else { + return .skipChildren + } + + let name = node.name.text + + let rawType: String? = node.inheritanceClause?.inheritedTypes.first { inheritedType in + let typeName = inheritedType.type.trimmedDescription + return ExportSwiftConstants.supportedRawTypes.contains(typeName) + }?.type.trimmedDescription + + let namespaceResult = resolveNamespace(from: jsAttribute, for: node, declarationType: "enum") + guard namespaceResult.isValid else { + return .skipChildren + } + let emitStyle = extractEnumStyle(from: jsAttribute) ?? .const + let swiftCallName = SwiftToSkeleton.computeSwiftCallName(for: node, itemName: name) + let explicitAccessControl = computeExplicitAtLeastInternalAccessControl( + for: node, + message: "Enum visibility must be at least internal" + ) + + let tsFullPath: String + if let namespace = namespaceResult.namespace, !namespace.isEmpty { + tsFullPath = namespace.joined(separator: ".") + "." + name + } else { + tsFullPath = name + } + + // Create enum directly in dictionary + let exportedEnum = ExportedEnum( + name: name, + swiftCallName: swiftCallName, + tsFullPath: tsFullPath, + explicitAccessControl: explicitAccessControl, + cases: [], // Will be populated in visit(EnumCaseDeclSyntax) + rawType: SwiftEnumRawType(rawType), + namespace: namespaceResult.namespace, + emitStyle: emitStyle, + staticMethods: [], + staticProperties: [] + ) + + let enumUniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) + exportedEnumByName[enumUniqueKey] = exportedEnum + exportedEnumNames.append(enumUniqueKey) + + stateStack.push(state: .enumBody(name: name, key: enumUniqueKey)) + + return .visitChildren + } + + override func visitPost(_ node: EnumDeclSyntax) { + guard let jsAttribute = node.attributes.firstJSAttribute else { + // Only pop if we have a valid enum that was processed + if case .enumBody(_, _) = stateStack.current { + stateStack.pop() + } + return + } + + guard case .enumBody(_, let enumKey) = stateStack.current else { + return + } + + guard let exportedEnum = exportedEnumByName[enumKey] else { + stateStack.pop() + return + } + + let emitStyle = exportedEnum.emitStyle + + if case .tsEnum = emitStyle { + if exportedEnum.rawType == .bool { + diagnose( + node: jsAttribute, + message: "TypeScript enum style is not supported for Bool raw-value enums", + hint: "Use enumStyle: .const or change the raw type to String or a numeric type" + ) + } + if !exportedEnum.staticMethods.isEmpty { + diagnose( + node: jsAttribute, + message: "TypeScript enum style does not support static functions", + hint: "Use enumStyle: .const to generate a const object that supports static functions" + ) + } + } + + if exportedEnum.cases.contains(where: { !$0.associatedValues.isEmpty }) { + if case .tsEnum = emitStyle { + diagnose( + node: jsAttribute, + message: "TypeScript enum style is not supported for associated value enums", + hint: "Use enumStyle: .const in order to map associated-value enums" + ) + } + for enumCase in exportedEnum.cases { + for associatedValue in enumCase.associatedValues { + switch associatedValue.type { + case .string, .int, .float, .double, .bool: + break + case .optional(let wrappedType): + switch wrappedType { + case .string, .int, .float, .double, .bool: + break + default: + diagnose( + node: node, + message: "Unsupported associated value type: \(associatedValue.type.swiftType)", + hint: + "Only primitive types and optional primitives (String?, Int?, Float?, Double?, Bool?) are supported in associated-value enums" + ) + } + default: + diagnose( + node: node, + message: "Unsupported associated value type: \(associatedValue.type.swiftType)", + hint: + "Only primitive types and optional primitives (String?, Int?, Float?, Double?, Bool?) are supported in associated-value enums" + ) + } + } + } + } + + stateStack.pop() + } + + override func visit(_ node: ProtocolDeclSyntax) -> SyntaxVisitorContinueKind { + guard let jsAttribute = node.attributes.firstJSAttribute else { + return .skipChildren + } + + let name = node.name.text + + let namespaceResult = resolveNamespace(from: jsAttribute, for: node, declarationType: "protocol") + guard namespaceResult.isValid else { + return .skipChildren + } + _ = computeExplicitAtLeastInternalAccessControl( + for: node, + message: "Protocol visibility must be at least internal" + ) + + let protocolUniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) + + exportedProtocolByName[protocolUniqueKey] = ExportedProtocol( + name: name, + methods: [], + properties: [], + namespace: namespaceResult.namespace + ) + + stateStack.push(state: .protocolBody(name: name, key: protocolUniqueKey)) + + var methods: [ExportedFunction] = [] + for member in node.memberBlock.members { + if let funcDecl = member.decl.as(FunctionDeclSyntax.self) { + if let exportedFunction = visitProtocolMethod( + node: funcDecl, + protocolName: name, + namespace: namespaceResult.namespace + ) { + methods.append(exportedFunction) + } + } else if let varDecl = member.decl.as(VariableDeclSyntax.self) { + _ = visitProtocolProperty(node: varDecl, protocolName: name, protocolKey: protocolUniqueKey) + } + } + + let exportedProtocol = ExportedProtocol( + name: name, + methods: methods, + properties: exportedProtocolByName[protocolUniqueKey]?.properties ?? [], + namespace: namespaceResult.namespace + ) + + exportedProtocolByName[protocolUniqueKey] = exportedProtocol + exportedProtocolNames.append(protocolUniqueKey) + + stateStack.pop() + + return .skipChildren + } + + override func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind { + guard let jsAttribute = node.attributes.firstJSAttribute else { + return .skipChildren + } + + let name = node.name.text + + let namespaceResult = resolveNamespace(from: jsAttribute, for: node, declarationType: "struct") + guard namespaceResult.isValid else { + return .skipChildren + } + let swiftCallName = SwiftToSkeleton.computeSwiftCallName(for: node, itemName: name) + let explicitAccessControl = computeExplicitAtLeastInternalAccessControl( + for: node, + message: "Struct visibility must be at least internal" + ) + + var properties: [ExportedProperty] = [] + + // Process all variables in struct as readonly (value semantics) and don't require @JS + for member in node.memberBlock.members { + if let varDecl = member.decl.as(VariableDeclSyntax.self) { + let isStatic = varDecl.modifiers.contains { modifier in + modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) + } + + // Handled with error in visitVariable + if varDecl.attributes.hasJSAttribute() { + continue + } + // Skips static non-@JS properties + if isStatic { + continue + } + + for binding in varDecl.bindings { + guard let pattern = binding.pattern.as(IdentifierPatternSyntax.self) else { + continue + } + + let fieldName = pattern.identifier.text + + guard let typeAnnotation = binding.typeAnnotation else { + diagnose(node: binding, message: "Struct field must have explicit type annotation") + continue + } + + guard let fieldType = self.parent.lookupType(for: typeAnnotation.type) else { + diagnoseUnsupportedType( + node: typeAnnotation.type, + type: typeAnnotation.type.trimmedDescription + ) + continue + } + + let property = ExportedProperty( + name: fieldName, + type: fieldType, + isReadonly: true, + isStatic: false, + namespace: namespaceResult.namespace, + staticContext: nil + ) + properties.append(property) + } + } + } + + let structUniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) + let exportedStruct = ExportedStruct( + name: name, + swiftCallName: swiftCallName, + explicitAccessControl: explicitAccessControl, + properties: properties, + methods: [], + namespace: namespaceResult.namespace + ) + + exportedStructByName[structUniqueKey] = exportedStruct + exportedStructNames.append(structUniqueKey) + + stateStack.push(state: .structBody(name: name, key: structUniqueKey)) + + return .visitChildren + } + + override func visitPost(_ node: StructDeclSyntax) { + if case .structBody(_, _) = stateStack.current { + stateStack.pop() + } + } + + private func visitProtocolMethod( + node: FunctionDeclSyntax, + protocolName: String, + namespace: [String]? + ) -> ExportedFunction? { + let name = node.name.text + + let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: false) + + let returnType: BridgeType + if let returnClause = node.signature.returnClause { + let resolvedType = self.parent.lookupType(for: returnClause.type) + + if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { + diagnoseNestedOptional(node: returnClause.type, type: returnClause.type.trimmedDescription) + return nil + } + + guard let type = resolvedType else { + diagnoseUnsupportedType(node: returnClause.type, type: returnClause.type.trimmedDescription) + return nil + } + returnType = type + } else { + returnType = .void + } + + let abiName = ABINameGenerator.generateABIName( + baseName: name, + namespace: namespace, + className: protocolName + ) + + guard let effects = collectEffects(signature: node.signature) else { + return nil + } + + return ExportedFunction( + name: name, + abiName: abiName, + parameters: parameters, + returnType: returnType, + effects: effects, + namespace: namespace, + staticContext: nil + ) + } + + private func visitProtocolProperty( + node: VariableDeclSyntax, + protocolName: String, + protocolKey: String + ) -> SyntaxVisitorContinueKind { + for binding in node.bindings { + guard let pattern = binding.pattern.as(IdentifierPatternSyntax.self) else { + diagnose(node: binding.pattern, message: "Complex patterns not supported for protocol properties") + continue + } + + let propertyName = pattern.identifier.text + + guard let typeAnnotation = binding.typeAnnotation else { + diagnose(node: binding, message: "Protocol property must have explicit type annotation") + continue + } + + guard let propertyType = self.parent.lookupType(for: typeAnnotation.type) else { + diagnoseUnsupportedType(node: typeAnnotation.type, type: typeAnnotation.type.trimmedDescription) + continue + } + + guard let accessorBlock = binding.accessorBlock else { + diagnose( + node: binding, + message: "Protocol property must specify { get } or { get set }", + hint: "Add { get } for readonly or { get set } for readwrite property" + ) + continue + } + + let isReadonly = hasOnlyGetter(accessorBlock) + + let exportedProperty = ExportedProtocolProperty( + name: propertyName, + type: propertyType, + isReadonly: isReadonly + ) + + if var currentProtocol = exportedProtocolByName[protocolKey] { + var properties = currentProtocol.properties + properties.append(exportedProperty) + + currentProtocol = ExportedProtocol( + name: currentProtocol.name, + methods: currentProtocol.methods, + properties: properties, + namespace: currentProtocol.namespace + ) + exportedProtocolByName[protocolKey] = currentProtocol + } + } + + return .skipChildren + } + + private func hasOnlyGetter(_ accessorBlock: AccessorBlockSyntax?) -> Bool { + switch accessorBlock?.accessors { + case .accessors(let accessors): + // Has accessors - check if it only has a getter (no setter, willSet, or didSet) + return !accessors.contains(where: { accessor in + let tokenKind = accessor.accessorSpecifier.tokenKind + return tokenKind == .keyword(.set) || tokenKind == .keyword(.willSet) + || tokenKind == .keyword(.didSet) + }) + case .getter: + // Has only a getter block + return true + case nil: + // No accessor block - this is a stored property, not readonly + return false + } + } + + override func visit(_ node: EnumCaseDeclSyntax) -> SyntaxVisitorContinueKind { + guard case .enumBody(_, let enumKey) = stateStack.current else { + return .visitChildren + } + + for element in node.elements { + let caseName = element.name.text + let rawValue: String? + var associatedValues: [AssociatedValue] = [] + + if exportedEnumByName[enumKey]?.rawType != nil { + if let stringLiteral = element.rawValue?.value.as(StringLiteralExprSyntax.self) { + rawValue = stringLiteral.segments.first?.as(StringSegmentSyntax.self)?.content.text + } else if let boolLiteral = element.rawValue?.value.as(BooleanLiteralExprSyntax.self) { + rawValue = boolLiteral.literal.text + } else { + var numericExpr = element.rawValue?.value + var isNegative = false + + // Check for prefix operator (for negative numbers) + if let prefixExpr = numericExpr?.as(PrefixOperatorExprSyntax.self), + prefixExpr.operator.text == "-" + { + numericExpr = prefixExpr.expression + isNegative = true + } + + if let intLiteral = numericExpr?.as(IntegerLiteralExprSyntax.self) { + rawValue = isNegative ? "-\(intLiteral.literal.text)" : intLiteral.literal.text + } else if let floatLiteral = numericExpr?.as(FloatLiteralExprSyntax.self) { + rawValue = isNegative ? "-\(floatLiteral.literal.text)" : floatLiteral.literal.text + } else { + rawValue = nil + } + } + } else { + rawValue = nil + } + if let parameterClause = element.parameterClause { + for param in parameterClause.parameters { + guard let bridgeType = parent.lookupType(for: param.type) else { + diagnose( + node: param.type, + message: "Unsupported associated value type: \(param.type.trimmedDescription)", + hint: "Only primitive types and types defined in the same module are allowed" + ) + continue + } + + let label = param.firstName?.text + associatedValues.append(AssociatedValue(label: label, type: bridgeType)) + } + } + let enumCase = EnumCase( + name: caseName, + rawValue: rawValue, + associatedValues: associatedValues + ) + exportedEnumByName[enumKey]?.cases.append(enumCase) + } + + return .visitChildren + } + + /// Computes namespace by walking up the AST hierarchy to find parent namespace enums + /// If parent enum is a namespace enum (no cases) then it will be used as part of namespace for given node + /// + /// + /// Method allows for explicit namespace for top level enum, it will be used as base namespace and will concat enum name + private func computeNamespace(for node: some SyntaxProtocol) -> [String]? { + var namespace: [String] = [] + var currentNode: Syntax? = node.parent + + while let parent = currentNode { + if let enumDecl = parent.as(EnumDeclSyntax.self), + enumDecl.attributes.hasJSAttribute() + { + let isNamespaceEnum = !enumDecl.memberBlock.members.contains { member in + member.decl.is(EnumCaseDeclSyntax.self) + } + if isNamespaceEnum { + namespace.insert(enumDecl.name.text, at: 0) + + if let jsAttribute = enumDecl.attributes.firstJSAttribute, + let explicitNamespace = extractNamespace(from: jsAttribute) + { + namespace = explicitNamespace + namespace + break + } + } + } + currentNode = parent.parent + } + + return namespace.isEmpty ? nil : namespace + } + + /// Requires the node to have at least internal access control. + private func computeExplicitAtLeastInternalAccessControl( + for node: some WithModifiersSyntax, + message: String + ) -> String? { + guard let accessControl = node.explicitAccessControl else { + return nil + } + guard accessControl.isAtLeastInternal else { + diagnose( + node: accessControl, + message: message, + hint: "Use `internal`, `package` or `public` access control" + ) + return nil + } + return accessControl.name.text + } +} + +fileprivate extension BridgeType { + /// Returns true if a value of `expectedType` can be assigned to this type. + func isCompatibleWith(_ expectedType: BridgeType) -> Bool { + switch (self, expectedType) { + case let (lhs, rhs) where lhs == rhs: + return true + case (.optional(let wrapped), expectedType): + return wrapped == expectedType + default: + return false + } + } +} + +import SwiftSyntax +#if canImport(BridgeJSSkeleton) +import BridgeJSSkeleton +#endif +#if canImport(BridgeJSUtilities) +import BridgeJSUtilities +#endif + +private final class ImportSwiftMacrosJSImportTypeNameCollector: SyntaxAnyVisitor { + var typeNames: Set = [] + + private func visitTypeDecl(_ attributes: AttributeListSyntax?, _ name: String) -> SyntaxVisitorContinueKind { + if ImportSwiftMacrosAPICollector.AttributeChecker.hasJSClassAttribute(attributes) { + typeNames.insert(name) + } + return .visitChildren + } + + override func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind { + visitTypeDecl(node.attributes, node.name.text) + } + + override func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind { + visitTypeDecl(node.attributes, node.name.text) + } +} + +private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { + var importedFunctions: [ImportedFunctionSkeleton] = [] + var importedTypes: [ImportedTypeSkeleton] = [] + var importedGlobalGetters: [ImportedGetterSkeleton] = [] + var errors: [DiagnosticError] = [] + + private let inputFilePath: String + private var jsClassNames: Set + + // MARK: - State Management + + enum State { + case topLevel + case jsClassBody(name: String) + } + + private var stateStack: [State] = [.topLevel] + var state: State { + return stateStack.last! + } + + // Current type being collected (when in jsClassBody state) + private struct CurrentType { + let name: String + var constructor: ImportedConstructorSkeleton? + var methods: [ImportedFunctionSkeleton] + var getters: [ImportedGetterSkeleton] + var setters: [ImportedSetterSkeleton] + } + private var currentType: CurrentType? + + // MARK: - Attribute Checking + + /// Helper struct for checking and extracting attributes + fileprivate struct AttributeChecker { + static func hasJSFunctionAttribute(_ attributes: AttributeListSyntax?) -> Bool { + hasAttribute(attributes, name: "JSFunction") + } + + static func hasJSGetterAttribute(_ attributes: AttributeListSyntax?) -> Bool { + hasAttribute(attributes, name: "JSGetter") + } + + static func hasJSSetterAttribute(_ attributes: AttributeListSyntax?) -> Bool { + hasAttribute(attributes, name: "JSSetter") + } + + static func firstJSSetterAttribute(_ attributes: AttributeListSyntax?) -> AttributeSyntax? { + attributes?.first { attribute in + attribute.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JSSetter" + }?.as(AttributeSyntax.self) + } + + static func hasJSClassAttribute(_ attributes: AttributeListSyntax?) -> Bool { + hasAttribute(attributes, name: "JSClass") + } + + static func hasAttribute(_ attributes: AttributeListSyntax?, name: String) -> Bool { + guard let attributes else { return false } + return attributes.contains { attribute in + guard let syntax = attribute.as(AttributeSyntax.self) else { return false } + return syntax.attributeName.trimmedDescription == name + } + } + + /// Extracts the jsName argument value from a @JSSetter attribute, if present. + static func extractJSName(from attribute: AttributeSyntax) -> String? { + guard let arguments = attribute.arguments?.as(LabeledExprListSyntax.self) else { + return nil + } + for argument in arguments { + if argument.label?.text == "jsName", + let stringLiteral = argument.expression.as(StringLiteralExprSyntax.self), + let segment = stringLiteral.segments.first?.as(StringSegmentSyntax.self) + { + return segment.content.text + } + } + return nil + } + } + + // MARK: - Validation Helpers + + /// Common validation result for setter functions + private struct SetterValidationResult { + let effects: Effects + let jsName: String? + let firstParam: FunctionParameterSyntax + let valueType: BridgeType + } + + /// Validates effects (throws required, async not supported) + private func validateEffects( + _ effects: FunctionEffectSpecifiersSyntax?, + node: some SyntaxProtocol, + attributeName: String + ) -> Effects? { + guard let effects = parseEffects(effects) else { + errors.append( + DiagnosticError( + node: node, + message: "@\(attributeName) declarations must be throws.", + hint: "Declare the function as 'throws (JSException)'." + ) + ) + return nil + } + if effects.isAsync { + errors.append( + DiagnosticError( + node: node, + message: "@\(attributeName) declarations do not support async yet." + ) + ) + return nil + } + return effects + } + + /// Validates a setter function and extracts common information + private func validateSetter( + _ node: FunctionDeclSyntax, + jsSetter: AttributeSyntax, + enclosingTypeName: String? + ) -> SetterValidationResult? { + guard let effects = validateEffects(node.signature.effectSpecifiers, node: node, attributeName: "JSSetter") + else { + return nil + } + + let jsName = AttributeChecker.extractJSName(from: jsSetter) + let parameters = node.signature.parameterClause.parameters + + guard let firstParam = parameters.first else { + errors.append( + DiagnosticError( + node: node, + message: "@JSSetter function must have at least one parameter." + ) + ) + return nil + } + + if firstParam.type.is(MissingTypeSyntax.self) { + errors.append( + DiagnosticError( + node: firstParam, + message: "All @JSSetter parameters must have explicit types." + ) + ) + return nil + } + + return SetterValidationResult( + effects: effects, + jsName: jsName, + firstParam: firstParam, + valueType: parseType(firstParam.type, enclosingTypeName: enclosingTypeName) + ) + } + + // MARK: - Property Name Resolution + + /// Helper for resolving property names from setter function names and jsName attributes + private struct PropertyNameResolver { + /// Resolves property name and function base name from a setter function and optional jsName + /// - Returns: (propertyName, functionBaseName) where propertyName preserves case for getter matching, + /// and functionBaseName has lowercase first char for ABI generation + static func resolve( + functionName: String, + jsName: String?, + normalizeIdentifier: (String) -> String + ) -> (propertyName: String, functionBaseName: String)? { + if let jsName = jsName { + let propertyName = normalizeIdentifier(jsName) + let functionBaseName = propertyName.prefix(1).lowercased() + propertyName.dropFirst() + return (propertyName: propertyName, functionBaseName: functionBaseName) + } + + let rawFunctionName = + functionName.hasPrefix("`") && functionName.hasSuffix("`") && functionName.count > 2 + ? String(functionName.dropFirst().dropLast()) + : functionName + + guard rawFunctionName.hasPrefix("set"), rawFunctionName.count > 3 else { + return nil + } + + let derivedPropertyName = String(rawFunctionName.dropFirst(3)) + let normalized = normalizeIdentifier(derivedPropertyName) + let propertyName = normalized.prefix(1).lowercased() + normalized.dropFirst() + return (propertyName: propertyName, functionBaseName: propertyName) + } + } + + init(inputFilePath: String, knownJSClassNames: Set) { + self.inputFilePath = inputFilePath + self.jsClassNames = knownJSClassNames + super.init(viewMode: .sourceAccurate) + } + + private func enterJSClass(_ typeName: String) { + stateStack.append(.jsClassBody(name: typeName)) + currentType = CurrentType(name: typeName, constructor: nil, methods: [], getters: [], setters: []) + } + + private func exitJSClass() { + if case .jsClassBody(let typeName) = state, let type = currentType, type.name == typeName { + importedTypes.append( + ImportedTypeSkeleton( + name: type.name, + constructor: type.constructor, + methods: type.methods, + getters: type.getters, + setters: type.setters, + documentation: nil + ) + ) + currentType = nil + } + stateStack.removeLast() + } + + override func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind { + if AttributeChecker.hasJSClassAttribute(node.attributes) { + enterJSClass(node.name.text) + } + return .visitChildren + } + + override func visitPost(_ node: StructDeclSyntax) { + if AttributeChecker.hasJSClassAttribute(node.attributes) { + exitJSClass() + } + } + + override func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind { + if AttributeChecker.hasJSClassAttribute(node.attributes) { + enterJSClass(node.name.text) + } + return .visitChildren + } + + override func visitPost(_ node: ClassDeclSyntax) { + if AttributeChecker.hasJSClassAttribute(node.attributes) { + exitJSClass() + } + } + + // MARK: - Visitor Methods + + override func visit(_ node: ExtensionDeclSyntax) -> SyntaxVisitorContinueKind { + let typeName = node.extendedType.trimmedDescription + collectStaticMembers(in: node.memberBlock.members, typeName: typeName) + return .skipChildren + } + + override func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { + switch state { + case .topLevel: + return handleTopLevelFunction(node) + + case .jsClassBody(let typeName): + guard var type = currentType, type.name == typeName else { + return .skipChildren + } + let isStaticMember = isStatic(node.modifiers) + let handled = handleClassFunction(node, typeName: typeName, isStaticMember: isStaticMember, type: &type) + if handled { + currentType = type + } + return .skipChildren + } + } + + private func handleTopLevelFunction(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { + if AttributeChecker.hasJSFunctionAttribute(node.attributes), + let function = parseFunction(node, enclosingTypeName: nil, isStaticMember: true) + { + importedFunctions.append(function) + return .skipChildren + } + // Top-level setters are not supported + if AttributeChecker.hasJSSetterAttribute(node.attributes) { + errors.append( + DiagnosticError( + node: node, + message: "@JSSetter is not supported at top-level. Use it only in @JSClass types." + ) + ) + return .skipChildren + } + return .visitChildren + } + + private func handleClassFunction( + _ node: FunctionDeclSyntax, + typeName: String, + isStaticMember: Bool, + type: inout CurrentType + ) -> Bool { + if AttributeChecker.hasJSFunctionAttribute(node.attributes) { + if isStaticMember { + parseFunction(node, enclosingTypeName: typeName, isStaticMember: true).map { + importedFunctions.append($0) + } + } else { + parseFunction(node, enclosingTypeName: typeName, isStaticMember: false).map { + type.methods.append($0) + } + } + return true + } + + if AttributeChecker.hasJSSetterAttribute(node.attributes) { + if isStaticMember { + errors.append( + DiagnosticError( + node: node, + message: + "@JSSetter is not supported for static members. Use it only for instance members in @JSClass types." + ) + ) + } else if let jsSetter = AttributeChecker.firstJSSetterAttribute(node.attributes), + let setter = parseSetterSkeleton(jsSetter, node, enclosingTypeName: typeName) + { + type.setters.append(setter) + } + return true + } + + return false + } + + override func visit(_ node: VariableDeclSyntax) -> SyntaxVisitorContinueKind { + guard AttributeChecker.hasJSGetterAttribute(node.attributes) else { + return .visitChildren + } + + switch state { + case .topLevel: + if let getter = parseGetterSkeleton(node, enclosingTypeName: nil) { + importedGlobalGetters.append(getter) + } + return .skipChildren + + case .jsClassBody(let typeName): + guard var type = currentType, type.name == typeName else { + return .skipChildren + } + if isStatic(node.modifiers) { + errors.append( + DiagnosticError( + node: node, + message: + "@JSGetter is not supported for static members. Use it only for instance members in @JSClass types." + ) + ) + } else if let getter = parseGetterSkeleton(node, enclosingTypeName: typeName) { + type.getters.append(getter) + currentType = type + } + return .skipChildren + } + } + + override func visit(_ node: InitializerDeclSyntax) -> SyntaxVisitorContinueKind { + guard AttributeChecker.hasJSFunctionAttribute(node.attributes) else { + return .visitChildren + } + + switch state { + case .topLevel: + return .visitChildren + + case .jsClassBody(let typeName): + guard var type = currentType, type.name == typeName else { + return .skipChildren + } + if type.constructor != nil { + errors.append( + DiagnosticError( + node: node, + message: "Only one @JSFunction initializer is supported in @JSClass types." + ) + ) + return .skipChildren + } + if let parsed = parseConstructor(node, typeName: typeName) { + type.constructor = parsed + currentType = type + } + return .skipChildren + } + } + + // MARK: - Member Collection + + private func collectStaticMembers(in members: MemberBlockItemListSyntax, typeName: String) { + for member in members { + if let function = member.decl.as(FunctionDeclSyntax.self) { + if AttributeChecker.hasJSFunctionAttribute(function.attributes), + let parsed = parseFunction(function, enclosingTypeName: typeName, isStaticMember: true) + { + importedFunctions.append(parsed) + } else if AttributeChecker.hasJSSetterAttribute(function.attributes) { + errors.append( + DiagnosticError( + node: function, + message: + "@JSSetter is not supported for static members. Use it only for instance members in @JSClass types." + ) + ) + } + } else if let variable = member.decl.as(VariableDeclSyntax.self), + AttributeChecker.hasJSGetterAttribute(variable.attributes) + { + errors.append( + DiagnosticError( + node: variable, + message: + "@JSGetter is not supported for static members. Use it only for instance members in @JSClass types." + ) + ) + } + } + } + + // MARK: - Parsing Methods + + private func parseConstructor( + _ initializer: InitializerDeclSyntax, + typeName: String + ) -> ImportedConstructorSkeleton? { + guard + validateEffects(initializer.signature.effectSpecifiers, node: initializer, attributeName: "JSFunction") + != nil + else { + return nil + } + return ImportedConstructorSkeleton( + parameters: parseParameters( + from: initializer.signature.parameterClause, + enclosingTypeName: typeName + ) + ) + } + + private func parseFunction( + _ node: FunctionDeclSyntax, + enclosingTypeName: String?, + isStaticMember: Bool + ) -> ImportedFunctionSkeleton? { + guard validateEffects(node.signature.effectSpecifiers, node: node, attributeName: "JSFunction") != nil + else { + return nil + } + + let baseName = normalizeIdentifier(node.name.text) + let name: String + if isStaticMember, let enclosingTypeName { + name = "\(enclosingTypeName)_\(baseName)" + } else { + name = baseName + } + + let parameters = parseParameters( + from: node.signature.parameterClause, + enclosingTypeName: enclosingTypeName + ) + let returnType: BridgeType + if let returnTypeSyntax = node.signature.returnClause?.type { + returnType = parseType(returnTypeSyntax, enclosingTypeName: enclosingTypeName) + } else { + returnType = .void + } + return ImportedFunctionSkeleton( + name: name, + parameters: parameters, + returnType: returnType, + documentation: nil + ) + } + + /// Extracts property info from a VariableDeclSyntax (binding, identifier, type) + private func extractPropertyInfo( + _ node: VariableDeclSyntax, + errorMessage: String = "@JSGetter must declare a single stored property with an explicit type." + ) -> (identifier: IdentifierPatternSyntax, type: TypeSyntax)? { + guard let binding = node.bindings.first, + let identifier = binding.pattern.as(IdentifierPatternSyntax.self), + let typeAnnotation = binding.typeAnnotation + else { + errors.append(DiagnosticError(node: node, message: errorMessage)) + return nil + } + return (identifier, typeAnnotation.type) + } + + private func parseGetterSkeleton( + _ node: VariableDeclSyntax, + enclosingTypeName: String? + ) -> ImportedGetterSkeleton? { + guard let (identifier, type) = extractPropertyInfo(node) else { + return nil + } + let propertyType = parseType(type, enclosingTypeName: enclosingTypeName) + let propertyName = normalizeIdentifier(identifier.identifier.text) + return ImportedGetterSkeleton( + name: propertyName, + type: propertyType, + documentation: nil, + functionName: nil + ) + } + + /// Parses a setter as part of a type's property system (for instance setters) + private func parseSetterSkeleton( + _ jsSetter: AttributeSyntax, + _ node: FunctionDeclSyntax, + enclosingTypeName: String? + ) -> ImportedSetterSkeleton? { + guard let validation = validateSetter(node, jsSetter: jsSetter, enclosingTypeName: enclosingTypeName) else { + return nil + } + + let functionName = node.name.text + guard + let (propertyName, functionBaseName) = PropertyNameResolver.resolve( + functionName: functionName, + jsName: validation.jsName, + normalizeIdentifier: normalizeIdentifier + ) + else { + return nil + } + + return ImportedSetterSkeleton( + name: propertyName, + type: validation.valueType, + documentation: nil, + functionName: "\(functionBaseName)_set" + ) + } + + // MARK: - Type and Parameter Parsing + + private func parseParameters( + from clause: FunctionParameterClauseSyntax, + enclosingTypeName: String? + ) -> [Parameter] { + clause.parameters.compactMap { param in + let type = param.type + if type.is(MissingTypeSyntax.self) { + errors.append( + DiagnosticError( + node: param, + message: "All @JSFunction parameters must have explicit types." + ) + ) + return nil + } + let nameToken = param.secondName ?? param.firstName + let name = normalizeIdentifier(nameToken.text) + let labelToken = param.secondName == nil ? nil : param.firstName + let label = labelToken?.text == "_" ? nil : labelToken?.text + let bridgeType = parseType(type, enclosingTypeName: enclosingTypeName) + return Parameter(label: label, name: name, type: bridgeType) + } + } + + private func parseType(_ type: TypeSyntax, enclosingTypeName: String?) -> BridgeType { + guard let identifier = type.as(IdentifierTypeSyntax.self) else { + errors.append( + DiagnosticError( + node: type, + message: "Unsupported @JS type '\(type.trimmedDescription)'." + ) + ) + return .void + } + + let name = normalizeIdentifier(identifier.name.text) + if name == "Self", let enclosingTypeName { + return .jsObject(enclosingTypeName) + } + return BridgeType(swiftType: name) ?? .jsObject(name) + } + + // MARK: - Helper Methods + + private func parseEffects(_ effects: FunctionEffectSpecifiersSyntax?) -> Effects? { + let isThrows = effects?.throwsClause != nil + let isAsync = effects?.asyncSpecifier != nil + guard isThrows else { + return nil + } + return Effects(isAsync: isAsync, isThrows: isThrows) + } + + private func isStatic(_ modifiers: DeclModifierListSyntax?) -> Bool { + guard let modifiers else { return false } + return modifiers.contains { modifier in + modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) + } + } + + private func normalizeIdentifier(_ name: String) -> String { + guard name.hasPrefix("`"), name.hasSuffix("`"), name.count >= 2 else { + return name + } + return String(name.dropFirst().dropLast()) + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 10f06802d..97001c5f8 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -548,11 +548,11 @@ public struct ExportedProperty: Codable, Equatable, Sendable { } public struct ExportedSkeleton: Codable { - public let functions: [ExportedFunction] - public let classes: [ExportedClass] - public let enums: [ExportedEnum] - public let structs: [ExportedStruct] - public let protocols: [ExportedProtocol] + public var functions: [ExportedFunction] + public var classes: [ExportedClass] + public var enums: [ExportedEnum] + public var structs: [ExportedStruct] + public var protocols: [ExportedProtocol] /// Whether to expose exported APIs to the global namespace. /// /// When `true`, exported functions, classes, and namespaces are available @@ -575,6 +575,15 @@ public struct ExportedSkeleton: Codable { self.protocols = protocols self.exposeToGlobal = exposeToGlobal } + + public mutating func append(_ other: ExportedSkeleton) { + self.functions.append(contentsOf: other.functions) + self.classes.append(contentsOf: other.classes) + self.enums.append(contentsOf: other.enums) + self.structs.append(contentsOf: other.structs) + self.protocols.append(contentsOf: other.protocols) + assert(self.exposeToGlobal == other.exposeToGlobal) + } } // MARK: - Imported Skeleton diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index eb6927852..f75c7b758 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -125,13 +125,11 @@ import BridgeJSUtilities } let inputFiles = inputSwiftFiles(targetDirectory: targetDirectory, positionalArguments: positionalArguments) - let exporter = ExportSwift( + let swiftToSkeleton = SwiftToSkeleton( progress: progress, moduleName: moduleName, exposeToGlobal: config.exposeToGlobal ) - let importSwift = ImportSwiftMacros(progress: progress, moduleName: moduleName) - for inputFile in inputFiles.sorted() { let content = try String(contentsOf: URL(fileURLWithPath: inputFile), encoding: .utf8) if hasBridgeJSSkipComment(content) { @@ -139,17 +137,30 @@ import BridgeJSUtilities } let sourceFile = Parser.parse(source: content) - try exporter.addSourceFile(sourceFile, inputFile) - importSwift.addSourceFile(sourceFile, inputFile) + swiftToSkeleton.addSourceFile(sourceFile, inputFilePath: inputFile) } - let importResult = try importSwift.finalize() - let exportResult = try exporter.finalize() - let importSkeleton = importResult.outputSkeleton + let skeleton = try swiftToSkeleton.finalize() + + var exporter: ExportSwift? + if let skeleton = skeleton.exported { + exporter = ExportSwift( + progress: progress, + moduleName: moduleName, + skeleton: skeleton + ) + } + var importer: ImportTS? + if let skeleton = skeleton.imported { + importer = ImportTS(progress: progress, moduleName: moduleName, skeleton: skeleton) + } + + let importResult = try importer?.finalize() + let exportResult = try exporter?.finalize() // Combine and write unified Swift output let outputSwiftURL = outputDirectory.appending(path: "BridgeJS.swift") - let combinedSwift = [exportResult?.outputSwift, importResult.outputSwift].compactMap { $0 } + let combinedSwift = [exportResult, importResult].compactMap { $0 } let outputSwift = combineGeneratedSwift(combinedSwift) let shouldWrite = doubleDashOptions["always-write"] == "true" || !outputSwift.isEmpty if shouldWrite { @@ -163,11 +174,6 @@ import BridgeJSUtilities // Write unified skeleton let outputSkeletonURL = outputDirectory.appending(path: "JavaScript/BridgeJS.json") - let unifiedSkeleton = BridgeJSSkeleton( - moduleName: moduleName, - exported: exportResult?.outputSkeleton, - imported: importSkeleton - ) try FileManager.default.createDirectory( at: outputSkeletonURL.deletingLastPathComponent(), withIntermediateDirectories: true, @@ -175,10 +181,10 @@ import BridgeJSUtilities ) let encoder = JSONEncoder() encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - let skeletonData = try encoder.encode(unifiedSkeleton) + let skeletonData = try encoder.encode(skeleton) try skeletonData.write(to: outputSkeletonURL) - if exportResult != nil || importResult.outputSwift != nil { + if skeleton.exported != nil || skeleton.imported != nil { progress.print("Generated BridgeJS code") } case "export", "import": diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift index 4cb46124d..16de8617e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift @@ -57,15 +57,13 @@ import Testing func snapshotExport(input: String) throws { let url = Self.inputsDirectory.appendingPathComponent(input) let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) - let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) - try swiftAPI.addSourceFile(sourceFile, input) + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + swiftAPI.addSourceFile(sourceFile, inputFilePath: input) let name = url.deletingPathExtension().lastPathComponent - let (_, outputSkeleton) = try #require(try swiftAPI.finalize()) + let outputSkeleton = try swiftAPI.finalize() let bridgeJSLink: BridgeJSLink = BridgeJSLink( - skeletons: [ - BridgeJSSkeleton(moduleName: "TestModule", exported: outputSkeleton) - ], + skeletons: [outputSkeleton], sharedMemory: false ) try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Export") @@ -86,27 +84,13 @@ import Testing ) let sourceFile = Parser.parse(source: swiftSource) - let importSwift = ImportSwiftMacros(progress: .silent, moduleName: "TestModule") - importSwift.addSourceFile(sourceFile, "\(name).Macros.swift") - let importResult = try importSwift.finalize() - - var importTS = ImportTS(progress: .silent, moduleName: "TestModule") - for child in importResult.outputSkeleton.children { - importTS.addSkeleton(child) - } - let importSkeleton = importTS.skeleton - - var bridgeJSLink = BridgeJSLink(sharedMemory: false) - // Create unified skeleton for test - let unifiedSkeleton = BridgeJSSkeleton( - moduleName: "TestModule", - exported: nil, - imported: importSkeleton + let importSwift = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + importSwift.addSourceFile(sourceFile, inputFilePath: "\(name).Macros.swift") + let skeleton = try importSwift.finalize() + let bridgeJSLink = BridgeJSLink( + skeletons: [skeleton], + sharedMemory: false ) - let encoder = JSONEncoder() - encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - let unifiedData = try encoder.encode(unifiedSkeleton) - try bridgeJSLink.addSkeletonFile(data: unifiedData) try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Import") } @@ -116,25 +100,13 @@ import Testing let name = url.deletingPathExtension().lastPathComponent let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) - let importSwift = ImportSwiftMacros(progress: .silent, moduleName: "TestModule") - importSwift.addSourceFile(sourceFile, "\(name).swift") + let importSwift = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + importSwift.addSourceFile(sourceFile, inputFilePath: "\(name).swift") let importResult = try importSwift.finalize() - - var importTS = ImportTS(progress: .silent, moduleName: "TestModule") - for child in importResult.outputSkeleton.children { - importTS.addSkeleton(child) - } - let importSkeleton = importTS.skeleton - var bridgeJSLink = BridgeJSLink(sharedMemory: false) - let unifiedSkeleton = BridgeJSSkeleton( - moduleName: "TestModule", - exported: nil, - imported: importSkeleton - ) let encoder = JSONEncoder() encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - let unifiedData = try encoder.encode(unifiedSkeleton) + let unifiedData = try encoder.encode(importResult) try bridgeJSLink.addSkeletonFile(data: unifiedData) try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".ImportMacros") } @@ -148,13 +120,13 @@ import Testing func snapshotExportWithGlobal(inputFile: String) throws { let url = Self.inputsDirectory.appendingPathComponent(inputFile) let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) - let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: true) - try swiftAPI.addSourceFile(sourceFile, inputFile) + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: true) + swiftAPI.addSourceFile(sourceFile, inputFilePath: inputFile) let name = url.deletingPathExtension().lastPathComponent - let (_, outputSkeleton) = try #require(try swiftAPI.finalize()) + let outputSkeleton = try swiftAPI.finalize() let bridgeJSLink: BridgeJSLink = BridgeJSLink( skeletons: [ - BridgeJSSkeleton(moduleName: "TestModule", exported: outputSkeleton) + outputSkeleton ], sharedMemory: false ) @@ -165,20 +137,20 @@ import Testing func snapshotMixedModuleExposure() throws { let globalURL = Self.inputsDirectory.appendingPathComponent("MixedGlobal.swift") let globalSourceFile = Parser.parse(source: try String(contentsOf: globalURL, encoding: .utf8)) - let globalAPI = ExportSwift(progress: .silent, moduleName: "GlobalModule", exposeToGlobal: true) - try globalAPI.addSourceFile(globalSourceFile, "MixedGlobal.swift") - let (_, globalSkeleton) = try #require(try globalAPI.finalize()) + let globalAPI = SwiftToSkeleton(progress: .silent, moduleName: "GlobalModule", exposeToGlobal: true) + globalAPI.addSourceFile(globalSourceFile, inputFilePath: "MixedGlobal.swift") + let globalSkeleton = try globalAPI.finalize() let privateURL = Self.inputsDirectory.appendingPathComponent("MixedPrivate.swift") let privateSourceFile = Parser.parse(source: try String(contentsOf: privateURL, encoding: .utf8)) - let privateAPI = ExportSwift(progress: .silent, moduleName: "PrivateModule", exposeToGlobal: false) - try privateAPI.addSourceFile(privateSourceFile, "MixedPrivate.swift") - let (_, privateSkeleton) = try #require(try privateAPI.finalize()) + let privateAPI = SwiftToSkeleton(progress: .silent, moduleName: "PrivateModule", exposeToGlobal: false) + privateAPI.addSourceFile(privateSourceFile, inputFilePath: "MixedPrivate.swift") + let privateSkeleton = try privateAPI.finalize() let bridgeJSLink = BridgeJSLink( skeletons: [ - BridgeJSSkeleton(moduleName: "GlobalModule", exported: globalSkeleton), - BridgeJSSkeleton(moduleName: "PrivateModule", exported: privateSkeleton), + globalSkeleton, + privateSkeleton, ], sharedMemory: false ) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift index 41e118315..fd86a2ad7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift @@ -4,16 +4,19 @@ import SwiftParser import Testing @testable import BridgeJSCore +@testable import BridgeJSSkeleton @Suite struct ExportSwiftTests { private func snapshot( - swiftAPI: ExportSwift, + skeleton: BridgeJSSkeleton, name: String? = nil, filePath: String = #filePath, function: String = #function, sourceLocation: Testing.SourceLocation = #_sourceLocation ) throws { - let (outputSwift, outputSkeleton) = try #require(try swiftAPI.finalize()) + guard let exported = skeleton.exported else { return } + let exportSwift = ExportSwift(progress: .silent, moduleName: skeleton.moduleName, skeleton: exported) + let outputSwift = try #require(try exportSwift.finalize()) try assertSnapshot( name: name, filePath: filePath, @@ -24,7 +27,7 @@ import Testing ) let encoder = JSONEncoder() encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - let outputSkeletonData = try encoder.encode(outputSkeleton) + let outputSkeletonData = try encoder.encode(exported) try assertSnapshot( name: name, filePath: filePath, @@ -52,12 +55,12 @@ import Testing @Test(arguments: collectInputs()) func snapshot(input: String) throws { - let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) let url = Self.inputsDirectory.appendingPathComponent(input) let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) - try swiftAPI.addSourceFile(sourceFile, input) + swiftAPI.addSourceFile(sourceFile, inputFilePath: input) let name = url.deletingPathExtension().lastPathComponent - try snapshot(swiftAPI: swiftAPI, name: name) + try snapshot(skeleton: swiftAPI.finalize(), name: name) } @Test(arguments: [ @@ -67,80 +70,80 @@ import Testing "EnumNamespace.swift", ]) func snapshotWithGlobal(input: String) throws { - let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: true) + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: true) let url = Self.inputsDirectory.appendingPathComponent(input) let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) - try swiftAPI.addSourceFile(sourceFile, input) + swiftAPI.addSourceFile(sourceFile, inputFilePath: input) let name = url.deletingPathExtension().lastPathComponent - try snapshot(swiftAPI: swiftAPI, name: name + ".Global") + try snapshot(skeleton: swiftAPI.finalize(), name: name + ".Global") } @Test func snapshotCrossFileTypeResolution() throws { // Test that types defined in one file can be referenced from another file // This tests the fix for cross-file type resolution in BridgeJS - let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) // Add ClassB first, then ClassA (which references ClassB) let classBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassB.swift") let classBSourceFile = Parser.parse(source: try String(contentsOf: classBURL, encoding: .utf8)) - try swiftAPI.addSourceFile(classBSourceFile, "CrossFileClassB.swift") + swiftAPI.addSourceFile(classBSourceFile, inputFilePath: "CrossFileClassB.swift") let classAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassA.swift") let classASourceFile = Parser.parse(source: try String(contentsOf: classAURL, encoding: .utf8)) - try swiftAPI.addSourceFile(classASourceFile, "CrossFileClassA.swift") + swiftAPI.addSourceFile(classASourceFile, inputFilePath: "CrossFileClassA.swift") - try snapshot(swiftAPI: swiftAPI, name: "CrossFileTypeResolution") + try snapshot(skeleton: swiftAPI.finalize(), name: "CrossFileTypeResolution") } @Test func snapshotCrossFileTypeResolutionReverseOrder() throws { // Test that types can be resolved regardless of the order files are added // Add ClassA first (which references ClassB), then ClassB - let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) let classAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassA.swift") let classASourceFile = Parser.parse(source: try String(contentsOf: classAURL, encoding: .utf8)) - try swiftAPI.addSourceFile(classASourceFile, "CrossFileClassA.swift") + swiftAPI.addSourceFile(classASourceFile, inputFilePath: "CrossFileClassA.swift") let classBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassB.swift") let classBSourceFile = Parser.parse(source: try String(contentsOf: classBURL, encoding: .utf8)) - try swiftAPI.addSourceFile(classBSourceFile, "CrossFileClassB.swift") + swiftAPI.addSourceFile(classBSourceFile, inputFilePath: "CrossFileClassB.swift") - try snapshot(swiftAPI: swiftAPI, name: "CrossFileTypeResolution.ReverseOrder") + try snapshot(skeleton: swiftAPI.finalize(), name: "CrossFileTypeResolution.ReverseOrder") } @Test func snapshotCrossFileFunctionTypes() throws { // Test that functions and methods can use cross-file types as parameters and return types - let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) // Add FunctionB first, then FunctionA (which references FunctionB in methods and functions) let functionBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionB.swift") let functionBSourceFile = Parser.parse(source: try String(contentsOf: functionBURL, encoding: .utf8)) - try swiftAPI.addSourceFile(functionBSourceFile, "CrossFileFunctionB.swift") + swiftAPI.addSourceFile(functionBSourceFile, inputFilePath: "CrossFileFunctionB.swift") let functionAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionA.swift") let functionASourceFile = Parser.parse(source: try String(contentsOf: functionAURL, encoding: .utf8)) - try swiftAPI.addSourceFile(functionASourceFile, "CrossFileFunctionA.swift") + swiftAPI.addSourceFile(functionASourceFile, inputFilePath: "CrossFileFunctionA.swift") - try snapshot(swiftAPI: swiftAPI, name: "CrossFileFunctionTypes") + try snapshot(skeleton: swiftAPI.finalize(), name: "CrossFileFunctionTypes") } @Test func snapshotCrossFileFunctionTypesReverseOrder() throws { // Test that function types can be resolved regardless of the order files are added - let swiftAPI = ExportSwift(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) // Add FunctionA first (which references FunctionB), then FunctionB let functionAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionA.swift") let functionASourceFile = Parser.parse(source: try String(contentsOf: functionAURL, encoding: .utf8)) - try swiftAPI.addSourceFile(functionASourceFile, "CrossFileFunctionA.swift") + swiftAPI.addSourceFile(functionASourceFile, inputFilePath: "CrossFileFunctionA.swift") let functionBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionB.swift") let functionBSourceFile = Parser.parse(source: try String(contentsOf: functionBURL, encoding: .utf8)) - try swiftAPI.addSourceFile(functionBSourceFile, "CrossFileFunctionB.swift") + swiftAPI.addSourceFile(functionBSourceFile, inputFilePath: "CrossFileFunctionB.swift") - try snapshot(swiftAPI: swiftAPI, name: "CrossFileFunctionTypes.ReverseOrder") + try snapshot(skeleton: swiftAPI.finalize(), name: "CrossFileFunctionTypes.ReverseOrder") } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift index 0a3101f11..158e4511e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift @@ -37,11 +37,14 @@ import SwiftParser ) let sourceFile = Parser.parse(source: swiftSource) - let importSwift = ImportSwiftMacros(progress: .silent, moduleName: "Check") - importSwift.addSourceFile(sourceFile, "\(name).Macros.swift") - let importResult = try importSwift.finalize() + let importSwift = SwiftToSkeleton(progress: .silent, moduleName: "Check", exposeToGlobal: false) + importSwift.addSourceFile(sourceFile, inputFilePath: "\(name).Macros.swift") + let skeleton = try importSwift.finalize() - let outputSwift = try #require(importResult.outputSwift) + guard let imported = skeleton.imported else { return } + + let importTS = ImportTS(progress: .silent, moduleName: "Check", skeleton: imported) + let outputSwift = try #require(try importTS.finalize()) try assertSnapshot( name: name, filePath: #filePath, diff --git a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json index 3e7f4a6dd..8b91ea964 100644 --- a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json @@ -538,17 +538,5 @@ ] }, - "imported" : { - "children" : [ - { - "functions" : [ - - ], - "types" : [ - - ] - } - ] - }, "moduleName" : "BridgeJSGlobalTests" } \ No newline at end of file From 237223550f795da4edaeca64bbe06d83e7adc2be Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 26 Jan 2026 13:54:53 +0800 Subject: [PATCH 085/252] PackageToJS: Rename SWIFT_PATH to SWIFT_BIN_PATH env var (#518) Utilities/format.swift now looks up `SWIFT_PATH` for the "swift" command location, but PackageToJS's test suites also use this env var to locate the Swift toolchain bin path. To avoid confusion, rename the env var in PackageToJS from `SWIFT_PATH` to `SWIFT_BIN_PATH`. --- .github/workflows/test.yml | 2 +- Plugins/PackageToJS/README.md | 2 +- Plugins/PackageToJS/Tests/ExampleTests.swift | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5d7e40337..4f1eb0a5b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,7 +46,7 @@ jobs: - name: Configure environment variables run: | echo "SWIFT_SDK_ID=${{ steps.setup-swiftwasm.outputs.swift-sdk-id }}" >> $GITHUB_ENV - echo "SWIFT_PATH=$(dirname $(which swiftc))" >> $GITHUB_ENV + echo "SWIFT_BIN_PATH=$(dirname $(which swiftc))" >> $GITHUB_ENV - run: make bootstrap - run: make unittest # Skip unit tests with uwasi because its proc_exit throws diff --git a/Plugins/PackageToJS/README.md b/Plugins/PackageToJS/README.md index 8b1821187..cbcaf19c5 100644 --- a/Plugins/PackageToJS/README.md +++ b/Plugins/PackageToJS/README.md @@ -41,5 +41,5 @@ swift test --package-path ./Plugins/PackageToJS Please define the following environment variables when you want to run E2E tests: - `SWIFT_SDK_ID`: Specifies the Swift SDK identifier to use -- `SWIFT_PATH`: Specifies the `bin` path to the Swift toolchain to use +- `SWIFT_BIN_PATH`: Specifies the `bin` path to the Swift toolchain to use diff --git a/Plugins/PackageToJS/Tests/ExampleTests.swift b/Plugins/PackageToJS/Tests/ExampleTests.swift index 01c02c193..d26832771 100644 --- a/Plugins/PackageToJS/Tests/ExampleTests.swift +++ b/Plugins/PackageToJS/Tests/ExampleTests.swift @@ -7,8 +7,8 @@ extension Trait where Self == ConditionTrait { static var requireSwiftSDK: ConditionTrait { .enabled( if: ProcessInfo.processInfo.environment["SWIFT_SDK_ID"] != nil - && ProcessInfo.processInfo.environment["SWIFT_PATH"] != nil, - "Requires SWIFT_SDK_ID and SWIFT_PATH environment variables" + && ProcessInfo.processInfo.environment["SWIFT_BIN_PATH"] != nil, + "Requires SWIFT_SDK_ID and SWIFT_BIN_PATH environment variables" ) } @@ -16,7 +16,7 @@ extension Trait where Self == ConditionTrait { .enabled( if: { guard let swiftSDKID = ProcessInfo.processInfo.environment["SWIFT_SDK_ID"], - ProcessInfo.processInfo.environment["SWIFT_PATH"] != nil + ProcessInfo.processInfo.environment["SWIFT_BIN_PATH"] != nil else { return false } @@ -32,22 +32,22 @@ extension Trait where Self == ConditionTrait { } return sanityCheckCompatibility(triple: triple) }(), - "Requires SWIFT_SDK_ID and SWIFT_PATH environment variables" + "Requires SWIFT_SDK_ID and SWIFT_BIN_PATH environment variables" ) } static func requireEmbeddedSwiftInToolchain(triple: String) -> ConditionTrait { - // Check if $SWIFT_PATH/../lib/swift/embedded/wasm32-unknown-none-wasm/ exists + // Check if $SWIFT_BIN_PATH/../lib/swift/embedded/wasm32-unknown-none-wasm/ exists return .enabled( if: { - guard let swiftPath = ProcessInfo.processInfo.environment["SWIFT_PATH"] else { + guard let swiftPath = ProcessInfo.processInfo.environment["SWIFT_BIN_PATH"] else { return false } let embeddedPath = URL(fileURLWithPath: swiftPath).deletingLastPathComponent() .appending(path: "lib/swift/embedded/\(triple)") return FileManager.default.fileExists(atPath: embeddedPath.path) }(), - "Requires embedded Swift SDK under $SWIFT_PATH/../lib/swift/embedded" + "Requires embedded Swift SDK under $SWIFT_BIN_PATH/../lib/swift/embedded" ) } @@ -75,7 +75,7 @@ extension Trait where Self == ConditionTrait { return false } } - guard let swiftPath = ProcessInfo.processInfo.environment["SWIFT_PATH"], + guard let swiftPath = ProcessInfo.processInfo.environment["SWIFT_BIN_PATH"], let swiftSDKID = ProcessInfo.processInfo.environment["SWIFT_SDK_ID"] else { return false @@ -102,7 +102,7 @@ extension Trait where Self == ConditionTrait { } static func getSwiftPath() -> String? { - ProcessInfo.processInfo.environment["SWIFT_PATH"] + ProcessInfo.processInfo.environment["SWIFT_BIN_PATH"] } static func getEmbeddedSwiftSDKID() -> String? { From bcbeea08f302ed7e785e84894fcb2fd985ae6b5a Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 26 Jan 2026 13:59:23 +0800 Subject: [PATCH 086/252] BridgeJS: Unify Swift type lookup logic between import/export (#517) * BridgeJS: Unify Swift type lookup logic between import/export * BridgeJS: Index known JS types for type lookup --- .../Sources/BridgeJSCore/ExportSwift.swift | 23 -- .../BridgeJSCore/SwiftToSkeleton.swift | 228 +++++++++--------- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 22 ++ 3 files changed, 137 insertions(+), 136 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 18d529d3e..b8790ec97 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1674,29 +1674,6 @@ struct ProtocolCodegen { } } -extension BridgeType { - init?(swiftType: String) { - switch swiftType { - case "Int": - self = .int - case "Float": - self = .float - case "Double": - self = .double - case "String": - self = .string - case "Bool": - self = .bool - case "Void": - self = .void - case "JSObject": - self = .jsObject(nil) - default: - return nil - } - } -} - extension WasmCoreType { var swiftType: String { switch self { diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index 71132568b..6628a3043 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -25,6 +25,13 @@ public final class SwiftToSkeleton { self.moduleName = moduleName self.exposeToGlobal = exposeToGlobal self.typeDeclResolver = TypeDeclResolver() + + // Index known types provided by JavaScriptKit + self.typeDeclResolver.addSourceFile( + """ + @JSClass struct JSPromise {} + """ + ) } public func addSourceFile(_ sourceFile: SourceFileSyntax, inputFilePath: String) { @@ -47,13 +54,15 @@ public final class SwiftToSkeleton { typeNameCollector.walk(sourceFile) let importCollector = ImportSwiftMacrosAPICollector( inputFilePath: inputFilePath, - knownJSClassNames: typeNameCollector.typeNames + knownJSClassNames: typeNameCollector.typeNames, + parent: self ) importCollector.walk(sourceFile) - if !exportCollector.errors.isEmpty || !importCollector.errors.isEmpty { + let importErrorsFatal = importCollector.errors.filter { !$0.message.contains("Unsupported type '") } + if !exportCollector.errors.isEmpty || !importErrorsFatal.isEmpty { perSourceErrors.append( - (inputFilePath: inputFilePath, errors: exportCollector.errors + importCollector.errors) + (inputFilePath: inputFilePath, errors: exportCollector.errors + importErrorsFatal) ) } @@ -84,22 +93,22 @@ public final class SwiftToSkeleton { return BridgeJSSkeleton(moduleName: moduleName, exported: exported, imported: importedSkeleton) } - func lookupType(for type: TypeSyntax) -> BridgeType? { + func lookupType(for type: TypeSyntax, errors: inout [DiagnosticError]) -> BridgeType? { if let attributedType = type.as(AttributedTypeSyntax.self) { - return lookupType(for: attributedType.baseType) + return lookupType(for: attributedType.baseType, errors: &errors) } // (T1, T2, ...) -> R if let functionType = type.as(FunctionTypeSyntax.self) { var parameters: [BridgeType] = [] for param in functionType.parameters { - guard let paramType = lookupType(for: param.type) else { + guard let paramType = lookupType(for: param.type, errors: &errors) else { return nil } parameters.append(paramType) } - guard let returnType = lookupType(for: functionType.returnClause.type) else { + guard let returnType = lookupType(for: functionType.returnClause.type, errors: &errors) else { return nil } @@ -120,7 +129,7 @@ public final class SwiftToSkeleton { // T? if let optionalType = type.as(OptionalTypeSyntax.self) { let wrappedType = optionalType.wrappedType - if let baseType = lookupType(for: wrappedType) { + if let baseType = lookupType(for: wrappedType, errors: &errors) { return .optional(baseType) } } @@ -131,7 +140,7 @@ public final class SwiftToSkeleton { genericArgs.count == 1, let argType = TypeSyntax(genericArgs.first?.argument) { - if let baseType = lookupType(for: argType) { + if let baseType = lookupType(for: argType, errors: &errors) { return .optional(baseType) } } @@ -144,22 +153,34 @@ public final class SwiftToSkeleton { genericArgs.count == 1, let argType = TypeSyntax(genericArgs.first?.argument) { - if let wrappedType = lookupType(for: argType) { + if let wrappedType = lookupType(for: argType, errors: &errors) { return .optional(wrappedType) } } if let aliasDecl = typeDeclResolver.resolveTypeAlias(type) { - if let resolvedType = lookupType(for: aliasDecl.initializer.value) { + if let resolvedType = lookupType(for: aliasDecl.initializer.value, errors: &errors) { return resolvedType } } - let typeName = type.trimmedDescription + let typeName: String + if let identifier = type.as(IdentifierTypeSyntax.self) { + typeName = Self.normalizeIdentifier(identifier.name.text) + } else { + typeName = type.trimmedDescription + } if let primitiveType = BridgeType(swiftType: typeName) { return primitiveType } guard let typeDecl = typeDeclResolver.resolve(type) else { + errors.append( + DiagnosticError( + node: type, + message: "Unsupported type '\(type.trimmedDescription)'.", + hint: "Only primitive types and types defined in the same module are allowed" + ) + ) return nil } @@ -204,6 +225,9 @@ public final class SwiftToSkeleton { if let structDecl = typeDecl.as(StructDeclSyntax.self) { let swiftCallName = SwiftToSkeleton.computeSwiftCallName(for: structDecl, itemName: structDecl.name.text) + if structDecl.attributes.hasAttribute(name: "JSClass") { + return .jsObject(swiftCallName) + } return .swiftStruct(swiftCallName) } @@ -236,6 +260,14 @@ public final class SwiftToSkeleton { } } + /// Strips surrounding backticks from an identifier (e.g. "`Foo`" -> "Foo"). + static func normalizeIdentifier(_ name: String) -> String { + guard name.hasPrefix("`"), name.hasSuffix("`"), name.count >= 2 else { + return name + } + return String(name.dropFirst().dropLast()) + } + } private enum ExportSwiftConstants { @@ -252,6 +284,14 @@ extension AttributeListSyntax { $0.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JS" })?.as(AttributeSyntax.self) } + + /// Returns true if any attribute has the given name (e.g. "JSClass"). + func hasAttribute(name: String) -> Bool { + contains { attribute in + guard let syntax = attribute.as(AttributeSyntax.self) else { return false } + return syntax.attributeName.trimmedDescription == name + } + } } private final class ExportSwiftAPICollector: SyntaxAnyVisitor { @@ -356,12 +396,10 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { errors.append(DiagnosticError(node: node, message: message, hint: hint)) } - private func diagnoseUnsupportedType(node: some SyntaxProtocol, type: String) { - diagnose( - node: node, - message: "Unsupported type: \(type)", - hint: "Only primitive types and types defined in the same module are allowed" - ) + private func withLookupErrors(_ body: (inout [DiagnosticError]) -> T) -> T { + var errs = self.errors + defer { self.errors = errs } + return body(&errs) } private func diagnoseNestedOptional(node: some SyntaxProtocol, type: String) { @@ -641,8 +679,11 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { var parameters: [Parameter] = [] for param in parameterClause.parameters { - let resolvedType = self.parent.lookupType(for: param.type) - if let type = resolvedType, case .closure(let signature) = type { + let resolvedType = withLookupErrors { self.parent.lookupType(for: param.type, errors: &$0) } + guard let type = resolvedType else { + continue // Skip unsupported types + } + if case .closure(let signature) = type { if signature.isAsync { diagnose( node: param.type, @@ -658,20 +699,15 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { continue } } - if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { + if case .optional(let wrappedType) = type, wrappedType.isOptional { diagnoseNestedOptional(node: param.type, type: param.type.trimmedDescription) continue } - if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { + if case .optional(let wrappedType) = type, wrappedType.isOptional { diagnoseNestedOptional(node: param.type, type: param.type.trimmedDescription) continue } - guard let type = resolvedType else { - diagnoseUnsupportedType(node: param.type, type: param.type.trimmedDescription) - continue - } - let name = param.secondName?.text ?? param.firstName.text let label = param.firstName.text @@ -787,17 +823,14 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { let parameters = parseParameters(from: node.signature.parameterClause, allowDefaults: true) let returnType: BridgeType if let returnClause = node.signature.returnClause { - let resolvedType = self.parent.lookupType(for: returnClause.type) + let resolvedType = withLookupErrors { self.parent.lookupType(for: returnClause.type, errors: &$0) } if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { diagnoseNestedOptional(node: returnClause.type, type: returnClause.type.trimmedDescription) return nil } - guard let type = resolvedType else { - diagnoseUnsupportedType(node: returnClause.type, type: returnClause.type.trimmedDescription) - return nil - } + guard let type = resolvedType else { return nil } returnType = type } else { returnType = .void @@ -1048,8 +1081,8 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { continue } - guard let propertyType = self.parent.lookupType(for: typeAnnotation.type) else { - diagnoseUnsupportedType(node: typeAnnotation.type, type: typeAnnotation.type.trimmedDescription) + guard let propertyType = withLookupErrors({ self.parent.lookupType(for: typeAnnotation.type, errors: &$0) }) + else { continue } @@ -1357,11 +1390,11 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { continue } - guard let fieldType = self.parent.lookupType(for: typeAnnotation.type) else { - diagnoseUnsupportedType( - node: typeAnnotation.type, - type: typeAnnotation.type.trimmedDescription - ) + guard + let fieldType = withLookupErrors({ + self.parent.lookupType(for: typeAnnotation.type, errors: &$0) + }) + else { continue } @@ -1413,17 +1446,14 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { let returnType: BridgeType if let returnClause = node.signature.returnClause { - let resolvedType = self.parent.lookupType(for: returnClause.type) + let resolvedType = withLookupErrors { self.parent.lookupType(for: returnClause.type, errors: &$0) } if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { diagnoseNestedOptional(node: returnClause.type, type: returnClause.type.trimmedDescription) return nil } - guard let type = resolvedType else { - diagnoseUnsupportedType(node: returnClause.type, type: returnClause.type.trimmedDescription) - return nil - } + guard let type = resolvedType else { return nil } returnType = type } else { returnType = .void @@ -1468,8 +1498,8 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { continue } - guard let propertyType = self.parent.lookupType(for: typeAnnotation.type) else { - diagnoseUnsupportedType(node: typeAnnotation.type, type: typeAnnotation.type.trimmedDescription) + guard let propertyType = withLookupErrors({ self.parent.lookupType(for: typeAnnotation.type, errors: &$0) }) + else { continue } @@ -1565,12 +1595,7 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { } if let parameterClause = element.parameterClause { for param in parameterClause.parameters { - guard let bridgeType = parent.lookupType(for: param.type) else { - diagnose( - node: param.type, - message: "Unsupported associated value type: \(param.type.trimmedDescription)", - hint: "Only primitive types and types defined in the same module are allowed" - ) + guard let bridgeType = withLookupErrors({ parent.lookupType(for: param.type, errors: &$0) }) else { continue } @@ -1691,6 +1716,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { private let inputFilePath: String private var jsClassNames: Set + private let parent: SwiftToSkeleton // MARK: - State Management @@ -1804,11 +1830,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } /// Validates a setter function and extracts common information - private func validateSetter( - _ node: FunctionDeclSyntax, - jsSetter: AttributeSyntax, - enclosingTypeName: String? - ) -> SetterValidationResult? { + private func validateSetter(_ node: FunctionDeclSyntax, jsSetter: AttributeSyntax) -> SetterValidationResult? { guard let effects = validateEffects(node.signature.effectSpecifiers, node: node, attributeName: "JSSetter") else { return nil @@ -1837,11 +1859,15 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { return nil } + guard let valueType = withLookupErrors({ parent.lookupType(for: firstParam.type, errors: &$0) }) else { + return nil + } + return SetterValidationResult( effects: effects, jsName: jsName, firstParam: firstParam, - valueType: parseType(firstParam.type, enclosingTypeName: enclosingTypeName) + valueType: valueType ) } @@ -1879,12 +1905,19 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } } - init(inputFilePath: String, knownJSClassNames: Set) { + init(inputFilePath: String, knownJSClassNames: Set, parent: SwiftToSkeleton) { self.inputFilePath = inputFilePath self.jsClassNames = knownJSClassNames + self.parent = parent super.init(viewMode: .sourceAccurate) } + private func withLookupErrors(_ body: (inout [DiagnosticError]) -> T) -> T { + var errs = self.errors + defer { self.errors = errs } + return body(&errs) + } + private func enterJSClass(_ typeName: String) { stateStack.append(.jsClassBody(name: typeName)) currentType = CurrentType(name: typeName, constructor: nil, methods: [], getters: [], setters: []) @@ -2008,7 +2041,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { ) ) } else if let jsSetter = AttributeChecker.firstJSSetterAttribute(node.attributes), - let setter = parseSetterSkeleton(jsSetter, node, enclosingTypeName: typeName) + let setter = parseSetterSkeleton(jsSetter, node) { type.setters.append(setter) } @@ -2025,7 +2058,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { switch state { case .topLevel: - if let getter = parseGetterSkeleton(node, enclosingTypeName: nil) { + if let getter = parseGetterSkeleton(node) { importedGlobalGetters.append(getter) } return .skipChildren @@ -2042,7 +2075,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { "@JSGetter is not supported for static members. Use it only for instance members in @JSClass types." ) ) - } else if let getter = parseGetterSkeleton(node, enclosingTypeName: typeName) { + } else if let getter = parseGetterSkeleton(node) { type.getters.append(getter) currentType = type } @@ -2125,10 +2158,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { return nil } return ImportedConstructorSkeleton( - parameters: parseParameters( - from: initializer.signature.parameterClause, - enclosingTypeName: typeName - ) + parameters: parseParameters(from: initializer.signature.parameterClause) ) } @@ -2142,7 +2172,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { return nil } - let baseName = normalizeIdentifier(node.name.text) + let baseName = SwiftToSkeleton.normalizeIdentifier(node.name.text) let name: String if isStaticMember, let enclosingTypeName { name = "\(enclosingTypeName)_\(baseName)" @@ -2150,13 +2180,13 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { name = baseName } - let parameters = parseParameters( - from: node.signature.parameterClause, - enclosingTypeName: enclosingTypeName - ) + let parameters = parseParameters(from: node.signature.parameterClause) let returnType: BridgeType if let returnTypeSyntax = node.signature.returnClause?.type { - returnType = parseType(returnTypeSyntax, enclosingTypeName: enclosingTypeName) + guard let resolved = withLookupErrors({ parent.lookupType(for: returnTypeSyntax, errors: &$0) }) else { + return nil + } + returnType = resolved } else { returnType = .void } @@ -2183,15 +2213,14 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { return (identifier, typeAnnotation.type) } - private func parseGetterSkeleton( - _ node: VariableDeclSyntax, - enclosingTypeName: String? - ) -> ImportedGetterSkeleton? { + private func parseGetterSkeleton(_ node: VariableDeclSyntax) -> ImportedGetterSkeleton? { guard let (identifier, type) = extractPropertyInfo(node) else { return nil } - let propertyType = parseType(type, enclosingTypeName: enclosingTypeName) - let propertyName = normalizeIdentifier(identifier.identifier.text) + guard let propertyType = withLookupErrors({ parent.lookupType(for: type, errors: &$0) }) else { + return nil + } + let propertyName = SwiftToSkeleton.normalizeIdentifier(identifier.identifier.text) return ImportedGetterSkeleton( name: propertyName, type: propertyType, @@ -2203,10 +2232,9 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { /// Parses a setter as part of a type's property system (for instance setters) private func parseSetterSkeleton( _ jsSetter: AttributeSyntax, - _ node: FunctionDeclSyntax, - enclosingTypeName: String? + _ node: FunctionDeclSyntax ) -> ImportedSetterSkeleton? { - guard let validation = validateSetter(node, jsSetter: jsSetter, enclosingTypeName: enclosingTypeName) else { + guard let validation = validateSetter(node, jsSetter: jsSetter) else { return nil } @@ -2215,7 +2243,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { let (propertyName, functionBaseName) = PropertyNameResolver.resolve( functionName: functionName, jsName: validation.jsName, - normalizeIdentifier: normalizeIdentifier + normalizeIdentifier: SwiftToSkeleton.normalizeIdentifier ) else { return nil @@ -2231,10 +2259,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { // MARK: - Type and Parameter Parsing - private func parseParameters( - from clause: FunctionParameterClauseSyntax, - enclosingTypeName: String? - ) -> [Parameter] { + private func parseParameters(from clause: FunctionParameterClauseSyntax) -> [Parameter] { clause.parameters.compactMap { param in let type = param.type if type.is(MissingTypeSyntax.self) { @@ -2246,33 +2271,17 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { ) return nil } + guard let bridgeType = withLookupErrors({ parent.lookupType(for: type, errors: &$0) }) else { + return nil + } let nameToken = param.secondName ?? param.firstName - let name = normalizeIdentifier(nameToken.text) + let name = SwiftToSkeleton.normalizeIdentifier(nameToken.text) let labelToken = param.secondName == nil ? nil : param.firstName let label = labelToken?.text == "_" ? nil : labelToken?.text - let bridgeType = parseType(type, enclosingTypeName: enclosingTypeName) return Parameter(label: label, name: name, type: bridgeType) } } - private func parseType(_ type: TypeSyntax, enclosingTypeName: String?) -> BridgeType { - guard let identifier = type.as(IdentifierTypeSyntax.self) else { - errors.append( - DiagnosticError( - node: type, - message: "Unsupported @JS type '\(type.trimmedDescription)'." - ) - ) - return .void - } - - let name = normalizeIdentifier(identifier.name.text) - if name == "Self", let enclosingTypeName { - return .jsObject(enclosingTypeName) - } - return BridgeType(swiftType: name) ?? .jsObject(name) - } - // MARK: - Helper Methods private func parseEffects(_ effects: FunctionEffectSpecifiersSyntax?) -> Effects? { @@ -2290,11 +2299,4 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) } } - - private func normalizeIdentifier(_ name: String) -> String { - guard name.hasPrefix("`"), name.hasSuffix("`"), name.count >= 2 else { - return name - } - return String(name.dropFirst().dropLast()) - } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 97001c5f8..28e4b6dcd 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -793,6 +793,28 @@ public struct BridgeJSSkeleton: Codable { // MARK: - BridgeType extension extension BridgeType { + /// Maps Swift primitive type names to BridgeType. Returns nil for unknown types. + public init?(swiftType: String) { + switch swiftType { + case "Int": + self = .int + case "Float": + self = .float + case "Double": + self = .double + case "String": + self = .string + case "Bool": + self = .bool + case "Void": + self = .void + case "JSObject": + self = .jsObject(nil) + default: + return nil + } + } + public var abiReturnType: WasmCoreType? { switch self { case .void: return nil From 1496944d8f230b9d960183d977c9195379e4846a Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 26 Jan 2026 14:37:58 +0800 Subject: [PATCH 087/252] BridgeJS: Add internal debug tool for inspecting intermediate stages (#519) --- Plugins/BridgeJS/Package.swift | 13 +- Plugins/BridgeJS/README.md | 20 +++ .../Sources/BridgeJSLink/BridgeJSLink.swift | 6 +- .../BridgeJSToolInternal.swift | 137 ++++++++++++++++++ 4 files changed, 172 insertions(+), 4 deletions(-) create mode 100644 Plugins/BridgeJS/Sources/BridgeJSToolInternal/BridgeJSToolInternal.swift diff --git a/Plugins/BridgeJS/Package.swift b/Plugins/BridgeJS/Package.swift index a4385bd37..eb675c86b 100644 --- a/Plugins/BridgeJS/Package.swift +++ b/Plugins/BridgeJS/Package.swift @@ -7,7 +7,9 @@ let package = Package( name: "BridgeJS", platforms: [.macOS(.v13)], dependencies: [ - .package(url: "https://github.com/swiftlang/swift-syntax", from: "600.0.1") + .package(url: "https://github.com/swiftlang/swift-syntax", from: "600.0.1"), + // Development dependencies + .package(url: "https://github.com/apple/swift-argument-parser", from: "1.7.0"), ], targets: [ .target(name: "BridgeJSBuildPlugin"), @@ -71,5 +73,14 @@ let package = Package( .product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"), ] ), + + .executableTarget( + name: "BridgeJSToolInternal", + dependencies: [ + "BridgeJSCore", + "BridgeJSLink", + .product(name: "ArgumentParser", package: "swift-argument-parser"), + ] + ), ] ) diff --git a/Plugins/BridgeJS/README.md b/Plugins/BridgeJS/README.md index 29d7df2e1..0e84674ac 100644 --- a/Plugins/BridgeJS/README.md +++ b/Plugins/BridgeJS/README.md @@ -163,6 +163,26 @@ Return values use direct Wasm returns for primitives, and imported intrinsic fun For detailed semantics, see the [How It Works sections](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/exporting-swift-class#How-It-Works) in the user documentation. +## Debug utilities + +`BridgeJSToolInternal` exposes pipeline stages for debugging: + +- `emit-skeleton` - Parse Swift files (or `-` for stdin) and print the BridgeJS skeleton as JSON. +- `emit-swift-thunks` — Read skeleton JSON (from a file or `-` for stdin) and print the generated Swift glue (export and import thunks). +- `emit-js` / `emit-dts` - Read skeleton JSON files (or `-` for stdin) and print the .js/.d.ts + +Use these to inspect parser output and generated code without running the full generate/link pipeline. + +```console +$ cat < Int +@JS class Bar { + @JS init() {} + @JS func baz() {} +} +EOS +``` + ## Future Work - [ ] Cast between TS interface diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 1f55eb187..625bfc364 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -7,12 +7,12 @@ import BridgeJSSkeleton import BridgeJSUtilities #endif -struct BridgeJSLink { +public struct BridgeJSLink { var skeletons: [BridgeJSSkeleton] = [] let sharedMemory: Bool private let namespaceBuilder = NamespaceBuilder() - init( + public init( skeletons: [BridgeJSSkeleton] = [], sharedMemory: Bool ) { @@ -1035,7 +1035,7 @@ struct BridgeJSLink { return printer.lines.joined(separator: "\n") } - func link() throws -> (outputJs: String, outputDts: String) { + public func link() throws -> (outputJs: String, outputDts: String) { let data = try collectLinkData() let outputJs = try generateJavaScript(data: data) let outputDts = generateTypeScript(data: data) diff --git a/Plugins/BridgeJS/Sources/BridgeJSToolInternal/BridgeJSToolInternal.swift b/Plugins/BridgeJS/Sources/BridgeJSToolInternal/BridgeJSToolInternal.swift new file mode 100644 index 000000000..8a6a6b7b4 --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSToolInternal/BridgeJSToolInternal.swift @@ -0,0 +1,137 @@ +@preconcurrency import struct Foundation.URL +@preconcurrency import struct Foundation.Data +@preconcurrency import class Foundation.JSONEncoder +@preconcurrency import class Foundation.JSONDecoder +@preconcurrency import class Foundation.FileHandle +import SwiftParser +import SwiftSyntax + +import BridgeJSCore +import BridgeJSSkeleton +import BridgeJSLink +import BridgeJSUtilities + +import ArgumentParser + +@main struct BridgeJSToolInternal: ParsableCommand { + + static let configuration = CommandConfiguration( + commandName: "bridge-js-tool-internal", + abstract: "BridgeJS Tool Internal", + version: "0.1.0", + subcommands: [ + EmitSkeleton.self, + EmitSwiftThunks.self, + EmitJS.self, + EmitDTS.self, + ] + ) + + static func readData(from file: String) throws -> Data { + if file == "-" { + return try FileHandle.standardInput.readToEnd() ?? Data() + } else { + return try Data(contentsOf: URL(fileURLWithPath: file)) + } + } + + struct EmitSkeleton: ParsableCommand { + static let configuration = CommandConfiguration( + commandName: "emit-skeleton", + abstract: "Emit the BridgeJS skeleton", + ) + + @Argument(help: "The input files to emit the BridgeJS skeleton from") + var inputFiles: [String] + + func run() throws { + let swiftToSkeleton = SwiftToSkeleton( + progress: ProgressReporting(verbose: false), + moduleName: "InternalModule", + exposeToGlobal: false + ) + for inputFile in inputFiles.sorted() { + let content = try String(decoding: readData(from: inputFile), as: UTF8.self) + if BridgeJSGeneratedFile.hasSkipComment(content) { + continue + } + let sourceFile = Parser.parse(source: content) + swiftToSkeleton.addSourceFile(sourceFile, inputFilePath: inputFile) + } + let skeleton = try swiftToSkeleton.finalize() + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys] + let skeletonData = try encoder.encode(skeleton) + print(String(data: skeletonData, encoding: .utf8)!) + } + } + + struct EmitSwiftThunks: ParsableCommand { + static let configuration = CommandConfiguration( + commandName: "emit-swift-thunks", + abstract: "Emit the Swift thunks", + ) + @Argument(help: "The skeleton file to emit the Swift thunks from") + var skeletonFile: String + + func run() throws { + let skeletonData = try readData(from: skeletonFile) + let skeleton = try JSONDecoder().decode(BridgeJSSkeleton.self, from: skeletonData) + let moduleName = "InternalModule" + let exported = try skeleton.exported.flatMap { + try ExportSwift( + progress: ProgressReporting(verbose: false), + moduleName: moduleName, + skeleton: $0 + ).finalize() + } + let imported = try skeleton.imported.flatMap { + try ImportTS( + progress: ProgressReporting(verbose: false), + moduleName: moduleName, + skeleton: $0 + ).finalize() + } + let combinedSwift = [exported, imported].compactMap { $0 } + print(combinedSwift.joined(separator: "\n\n")) + } + } + + static func linkSkeletons(skeletonFiles: [String]) throws -> (outputJs: String, outputDts: String) { + var skeletons: [BridgeJSSkeleton] = [] + for skeletonFile in skeletonFiles.sorted() { + let skeletonData = try readData(from: skeletonFile) + skeletons.append(try JSONDecoder().decode(BridgeJSSkeleton.self, from: skeletonData)) + } + let link = BridgeJSLink(skeletons: skeletons, sharedMemory: false) + return try link.link() + } + + struct EmitJS: ParsableCommand { + static let configuration = CommandConfiguration( + commandName: "emit-js", + abstract: "Emit the JavaScript glue code", + ) + @Argument(help: "The skeleton files to emit the JavaScript glue code from") + var skeletonFiles: [String] + + func run() throws { + let (outputJs, _) = try linkSkeletons(skeletonFiles: skeletonFiles) + print(outputJs) + } + } + + struct EmitDTS: ParsableCommand { + static let configuration = CommandConfiguration( + commandName: "emit-dts", + abstract: "Emit the TypeScript type definitions", + ) + @Argument(help: "The skeleton files to emit the TypeScript type definitions from") + var skeletonFiles: [String] + + func run() throws { + let (_, outputDts) = try linkSkeletons(skeletonFiles: skeletonFiles) + print(outputDts) + } + } +} From cd3edbe5a91b13335e1c939fdbc9a3139919ec5b Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 26 Jan 2026 15:06:10 +0800 Subject: [PATCH 088/252] BridgeJS: Remove BridgeType usage from ts2swift (#520) --- .../TS2Swift/JavaScript/src/index.d.ts | 11 +- .../TS2Swift/JavaScript/src/processor.js | 100 +++++++----------- 2 files changed, 38 insertions(+), 73 deletions(-) diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/index.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/index.d.ts index e5af49d9e..97af7b169 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/index.d.ts +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/index.d.ts @@ -1,13 +1,4 @@ -export type BridgeType = - | { "int": {} } - | { "float": {} } - | { "double": {} } - | { "string": {} } - | { "bool": {} } - | { "jsObject": { "_0": string } | {} } - | { "void": {} } - export type Parameter = { name: string; - type: BridgeType; + type: string; } diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 47b921764..50f797de7 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -7,7 +7,6 @@ import ts from 'typescript'; /** @typedef {import('./index.d.ts').Parameter} Parameter */ -/** @typedef {import('./index.d.ts').BridgeType} BridgeType */ /** * @typedef {{ @@ -48,7 +47,7 @@ export class TypeProcessor { this.diagnosticEngine = diagnosticEngine; this.options = options; - /** @type {Map} */ + /** @type {Map} */ this.processedTypes = new Map(); /** @type {Map} Seen position by type */ this.seenTypes = new Map(); @@ -202,7 +201,7 @@ export class TypeProcessor { if (!signature) return; const params = this.renderParameters(signature.getParameters(), node); - const returnType = this.renderBridgeType(this.visitType(signature.getReturnType(), node), node); + const returnType = this.visitType(signature.getReturnType(), node); const effects = this.renderEffects({ isAsync: false }); const swiftName = this.renderIdentifier(name); @@ -242,7 +241,7 @@ export class TypeProcessor { /** * @param {ts.PropertyDeclaration | ts.PropertySignature} node - * @returns {{ name: string, type: BridgeType, isReadonly: boolean, documentation: string | undefined } | null} + * @returns {{ name: string, type: string, isReadonly: boolean, documentation: string | undefined } | null} */ visitPropertyDecl(node) { if (!node.name) return null; @@ -253,10 +252,10 @@ export class TypeProcessor { } const type = this.checker.getTypeAtLocation(node) - const bridgeType = this.visitType(type, node); + const swiftType = this.visitType(type, node); const isReadonly = node.modifiers?.some(m => m.kind === ts.SyntaxKind.ReadonlyKeyword) ?? false; const documentation = this.getFullJSDocText(node); - return { name: propertyName, type: bridgeType, isReadonly, documentation }; + return { name: propertyName, type: swiftType, isReadonly, documentation }; } /** @@ -266,8 +265,8 @@ export class TypeProcessor { */ visitSignatureParameter(symbol, node) { const type = this.checker.getTypeOfSymbolAtLocation(symbol, node); - const bridgeType = this.visitType(type, node); - return { name: symbol.name, type: bridgeType }; + const swiftType = this.visitType(type, node); + return { name: symbol.name, type: swiftType }; } /** @@ -375,10 +374,10 @@ export class TypeProcessor { } /** - * Convert TypeScript type string to BridgeType - * @param {ts.Type} type - TypeScript type string + * Convert TypeScript type to Swift type string + * @param {ts.Type} type - TypeScript type * @param {ts.Node} node - Node - * @returns {BridgeType} Bridge type + * @returns {string} Swift type string * @private */ visitType(type, node) { @@ -392,28 +391,24 @@ export class TypeProcessor { } /** * @param {ts.Type} type - * @returns {BridgeType} + * @returns {string} */ const convert = (type) => { - /** @type {Record} */ + /** @type {Record} */ const typeMap = { - "number": { "double": {} }, - "string": { "string": {} }, - "boolean": { "bool": {} }, - "void": { "void": {} }, - "any": { "jsObject": {} }, - "unknown": { "jsObject": {} }, - "null": { "void": {} }, - "undefined": { "void": {} }, - "bigint": { "int": {} }, - "object": { "jsObject": {} }, - "symbol": { "jsObject": {} }, - "never": { "void": {} }, - "Promise": { - "jsObject": { - "_0": "JSPromise" - } - }, + "number": "Double", + "string": "String", + "boolean": "Bool", + "void": "Void", + "any": "JSObject", + "unknown": "JSObject", + "null": "Void", + "undefined": "Void", + "bigint": "Int", + "object": "JSObject", + "symbol": "JSObject", + "never": "Void", + "Promise": "JSPromise", }; const typeString = type.getSymbol()?.name ?? this.checker.typeToString(type); if (typeMap[typeString]) { @@ -421,27 +416,27 @@ export class TypeProcessor { } if (this.checker.isArrayType(type) || this.checker.isTupleType(type) || type.getCallSignatures().length > 0) { - return { "jsObject": {} }; + return "JSObject"; } // "a" | "b" -> string if (this.checker.isTypeAssignableTo(type, this.checker.getStringType())) { - return { "string": {} }; + return "String"; } if (type.isTypeParameter()) { - return { "jsObject": {} }; + return "JSObject"; } const typeName = this.deriveTypeName(type); if (!typeName) { this.diagnosticEngine.print("warning", `Unknown non-nominal type: ${typeString}`, node); - return { "jsObject": {} }; + return "JSObject"; } this.seenTypes.set(type, node); - return { "jsObject": { "_0": typeName } }; + return this.renderIdentifier(typeName); } - const bridgeType = convert(type); - this.processedTypes.set(type, bridgeType); - return bridgeType; + const swiftType = convert(type); + this.processedTypes.set(type, swiftType); + return swiftType; } /** @@ -471,7 +466,7 @@ export class TypeProcessor { const property = this.visitPropertyDecl(node); if (!property) return; - const type = this.renderBridgeType(property.type, node); + const type = property.type; const name = this.renderIdentifier(property.name); // Always render getter @@ -501,7 +496,7 @@ export class TypeProcessor { if (!signature) return; const params = this.renderParameters(signature.getParameters(), node); - const returnType = this.renderBridgeType(this.visitType(signature.getReturnType(), node), node); + const returnType = this.visitType(signature.getReturnType(), node); const effects = this.renderEffects({ isAsync: false }); const swiftName = this.renderIdentifier(name); @@ -538,35 +533,14 @@ export class TypeProcessor { renderParameters(parameters, node) { const params = []; for (const p of parameters) { - const bridgeType = this.visitSignatureParameter(p, node); + const param = this.visitSignatureParameter(p, node); const paramName = this.renderIdentifier(p.name); - const type = this.renderBridgeType(bridgeType.type, node); + const type = param.type; params.push(`_ ${paramName}: ${type}`); } return params.join(", "); } - /** - * Render bridge type to Swift type - * @param {BridgeType} bridgeType - * @param {ts.Node} node - * @returns {string} - * @private - */ - renderBridgeType(bridgeType, node) { - if ("int" in bridgeType) return "Int"; - if ("float" in bridgeType) return "Float"; - if ("double" in bridgeType) return "Double"; - if ("string" in bridgeType) return "String"; - if ("bool" in bridgeType) return "Bool"; - if ("void" in bridgeType) return "Void"; - if ("jsObject" in bridgeType) { - const name = "_0" in bridgeType.jsObject ? bridgeType.jsObject._0 : undefined; - return name ? this.renderIdentifier(name) : "JSObject"; - } - return "JSObject"; - } - /** * Render effects (async/throws) * @param {{ isAsync: boolean }} effects From 8565d3ba971cfb426b28c3ffde281ed6b0fc8d75 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 26 Jan 2026 16:04:25 +0800 Subject: [PATCH 089/252] BridgeJS: Import TypeScript enums into Swift (#521) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implemented TypeScript `enum` → Swift `enum` import for BridgeJS (string-valued enums, plus int-valued as a bonus). - `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js`: emits Swift `enum Name: String { ... }` (or `: Int`) for TS enums, adds `extension Name: _BridgedSwiftEnumNoPayload {}`, and ensures enum-typed parameters/returns stay typed as the enum (not downgraded to `String`). - `Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift`: resolves referenced Swift enums/typealiases via `TypeDeclResolver` so `FeatureFlag` becomes `.rawValueEnum("FeatureFlag", .string)` in the imported skeleton. - `Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift`: enables lowering/lifting for `.rawValueEnum` in the `.importTS` context (parameters + returns). - Added coverage: `Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringEnum.d.ts` with new snapshots `Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.Macros.swift` and `Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.swift`. - Verified with `swift test --package-path ./Plugins/BridgeJS --filter ImportTSTests`. * Added a BridgeJS runtime import test for TS string enums. - Updated `Tests/BridgeJSRuntimeTests/bridge-js.d.ts` with `FeatureFlag` + `jsRoundTripFeatureFlag`. - Added JS implementation in `Tests/prelude.mjs`. - Added XCTest in `Tests/BridgeJSRuntimeTests/ImportAPITests.swift` (`testRoundTripFeatureFlag`). - Regenerated runtime fixtures under `Tests/BridgeJSRuntimeTests/Generated/` (via `BridgeJSTool generate`). - Verified runtime: `make unittest SWIFT_SDK_ID=DEVELOPMENT-SNAPSHOT+MAIN-wasm32-unknown-wasip1-threads` (passes). --- .../Sources/BridgeJSCore/ImportTS.swift | 4 +- .../TS2Swift/JavaScript/src/processor.js | 189 ++++++++++++++ .../BridgeJSToolTests/Inputs/StringEnum.d.ts | 8 + .../BridgeJSLinkTests/StringEnum.Import.d.ts | 19 ++ .../BridgeJSLinkTests/StringEnum.Import.js | 231 ++++++++++++++++++ .../ImportTSTests/StringEnum.Macros.swift | 17 ++ .../ImportTSTests/StringEnum.swift | 33 +++ .../Generated/BridgeJS.Macros.swift | 8 + .../Generated/BridgeJS.swift | 18 ++ .../Generated/JavaScript/BridgeJS.json | 20 ++ .../BridgeJSRuntimeTests/ImportAPITests.swift | 6 + Tests/BridgeJSRuntimeTests/bridge-js.d.ts | 9 +- Tests/prelude.mjs | 3 + 13 files changed, 562 insertions(+), 3 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringEnum.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.Macros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.swift diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 27f5a7c51..acbf995b2 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -869,7 +869,7 @@ extension BridgeType { case .rawValueEnum(_, let rawType): switch context { case .importTS: - throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") + return LoweringParameterInfo(loweredParameters: [("value", rawType.wasmCoreType ?? .i32)]) case .exportSwift: // For protocol export we return .i32 for String raw value type instead of nil return LoweringParameterInfo(loweredParameters: [("value", rawType.wasmCoreType ?? .i32)]) @@ -952,7 +952,7 @@ extension BridgeType { case .rawValueEnum(_, let rawType): switch context { case .importTS: - throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") + return LiftingReturnInfo(valueToLift: rawType.wasmCoreType ?? .i32) case .exportSwift: // For protocol export we return .i32 for String raw value type instead of nil return LiftingReturnInfo(valueToLift: rawType.wasmCoreType ?? .i32) diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 50f797de7..6a752ab80 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -53,6 +53,10 @@ export class TypeProcessor { this.seenTypes = new Map(); /** @type {string[]} Collected Swift code lines */ this.swiftLines = []; + /** @type {Set} */ + this.emittedEnumNames = new Set(); + /** @type {Set} */ + this.emittedStructuredTypeNames = new Set(); /** @type {Set} */ this.visitedDeclarationKeys = new Set(); @@ -92,6 +96,10 @@ export class TypeProcessor { for (const [type, node] of this.seenTypes) { this.seenTypes.delete(type); + if (this.isEnumType(type)) { + this.visitEnumType(type, node); + continue; + } const typeString = this.checker.typeToString(type); const members = type.getProperties(); if (members) { @@ -119,6 +127,8 @@ export class TypeProcessor { this.visitFunctionDeclaration(node); } else if (ts.isClassDeclaration(node)) { this.visitClassDecl(node); + } else if (ts.isEnumDeclaration(node)) { + this.visitEnumDeclaration(node); } else if (ts.isExportDeclaration(node)) { this.visitExportDeclaration(node); } @@ -185,6 +195,145 @@ export class TypeProcessor { } } + /** + * @param {ts.Type} type + * @returns {boolean} + * @private + */ + isEnumType(type) { + const symbol = type.getSymbol() ?? type.aliasSymbol; + if (!symbol) return false; + return (symbol.flags & ts.SymbolFlags.Enum) !== 0; + } + + /** + * @param {ts.EnumDeclaration} node + * @private + */ + visitEnumDeclaration(node) { + const name = node.name?.text; + if (!name) return; + this.emitEnumFromDeclaration(name, node, node); + } + + /** + * @param {ts.Type} type + * @param {ts.Node} node + * @private + */ + visitEnumType(type, node) { + const symbol = type.getSymbol() ?? type.aliasSymbol; + const name = symbol?.name; + if (!name) return; + const decl = symbol?.getDeclarations()?.find(d => ts.isEnumDeclaration(d)); + if (!decl || !ts.isEnumDeclaration(decl)) { + this.diagnosticEngine.print("warning", `Enum declaration not found for type: ${name}`, node); + return; + } + this.emitEnumFromDeclaration(name, decl, node); + } + + /** + * @param {string} enumName + * @param {ts.EnumDeclaration} decl + * @param {ts.Node} diagnosticNode + * @private + */ + emitEnumFromDeclaration(enumName, decl, diagnosticNode) { + if (this.emittedEnumNames.has(enumName)) return; + this.emittedEnumNames.add(enumName); + + const members = decl.members ?? []; + if (members.length === 0) { + this.diagnosticEngine.print("warning", `Empty enum is not supported: ${enumName}`, diagnosticNode); + this.swiftLines.push(`typealias ${this.renderIdentifier(enumName)} = String`); + this.swiftLines.push(""); + return; + } + + /** @type {{ name: string, raw: string }[]} */ + const stringMembers = []; + /** @type {{ name: string, raw: number }[]} */ + const intMembers = []; + let canBeStringEnum = true; + let canBeIntEnum = true; + let nextAutoValue = 0; + + for (const member of members) { + const rawMemberName = member.name.getText(); + const unquotedName = rawMemberName.replace(/^["']|["']$/g, ""); + const swiftCaseNameBase = makeValidSwiftIdentifier(unquotedName, { emptyFallback: "_case" }); + + if (member.initializer && ts.isStringLiteral(member.initializer)) { + stringMembers.push({ name: swiftCaseNameBase, raw: member.initializer.text }); + canBeIntEnum = false; + continue; + } + + if (member.initializer && ts.isNumericLiteral(member.initializer)) { + const rawValue = Number(member.initializer.text); + if (!Number.isInteger(rawValue)) { + canBeIntEnum = false; + } else { + intMembers.push({ name: swiftCaseNameBase, raw: rawValue }); + nextAutoValue = rawValue + 1; + canBeStringEnum = false; + continue; + } + } + + if (!member.initializer) { + intMembers.push({ name: swiftCaseNameBase, raw: nextAutoValue }); + nextAutoValue += 1; + canBeStringEnum = false; + continue; + } + + canBeStringEnum = false; + canBeIntEnum = false; + } + const swiftEnumName = this.renderIdentifier(enumName); + const dedupeNames = (items) => { + const seen = new Map(); + return items.map(item => { + const count = seen.get(item.name) ?? 0; + seen.set(item.name, count + 1); + if (count === 0) return item; + return { ...item, name: `${item.name}_${count + 1}` }; + }); + }; + + if (canBeStringEnum && stringMembers.length > 0) { + this.swiftLines.push(`enum ${swiftEnumName}: String {`); + for (const { name, raw } of dedupeNames(stringMembers)) { + this.swiftLines.push(` case ${this.renderIdentifier(name)} = "${raw.replaceAll("\"", "\\\\\"")}"`); + } + this.swiftLines.push("}"); + this.swiftLines.push(`extension ${swiftEnumName}: _BridgedSwiftEnumNoPayload {}`); + this.swiftLines.push(""); + return; + } + + if (canBeIntEnum && intMembers.length > 0) { + this.swiftLines.push(`enum ${swiftEnumName}: Int {`); + for (const { name, raw } of dedupeNames(intMembers)) { + this.swiftLines.push(` case ${this.renderIdentifier(name)} = ${raw}`); + } + this.swiftLines.push("}"); + this.swiftLines.push(`extension ${swiftEnumName}: _BridgedSwiftEnumNoPayload {}`); + this.swiftLines.push(""); + return; + } + + this.diagnosticEngine.print( + "warning", + `Unsupported enum (only string or int enums are supported): ${enumName}`, + diagnosticNode + ); + this.swiftLines.push(`typealias ${swiftEnumName} = String`); + this.swiftLines.push(""); + } + /** * Visit a function declaration and render Swift code * @param {ts.FunctionDeclaration} node - The function node @@ -332,6 +481,9 @@ export class TypeProcessor { * @private */ visitStructuredType(name, members) { + if (this.emittedStructuredTypeNames.has(name)) return; + this.emittedStructuredTypeNames.add(name); + const typeName = this.renderIdentifier(name); this.swiftLines.push(`@JSClass struct ${typeName} {`); @@ -415,6 +567,13 @@ export class TypeProcessor { return typeMap[typeString]; } + const symbol = type.getSymbol() ?? type.aliasSymbol; + if (symbol && (symbol.flags & ts.SymbolFlags.Enum) !== 0) { + const typeName = symbol.name; + this.seenTypes.set(type, node); + return this.renderIdentifier(typeName); + } + if (this.checker.isArrayType(type) || this.checker.isTupleType(type) || type.getCallSignatures().length > 0) { return "JSObject"; } @@ -623,3 +782,33 @@ export function isValidSwiftDeclName(name) { const swiftIdentifierRegex = /^[_\p{ID_Start}][\p{ID_Continue}\u{200C}\u{200D}]*$/u; return swiftIdentifierRegex.test(name); } + +/** + * Convert an arbitrary string into a valid Swift identifier. + * @param {string} name + * @param {{ emptyFallback?: string }} options + * @returns {string} + */ +function makeValidSwiftIdentifier(name, options = {}) { + const emptyFallback = options.emptyFallback ?? "_"; + let result = ""; + for (const ch of name) { + const isIdentifierChar = /^[_\p{ID_Continue}\u{200C}\u{200D}]$/u.test(ch); + result += isIdentifierChar ? ch : "_"; + } + if (!result) result = emptyFallback; + if (!/^[_\p{ID_Start}]$/u.test(result[0])) { + result = "_" + result; + } + if (!isValidSwiftDeclName(result)) { + result = result.replace(/[^_\p{ID_Continue}\u{200C}\u{200D}]/gu, "_"); + if (!result) result = emptyFallback; + if (!/^[_\p{ID_Start}]$/u.test(result[0])) { + result = "_" + result; + } + } + if (isSwiftKeyword(result)) { + result = result + "_"; + } + return result; +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringEnum.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringEnum.d.ts new file mode 100644 index 000000000..10f6dd819 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringEnum.d.ts @@ -0,0 +1,8 @@ +export enum FeatureFlag { + foo = "foo", + bar = "bar", +} + +export function takesFeatureFlag(flag: FeatureFlag): void + +export function returnsFeatureFlag(): FeatureFlag diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.d.ts new file mode 100644 index 000000000..bb9f163cc --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.d.ts @@ -0,0 +1,19 @@ +// 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 type Exports = { +} +export type Imports = { + takesFeatureFlag(flag: FeatureFlagTag): void; + returnsFeatureFlag(): FeatureFlagTag; +} +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/StringEnum.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js new file mode 100644 index 000000000..7c30768f5 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js @@ -0,0 +1,231 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_takesFeatureFlag"] = function bjs_takesFeatureFlag(flag) { + try { + const flagObject = swift.memory.getObject(flag); + swift.memory.release(flag); + imports.takesFeatureFlag(flagObject); + } catch (error) { + setException(error); + } + } + TestModule["bjs_returnsFeatureFlag"] = function bjs_returnsFeatureFlag() { + try { + let ret = imports.returnsFeatureFlag(); + tmpRetBytes = textEncoder.encode(ret); + return tmpRetBytes.length; + } catch (error) { + setException(error); + } + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + const exports = { + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.Macros.swift new file mode 100644 index 000000000..b0049af28 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.Macros.swift @@ -0,0 +1,17 @@ +// 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(Experimental) import JavaScriptKit + +enum FeatureFlag: String { + case foo = "foo" + case bar = "bar" +} +extension FeatureFlag: _BridgedSwiftEnumNoPayload {} + +@JSFunction func takesFeatureFlag(_ flag: FeatureFlag) throws (JSException) -> Void + +@JSFunction func returnsFeatureFlag() throws (JSException) -> FeatureFlag diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.swift new file mode 100644 index 000000000..3059865ac --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.swift @@ -0,0 +1,33 @@ +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_takesFeatureFlag") +fileprivate func bjs_takesFeatureFlag(_ flag: Int32) -> Void +#else +fileprivate func bjs_takesFeatureFlag(_ flag: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$takesFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> Void { + let flagValue = flag.bridgeJSLowerParameter() + bjs_takesFeatureFlag(flagValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_returnsFeatureFlag") +fileprivate func bjs_returnsFeatureFlag() -> Int32 +#else +fileprivate func bjs_returnsFeatureFlag() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$returnsFeatureFlag() throws(JSException) -> FeatureFlag { + let ret = bjs_returnsFeatureFlag() + if let error = _swift_js_take_exception() { + throw error + } + return FeatureFlag.bridgeJSLiftReturn(ret) +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index 2ad11fd9b..65a46a3f2 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -22,6 +22,14 @@ @JSFunction func jsThrowOrString(_ shouldThrow: Bool) throws (JSException) -> String +enum FeatureFlag: String { + case foo = "foo" + case bar = "bar" +} +extension FeatureFlag: _BridgedSwiftEnumNoPayload {} + +@JSFunction func jsRoundTripFeatureFlag(_ flag: FeatureFlag) throws (JSException) -> FeatureFlag + @JSClass struct JsGreeter { @JSGetter var name: String @JSSetter func setName(_ value: String) throws (JSException) diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 1b39e77b8..51048feb6 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -6307,6 +6307,24 @@ func _$jsThrowOrString(_ shouldThrow: Bool) throws(JSException) -> String { return String.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripFeatureFlag") +fileprivate func bjs_jsRoundTripFeatureFlag(_ flag: Int32) -> Int32 +#else +fileprivate func bjs_jsRoundTripFeatureFlag(_ flag: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> FeatureFlag { + let flagValue = flag.bridgeJSLowerParameter() + let ret = bjs_jsRoundTripFeatureFlag(flagValue) + 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() -> Int32 diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 727508f3c..3dcb35239 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -9070,6 +9070,26 @@ } } }, + { + "name" : "jsRoundTripFeatureFlag", + "parameters" : [ + { + "name" : "flag", + "type" : { + "rawValueEnum" : { + "_0" : "FeatureFlag", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "FeatureFlag", + "_1" : "String" + } + } + }, { "name" : "runAsyncWorks", "parameters" : [ diff --git a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift index f0112ed1a..e31c89cbf 100644 --- a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift @@ -35,6 +35,12 @@ class ImportAPITests: XCTestCase { } } + func testRoundTripFeatureFlag() throws { + for v in [FeatureFlag.foo, .bar] { + try XCTAssertEqual(jsRoundTripFeatureFlag(v), v) + } + } + func ensureThrows(_ f: (Bool) throws(JSException) -> T) throws { do { _ = try f(true) diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts index 86a72ca05..87de440d8 100644 --- a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts +++ b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts @@ -7,6 +7,13 @@ export function jsThrowOrNumber(shouldThrow: boolean): number export function jsThrowOrBool(shouldThrow: boolean): boolean export function jsThrowOrString(shouldThrow: boolean): string +export enum FeatureFlag { + foo = "foo", + bar = "bar", +} + +export function jsRoundTripFeatureFlag(flag: FeatureFlag): FeatureFlag + export class JsGreeter { name: string; readonly prefix: string; @@ -15,4 +22,4 @@ export class JsGreeter { changeName(name: string): void; } -export function runAsyncWorks(): Promise; \ No newline at end of file +export function runAsyncWorks(): Promise; diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index a5611523c..7d048be72 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -47,6 +47,9 @@ export async function setupOptions(options, context) { } return "Hello, world!"; }, + "jsRoundTripFeatureFlag": (flag) => { + return flag; + }, JsGreeter: class { /** * @param {string} name From d9d6c56949ce89bcdfc5ea993ad7ae4420cc0e42 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 26 Jan 2026 15:39:19 +0900 Subject: [PATCH 090/252] Implemented BridgeJS support for using `@JSClass`-imported TS/JS types in exported APIs by treating `@JSClass` **classes/actors** as `.jsObject` (previously they were misclassified as Swift heap objects, producing JS like `Foo.__construct(...)`). - Fix: `Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift` - Regression test + snapshots: `Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ImportedTypeInExportedInterface.swift`, `Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js`, `Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.d.ts`, `Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.swift`, `Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.json` - Verified with `swift test --package-path ./Plugins/BridgeJS` --- .../BridgeJSCore/SwiftToSkeleton.swift | 10 + .../ImportedTypeInExportedInterface.swift | 7 + ...mportedTypeInExportedInterface.Export.d.ts | 23 ++ .../ImportedTypeInExportedInterface.Export.js | 233 ++++++++++++++++++ .../ImportedTypeInExportedInterface.json | 34 +++ .../ImportedTypeInExportedInterface.swift | 24 ++ .../BridgeJSRuntimeTests/ExportAPITests.swift | 11 +- .../Generated/BridgeJS.swift | 61 +++++ .../Generated/JavaScript/BridgeJS.json | 55 +++++ Tests/prelude.mjs | 12 + 10 files changed, 469 insertions(+), 1 deletion(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ImportedTypeInExportedInterface.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.swift diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index 6628a3043..f18788e7d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -235,6 +235,16 @@ public final class SwiftToSkeleton { return nil } let swiftCallName = SwiftToSkeleton.computeSwiftCallName(for: typeDecl, itemName: typeDecl.name.text) + + // A type annotated with @JSClass is a JavaScript object wrapper (imported), + // even if it is declared as a Swift class. + if let classDecl = typeDecl.as(ClassDeclSyntax.self), classDecl.attributes.hasAttribute(name: "JSClass") { + return .jsObject(swiftCallName) + } + if let actorDecl = typeDecl.as(ActorDeclSyntax.self), actorDecl.attributes.hasAttribute(name: "JSClass") { + return .jsObject(swiftCallName) + } + return .swiftHeapObject(swiftCallName) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ImportedTypeInExportedInterface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ImportedTypeInExportedInterface.swift new file mode 100644 index 000000000..9e3524284 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ImportedTypeInExportedInterface.swift @@ -0,0 +1,7 @@ +@JSClass class Foo { + @JSFunction init() throws(JSException) +} + +@JS func makeFoo() throws(JSException) -> Foo { + return try Foo() +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.d.ts new file mode 100644 index 000000000..654b4bc04 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.d.ts @@ -0,0 +1,23 @@ +// 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 interface Foo { +} +export type Exports = { + makeFoo(): Foo; +} +export type Imports = { + Foo: { + new(): Foo; + } +} +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/ImportedTypeInExportedInterface.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js new file mode 100644 index 000000000..93c23a0db --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js @@ -0,0 +1,233 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_Foo_init"] = function bjs_Foo_init() { + try { + return swift.memory.retain(new imports.Foo()); + } catch (error) { + setException(error); + return 0 + } + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + const exports = { + makeFoo: function bjs_makeFoo() { + const ret = instance.exports.bjs_makeFoo(); + const ret1 = swift.memory.getObject(ret); + swift.memory.release(ret); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; + throw error; + } + return ret1; + }, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.json new file mode 100644 index 000000000..6ee073ca8 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.json @@ -0,0 +1,34 @@ +{ + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_makeFoo", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "makeFoo", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "Foo" + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.swift new file mode 100644 index 000000000..0bebd4e73 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.swift @@ -0,0 +1,24 @@ +@_expose(wasm, "bjs_makeFoo") +@_cdecl("bjs_makeFoo") +public func _bjs_makeFoo() -> Int32 { + #if arch(wasm32) + do { + let ret = try makeFoo() + 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 +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 286c9a380..0df421df6 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -1,5 +1,5 @@ import XCTest -import JavaScriptKit +@_spi(Experimental) import JavaScriptKit import JavaScriptEventLoop @_extern(wasm, module: "BridgeJSRuntimeTests", name: "runJsWorks") @@ -33,6 +33,15 @@ func runJsWorks() -> Void return v } +@JSClass struct Foo { + @JSGetter var value: String + @JSFunction init(_ value: String) throws(JSException) +} + +@JS func makeImportedFoo(value: String) throws(JSException) -> Foo { + return try Foo(value) +} + struct TestError: Error { let message: String } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 1b39e77b8..7134003c0 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2560,6 +2560,31 @@ public func _bjs_roundTripJSObject(_ v: Int32) -> Int32 { #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 { @@ -6166,6 +6191,42 @@ fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int3 } #endif +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Foo_init") +fileprivate func bjs_Foo_init(_ value: Int32) -> Int32 +#else +fileprivate func bjs_Foo_init(_ value: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Foo_value_get") +fileprivate func bjs_Foo_value_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_Foo_value_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$Foo_init(_ value: String) throws(JSException) -> JSObject { + let valueValue = value.bridgeJSLowerParameter() + let ret = bjs_Foo_init(valueValue) + 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_jsRoundTripVoid") fileprivate func bjs_jsRoundTripVoid() -> Void diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 727508f3c..6127958ea 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -4729,6 +4729,31 @@ } } }, + { + "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" : { @@ -8928,7 +8953,37 @@ ], "types" : [ + { + "constructor" : { + "parameters" : [ + { + "name" : "value", + "type" : { + "string" : { + } + } + } + ] + }, + "getters" : [ + { + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "methods" : [ + + ], + "name" : "Foo", + "setters" : [ + + ] + } ] }, { diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index a5611523c..5363cfd25 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -64,6 +64,7 @@ export async function setupOptions(options, context) { this.name = name; } }, + Foo: ImportedFoo, runAsyncWorks: async () => { const exports = importsContext.getExports(); if (!exports) { @@ -100,6 +101,13 @@ export async function setupOptions(options, context) { import assert from "node:assert"; +class ImportedFoo { + /** @param {string} value */ + constructor(value) { + this.value = value; + } +} + /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { exports.roundTripVoid(); @@ -173,6 +181,10 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { g.release(); + const foo = exports.makeImportedFoo("hello"); + assert.ok(foo instanceof ImportedFoo); + assert.equal(foo.value, "hello"); + // Test PropertyHolder with various types const testObj = { testProp: "test" }; const sibling = new exports.SimplePropertyHolder(999); From f822943cf98594d9a4c26850255b548538120f57 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 26 Jan 2026 19:06:46 +0900 Subject: [PATCH 091/252] BridgeJS: support closures in imported APIs Enable closure parameter/return types for imported JS interfaces and emit the required closure glue from BridgeJSTool. --- .../Sources/BridgeJSCore/ClosureCodegen.swift | 337 ++++++++++++++++++ .../Sources/BridgeJSCore/ExportSwift.swift | 265 -------------- .../Sources/BridgeJSCore/ImportTS.swift | 53 ++- .../Sources/BridgeJSLink/BridgeJSLink.swift | 38 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 23 +- .../Sources/BridgeJSTool/BridgeJSTool.swift | 11 +- .../BridgeJSToolTests/ExportSwiftTests.swift | 13 +- .../SwiftClosureImports.swift | 4 + .../BridgeJSToolTests/ImportTSTests.swift | 47 ++- .../SwiftClosureImports.ImportMacros.d.ts | 19 + .../SwiftClosureImports.ImportMacros.js | 257 +++++++++++++ .../GlobalGetter.ImportMacros.swift | 34 ++ .../SwiftClosureImports.ImportMacros.swift | 84 +++++ 13 files changed, 899 insertions(+), 286 deletions(-) create mode 100644 Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftClosureImports.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalGetter.ImportMacros.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftClosureImports.ImportMacros.swift diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift new file mode 100644 index 000000000..5d6545668 --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift @@ -0,0 +1,337 @@ +import SwiftBasicFormat +import SwiftSyntax +import SwiftSyntaxBuilder +#if canImport(BridgeJSSkeleton) +import BridgeJSSkeleton +#endif + +public struct ClosureCodegen { + public init() {} + + func collectClosureSignatures(from parameters: [Parameter], into signatures: inout Set) { + for param in parameters { + collectClosureSignatures(from: param.type, into: &signatures) + } + } + + func collectClosureSignatures(from type: BridgeType, into signatures: inout Set) { + switch type { + case .closure(let signature): + signatures.insert(signature) + for paramType in signature.parameters { + collectClosureSignatures(from: paramType, into: &signatures) + } + collectClosureSignatures(from: signature.returnType, into: &signatures) + case .optional(let wrapped): + collectClosureSignatures(from: wrapped, into: &signatures) + default: + break + } + } + + func renderClosureHelpers(_ signature: ClosureSignature) throws -> [DeclSyntax] { + let mangledName = signature.mangleName + let helperName = "_BJS_Closure_\(mangledName)" + let boxClassName = "_BJS_ClosureBox_\(mangledName)" + + let closureParams = signature.parameters.enumerated().map { _, type in + "\(type.swiftType)" + }.joined(separator: ", ") + + let swiftEffects = (signature.isAsync ? " async" : "") + (signature.isThrows ? " throws" : "") + let swiftReturnType = signature.returnType.swiftType + let closureType = "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)" + + let externName = "invoke_js_callback_\(signature.moduleName)_\(mangledName)" + + // Use CallJSEmission to generate the callback invocation + let builder = ImportTS.CallJSEmission( + moduleName: "bjs", + abiName: externName, + context: .exportSwift + ) + + // Lower the callback parameter + try builder.lowerParameter(param: Parameter(label: nil, name: "callback", type: .jsObject(nil))) + + // Lower each closure parameter + for (index, paramType) in signature.parameters.enumerated() { + try builder.lowerParameter(param: Parameter(label: nil, name: "param\(index)", type: paramType)) + } + + // Generate the call and return value lifting + try builder.call(returnType: signature.returnType) + try builder.liftReturnValue(returnType: signature.returnType) + + // Get the body code + let bodyCode = builder.getBody() + + // Generate extern declaration using CallJSEmission + let externDecl = builder.renderImportDecl() + + let boxClassDecl: DeclSyntax = """ + private final class \(raw: boxClassName): _BridgedSwiftClosureBox { + let closure: \(raw: closureType) + init(_ closure: @escaping \(raw: closureType)) { + self.closure = closure + } + } + """ + + let helperEnumDecl = EnumDeclSyntax( + modifiers: DeclModifierListSyntax { + DeclModifierSyntax(name: .keyword(.private)) + }, + name: .identifier(helperName), + memberBlockBuilder: { + DeclSyntax( + FunctionDeclSyntax( + modifiers: DeclModifierListSyntax { + DeclModifierSyntax(name: .keyword(.static)) + }, + name: .identifier("bridgeJSLower"), + signature: FunctionSignatureSyntax( + parameterClause: FunctionParameterClauseSyntax { + FunctionParameterSyntax( + firstName: .wildcardToken(), + secondName: .identifier("closure"), + colon: .colonToken(), + type: TypeSyntax("@escaping \(raw: closureType)") + ) + }, + returnClause: ReturnClauseSyntax( + arrow: .arrowToken(), + type: IdentifierTypeSyntax(name: .identifier("UnsafeMutableRawPointer")) + ) + ), + body: CodeBlockSyntax { + "let box = \(raw: boxClassName)(closure)" + "return Unmanaged.passRetained(box).toOpaque()" + } + ) + ) + + DeclSyntax( + FunctionDeclSyntax( + modifiers: DeclModifierListSyntax { + DeclModifierSyntax(name: .keyword(.static)) + }, + name: .identifier("bridgeJSLift"), + signature: FunctionSignatureSyntax( + parameterClause: FunctionParameterClauseSyntax { + FunctionParameterSyntax( + firstName: .wildcardToken(), + secondName: .identifier("callbackId"), + colon: .colonToken(), + type: IdentifierTypeSyntax(name: .identifier("Int32")) + ) + }, + returnClause: ReturnClauseSyntax( + arrow: .arrowToken(), + type: IdentifierTypeSyntax(name: .identifier(closureType)) + ) + ), + body: CodeBlockSyntax { + "let callback = JSObject.bridgeJSLiftParameter(callbackId)" + ReturnStmtSyntax( + expression: ClosureExprSyntax( + leftBrace: .leftBraceToken(), + signature: ClosureSignatureSyntax( + capture: ClosureCaptureClauseSyntax( + leftSquare: .leftSquareToken(), + items: ClosureCaptureListSyntax { + #if canImport(SwiftSyntax602) + ClosureCaptureSyntax( + name: .identifier("", presence: .missing), + initializer: InitializerClauseSyntax( + equal: .equalToken(presence: .missing), + nil, + value: ExprSyntax("callback") + ), + trailingTrivia: nil + ) + #else + ClosureCaptureSyntax( + expression: ExprSyntax("callback") + ) + #endif + }, + rightSquare: .rightSquareToken() + ), + parameterClause: .simpleInput( + ClosureShorthandParameterListSyntax { + for (index, _) in signature.parameters.enumerated() { + ClosureShorthandParameterSyntax(name: .identifier("param\(index)")) + } + } + ), + inKeyword: .keyword(.in) + ), + statements: CodeBlockItemListSyntax { + SwiftCodePattern.buildWasmConditionalCompilation(wasmBody: bodyCode.statements) + }, + rightBrace: .rightBraceToken() + ) + ) + } + ) + ) + } + ) + return [externDecl, boxClassDecl, DeclSyntax(helperEnumDecl)] + } + + func renderClosureInvokeHandler(_ signature: ClosureSignature) throws -> DeclSyntax { + let boxClassName = "_BJS_ClosureBox_\(signature.mangleName)" + let abiName = "invoke_swift_closure_\(signature.moduleName)_\(signature.mangleName)" + + // Build ABI parameters directly with WasmCoreType (no string conversion needed) + var abiParams: [(name: String, type: WasmCoreType)] = [("boxPtr", .pointer)] + var liftedParams: [String] = [] + + for (index, paramType) in signature.parameters.enumerated() { + let paramName = "param\(index)" + let liftInfo = try paramType.liftParameterInfo() + + for (argName, wasmType) in liftInfo.parameters { + let fullName = + liftInfo.parameters.count > 1 ? "\(paramName)\(argName.capitalizedFirstLetter)" : paramName + abiParams.append((fullName, wasmType)) + } + + let argNames = liftInfo.parameters.map { (argName, _) in + liftInfo.parameters.count > 1 ? "\(paramName)\(argName.capitalizedFirstLetter)" : paramName + } + liftedParams.append("\(paramType.swiftType).bridgeJSLiftParameter(\(argNames.joined(separator: ", ")))") + } + + let closureCallExpr = ExprSyntax("box.closure(\(raw: liftedParams.joined(separator: ", ")))") + + // Determine return type + let abiReturnWasmType: WasmCoreType? + if signature.returnType == .void { + abiReturnWasmType = nil + } else if let wasmType = try signature.returnType.loweringReturnInfo().returnType { + abiReturnWasmType = wasmType + } else { + abiReturnWasmType = nil + } + + // Build signature using SwiftSignatureBuilder + let funcSignature = SwiftSignatureBuilder.buildABIFunctionSignature( + abiParameters: abiParams, + returnType: abiReturnWasmType + ) + + // Build body + let body = CodeBlockItemListSyntax { + "let box = Unmanaged<\(raw: boxClassName)>.fromOpaque(boxPtr).takeUnretainedValue()" + if signature.returnType == .void { + closureCallExpr + } else { + "let result = \(closureCallExpr)" + "return result.bridgeJSLowerReturn()" + } + } + + // Build function declaration using helper + let funcDecl = SwiftCodePattern.buildExposedFunctionDecl( + abiName: abiName, + signature: funcSignature, + body: body + ) + + return DeclSyntax(funcDecl) + } + + public func renderSupport(for skeleton: BridgeJSSkeleton) throws -> String? { + var closureSignatures: Set = [] + + if let exported = skeleton.exported { + for function in exported.functions { + collectClosureSignatures(from: function.parameters, into: &closureSignatures) + collectClosureSignatures(from: function.returnType, into: &closureSignatures) + } + for klass in exported.classes { + if let constructor = klass.constructor { + collectClosureSignatures(from: constructor.parameters, into: &closureSignatures) + } + for method in klass.methods { + collectClosureSignatures(from: method.parameters, into: &closureSignatures) + collectClosureSignatures(from: method.returnType, into: &closureSignatures) + } + for property in klass.properties { + collectClosureSignatures(from: property.type, into: &closureSignatures) + } + } + for proto in exported.protocols { + for method in proto.methods { + collectClosureSignatures(from: method.parameters, into: &closureSignatures) + collectClosureSignatures(from: method.returnType, into: &closureSignatures) + } + for property in proto.properties { + collectClosureSignatures(from: property.type, into: &closureSignatures) + } + } + for structDecl in exported.structs { + for property in structDecl.properties { + collectClosureSignatures(from: property.type, into: &closureSignatures) + } + if let constructor = structDecl.constructor { + collectClosureSignatures(from: constructor.parameters, into: &closureSignatures) + } + for method in structDecl.methods { + collectClosureSignatures(from: method.parameters, into: &closureSignatures) + collectClosureSignatures(from: method.returnType, into: &closureSignatures) + } + } + for enumDecl in exported.enums { + for method in enumDecl.staticMethods { + collectClosureSignatures(from: method.parameters, into: &closureSignatures) + collectClosureSignatures(from: method.returnType, into: &closureSignatures) + } + for property in enumDecl.staticProperties { + collectClosureSignatures(from: property.type, into: &closureSignatures) + } + } + } + + if let imported = skeleton.imported { + for fileSkeleton in imported.children { + for getter in fileSkeleton.globalGetters { + collectClosureSignatures(from: getter.type, into: &closureSignatures) + } + for function in fileSkeleton.functions { + collectClosureSignatures(from: function.parameters, into: &closureSignatures) + collectClosureSignatures(from: function.returnType, into: &closureSignatures) + } + for type in fileSkeleton.types { + if let constructor = type.constructor { + collectClosureSignatures(from: constructor.parameters, into: &closureSignatures) + } + for getter in type.getters { + collectClosureSignatures(from: getter.type, into: &closureSignatures) + } + for setter in type.setters { + collectClosureSignatures(from: setter.type, into: &closureSignatures) + } + for method in type.methods { + collectClosureSignatures(from: method.parameters, into: &closureSignatures) + collectClosureSignatures(from: method.returnType, into: &closureSignatures) + } + } + } + } + + guard !closureSignatures.isEmpty else { return nil } + + var decls: [DeclSyntax] = [] + for signature in closureSignatures.sorted(by: { $0.mangleName < $1.mangleName }) { + decls.append(contentsOf: try renderClosureHelpers(signature)) + decls.append(try renderClosureInvokeHandler(signature)) + } + + let format = BasicFormat() + return decls.map { $0.formatted(using: format).description }.joined(separator: "\n\n") + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index b8790ec97..a40f9c2b6 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -47,30 +47,6 @@ public class ExportSwift { func renderSwiftGlue() throws -> String? { var decls: [DeclSyntax] = [] - let closureCodegen = ClosureCodegen() - var closureSignatures: Set = [] - for function in skeleton.functions { - closureCodegen.collectClosureSignatures(from: function.parameters, into: &closureSignatures) - closureCodegen.collectClosureSignatures(from: function.returnType, into: &closureSignatures) - } - for klass in skeleton.classes { - if let constructor = klass.constructor { - closureCodegen.collectClosureSignatures(from: constructor.parameters, into: &closureSignatures) - } - for method in klass.methods { - closureCodegen.collectClosureSignatures(from: method.parameters, into: &closureSignatures) - closureCodegen.collectClosureSignatures(from: method.returnType, into: &closureSignatures) - } - for property in klass.properties { - closureCodegen.collectClosureSignatures(from: property.type, into: &closureSignatures) - } - } - - for signature in closureSignatures.sorted(by: { $0.mangleName < $1.mangleName }) { - decls.append(contentsOf: try closureCodegen.renderClosureHelpers(signature)) - decls.append(try closureCodegen.renderClosureInvokeHandler(signature)) - } - let protocolCodegen = ProtocolCodegen() for proto in skeleton.protocols { decls.append(contentsOf: try protocolCodegen.renderProtocolWrapper(proto, moduleName: moduleName)) @@ -773,247 +749,6 @@ public class ExportSwift { } } -// MARK: - ClosureCodegen - -struct ClosureCodegen { - func collectClosureSignatures(from parameters: [Parameter], into signatures: inout Set) { - for param in parameters { - collectClosureSignatures(from: param.type, into: &signatures) - } - } - - func collectClosureSignatures(from type: BridgeType, into signatures: inout Set) { - switch type { - case .closure(let signature): - signatures.insert(signature) - for paramType in signature.parameters { - collectClosureSignatures(from: paramType, into: &signatures) - } - collectClosureSignatures(from: signature.returnType, into: &signatures) - case .optional(let wrapped): - collectClosureSignatures(from: wrapped, into: &signatures) - default: - break - } - } - - func renderClosureHelpers(_ signature: ClosureSignature) throws -> [DeclSyntax] { - let mangledName = signature.mangleName - let helperName = "_BJS_Closure_\(mangledName)" - let boxClassName = "_BJS_ClosureBox_\(mangledName)" - - let closureParams = signature.parameters.enumerated().map { index, type in - "\(type.swiftType)" - }.joined(separator: ", ") - - let swiftEffects = (signature.isAsync ? " async" : "") + (signature.isThrows ? " throws" : "") - let swiftReturnType = signature.returnType.swiftType - let closureType = "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)" - - let externName = "invoke_js_callback_\(signature.moduleName)_\(mangledName)" - - // Use CallJSEmission to generate the callback invocation - let builder = ImportTS.CallJSEmission( - moduleName: "bjs", - abiName: externName, - context: .exportSwift - ) - - // Lower the callback parameter - try builder.lowerParameter(param: Parameter(label: nil, name: "callback", type: .jsObject(nil))) - - // Lower each closure parameter - for (index, paramType) in signature.parameters.enumerated() { - try builder.lowerParameter(param: Parameter(label: nil, name: "param\(index)", type: paramType)) - } - - // Generate the call and return value lifting - try builder.call(returnType: signature.returnType) - try builder.liftReturnValue(returnType: signature.returnType) - - // Get the body code - let bodyCode = builder.getBody() - - // Generate extern declaration using CallJSEmission - let externDecl = builder.renderImportDecl() - - let boxClassDecl: DeclSyntax = """ - private final class \(raw: boxClassName): _BridgedSwiftClosureBox { - let closure: \(raw: closureType) - init(_ closure: @escaping \(raw: closureType)) { - self.closure = closure - } - } - """ - - let helperEnumDecl = EnumDeclSyntax( - modifiers: DeclModifierListSyntax { - DeclModifierSyntax(name: .keyword(.private)) - }, - name: .identifier(helperName), - memberBlockBuilder: { - DeclSyntax( - FunctionDeclSyntax( - modifiers: DeclModifierListSyntax { - DeclModifierSyntax(name: .keyword(.static)) - }, - name: .identifier("bridgeJSLower"), - signature: FunctionSignatureSyntax( - parameterClause: FunctionParameterClauseSyntax { - FunctionParameterSyntax( - firstName: .wildcardToken(), - secondName: .identifier("closure"), - colon: .colonToken(), - type: TypeSyntax("@escaping \(raw: closureType)") - ) - }, - returnClause: ReturnClauseSyntax( - arrow: .arrowToken(), - type: IdentifierTypeSyntax(name: .identifier("UnsafeMutableRawPointer")) - ) - ), - body: CodeBlockSyntax { - "let box = \(raw: boxClassName)(closure)" - "return Unmanaged.passRetained(box).toOpaque()" - } - ) - ) - - DeclSyntax( - FunctionDeclSyntax( - modifiers: DeclModifierListSyntax { - DeclModifierSyntax(name: .keyword(.static)) - }, - name: .identifier("bridgeJSLift"), - signature: FunctionSignatureSyntax( - parameterClause: FunctionParameterClauseSyntax { - FunctionParameterSyntax( - firstName: .wildcardToken(), - secondName: .identifier("callbackId"), - colon: .colonToken(), - type: IdentifierTypeSyntax(name: .identifier("Int32")) - ) - }, - returnClause: ReturnClauseSyntax( - arrow: .arrowToken(), - type: IdentifierTypeSyntax(name: .identifier(closureType)) - ) - ), - body: CodeBlockSyntax { - "let callback = JSObject.bridgeJSLiftParameter(callbackId)" - ReturnStmtSyntax( - expression: ClosureExprSyntax( - leftBrace: .leftBraceToken(), - signature: ClosureSignatureSyntax( - capture: ClosureCaptureClauseSyntax( - leftSquare: .leftSquareToken(), - items: ClosureCaptureListSyntax { - #if canImport(SwiftSyntax602) - ClosureCaptureSyntax( - name: .identifier("", presence: .missing), - initializer: InitializerClauseSyntax( - equal: .equalToken(presence: .missing), - nil, - value: ExprSyntax("callback") - ), - trailingTrivia: nil - ) - #else - ClosureCaptureSyntax( - expression: ExprSyntax("callback") - ) - #endif - }, - rightSquare: .rightSquareToken() - ), - parameterClause: .simpleInput( - ClosureShorthandParameterListSyntax { - for (index, _) in signature.parameters.enumerated() { - ClosureShorthandParameterSyntax(name: .identifier("param\(index)")) - } - } - ), - inKeyword: .keyword(.in) - ), - statements: CodeBlockItemListSyntax { - SwiftCodePattern.buildWasmConditionalCompilation(wasmBody: bodyCode.statements) - }, - rightBrace: .rightBraceToken() - ) - ) - } - ) - ) - } - ) - return [externDecl, boxClassDecl, DeclSyntax(helperEnumDecl)] - } - - func renderClosureInvokeHandler(_ signature: ClosureSignature) throws -> DeclSyntax { - let boxClassName = "_BJS_ClosureBox_\(signature.mangleName)" - let abiName = "invoke_swift_closure_\(signature.moduleName)_\(signature.mangleName)" - - // Build ABI parameters directly with WasmCoreType (no string conversion needed) - var abiParams: [(name: String, type: WasmCoreType)] = [("boxPtr", .pointer)] - var liftedParams: [String] = [] - - for (index, paramType) in signature.parameters.enumerated() { - let paramName = "param\(index)" - let liftInfo = try paramType.liftParameterInfo() - - for (argName, wasmType) in liftInfo.parameters { - let fullName = - liftInfo.parameters.count > 1 ? "\(paramName)\(argName.capitalizedFirstLetter)" : paramName - abiParams.append((fullName, wasmType)) - } - - let argNames = liftInfo.parameters.map { (argName, _) in - liftInfo.parameters.count > 1 ? "\(paramName)\(argName.capitalizedFirstLetter)" : paramName - } - liftedParams.append("\(paramType.swiftType).bridgeJSLiftParameter(\(argNames.joined(separator: ", ")))") - } - - let closureCallExpr = ExprSyntax("box.closure(\(raw: liftedParams.joined(separator: ", ")))") - - // Determine return type - let abiReturnWasmType: WasmCoreType? - if signature.returnType == .void { - abiReturnWasmType = nil - } else if let wasmType = try signature.returnType.loweringReturnInfo().returnType { - abiReturnWasmType = wasmType - } else { - abiReturnWasmType = nil - } - - // Build signature using SwiftSignatureBuilder - let funcSignature = SwiftSignatureBuilder.buildABIFunctionSignature( - abiParameters: abiParams, - returnType: abiReturnWasmType - ) - - // Build body - let body = CodeBlockItemListSyntax { - "let box = Unmanaged<\(raw: boxClassName)>.fromOpaque(boxPtr).takeUnretainedValue()" - if signature.returnType == .void { - closureCallExpr - } else { - "let result = \(closureCallExpr)" - "return result.bridgeJSLowerReturn()" - } - } - - // Build function declaration using helper - let funcDecl = SwiftCodePattern.buildExposedFunctionDecl( - abiName: abiName, - signature: funcSignature, - body: body - ) - - return DeclSyntax(funcDecl) - } - -} - // MARK: - StackCodegen /// Helper for stack-based lifting and lowering operations. diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 27f5a7c51..b824bf8d8 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -30,6 +30,7 @@ public struct ImportTS { /// Finalizes the import process and generates Swift code public func finalize() throws -> String? { var decls: [DeclSyntax] = [] + for skeleton in self.skeleton.children { for getter in skeleton.globalGetters { let getterDecls = try renderSwiftGlobalGetter(getter, topLevelDecls: &decls) @@ -97,6 +98,16 @@ public struct ImportTS { "\(param.name)\($0.name.capitalizedFirstLetter)" } + let initializerExpr: ExprSyntax + switch param.type { + case .closure(let signature): + initializerExpr = ExprSyntax( + "_BJS_Closure_\(raw: signature.mangleName).bridgeJSLower(\(raw: param.name))" + ) + default: + initializerExpr = ExprSyntax("\(raw: param.name).bridgeJSLowerParameter()") + } + // Always add destructuring statement to body (unified for single and multiple) let pattern: PatternSyntax if destructuredNames.count == 1 { @@ -123,7 +134,7 @@ public struct ImportTS { PatternBindingSyntax( pattern: pattern, initializer: InitializerClauseSyntax( - value: ExprSyntax("\(raw: param.name).bridgeJSLowerParameter()") + value: initializerExpr ) ) } @@ -209,10 +220,15 @@ public struct ImportTS { } else { abiReturnType = liftingInfo.valueToLift let liftExpr: ExprSyntax - if liftingInfo.valueToLift != nil { - liftExpr = "\(raw: returnType.swiftType).bridgeJSLiftReturn(ret)" - } else { - liftExpr = "\(raw: returnType.swiftType).bridgeJSLiftReturn()" + switch returnType { + case .closure(let signature): + liftExpr = ExprSyntax("_BJS_Closure_\(raw: signature.mangleName).bridgeJSLift(ret)") + default: + if liftingInfo.valueToLift != nil { + liftExpr = "\(raw: returnType.swiftType).bridgeJSLiftReturn(ret)" + } else { + liftExpr = "\(raw: returnType.swiftType).bridgeJSLiftReturn()" + } } body.append( CodeBlockItemSyntax( @@ -543,13 +559,14 @@ struct SwiftSignatureBuilder { ) -> FunctionParameterClauseSyntax { return FunctionParameterClauseSyntax(parametersBuilder: { for param in parameters { + let paramTypeSyntax = buildParameterTypeSyntax(from: param.type) if useWildcardLabels { // Always use wildcard labels: "_ name: Type" FunctionParameterSyntax( firstName: .wildcardToken(), secondName: .identifier(param.name), colon: .colonToken(), - type: buildTypeSyntax(from: param.type) + type: paramTypeSyntax ) } else { let label = param.label ?? param.name @@ -559,7 +576,7 @@ struct SwiftSignatureBuilder { firstName: .identifier(label), secondName: nil, colon: .colonToken(), - type: buildTypeSyntax(from: param.type) + type: paramTypeSyntax ) } else if param.label == nil { // No label specified: use wildcard "_ name: Type" @@ -567,7 +584,7 @@ struct SwiftSignatureBuilder { firstName: .wildcardToken(), secondName: .identifier(param.name), colon: .colonToken(), - type: buildTypeSyntax(from: param.type) + type: paramTypeSyntax ) } else { // External label differs: "label count: Int" @@ -575,7 +592,7 @@ struct SwiftSignatureBuilder { firstName: .identifier(label), secondName: .identifier(param.name), colon: .colonToken(), - type: buildTypeSyntax(from: param.type) + type: paramTypeSyntax ) } } @@ -653,6 +670,18 @@ struct SwiftSignatureBuilder { let identifierType = IdentifierTypeSyntax(name: .identifier(type.swiftType)) return TypeSyntax(identifierType) } + + /// Builds a parameter type syntax from a BridgeType. + /// + /// Swift closure parameters must be `@escaping` because they are boxed and can be invoked from JavaScript. + static func buildParameterTypeSyntax(from type: BridgeType) -> TypeSyntax { + switch type { + case .closure: + return TypeSyntax("@escaping \(raw: type.swiftType)") + default: + return buildTypeSyntax(from: type) + } + } } enum SwiftCodePattern { @@ -844,7 +873,8 @@ extension BridgeType { case .jsObject: return .jsObject case .void: return .void case .closure: - throw BridgeJSCoreError("Closure types are not yet supported in TypeScript imports") + // Swift closure is boxed and passed to JS as a pointer. + return LoweringParameterInfo(loweredParameters: [("pointer", .pointer)]) case .swiftHeapObject(let className): switch context { case .importTS: @@ -927,7 +957,8 @@ extension BridgeType { case .jsObject: return .jsObject case .void: return .void case .closure: - throw BridgeJSCoreError("Closure types are not yet supported in TypeScript imports") + // JS returns a callback ID for closures, which Swift lifts to a typed closure. + return LiftingReturnInfo(valueToLift: .i32) case .swiftHeapObject(let className): switch context { case .importTS: diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 625bfc364..929e6e4cd 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -589,10 +589,14 @@ public struct BridgeJSLink { printer.write("}") for unified in skeletons { - guard let skeleton = unified.exported else { continue } let moduleName = unified.moduleName var closureSignatures: Set = [] - collectClosureSignatures(from: skeleton, into: &closureSignatures) + if let exported = unified.exported { + collectClosureSignatures(from: exported, into: &closureSignatures) + } + if let imported = unified.imported { + collectClosureSignatures(from: imported, into: &closureSignatures) + } guard !closureSignatures.isEmpty else { continue } @@ -640,6 +644,36 @@ public struct BridgeJSLink { } } + private func collectClosureSignatures( + from skeleton: ImportedModuleSkeleton, + into signatures: inout Set + ) { + for fileSkeleton in skeleton.children { + for getter in fileSkeleton.globalGetters { + collectClosureSignatures(from: getter.type, into: &signatures) + } + for function in fileSkeleton.functions { + collectClosureSignatures(from: function.parameters, into: &signatures) + collectClosureSignatures(from: function.returnType, into: &signatures) + } + for type in fileSkeleton.types { + if let constructor = type.constructor { + collectClosureSignatures(from: constructor.parameters, into: &signatures) + } + for getter in type.getters { + collectClosureSignatures(from: getter.type, into: &signatures) + } + for setter in type.setters { + collectClosureSignatures(from: setter.type, into: &signatures) + } + for method in type.methods { + collectClosureSignatures(from: method.parameters, into: &signatures) + collectClosureSignatures(from: method.returnType, into: &signatures) + } + } + } + } + private func collectClosureSignatures(from parameters: [Parameter], into signatures: inout Set) { for param in parameters { collectClosureSignatures(from: param.type, into: &signatures) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 944c1659b..d9223faf8 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -1459,8 +1459,14 @@ struct IntrinsicJSFragment: Sendable { } ) } - case .closure: - throw BridgeJSLinkError(message: "Closure parameters not yet implemented for imported JS functions") + case .closure(let signature): + let lowerFuncName = "lower_closure_\(signature.moduleName)_\(signature.mangleName)" + return IntrinsicJSFragment( + parameters: ["boxPtr"], + printCode: { arguments, scope, printer, cleanupCode in + return ["bjs[\"\(lowerFuncName)\"](\(arguments[0]))"] + } + ) case .namespaceEnum(let string): throw BridgeJSLinkError( message: @@ -1524,7 +1530,18 @@ struct IntrinsicJSFragment: Sendable { return swiftStructLowerReturn(fullName: fullName) } case .closure: - throw BridgeJSLinkError(message: "Closure return values not yet implemented for imported JS functions") + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanupCode in + let value = arguments[0] + printer.write("if (typeof \(value) !== \"function\") {") + printer.indent { + printer.write("throw new TypeError(\"Expected a function\")") + } + printer.write("}") + return ["\(JSGlueVariableScope.reservedSwift).memory.retain(\(value))"] + } + ) case .namespaceEnum(let string): throw BridgeJSLinkError( message: "Namespace enums are not supported to be returned from imported JS functions: \(string)" diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index f75c7b758..3fb7f8114 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -152,15 +152,22 @@ import BridgeJSUtilities } var importer: ImportTS? if let skeleton = skeleton.imported { - importer = ImportTS(progress: progress, moduleName: moduleName, skeleton: skeleton) + importer = ImportTS( + progress: progress, + moduleName: moduleName, + skeleton: skeleton + ) } + // Generate unified closure support for both import/export to avoid duplicate symbols when concatenating. + let closureSupport = try ClosureCodegen().renderSupport(for: skeleton) + let importResult = try importer?.finalize() let exportResult = try exporter?.finalize() // Combine and write unified Swift output let outputSwiftURL = outputDirectory.appending(path: "BridgeJS.swift") - let combinedSwift = [exportResult, importResult].compactMap { $0 } + let combinedSwift = [closureSupport, exportResult, importResult].compactMap { $0 } let outputSwift = combineGeneratedSwift(combinedSwift) let shouldWrite = doubleDashOptions["always-write"] == "true" || !outputSwift.isEmpty if shouldWrite { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift index fd86a2ad7..fb31ac837 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift @@ -15,8 +15,17 @@ import Testing sourceLocation: Testing.SourceLocation = #_sourceLocation ) throws { guard let exported = skeleton.exported else { return } - let exportSwift = ExportSwift(progress: .silent, moduleName: skeleton.moduleName, skeleton: exported) - let outputSwift = try #require(try exportSwift.finalize()) + let exportSwift = ExportSwift( + progress: .silent, + moduleName: skeleton.moduleName, + skeleton: exported + ) + let closureSupport = try ClosureCodegen().renderSupport(for: skeleton) + let exportResult = try #require(try exportSwift.finalize()) + let outputSwift = ([closureSupport, exportResult] as [String?]) + .compactMap { $0?.trimmingCharacters(in: .newlines) } + .filter { !$0.isEmpty } + .joined(separator: "\n\n") try assertSnapshot( name: name, filePath: filePath, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftClosureImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftClosureImports.swift new file mode 100644 index 000000000..6efd641b9 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftClosureImports.swift @@ -0,0 +1,4 @@ +@JSFunction func applyInt(_ value: Int, _ transform: (Int) -> Int) throws(JSException) -> Int + +@JSFunction func makeAdder(_ base: Int) throws(JSException) -> (Int) -> Int + diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift index 158e4511e..89c7dd11d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift @@ -3,11 +3,14 @@ import Foundation import SwiftParser @testable import BridgeJSCore @testable import TS2Swift +@testable import BridgeJSSkeleton @Suite struct ImportTSTests { static let inputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent().appendingPathComponent( "Inputs" ) + static let importMacroInputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent() + .appendingPathComponent("ImportMacroInputs") static func collectInputs() -> [String] { let fileManager = FileManager.default @@ -15,6 +18,12 @@ import SwiftParser return inputs.filter { $0.hasSuffix(".d.ts") } } + static func collectImportMacroInputs() -> [String] { + let fileManager = FileManager.default + let inputs = try! fileManager.contentsOfDirectory(atPath: Self.importMacroInputsDirectory.path) + return inputs.filter { $0.hasSuffix(".swift") } + } + @Test(arguments: collectInputs()) func snapshot(input: String) throws { let url = Self.inputsDirectory.appendingPathComponent(input) @@ -44,7 +53,14 @@ import SwiftParser guard let imported = skeleton.imported else { return } let importTS = ImportTS(progress: .silent, moduleName: "Check", skeleton: imported) - let outputSwift = try #require(try importTS.finalize()) + let importResult = try #require(try importTS.finalize()) + let closureSupport = try ClosureCodegen().renderSupport( + for: BridgeJSSkeleton(moduleName: "Check", imported: imported) + ) + let outputSwift = ([closureSupport, importResult] as [String?]) + .compactMap { $0?.trimmingCharacters(in: .newlines) } + .filter { !$0.isEmpty } + .joined(separator: "\n\n") try assertSnapshot( name: name, filePath: #filePath, @@ -53,4 +69,33 @@ import SwiftParser fileExtension: "swift" ) } + + @Test(arguments: collectImportMacroInputs()) + func snapshotImportMacroInput(input: String) throws { + let url = Self.importMacroInputsDirectory.appendingPathComponent(input) + let name = url.deletingPathExtension().lastPathComponent + + let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) + let importSwift = SwiftToSkeleton(progress: .silent, moduleName: "Check", exposeToGlobal: false) + importSwift.addSourceFile(sourceFile, inputFilePath: "\(name).swift") + let skeleton = try importSwift.finalize() + + guard let imported = skeleton.imported else { return } + let importTS = ImportTS(progress: .silent, moduleName: "Check", skeleton: imported) + let importResult = try #require(try importTS.finalize()) + let closureSupport = try ClosureCodegen().renderSupport( + for: BridgeJSSkeleton(moduleName: "Check", imported: imported) + ) + let outputSwift = ([closureSupport, importResult] as [String?]) + .compactMap { $0?.trimmingCharacters(in: .newlines) } + .filter { !$0.isEmpty } + .joined(separator: "\n\n") + try assertSnapshot( + name: name + ".ImportMacros", + filePath: #filePath, + function: #function, + input: outputSwift.data(using: .utf8)!, + fileExtension: "swift" + ) + } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.d.ts new file mode 100644 index 000000000..ebf493910 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.d.ts @@ -0,0 +1,19 @@ +// 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 type Exports = { +} +export type Imports = { + applyInt(value: number, transform: (arg0: number) => number): number; + makeAdder(base: number): (arg0: number) => number; +} +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/SwiftClosureImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js new file mode 100644 index 000000000..db434c2ab --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js @@ -0,0 +1,257 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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["invoke_js_callback_TestModule_10TestModuleSi_Si"] = function(callbackId, param0Id) { + try { + const callback = swift.memory.getObject(callbackId); + let param0 = param0Id; + const result = callback(param0); + return result | 0; + } catch (error) { + setException?.(error); + return 0; + } + }; + + bjs["lower_closure_TestModule_10TestModuleSi_Si"] = function(closurePtr) { + return function(param0) { + try { + return instance.exports.invoke_swift_closure_TestModule_10TestModuleSi_Si(closurePtr, param0) | 0; + } catch (error) { + setException?.(error); + throw error; + } + }; + }; + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_applyInt"] = function bjs_applyInt(value, transform) { + try { + let ret = imports.applyInt(value, bjs["lower_closure_TestModule_10TestModuleSi_Si"](transform)); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_makeAdder"] = function bjs_makeAdder(base) { + try { + let ret = imports.makeAdder(base); + if (typeof ret !== "function") { + throw new TypeError("Expected a function") + } + return swift.memory.retain(ret); + } catch (error) { + setException(error); + return 0 + } + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + const exports = { + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalGetter.ImportMacros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalGetter.ImportMacros.swift new file mode 100644 index 000000000..b5442b09e --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalGetter.ImportMacros.swift @@ -0,0 +1,34 @@ +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_console_get") +fileprivate func bjs_console_get() -> Int32 +#else +fileprivate func bjs_console_get() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$console_get() throws(JSException) -> JSConsole { + let ret = bjs_console_get() + if let error = _swift_js_take_exception() { + throw error + } + return JSConsole.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_JSConsole_log") +fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void +#else +fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$JSConsole_log(_ self: JSObject, _ message: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let messageValue = message.bridgeJSLowerParameter() + bjs_JSConsole_log(selfValue, messageValue) + if let error = _swift_js_take_exception() { + throw error + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftClosureImports.ImportMacros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftClosureImports.ImportMacros.swift new file mode 100644 index 000000000..d1a4c4a54 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftClosureImports.ImportMacros.swift @@ -0,0 +1,84 @@ +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_Check_5CheckSi_Si") +fileprivate func invoke_js_callback_Check_5CheckSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_Check_5CheckSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +private final class _BJS_ClosureBox_5CheckSi_Si: _BridgedSwiftClosureBox { + let closure: (Int) -> Int + init(_ closure: @escaping (Int) -> Int) { + self.closure = closure + } +} + +private enum _BJS_Closure_5CheckSi_Si { + static func bridgeJSLower(_ closure: @escaping (Int) -> Int) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_5CheckSi_Si(closure) + return Unmanaged.passRetained(box).toOpaque() + } + 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_Check_5CheckSi_Si(callbackValue, param0Value) + return Int.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +@_expose(wasm, "invoke_swift_closure_Check_5CheckSi_Si") +@_cdecl("invoke_swift_closure_Check_5CheckSi_Si") +public func _invoke_swift_closure_Check_5CheckSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { + #if arch(wasm32) + let box = Unmanaged<_BJS_ClosureBox_5CheckSi_Si>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.closure(Int.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_applyInt") +fileprivate func bjs_applyInt(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func bjs_applyInt(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$applyInt(_ value: Int, _ transform: (Int) -> Int) throws(JSException) -> Int { + let valueValue = value.bridgeJSLowerParameter() + let transformPointer = _BJS_Closure_5CheckSi_Si.bridgeJSLower(transform) + let ret = bjs_applyInt(valueValue, transformPointer) + if let error = _swift_js_take_exception() { + throw error + } + return Int.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_makeAdder") +fileprivate func bjs_makeAdder(_ base: Int32) -> Int32 +#else +fileprivate func bjs_makeAdder(_ base: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$makeAdder(_ base: Int) throws(JSException) -> (Int) -> Int { + let baseValue = base.bridgeJSLowerParameter() + let ret = bjs_makeAdder(baseValue) + if let error = _swift_js_take_exception() { + throw error + } + return _BJS_Closure_5CheckSi_Si.bridgeJSLift(ret) +} \ No newline at end of file From 987b0889a2a448a294c59ee68f0455b0c2166978 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 26 Jan 2026 18:34:32 +0800 Subject: [PATCH 092/252] Restrict @JSClass to structs (#523) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated `@JSClass` macro to emit an error unless it’s attached to a `struct` (`Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift:13`). - Added new diagnostic message `@JSClass can only be applied to structs.` (`Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift:8`). - Updated macro expansion tests so `class`/`enum`/`actor` usages now produce diagnostics and no generated members/extensions (`Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift:147`). - Verified with `swift test --package-path ./Plugins/BridgeJS --filter BridgeJSMacrosTests`. --- .../Sources/BridgeJSMacros/JSClassMacro.swift | 8 ++++ .../BridgeJSMacros/JSMacroSupport.swift | 1 + .../JSClassMacroTests.swift | 45 +++++++++---------- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift index 060d2269b..8a3f83f05 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift @@ -12,6 +12,13 @@ extension JSClassMacro: MemberMacro { conformingTo protocols: [TypeSyntax], in context: some MacroExpansionContext ) throws -> [DeclSyntax] { + guard declaration.is(StructDeclSyntax.self) else { + context.diagnose( + Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedJSClassDeclaration) + ) + return [] + } + var members: [DeclSyntax] = [] let existingMembers = declaration.memberBlock.members @@ -59,6 +66,7 @@ extension JSClassMacro: ExtensionMacro { conformingTo protocols: [TypeSyntax], in context: some MacroExpansionContext ) throws -> [ExtensionDeclSyntax] { + guard declaration.is(StructDeclSyntax.self) else { return [] } guard !protocols.isEmpty else { return [] } let conformanceList = protocols.map { $0.trimmed.description }.joined(separator: ", ") diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift index b10871f6a..59fa1c4c2 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift @@ -5,6 +5,7 @@ import SwiftDiagnostics enum JSMacroMessage: String, DiagnosticMessage { case unsupportedDeclaration = "@JSFunction can only be applied to functions or initializers." + case unsupportedJSClassDeclaration = "@JSClass can only be applied to structs." case unsupportedVariable = "@JSGetter can only be applied to single-variable declarations." case unsupportedSetterDeclaration = "@JSSetter can only be applied to functions." case invalidSetterName = diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift index 95e3893ed..b27b93941 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift @@ -153,16 +153,15 @@ import BridgeJSMacros """, expandedSource: """ class MyClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - } - - extension MyClass: _JSBridgedClass { } """, + diagnostics: [ + DiagnosticSpec( + message: "@JSClass can only be applied to structs.", + line: 1, + column: 1 + ) + ], macroSpecs: macroSpecs, indentationWidth: indentationWidth ) @@ -177,16 +176,15 @@ import BridgeJSMacros """, expandedSource: """ enum MyEnum { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - } - - extension MyEnum: _JSBridgedClass { } """, + diagnostics: [ + DiagnosticSpec( + message: "@JSClass can only be applied to structs.", + line: 1, + column: 1 + ) + ], macroSpecs: macroSpecs, indentationWidth: indentationWidth ) @@ -201,16 +199,15 @@ import BridgeJSMacros """, expandedSource: """ actor MyActor { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - } - - extension MyActor: _JSBridgedClass { } """, + diagnostics: [ + DiagnosticSpec( + message: "@JSClass can only be applied to structs.", + line: 1, + column: 1 + ) + ], macroSpecs: macroSpecs, indentationWidth: indentationWidth ) From cef2d6fa9423370cca1e53a2c1d20b9daf1ffee6 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 26 Jan 2026 19:07:16 +0900 Subject: [PATCH 093/252] Runtime tests: cover imported JS closures Add runtime import fixtures and tests for passing Swift closures into JS and receiving JS functions back as Swift closures. --- .../SwiftClosureImports.swift | 1 - .../SwiftClosureImports.ImportMacros.swift | 2 +- .../Generated/BridgeJS.swift | 139 ++++++++++++ .../Generated/JavaScript/BridgeJS.json | 206 ++++++++++++++++++ .../BridgeJSRuntimeTests/ImportAPITests.swift | 30 +++ .../ImportClosureAPIs.swift | 11 + Tests/prelude.mjs | 19 +- 7 files changed, 405 insertions(+), 3 deletions(-) create mode 100644 Tests/BridgeJSRuntimeTests/ImportClosureAPIs.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftClosureImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftClosureImports.swift index 6efd641b9..d9f92fffb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftClosureImports.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftClosureImports.swift @@ -1,4 +1,3 @@ @JSFunction func applyInt(_ value: Int, _ transform: (Int) -> Int) throws(JSException) -> Int @JSFunction func makeAdder(_ base: Int) throws(JSException) -> (Int) -> Int - diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftClosureImports.ImportMacros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftClosureImports.ImportMacros.swift index d1a4c4a54..9e0959157 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftClosureImports.ImportMacros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftClosureImports.ImportMacros.swift @@ -55,7 +55,7 @@ fileprivate func bjs_applyInt(_ value: Int32, _ transform: UnsafeMutableRawPoint } #endif -func _$applyInt(_ value: Int, _ transform: (Int) -> Int) throws(JSException) -> Int { +func _$applyInt(_ value: Int, _ transform: @escaping (Int) -> Int) throws(JSException) -> Int { let valueValue = value.bridgeJSLowerParameter() let transformPointer = _BJS_Closure_5CheckSi_Si.bridgeJSLower(transform) let ret = bjs_applyInt(valueValue, transformPointer) diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 1b39e77b8..ad0357d4e 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -537,6 +537,52 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_ #endif } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(_ callback: Int32, _ param0: Int32) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(_ callback: Int32, _ param0: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSi_y: _BridgedSwiftClosureBox { + let closure: (Int) -> Void + init(_ closure: @escaping (Int) -> Void) { + self.closure = closure + } +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSi_y { + static func bridgeJSLower(_ closure: @escaping (Int) -> Void) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSi_y(closure) + return Unmanaged.passRetained(box).toOpaque() + } + 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 + } + } +} + +@_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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSi_y>.fromOpaque(boxPtr).takeUnretainedValue() + box.closure(Int.bridgeJSLiftParameter(param0)) + #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(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 @@ -6431,4 +6477,97 @@ func _$JsGreeter_changeName(_ self: JSObject, _ name: String) throws(JSException if let error = _swift_js_take_exception() { throw error } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsApplyInt") +fileprivate func bjs_jsApplyInt(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func bjs_jsApplyInt(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsApplyInt(_ value: Int, _ transform: @escaping (Int) -> Int) throws(JSException) -> Int { + let valueValue = value.bridgeJSLowerParameter() + let transformPointer = _BJS_Closure_20BridgeJSRuntimeTestsSi_Si.bridgeJSLower(transform) + let ret = bjs_jsApplyInt(valueValue, transformPointer) + if let error = _swift_js_take_exception() { + throw error + } + return Int.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsMakeAdder") +fileprivate func bjs_jsMakeAdder(_ base: Int32) -> Int32 +#else +fileprivate func bjs_jsMakeAdder(_ base: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsMakeAdder(_ base: Int) throws(JSException) -> (Int) -> Int { + let baseValue = base.bridgeJSLowerParameter() + let ret = bjs_jsMakeAdder(baseValue) + if let error = _swift_js_take_exception() { + throw error + } + return _BJS_Closure_20BridgeJSRuntimeTestsSi_Si.bridgeJSLift(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsMapString") +fileprivate func bjs_jsMapString(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func bjs_jsMapString(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsMapString(_ value: String, _ transform: @escaping (String) -> String) throws(JSException) -> String { + let valueValue = value.bridgeJSLowerParameter() + let transformPointer = _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(transform) + let ret = bjs_jsMapString(valueValue, transformPointer) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsMakePrefixer") +fileprivate func bjs_jsMakePrefixer(_ prefix: Int32) -> Int32 +#else +fileprivate func bjs_jsMakePrefixer(_ prefix: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsMakePrefixer(_ prefix: String) throws(JSException) -> (String) -> String { + let prefixValue = prefix.bridgeJSLowerParameter() + let ret = bjs_jsMakePrefixer(prefixValue) + if let error = _swift_js_take_exception() { + throw error + } + return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsCallTwice") +fileprivate func bjs_jsCallTwice(_ value: Int32, _ callback: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func bjs_jsCallTwice(_ value: Int32, _ callback: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsCallTwice(_ value: Int, _ callback: @escaping (Int) -> Void) throws(JSException) -> Int { + let valueValue = value.bridgeJSLowerParameter() + let callbackPointer = _BJS_Closure_20BridgeJSRuntimeTestsSi_y.bridgeJSLower(callback) + let ret = bjs_jsCallTwice(valueValue, callbackPointer) + if let error = _swift_js_take_exception() { + throw error + } + return Int.bridgeJSLiftReturn(ret) } \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 727508f3c..de90f183c 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -9174,6 +9174,212 @@ ], "types" : [ + ] + }, + { + "functions" : [ + { + "name" : "jsApplyInt", + "parameters" : [ + { + "name" : "value", + "type" : { + "int" : { + + } + } + }, + { + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "name" : "jsMakeAdder", + "parameters" : [ + { + "name" : "base", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + }, + { + "name" : "jsMapString", + "parameters" : [ + { + "name" : "value", + "type" : { + "string" : { + + } + } + }, + { + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "name" : "jsMakePrefixer", + "parameters" : [ + { + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "name" : "jsCallTwice", + "parameters" : [ + { + "name" : "value", + "type" : { + "int" : { + + } + } + }, + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_y", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "void" : { + + } + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + } + ], + "types" : [ + ] } ] diff --git a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift index f0112ed1a..20f96c682 100644 --- a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift @@ -84,4 +84,34 @@ class ImportAPITests: XCTestCase { XCTAssertEqual(try greeter.prefix, "Hello") } + + func testClosureParameterIntToInt() throws { + let result = try jsApplyInt(21) { $0 * 2 } + XCTAssertEqual(result, 42) + } + + func testClosureReturnIntToInt() throws { + let add10 = try jsMakeAdder(10) + XCTAssertEqual(add10(0), 10) + XCTAssertEqual(add10(32), 42) + } + + func testClosureParameterStringToString() throws { + let result = try jsMapString("Hello") { value in + value + ", world!" + } + XCTAssertEqual(result, "Hello, world!") + } + + func testClosureReturnStringToString() throws { + let prefixer = try jsMakePrefixer("Hello, ") + XCTAssertEqual(prefixer("world!"), "Hello, world!") + } + + func testClosureParameterIntToVoid() throws { + var total = 0 + let ret = try jsCallTwice(5) { total += $0 } + XCTAssertEqual(ret, 5) + XCTAssertEqual(total, 10) + } } diff --git a/Tests/BridgeJSRuntimeTests/ImportClosureAPIs.swift b/Tests/BridgeJSRuntimeTests/ImportClosureAPIs.swift new file mode 100644 index 000000000..bb913300b --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/ImportClosureAPIs.swift @@ -0,0 +1,11 @@ +@_spi(Experimental) import JavaScriptKit + +@JSFunction func jsApplyInt(_ value: Int, _ transform: @escaping (Int) -> Int) throws(JSException) -> Int + +@JSFunction func jsMakeAdder(_ base: Int) throws(JSException) -> (Int) -> Int + +@JSFunction func jsMapString(_ value: String, _ transform: @escaping (String) -> String) throws(JSException) -> String + +@JSFunction func jsMakePrefixer(_ `prefix`: String) throws(JSException) -> (String) -> String + +@JSFunction func jsCallTwice(_ value: Int, _ callback: @escaping (Int) -> Void) throws(JSException) -> Int diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index a5611523c..1b1f1d2e0 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -71,6 +71,23 @@ export async function setupOptions(options, context) { } BridgeJSRuntimeTests_runAsyncWorks(exports); return; + }, + jsApplyInt: (v, fn) => { + return fn(v); + }, + jsMakeAdder: (base) => { + return (v) => base + v; + }, + jsMapString: (value, fn) => { + return fn(value); + }, + jsMakePrefixer: (prefix) => { + return (name) => `${prefix}${name}`; + }, + jsCallTwice: (v, fn) => { + fn(v); + fn(v); + return v; } }; }, @@ -241,7 +258,7 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(ph.intValue, 777); // Should have parsed and set intValue assert.equal(ph.computedReadWrite, "Value: 777"); - // Test computed readonly property + // Test computed readonly property assert.equal(ph.computedReadonly, 1554); // intValue * 2 = 777 * 2 // Test property with observers From ed57d5e6be2e58da66f2a35e684e80b2567079cf Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 27 Jan 2026 01:23:12 +0900 Subject: [PATCH 094/252] =?UTF-8?q?-=20Added=20`@JSGetter(jsName:=20String?= =?UTF-8?q?=3F=20=3D=20nil)`=20so=20generated=20getters=20can=20target=20n?= =?UTF-8?q?on-Swift/quoted=20JS=20property=20names=20(`Sources/JavaScriptK?= =?UTF-8?q?it/Macros.swift`).=20-=20Plumbed=20`jsName`=20through=20the=20i?= =?UTF-8?q?mported-property=20IR=20(`Plugins/BridgeJS/Sources/BridgeJSSkel?= =?UTF-8?q?eton/BridgeJSSkeleton.swift`)=20and=20extraction=20(`Plugins/Br?= =?UTF-8?q?idgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift`).=20-=20Upda?= =?UTF-8?q?ted=20TS=E2=86=92Swift=20generation=20to=20no=20longer=20drop?= =?UTF-8?q?=20quoted/invalid=20TS=20property=20names;=20it=20now=20emits?= =?UTF-8?q?=20Swift-safe=20identifiers=20plus=20`@JSGetter(jsName:=20...)`?= =?UTF-8?q?=20/=20`@JSSetter(jsName:=20...)`=20as=20needed=20(`Plugins/Bri?= =?UTF-8?q?dgeJS/Sources/TS2Swift/JavaScript/src/processor.js`).=20-=20Upd?= =?UTF-8?q?ated=20JS=20glue=20+=20generated=20`.d.ts`=20to=20use=20bracket?= =?UTF-8?q?=20property=20access=20and=20quote=20invalid=20TS=20property=20?= =?UTF-8?q?keys=20(`Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swi?= =?UTF-8?q?ft`).=20-=20Updated=20snapshots;=20`swift=20test=20--package-pa?= =?UTF-8?q?th=20./Plugins/BridgeJS`=20now=20passes=20(requires=20`npm=20ci?= =?UTF-8?q?`=20at=20repo=20root=20to=20provide=20`typescript`).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BridgeJSCore/SwiftToSkeleton.swift | 39 ++-- .../Sources/BridgeJSLink/BridgeJSLink.swift | 54 ++++-- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 8 + .../TS2Swift/JavaScript/src/processor.js | 33 ++-- .../InvalidPropertyNames.Import.d.ts | 5 + .../InvalidPropertyNames.Import.js | 98 +++++++++- .../MultipleImportedTypes.Import.js | 10 +- .../BridgeJSLinkTests/Protocol.Export.js | 42 ++-- .../TS2SkeletonLike.Import.js | 4 +- .../TypeScriptClass.Import.js | 6 +- .../InvalidPropertyNames.Macros.swift | 10 + .../ImportTSTests/InvalidPropertyNames.swift | 180 ++++++++++++++++++ Sources/JavaScriptKit/Macros.swift | 5 +- 13 files changed, 414 insertions(+), 80 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index f18788e7d..f09a9140a 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -1762,6 +1762,12 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { hasAttribute(attributes, name: "JSGetter") } + static func firstJSGetterAttribute(_ attributes: AttributeListSyntax?) -> AttributeSyntax? { + attributes?.first { attribute in + attribute.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JSGetter" + }?.as(AttributeSyntax.self) + } + static func hasJSSetterAttribute(_ attributes: AttributeListSyntax?) -> Bool { hasAttribute(attributes, name: "JSSetter") } @@ -1784,7 +1790,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } } - /// Extracts the jsName argument value from a @JSSetter attribute, if present. + /// Extracts the `jsName` argument value from an attribute, if present. static func extractJSName(from attribute: AttributeSyntax) -> String? { guard let arguments = attribute.arguments?.as(LabeledExprListSyntax.self) else { return nil @@ -1883,22 +1889,15 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { // MARK: - Property Name Resolution - /// Helper for resolving property names from setter function names and jsName attributes + /// Helper for resolving property names from setter function names. private struct PropertyNameResolver { - /// Resolves property name and function base name from a setter function and optional jsName - /// - Returns: (propertyName, functionBaseName) where propertyName preserves case for getter matching, - /// and functionBaseName has lowercase first char for ABI generation + /// Resolves property name and function base name from a setter function. + /// - Returns: (propertyName, functionBaseName) where `propertyName` is derived from the setter name, + /// and `functionBaseName` has lowercase first char for ABI generation. static func resolve( functionName: String, - jsName: String?, normalizeIdentifier: (String) -> String ) -> (propertyName: String, functionBaseName: String)? { - if let jsName = jsName { - let propertyName = normalizeIdentifier(jsName) - let functionBaseName = propertyName.prefix(1).lowercased() + propertyName.dropFirst() - return (propertyName: propertyName, functionBaseName: functionBaseName) - } - let rawFunctionName = functionName.hasPrefix("`") && functionName.hasSuffix("`") && functionName.count > 2 ? String(functionName.dropFirst().dropLast()) @@ -2065,10 +2064,13 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { guard AttributeChecker.hasJSGetterAttribute(node.attributes) else { return .visitChildren } + guard let jsGetter = AttributeChecker.firstJSGetterAttribute(node.attributes) else { + return .skipChildren + } switch state { case .topLevel: - if let getter = parseGetterSkeleton(node) { + if let getter = parseGetterSkeleton(jsGetter, node) { importedGlobalGetters.append(getter) } return .skipChildren @@ -2085,7 +2087,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { "@JSGetter is not supported for static members. Use it only for instance members in @JSClass types." ) ) - } else if let getter = parseGetterSkeleton(node) { + } else if let getter = parseGetterSkeleton(jsGetter, node) { type.getters.append(getter) currentType = type } @@ -2223,7 +2225,10 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { return (identifier, typeAnnotation.type) } - private func parseGetterSkeleton(_ node: VariableDeclSyntax) -> ImportedGetterSkeleton? { + private func parseGetterSkeleton( + _ jsGetter: AttributeSyntax, + _ node: VariableDeclSyntax + ) -> ImportedGetterSkeleton? { guard let (identifier, type) = extractPropertyInfo(node) else { return nil } @@ -2231,8 +2236,10 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { return nil } let propertyName = SwiftToSkeleton.normalizeIdentifier(identifier.identifier.text) + let jsName = AttributeChecker.extractJSName(from: jsGetter) return ImportedGetterSkeleton( name: propertyName, + jsName: jsName, type: propertyType, documentation: nil, functionName: nil @@ -2252,7 +2259,6 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { guard let (propertyName, functionBaseName) = PropertyNameResolver.resolve( functionName: functionName, - jsName: validation.jsName, normalizeIdentifier: SwiftToSkeleton.normalizeIdentifier ) else { @@ -2261,6 +2267,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { return ImportedSetterSkeleton( name: propertyName, + jsName: validation.jsName, type: validation.valueType, documentation: nil, functionName: "\(functionBaseName)_set" diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 929e6e4cd..bcb19320b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -1202,17 +1202,20 @@ public struct BridgeJSLink { // Add properties from getters var propertyNames = Set() for getter in type.getters { - propertyNames.insert(getter.name) - let hasSetter = type.setters.contains { $0.name == getter.name } + let propertyName = getter.jsName ?? getter.name + propertyNames.insert(propertyName) + let hasSetter = type.setters.contains { ($0.jsName ?? $0.name) == propertyName } let propertySignature = hasSetter - ? "\(getter.name): \(resolveTypeScriptType(getter.type));" - : "readonly \(getter.name): \(resolveTypeScriptType(getter.type));" + ? "\(renderTSPropertyName(propertyName)): \(resolveTypeScriptType(getter.type));" + : "readonly \(renderTSPropertyName(propertyName)): \(resolveTypeScriptType(getter.type));" printer.write(propertySignature) } // Add setters that don't have corresponding getters - for setter in type.setters where !propertyNames.contains(setter.name) { - printer.write("\(setter.name): \(resolveTypeScriptType(setter.type));") + for setter in type.setters { + let propertyName = setter.jsName ?? setter.name + guard !propertyNames.contains(propertyName) else { continue } + printer.write("\(renderTSPropertyName(propertyName)): \(resolveTypeScriptType(setter.type));") } printer.unindent() @@ -1387,6 +1390,20 @@ public struct BridgeJSLink { return "(\(parameterSignatures.joined(separator: ", "))): \(returnTypeWithEffect)" } + private func renderTSPropertyName(_ name: String) -> String { + // TypeScript allows quoted property names for keys that aren't valid identifiers. + if name.range(of: #"^[$A-Z_][0-9A-Z_$]*$"#, options: [.regularExpression, .caseInsensitive]) != nil { + return name + } + return "\"\(Self.escapeForJavaScriptStringLiteral(name))\"" + } + + fileprivate static func escapeForJavaScriptStringLiteral(_ string: String) -> String { + string + .replacingOccurrences(of: "\\", with: "\\\\") + .replacingOccurrences(of: "\"", with: "\\\"") + } + /// Helper method to append JSDoc comments for parameters with default values private func appendJSDocIfNeeded(for parameters: [Parameter], to lines: inout [String]) { let jsDocLines = DefaultValueUtils.formatJSDoc(for: parameters) @@ -2151,6 +2168,9 @@ extension BridgeJSLink { } func callPropertyGetter(name: String, returnType: BridgeType) throws -> String? { + let escapedName = BridgeJSLink.escapeForJavaScriptStringLiteral(name) + let accessExpr = + "\(JSGlueVariableScope.reservedSwift).memory.getObject(self)[\"\(escapedName)\"]" if context == .exportSwift, returnType.usesSideChannelForOptionalReturn() { guard case .optional(let wrappedType) = returnType else { fatalError("usesSideChannelForOptionalReturn returned true for non-optional type") @@ -2158,7 +2178,7 @@ extension BridgeJSLink { let resultVar = scope.variable("ret") body.write( - "let \(resultVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(self).\(name);" + "let \(resultVar) = \(accessExpr);" ) let fragment = try IntrinsicJSFragment.protocolPropertyOptionalToSideChannel(wrappedType: wrappedType) @@ -2168,14 +2188,15 @@ extension BridgeJSLink { } return try call( - callExpr: "\(JSGlueVariableScope.reservedSwift).memory.getObject(self).\(name)", + callExpr: accessExpr, returnType: returnType ) } func callPropertySetter(name: String, returnType: BridgeType) { + let escapedName = BridgeJSLink.escapeForJavaScriptStringLiteral(name) let call = - "\(JSGlueVariableScope.reservedSwift).memory.getObject(self).\(name) = \(parameterForwardings.joined(separator: ", "))" + "\(JSGlueVariableScope.reservedSwift).memory.getObject(self)[\"\(escapedName)\"] = \(parameterForwardings.joined(separator: ", "))" body.write("\(call);") } @@ -2185,7 +2206,8 @@ extension BridgeJSLink { } let loweringFragment = try IntrinsicJSFragment.lowerReturn(type: returnType, context: context) - let expr = "imports[\"\(name)\"]" + let escapedName = BridgeJSLink.escapeForJavaScriptStringLiteral(name) + let expr = "imports[\"\(escapedName)\"]" let returnExpr: String? if loweringFragment.parameters.count == 0 { @@ -2948,14 +2970,15 @@ extension BridgeJSLink { getter: ImportedGetterSkeleton ) throws { let thunkBuilder = ImportedThunkBuilder() - let returnExpr = try thunkBuilder.getImportProperty(name: getter.name, returnType: getter.type) + let jsName = getter.jsName ?? getter.name + let returnExpr = try thunkBuilder.getImportProperty(name: jsName, returnType: getter.type) let abiName = getter.abiName(context: nil) let funcLines = thunkBuilder.renderFunction( name: abiName, returnExpr: returnExpr, returnType: getter.type ) - importObjectBuilder.appendDts(["readonly \(getter.name): \(getter.type.tsType);"]) + importObjectBuilder.appendDts(["readonly \(renderTSPropertyName(jsName)): \(getter.type.tsType);"]) importObjectBuilder.assignToImportObject(name: abiName, function: funcLines) } @@ -2976,7 +2999,10 @@ extension BridgeJSLink { getter: getter, abiName: getterAbiName, emitCall: { thunkBuilder in - return try thunkBuilder.callPropertyGetter(name: getter.name, returnType: getter.type) + return try thunkBuilder.callPropertyGetter( + name: getter.jsName ?? getter.name, + returnType: getter.type + ) } ) importObjectBuilder.assignToImportObject(name: getterAbiName, function: js) @@ -2992,7 +3018,7 @@ extension BridgeJSLink { try thunkBuilder.liftParameter( param: Parameter(label: nil, name: "newValue", type: setter.type) ) - thunkBuilder.callPropertySetter(name: setter.name, returnType: setter.type) + thunkBuilder.callPropertySetter(name: setter.jsName ?? setter.name, returnType: setter.type) return nil } ) diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 28e4b6dcd..7040d607d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -626,6 +626,8 @@ public struct ImportedConstructorSkeleton: Codable { public struct ImportedGetterSkeleton: Codable { public let name: String + /// The JavaScript property name to read from, if different from `name`. + public let jsName: String? public let type: BridgeType public let documentation: String? /// Name of the getter function if it's a separate function (from @JSGetter) @@ -633,11 +635,13 @@ public struct ImportedGetterSkeleton: Codable { public init( name: String, + jsName: String? = nil, type: BridgeType, documentation: String? = nil, functionName: String? = nil ) { self.name = name + self.jsName = jsName self.type = type self.documentation = documentation self.functionName = functionName @@ -661,6 +665,8 @@ public struct ImportedGetterSkeleton: Codable { public struct ImportedSetterSkeleton: Codable { public let name: String + /// The JavaScript property name to write to, if different from `name`. + public let jsName: String? public let type: BridgeType public let documentation: String? /// Name of the setter function if it's a separate function (from @JSSetter) @@ -668,11 +674,13 @@ public struct ImportedSetterSkeleton: Codable { public init( name: String, + jsName: String? = nil, type: BridgeType, documentation: String? = nil, functionName: String? = nil ) { self.name = name + self.jsName = jsName self.type = type self.documentation = documentation self.functionName = functionName diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 6a752ab80..87663cb88 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -390,21 +390,28 @@ export class TypeProcessor { /** * @param {ts.PropertyDeclaration | ts.PropertySignature} node - * @returns {{ name: string, type: string, isReadonly: boolean, documentation: string | undefined } | null} + * @returns {{ jsName: string, swiftName: string, type: string, isReadonly: boolean, documentation: string | undefined } | null} */ visitPropertyDecl(node) { if (!node.name) return null; - - const propertyName = node.name.getText(); - if (!isValidSwiftDeclName(propertyName)) { + /** @type {string | null} */ + let jsName = null; + if (ts.isIdentifier(node.name)) { + jsName = node.name.text; + } else if (ts.isStringLiteral(node.name) || ts.isNumericLiteral(node.name)) { + jsName = node.name.text; + } else { + // Computed property names like `[Symbol.iterator]` are not supported yet. return null; } + const swiftName = isValidSwiftDeclName(jsName) ? jsName : makeValidSwiftIdentifier(jsName, { emptyFallback: "_" }); + const type = this.checker.getTypeAtLocation(node) const swiftType = this.visitType(type, node); const isReadonly = node.modifiers?.some(m => m.kind === ts.SyntaxKind.ReadonlyKeyword) ?? false; const documentation = this.getFullJSDocText(node); - return { name: propertyName, type: swiftType, isReadonly, documentation }; + return { jsName, swiftName, type: swiftType, isReadonly, documentation }; } /** @@ -626,17 +633,21 @@ export class TypeProcessor { if (!property) return; const type = property.type; - const name = this.renderIdentifier(property.name); + const swiftName = this.renderIdentifier(property.swiftName); + const needsJSGetterName = property.jsName !== property.swiftName; + const escapedJSName = property.jsName.replaceAll("\\", "\\\\").replaceAll("\"", "\\\\\""); + const getterAnnotation = needsJSGetterName ? `@JSGetter(jsName: "${escapedJSName}")` : "@JSGetter"; // Always render getter - this.swiftLines.push(` @JSGetter var ${name}: ${type}`); + this.swiftLines.push(` ${getterAnnotation} var ${swiftName}: ${type}`); // Render setter if not readonly if (!property.isReadonly) { - const capitalizedName = property.name.charAt(0).toUpperCase() + property.name.slice(1); - const needsJSNameField = property.name.charAt(0) != capitalizedName.charAt(0).toLowerCase(); - const setterName = `set${capitalizedName}`; - const annotation = needsJSNameField ? `@JSSetter(jsName: "${property.name}")` : "@JSSetter"; + const capitalizedSwiftName = property.swiftName.charAt(0).toUpperCase() + property.swiftName.slice(1); + const derivedPropertyName = property.swiftName.charAt(0).toLowerCase() + property.swiftName.slice(1); + const needsJSNameField = property.jsName !== derivedPropertyName; + const setterName = `set${capitalizedSwiftName}`; + const annotation = needsJSNameField ? `@JSSetter(jsName: "${escapedJSName}")` : "@JSSetter"; this.swiftLines.push(` ${annotation} func ${this.renderIdentifier(setterName)}(_ value: ${type}) ${this.renderEffects({ isAsync: false })}`); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts index 2b0474bb5..bcd4c7392 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts @@ -11,6 +11,11 @@ export interface ArrayBufferLike { export interface WeirdNaming { as(): void; normalProperty: string; + "property-with-dashes": number; + "123invalidStart": boolean; + "property with spaces": string; + "@specialChar": number; + constructor: string; for: string; Any: string; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index 60435e569..585b276de 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -212,7 +212,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_ArrayBufferLike_byteLength_get"] = function bjs_ArrayBufferLike_byteLength_get(self) { try { - let ret = swift.memory.getObject(self).byteLength; + let ret = swift.memory.getObject(self)["byteLength"]; return ret; } catch (error) { setException(error); @@ -230,7 +230,52 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_WeirdNaming_normalProperty_get"] = function bjs_WeirdNaming_normalProperty_get(self) { try { - let ret = swift.memory.getObject(self).normalProperty; + let ret = swift.memory.getObject(self)["normalProperty"]; + tmpRetBytes = textEncoder.encode(ret); + return tmpRetBytes.length; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WeirdNaming_property_with_dashes_get"] = function bjs_WeirdNaming_property_with_dashes_get(self) { + try { + let ret = swift.memory.getObject(self)["property-with-dashes"]; + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_WeirdNaming__123invalidStart_get"] = function bjs_WeirdNaming__123invalidStart_get(self) { + try { + let ret = swift.memory.getObject(self)["123invalidStart"]; + return ret ? 1 : 0; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_WeirdNaming_property_with_spaces_get"] = function bjs_WeirdNaming_property_with_spaces_get(self) { + try { + let ret = swift.memory.getObject(self)["property with spaces"]; + tmpRetBytes = textEncoder.encode(ret); + return tmpRetBytes.length; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WeirdNaming__specialChar_get"] = function bjs_WeirdNaming__specialChar_get(self) { + try { + let ret = swift.memory.getObject(self)["@specialChar"]; + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_WeirdNaming_constructor_get"] = function bjs_WeirdNaming_constructor_get(self) { + try { + let ret = swift.memory.getObject(self)["constructor"]; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -239,7 +284,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_WeirdNaming_for_get"] = function bjs_WeirdNaming_for_get(self) { try { - let ret = swift.memory.getObject(self).for; + let ret = swift.memory.getObject(self)["for"]; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -248,7 +293,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_WeirdNaming_Any_get"] = function bjs_WeirdNaming_Any_get(self) { try { - let ret = swift.memory.getObject(self).Any; + let ret = swift.memory.getObject(self)["Any"]; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -259,7 +304,46 @@ export async function createInstantiator(options, swift) { try { const newValueObject = swift.memory.getObject(newValue); swift.memory.release(newValue); - swift.memory.getObject(self).normalProperty = newValueObject; + swift.memory.getObject(self)["normalProperty"] = newValueObject; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WeirdNaming_property_with_dashes_set"] = function bjs_WeirdNaming_property_with_dashes_set(self, newValue) { + try { + swift.memory.getObject(self)["property-with-dashes"] = newValue; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WeirdNaming__123invalidStart_set"] = function bjs_WeirdNaming__123invalidStart_set(self, newValue) { + try { + swift.memory.getObject(self)["123invalidStart"] = newValue !== 0; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WeirdNaming_property_with_spaces_set"] = function bjs_WeirdNaming_property_with_spaces_set(self, newValue) { + try { + const newValueObject = swift.memory.getObject(newValue); + swift.memory.release(newValue); + swift.memory.getObject(self)["property with spaces"] = newValueObject; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WeirdNaming__specialChar_set"] = function bjs_WeirdNaming__specialChar_set(self, newValue) { + try { + swift.memory.getObject(self)["@specialChar"] = newValue; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WeirdNaming_constructor_set"] = function bjs_WeirdNaming_constructor_set(self, newValue) { + try { + const newValueObject = swift.memory.getObject(newValue); + swift.memory.release(newValue); + swift.memory.getObject(self)["constructor"] = newValueObject; } catch (error) { setException(error); } @@ -268,7 +352,7 @@ export async function createInstantiator(options, swift) { try { const newValueObject = swift.memory.getObject(newValue); swift.memory.release(newValue); - swift.memory.getObject(self).for = newValueObject; + swift.memory.getObject(self)["for"] = newValueObject; } catch (error) { setException(error); } @@ -277,7 +361,7 @@ export async function createInstantiator(options, swift) { try { const newValueObject = swift.memory.getObject(newValue); swift.memory.release(newValue); - swift.memory.getObject(self).Any = newValueObject; + swift.memory.getObject(self)["Any"] = newValueObject; } catch (error) { setException(error); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index 40a3f4e3f..59457a1a2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -223,7 +223,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_DatabaseConnection_isConnected_get"] = function bjs_DatabaseConnection_isConnected_get(self) { try { - let ret = swift.memory.getObject(self).isConnected; + let ret = swift.memory.getObject(self)["isConnected"]; return ret ? 1 : 0; } catch (error) { setException(error); @@ -232,7 +232,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_DatabaseConnection_connectionTimeout_get"] = function bjs_DatabaseConnection_connectionTimeout_get(self) { try { - let ret = swift.memory.getObject(self).connectionTimeout; + let ret = swift.memory.getObject(self)["connectionTimeout"]; return ret; } catch (error) { setException(error); @@ -241,7 +241,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_DatabaseConnection_connectionTimeout_set"] = function bjs_DatabaseConnection_connectionTimeout_set(self, newValue) { try { - swift.memory.getObject(self).connectionTimeout = newValue; + swift.memory.getObject(self)["connectionTimeout"] = newValue; } catch (error) { setException(error); } @@ -268,7 +268,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_Logger_level_get"] = function bjs_Logger_level_get(self) { try { - let ret = swift.memory.getObject(self).level; + let ret = swift.memory.getObject(self)["level"]; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -295,7 +295,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_ConfigManager_configPath_get"] = function bjs_ConfigManager_configPath_get(self) { try { - let ret = swift.memory.getObject(self).configPath; + let ret = swift.memory.getObject(self)["configPath"]; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index d6b9a4f01..ee2212bbe 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -269,7 +269,7 @@ export async function createInstantiator(options, swift) { const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_MyViewControllerDelegate_eventCount_get"] = function bjs_MyViewControllerDelegate_eventCount_get(self) { try { - let ret = swift.memory.getObject(self).eventCount; + let ret = swift.memory.getObject(self)["eventCount"]; return ret; } catch (error) { setException(error); @@ -278,14 +278,14 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_eventCount_set"] = function bjs_MyViewControllerDelegate_eventCount_set(self, value) { try { - swift.memory.getObject(self).eventCount = value; + swift.memory.getObject(self)["eventCount"] = value; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_delegateName_get"] = function bjs_MyViewControllerDelegate_delegateName_get(self) { try { - let ret = swift.memory.getObject(self).delegateName; + let ret = swift.memory.getObject(self)["delegateName"]; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -294,7 +294,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_optionalName_get"] = function bjs_MyViewControllerDelegate_optionalName_get(self) { try { - let ret = swift.memory.getObject(self).optionalName; + let ret = swift.memory.getObject(self)["optionalName"]; tmpRetString = ret; } catch (error) { setException(error); @@ -307,14 +307,14 @@ export async function createInstantiator(options, swift) { obj = swift.memory.getObject(valueWrappedValue); swift.memory.release(valueWrappedValue); } - swift.memory.getObject(self).optionalName = valueIsSome ? obj : null; + swift.memory.getObject(self)["optionalName"] = valueIsSome ? obj : null; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_optionalRawEnum_get"] = function bjs_MyViewControllerDelegate_optionalRawEnum_get(self) { try { - let ret = swift.memory.getObject(self).optionalRawEnum; + let ret = swift.memory.getObject(self)["optionalRawEnum"]; tmpRetString = ret; } catch (error) { setException(error); @@ -327,14 +327,14 @@ export async function createInstantiator(options, swift) { obj = swift.memory.getObject(valueWrappedValue); swift.memory.release(valueWrappedValue); } - swift.memory.getObject(self).optionalRawEnum = valueIsSome ? obj : null; + swift.memory.getObject(self)["optionalRawEnum"] = valueIsSome ? obj : null; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_rawStringEnum_get"] = function bjs_MyViewControllerDelegate_rawStringEnum_get(self) { try { - let ret = swift.memory.getObject(self).rawStringEnum; + let ret = swift.memory.getObject(self)["rawStringEnum"]; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -345,14 +345,14 @@ export async function createInstantiator(options, swift) { try { const valueObject = swift.memory.getObject(value); swift.memory.release(value); - swift.memory.getObject(self).rawStringEnum = valueObject; + swift.memory.getObject(self)["rawStringEnum"] = valueObject; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_result_get"] = function bjs_MyViewControllerDelegate_result_get(self) { try { - let ret = swift.memory.getObject(self).result; + let ret = swift.memory.getObject(self)["result"]; const { caseId: caseId, cleanup: cleanup } = enumHelpers.Result.lower(ret); return caseId; } catch (error) { @@ -362,14 +362,14 @@ export async function createInstantiator(options, swift) { TestModule["bjs_MyViewControllerDelegate_result_set"] = function bjs_MyViewControllerDelegate_result_set(self, value) { try { const enumValue = enumHelpers.Result.raise(value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); - swift.memory.getObject(self).result = enumValue; + swift.memory.getObject(self)["result"] = enumValue; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_optionalResult_get"] = function bjs_MyViewControllerDelegate_optionalResult_get(self) { try { - let ret = swift.memory.getObject(self).optionalResult; + let ret = swift.memory.getObject(self)["optionalResult"]; const isSome = ret != null; if (isSome) { const { caseId: caseId, cleanup: cleanup } = enumHelpers.Result.lower(ret); @@ -387,14 +387,14 @@ export async function createInstantiator(options, swift) { if (valueIsSome) { enumValue = enumHelpers.Result.raise(valueWrappedValue, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); } - swift.memory.getObject(self).optionalResult = valueIsSome ? enumValue : null; + swift.memory.getObject(self)["optionalResult"] = valueIsSome ? enumValue : null; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_direction_get"] = function bjs_MyViewControllerDelegate_direction_get(self) { try { - let ret = swift.memory.getObject(self).direction; + let ret = swift.memory.getObject(self)["direction"]; return ret; } catch (error) { setException(error); @@ -403,14 +403,14 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_direction_set"] = function bjs_MyViewControllerDelegate_direction_set(self, value) { try { - swift.memory.getObject(self).direction = value; + swift.memory.getObject(self)["direction"] = value; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_directionOptional_get"] = function bjs_MyViewControllerDelegate_directionOptional_get(self) { try { - let ret = swift.memory.getObject(self).directionOptional; + let ret = swift.memory.getObject(self)["directionOptional"]; const isSome = ret != null; return isSome ? (ret | 0) : -1; } catch (error) { @@ -419,14 +419,14 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_directionOptional_set"] = function bjs_MyViewControllerDelegate_directionOptional_set(self, valueIsSome, valueWrappedValue) { try { - swift.memory.getObject(self).directionOptional = valueIsSome ? valueWrappedValue : null; + swift.memory.getObject(self)["directionOptional"] = valueIsSome ? valueWrappedValue : null; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_priority_get"] = function bjs_MyViewControllerDelegate_priority_get(self) { try { - let ret = swift.memory.getObject(self).priority; + let ret = swift.memory.getObject(self)["priority"]; return ret; } catch (error) { setException(error); @@ -435,14 +435,14 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_priority_set"] = function bjs_MyViewControllerDelegate_priority_set(self, value) { try { - swift.memory.getObject(self).priority = value; + swift.memory.getObject(self)["priority"] = value; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_priorityOptional_get"] = function bjs_MyViewControllerDelegate_priorityOptional_get(self) { try { - let ret = swift.memory.getObject(self).priorityOptional; + let ret = swift.memory.getObject(self)["priorityOptional"]; tmpRetOptionalInt = ret; } catch (error) { setException(error); @@ -450,7 +450,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_priorityOptional_set"] = function bjs_MyViewControllerDelegate_priorityOptional_set(self, valueIsSome, valueWrappedValue) { try { - swift.memory.getObject(self).priorityOptional = valueIsSome ? valueWrappedValue : null; + swift.memory.getObject(self)["priorityOptional"] = valueIsSome ? valueWrappedValue : null; } catch (error) { setException(error); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js index 2bbae4fec..7c11cb01c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js @@ -214,7 +214,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_TypeScriptProcessor_version_get"] = function bjs_TypeScriptProcessor_version_get(self) { try { - let ret = swift.memory.getObject(self).version; + let ret = swift.memory.getObject(self)["version"]; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -245,7 +245,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_CodeGenerator_outputFormat_get"] = function bjs_CodeGenerator_outputFormat_get(self) { try { - let ret = swift.memory.getObject(self).outputFormat; + let ret = swift.memory.getObject(self)["outputFormat"]; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index 6c44fd008..0209bd3fd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -204,7 +204,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_Greeter_name_get"] = function bjs_Greeter_name_get(self) { try { - let ret = swift.memory.getObject(self).name; + let ret = swift.memory.getObject(self)["name"]; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -213,7 +213,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_Greeter_age_get"] = function bjs_Greeter_age_get(self) { try { - let ret = swift.memory.getObject(self).age; + let ret = swift.memory.getObject(self)["age"]; return ret; } catch (error) { setException(error); @@ -224,7 +224,7 @@ export async function createInstantiator(options, swift) { try { const newValueObject = swift.memory.getObject(newValue); swift.memory.release(newValue); - swift.memory.getObject(self).name = newValueObject; + swift.memory.getObject(self)["name"] = newValueObject; } catch (error) { setException(error); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift index 6fa9b6d8c..73cd7cf45 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift @@ -18,6 +18,16 @@ @JSClass struct WeirdNaming { @JSGetter var normalProperty: String @JSSetter func setNormalProperty(_ value: String) throws (JSException) + @JSGetter(jsName: "property-with-dashes") var property_with_dashes: Double + @JSSetter(jsName: "property-with-dashes") func setProperty_with_dashes(_ value: Double) throws (JSException) + @JSGetter(jsName: "123invalidStart") var _123invalidStart: Bool + @JSSetter(jsName: "123invalidStart") func set_123invalidStart(_ value: Bool) throws (JSException) + @JSGetter(jsName: "property with spaces") var property_with_spaces: String + @JSSetter(jsName: "property with spaces") func setProperty_with_spaces(_ value: String) throws (JSException) + @JSGetter(jsName: "@specialChar") var _specialChar: Double + @JSSetter(jsName: "@specialChar") func set_specialChar(_ value: Double) throws (JSException) + @JSGetter var constructor: String + @JSSetter func setConstructor(_ value: String) throws (JSException) @JSGetter var `for`: String @JSSetter func setFor(_ value: String) throws (JSException) @JSGetter var `Any`: String diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift index ba9e925e0..2922a23f5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift @@ -79,6 +79,51 @@ fileprivate func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 { } #endif +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_property_with_dashes_get") +fileprivate func bjs_WeirdNaming_property_with_dashes_get(_ self: Int32) -> Float64 +#else +fileprivate func bjs_WeirdNaming_property_with_dashes_get(_ self: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming__123invalidStart_get") +fileprivate func bjs_WeirdNaming__123invalidStart_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_WeirdNaming__123invalidStart_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_property_with_spaces_get") +fileprivate func bjs_WeirdNaming_property_with_spaces_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_WeirdNaming_property_with_spaces_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming__specialChar_get") +fileprivate func bjs_WeirdNaming__specialChar_get(_ self: Int32) -> Float64 +#else +fileprivate func bjs_WeirdNaming__specialChar_get(_ self: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_constructor_get") +fileprivate func bjs_WeirdNaming_constructor_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_WeirdNaming_constructor_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_get") fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 @@ -106,6 +151,51 @@ fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: I } #endif +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_property_with_dashes_set") +fileprivate func bjs_WeirdNaming_property_with_dashes_set(_ self: Int32, _ newValue: Float64) -> Void +#else +fileprivate func bjs_WeirdNaming_property_with_dashes_set(_ self: Int32, _ newValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming__123invalidStart_set") +fileprivate func bjs_WeirdNaming__123invalidStart_set(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_WeirdNaming__123invalidStart_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_property_with_spaces_set") +fileprivate func bjs_WeirdNaming_property_with_spaces_set(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_WeirdNaming_property_with_spaces_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming__specialChar_set") +fileprivate func bjs_WeirdNaming__specialChar_set(_ self: Int32, _ newValue: Float64) -> Void +#else +fileprivate func bjs_WeirdNaming__specialChar_set(_ self: Int32, _ newValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_constructor_set") +fileprivate func bjs_WeirdNaming_constructor_set(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_WeirdNaming_constructor_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_set") fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void @@ -142,6 +232,51 @@ func _$WeirdNaming_normalProperty_get(_ self: JSObject) throws(JSException) -> S return String.bridgeJSLiftReturn(ret) } +func _$WeirdNaming_property_with_dashes_get(_ self: JSObject) throws(JSException) -> Double { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming_property_with_dashes_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +func _$WeirdNaming__123invalidStart_get(_ self: JSObject) throws(JSException) -> Bool { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming__123invalidStart_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return Bool.bridgeJSLiftReturn(ret) +} + +func _$WeirdNaming_property_with_spaces_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming_property_with_spaces_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +func _$WeirdNaming__specialChar_get(_ self: JSObject) throws(JSException) -> Double { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming__specialChar_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +func _$WeirdNaming_constructor_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming_constructor_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + func _$WeirdNaming_for_get(_ self: JSObject) throws(JSException) -> String { let selfValue = self.bridgeJSLowerParameter() let ret = bjs_WeirdNaming_for_get(selfValue) @@ -169,6 +304,51 @@ func _$WeirdNaming_normalProperty_set(_ self: JSObject, _ newValue: String) thro } } +func _$WeirdNaming_property_with_dashes_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_property_with_dashes_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WeirdNaming__123invalidStart_set(_ self: JSObject, _ newValue: Bool) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming__123invalidStart_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WeirdNaming_property_with_spaces_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_property_with_spaces_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WeirdNaming__specialChar_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming__specialChar_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WeirdNaming_constructor_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_constructor_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + func _$WeirdNaming_for_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { let selfValue = self.bridgeJSLowerParameter() let newValueValue = newValue.bridgeJSLowerParameter() diff --git a/Sources/JavaScriptKit/Macros.swift b/Sources/JavaScriptKit/Macros.swift index 8cc3dbc64..5a0571ab5 100644 --- a/Sources/JavaScriptKit/Macros.swift +++ b/Sources/JavaScriptKit/Macros.swift @@ -112,6 +112,9 @@ public macro JS(namespace: String? = nil, enumStyle: JSEnumStyle = .const) = Bui /// /// This macro is used by BridgeJS-generated Swift declarations. /// +/// - Parameter jsName: An optional string that specifies the name of the JavaScript property to read from. +/// If not provided, the Swift property name is used. +/// /// Example: /// /// ```swift @@ -125,7 +128,7 @@ public macro JS(namespace: String? = nil, enumStyle: JSEnumStyle = .const) = Bui /// ``` @attached(accessor) @_spi(Experimental) -public macro JSGetter() = +public macro JSGetter(jsName: String? = nil) = #externalMacro(module: "BridgeJSMacros", type: "JSGetterMacro") /// A macro that generates a Swift function body that writes a value to JavaScript. From 790605023d5dea0d2f4890b340d5a1aef05696a9 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 27 Jan 2026 08:24:42 +0900 Subject: [PATCH 095/252] Adjusted imported-property JS glue to prefer dot access when the property name is a normal identifier, falling back to bracket access only when needed. - Implementation: `Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift` - Updated snapshots (including `Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js:215`) - `swift test --package-path ./Plugins/BridgeJS` passes --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 19 ++++++--- .../InvalidPropertyNames.Import.js | 18 ++++---- .../MultipleImportedTypes.Import.js | 10 ++--- .../BridgeJSLinkTests/Protocol.Export.js | 42 +++++++++---------- .../TS2SkeletonLike.Import.js | 4 +- .../TypeScriptClass.Import.js | 6 +-- 6 files changed, 53 insertions(+), 46 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index bcb19320b..4dce2f0ef 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -2168,9 +2168,8 @@ extension BridgeJSLink { } func callPropertyGetter(name: String, returnType: BridgeType) throws -> String? { - let escapedName = BridgeJSLink.escapeForJavaScriptStringLiteral(name) - let accessExpr = - "\(JSGlueVariableScope.reservedSwift).memory.getObject(self)[\"\(escapedName)\"]" + let objectExpr = "\(JSGlueVariableScope.reservedSwift).memory.getObject(self)" + let accessExpr = Self.propertyAccessExpr(objectExpr: objectExpr, propertyName: name) if context == .exportSwift, returnType.usesSideChannelForOptionalReturn() { guard case .optional(let wrappedType) = returnType else { fatalError("usesSideChannelForOptionalReturn returned true for non-optional type") @@ -2194,9 +2193,9 @@ extension BridgeJSLink { } func callPropertySetter(name: String, returnType: BridgeType) { - let escapedName = BridgeJSLink.escapeForJavaScriptStringLiteral(name) - let call = - "\(JSGlueVariableScope.reservedSwift).memory.getObject(self)[\"\(escapedName)\"] = \(parameterForwardings.joined(separator: ", "))" + let objectExpr = "\(JSGlueVariableScope.reservedSwift).memory.getObject(self)" + let accessExpr = Self.propertyAccessExpr(objectExpr: objectExpr, propertyName: name) + let call = "\(accessExpr) = \(parameterForwardings.joined(separator: ", "))" body.write("\(call);") } @@ -2236,6 +2235,14 @@ extension BridgeJSLink { assert(loweredValues.count <= 1, "Lowering fragment should produce at most one value") return loweredValues.first } + + private static func propertyAccessExpr(objectExpr: String, propertyName: String) -> String { + if propertyName.range(of: #"^[$A-Z_][0-9A-Z_$]*$"#, options: [.regularExpression, .caseInsensitive]) != nil { + return "\(objectExpr).\(propertyName)" + } + let escapedName = BridgeJSLink.escapeForJavaScriptStringLiteral(propertyName) + return "\(objectExpr)[\"\(escapedName)\"]" + } } class ImportObjectBuilder { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index 585b276de..022b14e0e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -212,7 +212,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_ArrayBufferLike_byteLength_get"] = function bjs_ArrayBufferLike_byteLength_get(self) { try { - let ret = swift.memory.getObject(self)["byteLength"]; + let ret = swift.memory.getObject(self).byteLength; return ret; } catch (error) { setException(error); @@ -230,7 +230,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_WeirdNaming_normalProperty_get"] = function bjs_WeirdNaming_normalProperty_get(self) { try { - let ret = swift.memory.getObject(self)["normalProperty"]; + let ret = swift.memory.getObject(self).normalProperty; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -275,7 +275,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_WeirdNaming_constructor_get"] = function bjs_WeirdNaming_constructor_get(self) { try { - let ret = swift.memory.getObject(self)["constructor"]; + let ret = swift.memory.getObject(self).constructor; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -284,7 +284,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_WeirdNaming_for_get"] = function bjs_WeirdNaming_for_get(self) { try { - let ret = swift.memory.getObject(self)["for"]; + let ret = swift.memory.getObject(self).for; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -293,7 +293,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_WeirdNaming_Any_get"] = function bjs_WeirdNaming_Any_get(self) { try { - let ret = swift.memory.getObject(self)["Any"]; + let ret = swift.memory.getObject(self).Any; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -304,7 +304,7 @@ export async function createInstantiator(options, swift) { try { const newValueObject = swift.memory.getObject(newValue); swift.memory.release(newValue); - swift.memory.getObject(self)["normalProperty"] = newValueObject; + swift.memory.getObject(self).normalProperty = newValueObject; } catch (error) { setException(error); } @@ -343,7 +343,7 @@ export async function createInstantiator(options, swift) { try { const newValueObject = swift.memory.getObject(newValue); swift.memory.release(newValue); - swift.memory.getObject(self)["constructor"] = newValueObject; + swift.memory.getObject(self).constructor = newValueObject; } catch (error) { setException(error); } @@ -352,7 +352,7 @@ export async function createInstantiator(options, swift) { try { const newValueObject = swift.memory.getObject(newValue); swift.memory.release(newValue); - swift.memory.getObject(self)["for"] = newValueObject; + swift.memory.getObject(self).for = newValueObject; } catch (error) { setException(error); } @@ -361,7 +361,7 @@ export async function createInstantiator(options, swift) { try { const newValueObject = swift.memory.getObject(newValue); swift.memory.release(newValue); - swift.memory.getObject(self)["Any"] = newValueObject; + swift.memory.getObject(self).Any = newValueObject; } catch (error) { setException(error); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index 59457a1a2..40a3f4e3f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -223,7 +223,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_DatabaseConnection_isConnected_get"] = function bjs_DatabaseConnection_isConnected_get(self) { try { - let ret = swift.memory.getObject(self)["isConnected"]; + let ret = swift.memory.getObject(self).isConnected; return ret ? 1 : 0; } catch (error) { setException(error); @@ -232,7 +232,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_DatabaseConnection_connectionTimeout_get"] = function bjs_DatabaseConnection_connectionTimeout_get(self) { try { - let ret = swift.memory.getObject(self)["connectionTimeout"]; + let ret = swift.memory.getObject(self).connectionTimeout; return ret; } catch (error) { setException(error); @@ -241,7 +241,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_DatabaseConnection_connectionTimeout_set"] = function bjs_DatabaseConnection_connectionTimeout_set(self, newValue) { try { - swift.memory.getObject(self)["connectionTimeout"] = newValue; + swift.memory.getObject(self).connectionTimeout = newValue; } catch (error) { setException(error); } @@ -268,7 +268,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_Logger_level_get"] = function bjs_Logger_level_get(self) { try { - let ret = swift.memory.getObject(self)["level"]; + let ret = swift.memory.getObject(self).level; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -295,7 +295,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_ConfigManager_configPath_get"] = function bjs_ConfigManager_configPath_get(self) { try { - let ret = swift.memory.getObject(self)["configPath"]; + let ret = swift.memory.getObject(self).configPath; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index ee2212bbe..d6b9a4f01 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -269,7 +269,7 @@ export async function createInstantiator(options, swift) { const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_MyViewControllerDelegate_eventCount_get"] = function bjs_MyViewControllerDelegate_eventCount_get(self) { try { - let ret = swift.memory.getObject(self)["eventCount"]; + let ret = swift.memory.getObject(self).eventCount; return ret; } catch (error) { setException(error); @@ -278,14 +278,14 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_eventCount_set"] = function bjs_MyViewControllerDelegate_eventCount_set(self, value) { try { - swift.memory.getObject(self)["eventCount"] = value; + swift.memory.getObject(self).eventCount = value; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_delegateName_get"] = function bjs_MyViewControllerDelegate_delegateName_get(self) { try { - let ret = swift.memory.getObject(self)["delegateName"]; + let ret = swift.memory.getObject(self).delegateName; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -294,7 +294,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_optionalName_get"] = function bjs_MyViewControllerDelegate_optionalName_get(self) { try { - let ret = swift.memory.getObject(self)["optionalName"]; + let ret = swift.memory.getObject(self).optionalName; tmpRetString = ret; } catch (error) { setException(error); @@ -307,14 +307,14 @@ export async function createInstantiator(options, swift) { obj = swift.memory.getObject(valueWrappedValue); swift.memory.release(valueWrappedValue); } - swift.memory.getObject(self)["optionalName"] = valueIsSome ? obj : null; + swift.memory.getObject(self).optionalName = valueIsSome ? obj : null; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_optionalRawEnum_get"] = function bjs_MyViewControllerDelegate_optionalRawEnum_get(self) { try { - let ret = swift.memory.getObject(self)["optionalRawEnum"]; + let ret = swift.memory.getObject(self).optionalRawEnum; tmpRetString = ret; } catch (error) { setException(error); @@ -327,14 +327,14 @@ export async function createInstantiator(options, swift) { obj = swift.memory.getObject(valueWrappedValue); swift.memory.release(valueWrappedValue); } - swift.memory.getObject(self)["optionalRawEnum"] = valueIsSome ? obj : null; + swift.memory.getObject(self).optionalRawEnum = valueIsSome ? obj : null; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_rawStringEnum_get"] = function bjs_MyViewControllerDelegate_rawStringEnum_get(self) { try { - let ret = swift.memory.getObject(self)["rawStringEnum"]; + let ret = swift.memory.getObject(self).rawStringEnum; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -345,14 +345,14 @@ export async function createInstantiator(options, swift) { try { const valueObject = swift.memory.getObject(value); swift.memory.release(value); - swift.memory.getObject(self)["rawStringEnum"] = valueObject; + swift.memory.getObject(self).rawStringEnum = valueObject; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_result_get"] = function bjs_MyViewControllerDelegate_result_get(self) { try { - let ret = swift.memory.getObject(self)["result"]; + let ret = swift.memory.getObject(self).result; const { caseId: caseId, cleanup: cleanup } = enumHelpers.Result.lower(ret); return caseId; } catch (error) { @@ -362,14 +362,14 @@ export async function createInstantiator(options, swift) { TestModule["bjs_MyViewControllerDelegate_result_set"] = function bjs_MyViewControllerDelegate_result_set(self, value) { try { const enumValue = enumHelpers.Result.raise(value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); - swift.memory.getObject(self)["result"] = enumValue; + swift.memory.getObject(self).result = enumValue; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_optionalResult_get"] = function bjs_MyViewControllerDelegate_optionalResult_get(self) { try { - let ret = swift.memory.getObject(self)["optionalResult"]; + let ret = swift.memory.getObject(self).optionalResult; const isSome = ret != null; if (isSome) { const { caseId: caseId, cleanup: cleanup } = enumHelpers.Result.lower(ret); @@ -387,14 +387,14 @@ export async function createInstantiator(options, swift) { if (valueIsSome) { enumValue = enumHelpers.Result.raise(valueWrappedValue, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); } - swift.memory.getObject(self)["optionalResult"] = valueIsSome ? enumValue : null; + swift.memory.getObject(self).optionalResult = valueIsSome ? enumValue : null; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_direction_get"] = function bjs_MyViewControllerDelegate_direction_get(self) { try { - let ret = swift.memory.getObject(self)["direction"]; + let ret = swift.memory.getObject(self).direction; return ret; } catch (error) { setException(error); @@ -403,14 +403,14 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_direction_set"] = function bjs_MyViewControllerDelegate_direction_set(self, value) { try { - swift.memory.getObject(self)["direction"] = value; + swift.memory.getObject(self).direction = value; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_directionOptional_get"] = function bjs_MyViewControllerDelegate_directionOptional_get(self) { try { - let ret = swift.memory.getObject(self)["directionOptional"]; + let ret = swift.memory.getObject(self).directionOptional; const isSome = ret != null; return isSome ? (ret | 0) : -1; } catch (error) { @@ -419,14 +419,14 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_directionOptional_set"] = function bjs_MyViewControllerDelegate_directionOptional_set(self, valueIsSome, valueWrappedValue) { try { - swift.memory.getObject(self)["directionOptional"] = valueIsSome ? valueWrappedValue : null; + swift.memory.getObject(self).directionOptional = valueIsSome ? valueWrappedValue : null; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_priority_get"] = function bjs_MyViewControllerDelegate_priority_get(self) { try { - let ret = swift.memory.getObject(self)["priority"]; + let ret = swift.memory.getObject(self).priority; return ret; } catch (error) { setException(error); @@ -435,14 +435,14 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_priority_set"] = function bjs_MyViewControllerDelegate_priority_set(self, value) { try { - swift.memory.getObject(self)["priority"] = value; + swift.memory.getObject(self).priority = value; } catch (error) { setException(error); } } TestModule["bjs_MyViewControllerDelegate_priorityOptional_get"] = function bjs_MyViewControllerDelegate_priorityOptional_get(self) { try { - let ret = swift.memory.getObject(self)["priorityOptional"]; + let ret = swift.memory.getObject(self).priorityOptional; tmpRetOptionalInt = ret; } catch (error) { setException(error); @@ -450,7 +450,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_priorityOptional_set"] = function bjs_MyViewControllerDelegate_priorityOptional_set(self, valueIsSome, valueWrappedValue) { try { - swift.memory.getObject(self)["priorityOptional"] = valueIsSome ? valueWrappedValue : null; + swift.memory.getObject(self).priorityOptional = valueIsSome ? valueWrappedValue : null; } catch (error) { setException(error); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js index 7c11cb01c..2bbae4fec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js @@ -214,7 +214,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_TypeScriptProcessor_version_get"] = function bjs_TypeScriptProcessor_version_get(self) { try { - let ret = swift.memory.getObject(self)["version"]; + let ret = swift.memory.getObject(self).version; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -245,7 +245,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_CodeGenerator_outputFormat_get"] = function bjs_CodeGenerator_outputFormat_get(self) { try { - let ret = swift.memory.getObject(self)["outputFormat"]; + let ret = swift.memory.getObject(self).outputFormat; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index 0209bd3fd..6c44fd008 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -204,7 +204,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_Greeter_name_get"] = function bjs_Greeter_name_get(self) { try { - let ret = swift.memory.getObject(self)["name"]; + let ret = swift.memory.getObject(self).name; tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { @@ -213,7 +213,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_Greeter_age_get"] = function bjs_Greeter_age_get(self) { try { - let ret = swift.memory.getObject(self)["age"]; + let ret = swift.memory.getObject(self).age; return ret; } catch (error) { setException(error); @@ -224,7 +224,7 @@ export async function createInstantiator(options, swift) { try { const newValueObject = swift.memory.getObject(newValue); swift.memory.release(newValue); - swift.memory.getObject(self)["name"] = newValueObject; + swift.memory.getObject(self).name = newValueObject; } catch (error) { setException(error); } From 0497d2611205389840156fe1d189b2cf1ca39cf0 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 27 Jan 2026 08:39:17 +0900 Subject: [PATCH 096/252] Added `jsName` support to `@JSFunction` and `@JSClass`, end-to-end. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated macro APIs: `Sources/JavaScriptKit/Macros.swift` - Plumbed `jsName` through the imported skeleton + Swift parser: `Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift`, `Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift` - Updated JS glue + generated `.d.ts` to use the JS names (dot access when possible, bracket access when needed): `Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift` - Updated TS→Swift generator to emit `@JSClass(jsName: ...)` / `@JSFunction(jsName: ...)` when it has to sanitize names: `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js` - Added coverage for a renamed class + quoted method name: `Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/InvalidPropertyNames.d.ts` (snapshots refreshed; `swift test --package-path ./Plugins/BridgeJS` passes) --- .../BridgeJSCore/SwiftToSkeleton.swift | 44 +++++++--- .../Sources/BridgeJSLink/BridgeJSLink.swift | 26 +++--- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 15 +++- .../TS2Swift/JavaScript/src/processor.js | 81 +++++++++++++++---- .../Inputs/InvalidPropertyNames.d.ts | 7 ++ .../InvalidPropertyNames.Import.d.ts | 10 +++ .../InvalidPropertyNames.Import.js | 31 +++++++ .../InvalidPropertyNames.Macros.swift | 11 +++ .../ImportTSTests/InvalidPropertyNames.swift | 68 ++++++++++++++++ Sources/JavaScriptKit/Macros.swift | 7 +- 10 files changed, 260 insertions(+), 40 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index f09a9140a..b1dced37e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -1743,6 +1743,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { // Current type being collected (when in jsClassBody state) private struct CurrentType { let name: String + let jsName: String? var constructor: ImportedConstructorSkeleton? var methods: [ImportedFunctionSkeleton] var getters: [ImportedGetterSkeleton] @@ -1758,6 +1759,12 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { hasAttribute(attributes, name: "JSFunction") } + static func firstJSFunctionAttribute(_ attributes: AttributeListSyntax?) -> AttributeSyntax? { + attributes?.first { attribute in + attribute.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JSFunction" + }?.as(AttributeSyntax.self) + } + static func hasJSGetterAttribute(_ attributes: AttributeListSyntax?) -> Bool { hasAttribute(attributes, name: "JSGetter") } @@ -1782,6 +1789,12 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { hasAttribute(attributes, name: "JSClass") } + static func firstJSClassAttribute(_ attributes: AttributeListSyntax?) -> AttributeSyntax? { + attributes?.first { attribute in + attribute.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JSClass" + }?.as(AttributeSyntax.self) + } + static func hasAttribute(_ attributes: AttributeListSyntax?, name: String) -> Bool { guard let attributes else { return false } return attributes.contains { attribute in @@ -1929,7 +1942,12 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { private func enterJSClass(_ typeName: String) { stateStack.append(.jsClassBody(name: typeName)) - currentType = CurrentType(name: typeName, constructor: nil, methods: [], getters: [], setters: []) + currentType = CurrentType(name: typeName, jsName: nil, constructor: nil, methods: [], getters: [], setters: []) + } + + private func enterJSClass(_ typeName: String, jsName: String?) { + stateStack.append(.jsClassBody(name: typeName)) + currentType = CurrentType(name: typeName, jsName: jsName, constructor: nil, methods: [], getters: [], setters: []) } private func exitJSClass() { @@ -1937,6 +1955,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { importedTypes.append( ImportedTypeSkeleton( name: type.name, + jsName: type.jsName, constructor: type.constructor, methods: type.methods, getters: type.getters, @@ -1951,7 +1970,8 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { override func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind { if AttributeChecker.hasJSClassAttribute(node.attributes) { - enterJSClass(node.name.text) + let jsName = AttributeChecker.firstJSClassAttribute(node.attributes).flatMap(AttributeChecker.extractJSName) + enterJSClass(node.name.text, jsName: jsName) } return .visitChildren } @@ -1964,7 +1984,8 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { override func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind { if AttributeChecker.hasJSClassAttribute(node.attributes) { - enterJSClass(node.name.text) + let jsName = AttributeChecker.firstJSClassAttribute(node.attributes).flatMap(AttributeChecker.extractJSName) + enterJSClass(node.name.text, jsName: jsName) } return .visitChildren } @@ -2002,8 +2023,8 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } private func handleTopLevelFunction(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { - if AttributeChecker.hasJSFunctionAttribute(node.attributes), - let function = parseFunction(node, enclosingTypeName: nil, isStaticMember: true) + if let jsFunction = AttributeChecker.firstJSFunctionAttribute(node.attributes), + let function = parseFunction(jsFunction, node, enclosingTypeName: nil, isStaticMember: true) { importedFunctions.append(function) return .skipChildren @@ -2027,13 +2048,13 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { isStaticMember: Bool, type: inout CurrentType ) -> Bool { - if AttributeChecker.hasJSFunctionAttribute(node.attributes) { + if let jsFunction = AttributeChecker.firstJSFunctionAttribute(node.attributes) { if isStaticMember { - parseFunction(node, enclosingTypeName: typeName, isStaticMember: true).map { + parseFunction(jsFunction, node, enclosingTypeName: typeName, isStaticMember: true).map { importedFunctions.append($0) } } else { - parseFunction(node, enclosingTypeName: typeName, isStaticMember: false).map { + parseFunction(jsFunction, node, enclosingTypeName: typeName, isStaticMember: false).map { type.methods.append($0) } } @@ -2130,8 +2151,8 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { private func collectStaticMembers(in members: MemberBlockItemListSyntax, typeName: String) { for member in members { if let function = member.decl.as(FunctionDeclSyntax.self) { - if AttributeChecker.hasJSFunctionAttribute(function.attributes), - let parsed = parseFunction(function, enclosingTypeName: typeName, isStaticMember: true) + if let jsFunction = AttributeChecker.firstJSFunctionAttribute(function.attributes), + let parsed = parseFunction(jsFunction, function, enclosingTypeName: typeName, isStaticMember: true) { importedFunctions.append(parsed) } else if AttributeChecker.hasJSSetterAttribute(function.attributes) { @@ -2175,6 +2196,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } private func parseFunction( + _ jsFunction: AttributeSyntax, _ node: FunctionDeclSyntax, enclosingTypeName: String?, isStaticMember: Bool @@ -2185,6 +2207,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } let baseName = SwiftToSkeleton.normalizeIdentifier(node.name.text) + let jsName = AttributeChecker.extractJSName(from: jsFunction) let name: String if isStaticMember, let enclosingTypeName { name = "\(enclosingTypeName)_\(baseName)" @@ -2204,6 +2227,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } return ImportedFunctionSkeleton( name: name, + jsName: jsName, parameters: parameters, returnType: returnType, documentation: nil diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 4dce2f0ef..c42437dbe 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -1194,8 +1194,9 @@ public struct BridgeJSLink { // Add methods for method in type.methods { + let methodName = method.jsName ?? method.name let methodSignature = - "\(method.name)\(renderTSSignature(parameters: method.parameters, returnType: method.returnType, effects: Effects(isAsync: false, isThrows: false)));" + "\(renderTSPropertyName(methodName))\(renderTSSignature(parameters: method.parameters, returnType: method.returnType, effects: Effects(isAsync: false, isThrows: false)));" printer.write(methodSignature) } @@ -2127,7 +2128,8 @@ extension BridgeJSLink { } func call(name: String, returnType: BridgeType) throws -> String? { - return try self.call(calleeExpr: "imports.\(name)", returnType: returnType) + let calleeExpr = Self.propertyAccessExpr(objectExpr: "imports", propertyName: name) + return try self.call(calleeExpr: calleeExpr, returnType: returnType) } private func call(calleeExpr: String, returnType: BridgeType) throws -> String? { @@ -2153,16 +2155,19 @@ extension BridgeJSLink { ) } - func callConstructor(name: String) throws -> String? { - let call = "new imports.\(name)(\(parameterForwardings.joined(separator: ", ")))" - let type: BridgeType = .jsObject(name) + func callConstructor(jsName: String, swiftTypeName: String) throws -> String? { + let ctorExpr = Self.propertyAccessExpr(objectExpr: "imports", propertyName: jsName) + let call = "new \(ctorExpr)(\(parameterForwardings.joined(separator: ", ")))" + let type: BridgeType = .jsObject(swiftTypeName) let loweringFragment = try IntrinsicJSFragment.lowerReturn(type: type, context: context) return try lowerReturnValue(returnType: type, returnExpr: call, loweringFragment: loweringFragment) } func callMethod(name: String, returnType: BridgeType) throws -> String? { + let objectExpr = "\(JSGlueVariableScope.reservedSwift).memory.getObject(self)" + let calleeExpr = Self.propertyAccessExpr(objectExpr: objectExpr, propertyName: name) return try call( - calleeExpr: "\(JSGlueVariableScope.reservedSwift).memory.getObject(self).\(name)", + calleeExpr: calleeExpr, returnType: returnType ) } @@ -2957,7 +2962,8 @@ extension BridgeJSLink { for param in function.parameters { try thunkBuilder.liftParameter(param: param) } - let returnExpr = try thunkBuilder.call(name: function.name, returnType: function.returnType) + let jsName = function.jsName ?? function.name + let returnExpr = try thunkBuilder.call(name: jsName, returnType: function.returnType) let funcLines = thunkBuilder.renderFunction( name: function.abiName(context: nil), returnExpr: returnExpr, @@ -2966,7 +2972,7 @@ extension BridgeJSLink { let effects = Effects(isAsync: false, isThrows: false) importObjectBuilder.appendDts( [ - "\(function.name)\(renderTSSignature(parameters: function.parameters, returnType: function.returnType, effects: effects));" + "\(renderTSPropertyName(jsName))\(renderTSSignature(parameters: function.parameters, returnType: function.returnType, effects: effects));" ] ) importObjectBuilder.assignToImportObject(name: function.abiName(context: nil), function: funcLines) @@ -3049,7 +3055,7 @@ extension BridgeJSLink { try thunkBuilder.liftParameter(param: param) } let returnType = BridgeType.jsObject(type.name) - let returnExpr = try thunkBuilder.callConstructor(name: type.name) + let returnExpr = try thunkBuilder.callConstructor(jsName: type.jsName ?? type.name, swiftTypeName: type.name) let abiName = constructor.abiName(context: type) let funcLines = thunkBuilder.renderFunction( name: abiName, @@ -3111,7 +3117,7 @@ extension BridgeJSLink { for param in method.parameters { try thunkBuilder.liftParameter(param: param) } - let returnExpr = try thunkBuilder.callMethod(name: method.name, returnType: method.returnType) + let returnExpr = try thunkBuilder.callMethod(name: method.jsName ?? method.name, returnType: method.returnType) let funcLines = thunkBuilder.renderFunction( name: method.abiName(context: context), returnExpr: returnExpr, diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 7040d607d..3baebe6da 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -590,12 +590,21 @@ public struct ExportedSkeleton: Codable { public struct ImportedFunctionSkeleton: Codable { public let name: String + /// The JavaScript function/method name to call, if different from `name`. + public let jsName: String? public let parameters: [Parameter] public let returnType: BridgeType public let documentation: String? - public init(name: String, parameters: [Parameter], returnType: BridgeType, documentation: String? = nil) { + public init( + name: String, + jsName: String? = nil, + parameters: [Parameter], + returnType: BridgeType, + documentation: String? = nil + ) { self.name = name + self.jsName = jsName self.parameters = parameters self.returnType = returnType self.documentation = documentation @@ -704,6 +713,8 @@ public struct ImportedSetterSkeleton: Codable { public struct ImportedTypeSkeleton: Codable { public let name: String + /// The JavaScript constructor name to use for `init(...)`, if different from `name`. + public let jsName: String? public let constructor: ImportedConstructorSkeleton? public let methods: [ImportedFunctionSkeleton] public let getters: [ImportedGetterSkeleton] @@ -712,6 +723,7 @@ public struct ImportedTypeSkeleton: Codable { public init( name: String, + jsName: String? = nil, constructor: ImportedConstructorSkeleton? = nil, methods: [ImportedFunctionSkeleton], getters: [ImportedGetterSkeleton] = [], @@ -719,6 +731,7 @@ public struct ImportedTypeSkeleton: Codable { documentation: String? = nil ) { self.name = name + self.jsName = jsName self.constructor = constructor self.methods = methods self.getters = getters diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 87663cb88..615cffa25 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -60,6 +60,33 @@ export class TypeProcessor { /** @type {Set} */ this.visitedDeclarationKeys = new Set(); + + /** @type {Map} */ + this.swiftTypeNameByJSTypeName = new Map(); + } + + /** + * Convert a TypeScript type name to a valid Swift type identifier. + * @param {string} jsTypeName + * @returns {string} + * @private + */ + swiftTypeName(jsTypeName) { + const cached = this.swiftTypeNameByJSTypeName.get(jsTypeName); + if (cached) return cached; + const swiftName = isValidSwiftDeclName(jsTypeName) ? jsTypeName : makeValidSwiftIdentifier(jsTypeName, { emptyFallback: "_" }); + this.swiftTypeNameByJSTypeName.set(jsTypeName, swiftName); + return swiftName; + } + + /** + * Render a Swift type identifier from a TypeScript type name. + * @param {string} jsTypeName + * @returns {string} + * @private + */ + renderTypeIdentifier(jsTypeName) { + return this.renderIdentifier(this.swiftTypeName(jsTypeName)); } /** @@ -292,7 +319,7 @@ export class TypeProcessor { canBeStringEnum = false; canBeIntEnum = false; } - const swiftEnumName = this.renderIdentifier(enumName); + const swiftEnumName = this.renderTypeIdentifier(enumName); const dedupeNames = (items) => { const seen = new Map(); return items.map(item => { @@ -341,10 +368,10 @@ export class TypeProcessor { */ visitFunctionDeclaration(node) { if (!node.name) return; - const name = node.name.getText(); - if (!isValidSwiftDeclName(name)) { - return; - } + const jsName = node.name.text; + const swiftName = this.swiftTypeName(jsName); + const escapedJSName = jsName.replaceAll("\\", "\\\\").replaceAll("\"", "\\\\\""); + const annotation = jsName !== swiftName ? `@JSFunction(jsName: "${escapedJSName}")` : "@JSFunction"; const signature = this.checker.getSignatureFromDeclaration(node); if (!signature) return; @@ -352,9 +379,9 @@ export class TypeProcessor { const params = this.renderParameters(signature.getParameters(), node); const returnType = this.visitType(signature.getReturnType(), node); const effects = this.renderEffects({ isAsync: false }); - const swiftName = this.renderIdentifier(name); + const swiftFuncName = this.renderIdentifier(swiftName); - this.swiftLines.push(`@JSFunction func ${swiftName}(${params}) ${effects} -> ${returnType}`); + this.swiftLines.push(`${annotation} func ${swiftFuncName}(${params}) ${effects} -> ${returnType}`); this.swiftLines.push(""); } @@ -433,8 +460,12 @@ export class TypeProcessor { visitClassDecl(node) { if (!node.name) return; - const className = this.renderIdentifier(node.name.text); - this.swiftLines.push(`@JSClass struct ${className} {`); + const jsName = node.name.text; + const swiftName = this.swiftTypeName(jsName); + const escapedJSName = jsName.replaceAll("\\", "\\\\").replaceAll("\"", "\\\\\""); + const annotation = jsName !== swiftName ? `@JSClass(jsName: "${escapedJSName}")` : "@JSClass"; + const className = this.renderIdentifier(swiftName); + this.swiftLines.push(`${annotation} struct ${className} {`); // Process members in declaration order for (const member of node.members) { @@ -491,8 +522,11 @@ export class TypeProcessor { if (this.emittedStructuredTypeNames.has(name)) return; this.emittedStructuredTypeNames.add(name); - const typeName = this.renderIdentifier(name); - this.swiftLines.push(`@JSClass struct ${typeName} {`); + const swiftName = this.swiftTypeName(name); + const escapedJSName = name.replaceAll("\\", "\\\\").replaceAll("\"", "\\\\\""); + const annotation = name !== swiftName ? `@JSClass(jsName: "${escapedJSName}")` : "@JSClass"; + const typeName = this.renderIdentifier(swiftName); + this.swiftLines.push(`${annotation} struct ${typeName} {`); // Collect all declarations with their positions to preserve order /** @type {Array<{ decl: ts.Node, symbol: ts.Symbol, position: number }>} */ @@ -578,7 +612,7 @@ export class TypeProcessor { if (symbol && (symbol.flags & ts.SymbolFlags.Enum) !== 0) { const typeName = symbol.name; this.seenTypes.set(type, node); - return this.renderIdentifier(typeName); + return this.renderTypeIdentifier(typeName); } if (this.checker.isArrayType(type) || this.checker.isTupleType(type) || type.getCallSignatures().length > 0) { @@ -598,7 +632,7 @@ export class TypeProcessor { return "JSObject"; } this.seenTypes.set(type, node); - return this.renderIdentifier(typeName); + return this.renderTypeIdentifier(typeName); } const swiftType = convert(type); this.processedTypes.set(type, swiftType); @@ -659,8 +693,21 @@ export class TypeProcessor { */ renderMethod(node) { if (!node.name) return; - const name = node.name.getText(); - if (!isValidSwiftDeclName(name)) return; + /** @type {string | null} */ + let jsName = null; + if (ts.isIdentifier(node.name)) { + jsName = node.name.text; + } else if (ts.isStringLiteral(node.name) || ts.isNumericLiteral(node.name)) { + jsName = node.name.text; + } else { + // Computed property names like `[Symbol.iterator]` are not supported yet. + return; + } + + const swiftName = this.swiftTypeName(jsName); + const needsJSNameField = jsName !== swiftName; + const escapedJSName = jsName.replaceAll("\\", "\\\\").replaceAll("\"", "\\\\\""); + const annotation = needsJSNameField ? `@JSFunction(jsName: "${escapedJSName}")` : "@JSFunction"; const signature = this.checker.getSignatureFromDeclaration(node); if (!signature) return; @@ -668,9 +715,9 @@ export class TypeProcessor { const params = this.renderParameters(signature.getParameters(), node); const returnType = this.visitType(signature.getReturnType(), node); const effects = this.renderEffects({ isAsync: false }); - const swiftName = this.renderIdentifier(name); + const swiftMethodName = this.renderIdentifier(swiftName); - this.swiftLines.push(` @JSFunction func ${swiftName}(${params}) ${effects} -> ${returnType}`); + this.swiftLines.push(` ${annotation} func ${swiftMethodName}(${params}) ${effects} -> ${returnType}`); } /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/InvalidPropertyNames.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/InvalidPropertyNames.d.ts index d21f3c207..b9d3722b8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/InvalidPropertyNames.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/InvalidPropertyNames.d.ts @@ -21,3 +21,10 @@ interface WeirdNaming { export function createArrayBuffer(): ArrayBufferLike; export function createWeirdObject(): WeirdNaming; + +export class $Weird { + constructor(); + "method-with-dashes"(): void; +} + +export function createWeirdClass(): $Weird; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts index bcd4c7392..42d0d4123 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts @@ -10,6 +10,7 @@ export interface ArrayBufferLike { } export interface WeirdNaming { as(): void; + try(): void; normalProperty: string; "property-with-dashes": number; "123invalidStart": boolean; @@ -19,11 +20,20 @@ export interface WeirdNaming { for: string; Any: string; } +export interface _Weird { + "method-with-dashes"(): void; +} +export interface _Weird { +} export type Exports = { } export type Imports = { createArrayBuffer(): ArrayBufferLike; createWeirdObject(): WeirdNaming; + createWeirdClass(): _Weird; + _Weird: { + new(): _Weird; + } } export function createInstantiator(options: { imports: Imports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index 022b14e0e..66cbe7937 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -210,6 +210,15 @@ export async function createInstantiator(options, swift) { return 0 } } + TestModule["bjs_createWeirdClass"] = function bjs_createWeirdClass() { + try { + let ret = imports.createWeirdClass(); + return swift.memory.retain(ret); + } catch (error) { + setException(error); + return 0 + } + } TestModule["bjs_ArrayBufferLike_byteLength_get"] = function bjs_ArrayBufferLike_byteLength_get(self) { try { let ret = swift.memory.getObject(self).byteLength; @@ -373,6 +382,28 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_WeirdNaming_try"] = function bjs_WeirdNaming_try(self) { + try { + swift.memory.getObject(self).try(); + } catch (error) { + setException(error); + } + } + TestModule["bjs__Weird_init"] = function bjs__Weird_init() { + try { + return swift.memory.retain(new imports.$Weird()); + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs__Weird_method_with_dashes"] = function bjs__Weird_method_with_dashes(self) { + try { + swift.memory.getObject(self)["method-with-dashes"](); + } catch (error) { + setException(error); + } + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift index 73cd7cf45..bfd8589e4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift @@ -33,4 +33,15 @@ @JSGetter var `Any`: String @JSSetter(jsName: "Any") func setAny(_ value: String) throws (JSException) @JSFunction func `as`() throws (JSException) -> Void + @JSFunction func `try`() throws (JSException) -> Void +} + +@JSClass(jsName: "$Weird") struct _Weird { + @JSFunction init() throws (JSException) + @JSFunction(jsName: "method-with-dashes") func method_with_dashes() throws (JSException) -> Void +} + +@JSFunction func createWeirdClass() throws (JSException) -> _Weird + +@JSClass(jsName: "$Weird") struct _Weird { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift index 2922a23f5..0ef52d4d7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift @@ -32,6 +32,23 @@ func _$createWeirdObject() throws(JSException) -> WeirdNaming { return WeirdNaming.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_createWeirdClass") +fileprivate func bjs_createWeirdClass() -> Int32 +#else +fileprivate func bjs_createWeirdClass() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$createWeirdClass() throws(JSException) -> _Weird { + let ret = bjs_createWeirdClass() + if let error = _swift_js_take_exception() { + throw error + } + return _Weird.bridgeJSLiftReturn(ret) +} + #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_ArrayBufferLike_byteLength_get") fileprivate func bjs_ArrayBufferLike_byteLength_get(_ self: Int32) -> Float64 @@ -223,6 +240,15 @@ fileprivate func bjs_WeirdNaming_as(_ self: Int32) -> Void { } #endif +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_try") +fileprivate func bjs_WeirdNaming_try(_ self: Int32) -> Void +#else +fileprivate func bjs_WeirdNaming_try(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + func _$WeirdNaming_normalProperty_get(_ self: JSObject) throws(JSException) -> String { let selfValue = self.bridgeJSLowerParameter() let ret = bjs_WeirdNaming_normalProperty_get(selfValue) @@ -373,4 +399,46 @@ func _$WeirdNaming_as(_ self: JSObject) throws(JSException) -> Void { if let error = _swift_js_take_exception() { throw error } +} + +func _$WeirdNaming_try(_ self: JSObject) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + bjs_WeirdNaming_try(selfValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs__Weird_init") +fileprivate func bjs__Weird_init() -> Int32 +#else +fileprivate func bjs__Weird_init() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs__Weird_method_with_dashes") +fileprivate func bjs__Weird_method_with_dashes(_ self: Int32) -> Void +#else +fileprivate func bjs__Weird_method_with_dashes(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$_Weird_init() throws(JSException) -> JSObject { + let ret = bjs__Weird_init() + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$_Weird_method_with_dashes(_ self: JSObject) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + bjs__Weird_method_with_dashes(selfValue) + if let error = _swift_js_take_exception() { + throw error + } } \ No newline at end of file diff --git a/Sources/JavaScriptKit/Macros.swift b/Sources/JavaScriptKit/Macros.swift index 5a0571ab5..61797a58e 100644 --- a/Sources/JavaScriptKit/Macros.swift +++ b/Sources/JavaScriptKit/Macros.swift @@ -162,9 +162,12 @@ public macro JSSetter(jsName: String? = nil) = /// @JSFunction func greet() throws (JSException) -> String /// @JSFunction init(_ name: String) throws (JSException) /// ``` +/// +/// - Parameter jsName: An optional string that specifies the name of the JavaScript function or method to call. +/// If not provided, the Swift function name is used. @attached(body) @_spi(Experimental) -public macro JSFunction() = +public macro JSFunction(jsName: String? = nil) = #externalMacro(module: "BridgeJSMacros", type: "JSFunctionMacro") /// A macro that adds bridging members for a Swift type that represents a JavaScript class. @@ -187,5 +190,5 @@ public macro JSFunction() = @attached(member, names: arbitrary) @attached(extension, conformances: _JSBridgedClass) @_spi(Experimental) -public macro JSClass() = +public macro JSClass(jsName: String? = nil) = #externalMacro(module: "BridgeJSMacros", type: "JSClassMacro") From e3a10d727129f7bd5111cd9582cbcca387af2230 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 27 Jan 2026 08:47:11 +0900 Subject: [PATCH 097/252] Fixed: TS2Swift was emitting class types twice (once via `visitClassDecl`, then again via `visitStructuredType` when the same type showed up in `seenTypes`), which caused the duplicate `_Weird` interface in `InvalidPropertyNames.Import.d.ts`. - Change: `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js` now records emitted class names in `emittedStructuredTypeNames` so the structured-type pass skips them. - Snapshots refreshed; `swift test --package-path ./Plugins/BridgeJS` passes. --- Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js | 3 +++ .../BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts | 2 -- .../ImportTSTests/InvalidPropertyNames.Macros.swift | 3 --- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 615cffa25..1992b49f2 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -461,6 +461,9 @@ export class TypeProcessor { if (!node.name) return; const jsName = node.name.text; + if (this.emittedStructuredTypeNames.has(jsName)) return; + this.emittedStructuredTypeNames.add(jsName); + const swiftName = this.swiftTypeName(jsName); const escapedJSName = jsName.replaceAll("\\", "\\\\").replaceAll("\"", "\\\\\""); const annotation = jsName !== swiftName ? `@JSClass(jsName: "${escapedJSName}")` : "@JSClass"; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts index 42d0d4123..2efd24317 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts @@ -23,8 +23,6 @@ export interface WeirdNaming { export interface _Weird { "method-with-dashes"(): void; } -export interface _Weird { -} export type Exports = { } export type Imports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift index bfd8589e4..43d6a3eb9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift @@ -42,6 +42,3 @@ } @JSFunction func createWeirdClass() throws (JSException) -> _Weird - -@JSClass(jsName: "$Weird") struct _Weird { -} From 64e7febac8e73a1d8b2ca05489ea170e983f9be7 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 27 Jan 2026 09:02:59 +0900 Subject: [PATCH 098/252] Implemented runtime coverage for `jsName` on `@JSFunction` and `@JSClass`. - Added new import API + XCTest: `Tests/BridgeJSRuntimeTests/bridge-js.d.ts`, `Tests/BridgeJSRuntimeTests/ImportAPITests.swift` - Wired JS-side implementations: `Tests/prelude.mjs` - Regenerated pre-generated files: `./Utilities/bridge-js-generate.sh` (updated `Tests/BridgeJSRuntimeTests/Generated/*`) - Verified: `SWIFT_SDK_ID=DEVELOPMENT-SNAPSHOT-2025-11-03-a-wasm32-unknown-wasip1 make unittest` passes --- .../Generated/BridgeJS.Macros.swift | 7 +++ .../Generated/BridgeJS.swift | 52 +++++++++++++++++++ .../Generated/JavaScript/BridgeJS.json | 41 +++++++++++++++ .../BridgeJSRuntimeTests/ImportAPITests.swift | 7 +++ Tests/BridgeJSRuntimeTests/bridge-js.d.ts | 8 +++ Tests/prelude.mjs | 10 ++++ 6 files changed, 125 insertions(+) diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index 65a46a3f2..ffcfca8dd 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -40,3 +40,10 @@ extension FeatureFlag: _BridgedSwiftEnumNoPayload {} } @JSFunction func runAsyncWorks() throws (JSException) -> JSPromise + +@JSFunction(jsName: "$jsWeirdFunction") func _jsWeirdFunction() throws (JSException) -> Double + +@JSClass(jsName: "$WeirdClass") struct _WeirdClass { + @JSFunction init() throws (JSException) + @JSFunction(jsName: "method-with-dashes") func method_with_dashes() throws (JSException) -> String +} diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 5195bee1e..ed2e5240f 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -6449,6 +6449,23 @@ func _$runAsyncWorks() throws(JSException) -> JSPromise { return JSPromise.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs__jsWeirdFunction") +fileprivate func bjs__jsWeirdFunction() -> Float64 +#else +fileprivate func bjs__jsWeirdFunction() -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +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_JsGreeter_init") fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 @@ -6558,6 +6575,41 @@ func _$JsGreeter_changeName(_ self: JSObject, _ name: String) throws(JSException } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs__WeirdClass_init") +fileprivate func bjs__WeirdClass_init() -> Int32 +#else +fileprivate func bjs__WeirdClass_init() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs__WeirdClass_method_with_dashes") +fileprivate func bjs__WeirdClass_method_with_dashes(_ self: Int32) -> Int32 +#else +fileprivate func bjs__WeirdClass_method_with_dashes(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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_jsApplyInt") fileprivate func bjs_jsApplyInt(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 66a87b063..fb2770ae6 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -9155,6 +9155,18 @@ "_0" : "JSPromise" } } + }, + { + "jsName" : "$jsWeirdFunction", + "name" : "_jsWeirdFunction", + "parameters" : [ + + ], + "returnType" : { + "double" : { + + } + } } ], "types" : [ @@ -9240,6 +9252,35 @@ } } ] + }, + { + "constructor" : { + "parameters" : [ + + ] + }, + "getters" : [ + + ], + "jsName" : "$WeirdClass", + "methods" : [ + { + "jsName" : "method-with-dashes", + "name" : "method_with_dashes", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "_WeirdClass", + "setters" : [ + + ] } ] }, diff --git a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift index 5ceca3bf0..ea9f8c68f 100644 --- a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift @@ -120,4 +120,11 @@ class ImportAPITests: XCTestCase { XCTAssertEqual(ret, 5) XCTAssertEqual(total, 10) } + + func testJSNameFunctionAndClass() throws { + XCTAssertEqual(try _jsWeirdFunction(), 42) + + let obj = try _WeirdClass() + XCTAssertEqual(try obj.method_with_dashes(), "ok") + } } diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts index 87de440d8..983d6052d 100644 --- a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts +++ b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts @@ -23,3 +23,11 @@ export class JsGreeter { } export function runAsyncWorks(): Promise; + +// jsName tests +export function $jsWeirdFunction(): number; + +export class $WeirdClass { + constructor(); + "method-with-dashes"(): string; +} diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 66283b723..47f30a926 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -50,6 +50,9 @@ export async function setupOptions(options, context) { "jsRoundTripFeatureFlag": (flag) => { return flag; }, + "$jsWeirdFunction": () => { + return 42; + }, JsGreeter: class { /** * @param {string} name @@ -67,6 +70,13 @@ export async function setupOptions(options, context) { this.name = name; } }, + $WeirdClass: class { + constructor() { + } + ["method-with-dashes"]() { + return "ok"; + } + }, Foo: ImportedFoo, runAsyncWorks: async () => { const exports = importsContext.getExports(); From 374d796e9bf759b3f17b46fd375d66b99c25c414 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 27 Jan 2026 09:06:48 +0900 Subject: [PATCH 099/252] Format BridgeJS generator sources --- .../BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift | 9 ++++++++- Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index b1dced37e..e2f1c3cf4 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -1947,7 +1947,14 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { private func enterJSClass(_ typeName: String, jsName: String?) { stateStack.append(.jsClassBody(name: typeName)) - currentType = CurrentType(name: typeName, jsName: jsName, constructor: nil, methods: [], getters: [], setters: []) + currentType = CurrentType( + name: typeName, + jsName: jsName, + constructor: nil, + methods: [], + getters: [], + setters: [] + ) } private func exitJSClass() { diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index c42437dbe..ab4251c2c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -2242,7 +2242,8 @@ extension BridgeJSLink { } private static func propertyAccessExpr(objectExpr: String, propertyName: String) -> String { - if propertyName.range(of: #"^[$A-Z_][0-9A-Z_$]*$"#, options: [.regularExpression, .caseInsensitive]) != nil { + if propertyName.range(of: #"^[$A-Z_][0-9A-Z_$]*$"#, options: [.regularExpression, .caseInsensitive]) != nil + { return "\(objectExpr).\(propertyName)" } let escapedName = BridgeJSLink.escapeForJavaScriptStringLiteral(propertyName) From da51c40f8370f9b21029e0c9c4e5490336ee7abb Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 27 Jan 2026 09:32:17 +0900 Subject: [PATCH 100/252] BridgeJS: allow @JS structs to copy from JSObject Add struct-level helpers for copying values out of a backing JS object and raising a new JS object from a Swift struct. This makes it possible to round-trip JSON-style plain objects without manual field mapping, while keeping the default value semantics of exported structs. --- Benchmarks/Sources/Generated/BridgeJS.swift | 168 ++++++ .../Sources/BridgeJSCore/ExportSwift.swift | 88 ++- .../Sources/BridgeJSLink/BridgeJSLink.swift | 49 ++ .../Sources/BridgeJSLink/JSGlueGen.swift | 2 + .../ArrayParameter.Import.js | 11 + .../BridgeJSLinkTests/Async.Export.js | 11 + .../BridgeJSLinkTests/Async.Import.js | 11 + .../DefaultParameters.Export.js | 33 ++ .../EnumAssociatedValue.Export.js | 11 + .../BridgeJSLinkTests/EnumCase.Export.js | 11 + .../BridgeJSLinkTests/EnumNamespace.Export.js | 11 + .../EnumNamespace.Global.Export.js | 11 + .../BridgeJSLinkTests/EnumRawType.Export.js | 11 + .../GlobalGetter.ImportMacros.js | 11 + .../ImportedTypeInExportedInterface.Export.js | 11 + .../BridgeJSLinkTests/Interface.Import.js | 11 + .../InvalidPropertyNames.Import.js | 11 + .../BridgeJSLinkTests/MixedGlobal.Export.js | 11 + .../BridgeJSLinkTests/MixedModules.Export.js | 11 + .../BridgeJSLinkTests/MixedPrivate.Export.js | 11 + .../MultipleImportedTypes.Import.js | 11 + .../BridgeJSLinkTests/Namespaces.Export.js | 11 + .../Namespaces.Global.Export.js | 11 + .../BridgeJSLinkTests/Optionals.Export.js | 11 + .../PrimitiveParameters.Export.js | 11 + .../PrimitiveParameters.Import.js | 11 + .../PrimitiveReturn.Export.js | 11 + .../PrimitiveReturn.Import.js | 11 + .../BridgeJSLinkTests/PropertyTypes.Export.js | 11 + .../BridgeJSLinkTests/Protocol.Export.js | 11 + .../BridgeJSLinkTests/ReExportFrom.Import.js | 11 + .../StaticFunctions.Export.js | 11 + .../StaticFunctions.Global.Export.js | 11 + .../StaticProperties.Export.js | 11 + .../StaticProperties.Global.Export.js | 11 + .../BridgeJSLinkTests/StringEnum.Import.js | 11 + .../StringParameter.Export.js | 11 + .../StringParameter.Import.js | 11 + .../BridgeJSLinkTests/StringReturn.Export.js | 11 + .../BridgeJSLinkTests/StringReturn.Import.js | 11 + .../BridgeJSLinkTests/SwiftClass.Export.js | 11 + .../BridgeJSLinkTests/SwiftClosure.Export.js | 11 + .../SwiftClosureImports.ImportMacros.js | 11 + .../BridgeJSLinkTests/SwiftStruct.Export.js | 66 +++ .../TS2SkeletonLike.Import.js | 11 + .../BridgeJSLinkTests/Throws.Export.js | 11 + .../BridgeJSLinkTests/TypeAlias.Import.js | 11 + .../TypeScriptClass.Import.js | 11 + .../VoidParameterVoidReturn.Export.js | 11 + .../VoidParameterVoidReturn.Import.js | 11 + .../ExportSwiftTests/DefaultParameters.swift | 84 +++ .../ExportSwiftTests/SwiftStruct.swift | 210 +++++++ .../JavaScriptKit/BridgeJSIntrinsics.swift | 11 + .../BridgeJSRuntimeTests/ExportAPITests.swift | 32 + .../Generated/BridgeJS.swift | 561 ++++++++++++++++++ .../Generated/JavaScript/BridgeJS.json | 213 +++++++ Tests/prelude.mjs | 25 + 57 files changed, 2023 insertions(+), 3 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 85d81f4a2..7d90eb82b 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -267,7 +267,49 @@ extension SimpleStruct: _BridgedSwiftStruct { _swift_js_push_f32(self.rate) _swift_js_push_f64(self.precise) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _SimpleStructHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _SimpleStructHelpers.raise() + } +} + +fileprivate enum _SimpleStructHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_SimpleStruct(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_SimpleStruct())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_SimpleStruct") +fileprivate func _bjs_struct_lower_SimpleStruct(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_SimpleStruct(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_SimpleStruct") +fileprivate func _bjs_struct_raise_SimpleStruct() -> Int32 +#else +fileprivate func _bjs_struct_raise_SimpleStruct() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif extension Address: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Address { @@ -288,7 +330,49 @@ extension Address: _BridgedSwiftStruct { } _swift_js_push_int(Int32(self.zipCode)) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _AddressHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _AddressHelpers.raise() + } +} + +fileprivate enum _AddressHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Address())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Address") +fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Address") +fileprivate func _bjs_struct_raise_Address() -> Int32 +#else +fileprivate func _bjs_struct_raise_Address() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif extension Person: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Person { @@ -315,7 +399,49 @@ extension Person: _BridgedSwiftStruct { } _swift_js_push_int(__bjs_isSome_email ? 1 : 0) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _PersonHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _PersonHelpers.raise() + } +} + +fileprivate enum _PersonHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_Person(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Person())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Person") +fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Person") +fileprivate func _bjs_struct_raise_Person() -> Int32 +#else +fileprivate func _bjs_struct_raise_Person() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif extension ComplexStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ComplexStruct { @@ -345,7 +471,49 @@ extension ComplexStruct: _BridgedSwiftStruct { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _ComplexStructHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _ComplexStructHelpers.raise() + } +} + +fileprivate enum _ComplexStructHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_ComplexStruct(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ComplexStruct())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ComplexStruct") +fileprivate func _bjs_struct_lower_ComplexStruct(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_ComplexStruct(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_ComplexStruct") +fileprivate func _bjs_struct_raise_ComplexStruct() -> Int32 +#else +fileprivate func _bjs_struct_raise_ComplexStruct() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif @_expose(wasm, "bjs_run") @_cdecl("bjs_run") diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index a40f9c2b6..d89d426ee 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -74,7 +74,7 @@ public class ExportSwift { let structCodegen = StructCodegen() for structDef in skeleton.structs { - decls.append(structCodegen.renderStructHelpers(structDef)) + decls.append(contentsOf: structCodegen.renderStructHelpers(structDef)) decls.append(contentsOf: try renderSingleExportedStruct(struct: structDef)) } @@ -1147,12 +1147,19 @@ struct EnumCodegen { struct StructCodegen { private let stackCodegen = StackCodegen() - func renderStructHelpers(_ structDef: ExportedStruct) -> DeclSyntax { + func renderStructHelpers(_ structDef: ExportedStruct) -> [DeclSyntax] { let typeName = structDef.swiftCallName let liftCode = generateStructLiftCode(structDef: structDef) let lowerCode = generateStructLowerCode(structDef: structDef) + let accessControl = structDef.explicitAccessControl.map { "\($0) " } ?? "" - return """ + let helpersTypeName = "_\(structDef.name)Helpers" + let lowerExternName = "swift_js_struct_lower_\(structDef.name)" + let raiseExternName = "swift_js_struct_raise_\(structDef.name)" + let lowerFunctionName = "_bjs_struct_lower_\(structDef.name)" + let raiseFunctionName = "_bjs_struct_raise_\(structDef.name)" + + let bridgedStructExtension: DeclSyntax = """ extension \(raw: typeName): _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> \(raw: typeName) { \(raw: liftCode.joined(separator: "\n")) @@ -1161,8 +1168,83 @@ struct StructCodegen { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { \(raw: lowerCode.joined(separator: "\n")) } + + \(raw: accessControl)init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = \(raw: helpersTypeName).lower(jsObject) + defer { _swift_js_struct_cleanup(__bjs_cleanupId) } + self = Self.bridgeJSLiftParameter() + } + + \(raw: accessControl)func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return \(raw: helpersTypeName).raise() + } } """ + + let helpersType: DeclSyntax = """ + fileprivate enum \(raw: helpersTypeName) { + static func lower(_ jsObject: JSObject) -> Int32 { + return \(raw: lowerFunctionName)(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: \(raw: raiseFunctionName)())) + } + } + """ + + let lowerExternDecl = Self.renderStructExtern( + externName: lowerExternName, + functionName: lowerFunctionName, + signature: SwiftSignatureBuilder.buildABIFunctionSignature( + abiParameters: [("objectId", .i32)], + returnType: .i32 + ) + ) + let raiseExternDecl = Self.renderStructExtern( + externName: raiseExternName, + functionName: raiseFunctionName, + signature: SwiftSignatureBuilder.buildABIFunctionSignature( + abiParameters: [], + returnType: .i32 + ) + ) + + return [bridgedStructExtension, helpersType, lowerExternDecl, raiseExternDecl] + } + + private static func renderStructExtern( + externName: String, + functionName: String, + signature: FunctionSignatureSyntax + ) -> DeclSyntax { + let externFuncDecl = SwiftCodePattern.buildExternFunctionDecl( + moduleName: "bjs", + abiName: externName, + functionName: functionName, + signature: signature + ) + + let stubFuncDecl = FunctionDeclSyntax( + modifiers: DeclModifierListSyntax { + DeclModifierSyntax(name: .keyword(.fileprivate)) + }, + funcKeyword: .keyword(.func), + name: .identifier(functionName), + signature: signature, + body: CodeBlockSyntax { + "fatalError(\"Only available on WebAssembly\")" + } + ) + + return DeclSyntax( + SwiftCodePattern.buildWasmConditionalCompilationDecls( + wasmDecl: DeclSyntax(externFuncDecl), + elseDecl: DeclSyntax(stubFuncDecl) + ) + ) } private func generateStructLiftCode(structDef: ExportedStruct) -> [String] { diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 929e6e4cd..72cd7b020 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -245,6 +245,7 @@ public struct BridgeJSLink { "let \(JSGlueVariableScope.reservedTmpParamF64s) = [];", "let \(JSGlueVariableScope.reservedTmpRetPointers) = [];", "let \(JSGlueVariableScope.reservedTmpParamPointers) = [];", + "let \(JSGlueVariableScope.reservedTmpStructCleanups) = [];", "const \(JSGlueVariableScope.reservedEnumHelpers) = {};", "const \(JSGlueVariableScope.reservedStructHelpers) = {};", "", @@ -295,6 +296,7 @@ public struct BridgeJSLink { private func generateAddImports() -> CodeFragmentPrinter { let printer = CodeFragmentPrinter() + let allStructs = skeletons.compactMap { $0.exported?.structs }.flatMap { $0 } printer.write("return {") printer.indent { printer.write(lines: [ @@ -427,6 +429,53 @@ public struct BridgeJSLink { printer.write("return \(JSGlueVariableScope.reservedTmpParamPointers).pop();") } printer.write("}") + + printer.write("bjs[\"swift_js_struct_cleanup\"] = function(cleanupId) {") + printer.indent { + printer.write("if (cleanupId === 0) { return; }") + printer.write("const index = (cleanupId | 0) - 1;") + printer.write("const cleanup = \(JSGlueVariableScope.reservedTmpStructCleanups)[index];") + printer.write("\(JSGlueVariableScope.reservedTmpStructCleanups)[index] = null;") + printer.write("if (cleanup) { cleanup(); }") + printer.write( + "while (\(JSGlueVariableScope.reservedTmpStructCleanups).length > 0 && \(JSGlueVariableScope.reservedTmpStructCleanups)[\(JSGlueVariableScope.reservedTmpStructCleanups).length - 1] == null) {" + ) + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpStructCleanups).pop();") + } + printer.write("}") + } + printer.write("}") + + if !allStructs.isEmpty { + for structDef in allStructs { + printer.write("bjs[\"swift_js_struct_lower_\(structDef.name)\"] = function(objectId) {") + printer.indent { + printer.write( + "const { cleanup: cleanup } = \(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).lower(\(JSGlueVariableScope.reservedSwift).memory.getObject(objectId));" + ) + printer.write("if (cleanup) {") + printer.indent { + printer.write( + "return \(JSGlueVariableScope.reservedTmpStructCleanups).push(cleanup);" + ) + } + printer.write("}") + printer.write("return 0;") + } + printer.write("}") + + printer.write("bjs[\"swift_js_struct_raise_\(structDef.name)\"] = function() {") + printer.indent { + printer.write( + "const value = \(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + ) + printer.write("return \(JSGlueVariableScope.reservedSwift).memory.retain(value);") + } + printer.write("}") + } + } + printer.write("bjs[\"swift_js_return_optional_bool\"] = function(isSome, value) {") printer.indent { printer.write("if (isSome === 0) {") diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index d9223faf8..20257f749 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -30,6 +30,7 @@ final class JSGlueVariableScope { static let reservedTmpParamF64s = "tmpParamF64s" static let reservedTmpRetPointers = "tmpRetPointers" static let reservedTmpParamPointers = "tmpParamPointers" + static let reservedTmpStructCleanups = "tmpStructCleanups" static let reservedEnumHelpers = "enumHelpers" static let reservedStructHelpers = "structHelpers" @@ -58,6 +59,7 @@ final class JSGlueVariableScope { reservedTmpParamF64s, reservedTmpRetPointers, reservedTmpParamPointers, + reservedTmpStructCleanups, reservedEnumHelpers, reservedStructHelpers, ] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js index d477487e5..84af4bccb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js index c01eac976..916eafb1f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js index 15b2a9742..4e47329f0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index 48dfc0994..6923db749 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -34,6 +34,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -153,6 +154,38 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } + bjs["swift_js_struct_lower_Config"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.Config.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_raise_Config"] = function() { + const value = structHelpers.Config.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } + bjs["swift_js_struct_lower_MathOperations"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.MathOperations.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_raise_MathOperations"] = function() { + const value = structHelpers.MathOperations.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index a15e386e8..bbceab383 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -503,6 +503,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -575,6 +576,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js index 9cd3e1f3b..79fba73b0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js @@ -52,6 +52,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -124,6 +125,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index 34a2e0540..4c09e3bd9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -53,6 +53,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -125,6 +126,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js index 074380d00..584788f20 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js @@ -72,6 +72,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -144,6 +145,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js index 00b542e30..63f18d4d5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js @@ -103,6 +103,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -175,6 +176,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js index 89aa3af9d..32593d2ae 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js index 93c23a0db..3cfc76bb3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js index 83450b4c5..41b006340 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index 60435e569..f76ad31cb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js index ce9475b0c..5e258f47a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js index c4a1c2e3a..0b4f1bca0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js index d0f00f279..d3f325f74 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index 40a3f4e3f..d0fc9931d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index 0b6ef40dc..d134a8fff 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js index 6b4d37fc5..554d8d794 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js index 9770da2db..8b10a7e98 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js index 761397287..faca8ce39 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js index a0f2c8b08..4c628d1db 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js index ec4dd9cab..135640249 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js index 871e16a30..9621baf26 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js index 240ee9cd5..35d68c047 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index d6b9a4f01..0cf44ffdc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -92,6 +92,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -164,6 +165,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js index 4a13f2d7d..de20a1194 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index 9d69f4183..201d0fd6b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -79,6 +79,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -151,6 +152,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js index a7e6c44cc..e971c0161 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js @@ -79,6 +79,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -151,6 +152,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js index 8019f2a44..352d1a2c0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js @@ -33,6 +33,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -105,6 +106,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js index 7c4c11f69..98f4cfdf8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js @@ -33,6 +33,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -105,6 +106,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js index 7c30768f5..5b399b276 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js index 891f4bb01..4d76cbb7e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js index 03a65cc47..82b4068ed 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js index 489fbe092..2d3679926 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js index 49fafc92e..b4ba16cf9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js index f95ee4367..87773621d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js index 8bdbfa4be..b4a073d7a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js @@ -130,6 +130,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -202,6 +203,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js index db434c2ab..461d55aff 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js index 07a2f320f..abcd9500d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -260,6 +261,71 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } + bjs["swift_js_struct_lower_DataPoint"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.DataPoint.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_raise_DataPoint"] = function() { + const value = structHelpers.DataPoint.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } + bjs["swift_js_struct_lower_Address"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.Address.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_raise_Address"] = function() { + const value = structHelpers.Address.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } + bjs["swift_js_struct_lower_Person"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.Person.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_raise_Person"] = function() { + const value = structHelpers.Person.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } + bjs["swift_js_struct_lower_Session"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.Session.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_raise_Session"] = function() { + const value = structHelpers.Session.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } + bjs["swift_js_struct_lower_ConfigStruct"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.ConfigStruct.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_raise_ConfigStruct"] = function() { + const value = structHelpers.ConfigStruct.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js index 2bbae4fec..0b0de98cd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js index 016ebaa53..820a221a2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js index 8b46062c4..1b2485296 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index 6c44fd008..e0ae6c7a7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js index 148418657..8564697d3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -100,6 +101,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js index c22ff8c5a..16e42865c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +102,16 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index d5e5bdc48..cd305f407 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -53,7 +53,49 @@ extension Config: _BridgedSwiftStruct { _swift_js_push_int(Int32(self.value)) _swift_js_push_int(self.enabled ? 1 : 0) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _ConfigHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _ConfigHelpers.raise() + } +} + +fileprivate enum _ConfigHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_Config(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Config())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Config") +fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Config") +fileprivate func _bjs_struct_raise_Config() -> Int32 +#else +fileprivate func _bjs_struct_raise_Config() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif extension MathOperations: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MathOperations { @@ -64,7 +106,49 @@ extension MathOperations: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { _swift_js_push_f64(self.baseValue) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _MathOperationsHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _MathOperationsHelpers.raise() + } +} + +fileprivate enum _MathOperationsHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_MathOperations(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_MathOperations())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MathOperations") +fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_MathOperations") +fileprivate func _bjs_struct_raise_MathOperations() -> Int32 +#else +fileprivate func _bjs_struct_raise_MathOperations() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif @_expose(wasm, "bjs_MathOperations_init") @_cdecl("bjs_MathOperations_init") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift index a09d312d3..fa094a1b8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift @@ -26,8 +26,50 @@ extension DataPoint: _BridgedSwiftStruct { } _swift_js_push_int(__bjs_isSome_optFlag ? 1 : 0) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _DataPointHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _DataPointHelpers.raise() + } } +fileprivate enum _DataPointHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_DataPoint(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_DataPoint())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_DataPoint") +fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_DataPoint") +fileprivate func _bjs_struct_raise_DataPoint() -> Int32 +#else +fileprivate func _bjs_struct_raise_DataPoint() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_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 { @@ -62,8 +104,50 @@ extension Address: _BridgedSwiftStruct { } _swift_js_push_int(__bjs_isSome_zipCode ? 1 : 0) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _AddressHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _AddressHelpers.raise() + } } +fileprivate enum _AddressHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Address())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Address") +fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Address") +fileprivate func _bjs_struct_raise_Address() -> Int32 +#else +fileprivate func _bjs_struct_raise_Address() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + extension Person: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Person { let email = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32()) @@ -89,8 +173,50 @@ extension Person: _BridgedSwiftStruct { } _swift_js_push_int(__bjs_isSome_email ? 1 : 0) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _PersonHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _PersonHelpers.raise() + } +} + +fileprivate enum _PersonHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_Person(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Person())) + } } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Person") +fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Person") +fileprivate func _bjs_struct_raise_Person() -> Int32 +#else +fileprivate func _bjs_struct_raise_Person() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + extension Session: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Session { let owner = Greeter.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) @@ -102,7 +228,49 @@ extension Session: _BridgedSwiftStruct { _swift_js_push_int(Int32(self.id)) _swift_js_push_pointer(self.owner.bridgeJSLowerReturn()) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _SessionHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _SessionHelpers.raise() + } +} + +fileprivate enum _SessionHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_Session(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Session())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Session") +fileprivate func _bjs_struct_lower_Session(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Session(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Session") +fileprivate func _bjs_struct_raise_Session() -> Int32 +#else +fileprivate func _bjs_struct_raise_Session() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif extension ConfigStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ConfigStruct { @@ -112,7 +280,49 @@ extension ConfigStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _ConfigStructHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _ConfigStructHelpers.raise() + } +} + +fileprivate enum _ConfigStructHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_ConfigStruct(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ConfigStruct())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ConfigStruct") +fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_ConfigStruct") +fileprivate func _bjs_struct_raise_ConfigStruct() -> Int32 +#else +fileprivate func _bjs_struct_raise_ConfigStruct() -> Int32 { + fatalError("Only available on WebAssembly") } +#endif @_expose(wasm, "bjs_ConfigStruct_static_maxRetries_get") @_cdecl("bjs_ConfigStruct_static_maxRetries_get") diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 92ab52f04..9f74cfdc7 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -441,6 +441,17 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo } #endif +// MARK: Struct bridging helpers (JS-side lowering/raising) + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_cleanup") +@_spi(BridgeJS) public func _swift_js_struct_cleanup(_ cleanupId: Int32) +#else +@_spi(BridgeJS) public func _swift_js_struct_cleanup(_ cleanupId: Int32) { + _onlyAvailableOnWasm() +} +#endif + // MARK: Wasm externs used by type lowering/lifting #if arch(wasm32) diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 0df421df6..59f48aed4 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -1318,6 +1318,38 @@ enum APIOptionalResult { return "\(point.x),\(point.y),\(point.label)" } +@JS struct CopyableCart { + var x: Int + var note: String? + + @JS static func fromJSObject(_ object: JSObject) -> CopyableCart { + CopyableCart(unsafelyCopying: object) + } +} + +@JS func cartToJSObject(_ cart: CopyableCart) -> JSObject { + cart.toJSObject() +} + +@JS struct CopyableCartItem { + var sku: String + var quantity: Int +} + +@JS struct CopyableNestedCart { + var id: Int + var item: CopyableCartItem + var shippingAddress: Address? + + @JS static func fromJSObject(_ object: JSObject) -> CopyableNestedCart { + CopyableNestedCart(unsafelyCopying: object) + } +} + +@JS func nestedCartToJSObject(_ cart: CopyableNestedCart) -> JSObject { + cart.toJSObject() +} + @JS struct ConfigStruct { var name: String var value: Int diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 5195bee1e..616cc7195 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2240,8 +2240,50 @@ extension DataPoint: _BridgedSwiftStruct { } _swift_js_push_int(__bjs_isSome_optFlag ? 1 : 0) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _DataPointHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _DataPointHelpers.raise() + } +} + +fileprivate enum _DataPointHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_DataPoint(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_DataPoint())) + } } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_DataPoint") +fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_DataPoint") +fileprivate func _bjs_struct_raise_DataPoint() -> Int32 +#else +fileprivate func _bjs_struct_raise_DataPoint() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_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 { @@ -2276,7 +2318,49 @@ extension Address: _BridgedSwiftStruct { } _swift_js_push_int(__bjs_isSome_zipCode ? 1 : 0) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _AddressHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _AddressHelpers.raise() + } +} + +fileprivate enum _AddressHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Address())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Address") +fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Address") +fileprivate func _bjs_struct_raise_Address() -> Int32 +#else +fileprivate func _bjs_struct_raise_Address() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif extension Contact: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Contact { @@ -2309,8 +2393,50 @@ extension Contact: _BridgedSwiftStruct { } _swift_js_push_int(__bjs_isSome_secondaryAddress ? 1 : 0) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _ContactHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _ContactHelpers.raise() + } } +fileprivate enum _ContactHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_Contact(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Contact())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Contact") +fileprivate func _bjs_struct_lower_Contact(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Contact(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Contact") +fileprivate func _bjs_struct_raise_Contact() -> Int32 +#else +fileprivate func _bjs_struct_raise_Contact() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + extension Config: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Config { let status = Status.bridgeJSLiftParameter(_swift_js_pop_param_int32()) @@ -2340,7 +2466,49 @@ extension Config: _BridgedSwiftStruct { _swift_js_push_int(__bjs_isSome_direction ? 1 : 0) _swift_js_push_int(Int32(self.status.bridgeJSLowerParameter())) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _ConfigHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _ConfigHelpers.raise() + } +} + +fileprivate enum _ConfigHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_Config(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Config())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Config") +fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Config") +fileprivate func _bjs_struct_raise_Config() -> Int32 +#else +fileprivate func _bjs_struct_raise_Config() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif extension SessionData: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> SessionData { @@ -2357,8 +2525,50 @@ extension SessionData: _BridgedSwiftStruct { } _swift_js_push_int(__bjs_isSome_owner ? 1 : 0) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _SessionDataHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _SessionDataHelpers.raise() + } } +fileprivate enum _SessionDataHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_SessionData(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_SessionData())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_SessionData") +fileprivate func _bjs_struct_lower_SessionData(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_SessionData(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_SessionData") +fileprivate func _bjs_struct_raise_SessionData() -> Int32 +#else +fileprivate func _bjs_struct_raise_SessionData() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + extension ValidationReport: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ValidationReport { let outcome = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) @@ -2382,8 +2592,50 @@ extension ValidationReport: _BridgedSwiftStruct { } _swift_js_push_int(__bjs_isSome_outcome ? 1 : 0) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _ValidationReportHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _ValidationReportHelpers.raise() + } +} + +fileprivate enum _ValidationReportHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_ValidationReport(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ValidationReport())) + } } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ValidationReport") +fileprivate func _bjs_struct_lower_ValidationReport(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_ValidationReport(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_ValidationReport") +fileprivate func _bjs_struct_raise_ValidationReport() -> Int32 +#else +fileprivate func _bjs_struct_raise_ValidationReport() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + extension MathOperations: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MathOperations { let baseValue = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) @@ -2393,7 +2645,49 @@ extension MathOperations: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { _swift_js_push_f64(self.baseValue) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _MathOperationsHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _MathOperationsHelpers.raise() + } +} + +fileprivate enum _MathOperationsHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_MathOperations(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_MathOperations())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MathOperations") +fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_MathOperations") +fileprivate func _bjs_struct_raise_MathOperations() -> Int32 +#else +fileprivate func _bjs_struct_raise_MathOperations() -> Int32 { + fatalError("Only available on WebAssembly") } +#endif @_expose(wasm, "bjs_MathOperations_init") @_cdecl("bjs_MathOperations_init") @@ -2439,6 +2733,209 @@ public func _bjs_MathOperations_static_subtract(_ a: Float64, _ b: Float64) -> F #endif } +extension CopyableCart: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> CopyableCart { + let note = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let x = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + return CopyableCart(x: x, note: note) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_int(Int32(self.x)) + let __bjs_isSome_note = self.note != nil + if let __bjs_unwrapped_note = self.note { + var __bjs_str_note = __bjs_unwrapped_note + __bjs_str_note.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + } + _swift_js_push_int(__bjs_isSome_note ? 1 : 0) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _CopyableCartHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _CopyableCartHelpers.raise() + } +} + +fileprivate enum _CopyableCartHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_CopyableCart(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_CopyableCart())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableCart") +fileprivate func _bjs_struct_lower_CopyableCart(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_CopyableCart(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_CopyableCart") +fileprivate func _bjs_struct_raise_CopyableCart() -> Int32 +#else +fileprivate func _bjs_struct_raise_CopyableCart() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_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 bridgeJSLiftParameter() -> CopyableCartItem { + let quantity = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let sku = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + return CopyableCartItem(sku: sku, quantity: quantity) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + var __bjs_sku = self.sku + __bjs_sku.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(self.quantity)) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _CopyableCartItemHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _CopyableCartItemHelpers.raise() + } +} + +fileprivate enum _CopyableCartItemHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_CopyableCartItem(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_CopyableCartItem())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableCartItem") +fileprivate func _bjs_struct_lower_CopyableCartItem(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_CopyableCartItem(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_CopyableCartItem") +fileprivate func _bjs_struct_raise_CopyableCartItem() -> Int32 +#else +fileprivate func _bjs_struct_raise_CopyableCartItem() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +extension CopyableNestedCart: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> CopyableNestedCart { + let shippingAddress = Optional
        .bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let item = CopyableCartItem.bridgeJSLiftParameter() + let id = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + return CopyableNestedCart(id: id, item: item, shippingAddress: shippingAddress) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_int(Int32(self.id)) + self.item.bridgeJSLowerReturn() + let __bjs_isSome_shippingAddress = self.shippingAddress != nil + if let __bjs_unwrapped_shippingAddress = self.shippingAddress { + __bjs_unwrapped_shippingAddress.bridgeJSLowerReturn() + } + _swift_js_push_int(__bjs_isSome_shippingAddress ? 1 : 0) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _CopyableNestedCartHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _CopyableNestedCartHelpers.raise() + } +} + +fileprivate enum _CopyableNestedCartHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_CopyableNestedCart(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_CopyableNestedCart())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableNestedCart") +fileprivate func _bjs_struct_lower_CopyableNestedCart(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_CopyableNestedCart(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_CopyableNestedCart") +fileprivate func _bjs_struct_raise_CopyableNestedCart() -> Int32 +#else +fileprivate func _bjs_struct_raise_CopyableNestedCart() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_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 bridgeJSLiftParameter() -> ConfigStruct { let value = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) @@ -2453,8 +2950,50 @@ extension ConfigStruct: _BridgedSwiftStruct { } _swift_js_push_int(Int32(self.value)) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _ConfigStructHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _ConfigStructHelpers.raise() + } } +fileprivate enum _ConfigStructHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_ConfigStruct(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ConfigStruct())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ConfigStruct") +fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_ConfigStruct") +fileprivate func _bjs_struct_raise_ConfigStruct() -> Int32 +#else +fileprivate func _bjs_struct_raise_ConfigStruct() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_ConfigStruct_static_defaultConfig_get") @_cdecl("bjs_ConfigStruct_static_defaultConfig_get") public func _bjs_ConfigStruct_static_defaultConfig_get() -> Void { @@ -3858,6 +4397,28 @@ public func _bjs_testStructDefault() -> Void { #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 { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 66a87b063..c16b65a00 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -7742,6 +7742,56 @@ } } }, + { + "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" : { @@ -8855,6 +8905,169 @@ ], "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" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "note", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "swiftCallName" : "CopyableCart" + }, + { + "methods" : [ + + ], + "name" : "CopyableCartItem", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "sku", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "quantity", + "type" : { + "int" : { + + } + } + } + ], + "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" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "item", + "type" : { + "swiftStruct" : { + "_0" : "CopyableCartItem" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "shippingAddress", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Address" + } + } + } + } + } + ], + "swiftCallName" : "CopyableNestedCart" + }, { "methods" : [ diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 66283b723..e7441d537 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -1032,6 +1032,31 @@ function testStructSupport(exports) { const customPoint = { x: 10.0, y: 20.0, label: "custom", optCount: null, optFlag: null }; assert.equal(exports.testStructDefault(customPoint), "10.0,20.0,custom"); + // Test @JS struct init(unsafelyCopying:) + toJSObject() + const cart1 = { x: 123, note: "hello" }; + assert.deepEqual(exports.CopyableCart.fromJSObject(cart1), cart1); + assert.deepEqual(exports.cartToJSObject(cart1), cart1); + + const cart2 = { x: 1 }; + assert.deepEqual(exports.CopyableCart.fromJSObject(cart2), { x: 1, note: null }); + assert.deepEqual(exports.cartToJSObject(cart2), { x: 1, note: null }); + + const nestedCart1 = { + id: 7, + item: { sku: "ABC-123", quantity: 2 }, + shippingAddress: { street: "1 Swift Way", city: "WasmCity", zipCode: 12345 }, + }; + assert.deepEqual(exports.CopyableNestedCart.fromJSObject(nestedCart1), nestedCart1); + assert.deepEqual(exports.nestedCartToJSObject(nestedCart1), nestedCart1); + + const nestedCart2 = { + id: 8, + item: { sku: "XYZ-999", quantity: 0 }, + shippingAddress: null, + }; + assert.deepEqual(exports.CopyableNestedCart.fromJSObject(nestedCart2), nestedCart2); + assert.deepEqual(exports.nestedCartToJSObject(nestedCart2), nestedCart2); + const container = exports.testContainerWithStruct({ x: 5.0, y: 10.0, label: "test", optCount: null, optFlag: true }); assert.equal(container.location.x, 5.0); assert.equal(container.config, null); From 89e3532f8a8c75b36b09ed67c5f9869ad04b4755 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 27 Jan 2026 11:05:27 +0900 Subject: [PATCH 101/252] BridgeJS: support UnsafePointer-family types (#525) * BridgeJS: support UnsafePointer-family types Allow UnsafePointer/UnsafeRawPointer/OpaquePointer as BridgeJS parameter/return and struct field types by lowering them to WASM pointers. Updates codegen/runtime intrinsics and adds coverage in generator snapshots + runtime exports. * Format --- .../Sources/BridgeJSCore/ExportSwift.swift | 26 ++ .../Sources/BridgeJSCore/ImportTS.swift | 4 + .../BridgeJSCore/SwiftToSkeleton.swift | 54 +++ .../Sources/BridgeJSLink/BridgeJSLink.swift | 2 + .../Sources/BridgeJSLink/JSGlueGen.swift | 22 +- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 45 ++ .../Inputs/UnsafePointer.swift | 39 ++ .../UnsafePointer.Export.d.ts | 38 ++ .../BridgeJSLinkTests/UnsafePointer.Export.js | 283 ++++++++++++ .../ExportSwiftTests/UnsafePointer.json | 413 ++++++++++++++++++ .../ExportSwiftTests/UnsafePointer.swift | 145 ++++++ .../JavaScriptKit/BridgeJSIntrinsics.swift | 128 ++++++ .../BridgeJSRuntimeTests/ExportAPITests.swift | 40 ++ .../Generated/BridgeJS.swift | 96 ++++ .../Generated/JavaScript/BridgeJS.json | 312 +++++++++++++ Tests/prelude.mjs | 11 + 16 files changed, 1657 insertions(+), 1 deletion(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/UnsafePointer.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index a40f9c2b6..0718a1a73 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -772,6 +772,8 @@ struct StackCodegen { return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" case .swiftHeapObject(let className): return "\(raw: className).bridgeJSLiftParameter(_swift_js_pop_param_pointer())" + case .unsafePointer: + return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_param_pointer())" case .swiftProtocol: // Protocols are handled via JSObject return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" @@ -872,6 +874,8 @@ struct StackCodegen { return ["_swift_js_push_int(\(raw: accessor).bridgeJSLowerParameter())"] case .swiftHeapObject: return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] + case .unsafePointer: + return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] case .swiftProtocol: return ["_swift_js_push_int(\(raw: accessor).bridgeJSLowerParameter())"] case .caseEnum: @@ -1421,6 +1425,23 @@ extension WasmCoreType { } } +extension UnsafePointerType { + var swiftType: String { + switch kind { + case .unsafePointer: + return "UnsafePointer<\(pointee ?? "Never")>" + case .unsafeMutablePointer: + return "UnsafeMutablePointer<\(pointee ?? "Never")>" + case .unsafeRawPointer: + return "UnsafeRawPointer" + case .unsafeMutableRawPointer: + return "UnsafeMutableRawPointer" + case .opaquePointer: + return "OpaquePointer" + } + } +} + extension BridgeType { var swiftType: String { switch self { @@ -1432,6 +1453,7 @@ extension BridgeType { case .jsObject(nil): return "JSObject" case .jsObject(let name?): return name case .swiftHeapObject(let name): return name + case .unsafePointer(let ptr): return ptr.swiftType case .swiftProtocol(let name): return "Any\(name)" case .void: return "Void" case .optional(let wrappedType): return "Optional<\(wrappedType.swiftType)>" @@ -1457,6 +1479,7 @@ extension BridgeType { static let string = LiftingIntrinsicInfo(parameters: [("bytes", .i32), ("length", .i32)]) static let jsObject = LiftingIntrinsicInfo(parameters: [("value", .i32)]) static let swiftHeapObject = LiftingIntrinsicInfo(parameters: [("value", .pointer)]) + static let unsafePointer = LiftingIntrinsicInfo(parameters: [("pointer", .pointer)]) static let void = LiftingIntrinsicInfo(parameters: []) static let caseEnum = LiftingIntrinsicInfo(parameters: [("value", .i32)]) static let associatedValueEnum = LiftingIntrinsicInfo(parameters: [ @@ -1473,6 +1496,7 @@ extension BridgeType { case .string: return .string case .jsObject: return .jsObject case .swiftHeapObject: return .swiftHeapObject + case .unsafePointer: return .unsafePointer case .swiftProtocol: return .jsObject case .void: return .void case .optional(let wrappedType): @@ -1503,6 +1527,7 @@ extension BridgeType { static let string = LoweringIntrinsicInfo(returnType: nil) static let jsObject = LoweringIntrinsicInfo(returnType: .i32) static let swiftHeapObject = LoweringIntrinsicInfo(returnType: .pointer) + static let unsafePointer = LoweringIntrinsicInfo(returnType: .pointer) static let void = LoweringIntrinsicInfo(returnType: nil) static let caseEnum = LoweringIntrinsicInfo(returnType: .i32) static let rawValueEnum = LoweringIntrinsicInfo(returnType: .i32) @@ -1520,6 +1545,7 @@ extension BridgeType { case .string: return .string case .jsObject: return .jsObject case .swiftHeapObject: return .swiftHeapObject + case .unsafePointer: return .unsafePointer case .swiftProtocol: return .jsObject case .void: return .void case .optional: return .optional diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index dd6c9d27a..ad5cdaf06 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -875,6 +875,8 @@ extension BridgeType { case .closure: // Swift closure is boxed and passed to JS as a pointer. return LoweringParameterInfo(loweredParameters: [("pointer", .pointer)]) + case .unsafePointer: + return LoweringParameterInfo(loweredParameters: [("pointer", .pointer)]) case .swiftHeapObject(let className): switch context { case .importTS: @@ -959,6 +961,8 @@ extension BridgeType { case .closure: // JS returns a callback ID for closures, which Swift lifts to a typed closure. return LiftingReturnInfo(valueToLift: .i32) + case .unsafePointer: + return LiftingReturnInfo(valueToLift: .pointer) case .swiftHeapObject(let className): switch context { case .importTS: diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index e2f1c3cf4..321dbd6df 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -163,6 +163,11 @@ public final class SwiftToSkeleton { } } + // UnsafePointer family + if let unsafePointerType = Self.parseUnsafePointerType(type) { + return .unsafePointer(unsafePointerType) + } + let typeName: String if let identifier = type.as(IdentifierTypeSyntax.self) { typeName = Self.normalizeIdentifier(identifier.name.text) @@ -248,6 +253,55 @@ public final class SwiftToSkeleton { return .swiftHeapObject(swiftCallName) } + fileprivate static func parseUnsafePointerType(_ type: TypeSyntax) -> UnsafePointerType? { + func parse(baseName: String, genericArg: TypeSyntax?) -> UnsafePointerType? { + let pointee = genericArg?.trimmedDescription + switch baseName { + case "UnsafePointer": + return .init(kind: .unsafePointer, pointee: pointee) + case "UnsafeMutablePointer": + return .init(kind: .unsafeMutablePointer, pointee: pointee) + case "UnsafeRawPointer": + return .init(kind: .unsafeRawPointer) + case "UnsafeMutableRawPointer": + return .init(kind: .unsafeMutableRawPointer) + case "OpaquePointer": + return .init(kind: .opaquePointer) + default: + return nil + } + } + + if let identifier = type.as(IdentifierTypeSyntax.self) { + let baseName = identifier.name.text + if (baseName == "UnsafePointer" || baseName == "UnsafeMutablePointer"), + let genericArgs = identifier.genericArgumentClause?.arguments, + genericArgs.count == 1, + let argType = TypeSyntax(genericArgs.first?.argument) + { + return parse(baseName: baseName, genericArg: argType) + } + return parse(baseName: baseName, genericArg: nil) + } + + if let member = type.as(MemberTypeSyntax.self), + let base = member.baseType.as(IdentifierTypeSyntax.self), + base.name.text == "Swift" + { + let baseName = member.name.text + if (baseName == "UnsafePointer" || baseName == "UnsafeMutablePointer"), + let genericArgs = member.genericArgumentClause?.arguments, + genericArgs.count == 1, + let argType = TypeSyntax(genericArgs.first?.argument) + { + return parse(baseName: baseName, genericArg: argType) + } + return parse(baseName: baseName, genericArg: nil) + } + + return nil + } + /// Computes the full Swift call name by walking up the AST hierarchy to find all parent enums /// This generates the qualified name needed for Swift code generation (e.g., "Networking.API.HTTPServer") fileprivate static func computeSwiftCallName(for node: some SyntaxProtocol, itemName: String) -> String { diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index ab4251c2c..16224ba50 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -3298,6 +3298,8 @@ extension BridgeType { return name ?? "any" case .swiftHeapObject(let name): return name + case .unsafePointer: + return "number" case .optional(let wrappedType): return "\(wrappedType.tsType) | null" case .caseEnum(let name): diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index d9223faf8..e14eb4ee0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -1300,7 +1300,7 @@ struct IntrinsicJSFragment: Sendable { /// Returns a fragment that lowers a JS value to Wasm core values for parameters static func lowerParameter(type: BridgeType) throws -> IntrinsicJSFragment { switch type { - case .int, .float, .double, .bool: return .identity + case .int, .float, .double, .bool, .unsafePointer: return .identity case .string: return .stringLowerParameter case .jsObject: return .jsObjectLowerParameter case .swiftHeapObject: @@ -1346,6 +1346,7 @@ struct IntrinsicJSFragment: Sendable { case .string: return .stringLiftReturn case .jsObject: return .jsObjectLiftReturn case .swiftHeapObject(let name): return .swiftHeapObjectLiftReturn(name) + case .unsafePointer: return .identity case .swiftProtocol: return .jsObjectLiftReturn case .void: return .void case .optional(let wrappedType): return .optionalLiftReturn(wrappedType: wrappedType) @@ -1388,6 +1389,7 @@ struct IntrinsicJSFragment: Sendable { case .bool: return .boolLiftParameter case .string: return .stringLiftParameter case .jsObject: return .jsObjectLiftParameter + case .unsafePointer: return .identity case .swiftHeapObject(let name): switch context { case .importTS: @@ -1482,6 +1484,7 @@ struct IntrinsicJSFragment: Sendable { case .bool: return .boolLowerReturn case .string: return .stringLowerReturn case .jsObject: return .jsObjectLowerReturn + case .unsafePointer: return .identity case .swiftHeapObject(let name): switch context { case .importTS: @@ -2266,6 +2269,14 @@ struct IntrinsicJSFragment: Sendable { return [] } ) + case .unsafePointer: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push((\(arguments[0]) | 0));") + return [] + } + ) case .jsObject: return IntrinsicJSFragment( parameters: ["value"], @@ -2698,6 +2709,15 @@ struct IntrinsicJSFragment: Sendable { return [dVar] } ) + case .unsafePointer: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let pVar = scope.variable("pointer") + printer.write("const \(pVar) = \(JSGlueVariableScope.reservedTmpRetPointers).pop();") + return [pVar] + } + ) case .optional(let wrappedType): return IntrinsicJSFragment( parameters: [], diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 3baebe6da..dcb819fef 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -107,8 +107,28 @@ public struct ClosureSignature: Codable, Equatable, Hashable, Sendable { } } +public enum UnsafePointerKind: String, Codable, Equatable, Hashable, Sendable { + case unsafePointer + case unsafeMutablePointer + case unsafeRawPointer + case unsafeMutableRawPointer + case opaquePointer +} + +public struct UnsafePointerType: Codable, Equatable, Hashable, Sendable { + public let kind: UnsafePointerKind + /// The pointee type name for generic pointer types (e.g. `UInt8` for `UnsafePointer`). + public let pointee: String? + + public init(kind: UnsafePointerKind, pointee: String? = nil) { + self.kind = kind + self.pointee = pointee + } +} + public enum BridgeType: Codable, Equatable, Hashable, Sendable { case int, float, double, string, bool, jsObject(String?), swiftHeapObject(String), void + case unsafePointer(UnsafePointerType) indirect case optional(BridgeType) case caseEnum(String) case rawValueEnum(String, SwiftEnumRawType) @@ -831,6 +851,12 @@ extension BridgeType { self = .void case "JSObject": self = .jsObject(nil) + case "UnsafeRawPointer": + self = .unsafePointer(.init(kind: .unsafeRawPointer)) + case "UnsafeMutableRawPointer": + self = .unsafePointer(.init(kind: .unsafeMutableRawPointer)) + case "OpaquePointer": + self = .unsafePointer(.init(kind: .opaquePointer)) default: return nil } @@ -848,6 +874,8 @@ extension BridgeType { case .swiftHeapObject: // UnsafeMutableRawPointer is returned as an i32 pointer return .pointer + case .unsafePointer: + return .pointer case .optional(_): return nil case .caseEnum: @@ -891,6 +919,23 @@ extension BridgeType { return "\(typeName.count)\(typeName)C" case .swiftHeapObject(let name): return "\(name.count)\(name)C" + case .unsafePointer(let ptr): + func sanitize(_ s: String) -> String { + s.filter { $0.isNumber || $0.isLetter } + } + let kindCode: String = + switch ptr.kind { + case .unsafePointer: "Sup" + case .unsafeMutablePointer: "Sump" + case .unsafeRawPointer: "Surp" + case .unsafeMutableRawPointer: "Sumrp" + case .opaquePointer: "Sop" + } + if let pointee = ptr.pointee, !pointee.isEmpty { + let p = sanitize(pointee) + return "\(kindCode)\(p.count)\(p)" + } + return kindCode case .optional(let wrapped): return "Sq\(wrapped.mangleTypeName)" case .caseEnum(let name), diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/UnsafePointer.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/UnsafePointer.swift new file mode 100644 index 000000000..eb6ca0071 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/UnsafePointer.swift @@ -0,0 +1,39 @@ +@JS func takeUnsafeRawPointer(_ p: UnsafeRawPointer) {} +@JS func takeUnsafeMutableRawPointer(_ p: UnsafeMutableRawPointer) {} +@JS func takeOpaquePointer(_ p: OpaquePointer) {} +@JS func takeUnsafePointer(_ p: UnsafePointer) {} +@JS func takeUnsafeMutablePointer(_ p: UnsafeMutablePointer) {} + +@JS func returnUnsafeRawPointer() -> UnsafeRawPointer { UnsafeRawPointer(bitPattern: 1)! } +@JS func returnUnsafeMutableRawPointer() -> UnsafeMutableRawPointer { UnsafeMutableRawPointer(bitPattern: 1)! } +@JS func returnOpaquePointer() -> OpaquePointer { OpaquePointer(bitPattern: 1)! } +@JS func returnUnsafePointer() -> UnsafePointer { + UnsafeRawPointer(bitPattern: 1)!.assumingMemoryBound(to: UInt8.self) +} +@JS func returnUnsafeMutablePointer() -> UnsafeMutablePointer { + UnsafeMutableRawPointer(bitPattern: 1)!.assumingMemoryBound(to: UInt8.self) +} + +@JS struct PointerFields { + var raw: UnsafeRawPointer + var mutRaw: UnsafeMutableRawPointer + var opaque: OpaquePointer + var ptr: UnsafePointer + var mutPtr: UnsafeMutablePointer + + @JS init( + raw: UnsafeRawPointer, + mutRaw: UnsafeMutableRawPointer, + opaque: OpaquePointer, + ptr: UnsafePointer, + mutPtr: UnsafeMutablePointer + ) { + self.raw = raw + self.mutRaw = mutRaw + self.opaque = opaque + self.ptr = ptr + self.mutPtr = mutPtr + } +} + +@JS func roundTripPointerFields(_ value: PointerFields) -> PointerFields { value } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.d.ts new file mode 100644 index 000000000..4f9aa4e4a --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.d.ts @@ -0,0 +1,38 @@ +// 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 interface PointerFields { + raw: number; + mutRaw: number; + opaque: number; + ptr: number; + mutPtr: number; +} +export type Exports = { + takeUnsafeRawPointer(p: number): void; + takeUnsafeMutableRawPointer(p: number): void; + takeOpaquePointer(p: number): void; + takeUnsafePointer(p: number): void; + takeUnsafeMutablePointer(p: number): void; + returnUnsafeRawPointer(): number; + returnUnsafeMutableRawPointer(): number; + returnOpaquePointer(): number; + returnUnsafePointer(): number; + returnUnsafeMutablePointer(): number; + roundTripPointerFields(value: PointerFields): PointerFields; + PointerFields: { + init(raw: number, mutRaw: number, opaque: number, ptr: number, mutPtr: number): PointerFields; + } +} +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/UnsafePointer.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js new file mode 100644 index 000000000..1e1c73492 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js @@ -0,0 +1,283 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + const __bjs_createPointerFieldsHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + tmpParamPointers.push((value.raw | 0)); + tmpParamPointers.push((value.mutRaw | 0)); + tmpParamPointers.push((value.opaque | 0)); + tmpParamPointers.push((value.ptr | 0)); + tmpParamPointers.push((value.mutPtr | 0)); + return { cleanup: undefined }; + }, + raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + const pointer = tmpRetPointers.pop(); + const pointer1 = tmpRetPointers.pop(); + const pointer2 = tmpRetPointers.pop(); + const pointer3 = tmpRetPointers.pop(); + const pointer4 = tmpRetPointers.pop(); + return { raw: pointer4, mutRaw: pointer3, opaque: pointer2, ptr: pointer1, mutPtr: pointer }; + } + }); + }; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + 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); + }, + takeUnsafeMutableRawPointer: function bjs_takeUnsafeMutableRawPointer(p) { + instance.exports.bjs_takeUnsafeMutableRawPointer(p); + }, + takeOpaquePointer: function bjs_takeOpaquePointer(p) { + instance.exports.bjs_takeOpaquePointer(p); + }, + takeUnsafePointer: function bjs_takeUnsafePointer(p) { + instance.exports.bjs_takeUnsafePointer(p); + }, + takeUnsafeMutablePointer: function bjs_takeUnsafeMutablePointer(p) { + instance.exports.bjs_takeUnsafeMutablePointer(p); + }, + returnUnsafeRawPointer: function bjs_returnUnsafeRawPointer() { + const ret = instance.exports.bjs_returnUnsafeRawPointer(); + return ret; + }, + returnUnsafeMutableRawPointer: function bjs_returnUnsafeMutableRawPointer() { + const ret = instance.exports.bjs_returnUnsafeMutableRawPointer(); + return ret; + }, + returnOpaquePointer: function bjs_returnOpaquePointer() { + const ret = instance.exports.bjs_returnOpaquePointer(); + return ret; + }, + returnUnsafePointer: function bjs_returnUnsafePointer() { + const ret = instance.exports.bjs_returnUnsafePointer(); + return ret; + }, + returnUnsafeMutablePointer: function bjs_returnUnsafeMutablePointer() { + const ret = instance.exports.bjs_returnUnsafeMutablePointer(); + return ret; + }, + roundTripPointerFields: function bjs_roundTripPointerFields(value) { + const { cleanup: cleanup } = structHelpers.PointerFields.lower(value); + instance.exports.bjs_roundTripPointerFields(); + const structValue = structHelpers.PointerFields.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + if (cleanup) { cleanup(); } + return structValue; + }, + PointerFields: { + init: function(raw, mutRaw, opaque, ptr, mutPtr) { + instance.exports.bjs_PointerFields_init(raw, mutRaw, opaque, ptr, mutPtr); + const structValue = structHelpers.PointerFields.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return structValue; + }, + }, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.json new file mode 100644 index 000000000..f38cd9440 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.json @@ -0,0 +1,413 @@ +{ + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_takeUnsafeRawPointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeUnsafeRawPointer", + "parameters" : [ + { + "label" : "_", + "name" : "p", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_takeUnsafeMutableRawPointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeUnsafeMutableRawPointer", + "parameters" : [ + { + "label" : "_", + "name" : "p", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_takeOpaquePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeOpaquePointer", + "parameters" : [ + { + "label" : "_", + "name" : "p", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_takeUnsafePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeUnsafePointer", + "parameters" : [ + { + "label" : "_", + "name" : "p", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_takeUnsafeMutablePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeUnsafeMutablePointer", + "parameters" : [ + { + "label" : "_", + "name" : "p", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_returnUnsafeRawPointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "returnUnsafeRawPointer", + "parameters" : [ + + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + }, + { + "abiName" : "bjs_returnUnsafeMutableRawPointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "returnUnsafeMutableRawPointer", + "parameters" : [ + + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + }, + { + "abiName" : "bjs_returnOpaquePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "returnOpaquePointer", + "parameters" : [ + + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + }, + { + "abiName" : "bjs_returnUnsafePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "returnUnsafePointer", + "parameters" : [ + + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } + } + } + }, + { + "abiName" : "bjs_returnUnsafeMutablePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "returnUnsafeMutablePointer", + "parameters" : [ + + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } + } + } + }, + { + "abiName" : "bjs_roundTripPointerFields", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripPointerFields", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "PointerFields" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "PointerFields" + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + { + "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" + } + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift new file mode 100644 index 000000000..503fed02d --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift @@ -0,0 +1,145 @@ +extension PointerFields: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PointerFields { + let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) + let ptr = UnsafePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) + let opaque = OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) + let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) + let raw = UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) + return PointerFields(raw: raw, mutRaw: mutRaw, opaque: opaque, ptr: ptr, mutPtr: mutPtr) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_pointer(self.raw.bridgeJSLowerReturn()) + _swift_js_push_pointer(self.mutRaw.bridgeJSLowerReturn()) + _swift_js_push_pointer(self.opaque.bridgeJSLowerReturn()) + _swift_js_push_pointer(self.ptr.bridgeJSLowerReturn()) + _swift_js_push_pointer(self.mutPtr.bridgeJSLowerReturn()) + } +} + +@_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 +} + +@_expose(wasm, "bjs_takeUnsafeRawPointer") +@_cdecl("bjs_takeUnsafeRawPointer") +public func _bjs_takeUnsafeRawPointer(_ p: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + takeUnsafeRawPointer(_: UnsafeRawPointer.bridgeJSLiftParameter(p)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_takeUnsafeMutableRawPointer") +@_cdecl("bjs_takeUnsafeMutableRawPointer") +public func _bjs_takeUnsafeMutableRawPointer(_ p: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + takeUnsafeMutableRawPointer(_: UnsafeMutableRawPointer.bridgeJSLiftParameter(p)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_takeOpaquePointer") +@_cdecl("bjs_takeOpaquePointer") +public func _bjs_takeOpaquePointer(_ p: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + takeOpaquePointer(_: OpaquePointer.bridgeJSLiftParameter(p)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_takeUnsafePointer") +@_cdecl("bjs_takeUnsafePointer") +public func _bjs_takeUnsafePointer(_ p: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + takeUnsafePointer(_: UnsafePointer.bridgeJSLiftParameter(p)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_takeUnsafeMutablePointer") +@_cdecl("bjs_takeUnsafeMutablePointer") +public func _bjs_takeUnsafeMutablePointer(_ p: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + takeUnsafeMutablePointer(_: UnsafeMutablePointer.bridgeJSLiftParameter(p)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_returnUnsafeRawPointer") +@_cdecl("bjs_returnUnsafeRawPointer") +public func _bjs_returnUnsafeRawPointer() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = returnUnsafeRawPointer() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_returnUnsafeMutableRawPointer") +@_cdecl("bjs_returnUnsafeMutableRawPointer") +public func _bjs_returnUnsafeMutableRawPointer() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = returnUnsafeMutableRawPointer() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_returnOpaquePointer") +@_cdecl("bjs_returnOpaquePointer") +public func _bjs_returnOpaquePointer() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = returnOpaquePointer() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_returnUnsafePointer") +@_cdecl("bjs_returnUnsafePointer") +public func _bjs_returnUnsafePointer() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = returnUnsafePointer() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_returnUnsafeMutablePointer") +@_cdecl("bjs_returnUnsafeMutablePointer") +public func _bjs_returnUnsafeMutablePointer() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = returnUnsafeMutablePointer() + return ret.bridgeJSLowerReturn() + #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 +} \ No newline at end of file diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 92ab52f04..be763b7ac 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -644,6 +644,134 @@ func _swift_js_return_optional_double(_ isSome: Int32, _ value: Float64) { } #endif +// MARK: - UnsafePointer family + +extension UnsafeMutableRawPointer { + // MARK: ImportTS + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { self } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn( + _ pointer: UnsafeMutableRawPointer + ) + -> UnsafeMutableRawPointer + { + pointer + } + + // MARK: ExportSwift + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter( + _ pointer: UnsafeMutableRawPointer + ) + -> UnsafeMutableRawPointer + { + pointer + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { self } +} + +extension UnsafeRawPointer { + // MARK: ImportTS + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { + UnsafeMutableRawPointer(mutating: self) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn( + _ pointer: UnsafeMutableRawPointer + ) + -> UnsafeRawPointer + { + UnsafeRawPointer(pointer) + } + + // MARK: ExportSwift + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter( + _ pointer: UnsafeMutableRawPointer + ) + -> UnsafeRawPointer + { + UnsafeRawPointer(pointer) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { + bridgeJSLowerParameter() + } +} + +extension OpaquePointer { + // MARK: ImportTS + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { + UnsafeMutableRawPointer(mutating: UnsafeRawPointer(self)) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn( + _ pointer: UnsafeMutableRawPointer + ) + -> OpaquePointer + { + OpaquePointer(UnsafeRawPointer(pointer)) + } + + // MARK: ExportSwift + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter( + _ pointer: UnsafeMutableRawPointer + ) + -> OpaquePointer + { + OpaquePointer(UnsafeRawPointer(pointer)) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { + bridgeJSLowerParameter() + } +} + +extension UnsafePointer { + // MARK: ImportTS + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { + UnsafeMutableRawPointer(mutating: UnsafeRawPointer(self)) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn( + _ pointer: UnsafeMutableRawPointer + ) + -> UnsafePointer + { + UnsafeRawPointer(pointer).assumingMemoryBound(to: Pointee.self) + } + + // MARK: ExportSwift + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter( + _ pointer: UnsafeMutableRawPointer + ) + -> UnsafePointer + { + UnsafeRawPointer(pointer).assumingMemoryBound(to: Pointee.self) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { + bridgeJSLowerParameter() + } +} + +extension UnsafeMutablePointer { + // MARK: ImportTS + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { + UnsafeMutableRawPointer(self) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn( + _ pointer: UnsafeMutableRawPointer + ) + -> UnsafeMutablePointer + { + pointer.assumingMemoryBound(to: Pointee.self) + } + + // MARK: ExportSwift + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter( + _ pointer: UnsafeMutableRawPointer + ) + -> UnsafeMutablePointer + { + pointer.assumingMemoryBound(to: Pointee.self) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { + bridgeJSLowerParameter() + } +} + extension Optional where Wrapped == Bool { // MARK: ImportTS diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 0df421df6..8edf8a6d2 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -29,10 +29,50 @@ func runJsWorks() -> Void return v } +@JS func roundTripUnsafeRawPointer(v: UnsafeRawPointer) -> UnsafeRawPointer { + return v +} +@JS func roundTripUnsafeMutableRawPointer(v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + return v +} +@JS func roundTripOpaquePointer(v: OpaquePointer) -> OpaquePointer { + return v +} +@JS func roundTripUnsafePointer(v: UnsafePointer) -> UnsafePointer { + return v +} +@JS func roundTripUnsafeMutablePointer(v: UnsafeMutablePointer) -> UnsafeMutablePointer { + return v +} + @JS func roundTripJSObject(v: JSObject) -> JSObject { return v } +@JS struct PointerFields { + var raw: UnsafeRawPointer + var mutRaw: UnsafeMutableRawPointer + var opaque: OpaquePointer + var ptr: UnsafePointer + var mutPtr: UnsafeMutablePointer + + @JS init( + raw: UnsafeRawPointer, + mutRaw: UnsafeMutableRawPointer, + opaque: OpaquePointer, + ptr: UnsafePointer, + mutPtr: UnsafeMutablePointer + ) { + self.raw = raw + self.mutRaw = mutRaw + self.opaque = opaque + self.ptr = ptr + self.mutPtr = mutPtr + } +} + +@JS func roundTripPointerFields(_ value: PointerFields) -> PointerFields { value } + @JSClass struct Foo { @JSGetter var value: String @JSFunction init(_ value: String) throws(JSException) diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index ed2e5240f..08f3f48aa 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2212,6 +2212,36 @@ public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_se #endif } +extension PointerFields: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PointerFields { + let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) + let ptr = UnsafePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) + let opaque = OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) + let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) + let raw = UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) + return PointerFields(raw: raw, mutRaw: mutRaw, opaque: opaque, ptr: ptr, mutPtr: mutPtr) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_pointer(self.raw.bridgeJSLowerReturn()) + _swift_js_push_pointer(self.mutRaw.bridgeJSLowerReturn()) + _swift_js_push_pointer(self.opaque.bridgeJSLowerReturn()) + _swift_js_push_pointer(self.ptr.bridgeJSLowerReturn()) + _swift_js_push_pointer(self.mutPtr.bridgeJSLowerReturn()) + } +} + +@_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 bridgeJSLiftParameter() -> DataPoint { let optFlag = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) @@ -2595,6 +2625,61 @@ public func _bjs_roundTripSwiftHeapObject(_ v: UnsafeMutableRawPointer) -> Unsaf #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 { @@ -2606,6 +2691,17 @@ public func _bjs_roundTripJSObject(_ v: Int32) -> Int32 { #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_makeImportedFoo") @_cdecl("bjs_makeImportedFoo") public func _bjs_makeImportedFoo(_ valueBytes: Int32, _ valueLength: Int32) -> Int32 { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index fb2770ae6..1dafe7851 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -4704,6 +4704,155 @@ } } }, + { + "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" : { @@ -4729,6 +4878,31 @@ } } }, + { + "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_makeImportedFoo", "effects" : { @@ -8313,6 +8487,144 @@ } ], "structs" : [ + { + "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", diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 47f30a926..df83d41e9 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -176,6 +176,14 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(exports.roundTripString(v), v); } + for (const p of [1, 4, 1024, 65536, 2147483647]) { + assert.equal(exports.roundTripUnsafeRawPointer(p), p); + assert.equal(exports.roundTripUnsafeMutableRawPointer(p), p); + assert.equal(exports.roundTripOpaquePointer(p), p); + assert.equal(exports.roundTripUnsafePointer(p), p); + assert.equal(exports.roundTripUnsafeMutablePointer(p), p); + } + const g = new exports.Greeter("John"); assert.equal(g.greet(), "Hello, John!"); @@ -955,6 +963,9 @@ function testStructSupport(exports) { const data2 = { x: 0.0, y: 0.0, label: "", optCount: null, optFlag: null }; assert.deepEqual(exports.roundTripDataPoint(data2), data2); + const pointerFields1 = { raw: 1, mutRaw: 4, opaque: 1024, ptr: 65536, mutPtr: 2 }; + assert.deepEqual(exports.roundTripPointerFields(pointerFields1), pointerFields1); + const contact1 = { name: "Alice", age: 30, From 7b1ee44d77a3b4432da3ef5b4c86779efe927383 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 27 Jan 2026 12:25:13 +0900 Subject: [PATCH 102/252] Turn JSValue from enum to struct to have flexibility for future changes (#528) --- .../BasicObjects/JSPromise.swift | 2 +- .../JavaScriptKit/ConvertibleToJSValue.swift | 2 +- .../FundamentalObjects/JSObject.swift | 2 +- Sources/JavaScriptKit/JSValue.swift | 87 +++++++++++++------ Sources/JavaScriptKit/JSValueDecoder.swift | 6 +- .../JavaScriptKitTests.swift | 4 +- 6 files changed, 71 insertions(+), 32 deletions(-) diff --git a/Sources/JavaScriptKit/BasicObjects/JSPromise.swift b/Sources/JavaScriptKit/BasicObjects/JSPromise.swift index c83d70673..c02ab44b0 100644 --- a/Sources/JavaScriptKit/BasicObjects/JSPromise.swift +++ b/Sources/JavaScriptKit/BasicObjects/JSPromise.swift @@ -31,7 +31,7 @@ public final class JSPromise: JSBridgedClass { /// is not an object and is not an instance of JavaScript `Promise`, this function will /// return `nil`. public static func construct(from value: JSValue) -> Self? { - guard case .object(let jsObject) = value else { return nil } + guard let jsObject = value.object else { return nil } return Self(jsObject) } diff --git a/Sources/JavaScriptKit/ConvertibleToJSValue.swift b/Sources/JavaScriptKit/ConvertibleToJSValue.swift index 966dbc821..3f548a46c 100644 --- a/Sources/JavaScriptKit/ConvertibleToJSValue.swift +++ b/Sources/JavaScriptKit/ConvertibleToJSValue.swift @@ -222,7 +222,7 @@ extension JSValue { let kind: JavaScriptValueKind let payload1: JavaScriptPayload1 var payload2: JavaScriptPayload2 = 0 - switch self { + switch self.storage { case .boolean(let boolValue): kind = .boolean payload1 = boolValue ? 1 : 0 diff --git a/Sources/JavaScriptKit/FundamentalObjects/JSObject.swift b/Sources/JavaScriptKit/FundamentalObjects/JSObject.swift index 238b88055..101f13a95 100644 --- a/Sources/JavaScriptKit/FundamentalObjects/JSObject.swift +++ b/Sources/JavaScriptKit/FundamentalObjects/JSObject.swift @@ -249,7 +249,7 @@ public class JSObject: Equatable, ExpressibleByDictionaryLiteral { } public static func construct(from value: JSValue) -> Self? { - switch value { + switch value.storage { case .boolean, .string, .number, diff --git a/Sources/JavaScriptKit/JSValue.swift b/Sources/JavaScriptKit/JSValue.swift index f469a2f10..6c02e73f6 100644 --- a/Sources/JavaScriptKit/JSValue.swift +++ b/Sources/JavaScriptKit/JSValue.swift @@ -2,20 +2,55 @@ import _CJavaScriptKit /// `JSValue` represents a value in JavaScript. @dynamicMemberLookup -public enum JSValue: Equatable { - case boolean(Bool) - case string(JSString) - case number(Double) - case object(JSObject) - case null - case undefined - case symbol(JSSymbol) - case bigInt(JSBigInt) +public struct JSValue: Equatable { + /// The internal storage of the JSValue, which is intentionally not public + /// to leave the flexibility to change the storage. + internal enum Storage: Equatable { + case boolean(Bool) + case string(JSString) + case number(Double) + case object(JSObject) + case null + case undefined + case symbol(JSSymbol) + case bigInt(JSBigInt) + } + + internal var storage: Storage + + internal init(storage: Storage) { + self.storage = storage + } + + public static func boolean(_ value: Bool) -> JSValue { + .init(storage: .boolean(value)) + } + public static func string(_ value: JSString) -> JSValue { + .init(storage: .string(value)) + } + public static func number(_ value: Double) -> JSValue { + .init(storage: .number(value)) + } + public static func object(_ value: JSObject) -> JSValue { + .init(storage: .object(value)) + } + public static var null: JSValue { + .init(storage: .null) + } + public static var undefined: JSValue { + .init(storage: .undefined) + } + public static func symbol(_ value: JSSymbol) -> JSValue { + .init(storage: .symbol(value)) + } + public static func bigInt(_ value: JSBigInt) -> JSValue { + .init(storage: .bigInt(value)) + } /// Returns the `Bool` value of this JS value if its type is boolean. /// If not, returns `nil`. public var boolean: Bool? { - switch self { + switch storage { case .boolean(let boolean): return boolean default: return nil } @@ -35,7 +70,7 @@ public enum JSValue: Equatable { /// If not, returns `nil`. /// public var jsString: JSString? { - switch self { + switch storage { case .string(let string): return string default: return nil } @@ -44,7 +79,7 @@ public enum JSValue: Equatable { /// Returns the `Double` value of this JS value if the type is number. /// If not, returns `nil`. public var number: Double? { - switch self { + switch storage { case .number(let number): return number default: return nil } @@ -53,7 +88,7 @@ public enum JSValue: Equatable { /// Returns the `JSObject` of this JS value if its type is object. /// If not, returns `nil`. public var object: JSObject? { - switch self { + switch storage { case .object(let object): return object default: return nil } @@ -65,7 +100,7 @@ public enum JSValue: Equatable { /// Returns the `JSSymbol` of this JS value if its type is function. /// If not, returns `nil`. public var symbol: JSSymbol? { - switch self { + switch storage { case .symbol(let symbol): return symbol default: return nil } @@ -74,7 +109,7 @@ public enum JSValue: Equatable { /// Returns the `JSBigInt` of this JS value if its type is function. /// If not, returns `nil`. public var bigInt: JSBigInt? { - switch self { + switch storage { case .bigInt(let bigInt): return bigInt default: return nil } @@ -83,13 +118,13 @@ public enum JSValue: Equatable { /// Returns the `true` if this JS value is null. /// If not, returns `false`. public var isNull: Bool { - return self == .null + return storage == .null } /// Returns the `true` if this JS value is undefined. /// If not, returns `false`. public var isUndefined: Bool { - return self == .undefined + return storage == .undefined } } @@ -132,7 +167,7 @@ extension JSValue { extension JSValue { public static func string(_ value: String) -> JSValue { - .string(JSString(value)) + .init(storage: .string(JSString(value))) } /// Deprecated: Please create `JSClosure` directly and manage its lifetime manually. @@ -161,7 +196,7 @@ extension JSValue { /// ``` @available(*, deprecated, message: "Please create JSClosure directly and manage its lifetime manually.") public static func function(_ body: @escaping ([JSValue]) -> JSValue) -> JSValue { - .object(JSClosure(body)) + .init(storage: .object(JSClosure(body))) } @available( @@ -171,34 +206,34 @@ extension JSValue { message: "JSClosure is no longer a subclass of JSFunction. Use .object(closure) instead." ) public static func function(_ closure: JSClosure) -> JSValue { - .object(closure) + .init(storage: .object(closure)) } @available(*, deprecated, renamed: "object", message: "Use .object(function) instead") - public static func function(_ function: JSObject) -> JSValue { .object(function) } + public static func function(_ function: JSObject) -> JSValue { .init(storage: .object(function)) } } extension JSValue: ExpressibleByStringLiteral { public init(stringLiteral value: String) { - self = .string(JSString(value)) + self = .init(storage: .string(JSString(value))) } } extension JSValue: ExpressibleByIntegerLiteral { public init(integerLiteral value: Int32) { - self = .number(Double(value)) + self = .init(storage: .number(Double(value))) } } extension JSValue: ExpressibleByFloatLiteral { public init(floatLiteral value: Double) { - self = .number(value) + self = .init(storage: .number(value)) } } extension JSValue: ExpressibleByNilLiteral { public init(nilLiteral _: ()) { - self = .null + self = .init(storage: .null) } } @@ -268,7 +303,7 @@ extension JSValue { /// - Parameter constructor: The constructor function to check. /// - Returns: The result of `instanceof` in the JavaScript environment. public func isInstanceOf(_ constructor: JSObject) -> Bool { - switch self { + switch storage { case .boolean, .string, .number, .null, .undefined, .symbol, .bigInt: return false case .object(let ref): diff --git a/Sources/JavaScriptKit/JSValueDecoder.swift b/Sources/JavaScriptKit/JSValueDecoder.swift index 054c6c8da..c2ac4a681 100644 --- a/Sources/JavaScriptKit/JSValueDecoder.swift +++ b/Sources/JavaScriptKit/JSValueDecoder.swift @@ -159,7 +159,11 @@ private struct _UnkeyedDecodingContainer: UnkeyedDecodingContainer { init(decoder: _Decoder, ref: JSObject) { self.decoder = decoder - count = ref.length.number.map(Int.init) + if let count = ref.length.number { + self.count = Int(count) + } else { + self.count = nil + } self.ref = ref } diff --git a/Tests/JavaScriptKitTests/JavaScriptKitTests.swift b/Tests/JavaScriptKitTests/JavaScriptKitTests.swift index 0a6fc9ce2..b69334ce5 100644 --- a/Tests/JavaScriptKitTests/JavaScriptKitTests.swift +++ b/Tests/JavaScriptKitTests/JavaScriptKitTests.swift @@ -21,8 +21,8 @@ class JavaScriptKitTests: XCTestCase { let prop = JSString("prop_\(index)") setJSValue(this: global, name: prop, value: input) let got = getJSValue(this: global, name: prop) - switch (got, input) { - case (.number(let lhs), .number(let rhs)): + switch (got.number, input.number) { + case (let lhs?, let rhs?): // Compare bitPattern because nan == nan is always false XCTAssertEqual(lhs.bitPattern, rhs.bitPattern) default: From 773254a2ae8e63388bf1aea147d105ec9871697b Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 27 Jan 2026 14:47:15 +0900 Subject: [PATCH 103/252] BridgeJS: allow imports from globalThis Add an opt-in from: .global source for @JS* import macros so bindings can resolve values from globalThis without routing through the imports object. Teach ts2swift/BridgeJSTool to accept --global inputs (e.g. bridge-js.global.d.ts) so global declarations are separated cleanly, and update generated artifacts + snapshots. --- Package.swift | 1 + .../BridgeJSCore/SwiftToSkeleton.swift | 47 ++- .../Sources/BridgeJSLink/BridgeJSLink.swift | 98 +++++-- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 19 ++ .../Sources/BridgeJSTool/BridgeJSTool.swift | 10 +- .../Sources/TS2Swift/JavaScript/src/cli.js | 41 ++- .../TS2Swift/JavaScript/src/processor.js | 150 ++++++++-- .../BridgeJS/Sources/TS2Swift/TS2Swift.swift | 4 + .../ImportMacroInputs/GlobalThisImports.swift | 14 + .../GlobalGetter.ImportMacros.js | 2 +- .../GlobalThisImports.ImportMacros.d.ts | 23 ++ .../GlobalThisImports.ImportMacros.js | 269 ++++++++++++++++++ .../BridgeJSLinkTests/UnsafePointer.Export.js | 22 ++ .../ExportSwiftTests/UnsafePointer.swift | 42 +++ .../GlobalThisImports.ImportMacros.swift | 87 ++++++ Sources/JavaScriptKit/Macros.swift | 23 +- .../Generated/BridgeJS.Macros.swift | 16 ++ .../Generated/BridgeJS.swift | 241 ++++++++++++++++ .../Generated/JavaScript/BridgeJS.json | 149 ++++++++++ .../GlobalThisImportTests.swift | 19 ++ .../bridge-js.global.d.ts | 15 + 21 files changed, 1221 insertions(+), 71 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/GlobalThisImports.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalThisImports.ImportMacros.swift create mode 100644 Tests/BridgeJSRuntimeTests/GlobalThisImportTests.swift create mode 100644 Tests/BridgeJSRuntimeTests/bridge-js.global.d.ts diff --git a/Package.swift b/Package.swift index a513ec406..1d4c8fb06 100644 --- a/Package.swift +++ b/Package.swift @@ -181,6 +181,7 @@ let package = Package( exclude: [ "bridge-js.config.json", "bridge-js.d.ts", + "bridge-js.global.d.ts", "Generated/JavaScript", ], swiftSettings: [ diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index 321dbd6df..e489a711a 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -1798,6 +1798,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { private struct CurrentType { let name: String let jsName: String? + let from: JSImportFrom? var constructor: ImportedConstructorSkeleton? var methods: [ImportedFunctionSkeleton] var getters: [ImportedGetterSkeleton] @@ -1872,6 +1873,22 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } return nil } + + /// Extracts the `from` argument value from an attribute, if present. + static func extractJSImportFrom(from attribute: AttributeSyntax) -> JSImportFrom? { + guard let arguments = attribute.arguments?.as(LabeledExprListSyntax.self) else { + return nil + } + for argument in arguments { + guard argument.label?.text == "from" else { continue } + + // Accept `.global`, `JSImportFrom.global`, etc. + let description = argument.expression.trimmedDescription + let caseName = description.split(separator: ".").last.map(String.init) ?? description + return JSImportFrom(rawValue: caseName) + } + return nil + } } // MARK: - Validation Helpers @@ -1996,14 +2013,23 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { private func enterJSClass(_ typeName: String) { stateStack.append(.jsClassBody(name: typeName)) - currentType = CurrentType(name: typeName, jsName: nil, constructor: nil, methods: [], getters: [], setters: []) + currentType = CurrentType( + name: typeName, + jsName: nil, + from: nil, + constructor: nil, + methods: [], + getters: [], + setters: [] + ) } - private func enterJSClass(_ typeName: String, jsName: String?) { + private func enterJSClass(_ typeName: String, jsName: String?, from: JSImportFrom?) { stateStack.append(.jsClassBody(name: typeName)) currentType = CurrentType( name: typeName, jsName: jsName, + from: from, constructor: nil, methods: [], getters: [], @@ -2017,6 +2043,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { ImportedTypeSkeleton( name: type.name, jsName: type.jsName, + from: type.from, constructor: type.constructor, methods: type.methods, getters: type.getters, @@ -2031,8 +2058,10 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { override func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind { if AttributeChecker.hasJSClassAttribute(node.attributes) { - let jsName = AttributeChecker.firstJSClassAttribute(node.attributes).flatMap(AttributeChecker.extractJSName) - enterJSClass(node.name.text, jsName: jsName) + let attribute = AttributeChecker.firstJSClassAttribute(node.attributes) + let jsName = attribute.flatMap(AttributeChecker.extractJSName) + let from = attribute.flatMap(AttributeChecker.extractJSImportFrom) + enterJSClass(node.name.text, jsName: jsName, from: from) } return .visitChildren } @@ -2045,8 +2074,10 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { override func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind { if AttributeChecker.hasJSClassAttribute(node.attributes) { - let jsName = AttributeChecker.firstJSClassAttribute(node.attributes).flatMap(AttributeChecker.extractJSName) - enterJSClass(node.name.text, jsName: jsName) + let attribute = AttributeChecker.firstJSClassAttribute(node.attributes) + let jsName = attribute.flatMap(AttributeChecker.extractJSName) + let from = attribute.flatMap(AttributeChecker.extractJSImportFrom) + enterJSClass(node.name.text, jsName: jsName, from: from) } return .visitChildren } @@ -2269,6 +2300,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { let baseName = SwiftToSkeleton.normalizeIdentifier(node.name.text) let jsName = AttributeChecker.extractJSName(from: jsFunction) + let from = AttributeChecker.extractJSImportFrom(from: jsFunction) let name: String if isStaticMember, let enclosingTypeName { name = "\(enclosingTypeName)_\(baseName)" @@ -2289,6 +2321,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { return ImportedFunctionSkeleton( name: name, jsName: jsName, + from: from, parameters: parameters, returnType: returnType, documentation: nil @@ -2322,9 +2355,11 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } let propertyName = SwiftToSkeleton.normalizeIdentifier(identifier.identifier.text) let jsName = AttributeChecker.extractJSName(from: jsGetter) + let from = AttributeChecker.extractJSImportFrom(from: jsGetter) return ImportedGetterSkeleton( name: propertyName, jsName: jsName, + from: from, type: propertyType, documentation: nil, functionName: nil diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 2fc5d9523..2cfaef11e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -80,6 +80,7 @@ public struct BridgeJSLink { var topLevelDtsTypeLines: [String] = [] var importObjectBuilders: [ImportObjectBuilder] = [] var enumStaticAssignments: [String] = [] + var needsImportsObject: Bool = false } private func collectLinkData() throws -> LinkData { @@ -173,12 +174,21 @@ public struct BridgeJSLink { let importObjectBuilder = ImportObjectBuilder(moduleName: unified.moduleName) for fileSkeleton in imported.children { for getter in fileSkeleton.globalGetters { + if getter.from == nil { + data.needsImportsObject = true + } try renderImportedGlobalGetter(importObjectBuilder: importObjectBuilder, getter: getter) } for function in fileSkeleton.functions { + if function.from == nil { + data.needsImportsObject = true + } try renderImportedFunction(importObjectBuilder: importObjectBuilder, function: function) } for type in fileSkeleton.types { + if type.constructor != nil, type.from == nil { + data.needsImportsObject = true + } try renderImportedType(importObjectBuilder: importObjectBuilder, type: type) } } @@ -294,7 +304,7 @@ public struct BridgeJSLink { } } - private func generateAddImports() -> CodeFragmentPrinter { + private func generateAddImports(needsImportsObject: Bool) -> CodeFragmentPrinter { let printer = CodeFragmentPrinter() let allStructs = skeletons.compactMap { $0.exported?.structs }.flatMap { $0 } printer.write("return {") @@ -311,7 +321,7 @@ public struct BridgeJSLink { "bjs = {};", "importObject[\"bjs\"] = bjs;", ]) - if skeletons.contains(where: { $0.imported != nil }) { + if needsImportsObject { printer.write(lines: [ "const imports = options.getImports(importsContext);" ]) @@ -1043,7 +1053,7 @@ public struct BridgeJSLink { printer.write(lines: structPrinter.lines) } printer.nextLine() - printer.write(contentsOf: generateAddImports()) + printer.write(contentsOf: generateAddImports(needsImportsObject: data.needsImportsObject)) } printer.indent() @@ -2176,11 +2186,15 @@ extension BridgeJSLink { return printer.lines } - func call(name: String, returnType: BridgeType) throws -> String? { - let calleeExpr = Self.propertyAccessExpr(objectExpr: "imports", propertyName: name) + func call(name: String, fromObjectExpr: String, returnType: BridgeType) throws -> String? { + let calleeExpr = Self.propertyAccessExpr(objectExpr: fromObjectExpr, propertyName: name) return try self.call(calleeExpr: calleeExpr, returnType: returnType) } + func call(name: String, returnType: BridgeType) throws -> String? { + return try call(name: name, fromObjectExpr: "imports", returnType: returnType) + } + private func call(calleeExpr: String, returnType: BridgeType) throws -> String? { let callExpr = "\(calleeExpr)(\(parameterForwardings.joined(separator: ", ")))" return try self.call(callExpr: callExpr, returnType: returnType) @@ -2204,14 +2218,18 @@ extension BridgeJSLink { ) } - func callConstructor(jsName: String, swiftTypeName: String) throws -> String? { - let ctorExpr = Self.propertyAccessExpr(objectExpr: "imports", propertyName: jsName) + func callConstructor(jsName: String, swiftTypeName: String, fromObjectExpr: String) throws -> String? { + let ctorExpr = Self.propertyAccessExpr(objectExpr: fromObjectExpr, propertyName: jsName) let call = "new \(ctorExpr)(\(parameterForwardings.joined(separator: ", ")))" let type: BridgeType = .jsObject(swiftTypeName) let loweringFragment = try IntrinsicJSFragment.lowerReturn(type: type, context: context) return try lowerReturnValue(returnType: type, returnExpr: call, loweringFragment: loweringFragment) } + func callConstructor(jsName: String, swiftTypeName: String) throws -> String? { + return try callConstructor(jsName: jsName, swiftTypeName: swiftTypeName, fromObjectExpr: "imports") + } + func callMethod(name: String, returnType: BridgeType) throws -> String? { let objectExpr = "\(JSGlueVariableScope.reservedSwift).memory.getObject(self)" let calleeExpr = Self.propertyAccessExpr(objectExpr: objectExpr, propertyName: name) @@ -2253,14 +2271,13 @@ extension BridgeJSLink { body.write("\(call);") } - func getImportProperty(name: String, returnType: BridgeType) throws -> String? { + func getImportProperty(name: String, fromObjectExpr: String, returnType: BridgeType) throws -> String? { if returnType == .void { throw BridgeJSLinkError(message: "Void is not supported for imported JS properties") } let loweringFragment = try IntrinsicJSFragment.lowerReturn(type: returnType, context: context) - let escapedName = BridgeJSLink.escapeForJavaScriptStringLiteral(name) - let expr = "imports[\"\(escapedName)\"]" + let expr = Self.propertyAccessExpr(objectExpr: fromObjectExpr, propertyName: name) let returnExpr: String? if loweringFragment.parameters.count == 0 { @@ -2279,6 +2296,10 @@ extension BridgeJSLink { ) } + func getImportProperty(name: String, returnType: BridgeType) throws -> String? { + return try getImportProperty(name: name, fromObjectExpr: "imports", returnType: returnType) + } + private func lowerReturnValue( returnType: BridgeType, returnExpr: String?, @@ -3013,18 +3034,25 @@ extension BridgeJSLink { try thunkBuilder.liftParameter(param: param) } let jsName = function.jsName ?? function.name - let returnExpr = try thunkBuilder.call(name: jsName, returnType: function.returnType) + let importRootExpr = function.from == .global ? "globalThis" : "imports" + let returnExpr = try thunkBuilder.call( + name: jsName, + fromObjectExpr: importRootExpr, + returnType: function.returnType + ) let funcLines = thunkBuilder.renderFunction( name: function.abiName(context: nil), returnExpr: returnExpr, returnType: function.returnType ) let effects = Effects(isAsync: false, isThrows: false) - importObjectBuilder.appendDts( - [ - "\(renderTSPropertyName(jsName))\(renderTSSignature(parameters: function.parameters, returnType: function.returnType, effects: effects));" - ] - ) + if function.from == nil { + importObjectBuilder.appendDts( + [ + "\(renderTSPropertyName(jsName))\(renderTSSignature(parameters: function.parameters, returnType: function.returnType, effects: effects));" + ] + ) + } importObjectBuilder.assignToImportObject(name: function.abiName(context: nil), function: funcLines) } @@ -3034,14 +3062,21 @@ extension BridgeJSLink { ) throws { let thunkBuilder = ImportedThunkBuilder() let jsName = getter.jsName ?? getter.name - let returnExpr = try thunkBuilder.getImportProperty(name: jsName, returnType: getter.type) + let importRootExpr = getter.from == .global ? "globalThis" : "imports" + let returnExpr = try thunkBuilder.getImportProperty( + name: jsName, + fromObjectExpr: importRootExpr, + returnType: getter.type + ) let abiName = getter.abiName(context: nil) let funcLines = thunkBuilder.renderFunction( name: abiName, returnExpr: returnExpr, returnType: getter.type ) - importObjectBuilder.appendDts(["readonly \(renderTSPropertyName(jsName)): \(getter.type.tsType);"]) + if getter.from == nil { + importObjectBuilder.appendDts(["readonly \(renderTSPropertyName(jsName)): \(getter.type.tsType);"]) + } importObjectBuilder.assignToImportObject(name: abiName, function: funcLines) } @@ -3105,7 +3140,12 @@ extension BridgeJSLink { try thunkBuilder.liftParameter(param: param) } let returnType = BridgeType.jsObject(type.name) - let returnExpr = try thunkBuilder.callConstructor(jsName: type.jsName ?? type.name, swiftTypeName: type.name) + let importRootExpr = type.from == .global ? "globalThis" : "imports" + let returnExpr = try thunkBuilder.callConstructor( + jsName: type.jsName ?? type.name, + swiftTypeName: type.name, + fromObjectExpr: importRootExpr + ) let abiName = constructor.abiName(context: type) let funcLines = thunkBuilder.renderFunction( name: abiName, @@ -3114,16 +3154,18 @@ extension BridgeJSLink { ) importObjectBuilder.assignToImportObject(name: abiName, function: funcLines) - let dtsPrinter = CodeFragmentPrinter() - dtsPrinter.write("\(type.name): {") - dtsPrinter.indent { - dtsPrinter.write( - "new\(renderTSSignature(parameters: constructor.parameters, returnType: returnType, effects: Effects(isAsync: false, isThrows: false)));" - ) - } - dtsPrinter.write("}") + if type.from == nil { + let dtsPrinter = CodeFragmentPrinter() + dtsPrinter.write("\(type.name): {") + dtsPrinter.indent { + dtsPrinter.write( + "new\(renderTSSignature(parameters: constructor.parameters, returnType: returnType, effects: Effects(isAsync: false, isThrows: false)));" + ) + } + dtsPrinter.write("}") - importObjectBuilder.appendDts(dtsPrinter.lines) + importObjectBuilder.appendDts(dtsPrinter.lines) + } } func renderImportedGetter( diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index dcb819fef..c8fc84ec4 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -608,10 +608,19 @@ public struct ExportedSkeleton: Codable { // MARK: - Imported Skeleton +/// Controls where BridgeJS reads imported JS values from. +/// +/// - `global`: Read from `globalThis`. +public enum JSImportFrom: String, Codable { + case global +} + public struct ImportedFunctionSkeleton: Codable { public let name: String /// The JavaScript function/method name to call, if different from `name`. public let jsName: String? + /// Where this function is looked up from in JavaScript. + public let from: JSImportFrom? public let parameters: [Parameter] public let returnType: BridgeType public let documentation: String? @@ -619,12 +628,14 @@ public struct ImportedFunctionSkeleton: Codable { public init( name: String, jsName: String? = nil, + from: JSImportFrom? = nil, parameters: [Parameter], returnType: BridgeType, documentation: String? = nil ) { self.name = name self.jsName = jsName + self.from = from self.parameters = parameters self.returnType = returnType self.documentation = documentation @@ -657,6 +668,8 @@ public struct ImportedGetterSkeleton: Codable { public let name: String /// The JavaScript property name to read from, if different from `name`. public let jsName: String? + /// Where this property is looked up from in JavaScript (only used for global getters). + public let from: JSImportFrom? public let type: BridgeType public let documentation: String? /// Name of the getter function if it's a separate function (from @JSGetter) @@ -665,12 +678,14 @@ public struct ImportedGetterSkeleton: Codable { public init( name: String, jsName: String? = nil, + from: JSImportFrom? = nil, type: BridgeType, documentation: String? = nil, functionName: String? = nil ) { self.name = name self.jsName = jsName + self.from = from self.type = type self.documentation = documentation self.functionName = functionName @@ -735,6 +750,8 @@ public struct ImportedTypeSkeleton: Codable { public let name: String /// The JavaScript constructor name to use for `init(...)`, if different from `name`. public let jsName: String? + /// Where this constructor is looked up from in JavaScript. + public let from: JSImportFrom? public let constructor: ImportedConstructorSkeleton? public let methods: [ImportedFunctionSkeleton] public let getters: [ImportedGetterSkeleton] @@ -744,6 +761,7 @@ public struct ImportedTypeSkeleton: Codable { public init( name: String, jsName: String? = nil, + from: JSImportFrom? = nil, constructor: ImportedConstructorSkeleton? = nil, methods: [ImportedFunctionSkeleton], getters: [ImportedGetterSkeleton] = [], @@ -752,6 +770,7 @@ public struct ImportedTypeSkeleton: Codable { ) { self.name = name self.jsName = jsName + self.from = from self.constructor = constructor self.methods = methods self.getters = getters diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index 3fb7f8114..f75619489 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -110,13 +110,19 @@ import BridgeJSUtilities let nodePath: URL = try config.findTool("node", targetDirectory: targetDirectory) let bridgeJsDtsPath = targetDirectory.appending(path: "bridge-js.d.ts") - if FileManager.default.fileExists(atPath: bridgeJsDtsPath.path) { + let bridgeJsGlobalDtsPath = targetDirectory.appending(path: "bridge-js.global.d.ts") + let hasDts = FileManager.default.fileExists(atPath: bridgeJsDtsPath.path) + let hasGlobalDts = FileManager.default.fileExists(atPath: bridgeJsGlobalDtsPath.path) + if hasDts || hasGlobalDts { guard let tsconfigPath = doubleDashOptions["project"] else { throw BridgeJSToolError("--project option is required when processing .d.ts files") } let bridgeJSMacrosPath = outputDirectory.appending(path: "BridgeJS.Macros.swift") + let primaryDtsPath = hasDts ? bridgeJsDtsPath.path : bridgeJsGlobalDtsPath.path + let globalDtsFiles = (hasDts && hasGlobalDts) ? [bridgeJsGlobalDtsPath.path] : [] _ = try invokeTS2Swift( - dtsFile: bridgeJsDtsPath.path, + dtsFile: primaryDtsPath, + globalDtsFiles: globalDtsFiles, tsconfigPath: tsconfigPath, nodePath: nodePath, progress: progress, diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js index 28f37e0ec..645be1f5a 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js @@ -73,7 +73,7 @@ class DiagnosticEngine { } function printUsage() { - console.error('Usage: ts2swift -p [-o output.swift]'); + console.error('Usage: ts2swift -p [--global ]... [-o output.swift]'); } /** @@ -94,6 +94,10 @@ export function main(args) { type: 'string', short: 'p', }, + global: { + type: 'string', + multiple: true, + }, "log-level": { type: 'string', default: 'info', @@ -131,15 +135,44 @@ export function main(args) { process.exit(1); } - const program = TypeProcessor.createProgram(filePath, configParseResult.options); + /** @type {string[]} */ + const globalFiles = Array.isArray(options.values.global) + ? options.values.global + : (options.values.global ? [options.values.global] : []); + + const program = TypeProcessor.createProgram([filePath, ...globalFiles], configParseResult.options); const diagnostics = program.getSemanticDiagnostics(); if (diagnostics.length > 0) { diagnosticEngine.tsDiagnose(diagnostics); process.exit(1); } - const processor = new TypeProcessor(program.getTypeChecker(), diagnosticEngine); - const { content: swiftOutput, hasAny } = processor.processTypeDeclarations(program, filePath); + const prelude = [ + "// 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(Experimental) import JavaScriptKit", + "", + "", + ].join("\n"); + + /** @type {string[]} */ + const bodies = []; + const globalFileSet = new Set(globalFiles); + for (const inputPath of [filePath, ...globalFiles]) { + const processor = new TypeProcessor(program.getTypeChecker(), diagnosticEngine, { + defaultImportFromGlobal: globalFileSet.has(inputPath), + }); + const result = processor.processTypeDeclarations(program, inputPath); + const body = result.content.trim(); + if (body.length > 0) bodies.push(body); + } + + const hasAny = bodies.length > 0; + const swiftOutput = hasAny ? prelude + bodies.join("\n\n") + "\n" : ""; if (options.values.output) { if (hasAny) { diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 1992b49f2..e48510466 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -24,9 +24,10 @@ export class TypeProcessor { * @param {ts.CompilerOptions} options - Compiler options * @returns {ts.Program} TypeScript program object */ - static createProgram(filePath, options) { + static createProgram(filePaths, options) { const host = ts.createCompilerHost(options); - return ts.createProgram([filePath], options, host); + const roots = Array.isArray(filePaths) ? filePaths : [filePaths]; + return ts.createProgram(roots, options, host); } /** @@ -63,6 +64,43 @@ export class TypeProcessor { /** @type {Map} */ this.swiftTypeNameByJSTypeName = new Map(); + + /** @type {boolean} */ + this.defaultImportFromGlobal = options.defaultImportFromGlobal ?? false; + } + + /** + * Escape a string for a Swift string literal inside macro arguments. + * @param {string} value + * @returns {string} + * @private + */ + escapeForSwiftStringLiteral(value) { + return value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\\\""); + } + + /** + * Render a `jsName:` macro argument if the JS name differs from the default. + * @param {string} jsName + * @param {string} defaultName + * @returns {string | null} + * @private + */ + renderOptionalJSNameArg(jsName, defaultName) { + if (jsName === defaultName) return null; + return `jsName: "${this.escapeForSwiftStringLiteral(jsName)}"`; + } + + /** + * Render a macro annotation with optional labeled arguments. + * @param {string} macroName + * @param {string[]} args + * @returns {string} + * @private + */ + renderMacroAnnotation(macroName, args) { + if (!args.length) return `@${macroName}`; + return `@${macroName}(${args.join(", ")})`; } /** @@ -100,18 +138,6 @@ export class TypeProcessor { sf => !sf.isDeclarationFile || sf.fileName === inputFilePath ); - // Add prelude - this.swiftLines.push( - "// 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(Experimental) import JavaScriptKit", - "" - ); - for (const sourceFile of sourceFiles) { if (sourceFile.fileName.includes('node_modules/typescript/lib')) continue; @@ -140,7 +166,7 @@ export class TypeProcessor { } const content = this.swiftLines.join("\n").trimEnd() + "\n"; - const hasAny = this.swiftLines.length > 9; // More than just the prelude + const hasAny = content.trim().length > 0; return { content, hasAny }; } @@ -154,6 +180,8 @@ export class TypeProcessor { this.visitFunctionDeclaration(node); } else if (ts.isClassDeclaration(node)) { this.visitClassDecl(node); + } else if (ts.isVariableStatement(node)) { + this.visitVariableStatement(node); } else if (ts.isEnumDeclaration(node)) { this.visitEnumDeclaration(node); } else if (ts.isExportDeclaration(node)) { @@ -222,6 +250,41 @@ export class TypeProcessor { } } + /** + * Visit an exported variable statement and render Swift global getter(s). + * Supports simple `export const foo: T` / `export let foo: T` declarations. + * + * @param {ts.VariableStatement} node + * @private + */ + visitVariableStatement(node) { + const isExported = node.modifiers?.some(m => m.kind === ts.SyntaxKind.ExportKeyword) ?? false; + if (!isExported) return; + + const fromArg = this.renderDefaultJSImportFromArgument(); + + for (const decl of node.declarationList.declarations) { + if (!ts.isIdentifier(decl.name)) continue; + + const jsName = decl.name.text; + const swiftName = this.swiftTypeName(jsName); + const swiftVarName = this.renderIdentifier(swiftName); + + const type = this.checker.getTypeAtLocation(decl); + const swiftType = this.visitType(type, decl); + + /** @type {string[]} */ + const args = []; + const jsNameArg = this.renderOptionalJSNameArg(jsName, swiftName); + if (jsNameArg) args.push(jsNameArg); + if (fromArg) args.push(fromArg); + const annotation = this.renderMacroAnnotation("JSGetter", args); + + this.swiftLines.push(`${annotation} var ${swiftVarName}: ${swiftType}`); + this.swiftLines.push(""); + } + } + /** * @param {ts.Type} type * @returns {boolean} @@ -370,8 +433,13 @@ export class TypeProcessor { if (!node.name) return; const jsName = node.name.text; const swiftName = this.swiftTypeName(jsName); - const escapedJSName = jsName.replaceAll("\\", "\\\\").replaceAll("\"", "\\\\\""); - const annotation = jsName !== swiftName ? `@JSFunction(jsName: "${escapedJSName}")` : "@JSFunction"; + const fromArg = this.renderDefaultJSImportFromArgument(); + /** @type {string[]} */ + const args = []; + const jsNameArg = this.renderOptionalJSNameArg(jsName, swiftName); + if (jsNameArg) args.push(jsNameArg); + if (fromArg) args.push(fromArg); + const annotation = this.renderMacroAnnotation("JSFunction", args); const signature = this.checker.getSignatureFromDeclaration(node); if (!signature) return; @@ -402,6 +470,12 @@ export class TypeProcessor { return parts.join("\n"); } + /** @returns {string} */ + renderDefaultJSImportFromArgument() { + if (this.defaultImportFromGlobal) return "from: .global"; + return ""; + } + /** * Render constructor parameters * @param {ts.ConstructorDeclaration} node @@ -465,8 +539,13 @@ export class TypeProcessor { this.emittedStructuredTypeNames.add(jsName); const swiftName = this.swiftTypeName(jsName); - const escapedJSName = jsName.replaceAll("\\", "\\\\").replaceAll("\"", "\\\\\""); - const annotation = jsName !== swiftName ? `@JSClass(jsName: "${escapedJSName}")` : "@JSClass"; + const fromArg = this.renderDefaultJSImportFromArgument(); + /** @type {string[]} */ + const args = []; + const jsNameArg = this.renderOptionalJSNameArg(jsName, swiftName); + if (jsNameArg) args.push(jsNameArg); + if (fromArg) args.push(fromArg); + const annotation = this.renderMacroAnnotation("JSClass", args); const className = this.renderIdentifier(swiftName); this.swiftLines.push(`${annotation} struct ${className} {`); @@ -526,8 +605,11 @@ export class TypeProcessor { this.emittedStructuredTypeNames.add(name); const swiftName = this.swiftTypeName(name); - const escapedJSName = name.replaceAll("\\", "\\\\").replaceAll("\"", "\\\\\""); - const annotation = name !== swiftName ? `@JSClass(jsName: "${escapedJSName}")` : "@JSClass"; + /** @type {string[]} */ + const args = []; + const jsNameArg = this.renderOptionalJSNameArg(name, swiftName); + if (jsNameArg) args.push(jsNameArg); + const annotation = this.renderMacroAnnotation("JSClass", args); const typeName = this.renderIdentifier(swiftName); this.swiftLines.push(`${annotation} struct ${typeName} {`); @@ -672,8 +754,14 @@ export class TypeProcessor { const type = property.type; const swiftName = this.renderIdentifier(property.swiftName); const needsJSGetterName = property.jsName !== property.swiftName; - const escapedJSName = property.jsName.replaceAll("\\", "\\\\").replaceAll("\"", "\\\\\""); - const getterAnnotation = needsJSGetterName ? `@JSGetter(jsName: "${escapedJSName}")` : "@JSGetter"; + // Note: `from: .global` is only meaningful for top-level imports and constructors. + // Instance member access always comes from the JS object itself. + const fromArg = ""; + /** @type {string[]} */ + const getterArgs = []; + if (needsJSGetterName) getterArgs.push(`jsName: "${this.escapeForSwiftStringLiteral(property.jsName)}"`); + if (fromArg) getterArgs.push(fromArg); + const getterAnnotation = this.renderMacroAnnotation("JSGetter", getterArgs); // Always render getter this.swiftLines.push(` ${getterAnnotation} var ${swiftName}: ${type}`); @@ -684,7 +772,11 @@ export class TypeProcessor { const derivedPropertyName = property.swiftName.charAt(0).toLowerCase() + property.swiftName.slice(1); const needsJSNameField = property.jsName !== derivedPropertyName; const setterName = `set${capitalizedSwiftName}`; - const annotation = needsJSNameField ? `@JSSetter(jsName: "${escapedJSName}")` : "@JSSetter"; + /** @type {string[]} */ + const setterArgs = []; + if (needsJSNameField) setterArgs.push(`jsName: "${this.escapeForSwiftStringLiteral(property.jsName)}"`); + if (fromArg) setterArgs.push(fromArg); + const annotation = this.renderMacroAnnotation("JSSetter", setterArgs); this.swiftLines.push(` ${annotation} func ${this.renderIdentifier(setterName)}(_ value: ${type}) ${this.renderEffects({ isAsync: false })}`); } } @@ -709,8 +801,14 @@ export class TypeProcessor { const swiftName = this.swiftTypeName(jsName); const needsJSNameField = jsName !== swiftName; - const escapedJSName = jsName.replaceAll("\\", "\\\\").replaceAll("\"", "\\\\\""); - const annotation = needsJSNameField ? `@JSFunction(jsName: "${escapedJSName}")` : "@JSFunction"; + // Note: `from: .global` is only meaningful for top-level imports and constructors. + // Instance member calls always come from the JS object itself. + const fromArg = ""; + /** @type {string[]} */ + const args = []; + if (needsJSNameField) args.push(`jsName: "${this.escapeForSwiftStringLiteral(jsName)}"`); + if (fromArg) args.push(fromArg); + const annotation = this.renderMacroAnnotation("JSFunction", args); const signature = this.checker.getSignatureFromDeclaration(node); if (!signature) return; diff --git a/Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift b/Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift index 0a69eb702..795b7b390 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift +++ b/Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift @@ -87,6 +87,7 @@ extension BridgeJSConfig { /// - Returns: The generated Swift source code (always collected from stdout for return value) public func invokeTS2Swift( dtsFile: String, + globalDtsFiles: [String] = [], tsconfigPath: String, nodePath: URL, progress: ProgressReporting, @@ -98,6 +99,9 @@ public func invokeTS2Swift( .appendingPathComponent("bin") .appendingPathComponent("ts2swift.js") var arguments = [ts2swiftPath.path, dtsFile, "--project", tsconfigPath] + for global in globalDtsFiles { + arguments.append(contentsOf: ["--global", global]) + } if let outputPath = outputPath { arguments.append(contentsOf: ["--output", outputPath]) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/GlobalThisImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/GlobalThisImports.swift new file mode 100644 index 000000000..fbf77adf1 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/GlobalThisImports.swift @@ -0,0 +1,14 @@ +@JSClass +struct JSConsole { + @JSFunction func log(_ message: String) throws(JSException) +} + +@JSGetter(from: .global) var console: JSConsole + +@JSFunction(jsName: "parseInt", from: .global) func parseInt(_ string: String) throws(JSException) -> Double + +@JSClass(from: .global) +struct WebSocket { + @JSFunction init(_ url: String) throws(JSException) + @JSFunction func close() throws(JSException) +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js index 32593d2ae..afcdddbd4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js @@ -205,7 +205,7 @@ export async function createInstantiator(options, swift) { const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_console_get"] = function bjs_console_get() { try { - let ret = imports["console"]; + let ret = imports.console; return swift.memory.retain(ret); } catch (error) { setException(error); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.d.ts new file mode 100644 index 000000000..ae1152016 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.d.ts @@ -0,0 +1,23 @@ +// 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 interface JSConsole { + log(message: string): void; +} +export interface WebSocket { + close(): void; +} +export type Exports = { +} +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/GlobalThisImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js new file mode 100644 index 000000000..b671728af --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js @@ -0,0 +1,269 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + let tmpStructCleanups = []; + 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) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_console_get"] = function bjs_console_get() { + try { + let ret = globalThis.console; + return swift.memory.retain(ret); + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_parseInt"] = function bjs_parseInt(string) { + try { + const stringObject = swift.memory.getObject(string); + swift.memory.release(string); + let ret = globalThis.parseInt(stringObject); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_JSConsole_log"] = function bjs_JSConsole_log(self, message) { + try { + const messageObject = swift.memory.getObject(message); + swift.memory.release(message); + swift.memory.getObject(self).log(messageObject); + } catch (error) { + setException(error); + } + } + TestModule["bjs_WebSocket_init"] = function bjs_WebSocket_init(url) { + try { + const urlObject = swift.memory.getObject(url); + swift.memory.release(url); + return swift.memory.retain(new globalThis.WebSocket(urlObject)); + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_WebSocket_close"] = function bjs_WebSocket_close(self) { + try { + swift.memory.getObject(self).close(); + } catch (error) { + setException(error); + } + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + const exports = { + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js index 1e1c73492..4eb09bb27 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js @@ -28,6 +28,7 @@ export async function createInstantiator(options, swift) { let tmpParamF64s = []; let tmpRetPointers = []; let tmpParamPointers = []; + let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -120,6 +121,27 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } + bjs["swift_js_struct_lower_PointerFields"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.PointerFields.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_raise_PointerFields"] = function() { + const value = structHelpers.PointerFields.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift index 503fed02d..3954f3feb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift @@ -15,7 +15,49 @@ extension PointerFields: _BridgedSwiftStruct { _swift_js_push_pointer(self.ptr.bridgeJSLowerReturn()) _swift_js_push_pointer(self.mutPtr.bridgeJSLowerReturn()) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _PointerFieldsHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _PointerFieldsHelpers.raise() + } +} + +fileprivate enum _PointerFieldsHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_PointerFields())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PointerFields") +fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_PointerFields") +fileprivate func _bjs_struct_raise_PointerFields() -> Int32 +#else +fileprivate func _bjs_struct_raise_PointerFields() -> Int32 { + fatalError("Only available on WebAssembly") } +#endif @_expose(wasm, "bjs_PointerFields_init") @_cdecl("bjs_PointerFields_init") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalThisImports.ImportMacros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalThisImports.ImportMacros.swift new file mode 100644 index 000000000..503da6189 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalThisImports.ImportMacros.swift @@ -0,0 +1,87 @@ +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_console_get") +fileprivate func bjs_console_get() -> Int32 +#else +fileprivate func bjs_console_get() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$console_get() throws(JSException) -> JSConsole { + let ret = bjs_console_get() + if let error = _swift_js_take_exception() { + throw error + } + return JSConsole.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_parseInt") +fileprivate func bjs_parseInt(_ string: Int32) -> Float64 +#else +fileprivate func bjs_parseInt(_ string: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$parseInt(_ string: String) throws(JSException) -> Double { + let stringValue = string.bridgeJSLowerParameter() + let ret = bjs_parseInt(stringValue) + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_JSConsole_log") +fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void +#else +fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$JSConsole_log(_ self: JSObject, _ message: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let messageValue = message.bridgeJSLowerParameter() + bjs_JSConsole_log(selfValue, messageValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WebSocket_init") +fileprivate func bjs_WebSocket_init(_ url: Int32) -> Int32 +#else +fileprivate func bjs_WebSocket_init(_ url: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WebSocket_close") +fileprivate func bjs_WebSocket_close(_ self: Int32) -> Void +#else +fileprivate func bjs_WebSocket_close(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$WebSocket_init(_ url: String) throws(JSException) -> JSObject { + let urlValue = url.bridgeJSLowerParameter() + let ret = bjs_WebSocket_init(urlValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$WebSocket_close(_ self: JSObject) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + bjs_WebSocket_close(selfValue) + if let error = _swift_js_take_exception() { + throw error + } +} \ No newline at end of file diff --git a/Sources/JavaScriptKit/Macros.swift b/Sources/JavaScriptKit/Macros.swift index 61797a58e..329945f2f 100644 --- a/Sources/JavaScriptKit/Macros.swift +++ b/Sources/JavaScriptKit/Macros.swift @@ -6,6 +6,13 @@ public enum JSEnumStyle: String { case tsEnum } +/// Controls where BridgeJS reads imported JS values from. +/// +/// - `global`: Read from `globalThis`. +public enum JSImportFrom: String { + case global +} + /// A macro that exposes Swift functions, classes, and methods to JavaScript. /// /// Apply this macro to Swift declarations that you want to make callable from JavaScript: @@ -126,9 +133,12 @@ public macro JS(namespace: String? = nil, enumStyle: JSEnumStyle = .const) = Bui /// @JSGetter var name: String /// } /// ``` +/// +/// - Parameter from: Selects where the property is read from. +/// Use `.global` to read from `globalThis` (e.g. `console`, `document`). @attached(accessor) @_spi(Experimental) -public macro JSGetter(jsName: String? = nil) = +public macro JSGetter(jsName: String? = nil, from: JSImportFrom? = nil) = #externalMacro(module: "BridgeJSMacros", type: "JSGetterMacro") /// A macro that generates a Swift function body that writes a value to JavaScript. @@ -147,7 +157,7 @@ public macro JSGetter(jsName: String? = nil) = /// ``` @attached(body) @_spi(Experimental) -public macro JSSetter(jsName: String? = nil) = +public macro JSSetter(jsName: String? = nil, from: JSImportFrom? = nil) = #externalMacro(module: "BridgeJSMacros", type: "JSSetterMacro") /// A macro that generates a Swift function body that calls a JavaScript function. @@ -165,9 +175,11 @@ public macro JSSetter(jsName: String? = nil) = /// /// - Parameter jsName: An optional string that specifies the name of the JavaScript function or method to call. /// If not provided, the Swift function name is used. +/// - Parameter from: Selects where the function is looked up from. +/// Use `.global` to call a function on `globalThis` (e.g. `setTimeout`). @attached(body) @_spi(Experimental) -public macro JSFunction(jsName: String? = nil) = +public macro JSFunction(jsName: String? = nil, from: JSImportFrom? = nil) = #externalMacro(module: "BridgeJSMacros", type: "JSFunctionMacro") /// A macro that adds bridging members for a Swift type that represents a JavaScript class. @@ -187,8 +199,11 @@ public macro JSFunction(jsName: String? = nil) = /// @JSFunction func greet() throws (JSException) -> String /// } /// ``` +/// +/// - Parameter from: Selects where the constructor is looked up from. +/// Use `.global` to construct globals like `WebSocket` via `globalThis`. @attached(member, names: arbitrary) @attached(extension, conformances: _JSBridgedClass) @_spi(Experimental) -public macro JSClass(jsName: String? = nil) = +public macro JSClass(jsName: String? = nil, from: JSImportFrom? = nil) = #externalMacro(module: "BridgeJSMacros", type: "JSClassMacro") diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index ffcfca8dd..b0b24137a 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -47,3 +47,19 @@ extension FeatureFlag: _BridgedSwiftEnumNoPayload {} @JSFunction init() throws (JSException) @JSFunction(jsName: "method-with-dashes") func method_with_dashes() throws (JSException) -> String } + +@JSFunction(from: .global) func parseInt(_ string: String) throws (JSException) -> Double + +@JSClass(from: .global) struct Animal { + @JSGetter var name: String + @JSSetter func setName(_ value: String) throws (JSException) + @JSGetter var age: Double + @JSSetter func setAge(_ value: Double) throws (JSException) + @JSGetter var isCat: Bool + @JSSetter func setIsCat(_ value: Bool) throws (JSException) + @JSFunction init(_ name: String, _ age: Double, _ isCat: Bool) throws (JSException) + @JSFunction func bark() throws (JSException) -> String + @JSFunction func getIsCat() throws (JSException) -> Bool +} + +@JSGetter(from: .global) var globalObject1: JSObject diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index c4fd3a722..b47bf062b 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2229,8 +2229,50 @@ extension PointerFields: _BridgedSwiftStruct { _swift_js_push_pointer(self.ptr.bridgeJSLowerReturn()) _swift_js_push_pointer(self.mutPtr.bridgeJSLowerReturn()) } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _PointerFieldsHelpers.lower(jsObject) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return _PointerFieldsHelpers.raise() + } } +fileprivate enum _PointerFieldsHelpers { + static func lower(_ jsObject: JSObject) -> Int32 { + return _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) + } + + static func raise() -> JSObject { + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_PointerFields())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PointerFields") +fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_PointerFields") +fileprivate func _bjs_struct_raise_PointerFields() -> Int32 +#else +fileprivate func _bjs_struct_raise_PointerFields() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_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 { @@ -6930,6 +6972,23 @@ func _$Foo_value_get(_ self: JSObject) throws(JSException) -> String { return String.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_globalObject1_get") +fileprivate func bjs_globalObject1_get() -> Int32 +#else +fileprivate func bjs_globalObject1_get() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$globalObject1_get() throws(JSException) -> JSObject { + let ret = bjs_globalObject1_get() + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripVoid") fileprivate func bjs_jsRoundTripVoid() -> Void @@ -7123,6 +7182,24 @@ func _$_jsWeirdFunction() throws(JSException) -> Double { return Double.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_parseInt") +fileprivate func bjs_parseInt(_ string: Int32) -> Float64 +#else +fileprivate func bjs_parseInt(_ string: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$parseInt(_ string: String) throws(JSException) -> Double { + let stringValue = string.bridgeJSLowerParameter() + let ret = bjs_parseInt(stringValue) + 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(_ name: Int32, _ prefix: Int32) -> Int32 @@ -7267,6 +7344,170 @@ func _$_WeirdClass_method_with_dashes(_ self: JSObject) throws(JSException) -> S return String.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_init") +fileprivate func bjs_Animal_init(_ name: Int32, _ age: Float64, _ isCat: Int32) -> Int32 +#else +fileprivate func bjs_Animal_init(_ name: Int32, _ age: Float64, _ isCat: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_name_get") +fileprivate func bjs_Animal_name_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_Animal_name_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_age_get") +fileprivate func bjs_Animal_age_get(_ self: Int32) -> Float64 +#else +fileprivate func bjs_Animal_age_get(_ self: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_isCat_get") +fileprivate func bjs_Animal_isCat_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_Animal_isCat_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_name_set") +fileprivate func bjs_Animal_name_set(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_Animal_name_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_age_set") +fileprivate func bjs_Animal_age_set(_ self: Int32, _ newValue: Float64) -> Void +#else +fileprivate func bjs_Animal_age_set(_ self: Int32, _ newValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_isCat_set") +fileprivate func bjs_Animal_isCat_set(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_Animal_isCat_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_bark") +fileprivate func bjs_Animal_bark(_ self: Int32) -> Int32 +#else +fileprivate func bjs_Animal_bark(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_getIsCat") +fileprivate func bjs_Animal_getIsCat(_ self: Int32) -> Int32 +#else +fileprivate func bjs_Animal_getIsCat(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$Animal_init(_ name: String, _ age: Double, _ isCat: Bool) throws(JSException) -> JSObject { + let nameValue = name.bridgeJSLowerParameter() + let ageValue = age.bridgeJSLowerParameter() + let isCatValue = isCat.bridgeJSLowerParameter() + let ret = bjs_Animal_init(nameValue, ageValue, isCatValue) + 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() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_Animal_name_set(selfValue, newValueValue) + 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_jsApplyInt") fileprivate func bjs_jsApplyInt(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 63c403bcf..82c394a93 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -9690,6 +9690,36 @@ "returnType" : { "double" : { + } + } + }, + { + "from" : "global", + "name" : "parseInt", + "parameters" : [ + { + "name" : "string", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + } + ], + "globalGetters" : [ + { + "from" : "global", + "name" : "globalObject1", + "type" : { + "jsObject" : { + } } } @@ -9806,6 +9836,117 @@ "setters" : [ ] + }, + { + "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" : [ + { + "name" : "bark", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "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" : { + + } + } + } + ] } ] }, @@ -9817,6 +9958,14 @@ ] }, + { + "functions" : [ + + ], + "types" : [ + + ] + }, { "functions" : [ { diff --git a/Tests/BridgeJSRuntimeTests/GlobalThisImportTests.swift b/Tests/BridgeJSRuntimeTests/GlobalThisImportTests.swift new file mode 100644 index 000000000..2f6251341 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/GlobalThisImportTests.swift @@ -0,0 +1,19 @@ +import XCTest +import JavaScriptKit + +final class GlobalThisImportTests: XCTestCase { + func testGlobalFunctionImport() throws { + XCTAssertEqual(try parseInt("42"), 42) + } + + func testGlobalClassImport() throws { + let cat = try Animal("Mimi", 3, true) + XCTAssertEqual(try cat.bark(), "nyan") + XCTAssertEqual(try cat.getIsCat(), true) + } + + func testGlobalGetterImport() throws { + let value = try globalObject1["prop_2"].number + XCTAssertEqual(value, 2) + } +} diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.global.d.ts b/Tests/BridgeJSRuntimeTests/bridge-js.global.d.ts new file mode 100644 index 000000000..b856ce8bd --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/bridge-js.global.d.ts @@ -0,0 +1,15 @@ +// Declarations in this file are imported from `globalThis`. + +export function parseInt(string: string): number; + +export class Animal { + name: string; + age: number; + isCat: boolean; + constructor(name: string, age: number, isCat: boolean); + bark(): string; + getIsCat(): boolean; +} + +export const globalObject1: any; + From 9c8d67d161deea5eaf80262acca2948a2fa40fcf Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 27 Jan 2026 19:16:37 +0900 Subject: [PATCH 104/252] Benchmarks: optional-return cases and runner tweaks (#529) * Benchmarks: add optional-return cases and improve runner * Benchmarks: pass iterations without globals * Run ./Utilities/bridge-js-generate.sh --------- Co-authored-by: Krzysztof Rodak --- Benchmarks/Sources/Benchmarks.swift | 16 ++ Benchmarks/Sources/Generated/BridgeJS.swift | 124 ++++++++++++ .../Generated/JavaScript/BridgeJS.json | 188 ++++++++++++++++++ Benchmarks/run.js | 83 +++++++- 4 files changed, 402 insertions(+), 9 deletions(-) diff --git a/Benchmarks/Sources/Benchmarks.swift b/Benchmarks/Sources/Benchmarks.swift index 661aba63e..921db50ea 100644 --- a/Benchmarks/Sources/Benchmarks.swift +++ b/Benchmarks/Sources/Benchmarks.swift @@ -111,6 +111,22 @@ enum ComplexResult { } } +@JS class OptionalReturnRoundtrip { + @JS init() {} + + @JS func makeIntSome() -> Int? { 42 } + @JS func makeIntNone() -> Int? { nil } + + @JS func makeBoolSome() -> Bool? { true } + @JS func makeBoolNone() -> Bool? { nil } + + @JS func makeDoubleSome() -> Double? { 0.5 } + @JS func makeDoubleNone() -> Double? { nil } + + @JS func makeStringSome() -> String? { "Hello, world" } + @JS func makeStringNone() -> String? { nil } +} + // MARK: - Struct Performance Tests @JS struct SimpleStruct { diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 7d90eb82b..0bbc68bb2 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -839,6 +839,130 @@ fileprivate func _bjs_StringRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) - } #endif +@_expose(wasm, "bjs_OptionalReturnRoundtrip_init") +@_cdecl("bjs_OptionalReturnRoundtrip_init") +public func _bjs_OptionalReturnRoundtrip_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = OptionalReturnRoundtrip() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalReturnRoundtrip_makeIntSome") +@_cdecl("bjs_OptionalReturnRoundtrip_makeIntSome") +public func _bjs_OptionalReturnRoundtrip_makeIntSome(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalReturnRoundtrip.bridgeJSLiftParameter(_self).makeIntSome() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalReturnRoundtrip_makeIntNone") +@_cdecl("bjs_OptionalReturnRoundtrip_makeIntNone") +public func _bjs_OptionalReturnRoundtrip_makeIntNone(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalReturnRoundtrip.bridgeJSLiftParameter(_self).makeIntNone() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalReturnRoundtrip_makeBoolSome") +@_cdecl("bjs_OptionalReturnRoundtrip_makeBoolSome") +public func _bjs_OptionalReturnRoundtrip_makeBoolSome(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalReturnRoundtrip.bridgeJSLiftParameter(_self).makeBoolSome() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalReturnRoundtrip_makeBoolNone") +@_cdecl("bjs_OptionalReturnRoundtrip_makeBoolNone") +public func _bjs_OptionalReturnRoundtrip_makeBoolNone(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalReturnRoundtrip.bridgeJSLiftParameter(_self).makeBoolNone() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalReturnRoundtrip_makeDoubleSome") +@_cdecl("bjs_OptionalReturnRoundtrip_makeDoubleSome") +public func _bjs_OptionalReturnRoundtrip_makeDoubleSome(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalReturnRoundtrip.bridgeJSLiftParameter(_self).makeDoubleSome() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalReturnRoundtrip_makeDoubleNone") +@_cdecl("bjs_OptionalReturnRoundtrip_makeDoubleNone") +public func _bjs_OptionalReturnRoundtrip_makeDoubleNone(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalReturnRoundtrip.bridgeJSLiftParameter(_self).makeDoubleNone() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalReturnRoundtrip_makeStringSome") +@_cdecl("bjs_OptionalReturnRoundtrip_makeStringSome") +public func _bjs_OptionalReturnRoundtrip_makeStringSome(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalReturnRoundtrip.bridgeJSLiftParameter(_self).makeStringSome() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalReturnRoundtrip_makeStringNone") +@_cdecl("bjs_OptionalReturnRoundtrip_makeStringNone") +public func _bjs_OptionalReturnRoundtrip_makeStringNone(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalReturnRoundtrip.bridgeJSLiftParameter(_self).makeStringNone() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalReturnRoundtrip_deinit") +@_cdecl("bjs_OptionalReturnRoundtrip_deinit") +public func _bjs_OptionalReturnRoundtrip_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension OptionalReturnRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalReturnRoundtrip_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_OptionalReturnRoundtrip_wrap") +fileprivate func _bjs_OptionalReturnRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_OptionalReturnRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_StructRoundtrip_init") @_cdecl("bjs_StructRoundtrip_init") public func _bjs_StructRoundtrip_init() -> UnsafeMutableRawPointer { diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json index 27a245f56..42cbcb707 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json @@ -424,6 +424,194 @@ ], "swiftCallName" : "StringRoundtrip" }, + { + "constructor" : { + "abiName" : "bjs_OptionalReturnRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_OptionalReturnRoundtrip_makeIntSome", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeIntSome", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_OptionalReturnRoundtrip_makeIntNone", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeIntNone", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_OptionalReturnRoundtrip_makeBoolSome", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeBoolSome", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "abiName" : "bjs_OptionalReturnRoundtrip_makeBoolNone", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeBoolNone", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "abiName" : "bjs_OptionalReturnRoundtrip_makeDoubleSome", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeDoubleSome", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_OptionalReturnRoundtrip_makeDoubleNone", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeDoubleNone", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_OptionalReturnRoundtrip_makeStringSome", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeStringSome", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_OptionalReturnRoundtrip_makeStringNone", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeStringNone", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "name" : "OptionalReturnRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "OptionalReturnRoundtrip" + }, { "constructor" : { "abiName" : "bjs_StructRoundtrip_init", diff --git a/Benchmarks/run.js b/Benchmarks/run.js index 5c27e6fff..7771887c5 100644 --- a/Benchmarks/run.js +++ b/Benchmarks/run.js @@ -17,9 +17,17 @@ function updateProgress(current, total, label = '', width) { const completed = Math.round(width * (percent / 100)); const remaining = width - completed; const bar = '█'.repeat(completed) + '░'.repeat(remaining); - process.stdout.clearLine(); - process.stdout.cursorTo(0); - process.stdout.write(`${label} [${bar}] ${current}/${total}`); + const canUpdateLine = + process.stdout.isTTY && + typeof process.stdout.clearLine === "function" && + typeof process.stdout.cursorTo === "function"; + if (canUpdateLine) { + process.stdout.clearLine(); + process.stdout.cursorTo(0); + process.stdout.write(`${label} [${bar}] ${current}/${total}`); + } else if (current === 0 || current === total) { + console.log(`${label} [${bar}] ${current}/${total}`); + } } /** @@ -263,14 +271,21 @@ function saveJsonResults(filePath, data) { /** * Run a single benchmark iteration * @param {Object} results - Results object to store benchmark data + * @param {(name: string) => boolean} nameFilter - Name filter + * @param {number} iterations - Loop iterations per JS benchmark * @returns {Promise} */ -async function singleRun(results, nameFilter) { +async function singleRun(results, nameFilter, iterations) { const options = await defaultNodeSetup({}) const benchmarkRunner = (name, body) => { if (nameFilter && !nameFilter(name)) { return; } + // Warmup to reduce JIT/IC noise. + body(); + if (typeof globalThis.gc === "function") { + globalThis.gc(); + } const startTime = performance.now(); body(); const endTime = performance.now(); @@ -291,7 +306,6 @@ async function singleRun(results, nameFilter) { exports.run(); const enumRoundtrip = new exports.EnumRoundtrip(); - const iterations = 100_000; benchmarkRunner("EnumRoundtrip/takeEnum success", () => { for (let i = 0; i < iterations; i++) { enumRoundtrip.take({ tag: APIResult.Tag.Success, param0: "Hello, world" }) @@ -455,6 +469,48 @@ async function singleRun(results, nameFilter) { } }) + const optionalReturnRoundtrip = new exports.OptionalReturnRoundtrip(); + benchmarkRunner("OptionalReturnRoundtrip/makeIntSome", () => { + for (let i = 0; i < iterations; i++) { + optionalReturnRoundtrip.makeIntSome() + } + }) + benchmarkRunner("OptionalReturnRoundtrip/makeIntNone", () => { + for (let i = 0; i < iterations; i++) { + optionalReturnRoundtrip.makeIntNone() + } + }) + benchmarkRunner("OptionalReturnRoundtrip/makeBoolSome", () => { + for (let i = 0; i < iterations; i++) { + optionalReturnRoundtrip.makeBoolSome() + } + }) + benchmarkRunner("OptionalReturnRoundtrip/makeBoolNone", () => { + for (let i = 0; i < iterations; i++) { + optionalReturnRoundtrip.makeBoolNone() + } + }) + benchmarkRunner("OptionalReturnRoundtrip/makeDoubleSome", () => { + for (let i = 0; i < iterations; i++) { + optionalReturnRoundtrip.makeDoubleSome() + } + }) + benchmarkRunner("OptionalReturnRoundtrip/makeDoubleNone", () => { + for (let i = 0; i < iterations; i++) { + optionalReturnRoundtrip.makeDoubleNone() + } + }) + benchmarkRunner("OptionalReturnRoundtrip/makeStringSome", () => { + for (let i = 0; i < iterations; i++) { + optionalReturnRoundtrip.makeStringSome() + } + }) + benchmarkRunner("OptionalReturnRoundtrip/makeStringNone", () => { + for (let i = 0; i < iterations; i++) { + optionalReturnRoundtrip.makeStringNone() + } + }) + // Struct performance tests const structRoundtrip = new exports.StructRoundtrip(); @@ -590,9 +646,10 @@ async function singleRun(results, nameFilter) { * Run until the coefficient of variation of measurements is below the threshold * @param {Object} results - Benchmark results object * @param {Object} options - Adaptive sampling options + * @param {number} iterations - Loop iterations per JS benchmark * @returns {Promise} */ -async function runUntilStable(results, options, width, nameFilter, filterArg) { +async function runUntilStable(results, options, width, nameFilter, filterArg, iterations) { const { minRuns = 5, maxRuns = 50, @@ -611,7 +668,7 @@ async function runUntilStable(results, options, width, nameFilter, filterArg) { // Update progress with estimated completion updateProgress(runs, maxRuns, "Benchmark Progress:", width); - await singleRun(results, nameFilter); + await singleRun(results, nameFilter, iterations); runs++; if (runs === 1 && Object.keys(results).length === 0) { @@ -674,6 +731,7 @@ Usage: node run.js [options] Options: --runs=NUMBER Number of benchmark runs (default: 10) + --iterations=NUMBER Loop iterations per JS benchmark (default: 100000) --output=FILENAME Save JSON results to specified file --baseline=FILENAME Compare results with baseline JSON file --adaptive Enable adaptive sampling (run until stable) @@ -689,6 +747,7 @@ async function main() { const args = parseArgs({ options: { runs: { type: 'string', default: '10' }, + iterations: { type: 'string', default: '100000' }, output: { type: 'string' }, baseline: { type: 'string' }, help: { type: 'boolean', default: false }, @@ -710,6 +769,12 @@ async function main() { const filterArg = args.values.filter; const nameFilter = createNameFilter(filterArg); + const iterations = parseInt(args.values.iterations, 10); + if (isNaN(iterations) || iterations <= 0) { + console.error('Invalid --iterations value:', args.values.iterations); + process.exit(1); + } + if (args.values.adaptive) { // Adaptive sampling mode const options = { @@ -723,7 +788,7 @@ async function main() { console.log(`Results will be saved to: ${args.values.output}`); } - await runUntilStable(results, options, width, nameFilter, filterArg); + await runUntilStable(results, options, width, nameFilter, filterArg, iterations); } else { // Fixed number of runs mode const runs = parseInt(args.values.runs, 10); @@ -745,7 +810,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); + await singleRun(results, nameFilter, iterations); if (i === 0 && Object.keys(results).length === 0) { process.stdout.write("\n"); console.error(`No benchmarks matched filter: ${filterArg}`); From 57160fe5c403822a3bc07217f931e05d12fe41ea Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 27 Jan 2026 22:44:19 +0900 Subject: [PATCH 105/252] BridgeJS: Remove unnecessary helper enums for struct bridging (#532) --- Benchmarks/Sources/Generated/BridgeJS.swift | 48 +----- .../Sources/BridgeJSCore/ExportSwift.swift | 17 +-- .../ExportSwiftTests/DefaultParameters.swift | 24 +-- .../ExportSwiftTests/SwiftStruct.swift | 60 +------- .../ExportSwiftTests/UnsafePointer.swift | 12 +- .../Generated/BridgeJS.swift | 144 ++---------------- 6 files changed, 26 insertions(+), 279 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 0bbc68bb2..84b466331 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -269,7 +269,7 @@ extension SimpleStruct: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _SimpleStructHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_SimpleStruct(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -279,16 +279,6 @@ extension SimpleStruct: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _SimpleStructHelpers.raise() - } -} - -fileprivate enum _SimpleStructHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_SimpleStruct(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_SimpleStruct())) } } @@ -332,7 +322,7 @@ extension Address: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _AddressHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -342,16 +332,6 @@ extension Address: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _AddressHelpers.raise() - } -} - -fileprivate enum _AddressHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Address())) } } @@ -401,7 +381,7 @@ extension Person: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _PersonHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_Person(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -411,16 +391,6 @@ extension Person: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _PersonHelpers.raise() - } -} - -fileprivate enum _PersonHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_Person(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Person())) } } @@ -473,7 +443,7 @@ extension ComplexStruct: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _ComplexStructHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_ComplexStruct(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -483,16 +453,6 @@ extension ComplexStruct: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _ComplexStructHelpers.raise() - } -} - -fileprivate enum _ComplexStructHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_ComplexStruct(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ComplexStruct())) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 81042b2e7..11951e7d9 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1157,7 +1157,6 @@ struct StructCodegen { let lowerCode = generateStructLowerCode(structDef: structDef) let accessControl = structDef.explicitAccessControl.map { "\($0) " } ?? "" - let helpersTypeName = "_\(structDef.name)Helpers" let lowerExternName = "swift_js_struct_lower_\(structDef.name)" let raiseExternName = "swift_js_struct_raise_\(structDef.name)" let lowerFunctionName = "_bjs_struct_lower_\(structDef.name)" @@ -1174,7 +1173,7 @@ struct StructCodegen { } \(raw: accessControl)init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = \(raw: helpersTypeName).lower(jsObject) + let __bjs_cleanupId = \(raw: lowerFunctionName)(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } self = Self.bridgeJSLiftParameter() } @@ -1182,18 +1181,6 @@ struct StructCodegen { \(raw: accessControl)func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return \(raw: helpersTypeName).raise() - } - } - """ - - let helpersType: DeclSyntax = """ - fileprivate enum \(raw: helpersTypeName) { - static func lower(_ jsObject: JSObject) -> Int32 { - return \(raw: lowerFunctionName)(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: \(raw: raiseFunctionName)())) } } @@ -1216,7 +1203,7 @@ struct StructCodegen { ) ) - return [bridgedStructExtension, helpersType, lowerExternDecl, raiseExternDecl] + return [bridgedStructExtension, lowerExternDecl, raiseExternDecl] } private static func renderStructExtern( diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index cd305f407..7db06add2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -55,7 +55,7 @@ extension Config: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _ConfigHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_Config(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -65,16 +65,6 @@ extension Config: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _ConfigHelpers.raise() - } -} - -fileprivate enum _ConfigHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_Config(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Config())) } } @@ -108,7 +98,7 @@ extension MathOperations: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _MathOperationsHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_MathOperations(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -118,16 +108,6 @@ extension MathOperations: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _MathOperationsHelpers.raise() - } -} - -fileprivate enum _MathOperationsHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_MathOperations(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_MathOperations())) } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift index fa094a1b8..001f3e4c8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift @@ -28,7 +28,7 @@ extension DataPoint: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _DataPointHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_DataPoint(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -38,16 +38,6 @@ extension DataPoint: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _DataPointHelpers.raise() - } -} - -fileprivate enum _DataPointHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_DataPoint(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_DataPoint())) } } @@ -106,7 +96,7 @@ extension Address: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _AddressHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -116,16 +106,6 @@ extension Address: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _AddressHelpers.raise() - } -} - -fileprivate enum _AddressHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Address())) } } @@ -175,7 +155,7 @@ extension Person: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _PersonHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_Person(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -185,16 +165,6 @@ extension Person: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _PersonHelpers.raise() - } -} - -fileprivate enum _PersonHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_Person(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Person())) } } @@ -230,7 +200,7 @@ extension Session: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _SessionHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_Session(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -240,16 +210,6 @@ extension Session: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _SessionHelpers.raise() - } -} - -fileprivate enum _SessionHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_Session(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Session())) } } @@ -282,7 +242,7 @@ extension ConfigStruct: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _ConfigStructHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_ConfigStruct(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -292,16 +252,6 @@ extension ConfigStruct: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _ConfigStructHelpers.raise() - } -} - -fileprivate enum _ConfigStructHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_ConfigStruct(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ConfigStruct())) } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift index 3954f3feb..5362e862a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift @@ -17,7 +17,7 @@ extension PointerFields: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _PointerFieldsHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -27,16 +27,6 @@ extension PointerFields: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _PointerFieldsHelpers.raise() - } -} - -fileprivate enum _PointerFieldsHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_PointerFields())) } } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index b47bf062b..f46a6d40e 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2231,7 +2231,7 @@ extension PointerFields: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _PointerFieldsHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -2241,16 +2241,6 @@ extension PointerFields: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _PointerFieldsHelpers.raise() - } -} - -fileprivate enum _PointerFieldsHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_PointerFields())) } } @@ -2314,7 +2304,7 @@ extension DataPoint: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _DataPointHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_DataPoint(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -2324,16 +2314,6 @@ extension DataPoint: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _DataPointHelpers.raise() - } -} - -fileprivate enum _DataPointHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_DataPoint(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_DataPoint())) } } @@ -2392,7 +2372,7 @@ extension Address: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _AddressHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -2402,16 +2382,6 @@ extension Address: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _AddressHelpers.raise() - } -} - -fileprivate enum _AddressHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Address())) } } @@ -2467,7 +2437,7 @@ extension Contact: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _ContactHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_Contact(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -2477,16 +2447,6 @@ extension Contact: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _ContactHelpers.raise() - } -} - -fileprivate enum _ContactHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_Contact(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Contact())) } } @@ -2540,7 +2500,7 @@ extension Config: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _ConfigHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_Config(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -2550,16 +2510,6 @@ extension Config: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _ConfigHelpers.raise() - } -} - -fileprivate enum _ConfigHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_Config(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Config())) } } @@ -2599,7 +2549,7 @@ extension SessionData: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _SessionDataHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_SessionData(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -2609,16 +2559,6 @@ extension SessionData: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _SessionDataHelpers.raise() - } -} - -fileprivate enum _SessionDataHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_SessionData(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_SessionData())) } } @@ -2666,7 +2606,7 @@ extension ValidationReport: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _ValidationReportHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_ValidationReport(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -2676,16 +2616,6 @@ extension ValidationReport: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _ValidationReportHelpers.raise() - } -} - -fileprivate enum _ValidationReportHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_ValidationReport(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ValidationReport())) } } @@ -2719,7 +2649,7 @@ extension MathOperations: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _MathOperationsHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_MathOperations(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -2729,16 +2659,6 @@ extension MathOperations: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _MathOperationsHelpers.raise() - } -} - -fileprivate enum _MathOperationsHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_MathOperations(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_MathOperations())) } } @@ -2825,7 +2745,7 @@ extension CopyableCart: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _CopyableCartHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_CopyableCart(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -2835,16 +2755,6 @@ extension CopyableCart: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _CopyableCartHelpers.raise() - } -} - -fileprivate enum _CopyableCartHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_CopyableCart(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_CopyableCart())) } } @@ -2894,7 +2804,7 @@ extension CopyableCartItem: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _CopyableCartItemHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_CopyableCartItem(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -2904,16 +2814,6 @@ extension CopyableCartItem: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _CopyableCartItemHelpers.raise() - } -} - -fileprivate enum _CopyableCartItemHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_CopyableCartItem(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_CopyableCartItem())) } } @@ -2955,7 +2855,7 @@ extension CopyableNestedCart: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _CopyableNestedCartHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_CopyableNestedCart(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -2965,16 +2865,6 @@ extension CopyableNestedCart: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _CopyableNestedCartHelpers.raise() - } -} - -fileprivate enum _CopyableNestedCartHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_CopyableNestedCart(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_CopyableNestedCart())) } } @@ -3024,7 +2914,7 @@ extension ConfigStruct: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _ConfigStructHelpers.lower(jsObject) + let __bjs_cleanupId = _bjs_struct_lower_ConfigStruct(jsObject.bridgeJSLowerParameter()) defer { _swift_js_struct_cleanup(__bjs_cleanupId) } @@ -3034,16 +2924,6 @@ extension ConfigStruct: _BridgedSwiftStruct { func toJSObject() -> JSObject { var __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return _ConfigStructHelpers.raise() - } -} - -fileprivate enum _ConfigStructHelpers { - static func lower(_ jsObject: JSObject) -> Int32 { - return _bjs_struct_lower_ConfigStruct(jsObject.bridgeJSLowerParameter()) - } - - static func raise() -> JSObject { return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ConfigStruct())) } } From d3c6d532de15ad852d7f7fc4341d62ed415e3baa Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 27 Jan 2026 18:42:05 +0700 Subject: [PATCH 106/252] BridgeJS: Remove warnings from toJSObject() --- Benchmarks/Sources/Generated/BridgeJS.swift | 8 +++---- .../Sources/BridgeJSCore/ExportSwift.swift | 2 +- .../ExportSwiftTests/DefaultParameters.swift | 4 ++-- .../ExportSwiftTests/SwiftStruct.swift | 10 ++++---- .../ExportSwiftTests/UnsafePointer.swift | 2 +- .../Generated/BridgeJS.swift | 24 +++++++++---------- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 84b466331..90558ff7b 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -277,7 +277,7 @@ extension SimpleStruct: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_SimpleStruct())) } @@ -330,7 +330,7 @@ extension Address: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Address())) } @@ -389,7 +389,7 @@ extension Person: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Person())) } @@ -451,7 +451,7 @@ extension ComplexStruct: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ComplexStruct())) } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 11951e7d9..2b301e822 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1179,7 +1179,7 @@ struct StructCodegen { } \(raw: accessControl)func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: \(raw: raiseFunctionName)())) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index 7db06add2..d80d78d85 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -63,7 +63,7 @@ extension Config: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Config())) } @@ -106,7 +106,7 @@ extension MathOperations: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_MathOperations())) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift index 001f3e4c8..1b753e47d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift @@ -36,7 +36,7 @@ extension DataPoint: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_DataPoint())) } @@ -104,7 +104,7 @@ extension Address: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Address())) } @@ -163,7 +163,7 @@ extension Person: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Person())) } @@ -208,7 +208,7 @@ extension Session: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Session())) } @@ -250,7 +250,7 @@ extension ConfigStruct: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ConfigStruct())) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift index 5362e862a..3e9fad511 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift @@ -25,7 +25,7 @@ extension PointerFields: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_PointerFields())) } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index f46a6d40e..e3b139c4a 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2239,7 +2239,7 @@ extension PointerFields: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_PointerFields())) } @@ -2312,7 +2312,7 @@ extension DataPoint: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_DataPoint())) } @@ -2380,7 +2380,7 @@ extension Address: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Address())) } @@ -2445,7 +2445,7 @@ extension Contact: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Contact())) } @@ -2508,7 +2508,7 @@ extension Config: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Config())) } @@ -2557,7 +2557,7 @@ extension SessionData: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_SessionData())) } @@ -2614,7 +2614,7 @@ extension ValidationReport: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ValidationReport())) } @@ -2657,7 +2657,7 @@ extension MathOperations: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_MathOperations())) } @@ -2753,7 +2753,7 @@ extension CopyableCart: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_CopyableCart())) } @@ -2812,7 +2812,7 @@ extension CopyableCartItem: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_CopyableCartItem())) } @@ -2863,7 +2863,7 @@ extension CopyableNestedCart: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_CopyableNestedCart())) } @@ -2922,7 +2922,7 @@ extension ConfigStruct: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ConfigStruct())) } From 61659cbc779d1298afee4414757e7fcd87c0f0bb Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 28 Jan 2026 07:08:49 +0700 Subject: [PATCH 107/252] BridgeJS: Fix codegen for Float/Double raw value enums in struct fields and optional context (#533) --- .../Sources/BridgeJSCore/ExportSwift.swift | 34 +++- .../Sources/BridgeJSLink/JSGlueGen.swift | 60 +++++++ .../Inputs/SwiftStruct.swift | 11 ++ .../BridgeJSLinkTests/SwiftStruct.Export.d.ts | 14 ++ .../BridgeJSLinkTests/SwiftStruct.Export.js | 49 ++++++ .../ExportSwiftTests/SwiftStruct.json | 73 ++++++++ .../ExportSwiftTests/SwiftStruct.swift | 54 ++++++ .../BridgeJSRuntimeTests/ExportAPITests.swift | 23 +++ .../Generated/BridgeJS.swift | 74 ++++++++ .../Generated/JavaScript/BridgeJS.json | 158 ++++++++++++++++++ Tests/prelude.mjs | 23 +++ 11 files changed, 569 insertions(+), 4 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 2b301e822..67b6df55f 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -784,7 +784,11 @@ struct StackCodegen { case .string: return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .bool, .int, .int32, .int64, .uint, .uint32, .uint64, .float, .double: + case .float: + return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_f32())" + case .double: + return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_f64())" + case .bool, .int, .int32, .int64, .uint, .uint32, .uint64: return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" } case .associatedValueEnum(let enumName): @@ -825,7 +829,13 @@ struct StackCodegen { case .string: return "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .bool, .int, .float, .double, .int32, .int64, .uint, .uint32, .uint64: + case .float: + return + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f32())" + case .double: + return + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f64())" + case .bool, .int, .int32, .int64, .uint, .uint32, .uint64: return "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" } @@ -880,8 +890,20 @@ struct StackCodegen { return ["_swift_js_push_int(\(raw: accessor).bridgeJSLowerParameter())"] case .caseEnum: return ["_swift_js_push_int(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] - case .rawValueEnum: - return ["_swift_js_push_int(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + return [ + "var __bjs_\(raw: varPrefix) = \(raw: accessor).rawValue", + "__bjs_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", + ] + case .float: + return ["_swift_js_push_f32(\(raw: accessor).bridgeJSLowerParameter())"] + case .double: + return ["_swift_js_push_f64(\(raw: accessor).bridgeJSLowerParameter())"] + default: + return ["_swift_js_push_int(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] + } case .associatedValueEnum: return ["\(raw: accessor).bridgeJSLowerReturn()"] case .swiftStruct: @@ -948,6 +970,10 @@ struct StackCodegen { "var __bjs_str_\(raw: varPrefix) = \(raw: unwrappedVar).rawValue", "__bjs_str_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", ] + case .float: + return ["_swift_js_push_f32(\(raw: unwrappedVar).bridgeJSLowerParameter())"] + case .double: + return ["_swift_js_push_f64(\(raw: unwrappedVar).bridgeJSLowerParameter())"] default: return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 6b45f6778..ef5c5eb2e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -2357,6 +2357,32 @@ struct IntrinsicJSFragment: Sendable { "if(\(idVar) !== undefined) { \(JSGlueVariableScope.reservedSwift).memory.release(\(idVar)); }" ) return [idVar] + case .float: + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write( + "\(JSGlueVariableScope.reservedTmpParamF32s).push(Math.fround(\(value)));" + ) + } + printer.write("} else {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(0.0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + return [] + case .double: + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(value));") + } + printer.write("} else {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(0.0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + return [] default: printer.write("if (\(isSomeVar)) {") printer.indent { @@ -2596,6 +2622,22 @@ struct IntrinsicJSFragment: Sendable { return [idVar] } ) + case .float: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(Math.fround(\(arguments[0])));") + return [] + } + ) + case .double: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(arguments[0]));") + return [] + } + ) default: return IntrinsicJSFragment( parameters: ["value"], @@ -2795,6 +2837,24 @@ struct IntrinsicJSFragment: Sendable { return [varName] } ) + case .float: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let varName = scope.variable("value") + printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetF32s).pop();") + return [varName] + } + ) + case .double: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let varName = scope.variable("value") + printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetF64s).pop();") + return [varName] + } + ) default: return IntrinsicJSFragment( parameters: [], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftStruct.swift index 3415f54a9..ac316a05a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftStruct.swift @@ -35,6 +35,17 @@ @JS func roundtrip(_ session: Person) -> Person +@JS enum Precision: Float { + case rough = 0.1 + case fine = 0.001 +} + +@JS struct Measurement { + var value: Double + var precision: Precision + var optionalPrecision: Precision? +} + @JS struct ConfigStruct { @JS static let maxRetries: Int = 3 @JS nonisolated(unsafe) static var defaultConfig: String = "production" diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.d.ts index 1d1474510..7769ebcbe 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.d.ts @@ -4,6 +4,12 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. +export const PrecisionValues: { + readonly Rough: 0.1; + readonly Fine: 0.001; +}; +export type PrecisionTag = typeof PrecisionValues[keyof typeof PrecisionValues]; + export interface DataPoint { x: number; y: number; @@ -26,8 +32,15 @@ export interface Session { id: number; owner: Greeter; } +export interface Measurement { + value: number; + precision: PrecisionTag; + optionalPrecision: PrecisionTag | null; +} export interface ConfigStruct { } +export type PrecisionObject = typeof PrecisionValues; + /// Represents a Swift heap object like a class instance or an actor instance. export interface SwiftHeapObject { /// Release the heap object. @@ -44,6 +57,7 @@ export type Exports = { new(name: string): Greeter; } roundtrip(session: Person): Person; + Precision: PrecisionObject DataPoint: { init(x: number, y: number, label: string, optCount: number | null, optFlag: boolean | null): DataPoint; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js index abcd9500d..91968b77a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js @@ -4,6 +4,11 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. +export const PrecisionValues = { + Rough: 0.1, + Fine: 0.001, +}; + export async function createInstantiator(options, swift) { let instance; let memory; @@ -184,6 +189,35 @@ export async function createInstantiator(options, swift) { } }); }; + const __bjs_createMeasurementHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + tmpParamF64s.push(value.value); + tmpParamF32s.push(Math.fround(value.precision)); + const isSome = value.optionalPrecision != null; + if (isSome) { + tmpParamF32s.push(Math.fround(value.optionalPrecision)); + } else { + tmpParamF32s.push(0.0); + } + tmpParamInts.push(isSome ? 1 : 0); + return { cleanup: undefined }; + }, + raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const value = tmpRetF32s.pop(); + optional = value; + } else { + optional = null; + } + const value1 = tmpRetF32s.pop(); + const f64 = tmpRetF64s.pop(); + return { value: f64, precision: value1, optionalPrecision: optional }; + } + }); + }; const __bjs_createConfigStructHelpers = () => { return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ lower: (value) => { @@ -315,6 +349,17 @@ export async function createInstantiator(options, swift) { const value = structHelpers.Session.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return swift.memory.retain(value); } + bjs["swift_js_struct_lower_Measurement"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.Measurement.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_raise_Measurement"] = function() { + const value = structHelpers.Measurement.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } bjs["swift_js_struct_lower_ConfigStruct"] = function(objectId) { const { cleanup: cleanup } = structHelpers.ConfigStruct.lower(swift.memory.getObject(objectId)); if (cleanup) { @@ -498,6 +543,9 @@ export async function createInstantiator(options, swift) { 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; @@ -510,6 +558,7 @@ export async function createInstantiator(options, swift) { if (cleanup) { cleanup(); } return structValue; }, + Precision: PrecisionValues, DataPoint: { init: function(x, y, label, optCount, optFlag) { const labelBytes = textEncoder.encode(label); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json index c6e430edf..ca8f7c625 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json @@ -56,7 +56,35 @@ } ], "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "rough", + "rawValue" : "0.1" + }, + { + "associatedValues" : [ + + ], + "name" : "fine", + "rawValue" : "0.001" + } + ], + "emitStyle" : "const", + "name" : "Precision", + "rawType" : "Float", + "staticMethods" : [ + + ], + "staticProperties" : [ + ], + "swiftCallName" : "Precision", + "tsFullPath" : "Precision" + } ], "exposeToGlobal" : false, "functions" : [ @@ -345,6 +373,51 @@ ], "swiftCallName" : "Session" }, + { + "methods" : [ + + ], + "name" : "Measurement", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "value", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "precision", + "type" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optionalPrecision", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + } + } + } + } + ], + "swiftCallName" : "Measurement" + }, { "methods" : [ { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift index 1b753e47d..ea3ae2469 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift @@ -1,3 +1,6 @@ +extension Precision: _BridgedSwiftEnumNoPayload { +} + extension DataPoint: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> DataPoint { let optFlag = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) @@ -232,6 +235,57 @@ fileprivate func _bjs_struct_raise_Session() -> Int32 { } #endif +extension Measurement: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Measurement { + let optionalPrecision = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f32()) + let precision = Precision.bridgeJSLiftParameter(_swift_js_pop_param_f32()) + let value = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + return Measurement(value: value, precision: precision, optionalPrecision: optionalPrecision) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_f64(self.value) + _swift_js_push_f32(self.precision.bridgeJSLowerParameter()) + let __bjs_isSome_optionalPrecision = self.optionalPrecision != nil + if let __bjs_unwrapped_optionalPrecision = self.optionalPrecision { + _swift_js_push_f32(__bjs_unwrapped_optionalPrecision.bridgeJSLowerParameter()) + } + _swift_js_push_int(__bjs_isSome_optionalPrecision ? 1 : 0) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_Measurement(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Measurement())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Measurement") +fileprivate func _bjs_struct_lower_Measurement(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Measurement(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Measurement") +fileprivate func _bjs_struct_raise_Measurement() -> Int32 +#else +fileprivate func _bjs_struct_raise_Measurement() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + extension ConfigStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ConfigStruct { return ConfigStruct() diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index fe4a44de2..411b01024 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -226,6 +226,18 @@ struct TestError: Error { case unknown = -1 } +@JS enum Precision: Float { + case rough = 0.1 + case normal = 0.01 + case fine = 0.001 +} + +@JS enum Ratio: Double { + case quarter = 0.25 + case half = 0.5 + case golden = 1.618 +} + @JS(enumStyle: .tsEnum) enum TSDirection { case north case south @@ -1390,6 +1402,17 @@ enum APIOptionalResult { cart.toJSObject() } +@JS struct MeasurementConfig { + var precision: Precision + var ratio: Ratio + var optionalPrecision: Precision? + var optionalRatio: Ratio? +} + +@JS func roundTripMeasurementConfig(_ config: MeasurementConfig) -> MeasurementConfig { + return config +} + @JS struct ConfigStruct { var name: String var value: Int diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index e3b139c4a..96e50d192 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -1298,6 +1298,12 @@ extension Theme: _BridgedSwiftEnumNoPayload { extension HttpStatus: _BridgedSwiftEnumNoPayload { } +extension Precision: _BridgedSwiftEnumNoPayload { +} + +extension Ratio: _BridgedSwiftEnumNoPayload { +} + extension TSDirection: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { return bridgeJSRawValue @@ -2898,6 +2904,63 @@ public func _bjs_CopyableNestedCart_static_fromJSObject(_ object: Int32) -> Void #endif } +extension MeasurementConfig: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MeasurementConfig { + let optionalRatio = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f64()) + let optionalPrecision = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f32()) + let ratio = Ratio.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let precision = Precision.bridgeJSLiftParameter(_swift_js_pop_param_f32()) + return MeasurementConfig(precision: precision, ratio: ratio, optionalPrecision: optionalPrecision, optionalRatio: optionalRatio) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_f32(self.precision.bridgeJSLowerParameter()) + _swift_js_push_f64(self.ratio.bridgeJSLowerParameter()) + let __bjs_isSome_optionalPrecision = self.optionalPrecision != nil + if let __bjs_unwrapped_optionalPrecision = self.optionalPrecision { + _swift_js_push_f32(__bjs_unwrapped_optionalPrecision.bridgeJSLowerParameter()) + } + _swift_js_push_int(__bjs_isSome_optionalPrecision ? 1 : 0) + let __bjs_isSome_optionalRatio = self.optionalRatio != nil + if let __bjs_unwrapped_optionalRatio = self.optionalRatio { + _swift_js_push_f64(__bjs_unwrapped_optionalRatio.bridgeJSLowerParameter()) + } + _swift_js_push_int(__bjs_isSome_optionalRatio ? 1 : 0) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_MeasurementConfig(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + var __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_MeasurementConfig())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MeasurementConfig") +fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_MeasurementConfig") +fileprivate func _bjs_struct_raise_MeasurementConfig() -> Int32 +#else +fileprivate func _bjs_struct_raise_MeasurementConfig() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + extension ConfigStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ConfigStruct { let value = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) @@ -4437,6 +4500,17 @@ public func _bjs_nestedCartToJSObject() -> Int32 { #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_roundTripDataPoint") @_cdecl("bjs_roundTripDataPoint") public func _bjs_roundTripDataPoint() -> Void { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 82c394a93..180dc6c1a 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -3341,6 +3341,78 @@ { "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" }, @@ -7966,6 +8038,31 @@ } } }, + { + "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_roundTripDataPoint", "effects" : { @@ -9383,6 +9480,67 @@ { "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" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optionalRatio", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Ratio", + "_1" : "Double" + } + } + } + } + } + ], + "swiftCallName" : "MeasurementConfig" + }, + { + "methods" : [ + ], "name" : "ConfigStruct", "properties" : [ diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index d95605078..65bb7d607 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -458,6 +458,13 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(HttpStatusValues.ServerError, 500); assert.equal(HttpStatusValues.Unknown, -1); + assert.equal(exports.Precision.Rough, 0.1); + assert.equal(exports.Precision.Normal, 0.01); + assert.equal(exports.Precision.Fine, 0.001); + assert.equal(exports.Ratio.Quarter, 0.25); + assert.equal(exports.Ratio.Half, 0.5); + assert.equal(exports.Ratio.Golden, 1.618); + assert.equal(exports.setTheme(exports.Theme.Light), exports.Theme.Light); assert.equal(exports.setTheme(exports.Theme.Dark), exports.Theme.Dark); assert.equal(exports.getTheme(), ThemeValues.Light); @@ -1089,6 +1096,22 @@ function testStructSupport(exports) { exports.ConfigStruct.defaultConfig = "staging"; assert.equal(exports.ConfigStruct.computedSetting, "Config: staging"); exports.ConfigStruct.defaultConfig = "production"; + + const { Precision, Ratio } = exports; + const mc1 = { + precision: Math.fround(Precision.Rough), + ratio: Ratio.Golden, + optionalPrecision: Math.fround(Precision.Fine), + optionalRatio: Ratio.Half + }; + assert.deepEqual(exports.roundTripMeasurementConfig(mc1), mc1); + const mc2 = { + precision: Math.fround(Precision.Normal), + ratio: Ratio.Quarter, + optionalPrecision: null, + optionalRatio: null + }; + assert.deepEqual(exports.roundTripMeasurementConfig(mc2), mc2); } /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ From 5931e7c2109657dce02ebe9d60f8285da75be875 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 27 Jan 2026 15:29:36 +0900 Subject: [PATCH 108/252] BridgeJS: Support `@JS` Swift struct types in imported JS signatures They are cloned via stack ABI --- .../Sources/BridgeJSCore/ExportSwift.swift | 4 +- .../Sources/BridgeJSCore/ImportTS.swift | 6 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 23 +- .../SwiftStructImports.swift | 7 + .../SwiftStructImports.ImportMacros.d.ts | 22 + .../SwiftStructImports.ImportMacros.js | 262 ++++++++++ .../ExportSwiftTests/SwiftStruct.swift | 2 +- .../SwiftStructImports.ImportMacros.swift | 19 + .../JavaScriptKit/BridgeJSIntrinsics.swift | 16 + .../BridgeJSRuntimeTests/ExportAPITests.swift | 200 -------- .../Generated/BridgeJS.swift | 317 +++++++++--- .../Generated/JavaScript/BridgeJS.json | 459 +++++++++++++----- .../ImportStructAPIs.swift | 9 + Tests/BridgeJSRuntimeTests/StructAPIs.swift | 216 +++++++++ .../SwiftStructTests.swift | 19 + Tests/prelude.mjs | 45 +- 16 files changed, 1222 insertions(+), 404 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftStructImports.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftStructImports.ImportMacros.swift create mode 100644 Tests/BridgeJSRuntimeTests/ImportStructAPIs.swift create mode 100644 Tests/BridgeJSRuntimeTests/StructAPIs.swift create mode 100644 Tests/BridgeJSRuntimeTests/SwiftStructTests.swift diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 67b6df55f..370b5fa2d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -881,7 +881,7 @@ struct StackCodegen { case .double: return ["_swift_js_push_f64(\(raw: accessor))"] case .jsObject: - return ["_swift_js_push_int(\(raw: accessor).bridgeJSLowerParameter())"] + return ["_swift_js_push_int(\(raw: accessor).bridgeJSLowerReturn())"] case .swiftHeapObject: return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] case .unsafePointer: @@ -984,7 +984,7 @@ struct StackCodegen { case .associatedValueEnum: return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] case .jsObject: - return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] + return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerReturn())"] default: return ["preconditionFailure(\"BridgeJS: unsupported optional wrapped type\")"] } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index ad5cdaf06..176b46b66 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -916,7 +916,8 @@ extension BridgeType { case .swiftStruct: switch context { case .importTS: - throw BridgeJSCoreError("Swift structs are not yet supported in TypeScript imports") + // Swift structs are bridged as JS objects (object IDs) in imported signatures. + return LoweringParameterInfo(loweredParameters: [("objectId", .i32)]) case .exportSwift: return LoweringParameterInfo(loweredParameters: []) } @@ -1002,7 +1003,8 @@ extension BridgeType { case .swiftStruct: switch context { case .importTS: - throw BridgeJSCoreError("Swift structs are not yet supported in TypeScript imports") + // Swift structs are bridged as JS objects (object IDs) in imported signatures. + return LiftingReturnInfo(valueToLift: .i32) case .exportSwift: return LiftingReturnInfo(valueToLift: nil) } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index ef5c5eb2e..05b279c4f 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -204,6 +204,18 @@ struct IntrinsicJSFragment: Sendable { return [resultLabel] } ) + static let jsObjectLiftRetainedObjectId = IntrinsicJSFragment( + parameters: ["objectId"], + printCode: { arguments, scope, printer, cleanupCode in + let resultLabel = scope.variable("value") + let objectId = arguments[0] + printer.write( + "const \(resultLabel) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(objectId));" + ) + printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(objectId));") + return [resultLabel] + } + ) static let jsObjectLiftParameter = IntrinsicJSFragment( parameters: ["objectId"], printCode: { arguments, scope, printer, cleanupCode in @@ -1446,10 +1458,7 @@ struct IntrinsicJSFragment: Sendable { case .swiftStruct(let fullName): switch context { case .importTS: - throw BridgeJSLinkError( - message: - "Swift structs are not supported to be passed as parameters to imported JS functions: \(fullName)" - ) + return .jsObjectLiftRetainedObjectId case .exportSwift: let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( @@ -1527,10 +1536,8 @@ struct IntrinsicJSFragment: Sendable { case .swiftStruct(let fullName): switch context { case .importTS: - throw BridgeJSLinkError( - message: - "Swift structs are not supported to be returned from imported JS functions: \(fullName)" - ) + // ImportTS expects Swift structs to come back as a retained JS object ID. + return .jsObjectLowerReturn case .exportSwift: return swiftStructLowerReturn(fullName: fullName) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftStructImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftStructImports.swift new file mode 100644 index 000000000..b00fd768a --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftStructImports.swift @@ -0,0 +1,7 @@ +@JS +struct Point { + var x: Int + var y: Int +} + +@JSFunction func translate(_ point: Point, dx: Int, dy: Int) throws(JSException) -> Point diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.d.ts new file mode 100644 index 000000000..3677f1e44 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.d.ts @@ -0,0 +1,22 @@ +// 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 interface Point { + x: number; + y: number; +} +export type Exports = { +} +export type Imports = { + translate(point: Point, dx: number, dy: number): Point; +} +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/SwiftStructImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js new file mode 100644 index 000000000..67a9b98e3 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js @@ -0,0 +1,262 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + let tmpStructCleanups = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + const __bjs_createPointHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + tmpParamInts.push((value.x | 0)); + tmpParamInts.push((value.y | 0)); + return { cleanup: undefined }; + }, + raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + const int = tmpRetInts.pop(); + const int1 = tmpRetInts.pop(); + return { x: int1, y: int }; + } + }); + }; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } + bjs["swift_js_struct_lower_Point"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.Point.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_raise_Point"] = function() { + const value = structHelpers.Point.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } + 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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_translate"] = function bjs_translate(point, dx, dy) { + try { + const value = swift.memory.getObject(point); + swift.memory.release(point); + let ret = imports.translate(value, dx, dy); + return swift.memory.retain(ret); + } catch (error) { + setException(error); + } + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + const PointHelpers = __bjs_createPointHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + structHelpers.Point = PointHelpers; + + const exports = { + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift index ea3ae2469..12623a344 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift @@ -262,7 +262,7 @@ extension Measurement: _BridgedSwiftStruct { } func toJSObject() -> JSObject { - var __bjs_self = self + let __bjs_self = self __bjs_self.bridgeJSLowerReturn() return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Measurement())) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftStructImports.ImportMacros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftStructImports.ImportMacros.swift new file mode 100644 index 000000000..54470e5de --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftStructImports.ImportMacros.swift @@ -0,0 +1,19 @@ +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_translate") +fileprivate func bjs_translate(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 +#else +fileprivate func bjs_translate(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$translate(_ point: Point, _ dx: Int, _ dy: Int) throws(JSException) -> Point { + let pointObjectId = point.bridgeJSLowerParameter() + let dxValue = dx.bridgeJSLowerParameter() + let dyValue = dy.bridgeJSLowerParameter() + let ret = bjs_translate(pointObjectId, dxValue, dyValue) + if let error = _swift_js_take_exception() { + throw error + } + return Point.bridgeJSLiftReturn(ret) +} \ No newline at end of file diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index fa7c9e4a6..52e05a4f6 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -322,6 +322,22 @@ public protocol _BridgedSwiftStruct: _BridgedSwiftTypeLoweredIntoVoidType { // MARK: ExportSwift @_spi(BridgeJS) static func bridgeJSLiftParameter() -> Self @_spi(BridgeJS) consuming func bridgeJSLowerReturn() -> Void + + /// Initializes a Swift struct by copying the fields from a bridged JS object. + init(unsafelyCopying jsObject: JSObject) + /// Converts the struct into a bridged JS object by copying its fields. + func toJSObject() -> JSObject +} + +extension _BridgedSwiftStruct { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + return toJSObject().bridgeJSLowerReturn() + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ objectId: Int32) -> Self { + let jsObject = JSObject.bridgeJSLiftReturn(objectId) + return Self(unsafelyCopying: jsObject) + } } extension _BridgedSwiftEnumNoPayload where Self: RawRepresentable, RawValue == String { diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 411b01024..27584d24d 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -49,30 +49,6 @@ func runJsWorks() -> Void return v } -@JS struct PointerFields { - var raw: UnsafeRawPointer - var mutRaw: UnsafeMutableRawPointer - var opaque: OpaquePointer - var ptr: UnsafePointer - var mutPtr: UnsafeMutablePointer - - @JS init( - raw: UnsafeRawPointer, - mutRaw: UnsafeMutableRawPointer, - opaque: OpaquePointer, - ptr: UnsafePointer, - mutPtr: UnsafeMutablePointer - ) { - self.raw = raw - self.mutRaw = mutRaw - self.opaque = opaque - self.ptr = ptr - self.mutPtr = mutPtr - } -} - -@JS func roundTripPointerFields(_ value: PointerFields) -> PointerFields { value } - @JSClass struct Foo { @JSGetter var value: String @JSFunction init(_ value: String) throws(JSException) @@ -1293,182 +1269,6 @@ enum APIOptionalResult { } } -// MARK: - Struct Tests - -@JS struct DataPoint { - let x: Double - let y: Double - var label: String - var optCount: Int? - var optFlag: Bool? - - @JS init(x: Double, y: Double, label: String, optCount: Int?, optFlag: Bool?) { - self.x = x - self.y = y - self.label = label - self.optCount = optCount - self.optFlag = optFlag - } -} - -@JS struct Address { - var street: String - var city: String - var zipCode: Int? -} - -@JS struct Contact { - var name: String - var age: Int - var address: Address - var email: String? - var secondaryAddress: Address? -} - -@JS struct Config { - var name: String - var theme: Theme? - var direction: Direction? - var status: Status -} - -@JS struct SessionData { - var id: Int - var owner: Greeter? -} - -@JS struct ValidationReport { - var id: Int - var result: APIResult - var status: Status? - var outcome: APIResult? -} - -@JS struct MathOperations { - var baseValue: Double - - @JS init(baseValue: Double = 0.0) { - self.baseValue = baseValue - } - - @JS func add(a: Double, b: Double = 10.0) -> Double { - return baseValue + a + b - } - - @JS func multiply(a: Double, b: Double) -> Double { - return a * b - } - - @JS static func subtract(a: Double, b: Double) -> Double { - return a - b - } -} - -@JS func testStructDefault( - point: DataPoint = DataPoint(x: 1.0, y: 2.0, label: "default", optCount: nil, optFlag: nil) -) -> String { - return "\(point.x),\(point.y),\(point.label)" -} - -@JS struct CopyableCart { - var x: Int - var note: String? - - @JS static func fromJSObject(_ object: JSObject) -> CopyableCart { - CopyableCart(unsafelyCopying: object) - } -} - -@JS func cartToJSObject(_ cart: CopyableCart) -> JSObject { - cart.toJSObject() -} - -@JS struct CopyableCartItem { - var sku: String - var quantity: Int -} - -@JS struct CopyableNestedCart { - var id: Int - var item: CopyableCartItem - var shippingAddress: Address? - - @JS static func fromJSObject(_ object: JSObject) -> CopyableNestedCart { - CopyableNestedCart(unsafelyCopying: object) - } -} - -@JS func nestedCartToJSObject(_ cart: CopyableNestedCart) -> JSObject { - cart.toJSObject() -} - -@JS struct MeasurementConfig { - var precision: Precision - var ratio: Ratio - var optionalPrecision: Precision? - var optionalRatio: Ratio? -} - -@JS func roundTripMeasurementConfig(_ config: MeasurementConfig) -> MeasurementConfig { - return config -} - -@JS struct ConfigStruct { - var name: String - var value: Int - - @JS nonisolated(unsafe) static var defaultConfig: String = "production" - @JS static let maxRetries: Int = 3 - @JS nonisolated(unsafe) static var timeout: Double = 30.0 - - @JS static var computedSetting: String { - return "Config: \(defaultConfig)" - } -} - -@JS func roundTripDataPoint(_ data: DataPoint) -> DataPoint { - return data -} - -@JS func roundTripContact(_ contact: Contact) -> Contact { - return contact -} - -@JS func roundTripConfig(_ config: Config) -> Config { - return config -} - -@JS func roundTripSessionData(_ session: SessionData) -> SessionData { - return session -} - -@JS func roundTripValidationReport(_ report: ValidationReport) -> ValidationReport { - return report -} - -@JS func updateValidationReport(_ newResult: APIResult?, _ report: ValidationReport) -> ValidationReport { - return ValidationReport( - id: report.id, - result: newResult ?? report.result, - status: report.status, - outcome: report.outcome - ) -} - -@JS class Container { - @JS var location: DataPoint - @JS var config: Config? - - @JS init(location: DataPoint, config: Config?) { - self.location = location - self.config = config - } -} - -@JS func testContainerWithStruct(_ point: DataPoint) -> Container { - return Container(location: point, config: nil) -} - class ExportAPITests: XCTestCase { func testAll() { var hasDeinitGreeter = false diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 96e50d192..b9f823d01 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2218,6 +2218,51 @@ public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_se #endif } +extension Point: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { + let y = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let x = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + return Point(x: x, y: y) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_int(Int32(self.x)) + _swift_js_push_int(Int32(self.y)) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Point())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Point") +fileprivate func _bjs_struct_raise_Point() -> Int32 +#else +fileprivate func _bjs_struct_raise_Point() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + extension PointerFields: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PointerFields { let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) @@ -2644,6 +2689,146 @@ fileprivate func _bjs_struct_raise_ValidationReport() -> Int32 { } #endif +extension AdvancedConfig: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> AdvancedConfig { + let overrideDefaults = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let defaults = ConfigStruct.bridgeJSLiftParameter() + let location = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let metadata = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let result = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let status = Status.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let theme = Theme.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let enabled = Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let title = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let id = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + 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 bridgeJSLowerReturn() { + _swift_js_push_int(Int32(self.id)) + var __bjs_title = self.title + __bjs_title.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(self.enabled ? 1 : 0) + var __bjs_theme = self.theme.rawValue + __bjs_theme.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + _swift_js_push_int(Int32(self.status.bridgeJSLowerParameter())) + let __bjs_isSome_result = self.result != nil + if let __bjs_unwrapped_result = self.result { + _swift_js_push_int(__bjs_unwrapped_result.bridgeJSLowerParameter()) + } + _swift_js_push_int(__bjs_isSome_result ? 1 : 0) + let __bjs_isSome_metadata = self.metadata != nil + if let __bjs_unwrapped_metadata = self.metadata { + _swift_js_push_int(__bjs_unwrapped_metadata.bridgeJSLowerReturn()) + } + _swift_js_push_int(__bjs_isSome_metadata ? 1 : 0) + let __bjs_isSome_location = self.location != nil + if let __bjs_unwrapped_location = self.location { + __bjs_unwrapped_location.bridgeJSLowerReturn() + } + _swift_js_push_int(__bjs_isSome_location ? 1 : 0) + self.defaults.bridgeJSLowerReturn() + let __bjs_isSome_overrideDefaults = self.overrideDefaults != nil + if let __bjs_unwrapped_overrideDefaults = self.overrideDefaults { + __bjs_unwrapped_overrideDefaults.bridgeJSLowerReturn() + } + _swift_js_push_int(__bjs_isSome_overrideDefaults ? 1 : 0) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_AdvancedConfig(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_AdvancedConfig())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_AdvancedConfig") +fileprivate func _bjs_struct_lower_AdvancedConfig(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_AdvancedConfig(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_AdvancedConfig") +fileprivate func _bjs_struct_raise_AdvancedConfig() -> Int32 +#else +fileprivate func _bjs_struct_raise_AdvancedConfig() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +extension MeasurementConfig: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MeasurementConfig { + let optionalRatio = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f64()) + let optionalPrecision = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f32()) + let ratio = Ratio.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let precision = Precision.bridgeJSLiftParameter(_swift_js_pop_param_f32()) + return MeasurementConfig(precision: precision, ratio: ratio, optionalPrecision: optionalPrecision, optionalRatio: optionalRatio) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_f32(self.precision.bridgeJSLowerParameter()) + _swift_js_push_f64(self.ratio.bridgeJSLowerParameter()) + let __bjs_isSome_optionalPrecision = self.optionalPrecision != nil + if let __bjs_unwrapped_optionalPrecision = self.optionalPrecision { + _swift_js_push_f32(__bjs_unwrapped_optionalPrecision.bridgeJSLowerParameter()) + } + _swift_js_push_int(__bjs_isSome_optionalPrecision ? 1 : 0) + let __bjs_isSome_optionalRatio = self.optionalRatio != nil + if let __bjs_unwrapped_optionalRatio = self.optionalRatio { + _swift_js_push_f64(__bjs_unwrapped_optionalRatio.bridgeJSLowerParameter()) + } + _swift_js_push_int(__bjs_isSome_optionalRatio ? 1 : 0) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_MeasurementConfig(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_MeasurementConfig())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MeasurementConfig") +fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_MeasurementConfig") +fileprivate func _bjs_struct_raise_MeasurementConfig() -> Int32 +#else +fileprivate func _bjs_struct_raise_MeasurementConfig() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + extension MathOperations: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MathOperations { let baseValue = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) @@ -2904,63 +3089,6 @@ public func _bjs_CopyableNestedCart_static_fromJSObject(_ object: Int32) -> Void #endif } -extension MeasurementConfig: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MeasurementConfig { - let optionalRatio = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f64()) - let optionalPrecision = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f32()) - let ratio = Ratio.bridgeJSLiftParameter(_swift_js_pop_param_f64()) - let precision = Precision.bridgeJSLiftParameter(_swift_js_pop_param_f32()) - return MeasurementConfig(precision: precision, ratio: ratio, optionalPrecision: optionalPrecision, optionalRatio: optionalRatio) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_f32(self.precision.bridgeJSLowerParameter()) - _swift_js_push_f64(self.ratio.bridgeJSLowerParameter()) - let __bjs_isSome_optionalPrecision = self.optionalPrecision != nil - if let __bjs_unwrapped_optionalPrecision = self.optionalPrecision { - _swift_js_push_f32(__bjs_unwrapped_optionalPrecision.bridgeJSLowerParameter()) - } - _swift_js_push_int(__bjs_isSome_optionalPrecision ? 1 : 0) - let __bjs_isSome_optionalRatio = self.optionalRatio != nil - if let __bjs_unwrapped_optionalRatio = self.optionalRatio { - _swift_js_push_f64(__bjs_unwrapped_optionalRatio.bridgeJSLowerParameter()) - } - _swift_js_push_int(__bjs_isSome_optionalRatio ? 1 : 0) - } - - init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_MeasurementConfig(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } - self = Self.bridgeJSLiftParameter() - } - - func toJSObject() -> JSObject { - var __bjs_self = self - __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_MeasurementConfig())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MeasurementConfig") -fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Int32 -#else -fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_MeasurementConfig") -fileprivate func _bjs_struct_raise_MeasurementConfig() -> Int32 -#else -fileprivate func _bjs_struct_raise_MeasurementConfig() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - extension ConfigStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ConfigStruct { let value = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) @@ -3215,17 +3343,6 @@ public func _bjs_roundTripJSObject(_ v: Int32) -> Int32 { #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_makeImportedFoo") @_cdecl("bjs_makeImportedFoo") public func _bjs_makeImportedFoo(_ valueBytes: Int32, _ valueLength: Int32) -> Int32 { @@ -4467,6 +4584,17 @@ public func _bjs_makeAdder(_ base: Int32) -> UnsafeMutableRawPointer { #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 { @@ -4500,17 +4628,6 @@ public func _bjs_nestedCartToJSObject() -> Int32 { #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_roundTripDataPoint") @_cdecl("bjs_roundTripDataPoint") public func _bjs_roundTripDataPoint() -> Void { @@ -4566,6 +4683,28 @@ public func _bjs_roundTripValidationReport() -> Void { #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 { @@ -7553,4 +7692,24 @@ func _$jsCallTwice(_ value: Int, _ callback: @escaping (Int) -> Void) throws(JSE throw error } return Int.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsTranslatePoint") +fileprivate func bjs_jsTranslatePoint(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 +#else +fileprivate func bjs_jsTranslatePoint(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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) } \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 180dc6c1a..1b70b0b04 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -4950,31 +4950,6 @@ } } }, - { - "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_makeImportedFoo", "effects" : { @@ -7916,6 +7891,31 @@ } } }, + { + "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" : { @@ -8038,31 +8038,6 @@ } } }, - { - "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_roundTripDataPoint", "effects" : { @@ -8188,6 +8163,56 @@ } } }, + { + "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" : { @@ -8634,6 +8659,35 @@ } ], "structs" : [ + { + "methods" : [ + + ], + "name" : "Point", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "x", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "y", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "Point" + }, { "constructor" : { "abiName" : "bjs_PointerFields_init", @@ -9160,6 +9214,193 @@ ], "swiftCallName" : "ValidationReport" }, + { + "methods" : [ + + ], + "name" : "AdvancedConfig", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "int" : { + + } + } + }, + { + "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" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "metadata", + "type" : { + "optional" : { + "_0" : { + "jsObject" : { + + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "location", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "defaults", + "type" : { + "swiftStruct" : { + "_0" : "ConfigStruct" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "overrideDefaults", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "ConfigStruct" + } + } + } + } + } + ], + "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" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optionalRatio", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Ratio", + "_1" : "Double" + } + } + } + } + } + ], + "swiftCallName" : "MeasurementConfig" + }, { "constructor" : { "abiName" : "bjs_MathOperations_init", @@ -9480,67 +9721,6 @@ { "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" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Precision", - "_1" : "Float" - } - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optionalRatio", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Ratio", - "_1" : "Double" - } - } - } - } - } - ], - "swiftCallName" : "MeasurementConfig" - }, - { - "methods" : [ - ], "name" : "ConfigStruct", "properties" : [ @@ -10328,6 +10508,63 @@ ], "types" : [ + ] + }, + { + "functions" : [ + { + "name" : "jsTranslatePoint", + "parameters" : [ + { + "name" : "point", + "type" : { + "swiftStruct" : { + "_0" : "Point" + } + } + }, + { + "name" : "dx", + "type" : { + "int" : { + + } + } + }, + { + "name" : "dy", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + ], + "types" : [ + + ] + }, + { + "functions" : [ + + ], + "types" : [ + + ] + }, + { + "functions" : [ + + ], + "types" : [ + ] } ] diff --git a/Tests/BridgeJSRuntimeTests/ImportStructAPIs.swift b/Tests/BridgeJSRuntimeTests/ImportStructAPIs.swift new file mode 100644 index 000000000..82908701c --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/ImportStructAPIs.swift @@ -0,0 +1,9 @@ +@_spi(Experimental) import JavaScriptKit + +@JS +struct Point { + var x: Int + var y: Int +} + +@JSFunction func jsTranslatePoint(_ point: Point, dx: Int, dy: Int) throws(JSException) -> Point diff --git a/Tests/BridgeJSRuntimeTests/StructAPIs.swift b/Tests/BridgeJSRuntimeTests/StructAPIs.swift new file mode 100644 index 000000000..5c9fed511 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/StructAPIs.swift @@ -0,0 +1,216 @@ +@_spi(Experimental) import JavaScriptKit + +@JS struct PointerFields { + var raw: UnsafeRawPointer + var mutRaw: UnsafeMutableRawPointer + var opaque: OpaquePointer + var ptr: UnsafePointer + var mutPtr: UnsafeMutablePointer + + @JS init( + raw: UnsafeRawPointer, + mutRaw: UnsafeMutableRawPointer, + opaque: OpaquePointer, + ptr: UnsafePointer, + mutPtr: UnsafeMutablePointer + ) { + self.raw = raw + self.mutRaw = mutRaw + self.opaque = opaque + self.ptr = ptr + self.mutPtr = mutPtr + } +} + +@JS func roundTripPointerFields(_ value: PointerFields) -> PointerFields { value } + +@JS struct DataPoint { + let x: Double + let y: Double + var label: String + var optCount: Int? + var optFlag: Bool? + + @JS init(x: Double, y: Double, label: String, optCount: Int?, optFlag: Bool?) { + self.x = x + self.y = y + self.label = label + self.optCount = optCount + self.optFlag = optFlag + } +} + +@JS struct Address { + var street: String + var city: String + var zipCode: Int? +} + +@JS struct Contact { + var name: String + var age: Int + var address: Address + var email: String? + var secondaryAddress: Address? +} + +@JS struct Config { + var name: String + var theme: Theme? + var direction: Direction? + var status: Status +} + +@JS struct SessionData { + var id: Int + var owner: Greeter? +} + +@JS struct ValidationReport { + var id: Int + var result: APIResult + var status: Status? + var outcome: APIResult? +} + +@JS struct AdvancedConfig { + var id: Int + var title: String + var enabled: Bool + var theme: Theme + var status: Status + var result: APIResult? + var metadata: JSObject? + var location: DataPoint? + var defaults: ConfigStruct + var overrideDefaults: ConfigStruct? +} + +@JS struct MeasurementConfig { + var precision: Precision + var ratio: Ratio + var optionalPrecision: Precision? + var optionalRatio: Ratio? +} + +@JS struct MathOperations { + var baseValue: Double + + @JS init(baseValue: Double = 0.0) { + self.baseValue = baseValue + } + + @JS func add(a: Double, b: Double = 10.0) -> Double { + return baseValue + a + b + } + + @JS func multiply(a: Double, b: Double) -> Double { + return a * b + } + + @JS static func subtract(a: Double, b: Double) -> Double { + return a - b + } +} + +@JS func testStructDefault( + point: DataPoint = DataPoint(x: 1.0, y: 2.0, label: "default", optCount: nil, optFlag: nil) +) -> String { + return "\(point.x),\(point.y),\(point.label)" +} + +@JS struct CopyableCart { + var x: Int + var note: String? + + @JS static func fromJSObject(_ object: JSObject) -> CopyableCart { + CopyableCart(unsafelyCopying: object) + } +} + +@JS func cartToJSObject(_ cart: CopyableCart) -> JSObject { + cart.toJSObject() +} + +@JS struct CopyableCartItem { + var sku: String + var quantity: Int +} + +@JS struct CopyableNestedCart { + var id: Int + var item: CopyableCartItem + var shippingAddress: Address? + + @JS static func fromJSObject(_ object: JSObject) -> CopyableNestedCart { + CopyableNestedCart(unsafelyCopying: object) + } +} + +@JS func nestedCartToJSObject(_ cart: CopyableNestedCart) -> JSObject { + cart.toJSObject() +} + +@JS struct ConfigStruct { + var name: String + var value: Int + + @JS nonisolated(unsafe) static var defaultConfig: String = "production" + @JS static let maxRetries: Int = 3 + @JS nonisolated(unsafe) static var timeout: Double = 30.0 + + @JS static var computedSetting: String { + return "Config: \(defaultConfig)" + } +} + +@JS func roundTripDataPoint(_ data: DataPoint) -> DataPoint { + return data +} + +@JS func roundTripContact(_ contact: Contact) -> Contact { + return contact +} + +@JS func roundTripConfig(_ config: Config) -> Config { + return config +} + +@JS func roundTripSessionData(_ session: SessionData) -> SessionData { + return session +} + +@JS func roundTripValidationReport(_ report: ValidationReport) -> ValidationReport { + return report +} + +@JS func roundTripAdvancedConfig(_ config: AdvancedConfig) -> AdvancedConfig { + return config +} + +@JS func roundTripMeasurementConfig(_ config: MeasurementConfig) -> MeasurementConfig { + return config +} + +@JS func updateValidationReport(_ newResult: APIResult?, _ report: ValidationReport) -> ValidationReport { + return ValidationReport( + id: report.id, + result: newResult ?? report.result, + status: report.status, + outcome: report.outcome + ) +} + +@JS class Container { + @JS var location: DataPoint + @JS var config: Config? + + @JS init(location: DataPoint, config: Config?) { + self.location = location + self.config = config + } +} + +@JS func testContainerWithStruct(_ point: DataPoint) -> Container { + return Container(location: point, config: nil) +} diff --git a/Tests/BridgeJSRuntimeTests/SwiftStructTests.swift b/Tests/BridgeJSRuntimeTests/SwiftStructTests.swift new file mode 100644 index 000000000..3ba9d28d6 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/SwiftStructTests.swift @@ -0,0 +1,19 @@ +import XCTest +import JavaScriptKit + +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "runJsStructWorks") +@_extern(c) +func runJsStructWorks() -> Void + +final class SwiftStructTests: XCTestCase { + func testExportedStructSupport() { + runJsStructWorks() + } + + func testSwiftStructInImportedSignature() throws { + let point = Point(x: 1, y: 2) + let moved = try jsTranslatePoint(point, dx: 3, dy: -1) + XCTAssertEqual(moved.x, 4) + XCTAssertEqual(moved.y, 1) + } +} diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 65bb7d607..141b87d35 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -8,6 +8,7 @@ import { export async function setupOptions(options, context) { Error.stackTraceLimit = 100; setupTestGlobals(globalThis); + return { ...options, getImports: (importsContext) => { @@ -102,6 +103,9 @@ export async function setupOptions(options, context) { fn(v); fn(v); return v; + }, + jsTranslatePoint: (point, dx, dy) => { + return { x: (point.x | 0) + (dx | 0), y: (point.y | 0) + (dy | 0) }; } }; }, @@ -119,6 +123,13 @@ export async function setupOptions(options, context) { } return BridgeJSRuntimeTests_runJsWorks(getInstance(), exports); } + bridgeJSRuntimeTests["runJsStructWorks"] = () => { + const exports = getExports(); + if (!exports) { + throw new Error("No exports!?"); + } + return BridgeJSRuntimeTests_runJsStructWorks(exports); + } const bridgeJSGlobalTests = importObject["BridgeJSGlobalTests"] || {}; bridgeJSGlobalTests["runJsWorksGlobal"] = () => { return BridgeJSGlobalTests_runJsWorksGlobal(); @@ -767,7 +778,6 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { testProtocolSupport(exports); testClosureSupport(exports); - testStructSupport(exports); } /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ function testClosureSupport(exports) { @@ -1043,6 +1053,34 @@ function testStructSupport(exports) { assert.deepEqual(updatedReport.result, { tag: exports.APIResult.Tag.Success, param0: "updated" }); assert.deepEqual(exports.updateValidationReport(null, origReport).result, origReport.result); + const advancedConfig1 = { + id: 42, + title: "Primary", + enabled: true, + theme: exports.Theme.Dark, + status: exports.Status.Success, + result: { tag: exports.APIResult.Tag.Success, param0: "ok" }, + metadata: { note: "extra" }, + location: data1, + defaults: { name: "base", value: 10 }, + overrideDefaults: { name: "override", value: 20 }, + }; + assert.deepEqual(exports.roundTripAdvancedConfig(advancedConfig1), advancedConfig1); + + const advancedConfig2 = { + id: 99, + title: "", + enabled: false, + theme: exports.Theme.Light, + status: exports.Status.Loading, + result: null, + metadata: null, + location: null, + defaults: { name: "base", value: 0 }, + overrideDefaults: null, + }; + assert.deepEqual(exports.roundTripAdvancedConfig(advancedConfig2), advancedConfig2); + assert.equal(exports.MathOperations.subtract(10.0, 4.0), 6.0); const mathOps = exports.MathOperations.init(); assert.equal(mathOps.baseValue, 0.0); @@ -1119,6 +1157,11 @@ async function BridgeJSRuntimeTests_runAsyncWorks(exports) { await exports.asyncRoundTripVoid(); } +/** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ +function BridgeJSRuntimeTests_runJsStructWorks(exports) { + testStructSupport(exports); +} + function BridgeJSGlobalTests_runJsWorksGlobal() { assert.equal(globalThis.GlobalNetworking.API.CallMethodValues.Get, 0); assert.equal(globalThis.GlobalNetworking.API.CallMethodValues.Post, 1); From eb1665cdda23c79d2a121b2ef2b1965bc7a5bb72 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 28 Jan 2026 18:50:14 +0700 Subject: [PATCH 109/252] NFC: BridgeJS: Rename raise to lift in struct and enum helpers (#539) BridgeJS: Align naming for stack based types from "raise" to "lift" --- Benchmarks/Sources/Generated/BridgeJS.swift | 32 ++--- .../Sources/BridgeJSCore/ExportSwift.swift | 14 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 4 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 58 ++++----- .../DefaultParameters.Export.js | 18 +-- .../EnumAssociatedValue.Export.js | 30 ++--- .../BridgeJSLinkTests/Protocol.Export.js | 8 +- .../StaticFunctions.Export.js | 4 +- .../StaticFunctions.Global.Export.js | 4 +- .../BridgeJSLinkTests/SwiftClosure.Export.js | 6 +- .../BridgeJSLinkTests/SwiftStruct.Export.js | 42 +++--- .../SwiftStructImports.ImportMacros.js | 6 +- .../BridgeJSLinkTests/UnsafePointer.Export.js | 10 +- .../ExportSwiftTests/DefaultParameters.swift | 16 +-- .../ExportSwiftTests/SwiftStruct.swift | 48 +++---- .../ExportSwiftTests/UnsafePointer.swift | 8 +- .../Generated/BridgeJS.swift | 120 +++++++++--------- 17 files changed, 214 insertions(+), 214 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 90558ff7b..9cf164d6d 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -279,7 +279,7 @@ extension SimpleStruct: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_SimpleStruct())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_SimpleStruct())) } } @@ -293,10 +293,10 @@ fileprivate func _bjs_struct_lower_SimpleStruct(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_SimpleStruct") -fileprivate func _bjs_struct_raise_SimpleStruct() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_SimpleStruct") +fileprivate func _bjs_struct_lift_SimpleStruct() -> Int32 #else -fileprivate func _bjs_struct_raise_SimpleStruct() -> Int32 { +fileprivate func _bjs_struct_lift_SimpleStruct() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -332,7 +332,7 @@ extension Address: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Address())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Address())) } } @@ -346,10 +346,10 @@ fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Address") -fileprivate func _bjs_struct_raise_Address() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Address") +fileprivate func _bjs_struct_lift_Address() -> Int32 #else -fileprivate func _bjs_struct_raise_Address() -> Int32 { +fileprivate func _bjs_struct_lift_Address() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -391,7 +391,7 @@ extension Person: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Person())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Person())) } } @@ -405,10 +405,10 @@ fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Person") -fileprivate func _bjs_struct_raise_Person() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Person") +fileprivate func _bjs_struct_lift_Person() -> Int32 #else -fileprivate func _bjs_struct_raise_Person() -> Int32 { +fileprivate func _bjs_struct_lift_Person() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -453,7 +453,7 @@ extension ComplexStruct: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ComplexStruct())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ComplexStruct())) } } @@ -467,10 +467,10 @@ fileprivate func _bjs_struct_lower_ComplexStruct(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_ComplexStruct") -fileprivate func _bjs_struct_raise_ComplexStruct() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_ComplexStruct") +fileprivate func _bjs_struct_lift_ComplexStruct() -> Int32 #else -fileprivate func _bjs_struct_raise_ComplexStruct() -> Int32 { +fileprivate func _bjs_struct_lift_ComplexStruct() -> Int32 { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 370b5fa2d..bfe414b76 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1184,9 +1184,9 @@ struct StructCodegen { let accessControl = structDef.explicitAccessControl.map { "\($0) " } ?? "" let lowerExternName = "swift_js_struct_lower_\(structDef.name)" - let raiseExternName = "swift_js_struct_raise_\(structDef.name)" + let liftExternName = "swift_js_struct_lift_\(structDef.name)" let lowerFunctionName = "_bjs_struct_lower_\(structDef.name)" - let raiseFunctionName = "_bjs_struct_raise_\(structDef.name)" + let liftFunctionName = "_bjs_struct_lift_\(structDef.name)" let bridgedStructExtension: DeclSyntax = """ extension \(raw: typeName): _BridgedSwiftStruct { @@ -1207,7 +1207,7 @@ struct StructCodegen { \(raw: accessControl)func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: \(raw: raiseFunctionName)())) + return JSObject(id: UInt32(bitPattern: \(raw: liftFunctionName)())) } } """ @@ -1220,16 +1220,16 @@ struct StructCodegen { returnType: .i32 ) ) - let raiseExternDecl = Self.renderStructExtern( - externName: raiseExternName, - functionName: raiseFunctionName, + let liftExternDecl = Self.renderStructExtern( + externName: liftExternName, + functionName: liftFunctionName, signature: SwiftSignatureBuilder.buildABIFunctionSignature( abiParameters: [], returnType: .i32 ) ) - return [bridgedStructExtension, lowerExternDecl, raiseExternDecl] + return [bridgedStructExtension, lowerExternDecl, liftExternDecl] } private static func renderStructExtern( diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 2cfaef11e..743494916 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -475,10 +475,10 @@ public struct BridgeJSLink { } printer.write("}") - printer.write("bjs[\"swift_js_struct_raise_\(structDef.name)\"] = function() {") + printer.write("bjs[\"swift_js_struct_lift_\(structDef.name)\"] = function() {") printer.indent { printer.write( - "const value = \(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const value = \(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) printer.write("return \(JSGlueVariableScope.reservedSwift).memory.retain(value);") } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 05b279c4f..d5f47234d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -280,7 +280,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { _, scope, printer, _ in let retName = scope.variable("ret") printer.write( - "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lift(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) return [retName] } @@ -343,7 +343,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSome)) {") printer.indent { printer.write( - "\(enumVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(wrappedValue), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "\(enumVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(wrappedValue), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) } printer.write("}") @@ -355,7 +355,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSome)) {") printer.indent { printer.write( - "\(structVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "\(structVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) } printer.write("} else {") @@ -547,7 +547,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("} else {") printer.indent { printer.write( - "\(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "\(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) } printer.write("}") @@ -559,7 +559,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") printer.indent { printer.write( - "\(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "\(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) } printer.write("} else {") @@ -839,7 +839,7 @@ struct IntrinsicJSFragment: Sendable { let targetVar = arguments[1] let base = fullName.components(separatedBy: ".").last ?? fullName printer.write( - "let \(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "let \(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) return [] } @@ -906,7 +906,7 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName printer.write( - "\(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(value), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "\(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(value), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) default: fatalError("Unsupported optional wrapped type in closure parameter lifting: \(wrappedType)") @@ -1234,7 +1234,7 @@ struct IntrinsicJSFragment: Sendable { let base = fullName.components(separatedBy: ".").last ?? fullName let resultVar = scope.variable("result") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) printer.write("return \(resultVar);") return [] @@ -1449,7 +1449,7 @@ struct IntrinsicJSFragment: Sendable { let caseId = arguments[0] let resultVar = scope.variable("enumValue") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) return [resultVar] } @@ -1466,7 +1466,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanupCode in let resultVar = scope.variable("structValue") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) return [resultVar] } @@ -1636,25 +1636,25 @@ struct IntrinsicJSFragment: Sendable { } printer.write("},") - // Generate raise function + // Generate lift function printer.write( - "raise: (\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s)) => {" + "lift: (\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s)) => {" ) printer.indent { printer.write("const tag = tmpRetTag | 0;") printer.write("switch (tag) {") printer.indent { - let raisePrinter = CodeFragmentPrinter() + let liftPrinter = CodeFragmentPrinter() for enumCase in enumDefinition.cases { let caseName = enumCase.name.capitalizedFirstLetter let caseScope = JSGlueVariableScope() let caseCleanup = CodeFragmentPrinter() let fragment = IntrinsicJSFragment.associatedValuePopPayload(enumCase: enumCase) - _ = fragment.printCode([enumName, caseName], caseScope, raisePrinter, caseCleanup) + _ = fragment.printCode([enumName, caseName], caseScope, liftPrinter, caseCleanup) } - for line in raisePrinter.lines { + for line in liftPrinter.lines { printer.write(line) } @@ -2048,7 +2048,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanupCode in let resultVar = scope.variable("structValue") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) return [resultVar] } @@ -2081,10 +2081,10 @@ struct IntrinsicJSFragment: Sendable { printer.write("},") printer.write( - "raise: (\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers)) => {" + "lift: (\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers)) => {" ) printer.indent { - generateStructRaiseCode( + generateStructLiftCode( structDef: capturedStructDef, allStructs: capturedAllStructs, printer: printer, @@ -2137,21 +2137,21 @@ struct IntrinsicJSFragment: Sendable { } } - private static func generateStructRaiseCode( + private static func generateStructLiftCode( structDef: ExportedStruct, allStructs: [ExportedStruct], printer: CodeFragmentPrinter, attachMethods: Bool = false ) { - let raiseScope = JSGlueVariableScope() - let raiseCleanup = CodeFragmentPrinter() + let liftScope = JSGlueVariableScope() + let liftCleanup = CodeFragmentPrinter() var fieldExpressions: [(name: String, expression: String)] = [] let instanceProps = structDef.properties.filter { !$0.isStatic } for property in instanceProps.reversed() { - let fragment = structFieldRaiseFragment(field: property, allStructs: allStructs) - let results = fragment.printCode([], raiseScope, printer, raiseCleanup) + let fragment = structFieldLiftFragment(field: property, allStructs: allStructs) + let results = fragment.printCode([], liftScope, printer, liftCleanup) if let resultExpr = results.first { fieldExpressions.append((property.name, resultExpr)) @@ -2167,7 +2167,7 @@ struct IntrinsicJSFragment: Sendable { } if attachMethods && !structDef.methods.filter({ !$0.effects.isStatic }).isEmpty { - let instanceVar = raiseScope.variable("instance") + let instanceVar = liftScope.variable("instance") printer.write("const \(instanceVar) = { \(reconstructedFields.joined(separator: ", ")) };") // Attach instance methods to the struct instance @@ -2710,7 +2710,7 @@ struct IntrinsicJSFragment: Sendable { case tmpParamF64s } - private static func structFieldRaiseFragment( + private static func structFieldLiftFragment( field: ExportedProperty, allStructs: [ExportedStruct] ) -> IntrinsicJSFragment { @@ -2785,10 +2785,10 @@ struct IntrinsicJSFragment: Sendable { let caseIdVar = scope.variable("enumCaseId") printer.write("const \(caseIdVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") printer.write( - "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) } else { - let wrappedFragment = structFieldRaiseFragment( + let wrappedFragment = structFieldLiftFragment( field: ExportedProperty( name: field.name, type: wrappedType, @@ -2819,7 +2819,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let structVar = scope.variable("struct") printer.write( - "const \(structVar) = \(JSGlueVariableScope.reservedStructHelpers).\(nestedName).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(structVar) = \(JSGlueVariableScope.reservedStructHelpers).\(nestedName).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) return [structVar] } @@ -2913,7 +2913,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let varName = scope.variable("value") printer.write( - "const \(varName) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).raise(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "const \(varName) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" ) return [varName] } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index 6923db749..7be003943 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -54,7 +54,7 @@ export async function createInstantiator(options, swift) { }; return { cleanup }; }, - raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { const bool = tmpRetInts.pop() !== 0; const int = tmpRetInts.pop(); const string = tmpRetStrings.pop(); @@ -68,7 +68,7 @@ export async function createInstantiator(options, swift) { tmpParamF64s.push(value.baseValue); return { cleanup: undefined }; }, - raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { const f64 = tmpRetF64s.pop(); const instance1 = { baseValue: f64 }; instance1.add = function(a, b = 10.0) { @@ -171,8 +171,8 @@ export async function createInstantiator(options, swift) { } return 0; } - bjs["swift_js_struct_raise_Config"] = function() { - const value = structHelpers.Config.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + bjs["swift_js_struct_lift_Config"] = function() { + const value = structHelpers.Config.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return swift.memory.retain(value); } bjs["swift_js_struct_lower_MathOperations"] = function(objectId) { @@ -182,8 +182,8 @@ export async function createInstantiator(options, swift) { } return 0; } - bjs["swift_js_struct_raise_MathOperations"] = function() { - const value = structHelpers.MathOperations.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + bjs["swift_js_struct_lift_MathOperations"] = function() { + const value = structHelpers.MathOperations.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return swift.memory.retain(value); } bjs["swift_js_return_optional_bool"] = function(isSome, value) { @@ -528,7 +528,7 @@ export async function createInstantiator(options, swift) { const isSome1 = tmpRetInts.pop(); let optResult; if (isSome1) { - optResult = structHelpers.Config.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optResult = structHelpers.Config.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); } else { optResult = null; } @@ -546,7 +546,7 @@ export async function createInstantiator(options, swift) { const isSome1 = tmpRetInts.pop(); let optResult; if (isSome1) { - optResult = structHelpers.Config.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optResult = structHelpers.Config.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); } else { optResult = null; } @@ -557,7 +557,7 @@ export async function createInstantiator(options, swift) { MathOperations: { init: function(baseValue = 0.0) { instance.exports.bjs_MathOperations_init(baseValue); - const structValue = structHelpers.MathOperations.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const structValue = structHelpers.MathOperations.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return structValue; }, subtract: function(a, b) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index bbceab383..3c7baa5b9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -57,7 +57,7 @@ const __bjs_createAPIResultValuesHelpers = () => { default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } }, - raise: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { + lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { const tag = tmpRetTag | 0; switch (tag) { case APIResultValues.Tag.Success: { @@ -175,7 +175,7 @@ const __bjs_createComplexResultValuesHelpers = () => { default: throw new Error("Unknown ComplexResultValues tag: " + String(enumTag)); } }, - raise: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { + lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { const tag = tmpRetTag | 0; switch (tag) { case ComplexResultValues.Tag.Success: { @@ -266,7 +266,7 @@ const __bjs_createResultValuesHelpers = () => { default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); } }, - raise: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { + lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { const tag = tmpRetTag | 0; switch (tag) { case ResultValues.Tag.Success: { @@ -325,7 +325,7 @@ const __bjs_createNetworkingResultValuesHelpers = () => { default: throw new Error("Unknown NetworkingResultValues tag: " + String(enumTag)); } }, - raise: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { + lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { const tag = tmpRetTag | 0; switch (tag) { case NetworkingResultValues.Tag.Success: { @@ -414,7 +414,7 @@ const __bjs_createAPIOptionalResultValuesHelpers = () => { default: throw new Error("Unknown APIOptionalResultValues tag: " + String(enumTag)); } }, - raise: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { + lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { const tag = tmpRetTag | 0; switch (tag) { case APIOptionalResultValues.Tag.Success: { @@ -711,13 +711,13 @@ export async function createInstantiator(options, swift) { }, getResult: function bjs_getResult() { instance.exports.bjs_getResult(); - const ret = enumHelpers.APIResult.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const ret = enumHelpers.APIResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); return ret; }, roundtripAPIResult: function bjs_roundtripAPIResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.APIResult.lower(result); instance.exports.bjs_roundtripAPIResult(resultCaseId); - const ret = enumHelpers.APIResult.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const ret = enumHelpers.APIResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -735,7 +735,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.APIResult.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + optResult = enumHelpers.APIResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -747,13 +747,13 @@ export async function createInstantiator(options, swift) { }, getComplexResult: function bjs_getComplexResult() { instance.exports.bjs_getComplexResult(); - const ret = enumHelpers.ComplexResult.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const ret = enumHelpers.ComplexResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); return ret; }, roundtripComplexResult: function bjs_roundtripComplexResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.ComplexResult.lower(result); instance.exports.bjs_roundtripComplexResult(resultCaseId); - const ret = enumHelpers.ComplexResult.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const ret = enumHelpers.ComplexResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -771,7 +771,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.ComplexResult.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + optResult = enumHelpers.ComplexResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -790,7 +790,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.Result.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + optResult = enumHelpers.Result.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -809,7 +809,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.NetworkingResult.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + optResult = enumHelpers.NetworkingResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -828,7 +828,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.APIOptionalResult.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + optResult = enumHelpers.APIOptionalResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -854,7 +854,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.APIOptionalResult.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + optResult = enumHelpers.APIOptionalResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); } if (result1Cleanup) { result1Cleanup(); } if (result2Cleanup) { result2Cleanup(); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index 0cf44ffdc..f9dbb07e2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -46,7 +46,7 @@ const __bjs_createResultValuesHelpers = () => { default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); } }, - raise: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { + lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { const tag = tmpRetTag | 0; switch (tag) { case ResultValues.Tag.Success: { @@ -372,7 +372,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_result_set"] = function bjs_MyViewControllerDelegate_result_set(self, value) { try { - const enumValue = enumHelpers.Result.raise(value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const enumValue = enumHelpers.Result.lift(value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); swift.memory.getObject(self).result = enumValue; } catch (error) { setException(error); @@ -396,7 +396,7 @@ export async function createInstantiator(options, swift) { try { let enumValue; if (valueIsSome) { - enumValue = enumHelpers.Result.raise(valueWrappedValue, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + enumValue = enumHelpers.Result.lift(valueWrappedValue, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); } swift.memory.getObject(self).optionalResult = valueIsSome ? enumValue : null; } catch (error) { @@ -553,7 +553,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_handleResult"] = function bjs_MyViewControllerDelegate_handleResult(self, result) { try { - const enumValue = enumHelpers.Result.raise(result, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const enumValue = enumHelpers.Result.lift(result, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); swift.memory.getObject(self).handleResult(enumValue); } catch (error) { setException(error); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index 201d0fd6b..84d517a57 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -39,7 +39,7 @@ const __bjs_createAPIResultValuesHelpers = () => { default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } }, - raise: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { + lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { const tag = tmpRetTag | 0; switch (tag) { case APIResultValues.Tag.Success: { @@ -330,7 +330,7 @@ export async function createInstantiator(options, swift) { roundtrip: function(value) { const { caseId: valueCaseId, cleanup: valueCleanup } = enumHelpers.APIResult.lower(value); instance.exports.bjs_APIResult_static_roundtrip(valueCaseId); - const ret = enumHelpers.APIResult.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const ret = enumHelpers.APIResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); if (valueCleanup) { valueCleanup(); } return ret; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js index e971c0161..97c09fb3e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js @@ -39,7 +39,7 @@ const __bjs_createAPIResultValuesHelpers = () => { default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } }, - raise: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { + lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { const tag = tmpRetTag | 0; switch (tag) { case APIResultValues.Tag.Success: { @@ -336,7 +336,7 @@ export async function createInstantiator(options, swift) { roundtrip: function(value) { const { caseId: valueCaseId, cleanup: valueCleanup } = enumHelpers.APIResult.lower(value); instance.exports.bjs_APIResult_static_roundtrip(valueCaseId); - const ret = enumHelpers.APIResult.raise(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const ret = enumHelpers.APIResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); if (valueCleanup) { valueCleanup(); } return ret; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js index b4a073d7a..58e39f0c6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js @@ -77,7 +77,7 @@ const __bjs_createAPIResultValuesHelpers = () => { default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } }, - raise: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { + lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { const tag = tmpRetTag | 0; switch (tag) { case APIResultValues.Tag.Success: { @@ -423,7 +423,7 @@ export async function createInstantiator(options, swift) { bjs["invoke_js_callback_TestModule_10TestModule9APIResultO_SS"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - let param0 = enumHelpers.APIResult.raise(param0Id, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + let param0 = enumHelpers.APIResult.lift(param0Id, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); const result = callback(param0); if (typeof result !== "string") { throw new TypeError("Callback must return a string"); @@ -685,7 +685,7 @@ export async function createInstantiator(options, swift) { const callback = swift.memory.getObject(callbackId); let param0; if (param0IsSome) { - param0 = enumHelpers.APIResult.raise(param0Value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + param0 = enumHelpers.APIResult.lift(param0Value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); } else { param0 = null; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js index 91968b77a..e7c40c298 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js @@ -67,7 +67,7 @@ export async function createInstantiator(options, swift) { }; return { cleanup }; }, - raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { const isSome = tmpRetInts.pop(); let optional; if (isSome) { @@ -115,7 +115,7 @@ export async function createInstantiator(options, swift) { }; return { cleanup }; }, - raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { const isSome = tmpRetInts.pop(); let optional; if (isSome) { @@ -158,7 +158,7 @@ export async function createInstantiator(options, swift) { }; return { cleanup }; }, - raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { const isSome = tmpRetInts.pop(); let optional; if (isSome) { @@ -167,7 +167,7 @@ export async function createInstantiator(options, swift) { } else { optional = null; } - const struct = structHelpers.Address.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const struct = structHelpers.Address.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); const int = tmpRetInts.pop(); const string1 = tmpRetStrings.pop(); return { name: string1, age: int, address: struct, email: optional }; @@ -181,7 +181,7 @@ export async function createInstantiator(options, swift) { tmpParamPointers.push(value.owner.pointer); return { cleanup: undefined }; }, - raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { const ptr = tmpRetPointers.pop(); const value = _exports['Greeter'].__construct(ptr); const int = tmpRetInts.pop(); @@ -203,7 +203,7 @@ export async function createInstantiator(options, swift) { tmpParamInts.push(isSome ? 1 : 0); return { cleanup: undefined }; }, - raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { const isSome = tmpRetInts.pop(); let optional; if (isSome) { @@ -223,7 +223,7 @@ export async function createInstantiator(options, swift) { lower: (value) => { return { cleanup: undefined }; }, - raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { return { }; } }); @@ -312,8 +312,8 @@ export async function createInstantiator(options, swift) { } return 0; } - bjs["swift_js_struct_raise_DataPoint"] = function() { - const value = structHelpers.DataPoint.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + bjs["swift_js_struct_lift_DataPoint"] = function() { + const value = structHelpers.DataPoint.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Address"] = function(objectId) { @@ -323,8 +323,8 @@ export async function createInstantiator(options, swift) { } return 0; } - bjs["swift_js_struct_raise_Address"] = function() { - const value = structHelpers.Address.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + bjs["swift_js_struct_lift_Address"] = function() { + const value = structHelpers.Address.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Person"] = function(objectId) { @@ -334,8 +334,8 @@ export async function createInstantiator(options, swift) { } return 0; } - bjs["swift_js_struct_raise_Person"] = function() { - const value = structHelpers.Person.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + bjs["swift_js_struct_lift_Person"] = function() { + const value = structHelpers.Person.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Session"] = function(objectId) { @@ -345,8 +345,8 @@ export async function createInstantiator(options, swift) { } return 0; } - bjs["swift_js_struct_raise_Session"] = function() { - const value = structHelpers.Session.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + bjs["swift_js_struct_lift_Session"] = function() { + const value = structHelpers.Session.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Measurement"] = function(objectId) { @@ -356,8 +356,8 @@ export async function createInstantiator(options, swift) { } return 0; } - bjs["swift_js_struct_raise_Measurement"] = function() { - const value = structHelpers.Measurement.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + bjs["swift_js_struct_lift_Measurement"] = function() { + const value = structHelpers.Measurement.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return swift.memory.retain(value); } bjs["swift_js_struct_lower_ConfigStruct"] = function(objectId) { @@ -367,8 +367,8 @@ export async function createInstantiator(options, swift) { } return 0; } - bjs["swift_js_struct_raise_ConfigStruct"] = function() { - const value = structHelpers.ConfigStruct.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + bjs["swift_js_struct_lift_ConfigStruct"] = function() { + const value = structHelpers.ConfigStruct.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return swift.memory.retain(value); } bjs["swift_js_return_optional_bool"] = function(isSome, value) { @@ -554,7 +554,7 @@ export async function createInstantiator(options, swift) { roundtrip: function bjs_roundtrip(session) { const { cleanup: cleanup } = structHelpers.Person.lower(session); instance.exports.bjs_roundtrip(); - const structValue = structHelpers.Person.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const structValue = structHelpers.Person.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); if (cleanup) { cleanup(); } return structValue; }, @@ -566,7 +566,7 @@ export async function createInstantiator(options, swift) { const isSome = optCount != null; const isSome1 = optFlag != null; instance.exports.bjs_DataPoint_init(x, y, labelId, labelBytes.length, +isSome, isSome ? optCount : 0, +isSome1, isSome1 ? optFlag : 0); - const structValue = structHelpers.DataPoint.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const structValue = structHelpers.DataPoint.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); swift.memory.release(labelId); return structValue; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js index 67a9b98e3..2f186df77 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js @@ -41,7 +41,7 @@ export async function createInstantiator(options, swift) { tmpParamInts.push((value.y | 0)); return { cleanup: undefined }; }, - raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { const int = tmpRetInts.pop(); const int1 = tmpRetInts.pop(); return { x: int1, y: int }; @@ -133,8 +133,8 @@ export async function createInstantiator(options, swift) { } return 0; } - bjs["swift_js_struct_raise_Point"] = function() { - const value = structHelpers.Point.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + bjs["swift_js_struct_lift_Point"] = function() { + const value = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return swift.memory.retain(value); } bjs["swift_js_return_optional_bool"] = function(isSome, value) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js index 4eb09bb27..aa45023ac 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js @@ -44,7 +44,7 @@ export async function createInstantiator(options, swift) { tmpParamPointers.push((value.mutPtr | 0)); return { cleanup: undefined }; }, - raise: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { const pointer = tmpRetPointers.pop(); const pointer1 = tmpRetPointers.pop(); const pointer2 = tmpRetPointers.pop(); @@ -138,8 +138,8 @@ export async function createInstantiator(options, swift) { } return 0; } - bjs["swift_js_struct_raise_PointerFields"] = function() { - const value = structHelpers.PointerFields.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + bjs["swift_js_struct_lift_PointerFields"] = function() { + const value = structHelpers.PointerFields.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return swift.memory.retain(value); } bjs["swift_js_return_optional_bool"] = function(isSome, value) { @@ -286,14 +286,14 @@ export async function createInstantiator(options, swift) { roundTripPointerFields: function bjs_roundTripPointerFields(value) { const { cleanup: cleanup } = structHelpers.PointerFields.lower(value); instance.exports.bjs_roundTripPointerFields(); - const structValue = structHelpers.PointerFields.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const structValue = structHelpers.PointerFields.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); if (cleanup) { cleanup(); } return structValue; }, PointerFields: { init: function(raw, mutRaw, opaque, ptr, mutPtr) { instance.exports.bjs_PointerFields_init(raw, mutRaw, opaque, ptr, mutPtr); - const structValue = structHelpers.PointerFields.raise(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const structValue = structHelpers.PointerFields.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return structValue; }, }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index d80d78d85..b1594c328 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -65,7 +65,7 @@ extension Config: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Config())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Config())) } } @@ -79,10 +79,10 @@ fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Config") -fileprivate func _bjs_struct_raise_Config() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Config") +fileprivate func _bjs_struct_lift_Config() -> Int32 #else -fileprivate func _bjs_struct_raise_Config() -> Int32 { +fileprivate func _bjs_struct_lift_Config() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -108,7 +108,7 @@ extension MathOperations: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_MathOperations())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_MathOperations())) } } @@ -122,10 +122,10 @@ fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_MathOperations") -fileprivate func _bjs_struct_raise_MathOperations() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_MathOperations") +fileprivate func _bjs_struct_lift_MathOperations() -> Int32 #else -fileprivate func _bjs_struct_raise_MathOperations() -> Int32 { +fileprivate func _bjs_struct_lift_MathOperations() -> Int32 { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift index 12623a344..ca164c1bf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift @@ -41,7 +41,7 @@ extension DataPoint: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_DataPoint())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_DataPoint())) } } @@ -55,10 +55,10 @@ fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_DataPoint") -fileprivate func _bjs_struct_raise_DataPoint() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_DataPoint") +fileprivate func _bjs_struct_lift_DataPoint() -> Int32 #else -fileprivate func _bjs_struct_raise_DataPoint() -> Int32 { +fileprivate func _bjs_struct_lift_DataPoint() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -109,7 +109,7 @@ extension Address: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Address())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Address())) } } @@ -123,10 +123,10 @@ fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Address") -fileprivate func _bjs_struct_raise_Address() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Address") +fileprivate func _bjs_struct_lift_Address() -> Int32 #else -fileprivate func _bjs_struct_raise_Address() -> Int32 { +fileprivate func _bjs_struct_lift_Address() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -168,7 +168,7 @@ extension Person: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Person())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Person())) } } @@ -182,10 +182,10 @@ fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Person") -fileprivate func _bjs_struct_raise_Person() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Person") +fileprivate func _bjs_struct_lift_Person() -> Int32 #else -fileprivate func _bjs_struct_raise_Person() -> Int32 { +fileprivate func _bjs_struct_lift_Person() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -213,7 +213,7 @@ extension Session: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Session())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Session())) } } @@ -227,10 +227,10 @@ fileprivate func _bjs_struct_lower_Session(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Session") -fileprivate func _bjs_struct_raise_Session() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Session") +fileprivate func _bjs_struct_lift_Session() -> Int32 #else -fileprivate func _bjs_struct_raise_Session() -> Int32 { +fileprivate func _bjs_struct_lift_Session() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -264,7 +264,7 @@ extension Measurement: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Measurement())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Measurement())) } } @@ -278,10 +278,10 @@ fileprivate func _bjs_struct_lower_Measurement(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Measurement") -fileprivate func _bjs_struct_raise_Measurement() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Measurement") +fileprivate func _bjs_struct_lift_Measurement() -> Int32 #else -fileprivate func _bjs_struct_raise_Measurement() -> Int32 { +fileprivate func _bjs_struct_lift_Measurement() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -306,7 +306,7 @@ extension ConfigStruct: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ConfigStruct())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ConfigStruct())) } } @@ -320,10 +320,10 @@ fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_ConfigStruct") -fileprivate func _bjs_struct_raise_ConfigStruct() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_ConfigStruct") +fileprivate func _bjs_struct_lift_ConfigStruct() -> Int32 #else -fileprivate func _bjs_struct_raise_ConfigStruct() -> Int32 { +fileprivate func _bjs_struct_lift_ConfigStruct() -> Int32 { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift index 3e9fad511..3ef3b9939 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift @@ -27,7 +27,7 @@ extension PointerFields: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_PointerFields())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PointerFields())) } } @@ -41,10 +41,10 @@ fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_PointerFields") -fileprivate func _bjs_struct_raise_PointerFields() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PointerFields") +fileprivate func _bjs_struct_lift_PointerFields() -> Int32 #else -fileprivate func _bjs_struct_raise_PointerFields() -> Int32 { +fileprivate func _bjs_struct_lift_PointerFields() -> Int32 { fatalError("Only available on WebAssembly") } #endif diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index b9f823d01..c31876ac9 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2241,7 +2241,7 @@ extension Point: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Point())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Point())) } } @@ -2255,10 +2255,10 @@ fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Point") -fileprivate func _bjs_struct_raise_Point() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Point") +fileprivate func _bjs_struct_lift_Point() -> Int32 #else -fileprivate func _bjs_struct_raise_Point() -> Int32 { +fileprivate func _bjs_struct_lift_Point() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -2292,7 +2292,7 @@ extension PointerFields: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_PointerFields())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PointerFields())) } } @@ -2306,10 +2306,10 @@ fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_PointerFields") -fileprivate func _bjs_struct_raise_PointerFields() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PointerFields") +fileprivate func _bjs_struct_lift_PointerFields() -> Int32 #else -fileprivate func _bjs_struct_raise_PointerFields() -> Int32 { +fileprivate func _bjs_struct_lift_PointerFields() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -2365,7 +2365,7 @@ extension DataPoint: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_DataPoint())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_DataPoint())) } } @@ -2379,10 +2379,10 @@ fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_DataPoint") -fileprivate func _bjs_struct_raise_DataPoint() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_DataPoint") +fileprivate func _bjs_struct_lift_DataPoint() -> Int32 #else -fileprivate func _bjs_struct_raise_DataPoint() -> Int32 { +fileprivate func _bjs_struct_lift_DataPoint() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -2433,7 +2433,7 @@ extension Address: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Address())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Address())) } } @@ -2447,10 +2447,10 @@ fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Address") -fileprivate func _bjs_struct_raise_Address() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Address") +fileprivate func _bjs_struct_lift_Address() -> Int32 #else -fileprivate func _bjs_struct_raise_Address() -> Int32 { +fileprivate func _bjs_struct_lift_Address() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -2498,7 +2498,7 @@ extension Contact: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Contact())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Contact())) } } @@ -2512,10 +2512,10 @@ fileprivate func _bjs_struct_lower_Contact(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Contact") -fileprivate func _bjs_struct_raise_Contact() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Contact") +fileprivate func _bjs_struct_lift_Contact() -> Int32 #else -fileprivate func _bjs_struct_raise_Contact() -> Int32 { +fileprivate func _bjs_struct_lift_Contact() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -2561,7 +2561,7 @@ extension Config: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Config())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Config())) } } @@ -2575,10 +2575,10 @@ fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Config") -fileprivate func _bjs_struct_raise_Config() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Config") +fileprivate func _bjs_struct_lift_Config() -> Int32 #else -fileprivate func _bjs_struct_raise_Config() -> Int32 { +fileprivate func _bjs_struct_lift_Config() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -2610,7 +2610,7 @@ extension SessionData: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_SessionData())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_SessionData())) } } @@ -2624,10 +2624,10 @@ fileprivate func _bjs_struct_lower_SessionData(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_SessionData") -fileprivate func _bjs_struct_raise_SessionData() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_SessionData") +fileprivate func _bjs_struct_lift_SessionData() -> Int32 #else -fileprivate func _bjs_struct_raise_SessionData() -> Int32 { +fileprivate func _bjs_struct_lift_SessionData() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -2667,7 +2667,7 @@ extension ValidationReport: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ValidationReport())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ValidationReport())) } } @@ -2681,10 +2681,10 @@ fileprivate func _bjs_struct_lower_ValidationReport(_ objectId: Int32) -> Int32 #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_ValidationReport") -fileprivate func _bjs_struct_raise_ValidationReport() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_ValidationReport") +fileprivate func _bjs_struct_lift_ValidationReport() -> Int32 #else -fileprivate func _bjs_struct_raise_ValidationReport() -> Int32 { +fileprivate func _bjs_struct_lift_ValidationReport() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -2750,7 +2750,7 @@ extension AdvancedConfig: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_AdvancedConfig())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_AdvancedConfig())) } } @@ -2764,10 +2764,10 @@ fileprivate func _bjs_struct_lower_AdvancedConfig(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_AdvancedConfig") -fileprivate func _bjs_struct_raise_AdvancedConfig() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_AdvancedConfig") +fileprivate func _bjs_struct_lift_AdvancedConfig() -> Int32 #else -fileprivate func _bjs_struct_raise_AdvancedConfig() -> Int32 { +fileprivate func _bjs_struct_lift_AdvancedConfig() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -2807,7 +2807,7 @@ extension MeasurementConfig: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_MeasurementConfig())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_MeasurementConfig())) } } @@ -2821,10 +2821,10 @@ fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Int32 #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_MeasurementConfig") -fileprivate func _bjs_struct_raise_MeasurementConfig() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_MeasurementConfig") +fileprivate func _bjs_struct_lift_MeasurementConfig() -> Int32 #else -fileprivate func _bjs_struct_raise_MeasurementConfig() -> Int32 { +fileprivate func _bjs_struct_lift_MeasurementConfig() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -2850,7 +2850,7 @@ extension MathOperations: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_MathOperations())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_MathOperations())) } } @@ -2864,10 +2864,10 @@ fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_MathOperations") -fileprivate func _bjs_struct_raise_MathOperations() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_MathOperations") +fileprivate func _bjs_struct_lift_MathOperations() -> Int32 #else -fileprivate func _bjs_struct_raise_MathOperations() -> Int32 { +fileprivate func _bjs_struct_lift_MathOperations() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -2946,7 +2946,7 @@ extension CopyableCart: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_CopyableCart())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_CopyableCart())) } } @@ -2960,10 +2960,10 @@ fileprivate func _bjs_struct_lower_CopyableCart(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_CopyableCart") -fileprivate func _bjs_struct_raise_CopyableCart() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_CopyableCart") +fileprivate func _bjs_struct_lift_CopyableCart() -> Int32 #else -fileprivate func _bjs_struct_raise_CopyableCart() -> Int32 { +fileprivate func _bjs_struct_lift_CopyableCart() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -3005,7 +3005,7 @@ extension CopyableCartItem: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_CopyableCartItem())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_CopyableCartItem())) } } @@ -3019,10 +3019,10 @@ fileprivate func _bjs_struct_lower_CopyableCartItem(_ objectId: Int32) -> Int32 #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_CopyableCartItem") -fileprivate func _bjs_struct_raise_CopyableCartItem() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_CopyableCartItem") +fileprivate func _bjs_struct_lift_CopyableCartItem() -> Int32 #else -fileprivate func _bjs_struct_raise_CopyableCartItem() -> Int32 { +fileprivate func _bjs_struct_lift_CopyableCartItem() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -3056,7 +3056,7 @@ extension CopyableNestedCart: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_CopyableNestedCart())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_CopyableNestedCart())) } } @@ -3070,10 +3070,10 @@ fileprivate func _bjs_struct_lower_CopyableNestedCart(_ objectId: Int32) -> Int3 #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_CopyableNestedCart") -fileprivate func _bjs_struct_raise_CopyableNestedCart() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_CopyableNestedCart") +fileprivate func _bjs_struct_lift_CopyableNestedCart() -> Int32 #else -fileprivate func _bjs_struct_raise_CopyableNestedCart() -> Int32 { +fileprivate func _bjs_struct_lift_CopyableNestedCart() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -3115,7 +3115,7 @@ extension ConfigStruct: _BridgedSwiftStruct { func toJSObject() -> JSObject { let __bjs_self = self __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ConfigStruct())) + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ConfigStruct())) } } @@ -3129,10 +3129,10 @@ fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_ConfigStruct") -fileprivate func _bjs_struct_raise_ConfigStruct() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_ConfigStruct") +fileprivate func _bjs_struct_lift_ConfigStruct() -> Int32 #else -fileprivate func _bjs_struct_raise_ConfigStruct() -> Int32 { +fileprivate func _bjs_struct_lift_ConfigStruct() -> Int32 { fatalError("Only available on WebAssembly") } #endif From 515b6d65bf95d8a05add7189226d4451d8c979e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Jan 2026 10:24:13 +0900 Subject: [PATCH 110/252] Bump playwright from 1.52.0 to 1.55.1 (#538) Bumps [playwright](https://github.com/microsoft/playwright) from 1.52.0 to 1.55.1. - [Release notes](https://github.com/microsoft/playwright/releases) - [Commits](https://github.com/microsoft/playwright/compare/v1.52.0...v1.55.1) --- updated-dependencies: - dependency-name: playwright dependency-version: 1.55.1 dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 20 ++++++++++++-------- package.json | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index e12af9c97..bf7f36315 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "prettier": "3.5.3", "rollup": "^4.37.0", "rollup-plugin-dts": "^6.2.1", + "tslib": "^2.8.1", "typescript": "^5.8.2" } }, @@ -507,12 +508,13 @@ } }, "node_modules/playwright": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.52.0.tgz", - "integrity": "sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==", + "version": "1.55.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.55.1.tgz", + "integrity": "sha512-cJW4Xd/G3v5ovXtJJ52MAOclqeac9S/aGGgRzLabuF8TnIb6xHvMzKIa6JmrRzUkeXJgfL1MhukP0NK6l39h3A==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.52.0" + "playwright-core": "1.55.1" }, "bin": { "playwright": "cli.js" @@ -525,10 +527,11 @@ } }, "node_modules/playwright-core": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.52.0.tgz", - "integrity": "sha512-l2osTgLXSMeuLZOML9qYODUQoPPnUsKsb5/P6LJ2e6uPKXUdPK5WYhN4z03G+YNbWmGDY4YENauNu4ZKczreHg==", + "version": "1.55.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.55.1.tgz", + "integrity": "sha512-Z6Mh9mkwX+zxSlHqdr5AOcJnfp+xUWLCt9uKV18fhzA8eyxUd8NUWzAjxUh55RZKSYwDGX0cfaySdhZJGMoJ+w==", "dev": true, + "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, @@ -579,6 +582,7 @@ "integrity": "sha512-iAtQy/L4QFU+rTJ1YUjXqJOJzuwEghqWzCEYD2FEghT7Gsy1VdABntrO4CLopA5IkflTyqNiLNwPcOJ3S7UKLg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/estree": "1.0.6" }, @@ -654,7 +658,6 @@ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true, "license": "0BSD", - "optional": true, "peer": true }, "node_modules/typescript": { @@ -663,6 +666,7 @@ "integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/package.json b/package.json index 96443ad9a..da7d5356d 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "prettier": "3.5.3", "rollup": "^4.37.0", "rollup-plugin-dts": "^6.2.1", + "tslib": "^2.8.1", "typescript": "^5.8.2" } } From 8784a389d111002b581b4140f41e6b2a6c315b95 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 29 Jan 2026 09:26:33 +0700 Subject: [PATCH 111/252] BridgeJS: Swift Array support (#542) --- .../Sources/BridgeJSCore/ExportSwift.swift | 127 +- .../Sources/BridgeJSCore/ImportTS.swift | 14 + .../BridgeJSCore/SwiftToSkeleton.swift | 73 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 32 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 529 +++++++ .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 8 + .../BridgeJSToolTests/Inputs/ArrayTypes.swift | 56 + .../Inputs/DefaultParameters.swift | 12 + .../BridgeJSToolTests/Inputs/Protocol.swift | 18 + .../ArrayParameter.Import.js | 8 + .../BridgeJSLinkTests/ArrayTypes.Export.d.ts | 76 + .../BridgeJSLinkTests/ArrayTypes.Export.js | 845 +++++++++++ .../BridgeJSLinkTests/Async.Export.js | 8 + .../BridgeJSLinkTests/Async.Import.js | 8 + .../DefaultParameters.Export.d.ts | 26 + .../DefaultParameters.Export.js | 114 ++ .../EnumAssociatedValue.Export.js | 8 + .../BridgeJSLinkTests/EnumCase.Export.js | 8 + .../BridgeJSLinkTests/EnumNamespace.Export.js | 8 + .../EnumNamespace.Global.Export.js | 8 + .../BridgeJSLinkTests/EnumRawType.Export.js | 8 + .../GlobalGetter.ImportMacros.js | 8 + .../GlobalThisImports.ImportMacros.js | 8 + .../ImportedTypeInExportedInterface.Export.js | 8 + .../BridgeJSLinkTests/Interface.Import.js | 8 + .../InvalidPropertyNames.Import.js | 8 + .../BridgeJSLinkTests/MixedGlobal.Export.js | 8 + .../BridgeJSLinkTests/MixedModules.Export.js | 8 + .../BridgeJSLinkTests/MixedPrivate.Export.js | 8 + .../MultipleImportedTypes.Import.js | 8 + .../BridgeJSLinkTests/Namespaces.Export.js | 8 + .../Namespaces.Global.Export.js | 8 + .../BridgeJSLinkTests/Optionals.Export.js | 8 + .../PrimitiveParameters.Export.js | 8 + .../PrimitiveParameters.Import.js | 8 + .../PrimitiveReturn.Export.js | 8 + .../PrimitiveReturn.Import.js | 8 + .../BridgeJSLinkTests/PropertyTypes.Export.js | 8 + .../BridgeJSLinkTests/Protocol.Export.d.ts | 8 + .../BridgeJSLinkTests/Protocol.Export.js | 76 + .../BridgeJSLinkTests/ReExportFrom.Import.js | 8 + .../StaticFunctions.Export.js | 8 + .../StaticFunctions.Global.Export.js | 8 + .../StaticProperties.Export.js | 8 + .../StaticProperties.Global.Export.js | 8 + .../BridgeJSLinkTests/StringEnum.Import.js | 8 + .../StringParameter.Export.js | 8 + .../StringParameter.Import.js | 8 + .../BridgeJSLinkTests/StringReturn.Export.js | 8 + .../BridgeJSLinkTests/StringReturn.Import.js | 8 + .../BridgeJSLinkTests/SwiftClass.Export.js | 8 + .../BridgeJSLinkTests/SwiftClosure.Export.js | 8 + .../SwiftClosureImports.ImportMacros.js | 8 + .../BridgeJSLinkTests/SwiftStruct.Export.js | 8 + .../SwiftStructImports.ImportMacros.js | 8 + .../TS2SkeletonLike.Import.js | 8 + .../BridgeJSLinkTests/Throws.Export.js | 8 + .../BridgeJSLinkTests/TypeAlias.Import.js | 8 + .../TypeScriptClass.Import.js | 8 + .../BridgeJSLinkTests/UnsafePointer.Export.js | 8 + .../VoidParameterVoidReturn.Export.js | 8 + .../VoidParameterVoidReturn.Import.js | 8 + .../ExportSwiftTests/ArrayTypes.json | 983 +++++++++++++ .../ExportSwiftTests/ArrayTypes.swift | 694 +++++++++ .../ExportSwiftTests/DefaultParameters.json | 334 +++++ .../ExportSwiftTests/DefaultParameters.swift | 133 ++ .../ExportSwiftTests/Protocol.json | 96 +- .../ExportSwiftTests/Protocol.swift | 109 ++ .../JavaScriptKit/BridgeJSIntrinsics.swift | 24 + .../BridgeJS/Exporting-Swift-to-JavaScript.md | 1 + .../Exporting-Swift/Exporting-Swift-Array.md | 132 ++ .../Exporting-Swift-Default-Parameters.md | 2 +- .../BridgeJSRuntimeTests/ExportAPITests.swift | 144 ++ .../Generated/BridgeJS.swift | 858 +++++++++++ .../Generated/JavaScript/BridgeJS.json | 1283 +++++++++++++++++ Tests/prelude.mjs | 124 ++ 76 files changed, 7293 insertions(+), 14 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ArrayTypes.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Array.md diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index bfe414b76..5b0105bf6 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -130,10 +130,43 @@ public class ExportSwift { case .swiftStruct(let structName): typeNameForIntrinsic = structName liftingExpr = ExprSyntax("\(raw: structName).bridgeJSLiftParameter()") + case .array: + typeNameForIntrinsic = param.type.swiftType + liftingExpr = StackCodegen().liftExpression(for: param.type) case .optional(let wrappedType): - typeNameForIntrinsic = "Optional<\(wrappedType.swiftType)>" + if case .array(let elementType) = wrappedType { + let arrayLift = StackCodegen().liftArrayExpression(elementType: elementType) + let isSomeParam = argumentsToLift[0] + let swiftTypeName = elementType.swiftType + typeNameForIntrinsic = "Optional<[\(swiftTypeName)]>" + liftingExpr = ExprSyntax( + """ + { + if \(raw: isSomeParam) == 0 { + return Optional<[\(raw: swiftTypeName)]>.none + } else { + return \(arrayLift) + } + }() + """ + ) + } else if case .swiftProtocol(let protocolName) = wrappedType { + let wrapperName = "Any\(protocolName)" + typeNameForIntrinsic = "Optional<\(wrapperName)>" + liftingExpr = ExprSyntax( + "\(raw: typeNameForIntrinsic).bridgeJSLiftParameter(\(raw: argumentsToLift.joined(separator: ", ")))" + ) + } else { + typeNameForIntrinsic = "Optional<\(wrappedType.swiftType)>" + liftingExpr = ExprSyntax( + "\(raw: typeNameForIntrinsic).bridgeJSLiftParameter(\(raw: argumentsToLift.joined(separator: ", ")))" + ) + } + case .swiftProtocol(let protocolName): + let wrapperName = "Any\(protocolName)" + typeNameForIntrinsic = wrapperName liftingExpr = ExprSyntax( - "\(raw: typeNameForIntrinsic).bridgeJSLiftParameter(\(raw: argumentsToLift.joined(separator: ", ")))" + "\(raw: wrapperName).bridgeJSLiftParameter(\(raw: argumentsToLift.joined(separator: ", ")))" ) default: typeNameForIntrinsic = param.type.swiftType @@ -246,7 +279,8 @@ public class ExportSwift { let stackParamIndices = parameters.enumerated().compactMap { index, param -> Int? in switch param.type { case .swiftStruct, .optional(.swiftStruct), - .associatedValueEnum, .optional(.associatedValueEnum): + .associatedValueEnum, .optional(.associatedValueEnum), + .array: return index default: return nil @@ -319,9 +353,15 @@ public class ExportSwift { return } - if case .closure(let signature) = returnType { + switch returnType { + case .closure(let signature): append("return _BJS_Closure_\(raw: signature.mangleName).bridgeJSLower(ret)") - } else { + case .array, .optional(.array): + let stackCodegen = StackCodegen() + for stmt in stackCodegen.lowerStatements(for: returnType, accessor: "ret", varPrefix: "ret") { + append(stmt) + } + default: append("return ret.bridgeJSLowerReturn()") } } @@ -774,9 +814,10 @@ struct StackCodegen { return "\(raw: className).bridgeJSLiftParameter(_swift_js_pop_param_pointer())" case .unsafePointer: return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_param_pointer())" - case .swiftProtocol: - // Protocols are handled via JSObject - return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .swiftProtocol(let protocolName): + // Protocols use their Any wrapper type for lifting + let wrapperName = "Any\(protocolName)" + return "\(raw: wrapperName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" case .caseEnum(let enumName): return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" case .rawValueEnum(let enumName, let rawType): @@ -805,9 +846,28 @@ struct StackCodegen { return "()" case .closure: return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + case .array(let elementType): + return liftArrayExpression(elementType: elementType) } } + func liftArrayExpression(elementType: BridgeType) -> ExprSyntax { + let elementLift = liftExpression(for: elementType) + let swiftTypeName = elementType.swiftType + return """ + { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [\(raw: swiftTypeName)] = [] + __result.reserveCapacity(__count) + for _ in 0..<__count { + __result.append(\(elementLift)) + } + __result.reverse() + return __result + }() + """ + } + private func liftOptionalExpression(wrappedType: BridgeType) -> ExprSyntax { switch wrappedType { case .string: @@ -849,6 +909,19 @@ struct StackCodegen { "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" case .jsObject: return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + case .array(let elementType): + let arrayLift = liftArrayExpression(elementType: elementType) + let swiftTypeName = elementType.swiftType + return """ + { + let __isSome = _swift_js_pop_param_int32() + if __isSome == 0 { + return Optional<[\(raw: swiftTypeName)]>.none + } else { + return \(arrayLift) + } + }() + """ default: // Fallback for other optional types return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" @@ -886,8 +959,9 @@ struct StackCodegen { return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] case .unsafePointer: return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] - case .swiftProtocol: - return ["_swift_js_push_int(\(raw: accessor).bridgeJSLowerParameter())"] + case .swiftProtocol(let protocolName): + let wrapperName = "Any\(protocolName)" + return ["_swift_js_push_int((\(raw: accessor) as! \(raw: wrapperName)).bridgeJSLowerReturn())"] case .caseEnum: return ["_swift_js_push_int(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] case .rawValueEnum(_, let rawType): @@ -916,9 +990,34 @@ struct StackCodegen { return [] case .closure: return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] + case .array(let elementType): + return lowerArrayStatements(elementType: elementType, accessor: accessor, varPrefix: varPrefix) } } + private func lowerArrayStatements( + elementType: BridgeType, + accessor: String, + varPrefix: String + ) -> [CodeBlockItemSyntax] { + var statements: [CodeBlockItemSyntax] = [] + let elementVarName = "__bjs_elem_\(varPrefix)" + statements.append("for \(raw: elementVarName) in \(raw: accessor) {") + + let elementStatements = lowerStatements( + for: elementType, + accessor: elementVarName, + varPrefix: "\(varPrefix)_elem" + ) + for stmt in elementStatements { + statements.append(stmt) + } + + statements.append("}") + statements.append("_swift_js_push_array_length(Int32(\(raw: accessor).count))") + return statements + } + private func lowerOptionalStatements( wrappedType: BridgeType, accessor: String, @@ -985,6 +1084,8 @@ struct StackCodegen { return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] case .jsObject: return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerReturn())"] + case .array(let elementType): + return lowerArrayStatements(elementType: elementType, accessor: unwrappedVar, varPrefix: varPrefix) default: return ["preconditionFailure(\"BridgeJS: unsupported optional wrapped type\")"] } @@ -1552,6 +1653,7 @@ extension BridgeType { case .swiftProtocol(let name): return "Any\(name)" case .void: return "Void" case .optional(let wrappedType): return "Optional<\(wrappedType.swiftType)>" + case .array(let elementType): return "[\(elementType.swiftType)]" case .caseEnum(let name): return name case .rawValueEnum(let name, _): return name case .associatedValueEnum(let name): return name @@ -1609,6 +1711,8 @@ extension BridgeType { throw BridgeJSCoreError("Namespace enums are not supported to pass as parameters") case .closure: return LiftingIntrinsicInfo(parameters: [("callbackId", .i32)]) + case .array: + return LiftingIntrinsicInfo(parameters: []) } } @@ -1629,6 +1733,7 @@ extension BridgeType { static let associatedValueEnum = LoweringIntrinsicInfo(returnType: nil) static let swiftStruct = LoweringIntrinsicInfo(returnType: nil) static let optional = LoweringIntrinsicInfo(returnType: nil) + static let array = LoweringIntrinsicInfo(returnType: nil) } func loweringReturnInfo() throws -> LoweringIntrinsicInfo { @@ -1655,6 +1760,8 @@ extension BridgeType { throw BridgeJSCoreError("Namespace enums are not supported to pass as parameters") case .closure: return .swiftHeapObject + case .array: + return .array } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 176b46b66..8a6ad930b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -933,6 +933,13 @@ extension BridgeType { params.append(contentsOf: wrappedInfo.loweredParameters) return LoweringParameterInfo(loweredParameters: params) } + case .array: + switch context { + case .importTS: + throw BridgeJSCoreError("Array types are not yet supported in TypeScript imports") + case .exportSwift: + return LoweringParameterInfo(loweredParameters: []) + } } } @@ -1018,6 +1025,13 @@ extension BridgeType { let wrappedInfo = try wrappedType.liftingReturnInfo(context: context) return LiftingReturnInfo(valueToLift: wrappedInfo.valueToLift) } + case .array: + switch context { + case .importTS: + throw BridgeJSCoreError("Array types are not yet supported in TypeScript imports") + case .exportSwift: + return LiftingReturnInfo(valueToLift: nil) + } } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index e489a711a..ea79d3f3b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -157,6 +157,36 @@ public final class SwiftToSkeleton { return .optional(wrappedType) } } + // [T] + if let arrayType = type.as(ArrayTypeSyntax.self) { + if let elementType = lookupType(for: arrayType.element, errors: &errors) { + return .array(elementType) + } + } + // Array + if let identifierType = type.as(IdentifierTypeSyntax.self), + identifierType.name.text == "Array", + let genericArgs = identifierType.genericArgumentClause?.arguments, + genericArgs.count == 1, + let argType = TypeSyntax(genericArgs.first?.argument) + { + if let elementType = lookupType(for: argType, errors: &errors) { + return .array(elementType) + } + } + // Swift.Array + if let memberType = type.as(MemberTypeSyntax.self), + let baseType = memberType.baseType.as(IdentifierTypeSyntax.self), + baseType.name.text == "Swift", + memberType.name.text == "Array", + let genericArgs = memberType.genericArgumentClause?.arguments, + genericArgs.count == 1, + let argType = TypeSyntax(genericArgs.first?.argument) + { + if let elementType = lookupType(for: argType, errors: &errors) { + return .array(elementType) + } + } if let aliasDecl = typeDeclResolver.resolveTypeAlias(type) { if let resolvedType = lookupType(for: aliasDecl.initializer.value, errors: &errors) { return resolvedType @@ -479,7 +509,7 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { let expression = initClause.value // Function calls are checked later in extractDefaultValue (as constructors are allowed) - if expression.is(ArrayExprSyntax.self) { return false } + // Array literals are allowed but checked in extractArrayDefaultValue if expression.is(DictionaryExprSyntax.self) { return false } if expression.is(BinaryOperatorExprSyntax.self) { return false } if expression.is(ClosureExprSyntax.self) { return false } @@ -575,6 +605,10 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { return extractConstructorDefaultValue(from: funcCall, type: type) } + if let arrayExpr = expr.as(ArrayExprSyntax.self) { + return extractArrayDefaultValue(from: arrayExpr, type: type) + } + if let literalValue = extractLiteralValue(from: expr, type: type) { return literalValue } @@ -735,6 +769,43 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { return nil } + /// Extracts default value from an array literal expression + private func extractArrayDefaultValue( + from arrayExpr: ArrayExprSyntax, + type: BridgeType + ) -> DefaultValue? { + // Verify the type is an array type + let elementType: BridgeType? + switch type { + case .array(let element): + elementType = element + case .optional(.array(let element)): + elementType = element + default: + diagnose( + node: arrayExpr, + message: "Array literal is only valid for array parameters", + hint: "Parameter type should be an array like [Int] or [String]" + ) + return nil + } + + var elements: [DefaultValue] = [] + for element in arrayExpr.elements { + guard let elementValue = extractLiteralValue(from: element.expression, type: elementType) else { + diagnose( + node: element.expression, + message: "Array element must be a literal value", + hint: "Use simple literals like \"text\", 42, true, false in array elements" + ) + return nil + } + elements.append(elementValue) + } + + return .array(elements) + } + /// Shared parameter parsing logic used by functions, initializers, and protocol methods private func parseParameters( from parameterClause: FunctionParameterClauseSyntax, diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 743494916..794637d9e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -256,6 +256,8 @@ public struct BridgeJSLink { "let \(JSGlueVariableScope.reservedTmpRetPointers) = [];", "let \(JSGlueVariableScope.reservedTmpParamPointers) = [];", "let \(JSGlueVariableScope.reservedTmpStructCleanups) = [];", + "let \(JSGlueVariableScope.reservedTmpRetArrayLengths) = [];", + "let \(JSGlueVariableScope.reservedTmpParamArrayLengths) = [];", "const \(JSGlueVariableScope.reservedEnumHelpers) = {};", "const \(JSGlueVariableScope.reservedStructHelpers) = {};", "", @@ -439,7 +441,16 @@ public struct BridgeJSLink { printer.write("return \(JSGlueVariableScope.reservedTmpParamPointers).pop();") } printer.write("}") - + printer.write("bjs[\"swift_js_push_array_length\"] = function(len) {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpRetArrayLengths).push(len | 0);") + } + printer.write("}") + printer.write("bjs[\"swift_js_pop_param_array_length\"] = function() {") + printer.indent { + printer.write("return \(JSGlueVariableScope.reservedTmpParamArrayLengths).pop();") + } + printer.write("}") printer.write("bjs[\"swift_js_struct_cleanup\"] = function(cleanupId) {") printer.indent { printer.write("if (cleanupId === 0) { return; }") @@ -1431,6 +1442,14 @@ public struct BridgeJSLink { return name.components(separatedBy: ".").last ?? name case .optional(let wrapped): return "\(resolveTypeScriptType(wrapped, exportedSkeletons: exportedSkeletons)) | null" + case .array(let elementType): + let elementTypeStr = resolveTypeScriptType(elementType, exportedSkeletons: exportedSkeletons) + // Parenthesize compound types so `[]` binds correctly in TypeScript + // e.g. `(string | null)[]` not `string | null[]`, `((x: number) => void)[]` not `(x: number) => void[]` + if elementTypeStr.contains("|") || elementTypeStr.contains("=>") { + return "(\(elementTypeStr))[]" + } + return "\(elementTypeStr)[]" default: return type.tsType } @@ -3326,6 +3345,11 @@ enum DefaultValueUtils { "\(field.name): \(Self.format(field.value, as: format))" } return "{ \(fieldStrings.joined(separator: ", ")) }" + case .array(let elements): + let elementStrings = elements.map { element in + DefaultValueUtils.format(element, as: format) + } + return "[\(elementStrings.joined(separator: ", "))]" } } @@ -3410,6 +3434,12 @@ extension BridgeType { "arg\(index): \(param.tsType)" }.joined(separator: ", ") return "(\(paramTypes)) => \(signature.returnType.tsType)" + case .array(let elementType): + let inner = elementType.tsType + if inner.contains("|") || inner.contains("=>") { + return "(\(inner))[]" + } + return "\(inner)[]" } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index d5f47234d..c0282cd3c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -31,6 +31,8 @@ final class JSGlueVariableScope { static let reservedTmpRetPointers = "tmpRetPointers" static let reservedTmpParamPointers = "tmpParamPointers" static let reservedTmpStructCleanups = "tmpStructCleanups" + static let reservedTmpRetArrayLengths = "tmpRetArrayLengths" + static let reservedTmpParamArrayLengths = "tmpParamArrayLengths" static let reservedEnumHelpers = "enumHelpers" static let reservedStructHelpers = "structHelpers" @@ -60,6 +62,8 @@ final class JSGlueVariableScope { reservedTmpRetPointers, reservedTmpParamPointers, reservedTmpStructCleanups, + reservedTmpRetArrayLengths, + reservedTmpParamArrayLengths, reservedEnumHelpers, reservedStructHelpers, ] @@ -364,6 +368,24 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") resultExpr = structVar + case .array(let elementType): + let arrayVar = scope.variable("arrayValue") + printer.write("let \(arrayVar);") + printer.write("if (\(isSome)) {") + printer.indent { + // Lift array from stacks - reuse array lift return logic + let arrayLiftFragment = try! arrayLift(elementType: elementType) + let liftResults = arrayLiftFragment.printCode([], scope, printer, cleanupCode) + if let liftResult = liftResults.first { + printer.write("\(arrayVar) = \(liftResult);") + } + } + printer.write("} else {") + printer.indent { + printer.write("\(arrayVar) = null;") + } + printer.write("}") + resultExpr = arrayVar default: resultExpr = "\(isSome) ? \(wrappedValue) : null" } @@ -437,6 +459,23 @@ struct IntrinsicJSFragment: Sendable { case .rawValueEnum: // Raw value enums with optional - falls through to handle based on raw type return ["+\(isSomeVar)", "\(isSomeVar) ? \(value) : 0"] + case .array(let elementType): + let cleanupArrayVar = scope.variable("\(value)Cleanups") + printer.write("const \(cleanupArrayVar) = [];") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let arrayLowerFragment = try! arrayLower(elementType: elementType) + let arrayCleanup = CodeFragmentPrinter() + let _ = arrayLowerFragment.printCode([value], scope, printer, arrayCleanup) + if !arrayCleanup.lines.isEmpty { + for line in arrayCleanup.lines { + printer.write("\(cleanupArrayVar).push(() => { \(line) });") + } + } + } + printer.write("}") + cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") + return ["+\(isSomeVar)"] default: switch wrappedType { case .swiftHeapObject: @@ -567,6 +606,23 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(resultVar) = null;") } printer.write("}") + case .array(let elementType): + let isSomeVar = scope.variable("isSome") + printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("let \(resultVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let arrayLiftFragment = try! arrayLift(elementType: elementType) + let liftResults = arrayLiftFragment.printCode([], scope, printer, cleanupCode) + if let liftResult = liftResults.first { + printer.write("\(resultVar) = \(liftResult);") + } + } + printer.write("} else {") + printer.indent { + printer.write("\(resultVar) = null;") + } + printer.write("}") default: printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnString);") printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = undefined;") @@ -1349,6 +1405,8 @@ struct IntrinsicJSFragment: Sendable { ) case .namespaceEnum(let string): throw BridgeJSLinkError(message: "Namespace enums are not supported to be passed as parameters: \(string)") + case .array(let elementType): + return try arrayLower(elementType: elementType) } } @@ -1391,6 +1449,8 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Namespace enums are not supported to be returned from functions: \(string)" ) + case .array(let elementType): + return try arrayLift(elementType: elementType) } } @@ -1485,6 +1545,15 @@ struct IntrinsicJSFragment: Sendable { message: "Namespace enums are not supported to be passed as parameters to imported JS functions: \(string)" ) + case .array(let elementType): + switch context { + case .importTS: + throw BridgeJSLinkError( + message: "Arrays are not yet supported to be passed as parameters to imported JS functions" + ) + case .exportSwift: + return try arrayLift(elementType: elementType) + } } } @@ -1558,6 +1627,15 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Namespace enums are not supported to be returned from imported JS functions: \(string)" ) + case .array(let elementType): + switch context { + case .importTS: + throw BridgeJSLinkError( + message: "Arrays are not yet supported to be returned from imported JS functions" + ) + case .exportSwift: + return try arrayLower(elementType: elementType) + } } } @@ -2055,6 +2133,453 @@ struct IntrinsicJSFragment: Sendable { ) } + // MARK: - Array Helpers + + /// Lowers an array from JS to Swift by iterating elements and pushing to stacks + static func arrayLower(elementType: BridgeType) throws -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: ["arr"], + printCode: { arguments, scope, printer, cleanupCode in + let arr = arguments[0] + let cleanupArrayVar = scope.variable("arrayCleanups") + + printer.write("const \(cleanupArrayVar) = [];") + let elemVar = scope.variable("elem") + printer.write("for (const \(elemVar) of \(arr)) {") + printer.indent { + let elementFragment = try! arrayElementLowerFragment(elementType: elementType) + let elementCleanup = CodeFragmentPrinter() + let _ = elementFragment.printCode([elemVar], scope, printer, elementCleanup) + if !elementCleanup.lines.isEmpty { + printer.write("\(cleanupArrayVar).push(() => {") + printer.indent { + for line in elementCleanup.lines { + printer.write(line) + } + } + printer.write("});") + } + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamArrayLengths).push(\(arr).length);") + cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") + return [] + } + ) + } + + /// Lifts an array from Swift to JS by popping elements from stacks + static func arrayLift(elementType: BridgeType) throws -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanupCode in + let resultVar = scope.variable("arrayResult") + let lenVar = scope.variable("arrayLen") + let iVar = scope.variable("i") + + printer.write("const \(lenVar) = \(JSGlueVariableScope.reservedTmpRetArrayLengths).pop();") + printer.write("const \(resultVar) = [];") + printer.write("for (let \(iVar) = 0; \(iVar) < \(lenVar); \(iVar)++) {") + printer.indent { + let elementFragment = try! arrayElementRaiseFragment(elementType: elementType) + let elementResults = elementFragment.printCode([], scope, printer, cleanupCode) + if let elementExpr = elementResults.first { + printer.write("\(resultVar).push(\(elementExpr));") + } + } + printer.write("}") + printer.write("\(resultVar).reverse();") + return [resultVar] + } + ) + } + + private static func arrayElementRaiseFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { + switch elementType { + case .string: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let strVar = scope.variable("string") + printer.write("const \(strVar) = \(JSGlueVariableScope.reservedTmpRetStrings).pop();") + return [strVar] + } + ) + case .bool: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let bVar = scope.variable("bool") + printer.write("const \(bVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop() !== 0;") + return [bVar] + } + ) + case .int: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let iVar = scope.variable("int") + printer.write("const \(iVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + return [iVar] + } + ) + case .float: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let fVar = scope.variable("f32") + printer.write("const \(fVar) = \(JSGlueVariableScope.reservedTmpRetF32s).pop();") + return [fVar] + } + ) + case .double: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let dVar = scope.variable("f64") + printer.write("const \(dVar) = \(JSGlueVariableScope.reservedTmpRetF64s).pop();") + return [dVar] + } + ) + case .swiftStruct(let fullName): + let structBase = fullName.components(separatedBy: ".").last ?? fullName + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let resultVar = scope.variable("struct") + printer.write( + "const \(resultVar) = structHelpers.\(structBase).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + ) + return [resultVar] + } + ) + case .caseEnum: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let varName = scope.variable("caseId") + printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + return [varName] + } + ) + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let varName = scope.variable("rawValue") + printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetStrings).pop();") + return [varName] + } + ) + default: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let varName = scope.variable("rawValue") + printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + return [varName] + } + ) + } + case .associatedValueEnum(let fullName): + let base = fullName.components(separatedBy: ".").last ?? fullName + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let caseIdVar = scope.variable("caseId") + let resultVar = scope.variable("enumValue") + printer.write("const \(caseIdVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write( + "const \(resultVar) = enumHelpers.\(base).lift(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + ) + return [resultVar] + } + ) + case .swiftHeapObject(let className): + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let ptrVar = scope.variable("ptr") + let objVar = scope.variable("obj") + printer.write("const \(ptrVar) = \(JSGlueVariableScope.reservedTmpRetPointers).pop();") + printer.write("const \(objVar) = \(className).__construct(\(ptrVar));") + return [objVar] + } + ) + case .jsObject, .swiftProtocol: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let idVar = scope.variable("objId") + let objVar = scope.variable("obj") + printer.write("const \(idVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(objVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(idVar));") + printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") + return [objVar] + } + ) + case .array(let innerElementType): + return try! arrayLift(elementType: innerElementType) + case .optional(let wrappedType): + return try optionalElementRaiseFragment(wrappedType: wrappedType) + case .unsafePointer: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let pVar = scope.variable("pointer") + printer.write("const \(pVar) = \(JSGlueVariableScope.reservedTmpRetPointers).pop();") + return [pVar] + } + ) + case .void, .closure, .namespaceEnum: + throw BridgeJSLinkError(message: "Unsupported array element type: \(elementType)") + } + } + + private static func arrayElementLowerFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { + switch elementType { + case .string: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let bytesVar = scope.variable("bytes") + let idVar = scope.variable("id") + printer.write("const \(bytesVar) = textEncoder.encode(\(value));") + printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") + return [] + } + ) + case .bool: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(arguments[0]) ? 1 : 0);") + return [] + } + ) + case .int: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(arguments[0]) | 0));") + return [] + } + ) + case .float: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(Math.fround(\(arguments[0])));") + return [] + } + ) + case .double: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(arguments[0]));") + return [] + } + ) + case .swiftStruct(let fullName): + let structBase = fullName.components(separatedBy: ".").last ?? fullName + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let cleanupVar = scope.variable("cleanup") + printer.write("const { cleanup: \(cleanupVar) } = structHelpers.\(structBase).lower(\(value));") + cleanup.write("if (\(cleanupVar)) { \(cleanupVar)(); }") + return [] + } + ) + case .caseEnum: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(arguments[0]) | 0));") + return [] + } + ) + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let bytesVar = scope.variable("bytes") + let idVar = scope.variable("id") + printer.write("const \(bytesVar) = textEncoder.encode(\(value));") + printer.write( + "const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") + return [] + } + ) + default: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(arguments[0]) | 0));") + return [] + } + ) + } + case .associatedValueEnum(let fullName): + let base = fullName.components(separatedBy: ".").last ?? fullName + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let caseIdVar = scope.variable("caseId") + let cleanupVar = scope.variable("enumCleanup") + printer.write( + "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(value));" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(caseIdVar));") + cleanup.write("if (\(cleanupVar)) { \(cleanupVar)(); }") + return [] + } + ) + case .swiftHeapObject: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(\(arguments[0]).pointer);") + return [] + } + ) + case .jsObject: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let idVar = scope.variable("objId") + printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") + return [] + } + ) + case .array(let innerElementType): + return try! arrayLower(elementType: innerElementType) + case .optional(let wrappedType): + return try optionalElementLowerFragment(wrappedType: wrappedType) + case .swiftProtocol: + // Same as jsObject but no cleanup — Swift's AnyProtocol wrapper releases via deinit + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let idVar = scope.variable("objId") + printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + return [] + } + ) + case .unsafePointer: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push((\(arguments[0]) | 0));") + return [] + } + ) + case .void, .closure, .namespaceEnum: + throw BridgeJSLinkError(message: "Unsupported array element type for lowering: \(elementType)") + } + } + + private static func optionalElementRaiseFragment(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let isSomeVar = scope.variable("isSome") + let resultVar = scope.variable("optValue") + + printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("let \(resultVar);") + printer.write("if (\(isSomeVar) === 0) {") + printer.indent { + printer.write("\(resultVar) = null;") + } + printer.write("} else {") + printer.indent { + let innerFragment = try! arrayElementRaiseFragment(elementType: wrappedType) + let innerResults = innerFragment.printCode([], scope, printer, cleanup) + if let innerResult = innerResults.first { + printer.write("\(resultVar) = \(innerResult);") + } else { + printer.write("\(resultVar) = undefined;") + } + } + printer.write("}") + + return [resultVar] + } + ) + } + + private static func optionalElementLowerFragment(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let isSomeVar = scope.variable("isSome") + + printer.write("const \(isSomeVar) = \(value) != null ? 1 : 0;") + // Cleanup is written inside the if block so retained id is in scope + let localCleanupWriter = CodeFragmentPrinter() + printer.write("if (\(isSomeVar)) {") + printer.indent { + let innerFragment = try! arrayElementLowerFragment(elementType: wrappedType) + let _ = innerFragment.printCode([value], scope, printer, localCleanupWriter) + let localCleanupLines = localCleanupWriter.lines.filter { + !$0.trimmingCharacters(in: .whitespaces).isEmpty + } + if !localCleanupLines.isEmpty { + let localCleanupCode = localCleanupLines.joined(separator: " ") + printer.write("arrayCleanups.push(() => { \(localCleanupCode) });") + } + } + printer.write("} else {") + printer.indent { + // Push placeholders so Swift can unconditionally pop value slots + switch wrappedType { + case .float: + printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(0.0);") + case .double: + printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(0.0);") + case .swiftStruct: + // No placeholder — Swift only pops struct fields when isSome=1 + break + case .string, .rawValueEnum(_, .string): + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + case .swiftHeapObject: + printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(0);") + default: + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + } + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar));") + + return [] + } + ) + } + static func structHelper(structDefinition: ExportedStruct, allStructs: [ExportedStruct]) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["structName"], @@ -2663,6 +3188,8 @@ struct IntrinsicJSFragment: Sendable { return [] } ) + case .array(let elementType): + return try! arrayLower(elementType: elementType) } } @@ -2927,6 +3454,8 @@ struct IntrinsicJSFragment: Sendable { return [] } ) + case .array(let elementType): + return try! arrayLift(elementType: elementType) } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index c8fc84ec4..d2f60cc4c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -130,6 +130,7 @@ public enum BridgeType: Codable, Equatable, Hashable, Sendable { case int, float, double, string, bool, jsObject(String?), swiftHeapObject(String), void case unsafePointer(UnsafePointerType) indirect case optional(BridgeType) + indirect case array(BridgeType) case caseEnum(String) case rawValueEnum(String, SwiftEnumRawType) case associatedValueEnum(String) @@ -202,6 +203,7 @@ public enum DefaultValue: Codable, Equatable, Sendable { case object(String) // className for parameterless constructor case objectWithArguments(String, [DefaultValue]) // className, constructor argument values case structLiteral(String, [DefaultValueField]) // structName, field name/value pairs + indirect case array([DefaultValue]) // array literal with element values } public struct Parameter: Codable, Equatable, Sendable { @@ -914,6 +916,9 @@ extension BridgeType { case .closure: // Closures pass callback ID as Int32 return .i32 + case .array: + // Arrays use stack-based return with length prefix (no direct WASM return type) + return nil } } @@ -972,6 +977,9 @@ extension BridgeType { ? "y" : signature.parameters.map { $0.mangleTypeName }.joined() return "K\(params)_\(signature.returnType.mangleTypeName)" + case .array(let elementType): + // Array mangling: "Sa" prefix followed by element type + return "Sa\(elementType.mangleTypeName)" } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ArrayTypes.swift new file mode 100644 index 000000000..8454b7520 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ArrayTypes.swift @@ -0,0 +1,56 @@ +@JS struct Point { + var x: Double + var y: Double +} + +@JS enum Direction { + case north + case south + case east + case west +} + +@JS enum Status: Int { + case pending = 0 + case active = 1 + case completed = 2 +} + +@JS class Item { + var name: String + + init(name: String) { + self.name = name + } +} + +@JS func processIntArray(_ values: [Int]) -> [Int] +@JS func processStringArray(_ values: [String]) -> [String] +@JS func processDoubleArray(_ values: [Double]) -> [Double] +@JS func processBoolArray(_ values: [Bool]) -> [Bool] + +@JS func processPointArray(_ points: [Point]) -> [Point] + +@JS func processDirectionArray(_ directions: [Direction]) -> [Direction] +@JS func processStatusArray(_ statuses: [Status]) -> [Status] + +@JS func sumIntArray(_ values: [Int]) -> Int +@JS func findFirstPoint(_ points: [Point], matching: String) -> Point + +@JS func processUnsafeRawPointerArray(_ values: [UnsafeRawPointer]) -> [UnsafeRawPointer] +@JS func processUnsafeMutableRawPointerArray(_ values: [UnsafeMutableRawPointer]) -> [UnsafeMutableRawPointer] +@JS func processOpaquePointerArray(_ values: [OpaquePointer]) -> [OpaquePointer] + +@JS func processOptionalIntArray(_ values: [Int?]) -> [Int?] +@JS func processOptionalStringArray(_ values: [String?]) -> [String?] +@JS func processOptionalArray(_ values: [Int]?) -> [Int]? +@JS func processOptionalPointArray(_ points: [Point?]) -> [Point?] +@JS func processOptionalDirectionArray(_ directions: [Direction?]) -> [Direction?] +@JS func processOptionalStatusArray(_ statuses: [Status?]) -> [Status?] + +@JS func processNestedIntArray(_ values: [[Int]]) -> [[Int]] +@JS func processNestedStringArray(_ values: [[String]]) -> [[String]] +@JS func processNestedPointArray(_ points: [[Point]]) -> [[Point]] + +@JS func processItemArray(_ items: [Item]) -> [Item] +@JS func processNestedItemArray(_ items: [[Item]]) -> [[Item]] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/DefaultParameters.swift index 73274ad5c..08dcde096 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/DefaultParameters.swift @@ -73,3 +73,15 @@ @JS func multiply(a: Double, b: Double) -> Double @JS static func subtract(a: Double, b: Double = 5.0) -> Double } + +// Array default values +@JS public func testIntArrayDefault(values: [Int] = [1, 2, 3]) -> [Int] +@JS public func testStringArrayDefault(names: [String] = ["a", "b", "c"]) -> [String] +@JS public func testDoubleArrayDefault(values: [Double] = [1.5, 2.5, 3.5]) -> [Double] +@JS public func testBoolArrayDefault(flags: [Bool] = [true, false, true]) -> [Bool] +@JS public func testEmptyArrayDefault(items: [Int] = []) -> [Int] +@JS public func testMixedWithArrayDefault( + name: String = "test", + values: [Int] = [10, 20, 30], + enabled: Bool = true +) -> String diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift index 689f4a355..fbbad0615 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift @@ -96,3 +96,21 @@ import JavaScriptKit delegate.onHelperUpdated(helper) } } + +// Protocol array support +@JS class DelegateManager { + @JS + var delegates: [MyViewControllerDelegate] + + @JS init(delegates: [MyViewControllerDelegate]) { + self.delegates = delegates + } + + @JS func notifyAll() { + for delegate in delegates { + delegate.onSomethingHappened() + } + } +} + +@JS func processDelegates(_ delegates: [MyViewControllerDelegate]) -> [MyViewControllerDelegate] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js index 84af4bccb..e0b1c0561 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.d.ts new file mode 100644 index 000000000..988626f3e --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.d.ts @@ -0,0 +1,76 @@ +// 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 const DirectionValues: { + readonly North: 0; + readonly South: 1; + readonly East: 2; + readonly West: 3; +}; +export type DirectionTag = typeof DirectionValues[keyof typeof DirectionValues]; + +export const StatusValues: { + readonly Pending: 0; + readonly Active: 1; + readonly Completed: 2; +}; +export type StatusTag = typeof StatusValues[keyof typeof StatusValues]; + +export interface Point { + x: number; + y: number; +} +export type DirectionObject = typeof DirectionValues; + +export type StatusObject = typeof StatusValues; + +/// 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 Item extends SwiftHeapObject { +} +export type Exports = { + Item: { + } + processIntArray(values: number[]): number[]; + processStringArray(values: string[]): string[]; + processDoubleArray(values: number[]): number[]; + processBoolArray(values: boolean[]): boolean[]; + processPointArray(points: Point[]): Point[]; + processDirectionArray(directions: DirectionTag[]): DirectionTag[]; + processStatusArray(statuses: StatusTag[]): StatusTag[]; + sumIntArray(values: number[]): number; + findFirstPoint(points: Point[], matching: string): Point; + processUnsafeRawPointerArray(values: number[]): number[]; + processUnsafeMutableRawPointerArray(values: number[]): number[]; + processOpaquePointerArray(values: number[]): number[]; + processOptionalIntArray(values: (number | null)[]): (number | null)[]; + processOptionalStringArray(values: (string | null)[]): (string | null)[]; + processOptionalArray(values: number[] | null): number[] | null; + processOptionalPointArray(points: (Point | null)[]): (Point | null)[]; + processOptionalDirectionArray(directions: (DirectionTag | null)[]): (DirectionTag | null)[]; + processOptionalStatusArray(statuses: (StatusTag | null)[]): (StatusTag | null)[]; + processNestedIntArray(values: number[][]): number[][]; + processNestedStringArray(values: string[][]): string[][]; + processNestedPointArray(points: Point[][]): Point[][]; + processItemArray(items: Item[]): Item[]; + processNestedItemArray(items: Item[][]): Item[][]; + Direction: DirectionObject + Status: StatusObject +} +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/ArrayTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js new file mode 100644 index 000000000..9416bb546 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js @@ -0,0 +1,845 @@ +// 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 const DirectionValues = { + North: 0, + South: 1, + East: 2, + West: 3, +}; + +export const StatusValues = { + Pending: 0, + Active: 1, + Completed: 2, +}; + +export async function createInstantiator(options, swift) { + let instance; + let memory; + let setException; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + const __bjs_createPointHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + tmpParamF64s.push(value.x); + tmpParamF64s.push(value.y); + return { cleanup: undefined }; + }, + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + const f64 = tmpRetF64s.pop(); + const f641 = tmpRetF64s.pop(); + return { x: f641, y: f64 }; + } + }); + }; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_int"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_param_int32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_param_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_param_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_param_pointer"] = function() { + return tmpParamPointers.pop(); + } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.pop(); + } + } + bjs["swift_js_struct_lower_Point"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.Point.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_lift_Point"] = function() { + const value = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } + 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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_Item_wrap"] = function(pointer) { + const obj = Item.__construct(pointer); + return swift.memory.retain(obj); + }; + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class Item extends SwiftHeapObject { + 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) { + const arrayCleanups = []; + for (const elem of values) { + tmpParamInts.push((elem | 0)); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_processIntArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const int = tmpRetInts.pop(); + arrayResult.push(int); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processStringArray: function bjs_processStringArray(values) { + const arrayCleanups = []; + for (const elem of values) { + const bytes = textEncoder.encode(elem); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + arrayCleanups.push(() => { + swift.memory.release(id); + }); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_processStringArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const string = tmpRetStrings.pop(); + arrayResult.push(string); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processDoubleArray: function bjs_processDoubleArray(values) { + const arrayCleanups = []; + for (const elem of values) { + tmpParamF64s.push(elem); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_processDoubleArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const f64 = tmpRetF64s.pop(); + arrayResult.push(f64); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processBoolArray: function bjs_processBoolArray(values) { + const arrayCleanups = []; + for (const elem of values) { + tmpParamInts.push(elem ? 1 : 0); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_processBoolArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const bool = tmpRetInts.pop() !== 0; + arrayResult.push(bool); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processPointArray: function bjs_processPointArray(points) { + const arrayCleanups = []; + for (const elem of points) { + const { cleanup: cleanup } = structHelpers.Point.lower(elem); + arrayCleanups.push(() => { + if (cleanup) { cleanup(); } + }); + } + tmpParamArrayLengths.push(points.length); + instance.exports.bjs_processPointArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const struct = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + arrayResult.push(struct); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processDirectionArray: function bjs_processDirectionArray(directions) { + const arrayCleanups = []; + for (const elem of directions) { + tmpParamInts.push((elem | 0)); + } + tmpParamArrayLengths.push(directions.length); + instance.exports.bjs_processDirectionArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const caseId = tmpRetInts.pop(); + arrayResult.push(caseId); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processStatusArray: function bjs_processStatusArray(statuses) { + const arrayCleanups = []; + for (const elem of statuses) { + tmpParamInts.push((elem | 0)); + } + tmpParamArrayLengths.push(statuses.length); + instance.exports.bjs_processStatusArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const rawValue = tmpRetInts.pop(); + arrayResult.push(rawValue); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + sumIntArray: function bjs_sumIntArray(values) { + const arrayCleanups = []; + for (const elem of values) { + tmpParamInts.push((elem | 0)); + } + tmpParamArrayLengths.push(values.length); + const ret = instance.exports.bjs_sumIntArray(); + for (const cleanup of arrayCleanups) { cleanup(); } + return ret; + }, + findFirstPoint: function bjs_findFirstPoint(points, matching) { + const arrayCleanups = []; + for (const elem of points) { + const { cleanup: cleanup } = structHelpers.Point.lower(elem); + arrayCleanups.push(() => { + if (cleanup) { cleanup(); } + }); + } + tmpParamArrayLengths.push(points.length); + const matchingBytes = textEncoder.encode(matching); + const matchingId = swift.memory.retain(matchingBytes); + instance.exports.bjs_findFirstPoint(matchingId, matchingBytes.length); + const structValue = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + for (const cleanup of arrayCleanups) { cleanup(); } + swift.memory.release(matchingId); + return structValue; + }, + processUnsafeRawPointerArray: function bjs_processUnsafeRawPointerArray(values) { + const arrayCleanups = []; + for (const elem of values) { + tmpParamPointers.push((elem | 0)); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_processUnsafeRawPointerArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const pointer = tmpRetPointers.pop(); + arrayResult.push(pointer); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processUnsafeMutableRawPointerArray: function bjs_processUnsafeMutableRawPointerArray(values) { + const arrayCleanups = []; + for (const elem of values) { + tmpParamPointers.push((elem | 0)); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_processUnsafeMutableRawPointerArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const pointer = tmpRetPointers.pop(); + arrayResult.push(pointer); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processOpaquePointerArray: function bjs_processOpaquePointerArray(values) { + const arrayCleanups = []; + for (const elem of values) { + tmpParamPointers.push((elem | 0)); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_processOpaquePointerArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const pointer = tmpRetPointers.pop(); + arrayResult.push(pointer); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processOptionalIntArray: function bjs_processOptionalIntArray(values) { + const arrayCleanups = []; + for (const elem of values) { + const isSome = elem != null ? 1 : 0; + if (isSome) { + tmpParamInts.push((elem | 0)); + } else { + tmpParamInts.push(0); + } + tmpParamInts.push(isSome); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_processOptionalIntArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const isSome1 = tmpRetInts.pop(); + let optValue; + if (isSome1 === 0) { + optValue = null; + } else { + const int = tmpRetInts.pop(); + optValue = int; + } + arrayResult.push(optValue); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processOptionalStringArray: function bjs_processOptionalStringArray(values) { + const arrayCleanups = []; + for (const elem of values) { + const isSome = elem != null ? 1 : 0; + if (isSome) { + const bytes = textEncoder.encode(elem); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + arrayCleanups.push(() => { swift.memory.release(id); }); + } else { + tmpParamInts.push(0); + tmpParamInts.push(0); + } + tmpParamInts.push(isSome); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_processOptionalStringArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const isSome1 = tmpRetInts.pop(); + let optValue; + if (isSome1 === 0) { + optValue = null; + } else { + const string = tmpRetStrings.pop(); + optValue = string; + } + arrayResult.push(optValue); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processOptionalArray: function bjs_processOptionalArray(values) { + const isSome = values != null; + const valuesCleanups = []; + if (isSome) { + const arrayCleanups = []; + for (const elem of values) { + tmpParamInts.push((elem | 0)); + } + tmpParamArrayLengths.push(values.length); + valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); + } + instance.exports.bjs_processOptionalArray(+isSome); + const isSome1 = tmpRetInts.pop(); + let optResult; + if (isSome1) { + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const int = tmpRetInts.pop(); + arrayResult.push(int); + } + arrayResult.reverse(); + optResult = arrayResult; + } else { + optResult = null; + } + for (const cleanup of valuesCleanups) { cleanup(); } + return optResult; + }, + processOptionalPointArray: function bjs_processOptionalPointArray(points) { + const arrayCleanups = []; + for (const elem of points) { + const isSome = elem != null ? 1 : 0; + if (isSome) { + const { cleanup: cleanup } = structHelpers.Point.lower(elem); + arrayCleanups.push(() => { if (cleanup) { cleanup(); } }); + } else { + } + tmpParamInts.push(isSome); + } + tmpParamArrayLengths.push(points.length); + instance.exports.bjs_processOptionalPointArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const isSome1 = tmpRetInts.pop(); + let optValue; + if (isSome1 === 0) { + optValue = null; + } else { + const struct = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optValue = struct; + } + arrayResult.push(optValue); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processOptionalDirectionArray: function bjs_processOptionalDirectionArray(directions) { + const arrayCleanups = []; + for (const elem of directions) { + const isSome = elem != null ? 1 : 0; + if (isSome) { + tmpParamInts.push((elem | 0)); + } else { + tmpParamInts.push(0); + } + tmpParamInts.push(isSome); + } + tmpParamArrayLengths.push(directions.length); + instance.exports.bjs_processOptionalDirectionArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const isSome1 = tmpRetInts.pop(); + let optValue; + if (isSome1 === 0) { + optValue = null; + } else { + const caseId = tmpRetInts.pop(); + optValue = caseId; + } + arrayResult.push(optValue); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processOptionalStatusArray: function bjs_processOptionalStatusArray(statuses) { + const arrayCleanups = []; + for (const elem of statuses) { + const isSome = elem != null ? 1 : 0; + if (isSome) { + tmpParamInts.push((elem | 0)); + } else { + tmpParamInts.push(0); + } + tmpParamInts.push(isSome); + } + tmpParamArrayLengths.push(statuses.length); + instance.exports.bjs_processOptionalStatusArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const isSome1 = tmpRetInts.pop(); + let optValue; + if (isSome1 === 0) { + optValue = null; + } else { + const rawValue = tmpRetInts.pop(); + optValue = rawValue; + } + arrayResult.push(optValue); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processNestedIntArray: function bjs_processNestedIntArray(values) { + const arrayCleanups = []; + for (const elem of values) { + const arrayCleanups1 = []; + for (const elem1 of elem) { + tmpParamInts.push((elem1 | 0)); + } + tmpParamArrayLengths.push(elem.length); + arrayCleanups.push(() => { + for (const cleanup of arrayCleanups1) { cleanup(); } + }); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_processNestedIntArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const arrayLen1 = tmpRetArrayLengths.pop(); + const arrayResult1 = []; + for (let i1 = 0; i1 < arrayLen1; i1++) { + const int = tmpRetInts.pop(); + arrayResult1.push(int); + } + arrayResult1.reverse(); + arrayResult.push(arrayResult1); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processNestedStringArray: function bjs_processNestedStringArray(values) { + const arrayCleanups = []; + for (const elem of values) { + const arrayCleanups1 = []; + for (const elem1 of elem) { + const bytes = textEncoder.encode(elem1); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + arrayCleanups1.push(() => { + swift.memory.release(id); + }); + } + tmpParamArrayLengths.push(elem.length); + arrayCleanups.push(() => { + for (const cleanup of arrayCleanups1) { cleanup(); } + }); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_processNestedStringArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const arrayLen1 = tmpRetArrayLengths.pop(); + const arrayResult1 = []; + for (let i1 = 0; i1 < arrayLen1; i1++) { + const string = tmpRetStrings.pop(); + arrayResult1.push(string); + } + arrayResult1.reverse(); + arrayResult.push(arrayResult1); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processNestedPointArray: function bjs_processNestedPointArray(points) { + const arrayCleanups = []; + for (const elem of points) { + const arrayCleanups1 = []; + for (const elem1 of elem) { + const { cleanup: cleanup } = structHelpers.Point.lower(elem1); + arrayCleanups1.push(() => { + if (cleanup) { cleanup(); } + }); + } + tmpParamArrayLengths.push(elem.length); + arrayCleanups.push(() => { + for (const cleanup of arrayCleanups1) { cleanup(); } + }); + } + tmpParamArrayLengths.push(points.length); + instance.exports.bjs_processNestedPointArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const arrayLen1 = tmpRetArrayLengths.pop(); + const arrayResult1 = []; + for (let i1 = 0; i1 < arrayLen1; i1++) { + const struct = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + arrayResult1.push(struct); + } + arrayResult1.reverse(); + arrayResult.push(arrayResult1); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processItemArray: function bjs_processItemArray(items) { + const arrayCleanups = []; + for (const elem of items) { + tmpParamPointers.push(elem.pointer); + } + tmpParamArrayLengths.push(items.length); + instance.exports.bjs_processItemArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const ptr = tmpRetPointers.pop(); + const obj = Item.__construct(ptr); + arrayResult.push(obj); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processNestedItemArray: function bjs_processNestedItemArray(items) { + const arrayCleanups = []; + for (const elem of items) { + const arrayCleanups1 = []; + for (const elem1 of elem) { + tmpParamPointers.push(elem1.pointer); + } + tmpParamArrayLengths.push(elem.length); + arrayCleanups.push(() => { + for (const cleanup of arrayCleanups1) { cleanup(); } + }); + } + tmpParamArrayLengths.push(items.length); + instance.exports.bjs_processNestedItemArray(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const arrayLen1 = tmpRetArrayLengths.pop(); + const arrayResult1 = []; + for (let i1 = 0; i1 < arrayLen1; i1++) { + const ptr = tmpRetPointers.pop(); + const obj = Item.__construct(ptr); + arrayResult1.push(obj); + } + arrayResult1.reverse(); + arrayResult.push(arrayResult1); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + Direction: DirectionValues, + Status: StatusValues, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js index 916eafb1f..cffc92db4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js index 4e47329f0..9259ae32d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.d.ts index c024ecfb6..ac5658eb3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.d.ts @@ -116,6 +116,32 @@ export type Exports = { * @param point - Optional parameter (default: { name: "default", value: 42, enabled: true }) */ testOptionalStructWithValueDefault(point?: Config | null): Config | null; + /** + * @param values - Optional parameter (default: [1, 2, 3]) + */ + testIntArrayDefault(values?: number[]): number[]; + /** + * @param names - Optional parameter (default: ["a", "b", "c"]) + */ + testStringArrayDefault(names?: string[]): string[]; + /** + * @param values - Optional parameter (default: [1.5, 2.5, 3.5]) + */ + testDoubleArrayDefault(values?: number[]): number[]; + /** + * @param flags - Optional parameter (default: [true, false, true]) + */ + testBoolArrayDefault(flags?: boolean[]): boolean[]; + /** + * @param items - Optional parameter (default: []) + */ + testEmptyArrayDefault(items?: number[]): number[]; + /** + * @param name - Optional parameter (default: "test") + * @param values - Optional parameter (default: [10, 20, 30]) + * @param enabled - Optional parameter (default: true) + */ + testMixedWithArrayDefault(name?: string, values?: number[], enabled?: boolean): string; Status: StatusObject MathOperations: { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index 7be003943..dd0f2af21 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -35,6 +35,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -154,6 +156,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; @@ -553,6 +561,112 @@ export async function createInstantiator(options, swift) { if (pointCleanup) { pointCleanup(); } return optResult; }, + testIntArrayDefault: function bjs_testIntArrayDefault(values = [1, 2, 3]) { + const arrayCleanups = []; + for (const elem of values) { + tmpParamInts.push((elem | 0)); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_testIntArrayDefault(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const int = tmpRetInts.pop(); + arrayResult.push(int); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + testStringArrayDefault: function bjs_testStringArrayDefault(names = ["a", "b", "c"]) { + const arrayCleanups = []; + for (const elem of names) { + const bytes = textEncoder.encode(elem); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + arrayCleanups.push(() => { + swift.memory.release(id); + }); + } + tmpParamArrayLengths.push(names.length); + instance.exports.bjs_testStringArrayDefault(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const string = tmpRetStrings.pop(); + arrayResult.push(string); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + testDoubleArrayDefault: function bjs_testDoubleArrayDefault(values = [1.5, 2.5, 3.5]) { + const arrayCleanups = []; + for (const elem of values) { + tmpParamF64s.push(elem); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_testDoubleArrayDefault(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const f64 = tmpRetF64s.pop(); + arrayResult.push(f64); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + testBoolArrayDefault: function bjs_testBoolArrayDefault(flags = [true, false, true]) { + const arrayCleanups = []; + for (const elem of flags) { + tmpParamInts.push(elem ? 1 : 0); + } + tmpParamArrayLengths.push(flags.length); + instance.exports.bjs_testBoolArrayDefault(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const bool = tmpRetInts.pop() !== 0; + arrayResult.push(bool); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + testEmptyArrayDefault: function bjs_testEmptyArrayDefault(items = []) { + const arrayCleanups = []; + for (const elem of items) { + tmpParamInts.push((elem | 0)); + } + tmpParamArrayLengths.push(items.length); + instance.exports.bjs_testEmptyArrayDefault(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const int = tmpRetInts.pop(); + arrayResult.push(int); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + testMixedWithArrayDefault: function bjs_testMixedWithArrayDefault(name = "test", values = [10, 20, 30], enabled = true) { + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + const arrayCleanups = []; + for (const elem of values) { + tmpParamInts.push((elem | 0)); + } + tmpParamArrayLengths.push(values.length); + instance.exports.bjs_testMixedWithArrayDefault(nameId, nameBytes.length, enabled); + const ret = tmpRetString; + tmpRetString = undefined; + swift.memory.release(nameId); + for (const cleanup of arrayCleanups) { cleanup(); } + return ret; + }, Status: StatusValues, MathOperations: { init: function(baseValue = 0.0) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index 3c7baa5b9..c22bd2b18 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -504,6 +504,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -576,6 +578,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js index 79fba73b0..1adfe67bf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js @@ -53,6 +53,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -125,6 +127,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index 4c09e3bd9..ceb2b2fd5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -54,6 +54,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -126,6 +128,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js index 584788f20..94e886cb5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js @@ -73,6 +73,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -145,6 +147,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js index 63f18d4d5..896b925f3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js @@ -104,6 +104,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -176,6 +178,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js index afcdddbd4..d0d035a38 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js index b671728af..6a5969915 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js index 3cfc76bb3..ba9024495 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js index 41b006340..2dd3e0cee 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index f43f73b1e..220b91e94 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js index 5e258f47a..fd05b0884 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js index 0b4f1bca0..69c674b51 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js index d3f325f74..33013eae7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index d0fc9931d..08f8ab83e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index d134a8fff..bd48815c5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js index 554d8d794..26ba1bba7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js index 8b10a7e98..64340972b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js index faca8ce39..c4c355c6a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js index 4c628d1db..a06cc4974 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js index 135640249..e36b1820f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js index 9621baf26..a19f3c0ac 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js index 35d68c047..5699a3e3d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts index b7fddd42e..4c09ad85f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts @@ -90,6 +90,10 @@ export interface MyViewController extends SwiftHeapObject { delegate: MyViewControllerDelegate; secondDelegate: MyViewControllerDelegate | null; } +export interface DelegateManager extends SwiftHeapObject { + notifyAll(): void; + delegates: MyViewControllerDelegate[]; +} export type Exports = { Helper: { new(value: number): Helper; @@ -97,6 +101,10 @@ export type Exports = { MyViewController: { new(delegate: MyViewControllerDelegate): MyViewController; } + DelegateManager: { + new(delegates: MyViewControllerDelegate[]): DelegateManager; + } + processDelegates(delegates: MyViewControllerDelegate[]): MyViewControllerDelegate[]; Direction: DirectionObject ExampleEnum: ExampleEnumObject Result: ResultObject diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index f9dbb07e2..4fd02029d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -93,6 +93,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -165,6 +167,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; @@ -269,6 +277,10 @@ export async function createInstantiator(options, swift) { if (!importObject["TestModule"]) { importObject["TestModule"] = {}; } + importObject["TestModule"]["bjs_DelegateManager_wrap"] = function(pointer) { + const obj = DelegateManager.__construct(pointer); + return swift.memory.retain(obj); + }; importObject["TestModule"]["bjs_Helper_wrap"] = function(pointer) { const obj = Helper.__construct(pointer); return swift.memory.retain(obj); @@ -680,9 +692,73 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_MyViewController_secondDelegate_set(this.pointer, +isSome, isSome ? swift.memory.retain(value) : 0); } } + class DelegateManager extends SwiftHeapObject { + static __construct(ptr) { + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_DelegateManager_deinit, DelegateManager.prototype); + } + + constructor(delegates) { + const arrayCleanups = []; + for (const elem of delegates) { + const objId = swift.memory.retain(elem); + tmpParamInts.push(objId); + } + tmpParamArrayLengths.push(delegates.length); + const ret = instance.exports.bjs_DelegateManager_init(); + for (const cleanup of arrayCleanups) { cleanup(); } + return DelegateManager.__construct(ret); + } + notifyAll() { + instance.exports.bjs_DelegateManager_notifyAll(this.pointer); + } + get delegates() { + instance.exports.bjs_DelegateManager_delegates_get(this.pointer); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const objId = tmpRetInts.pop(); + const obj = swift.memory.getObject(objId); + swift.memory.release(objId); + arrayResult.push(obj); + } + arrayResult.reverse(); + return arrayResult; + } + set delegates(value) { + const arrayCleanups = []; + for (const elem of value) { + const objId = swift.memory.retain(elem); + tmpParamInts.push(objId); + } + tmpParamArrayLengths.push(value.length); + instance.exports.bjs_DelegateManager_delegates_set(this.pointer); + for (const cleanup of arrayCleanups) { cleanup(); } + } + } const exports = { Helper, MyViewController, + DelegateManager, + processDelegates: function bjs_processDelegates(delegates) { + const arrayCleanups = []; + for (const elem of delegates) { + const objId = swift.memory.retain(elem); + tmpParamInts.push(objId); + } + tmpParamArrayLengths.push(delegates.length); + instance.exports.bjs_processDelegates(); + const arrayLen = tmpRetArrayLengths.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const objId1 = tmpRetInts.pop(); + const obj = swift.memory.getObject(objId1); + swift.memory.release(objId1); + arrayResult.push(obj); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, Direction: DirectionValues, ExampleEnum: ExampleEnumValues, Result: ResultValues, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js index de20a1194..1cdc061e1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index 84d517a57..4d8b282fa 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -80,6 +80,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -152,6 +154,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js index 97c09fb3e..5e712ef85 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js @@ -80,6 +80,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -152,6 +154,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js index 352d1a2c0..40c09140d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js @@ -34,6 +34,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,6 +108,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js index 98f4cfdf8..f5e30215c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js @@ -34,6 +34,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,6 +108,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js index 5b399b276..e634e4147 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js index 4d76cbb7e..3155c6611 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js index 82b4068ed..7c3999c87 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js index 2d3679926..d0fd0eb1c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js index b4ba16cf9..dc5b94a17 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js index 87773621d..6fb8849f6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js index 58e39f0c6..d32c5a27d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js @@ -131,6 +131,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -203,6 +205,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js index 461d55aff..51d52e0e5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js index e7c40c298..5e528e7bc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js @@ -34,6 +34,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -295,6 +297,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js index 2f186df77..8683a87f6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -116,6 +118,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js index 0b0de98cd..5ff21f227 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js index 820a221a2..664794d4a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js index 1b2485296..0aa603d8a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index e0ae6c7a7..f442cd882 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js index aa45023ac..95602db76 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -121,6 +123,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js index 8564697d3..67eb8bc8f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -101,6 +103,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js index 16e42865c..915f64367 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js @@ -29,6 +29,8 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; + let tmpRetArrayLengths = []; + let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,6 +104,12 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_param_pointer"] = function() { return tmpParamPointers.pop(); } + bjs["swift_js_push_array_length"] = function(len) { + tmpRetArrayLengths.push(len | 0); + } + bjs["swift_js_pop_param_array_length"] = function() { + return tmpParamArrayLengths.pop(); + } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.json new file mode 100644 index 000000000..c796433dd --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.json @@ -0,0 +1,983 @@ +{ + "classes" : [ + { + "methods" : [ + + ], + "name" : "Item", + "properties" : [ + + ], + "swiftCallName" : "Item" + } + ], + "enums" : [ + { + "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" : "pending", + "rawValue" : "0" + }, + { + "associatedValues" : [ + + ], + "name" : "active", + "rawValue" : "1" + }, + { + "associatedValues" : [ + + ], + "name" : "completed", + "rawValue" : "2" + } + ], + "emitStyle" : "const", + "name" : "Status", + "rawType" : "Int", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Status", + "tsFullPath" : "Status" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_processIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_processStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processStringArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_processDoubleArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDoubleArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_processBoolArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processBoolArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "abiName" : "bjs_processPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + }, + { + "abiName" : "bjs_processDirectionArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDirectionArray", + "parameters" : [ + { + "label" : "_", + "name" : "directions", + "type" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "abiName" : "bjs_processStatusArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processStatusArray", + "parameters" : [ + { + "label" : "_", + "name" : "statuses", + "type" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Status", + "_1" : "Int" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Status", + "_1" : "Int" + } + } + } + } + }, + { + "abiName" : "bjs_sumIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "sumIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_findFirstPoint", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "findFirstPoint", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + }, + { + "label" : "matching", + "name" : "matching", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Point" + } + } + }, + { + "abiName" : "bjs_processUnsafeRawPointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processUnsafeRawPointerArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + } + } + }, + { + "abiName" : "bjs_processUnsafeMutableRawPointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processUnsafeMutableRawPointerArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + } + }, + { + "abiName" : "bjs_processOpaquePointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOpaquePointerArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalStringArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalDirectionArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalDirectionArray", + "parameters" : [ + { + "label" : "_", + "name" : "directions", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalStatusArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalStatusArray", + "parameters" : [ + { + "label" : "_", + "name" : "statuses", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Status", + "_1" : "Int" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Status", + "_1" : "Int" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processNestedIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processNestedIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processNestedStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processNestedStringArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processNestedPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processNestedPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processItemArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processItemArray", + "parameters" : [ + { + "label" : "_", + "name" : "items", + "type" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Item" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Item" + } + } + } + } + }, + { + "abiName" : "bjs_processNestedItemArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processNestedItemArray", + "parameters" : [ + { + "label" : "_", + "name" : "items", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Item" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Item" + } + } + } + } + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + { + "methods" : [ + + ], + "name" : "Point", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "x", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "y", + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "Point" + } + ] +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift new file mode 100644 index 000000000..8142d6905 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift @@ -0,0 +1,694 @@ +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: _BridgedSwiftEnumNoPayload { +} + +extension Point: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { + let y = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let x = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + return Point(x: x, y: y) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_f64(self.x) + _swift_js_push_f64(self.y) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + 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(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Point") +fileprivate func _bjs_struct_lift_Point() -> Int32 +#else +fileprivate func _bjs_struct_lift_Point() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_processIntArray") +@_cdecl("bjs_processIntArray") +public func _bjs_processIntArray() -> Void { + #if arch(wasm32) + let ret = processIntArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int(Int32(__bjs_elem_ret))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processStringArray") +@_cdecl("bjs_processStringArray") +public func _bjs_processStringArray() -> Void { + #if arch(wasm32) + let ret = processStringArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [String] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + var __bjs_ret_elem = __bjs_elem_ret + __bjs_ret_elem.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + }} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processDoubleArray") +@_cdecl("bjs_processDoubleArray") +public func _bjs_processDoubleArray() -> Void { + #if arch(wasm32) + let ret = processDoubleArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Double] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_f64(__bjs_elem_ret)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processBoolArray") +@_cdecl("bjs_processBoolArray") +public func _bjs_processBoolArray() -> Void { + #if arch(wasm32) + let ret = processBoolArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Bool] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int(__bjs_elem_ret ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processPointArray") +@_cdecl("bjs_processPointArray") +public func _bjs_processPointArray() -> Void { + #if arch(wasm32) + let ret = processPointArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Point] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Point.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processDirectionArray") +@_cdecl("bjs_processDirectionArray") +public func _bjs_processDirectionArray() -> Void { + #if arch(wasm32) + let ret = processDirectionArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Direction] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Direction.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processStatusArray") +@_cdecl("bjs_processStatusArray") +public func _bjs_processStatusArray() -> Void { + #if arch(wasm32) + let ret = processStatusArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Status] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Status.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_sumIntArray") +@_cdecl("bjs_sumIntArray") +public func _bjs_sumIntArray() -> Int32 { + #if arch(wasm32) + let ret = sumIntArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_findFirstPoint") +@_cdecl("bjs_findFirstPoint") +public func _bjs_findFirstPoint(_ matchingBytes: Int32, _ matchingLength: Int32) -> Void { + #if arch(wasm32) + let ret = findFirstPoint(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Point] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Point.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }(), matching: String.bridgeJSLiftParameter(matchingBytes, matchingLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processUnsafeRawPointerArray") +@_cdecl("bjs_processUnsafeRawPointerArray") +public func _bjs_processUnsafeRawPointerArray() -> Void { + #if arch(wasm32) + let ret = processUnsafeRawPointerArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [UnsafeRawPointer] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processUnsafeMutableRawPointerArray") +@_cdecl("bjs_processUnsafeMutableRawPointerArray") +public func _bjs_processUnsafeMutableRawPointerArray() -> Void { + #if arch(wasm32) + let ret = processUnsafeMutableRawPointerArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [UnsafeMutableRawPointer] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processOpaquePointerArray") +@_cdecl("bjs_processOpaquePointerArray") +public func _bjs_processOpaquePointerArray() -> Void { + #if arch(wasm32) + let ret = processOpaquePointerArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [OpaquePointer] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processOptionalIntArray") +@_cdecl("bjs_processOptionalIntArray") +public func _bjs_processOptionalIntArray() -> Void { + #if arch(wasm32) + let ret = processOptionalIntArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + _swift_js_push_int(Int32(__bjs_unwrapped_ret_elem))} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processOptionalStringArray") +@_cdecl("bjs_processOptionalStringArray") +public func _bjs_processOptionalStringArray() -> Void { + #if arch(wasm32) + let ret = processOptionalStringArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + var __bjs_str_ret_elem = __bjs_unwrapped_ret_elem + __bjs_str_ret_elem.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + }} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processOptionalArray") +@_cdecl("bjs_processOptionalArray") +public func _bjs_processOptionalArray(_ values: Int32) -> Void { + #if arch(wasm32) + let ret = processOptionalArray(_: { + if values == 0 { + return Optional<[Int]>.none + } else { + return { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }() + } + }()) + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + for __bjs_elem_ret in __bjs_unwrapped_ret { + _swift_js_push_int(Int32(__bjs_elem_ret))} + _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processOptionalPointArray") +@_cdecl("bjs_processOptionalPointArray") +public func _bjs_processOptionalPointArray() -> Void { + #if arch(wasm32) + let ret = processOptionalPointArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processOptionalDirectionArray") +@_cdecl("bjs_processOptionalDirectionArray") +public func _bjs_processOptionalDirectionArray() -> Void { + #if arch(wasm32) + let ret = processOptionalDirectionArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + _swift_js_push_int(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processOptionalStatusArray") +@_cdecl("bjs_processOptionalStatusArray") +public func _bjs_processOptionalStatusArray() -> Void { + #if arch(wasm32) + let ret = processOptionalStatusArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + _swift_js_push_int(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processNestedIntArray") +@_cdecl("bjs_processNestedIntArray") +public func _bjs_processNestedIntArray() -> Void { + #if arch(wasm32) + let ret = processNestedIntArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[Int]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + _swift_js_push_int(Int32(__bjs_elem_ret_elem))} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processNestedStringArray") +@_cdecl("bjs_processNestedStringArray") +public func _bjs_processNestedStringArray() -> Void { + #if arch(wasm32) + let ret = processNestedStringArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[String]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [String] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + var __bjs_ret_elem_elem = __bjs_elem_ret_elem + __bjs_ret_elem_elem.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + }} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processNestedPointArray") +@_cdecl("bjs_processNestedPointArray") +public func _bjs_processNestedPointArray() -> Void { + #if arch(wasm32) + let ret = processNestedPointArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[Point]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Point] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Point.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + __bjs_elem_ret_elem.bridgeJSLowerReturn()} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processItemArray") +@_cdecl("bjs_processItemArray") +public func _bjs_processItemArray() -> Void { + #if arch(wasm32) + let ret = processItemArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Item] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Item.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processNestedItemArray") +@_cdecl("bjs_processNestedItemArray") +public func _bjs_processNestedItemArray() -> Void { + #if arch(wasm32) + let ret = processNestedItemArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[Item]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Item] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Item.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + _swift_js_push_pointer(__bjs_elem_ret_elem.bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Item_deinit") +@_cdecl("bjs_Item_deinit") +public func _bjs_Item_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension Item: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_Item_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Item_wrap") +fileprivate func _bjs_Item_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Item_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json index 1a013eed0..f2e6a4e2e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json @@ -728,6 +728,340 @@ } } } + }, + { + "abiName" : "bjs_testIntArrayDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testIntArrayDefault", + "parameters" : [ + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "int" : { + "_0" : 1 + } + }, + { + "int" : { + "_0" : 2 + } + }, + { + "int" : { + "_0" : 3 + } + } + ] + } + }, + "label" : "values", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testStringArrayDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testStringArrayDefault", + "parameters" : [ + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "string" : { + "_0" : "a" + } + }, + { + "string" : { + "_0" : "b" + } + }, + { + "string" : { + "_0" : "c" + } + } + ] + } + }, + "label" : "names", + "name" : "names", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testDoubleArrayDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testDoubleArrayDefault", + "parameters" : [ + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "double" : { + "_0" : 1.5 + } + }, + { + "double" : { + "_0" : 2.5 + } + }, + { + "double" : { + "_0" : 3.5 + } + } + ] + } + }, + "label" : "values", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testBoolArrayDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testBoolArrayDefault", + "parameters" : [ + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "bool" : { + "_0" : true + } + }, + { + "bool" : { + "_0" : false + } + }, + { + "bool" : { + "_0" : true + } + } + ] + } + }, + "label" : "flags", + "name" : "flags", + "type" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testEmptyArrayDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testEmptyArrayDefault", + "parameters" : [ + { + "defaultValue" : { + "array" : { + "_0" : [ + + ] + } + }, + "label" : "items", + "name" : "items", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testMixedWithArrayDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testMixedWithArrayDefault", + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "test" + } + }, + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "int" : { + "_0" : 10 + } + }, + { + "int" : { + "_0" : 20 + } + }, + { + "int" : { + "_0" : 30 + } + } + ] + } + }, + "label" : "values", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "defaultValue" : { + "bool" : { + "_0" : true + } + }, + "label" : "enabled", + "name" : "enabled", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } } ], "protocols" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index b1594c328..7803860a3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -317,6 +317,139 @@ public func _bjs_testOptionalStructWithValueDefault(_ point: Int32) -> Void { #endif } +@_expose(wasm, "bjs_testIntArrayDefault") +@_cdecl("bjs_testIntArrayDefault") +public func _bjs_testIntArrayDefault() -> Void { + #if arch(wasm32) + let ret = testIntArrayDefault(values: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int(Int32(__bjs_elem_ret))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_testStringArrayDefault") +@_cdecl("bjs_testStringArrayDefault") +public func _bjs_testStringArrayDefault() -> Void { + #if arch(wasm32) + let ret = testStringArrayDefault(names: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [String] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + var __bjs_ret_elem = __bjs_elem_ret + __bjs_ret_elem.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + }} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_testDoubleArrayDefault") +@_cdecl("bjs_testDoubleArrayDefault") +public func _bjs_testDoubleArrayDefault() -> Void { + #if arch(wasm32) + let ret = testDoubleArrayDefault(values: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Double] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_f64(__bjs_elem_ret)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_testBoolArrayDefault") +@_cdecl("bjs_testBoolArrayDefault") +public func _bjs_testBoolArrayDefault() -> Void { + #if arch(wasm32) + let ret = testBoolArrayDefault(flags: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Bool] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int(__bjs_elem_ret ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_testEmptyArrayDefault") +@_cdecl("bjs_testEmptyArrayDefault") +public func _bjs_testEmptyArrayDefault() -> Void { + #if arch(wasm32) + let ret = testEmptyArrayDefault(items: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int(Int32(__bjs_elem_ret))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_testMixedWithArrayDefault") +@_cdecl("bjs_testMixedWithArrayDefault") +public func _bjs_testMixedWithArrayDefault(_ nameBytes: Int32, _ nameLength: Int32, _ enabled: Int32) -> Void { + #if arch(wasm32) + let ret = testMixedWithArrayDefault(name: String.bridgeJSLiftParameter(nameBytes, nameLength), values: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }(), enabled: Bool.bridgeJSLiftParameter(enabled)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_DefaultGreeter_init") @_cdecl("bjs_DefaultGreeter_init") public func _bjs_DefaultGreeter_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json index b79a59d19..eb8f2426a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json @@ -247,6 +247,68 @@ } ], "swiftCallName" : "MyViewController" + }, + { + "constructor" : { + "abiName" : "bjs_DelegateManager_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "delegates", + "name" : "delegates", + "type" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_DelegateManager_notifyAll", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "notifyAll", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "DelegateManager", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "delegates", + "type" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + } + } + } + ], + "swiftCallName" : "DelegateManager" } ], "enums" : [ @@ -394,7 +456,39 @@ ], "exposeToGlobal" : false, "functions" : [ - + { + "abiName" : "bjs_processDelegates", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDelegates", + "parameters" : [ + { + "label" : "_", + "name" : "delegates", + "type" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + } + } + } ], "protocols" : [ { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index 735c225f1..7592f2960 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -418,6 +418,28 @@ extension Result: _BridgedSwiftAssociatedValueEnum { extension Priority: _BridgedSwiftEnumNoPayload { } +@_expose(wasm, "bjs_processDelegates") +@_cdecl("bjs_processDelegates") +public func _bjs_processDelegates() -> Void { + #if arch(wasm32) + let ret = processDelegates(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [AnyMyViewControllerDelegate] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(AnyMyViewControllerDelegate.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int((__bjs_elem_ret as! AnyMyViewControllerDelegate).bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_Helper_init") @_cdecl("bjs_Helper_init") public func _bjs_Helper_init(_ value: Int32) -> UnsafeMutableRawPointer { @@ -625,4 +647,91 @@ fileprivate func _bjs_MyViewController_wrap(_ pointer: UnsafeMutableRawPointer) fileprivate func _bjs_MyViewController_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } +#endif + +@_expose(wasm, "bjs_DelegateManager_init") +@_cdecl("bjs_DelegateManager_init") +public func _bjs_DelegateManager_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = DelegateManager(delegates: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [AnyMyViewControllerDelegate] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(AnyMyViewControllerDelegate.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DelegateManager_notifyAll") +@_cdecl("bjs_DelegateManager_notifyAll") +public func _bjs_DelegateManager_notifyAll(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + DelegateManager.bridgeJSLiftParameter(_self).notifyAll() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DelegateManager_delegates_get") +@_cdecl("bjs_DelegateManager_delegates_get") +public func _bjs_DelegateManager_delegates_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DelegateManager.bridgeJSLiftParameter(_self).delegates + for __bjs_elem_ret in ret { + _swift_js_push_int((__bjs_elem_ret as! AnyMyViewControllerDelegate).bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DelegateManager_delegates_set") +@_cdecl("bjs_DelegateManager_delegates_set") +public func _bjs_DelegateManager_delegates_set(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + DelegateManager.bridgeJSLiftParameter(_self).delegates = { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [AnyMyViewControllerDelegate] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(AnyMyViewControllerDelegate.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DelegateManager_deinit") +@_cdecl("bjs_DelegateManager_deinit") +public func _bjs_DelegateManager_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension DelegateManager: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_DelegateManager_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_DelegateManager_wrap") +fileprivate func _bjs_DelegateManager_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_DelegateManager_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} #endif \ No newline at end of file diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 52e05a4f6..d8145e3a7 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -282,6 +282,10 @@ extension _BridgedSwiftProtocolWrapper { @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Int32 { jsObject.bridgeJSLowerReturn() } + + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + jsObject.bridgeJSLowerParameter() + } } /// A protocol that Swift enum types that do not have a payload can conform to. @@ -457,6 +461,26 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo } #endif +// MARK: Array length operations + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_push_array_length") +@_spi(BridgeJS) public func _swift_js_push_array_length(_ length: Int32) +#else +@_spi(BridgeJS) public func _swift_js_push_array_length(_ length: Int32) { + _onlyAvailableOnWasm() +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_pop_param_array_length") +@_spi(BridgeJS) public func _swift_js_pop_param_array_length() -> Int32 +#else +@_spi(BridgeJS) public func _swift_js_pop_param_array_length() -> Int32 { + _onlyAvailableOnWasm() +} +#endif + // MARK: Struct bridging helpers (JS-side lowering/raising) #if arch(wasm32) diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md index c70533055..75f0fcca5 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md @@ -66,6 +66,7 @@ This command will: - - - +- - - - diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Array.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Array.md new file mode 100644 index 000000000..fed56618f --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Array.md @@ -0,0 +1,132 @@ +# Exporting Swift Arrays to JS + +Learn how to pass Swift arrays to and from JavaScript. + +## Overview + +> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). + +BridgeJS allows you to pass Swift arrays as function parameters and return values. + +```swift +import JavaScriptKit + +@JS func processNumbers(_ values: [Int]) -> [Int] { + return values.map { $0 * 2 } +} + +@JS func getGreeting() -> [String] { + return ["Hello", "World", "from", "Swift"] +} +``` + +In JavaScript: + +```javascript +import { init } from "./.build/plugins/PackageToJS/outputs/Package/index.js"; +const { exports } = await init({}); + +const doubled = exports.processNumbers([1, 2, 3, 4, 5]); +console.log(doubled); // [2, 4, 6, 8, 10] + +const greeting = exports.getGreeting(); +console.log(greeting.join(" ")); // "Hello World from Swift" +``` + +The generated TypeScript declarations: + +```typescript +export type Exports = { + processNumbers(values: number[]): number[]; + getGreeting(): string[]; +} +``` + +## Arrays of Custom Types + +Arrays work with `@JS` marked structs, classes, and enums: + +```swift +@JS struct Point { + var x: Double + var y: Double +} + +@JS func scalePoints(_ points: [Point], by factor: Double) -> [Point] { + return points.map { Point(x: $0.x * factor, y: $0.y * factor) } +} +``` + +In JavaScript: + +```javascript +const points = [{ x: 1.0, y: 2.0 }, { x: 3.0, y: 4.0 }]; +const scaled = exports.scalePoints(points, 2.0); +console.log(scaled); // [{ x: 2.0, y: 4.0 }, { x: 6.0, y: 8.0 }] +``` + +## Optional and Nested Arrays + +BridgeJS supports optional arrays (`[T]?`), arrays of optionals (`[T?]`), and nested arrays (`[[T]]`): + +```swift +@JS func processOptionalInts(_ values: [Int?]) -> [Int?] { + return values.map { $0.map { $0 * 2 } } +} + +@JS func processMatrix(_ matrix: [[Int]]) -> [[Int]] { + return matrix.map { row in row.map { $0 * 2 } } +} +``` + +In JavaScript: + +```javascript +const mixed = [1, null, 3]; +console.log(exports.processOptionalInts(mixed)); // [2, null, 6] + +const matrix = [[1, 2], [3, 4]]; +console.log(exports.processMatrix(matrix)); // [[2, 4], [6, 8]] +``` + +TypeScript definitions: + +- `[Int?]` becomes `(number | null)[]` +- `[Int]?` becomes `number[] | null` +- `[[Int]]` becomes `number[][]` + +## How It Works + +Arrays use **copy semantics** when crossing the Swift/JavaScript boundary: + +1. **Data Transfer**: Array elements are pushed to type-specific stacks and reconstructed as JavaScript arrays +2. **No Shared State**: Each side has its own copy - modifications don't affect the original +3. **Element Handling**: Primitive elements are copied by value; class elements copy their references (the objects remain shared) + +This differs from classes, which use reference semantics and share state across the boundary. + +```javascript +const original = [1, 2, 3]; +const result = exports.processNumbers(original); +// original is unchanged - Swift received a copy +``` + +## Supported Features + +| Swift Feature | Status | +|:--------------|:-------| +| Primitive arrays: `[Int]`, `[Double]`, `[Bool]`, `[String]` | ✅ | +| Struct arrays: `[MyStruct]` | ✅ | +| Class arrays: `[MyClass]` | ✅ | +| Enum arrays (case, raw value, associated value) | ✅ | +| Nested arrays: `[[Int]]` | ✅ | +| Optional arrays: `[Int]?` | ✅ | +| Arrays of optionals: `[Int?]` | ✅ | +| Protocol arrays: `[MyProtocol]` | ✅ | +| UnsafePointer-family arrays: `[UnsafeRawPointer]`, `[OpaquePointer]`, etc. | ✅ | + +> Note: Array element type support matches that of regular `@JS func` parameters and return values. + +## See Also + +- diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md index 21925685d..f6115f063 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md @@ -110,6 +110,7 @@ The following default value types are supported for both function and constructo | Class initialization (no args) | `MyClass()` | `new MyClass()` | | Class initialization (literal args) | `MyClass("value", 42)` | `new MyClass("value", 42)` | | Struct initialization | `Point(x: 1.0, y: 2.0)` | `{ x: 1.0, y: 2.0 }` | +| Array literals | `[1, 2, 3]` | `[1, 2, 3]` | ## Working with Class and Struct Defaults @@ -156,7 +157,6 @@ The following expressions are **not supported** as default parameter values: |:----------------|:--------|:-------| | Method calls | `Date().description` | ❌ | | Closures | `{ "computed" }()` | ❌ | -| Array literals | `[1, 2, 3]` | ❌ | | Dictionary literals | `["key": "value"]` | ❌ | | Binary operations | `10 + 20` | ❌ | | Complex member access | `Config.shared.value` | ❌ | diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 27584d24d..af6ad530b 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -864,6 +864,22 @@ enum APIOptionalResult { } } +@JS func arrayWithDefault(_ values: [Int] = [1, 2, 3]) -> Int { + return values.reduce(0, +) +} + +@JS func arrayWithOptionalDefault(_ values: [Int]? = nil) -> Int { + return values?.reduce(0, +) ?? -1 +} + +@JS func arrayMixedDefaults( + prefix: String = "Sum", + values: [Int] = [10, 20], + suffix: String = "!" +) -> String { + return "\(prefix): \(values.reduce(0, +))\(suffix)" +} + // MARK: - Static Properties @JS class StaticPropertyHolder { @@ -1269,6 +1285,134 @@ enum APIOptionalResult { } } +// MARK: - Array Tests + +// Primitive arrays +@JS func roundTripIntArray(_ values: [Int]) -> [Int] { + return values +} + +@JS func roundTripStringArray(_ values: [String]) -> [String] { + return values +} + +@JS func roundTripDoubleArray(_ values: [Double]) -> [Double] { + return values +} + +@JS func roundTripBoolArray(_ values: [Bool]) -> [Bool] { + return values +} + +// Enum arrays +@JS func roundTripDirectionArray(_ values: [Direction]) -> [Direction] { + return values +} + +@JS func roundTripStatusArray(_ values: [Status]) -> [Status] { + return values +} + +@JS func roundTripThemeArray(_ values: [Theme]) -> [Theme] { + return values +} + +@JS func roundTripHttpStatusArray(_ values: [HttpStatus]) -> [HttpStatus] { + return values +} + +// Struct arrays +@JS func roundTripDataPointArray(_ points: [DataPoint]) -> [DataPoint] { + return points +} + +// Class arrays +@JS func roundTripGreeterArray(_ greeters: [Greeter]) -> [Greeter] { + return greeters +} + +// Arrays of optional elements +@JS func roundTripOptionalIntArray(_ values: [Int?]) -> [Int?] { + return values +} + +@JS func roundTripOptionalStringArray(_ values: [String?]) -> [String?] { + return values +} + +@JS func roundTripOptionalDataPointArray(_ points: [DataPoint?]) -> [DataPoint?] { + return points +} + +@JS func roundTripOptionalDirectionArray(_ directions: [Direction?]) -> [Direction?] { + return directions +} + +@JS func roundTripOptionalStatusArray(_ statuses: [Status?]) -> [Status?] { + return statuses +} + +// Optional arrays +@JS func roundTripOptionalIntArrayType(_ values: [Int]?) -> [Int]? { + return values +} + +@JS func roundTripOptionalStringArrayType(_ values: [String]?) -> [String]? { + return values +} + +@JS func roundTripOptionalGreeterArrayType(_ greeters: [Greeter]?) -> [Greeter]? { + return greeters +} + +// Nested arrays + +@JS func roundTripNestedIntArray(_ values: [[Int]]) -> [[Int]] { + return values +} + +@JS func roundTripNestedStringArray(_ values: [[String]]) -> [[String]] { + return values +} + +@JS func roundTripNestedDoubleArray(_ values: [[Double]]) -> [[Double]] { + return values +} + +@JS func roundTripNestedBoolArray(_ values: [[Bool]]) -> [[Bool]] { + return values +} + +@JS func roundTripNestedDataPointArray(_ points: [[DataPoint]]) -> [[DataPoint]] { + return points +} + +@JS func roundTripNestedDirectionArray(_ directions: [[Direction]]) -> [[Direction]] { + return directions +} + +@JS func roundTripNestedGreeterArray(_ greeters: [[Greeter]]) -> [[Greeter]] { + return greeters +} + +@JS func roundTripUnsafeRawPointerArray(_ values: [UnsafeRawPointer]) -> [UnsafeRawPointer] { + return values +} +@JS func roundTripUnsafeMutableRawPointerArray(_ values: [UnsafeMutableRawPointer]) -> [UnsafeMutableRawPointer] { + return values +} +@JS func roundTripOpaquePointerArray(_ values: [OpaquePointer]) -> [OpaquePointer] { + return values +} + +@JS func consumeDataProcessorArrayType(_ processors: [DataProcessor]) -> Int { + return processors.count +} + +@JS func roundTripDataProcessorArrayType(_ processors: [DataProcessor]) -> [DataProcessor] { + return processors +} + class ExportAPITests: XCTestCase { func testAll() { var hasDeinitGreeter = false diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index c31876ac9..7f35f6725 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -4551,6 +4551,72 @@ public func _bjs_testEmptyInit(_ object: UnsafeMutableRawPointer) -> UnsafeMutab #endif } +@_expose(wasm, "bjs_arrayWithDefault") +@_cdecl("bjs_arrayWithDefault") +public func _bjs_arrayWithDefault() -> Int32 { + #if arch(wasm32) + let ret = arrayWithDefault(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_arrayWithOptionalDefault") +@_cdecl("bjs_arrayWithOptionalDefault") +public func _bjs_arrayWithOptionalDefault(_ values: Int32) -> Int32 { + #if arch(wasm32) + let ret = arrayWithOptionalDefault(_: { + if values == 0 { + return Optional<[Int]>.none + } else { + return { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }() + } + }()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_arrayMixedDefaults") +@_cdecl("bjs_arrayMixedDefaults") +public func _bjs_arrayMixedDefaults(_ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { + #if arch(wasm32) + let ret = arrayMixedDefaults(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength), values: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }(), suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) + 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 { @@ -4584,6 +4650,798 @@ public func _bjs_makeAdder(_ base: Int32) -> UnsafeMutableRawPointer { #endif } +@_expose(wasm, "bjs_roundTripIntArray") +@_cdecl("bjs_roundTripIntArray") +public func _bjs_roundTripIntArray() -> Void { + #if arch(wasm32) + let ret = roundTripIntArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int(Int32(__bjs_elem_ret))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripStringArray") +@_cdecl("bjs_roundTripStringArray") +public func _bjs_roundTripStringArray() -> Void { + #if arch(wasm32) + let ret = roundTripStringArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [String] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + var __bjs_ret_elem = __bjs_elem_ret + __bjs_ret_elem.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + }} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripDoubleArray") +@_cdecl("bjs_roundTripDoubleArray") +public func _bjs_roundTripDoubleArray() -> Void { + #if arch(wasm32) + let ret = roundTripDoubleArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Double] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_f64(__bjs_elem_ret)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripBoolArray") +@_cdecl("bjs_roundTripBoolArray") +public func _bjs_roundTripBoolArray() -> Void { + #if arch(wasm32) + let ret = roundTripBoolArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Bool] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int(__bjs_elem_ret ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripDirectionArray") +@_cdecl("bjs_roundTripDirectionArray") +public func _bjs_roundTripDirectionArray() -> Void { + #if arch(wasm32) + let ret = roundTripDirectionArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Direction] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Direction.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripStatusArray") +@_cdecl("bjs_roundTripStatusArray") +public func _bjs_roundTripStatusArray() -> Void { + #if arch(wasm32) + let ret = roundTripStatusArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Status] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Status.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripThemeArray") +@_cdecl("bjs_roundTripThemeArray") +public func _bjs_roundTripThemeArray() -> Void { + #if arch(wasm32) + let ret = roundTripThemeArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Theme] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Theme.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + var __bjs_ret_elem = __bjs_elem_ret.rawValue + __bjs_ret_elem.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + }} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripHttpStatusArray") +@_cdecl("bjs_roundTripHttpStatusArray") +public func _bjs_roundTripHttpStatusArray() -> Void { + #if arch(wasm32) + let ret = roundTripHttpStatusArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [HttpStatus] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(HttpStatus.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripDataPointArray") +@_cdecl("bjs_roundTripDataPointArray") +public func _bjs_roundTripDataPointArray() -> Void { + #if arch(wasm32) + let ret = roundTripDataPointArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [DataPoint] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(DataPoint.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripGreeterArray") +@_cdecl("bjs_roundTripGreeterArray") +public func _bjs_roundTripGreeterArray() -> Void { + #if arch(wasm32) + let ret = roundTripGreeterArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Greeter] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Greeter.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalIntArray") +@_cdecl("bjs_roundTripOptionalIntArray") +public func _bjs_roundTripOptionalIntArray() -> Void { + #if arch(wasm32) + let ret = roundTripOptionalIntArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + _swift_js_push_int(Int32(__bjs_unwrapped_ret_elem))} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalStringArray") +@_cdecl("bjs_roundTripOptionalStringArray") +public func _bjs_roundTripOptionalStringArray() -> Void { + #if arch(wasm32) + let ret = roundTripOptionalStringArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + var __bjs_str_ret_elem = __bjs_unwrapped_ret_elem + __bjs_str_ret_elem.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + }} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalDataPointArray") +@_cdecl("bjs_roundTripOptionalDataPointArray") +public func _bjs_roundTripOptionalDataPointArray() -> Void { + #if arch(wasm32) + let ret = roundTripOptionalDataPointArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalDirectionArray") +@_cdecl("bjs_roundTripOptionalDirectionArray") +public func _bjs_roundTripOptionalDirectionArray() -> Void { + #if arch(wasm32) + let ret = roundTripOptionalDirectionArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + _swift_js_push_int(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalStatusArray") +@_cdecl("bjs_roundTripOptionalStatusArray") +public func _bjs_roundTripOptionalStatusArray() -> Void { + #if arch(wasm32) + let ret = roundTripOptionalStatusArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + _swift_js_push_int(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalIntArrayType") +@_cdecl("bjs_roundTripOptionalIntArrayType") +public func _bjs_roundTripOptionalIntArrayType(_ values: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalIntArrayType(_: { + if values == 0 { + return Optional<[Int]>.none + } else { + return { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }() + } + }()) + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + for __bjs_elem_ret in __bjs_unwrapped_ret { + _swift_js_push_int(Int32(__bjs_elem_ret))} + _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalStringArrayType") +@_cdecl("bjs_roundTripOptionalStringArrayType") +public func _bjs_roundTripOptionalStringArrayType(_ values: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalStringArrayType(_: { + if values == 0 { + return Optional<[String]>.none + } else { + return { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [String] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }() + } + }()) + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + for __bjs_elem_ret in __bjs_unwrapped_ret { + var __bjs_ret_elem = __bjs_elem_ret + __bjs_ret_elem.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + }} + _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalGreeterArrayType") +@_cdecl("bjs_roundTripOptionalGreeterArrayType") +public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalGreeterArrayType(_: { + if greeters == 0 { + return Optional<[Greeter]>.none + } else { + return { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Greeter] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Greeter.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + } + __result.reverse() + return __result + }() + } + }()) + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + for __bjs_elem_ret in __bjs_unwrapped_ret { + _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripNestedIntArray") +@_cdecl("bjs_roundTripNestedIntArray") +public func _bjs_roundTripNestedIntArray() -> Void { + #if arch(wasm32) + let ret = roundTripNestedIntArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[Int]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + _swift_js_push_int(Int32(__bjs_elem_ret_elem))} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripNestedStringArray") +@_cdecl("bjs_roundTripNestedStringArray") +public func _bjs_roundTripNestedStringArray() -> Void { + #if arch(wasm32) + let ret = roundTripNestedStringArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[String]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [String] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + var __bjs_ret_elem_elem = __bjs_elem_ret_elem + __bjs_ret_elem_elem.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + }} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripNestedDoubleArray") +@_cdecl("bjs_roundTripNestedDoubleArray") +public func _bjs_roundTripNestedDoubleArray() -> Void { + #if arch(wasm32) + let ret = roundTripNestedDoubleArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[Double]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Double] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + _swift_js_push_f64(__bjs_elem_ret_elem)} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripNestedBoolArray") +@_cdecl("bjs_roundTripNestedBoolArray") +public func _bjs_roundTripNestedBoolArray() -> Void { + #if arch(wasm32) + let ret = roundTripNestedBoolArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[Bool]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Bool] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + _swift_js_push_int(__bjs_elem_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripNestedDataPointArray") +@_cdecl("bjs_roundTripNestedDataPointArray") +public func _bjs_roundTripNestedDataPointArray() -> Void { + #if arch(wasm32) + let ret = roundTripNestedDataPointArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[DataPoint]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [DataPoint] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(DataPoint.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + __bjs_elem_ret_elem.bridgeJSLowerReturn()} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripNestedDirectionArray") +@_cdecl("bjs_roundTripNestedDirectionArray") +public func _bjs_roundTripNestedDirectionArray() -> Void { + #if arch(wasm32) + let ret = roundTripNestedDirectionArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[Direction]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Direction] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Direction.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + _swift_js_push_int(Int32(__bjs_elem_ret_elem.bridgeJSLowerParameter()))} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripNestedGreeterArray") +@_cdecl("bjs_roundTripNestedGreeterArray") +public func _bjs_roundTripNestedGreeterArray() -> Void { + #if arch(wasm32) + let ret = roundTripNestedGreeterArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[Greeter]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Greeter] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Greeter.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + _swift_js_push_pointer(__bjs_elem_ret_elem.bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUnsafeRawPointerArray") +@_cdecl("bjs_roundTripUnsafeRawPointerArray") +public func _bjs_roundTripUnsafeRawPointerArray() -> Void { + #if arch(wasm32) + let ret = roundTripUnsafeRawPointerArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [UnsafeRawPointer] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUnsafeMutableRawPointerArray") +@_cdecl("bjs_roundTripUnsafeMutableRawPointerArray") +public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { + #if arch(wasm32) + let ret = roundTripUnsafeMutableRawPointerArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [UnsafeMutableRawPointer] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOpaquePointerArray") +@_cdecl("bjs_roundTripOpaquePointerArray") +public func _bjs_roundTripOpaquePointerArray() -> Void { + #if arch(wasm32) + let ret = roundTripOpaquePointerArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [OpaquePointer] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_consumeDataProcessorArrayType") +@_cdecl("bjs_consumeDataProcessorArrayType") +public func _bjs_consumeDataProcessorArrayType() -> Int32 { + #if arch(wasm32) + let ret = consumeDataProcessorArrayType(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [AnyDataProcessor] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(AnyDataProcessor.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripDataProcessorArrayType") +@_cdecl("bjs_roundTripDataProcessorArrayType") +public func _bjs_roundTripDataProcessorArrayType() -> Void { + #if arch(wasm32) + let ret = roundTripDataProcessorArrayType(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [AnyDataProcessor] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(AnyDataProcessor.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int((__bjs_elem_ret as! AnyDataProcessor).bridgeJSLowerReturn())} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_roundTripPointerFields") @_cdecl("bjs_roundTripPointerFields") public func _bjs_roundTripPointerFields() -> Void { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 1b70b0b04..2f0f964be 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -7756,6 +7756,167 @@ } } }, + { + "abiName" : "bjs_arrayWithDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "arrayWithDefault", + "parameters" : [ + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "int" : { + "_0" : 1 + } + }, + { + "int" : { + "_0" : 2 + } + }, + { + "int" : { + "_0" : 3 + } + } + ] + } + }, + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_arrayWithOptionalDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "arrayWithOptionalDefault", + "parameters" : [ + { + "defaultValue" : { + "null" : { + + } + }, + "label" : "_", + "name" : "values", + "type" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_arrayMixedDefaults", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "arrayMixedDefaults", + "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" : { + "int" : { + + } + } + } + } + }, + { + "defaultValue" : { + "string" : { + "_0" : "!" + } + }, + "label" : "suffix", + "name" : "suffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, { "abiName" : "bjs_formatName", "effects" : { @@ -7891,6 +8052,1128 @@ } } }, + { + "abiName" : "bjs_roundTripIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripStringArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripDoubleArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDoubleArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripBoolArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripBoolArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripDirectionArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDirectionArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripStatusArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripStatusArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripThemeArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripThemeArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripHttpStatusArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripHttpStatusArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripDataPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDataPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripGreeterArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripGreeterArray", + "parameters" : [ + { + "label" : "_", + "name" : "greeters", + "type" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalStringArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalDataPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalDataPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalDirectionArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalDirectionArray", + "parameters" : [ + { + "label" : "_", + "name" : "directions", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalStatusArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalStatusArray", + "parameters" : [ + { + "label" : "_", + "name" : "statuses", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalIntArrayType", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalIntArrayType", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalStringArrayType", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalStringArrayType", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalGreeterArrayType", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalGreeterArrayType", + "parameters" : [ + { + "label" : "_", + "name" : "greeters", + "type" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripNestedIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripNestedIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripNestedStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripNestedStringArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripNestedDoubleArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripNestedDoubleArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripNestedBoolArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripNestedBoolArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripNestedDataPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripNestedDataPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripNestedDirectionArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripNestedDirectionArray", + "parameters" : [ + { + "label" : "_", + "name" : "directions", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripNestedGreeterArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripNestedGreeterArray", + "parameters" : [ + { + "label" : "_", + "name" : "greeters", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripUnsafeRawPointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUnsafeRawPointerArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripUnsafeMutableRawPointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUnsafeMutableRawPointerArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOpaquePointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOpaquePointerArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + } + } + }, + { + "abiName" : "bjs_consumeDataProcessorArrayType", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "consumeDataProcessorArrayType", + "parameters" : [ + { + "label" : "_", + "name" : "processors", + "type" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_roundTripDataProcessorArrayType", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDataProcessorArrayType", + "parameters" : [ + { + "label" : "_", + "name" : "processors", + "type" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + } + } + }, { "abiName" : "bjs_roundTripPointerFields", "effects" : { diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 141b87d35..b2a079c35 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -778,6 +778,7 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { testProtocolSupport(exports); testClosureSupport(exports); + testArraySupport(exports); } /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ function testClosureSupport(exports) { @@ -1300,6 +1301,129 @@ function setupTestGlobals(global) { }; } +/** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ +function testArraySupport(exports) { + const { Direction, Status, Theme, HttpStatus, Greeter } = exports; + + // Primitive arrays + assert.deepEqual(exports.roundTripIntArray([1, 2, 3, -10, 2147483647]), [1, 2, 3, -10, 2147483647]); + assert.deepEqual(exports.roundTripIntArray([]), []); + assert.deepEqual(exports.roundTripStringArray(["Hello", "World", ""]), ["Hello", "World", ""]); + const doubles = exports.roundTripDoubleArray([1.5, 0.0, -1.5, Infinity, NaN]); + assert.equal(doubles[0], 1.5); + assert(Number.isNaN(doubles[4])); + assert.deepEqual(exports.roundTripBoolArray([true, false, true]), [true, false, true]); + + // Enum arrays + assert.deepEqual(exports.roundTripDirectionArray([Direction.North, Direction.South]), [Direction.North, Direction.South]); + assert.deepEqual(exports.roundTripStatusArray([Status.Loading, Status.Success]), [Status.Loading, Status.Success]); + assert.deepEqual(exports.roundTripThemeArray([Theme.Light, Theme.Dark]), [Theme.Light, Theme.Dark]); + assert.deepEqual(exports.roundTripHttpStatusArray([HttpStatus.Ok, HttpStatus.NotFound]), [HttpStatus.Ok, HttpStatus.NotFound]); + + // Struct arrays + const points = [ + { x: 1.0, y: 2.0, label: "A", optCount: 10, optFlag: true }, + { x: 3.0, y: 4.0, label: "B", optCount: null, optFlag: null } + ]; + const pointResult = exports.roundTripDataPointArray(points); + assert.equal(pointResult[0].optCount, 10); + assert.equal(pointResult[1].optCount, null); + + // Class arrays + const g1 = new Greeter("Alice"); + const g2 = new Greeter("Bob"); + const gResult = exports.roundTripGreeterArray([g1, g2]); + assert.equal(gResult[0].name, "Alice"); + assert.equal(gResult[1].greet(), "Hello, Bob!"); + g1.release(); g2.release(); + gResult.forEach(g => g.release()); + + // Arrays of optional elements + assert.deepEqual(exports.roundTripOptionalIntArray([1, null, 3]), [1, null, 3]); + assert.deepEqual(exports.roundTripOptionalStringArray(["a", null, "b"]), ["a", null, "b"]); + const optPoint = { x: 1.0, y: 2.0, label: "", optCount: null, optFlag: null }; + const optPoints = exports.roundTripOptionalDataPointArray([optPoint, null]); + assert.deepEqual(optPoints[0], optPoint); + assert.equal(optPoints[1], null); + assert.deepEqual(exports.roundTripOptionalDirectionArray([Direction.North, null]), [Direction.North, null]); + assert.deepEqual(exports.roundTripOptionalStatusArray([Status.Success, null]), [Status.Success, null]); + + // Optional arrays + assert.deepEqual(exports.roundTripOptionalIntArrayType([1, 2, 3]), [1, 2, 3]); + assert.equal(exports.roundTripOptionalIntArrayType(null), null); + assert.deepEqual(exports.roundTripOptionalStringArrayType(["a", "b"]), ["a", "b"]); + assert.equal(exports.roundTripOptionalStringArrayType(null), null); + const og1 = new Greeter("OptGreeter"); + const optGreeterResult = exports.roundTripOptionalGreeterArrayType([og1]); + assert.equal(optGreeterResult[0].name, "OptGreeter"); + assert.equal(exports.roundTripOptionalGreeterArrayType(null), null); + og1.release(); + optGreeterResult.forEach(g => g.release()); + + // Nested arrays + assert.deepEqual(exports.roundTripNestedIntArray([[1, 2], [3]]), [[1, 2], [3]]); + assert.deepEqual(exports.roundTripNestedIntArray([[1, 2], [], [3]]), [[1, 2], [], [3]]); + assert.deepEqual(exports.roundTripNestedStringArray([["a", "b"], ["c"]]), [["a", "b"], ["c"]]); + assert.deepEqual(exports.roundTripNestedDoubleArray([[1.5], [2.5]]), [[1.5], [2.5]]); + assert.deepEqual(exports.roundTripNestedBoolArray([[true], [false]]), [[true], [false]]); + const nestedPoint = { x: 1.0, y: 2.0, label: "A", optCount: null, optFlag: null }; + assert.deepEqual(exports.roundTripNestedDataPointArray([[nestedPoint]])[0][0], nestedPoint); + assert.deepEqual(exports.roundTripNestedDirectionArray([[Direction.North], [Direction.South]]), [[Direction.North], [Direction.South]]); + const ng1 = new Greeter("Nested1"); + const ng2 = new Greeter("Nested2"); + const nestedGreeters = exports.roundTripNestedGreeterArray([[ng1], [ng2]]); + assert.equal(nestedGreeters[0][0].name, "Nested1"); + assert.equal(nestedGreeters[1][0].greet(), "Hello, Nested2!"); + ng1.release(); ng2.release(); + nestedGreeters.forEach(row => row.forEach(g => g.release())); + + // UnsafePointer-family arrays + const pointerValues = [1, 4, 1024, 65536, 2147483647]; + assert.deepEqual(exports.roundTripUnsafeRawPointerArray(pointerValues), pointerValues); + assert.deepEqual(exports.roundTripUnsafeMutableRawPointerArray(pointerValues), pointerValues); + assert.deepEqual(exports.roundTripOpaquePointerArray(pointerValues), pointerValues); + assert.deepEqual(exports.roundTripUnsafeRawPointerArray([]), []); + + // Default values + assert.equal(exports.arrayWithDefault(), 6); + assert.equal(exports.arrayWithDefault([10, 20]), 30); + assert.equal(exports.arrayWithOptionalDefault(), -1); + assert.equal(exports.arrayWithOptionalDefault(null), -1); + assert.equal(exports.arrayWithOptionalDefault([5, 5]), 10); + assert.equal(exports.arrayMixedDefaults(), "Sum: 30!"); + assert.equal(exports.arrayMixedDefaults("Total"), "Total: 30!"); + assert.equal(exports.arrayMixedDefaults("Total", [1, 2, 3]), "Total: 6!"); + assert.equal(exports.arrayMixedDefaults("Val", [100], "?"), "Val: 100?"); + assert.equal(exports.arrayMixedDefaults(undefined, [5, 5]), "Sum: 10!"); + assert.equal(exports.arrayMixedDefaults(undefined, undefined, "?"), "Sum: 30?"); + + const helper1 = new exports.Greeter("Helper1"); + const jsProcessor1 = { + count: 1, name: "Processor1", optionalTag: null, optionalCount: null, + direction: null, optionalTheme: null, httpStatus: null, apiResult: null, + helper: helper1, optionalHelper: null, + increment(by) { this.count += by; }, + getValue() { return this.count; }, + setLabelElements(a, b) { }, getLabel() { return ""; }, + isEven() { return this.count % 2 === 0; }, + processGreeter(g) { return ""; }, createGreeter() { return new exports.Greeter("P1"); }, + processOptionalGreeter(g) { return ""; }, createOptionalGreeter() { return null; }, + handleAPIResult(r) { }, getAPIResult() { return null; } + }; + + const consumeResult = exports.consumeDataProcessorArrayType([jsProcessor1]); + assert.equal(consumeResult, 1); + + const processors = [jsProcessor1]; + const result = exports.roundTripDataProcessorArrayType(processors); + + assert.equal(result.length, 1); + assert.equal(result[0], jsProcessor1); + assert.equal(result[0].count, 1); + + helper1.release(); +} + /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ function testProtocolSupport(exports) { let processorValue = 0; From dac11cd03c7bb5363f2d476a7d3f60d4867d3f71 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 30 Jan 2026 16:34:46 +0900 Subject: [PATCH 112/252] Revert "Bump playwright from 1.52.0 to 1.55.1 (#538)" This reverts commit 515b6d65bf95d8a05add7189226d4451d8c979e9. --- package-lock.json | 20 ++++++++------------ package.json | 1 - 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index bf7f36315..e12af9c97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,6 @@ "prettier": "3.5.3", "rollup": "^4.37.0", "rollup-plugin-dts": "^6.2.1", - "tslib": "^2.8.1", "typescript": "^5.8.2" } }, @@ -508,13 +507,12 @@ } }, "node_modules/playwright": { - "version": "1.55.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.55.1.tgz", - "integrity": "sha512-cJW4Xd/G3v5ovXtJJ52MAOclqeac9S/aGGgRzLabuF8TnIb6xHvMzKIa6JmrRzUkeXJgfL1MhukP0NK6l39h3A==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.52.0.tgz", + "integrity": "sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==", "dev": true, - "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.55.1" + "playwright-core": "1.52.0" }, "bin": { "playwright": "cli.js" @@ -527,11 +525,10 @@ } }, "node_modules/playwright-core": { - "version": "1.55.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.55.1.tgz", - "integrity": "sha512-Z6Mh9mkwX+zxSlHqdr5AOcJnfp+xUWLCt9uKV18fhzA8eyxUd8NUWzAjxUh55RZKSYwDGX0cfaySdhZJGMoJ+w==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.52.0.tgz", + "integrity": "sha512-l2osTgLXSMeuLZOML9qYODUQoPPnUsKsb5/P6LJ2e6uPKXUdPK5WYhN4z03G+YNbWmGDY4YENauNu4ZKczreHg==", "dev": true, - "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, @@ -582,7 +579,6 @@ "integrity": "sha512-iAtQy/L4QFU+rTJ1YUjXqJOJzuwEghqWzCEYD2FEghT7Gsy1VdABntrO4CLopA5IkflTyqNiLNwPcOJ3S7UKLg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/estree": "1.0.6" }, @@ -658,6 +654,7 @@ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true, "license": "0BSD", + "optional": true, "peer": true }, "node_modules/typescript": { @@ -666,7 +663,6 @@ "integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/package.json b/package.json index da7d5356d..96443ad9a 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,6 @@ "prettier": "3.5.3", "rollup": "^4.37.0", "rollup-plugin-dts": "^6.2.1", - "tslib": "^2.8.1", "typescript": "^5.8.2" } } From 59734ebc0b04313d6dbf0394947c41512fb83a2a Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 30 Jan 2026 18:14:18 +0900 Subject: [PATCH 113/252] Re-apply Playwright upgrade (#550) * Reapply "Bump playwright from 1.52.0 to 1.55.1 (#538)" This reverts commit dac11cd03c7bb5363f2d476a7d3f60d4867d3f71. * PackageToJS: Fix missing await for `page.exposeFunction` It caused concurrent calls to `exposeFunction` and resulted losing the function bindings after the playwright upgrade. --- Plugins/PackageToJS/Templates/bin/test.js | 2 +- Plugins/PackageToJS/Templates/test.js | 6 ++++-- package-lock.json | 20 ++++++++++++-------- package.json | 1 + 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Plugins/PackageToJS/Templates/bin/test.js b/Plugins/PackageToJS/Templates/bin/test.js index 1d48b6853..82ef88cc2 100644 --- a/Plugins/PackageToJS/Templates/bin/test.js +++ b/Plugins/PackageToJS/Templates/bin/test.js @@ -116,7 +116,7 @@ Hint: This typically means that a continuation leak occurred. for (const [name, fn] of Object.entries(functions)) { // Bind the page context to each function if needed // The function can optionally use the page from its closure - page.exposeFunction(name, fn); + await page.exposeFunction(name, fn); } }; } diff --git a/Plugins/PackageToJS/Templates/test.js b/Plugins/PackageToJS/Templates/test.js index 5b7090300..606040b04 100644 --- a/Plugins/PackageToJS/Templates/test.js +++ b/Plugins/PackageToJS/Templates/test.js @@ -108,10 +108,12 @@ Please run the following command to install it: page.on("console", (message) => { console.log(message.text()); }); - + + let resolveExit = undefined; const onExit = new Promise((resolve) => { - page.exposeFunction("exitTest", resolve); + resolveExit = resolve; }); + await page.exposeFunction("exitTest", resolveExit); await page.goto(`http://localhost:${address.port}/test.browser.html`); const exitCode = await onExit; await browser.close(); diff --git a/package-lock.json b/package-lock.json index e12af9c97..bf7f36315 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "prettier": "3.5.3", "rollup": "^4.37.0", "rollup-plugin-dts": "^6.2.1", + "tslib": "^2.8.1", "typescript": "^5.8.2" } }, @@ -507,12 +508,13 @@ } }, "node_modules/playwright": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.52.0.tgz", - "integrity": "sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==", + "version": "1.55.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.55.1.tgz", + "integrity": "sha512-cJW4Xd/G3v5ovXtJJ52MAOclqeac9S/aGGgRzLabuF8TnIb6xHvMzKIa6JmrRzUkeXJgfL1MhukP0NK6l39h3A==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.52.0" + "playwright-core": "1.55.1" }, "bin": { "playwright": "cli.js" @@ -525,10 +527,11 @@ } }, "node_modules/playwright-core": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.52.0.tgz", - "integrity": "sha512-l2osTgLXSMeuLZOML9qYODUQoPPnUsKsb5/P6LJ2e6uPKXUdPK5WYhN4z03G+YNbWmGDY4YENauNu4ZKczreHg==", + "version": "1.55.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.55.1.tgz", + "integrity": "sha512-Z6Mh9mkwX+zxSlHqdr5AOcJnfp+xUWLCt9uKV18fhzA8eyxUd8NUWzAjxUh55RZKSYwDGX0cfaySdhZJGMoJ+w==", "dev": true, + "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, @@ -579,6 +582,7 @@ "integrity": "sha512-iAtQy/L4QFU+rTJ1YUjXqJOJzuwEghqWzCEYD2FEghT7Gsy1VdABntrO4CLopA5IkflTyqNiLNwPcOJ3S7UKLg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/estree": "1.0.6" }, @@ -654,7 +658,6 @@ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true, "license": "0BSD", - "optional": true, "peer": true }, "node_modules/typescript": { @@ -663,6 +666,7 @@ "integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/package.json b/package.json index 96443ad9a..da7d5356d 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "prettier": "3.5.3", "rollup": "^4.37.0", "rollup-plugin-dts": "^6.2.1", + "tslib": "^2.8.1", "typescript": "^5.8.2" } } From d2ca6ebb57e81e5c64a36e0e90f4fa0cbe02e1d8 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 30 Jan 2026 18:24:55 +0900 Subject: [PATCH 114/252] Add opt-in tracing hooks for JS bridge (#548) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Built an opt-in tracing surface and wired it through the bridge when enabled by a new trait. Implemented `JSTracing` (start/end hooks for Swift→JS calls and JSClosure invocations) with per-thread storage in `Sources/JavaScriptKit/JSTracing.swift`. Added tracing entry points to Swift→JS calls (functions, methods via dynamic members with method names, constructors, and throwing calls) and JS→Swift closures so hooks fire around each bridge crossing when compiled with tracing; closure creation now records `StaticString` file IDs for reporting (`Sources/JavaScriptKit/FundamentalObjects/JSObject+CallAsFunction.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSObject.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSThrowingFunction.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift`). Introduced a `JavaScriptKitTracing` package trait that gates `JAVASCRIPTKIT_ENABLE_TRACING` and updated docs with enablement and usage guidance (`Package.swift`, `Sources/JavaScriptKit/Documentation.docc/Articles/Debugging.md`). Verified the manifest parses with `swift package dump-package`. Notes: Hooks are compiled out unless `--traits JavaScriptKitTracing` is provided, and JSClosure initializers now take `StaticString` for `file`. Next steps: try `swift build --traits JavaScriptKitTracing` and exercise hooks in your app; consider adding focused tests for tracing callbacks if desired. Tests not run (not requested). * Applied the review feedback: hooked tracing to the “Tracing” trait and removed the extra compdef, made JSClosure tracing use `String` file IDs, and avoided unknown placeholders for method names by allowing nil method names. - Updated trait name and removed redundant define; tracing is now gated by trait “Tracing” and uses `#if Tracing` (`Package.swift`). - Hooks now accept optional method names and closure file IDs as `String`, with all tracing conditionals using the trait flag (`Sources/JavaScriptKit/JSTracing.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSObject+CallAsFunction.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSThrowingFunction.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSObject.swift`). - Documentation updated to instruct enabling tracing via `--traits Tracing` (`Sources/JavaScriptKit/Documentation.docc/Articles/Debugging.md`). Tests not run. Suggest running `swift build --traits Tracing` to verify the tracing variant compiles. * Added tracing unit coverage and wired the trait into the Makefile’s `unittest` target. - New `Tests/JavaScriptKitTests/JSTracingTests.swift` exercises JS→JS call hooks (ensures method info/method name/args) and JSClosure hooks (verifies file/line metadata and end callbacks) under `#if Tracing`. - Refactored tracing-overloaded helpers to avoid conditional parameters and added `Sendable` to `JSTracing` to satisfy Swift 6 safety (`Sources/JavaScriptKit/FundamentalObjects/JSObject+CallAsFunction.swift`, `Sources/JavaScriptKit/JSTracing.swift`). - `make unittest` now enables the `Tracing` trait so tracing hooks compile during test runs (`Makefile`). I attempted `swift test --traits Tracing`; the build passed the new tracing warnings but the compiler crashed later with an unrelated wasm memory.grow codegen bug, so tests didn’t finish. You can rerun `make unittest SWIFT_SDK_ID=`; expect the same toolchain crash until Swift fixes that issue. * Add Swift 6.2 manifest and trait opt-out * Add Swift 6.2 manifest with tracing trait * Make tracing trait opt-out via env only * Add option to disable tracing trait in JavaScriptKit tests * Revert changes in Package.swift * Remove metadata fields from non-tracing builds --- .github/workflows/test.yml | 8 + Makefile | 6 + Package@swift-6.2.swift | 217 ++++++++++++++++++ .../Documentation.docc/Articles/Debugging.md | 22 ++ .../FundamentalObjects/JSClosure.swift | 63 +++-- .../JSObject+CallAsFunction.swift | 93 +++++++- .../FundamentalObjects/JSObject.swift | 20 +- .../JSThrowingFunction.swift | 9 + Sources/JavaScriptKit/JSTracing.swift | 133 +++++++++++ Tests/JavaScriptKitTests/JSTracingTests.swift | 53 +++++ 10 files changed, 601 insertions(+), 23 deletions(-) create mode 100644 Package@swift-6.2.swift create mode 100644 Sources/JavaScriptKit/JSTracing.swift create mode 100644 Tests/JavaScriptKitTests/JSTracingTests.swift diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4f1eb0a5b..fc7392f7f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,8 @@ jobs: download-url: https://download.swift.org/swift-6.1-release/ubuntu2204/swift-6.1-RELEASE/swift-6.1-RELEASE-ubuntu22.04.tar.gz wasi-backend: Node target: "wasm32-unknown-wasi" + env: | + JAVASCRIPTKIT_DISABLE_TRACING_TRAIT=1 - os: ubuntu-24.04 toolchain: download-url: https://download.swift.org/development/ubuntu2404/swift-DEVELOPMENT-SNAPSHOT-2025-12-01-a/swift-DEVELOPMENT-SNAPSHOT-2025-12-01-a-ubuntu24.04.tar.gz @@ -36,6 +38,12 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 + - name: Export matrix env + if: ${{ matrix.entry.env != '' && matrix.entry.env != null }} + run: | + cat <<'EOF' >> "$GITHUB_ENV" + ${{ matrix.entry.env }} + EOF - uses: ./.github/actions/install-swift with: download-url: ${{ matrix.entry.toolchain.download-url }} diff --git a/Makefile b/Makefile index 0c5d0122a..135465a73 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,9 @@ SWIFT_SDK_ID ?= +ifeq ($(JAVASCRIPTKIT_DISABLE_TRACING_TRAIT),1) + TRACING_ARGS := +else + TRACING_ARGS := --traits Tracing +endif .PHONY: bootstrap bootstrap: @@ -12,6 +17,7 @@ unittest: exit 2; \ } env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --swift-sdk "$(SWIFT_SDK_ID)" \ + $(TRACING_ARGS) \ --disable-sandbox \ js test --prelude ./Tests/prelude.mjs -Xnode --expose-gc diff --git a/Package@swift-6.2.swift b/Package@swift-6.2.swift new file mode 100644 index 000000000..456a87ca0 --- /dev/null +++ b/Package@swift-6.2.swift @@ -0,0 +1,217 @@ +// swift-tools-version:6.2 + +import CompilerPluginSupport +import PackageDescription + +// NOTE: needed for embedded customizations, ideally this will not be necessary at all in the future, or can be replaced with traits +let shouldBuildForEmbedded = Context.environment["JAVASCRIPTKIT_EXPERIMENTAL_EMBEDDED_WASM"].flatMap(Bool.init) ?? false +let useLegacyResourceBundling = + Context.environment["JAVASCRIPTKIT_USE_LEGACY_RESOURCE_BUNDLING"].flatMap(Bool.init) ?? false +let enableTracingByEnv = Context.environment["JAVASCRIPTKIT_ENABLE_TRACING"].flatMap(Bool.init) ?? false + +let tracingTrait = Trait( + name: "Tracing", + description: "Enable opt-in Swift <-> JavaScript bridge tracing hooks.", + enabledTraits: [] +) + +let testingLinkerFlags: [LinkerSetting] = [ + .unsafeFlags([ + "-Xlinker", "--stack-first", + "-Xlinker", "--global-base=524288", + "-Xlinker", "-z", + "-Xlinker", "stack-size=524288", + ]) +] + +let package = Package( + name: "JavaScriptKit", + platforms: [ + .macOS(.v13), + .iOS(.v13), + .tvOS(.v13), + .watchOS(.v6), + .macCatalyst(.v13), + ], + products: [ + .library(name: "JavaScriptKit", targets: ["JavaScriptKit"]), + .library(name: "JavaScriptEventLoop", targets: ["JavaScriptEventLoop"]), + .library(name: "JavaScriptBigIntSupport", targets: ["JavaScriptBigIntSupport"]), + .library(name: "JavaScriptFoundationCompat", targets: ["JavaScriptFoundationCompat"]), + .library(name: "JavaScriptEventLoopTestSupport", targets: ["JavaScriptEventLoopTestSupport"]), + .plugin(name: "PackageToJS", targets: ["PackageToJS"]), + .plugin(name: "BridgeJS", targets: ["BridgeJS"]), + .plugin(name: "BridgeJSCommandPlugin", targets: ["BridgeJSCommandPlugin"]), + ], + traits: [tracingTrait], + dependencies: [ + .package(url: "https://github.com/swiftlang/swift-syntax", "600.0.0"..<"603.0.0") + ], + targets: [ + .target( + name: "JavaScriptKit", + dependencies: ["_CJavaScriptKit", "BridgeJSMacros"], + exclude: useLegacyResourceBundling ? [] : ["Runtime"], + resources: useLegacyResourceBundling ? [.copy("Runtime")] : [], + cSettings: shouldBuildForEmbedded + ? [ + .unsafeFlags(["-fdeclspec"]) + ] : nil, + swiftSettings: [ + .enableExperimentalFeature("Extern"), + .define("Tracing", .when(traits: ["Tracing"])), + ] + + (enableTracingByEnv ? [.define("Tracing")] : []) + + (shouldBuildForEmbedded + ? [ + .enableExperimentalFeature("Embedded"), + .unsafeFlags(["-Xfrontend", "-emit-empty-object-file"]), + ] : []) + ), + .target(name: "_CJavaScriptKit"), + .macro( + name: "BridgeJSMacros", + dependencies: [ + .product(name: "SwiftSyntaxMacros", package: "swift-syntax"), + .product(name: "SwiftCompilerPlugin", package: "swift-syntax"), + ] + ), + + .testTarget( + name: "JavaScriptKitTests", + dependencies: ["JavaScriptKit"], + swiftSettings: [ + .enableExperimentalFeature("Extern"), + .define("Tracing", .when(traits: ["Tracing"])), + ] + (enableTracingByEnv ? [.define("Tracing")] : []), + linkerSettings: testingLinkerFlags + ), + + .target( + name: "JavaScriptBigIntSupport", + dependencies: ["_CJavaScriptBigIntSupport", "JavaScriptKit"], + swiftSettings: shouldBuildForEmbedded + ? [ + .enableExperimentalFeature("Embedded"), + .unsafeFlags(["-Xfrontend", "-emit-empty-object-file"]), + ] : [] + ), + .target(name: "_CJavaScriptBigIntSupport", dependencies: ["_CJavaScriptKit"]), + .testTarget( + name: "JavaScriptBigIntSupportTests", + dependencies: ["JavaScriptBigIntSupport", "JavaScriptKit"], + linkerSettings: testingLinkerFlags + ), + + .target( + name: "JavaScriptEventLoop", + dependencies: ["JavaScriptKit", "_CJavaScriptEventLoop"], + swiftSettings: shouldBuildForEmbedded + ? [ + .enableExperimentalFeature("Embedded"), + .unsafeFlags(["-Xfrontend", "-emit-empty-object-file"]), + ] : [] + ), + .target(name: "_CJavaScriptEventLoop"), + .testTarget( + name: "JavaScriptEventLoopTests", + dependencies: [ + "JavaScriptEventLoop", + "JavaScriptKit", + "JavaScriptEventLoopTestSupport", + ], + swiftSettings: [ + .enableExperimentalFeature("Extern") + ], + linkerSettings: testingLinkerFlags + ), + .target( + name: "JavaScriptEventLoopTestSupport", + dependencies: [ + "_CJavaScriptEventLoopTestSupport", + "JavaScriptEventLoop", + ] + ), + .target(name: "_CJavaScriptEventLoopTestSupport"), + .testTarget( + name: "JavaScriptEventLoopTestSupportTests", + dependencies: [ + "JavaScriptKit", + "JavaScriptEventLoopTestSupport", + ], + linkerSettings: testingLinkerFlags + ), + .target( + name: "JavaScriptFoundationCompat", + dependencies: [ + "JavaScriptKit" + ] + ), + .testTarget( + name: "JavaScriptFoundationCompatTests", + dependencies: [ + "JavaScriptFoundationCompat" + ], + linkerSettings: testingLinkerFlags + ), + .plugin( + name: "PackageToJS", + capability: .command( + intent: .custom(verb: "js", description: "Convert a Swift package to a JavaScript package") + ), + path: "Plugins/PackageToJS/Sources" + ), + .plugin( + name: "BridgeJS", + capability: .buildTool(), + dependencies: ["BridgeJSTool"], + path: "Plugins/BridgeJS/Sources/BridgeJSBuildPlugin" + ), + .plugin( + name: "BridgeJSCommandPlugin", + capability: .command( + intent: .custom(verb: "bridge-js", description: "Generate bridging code"), + permissions: [.writeToPackageDirectory(reason: "Generate bridging code")] + ), + dependencies: ["BridgeJSTool"], + path: "Plugins/BridgeJS/Sources/BridgeJSCommandPlugin" + ), + .executableTarget( + name: "BridgeJSTool", + dependencies: [ + .product(name: "SwiftParser", package: "swift-syntax"), + .product(name: "SwiftSyntax", package: "swift-syntax"), + .product(name: "SwiftBasicFormat", package: "swift-syntax"), + .product(name: "SwiftSyntaxBuilder", package: "swift-syntax"), + ], + exclude: ["TS2Swift/JavaScript", "README.md"] + ), + .testTarget( + name: "BridgeJSRuntimeTests", + dependencies: ["JavaScriptKit", "JavaScriptEventLoop"], + exclude: [ + "bridge-js.config.json", + "bridge-js.d.ts", + "bridge-js.global.d.ts", + "Generated/JavaScript", + ], + swiftSettings: [ + .enableExperimentalFeature("Extern") + ], + linkerSettings: testingLinkerFlags + ), + .testTarget( + name: "BridgeJSGlobalTests", + dependencies: ["JavaScriptKit", "JavaScriptEventLoop"], + exclude: [ + "bridge-js.config.json", + "bridge-js.d.ts", + "Generated/JavaScript", + ], + swiftSettings: [ + .enableExperimentalFeature("Extern") + ], + linkerSettings: testingLinkerFlags + ), + ] +) diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/Debugging.md b/Sources/JavaScriptKit/Documentation.docc/Articles/Debugging.md index f766be2ed..a8e5d77fd 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/Debugging.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/Debugging.md @@ -57,3 +57,25 @@ Alternatively, you can use the official [`C/C++ DevTools Support (DWARF)`](https ![Chrome DevTools](chrome-devtools.png) See [the DevTools team's official introduction](https://developer.chrome.com/blog/wasm-debugging-2020) for more details about the extension. + +## Bridge Call Tracing + +Enable the `Tracing` package trait to compile lightweight hook points for Swift <-> JavaScript calls. Tracing is off by default and adds no runtime overhead unless the trait is enabled: + +```bash +swift build --traits Tracing +``` + +The hooks are invoked at the start and end of each bridge crossing without collecting data for you. For example: + +```swift +let removeCallHook = JSTracing.default.addJSCallHook { info in + let started = Date() + return { print("JS call \(info) finished in \(Date().timeIntervalSince(started))s") } +} + +let removeClosureHook = JSTracing.default.addJSClosureCallHook { info in + print("JSClosure created at \(info.fileID):\(info.line)") + return nil +} +``` diff --git a/Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift b/Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift index baeb29847..941b3f468 100644 --- a/Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift +++ b/Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift @@ -18,7 +18,11 @@ public protocol JSClosureProtocol: JSValueCompatible { public class JSOneshotClosure: JSObject, JSClosureProtocol { private var hostFuncRef: JavaScriptHostFuncRef = 0 - public init(file: String = #fileID, line: UInt32 = #line, _ body: @escaping (sending [JSValue]) -> JSValue) { + public init( + file: String = #fileID, + line: UInt32 = #line, + _ body: @escaping (sending [JSValue]) -> JSValue + ) { // 1. Fill `id` as zero at first to access `self` to get `ObjectIdentifier`. super.init(id: 0) @@ -29,12 +33,14 @@ public class JSOneshotClosure: JSObject, JSClosureProtocol { } // 3. Retain the given body in static storage by `funcRef`. - JSClosure.sharedClosures.wrappedValue[hostFuncRef] = ( - self, - { + JSClosure.sharedClosures.wrappedValue[hostFuncRef] = .init( + object: self, + body: { defer { self.release() } return body($0) - } + }, + fileID: file, + line: line ) } @@ -114,14 +120,28 @@ public class JSClosure: JSObject, JSClosureProtocol { // `removeValue(forKey:)` on a dictionary with value type containing // `sending`. Wrap the value type with a struct to avoid the crash. struct Entry { - let item: (object: JSObject, body: (sending [JSValue]) -> JSValue) + let object: JSObject + let body: (sending [JSValue]) -> JSValue + #if Tracing + let fileID: String + let line: UInt32 + #endif + + init(object: JSObject, body: @escaping (sending [JSValue]) -> JSValue, fileID: String, line: UInt32) { + self.object = object + self.body = body + #if Tracing + self.fileID = fileID + self.line = line + #endif + } } private var storage: [JavaScriptHostFuncRef: Entry] = [:] init() {} - subscript(_ key: JavaScriptHostFuncRef) -> (object: JSObject, body: (sending [JSValue]) -> JSValue)? { - get { storage[key]?.item } - set { storage[key] = newValue.map { Entry(item: $0) } } + subscript(_ key: JavaScriptHostFuncRef) -> Entry? { + get { storage[key] } + set { storage[key] = newValue } } } @@ -150,7 +170,11 @@ public class JSClosure: JSObject, JSClosureProtocol { }) } - public init(file: String = #fileID, line: UInt32 = #line, _ body: @escaping (sending [JSValue]) -> JSValue) { + public init( + file: String = #fileID, + line: UInt32 = #line, + _ body: @escaping (sending [JSValue]) -> JSValue + ) { // 1. Fill `id` as zero at first to access `self` to get `ObjectIdentifier`. super.init(id: 0) @@ -161,7 +185,12 @@ public class JSClosure: JSObject, JSClosureProtocol { } // 3. Retain the given body in static storage by `funcRef`. - Self.sharedClosures.wrappedValue[hostFuncRef] = (self, body) + Self.sharedClosures.wrappedValue[hostFuncRef] = .init( + object: self, + body: body, + fileID: file, + line: line + ) } @available(*, unavailable, message: "JSClosure does not support dictionary literal initialization") @@ -317,14 +346,22 @@ func _call_host_function_impl( _ argc: Int32, _ callbackFuncRef: JavaScriptObjectRef ) -> Bool { - guard let (_, hostFunc) = JSClosure.sharedClosures.wrappedValue[hostFuncRef] else { + guard let entry = JSClosure.sharedClosures.wrappedValue[hostFuncRef] else { return true } + #if Tracing + let traceEnd = JSTracingHooks.beginJSClosureCall( + JSTracing.JSClosureCallInfo(fileID: entry.fileID, line: UInt(entry.line)) + ) + #endif var arguments: [JSValue] = [] for i in 0.. JSObject { - arguments.withRawJSValues { rawValues in + #if Tracing + let jsValues = arguments.map { $0.jsValue } + return new(arguments: jsValues) + #else + return arguments.withRawJSValues { rawValues in rawValues.withUnsafeBufferPointer { bufferPointer in JSObject(id: swjs_call_new(self.id, bufferPointer.baseAddress!, Int32(bufferPointer.count))) } } + #endif } /// A variadic arguments version of `new`. @@ -89,8 +94,22 @@ extension JSObject { invokeNonThrowingJSFunction(arguments: arguments).jsValue } + /// Instantiate an object from this function as a constructor. + /// + /// Guaranteed to return an object because either: + /// + /// - a. the constructor explicitly returns an object, or + /// - b. the constructor returns nothing, which causes JS to return the `this` value, or + /// - c. the constructor returns undefined, null or a non-object, in which case JS also returns `this`. + /// + /// - Parameter arguments: Arguments to be passed to this constructor function. + /// - Returns: A new instance of this constructor. public func new(arguments: [JSValue]) -> JSObject { - arguments.withRawJSValues { rawValues in + #if Tracing + let traceEnd = JSTracingHooks.beginJSCall(.function(function: self, arguments: arguments)) + defer { traceEnd?() } + #endif + return arguments.withRawJSValues { rawValues in rawValues.withUnsafeBufferPointer { bufferPointer in JSObject(id: swjs_call_new(self.id, bufferPointer.baseAddress!, Int32(bufferPointer.count))) } @@ -103,22 +122,80 @@ extension JSObject { } final func invokeNonThrowingJSFunction(arguments: [JSValue]) -> RawJSValue { - arguments.withRawJSValues { invokeNonThrowingJSFunction(rawValues: $0) } - } - - final func invokeNonThrowingJSFunction(arguments: [JSValue], this: JSObject) -> RawJSValue { - arguments.withRawJSValues { invokeNonThrowingJSFunction(rawValues: $0, this: this) } + #if Tracing + let traceEnd = JSTracingHooks.beginJSCall(.function(function: self, arguments: arguments)) + #endif + let result = arguments.withRawJSValues { invokeNonThrowingJSFunction(rawValues: $0) } + #if Tracing + traceEnd?() + #endif + return result + } + + #if Tracing + final func invokeNonThrowingJSFunction( + arguments: [JSValue], + this: JSObject, + tracedMethodName: String? = nil + ) -> RawJSValue { + let traceEnd = JSTracingHooks.beginJSCall( + .method(receiver: this, methodName: tracedMethodName, arguments: arguments) + ) + let result = arguments.withRawJSValues { + invokeNonThrowingJSFunction( + rawValues: $0, + this: this + ) + } + traceEnd?() + return result + } + #else + final func invokeNonThrowingJSFunction( + arguments: [JSValue], + this: JSObject + ) -> RawJSValue { + arguments.withRawJSValues { + invokeNonThrowingJSFunction( + rawValues: $0, + this: this + ) + } } + #endif #if !hasFeature(Embedded) final func invokeNonThrowingJSFunction(arguments: [ConvertibleToJSValue]) -> RawJSValue { + #if Tracing + let jsValues = arguments.map { $0.jsValue } + return invokeNonThrowingJSFunction(arguments: jsValues) + #else arguments.withRawJSValues { invokeNonThrowingJSFunction(rawValues: $0) } + #endif } - final func invokeNonThrowingJSFunction(arguments: [ConvertibleToJSValue], this: JSObject) -> RawJSValue { + #if Tracing + final func invokeNonThrowingJSFunction( + arguments: [ConvertibleToJSValue], + this: JSObject, + tracedMethodName: String? = nil + ) -> RawJSValue { + let jsValues = arguments.map { $0.jsValue } + return invokeNonThrowingJSFunction( + arguments: jsValues, + this: this, + tracedMethodName: tracedMethodName + ) + } + #else + final func invokeNonThrowingJSFunction( + arguments: [ConvertibleToJSValue], + this: JSObject + ) -> RawJSValue { arguments.withRawJSValues { invokeNonThrowingJSFunction(rawValues: $0, this: this) } } #endif + #endif final private func invokeNonThrowingJSFunction(rawValues: [RawJSValue]) -> RawJSValue { rawValues.withUnsafeBufferPointer { [id] bufferPointer in diff --git a/Sources/JavaScriptKit/FundamentalObjects/JSObject.swift b/Sources/JavaScriptKit/FundamentalObjects/JSObject.swift index 101f13a95..caacd49f2 100644 --- a/Sources/JavaScriptKit/FundamentalObjects/JSObject.swift +++ b/Sources/JavaScriptKit/FundamentalObjects/JSObject.swift @@ -94,7 +94,15 @@ public class JSObject: Equatable, ExpressibleByDictionaryLiteral { public subscript(_ name: String) -> ((ConvertibleToJSValue...) -> JSValue)? { guard let function = self[name].function else { return nil } return { (arguments: ConvertibleToJSValue...) in - function(this: self, arguments: arguments) + #if Tracing + return function.invokeNonThrowingJSFunction( + arguments: arguments, + this: self, + tracedMethodName: name + ).jsValue + #else + return function.invokeNonThrowingJSFunction(arguments: arguments, this: self).jsValue + #endif } } @@ -112,7 +120,15 @@ public class JSObject: Equatable, ExpressibleByDictionaryLiteral { public subscript(_ name: JSString) -> ((ConvertibleToJSValue...) -> JSValue)? { guard let function = self[name].function else { return nil } return { (arguments: ConvertibleToJSValue...) in - function(this: self, arguments: arguments) + #if Tracing + return function.invokeNonThrowingJSFunction( + arguments: arguments, + this: self, + tracedMethodName: String(name) + ).jsValue + #else + return function.invokeNonThrowingJSFunction(arguments: arguments, this: self).jsValue + #endif } } diff --git a/Sources/JavaScriptKit/FundamentalObjects/JSThrowingFunction.swift b/Sources/JavaScriptKit/FundamentalObjects/JSThrowingFunction.swift index 7c75ad556..94b5b0eca 100644 --- a/Sources/JavaScriptKit/FundamentalObjects/JSThrowingFunction.swift +++ b/Sources/JavaScriptKit/FundamentalObjects/JSThrowingFunction.swift @@ -77,6 +77,15 @@ private func invokeJSFunction( arguments: [ConvertibleToJSValue], this: JSObject? ) throws -> JSValue { + #if Tracing + let jsValues = arguments.map { $0.jsValue } + let traceEnd = JSTracingHooks.beginJSCall( + this.map { + .method(receiver: $0, methodName: nil, arguments: jsValues) + } ?? .function(function: jsFunc, arguments: jsValues) + ) + defer { traceEnd?() } + #endif let id = jsFunc.id let (result, isException) = arguments.withRawJSValues { rawValues in rawValues.withUnsafeBufferPointer { bufferPointer -> (JSValue, Bool) in diff --git a/Sources/JavaScriptKit/JSTracing.swift b/Sources/JavaScriptKit/JSTracing.swift new file mode 100644 index 000000000..8804e9afb --- /dev/null +++ b/Sources/JavaScriptKit/JSTracing.swift @@ -0,0 +1,133 @@ +#if Tracing + +/// Hooks for tracing Swift <-> JavaScript bridge calls. +public struct JSTracing: Sendable { + public static let `default` = JSTracing() + + public enum JSCallInfo { + case function(function: JSObject, arguments: [JSValue]) + case method(receiver: JSObject, methodName: String?, arguments: [JSValue]) + } + + /// Register a hook for Swift to JavaScript calls. + /// + /// The hook is invoked at the start of the call. Return a closure to run when + /// the call finishes, or `nil` to skip the end hook. + /// + /// - Returns: A cleanup closure that unregisters the hook. + @discardableResult + public func addJSCallHook( + _ hook: @escaping (_ info: JSCallInfo) -> (() -> Void)? + ) -> () -> Void { + JSTracingHooks.addJSCallHook(hook) + } + + public struct JSClosureCallInfo { + /// The file identifier where the called `JSClosure` was created. + public let fileID: String + /// The line number where the called `JSClosure` was created. + public let line: UInt + } + + /// Register a hook for JavaScript to Swift calls via `JSClosure`. + /// + /// The hook is invoked at the start of the call. Return a closure to run when + /// the call finishes, or `nil` to skip the end hook. + /// + /// - Returns: A cleanup closure that unregisters the hook. + @discardableResult + public func addJSClosureCallHook( + _ hook: @escaping (_ info: JSClosureCallInfo) -> (() -> Void)? + ) -> () -> Void { + JSTracingHooks.addJSClosureCallHook(hook) + } +} + +enum JSTracingHooks { + typealias HookEnd = () -> Void + typealias JSCallHook = (JSTracing.JSCallInfo) -> HookEnd? + typealias JSClosureCallHook = (JSTracing.JSClosureCallInfo) -> HookEnd? + + private final class HookList { + private var hooks: [(id: UInt, hook: Hook)] = [] + private var nextID: UInt = 0 + + var isEmpty: Bool { hooks.isEmpty } + + func add(_ hook: Hook) -> UInt { + let id = nextID + nextID &+= 1 + hooks.append((id, hook)) + return id + } + + func remove(id: UInt) { + hooks.removeAll { $0.id == id } + } + + func forEach(_ body: (Hook) -> Void) { + for entry in hooks { + body(entry.hook) + } + } + } + + private final class Storage { + let jsCallHooks = HookList() + let jsClosureCallHooks = HookList() + } + + private static let storage = LazyThreadLocal(initialize: Storage.init) + + static func addJSCallHook(_ hook: @escaping JSCallHook) -> () -> Void { + let storage = storage.wrappedValue + let id = storage.jsCallHooks.add(hook) + return { storage.jsCallHooks.remove(id: id) } + } + + static func addJSClosureCallHook(_ hook: @escaping JSClosureCallHook) -> () -> Void { + let storage = storage.wrappedValue + let id = storage.jsClosureCallHooks.add(hook) + return { storage.jsClosureCallHooks.remove(id: id) } + } + + static func beginJSCall(_ info: JSTracing.JSCallInfo) -> HookEnd? { + let storage = storage.wrappedValue + guard !storage.jsCallHooks.isEmpty else { return nil } + + var callbacks: [HookEnd] = [] + storage.jsCallHooks.forEach { hook in + if let callback = hook(info) { + callbacks.append(callback) + } + } + + guard !callbacks.isEmpty else { return nil } + return { + for callback in callbacks.reversed() { + callback() + } + } + } + + static func beginJSClosureCall(_ info: JSTracing.JSClosureCallInfo) -> HookEnd? { + let storage = storage.wrappedValue + guard !storage.jsClosureCallHooks.isEmpty else { return nil } + + var callbacks: [HookEnd] = [] + storage.jsClosureCallHooks.forEach { hook in + if let callback = hook(info) { + callbacks.append(callback) + } + } + + guard !callbacks.isEmpty else { return nil } + return { + for callback in callbacks.reversed() { + callback() + } + } + } +} + +#endif diff --git a/Tests/JavaScriptKitTests/JSTracingTests.swift b/Tests/JavaScriptKitTests/JSTracingTests.swift new file mode 100644 index 000000000..84fb9bfc6 --- /dev/null +++ b/Tests/JavaScriptKitTests/JSTracingTests.swift @@ -0,0 +1,53 @@ +#if Tracing +import JavaScriptKit +import XCTest + +final class JSTracingTests: XCTestCase { + func testJSCallHookReportsMethod() throws { + var startInfo: [JSTracing.JSCallInfo] = [] + var ended = 0 + let remove = JSTracing.default.addJSCallHook { info in + startInfo.append(info) + return { ended += 1 } + } + defer { remove() } + + let globalObject1 = JSObject.global.globalObject1 + let prop5 = try XCTUnwrap(globalObject1.prop_5.object) + _ = prop5.func6!(true, 1, 2) + + XCTAssertEqual(startInfo.count, 1) + guard case let .method(receiver, methodName, arguments) = startInfo.first else { + XCTFail("Expected method info") + return + } + XCTAssertEqual(receiver.id, prop5.id) + XCTAssertEqual(methodName, "func6") + XCTAssertEqual(arguments, [.boolean(true), .number(1), .number(2)]) + XCTAssertEqual(ended, 1) + } + + func testJSClosureCallHookReportsMetadata() throws { + var startInfo: [JSTracing.JSClosureCallInfo] = [] + var ended = 0 + let remove = JSTracing.default.addJSClosureCallHook { info in + startInfo.append(info) + return { ended += 1 } + } + defer { remove() } + + let globalObject1 = JSObject.global.globalObject1 + let prop6 = try XCTUnwrap(globalObject1.prop_6.object) + let closure = JSClosure(file: "TracingTests.swift", line: 4242) { _ in .number(7) } + prop6.host_func_1 = .object(closure) + + let callHost = try XCTUnwrap(prop6.call_host_1.function) + XCTAssertEqual(callHost(), .number(7)) + + XCTAssertEqual(startInfo.count, 1) + XCTAssertEqual(startInfo.first?.fileID, "TracingTests.swift") + XCTAssertEqual(startInfo.first?.line, 4242) + XCTAssertEqual(ended, 1) + } +} +#endif From d08ab429df178ac7262b5fa3576c5e1a676653a4 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Sat, 31 Jan 2026 04:57:12 +0700 Subject: [PATCH 115/252] BridgeJS: Array benchmarks (#549) --- Benchmarks/Sources/Benchmarks.swift | 128 +++ Benchmarks/Sources/Generated/BridgeJS.swift | 689 +++++++++++++ .../Generated/JavaScript/BridgeJS.json | 943 ++++++++++++++++++ Benchmarks/run.js | 229 +++++ 4 files changed, 1989 insertions(+) diff --git a/Benchmarks/Sources/Benchmarks.swift b/Benchmarks/Sources/Benchmarks.swift index 921db50ea..59da8c96c 100644 --- a/Benchmarks/Sources/Benchmarks.swift +++ b/Benchmarks/Sources/Benchmarks.swift @@ -257,6 +257,134 @@ enum ComplexResult { } } +// MARK: - Array Performance Tests + +@JS struct Point { + var x: Double + var y: Double +} + +@JS class ArrayRoundtrip { + @JS init() {} + + // MARK: Primitive Arrays - Int + + @JS func takeIntArray(_ values: [Int]) {} + @JS func makeIntArray() -> [Int] { + return Array(1...1000) + } + @JS func roundtripIntArray(_ values: [Int]) -> [Int] { + return values + } + + @JS func makeIntArrayLarge() -> [Int] { + return Array(1...10000) + } + + // MARK: Primitive Arrays - Double + + @JS func takeDoubleArray(_ values: [Double]) {} + @JS func makeDoubleArray() -> [Double] { + return (1...1000).map { Double($0) * 1.1 } + } + @JS func roundtripDoubleArray(_ values: [Double]) -> [Double] { + return values + } + + // MARK: Primitive Arrays - String + + @JS func takeStringArray(_ values: [String]) {} + @JS func makeStringArray() -> [String] { + return ["one", "two", "three", "four", "five"] + } + @JS func roundtripStringArray(_ values: [String]) -> [String] { + return values + } + + // MARK: Struct Arrays + + @JS func takePointArray(_ points: [Point]) {} + @JS func makePointArray() -> [Point] { + return [ + Point(x: 0.0, y: 0.0), + Point(x: 1.0, y: 1.0), + Point(x: 2.0, y: 2.0), + Point(x: 3.0, y: 3.0), + Point(x: 4.0, y: 4.0), + ] + } + @JS func roundtripPointArray(_ points: [Point]) -> [Point] { + return points + } + + @JS func makePointArrayLarge() -> [Point] { + return (0..<50).map { Point(x: Double($0), y: Double($0)) } + } + + // MARK: Nested Arrays + + @JS func takeNestedIntArray(_ values: [[Int]]) {} + @JS func makeNestedIntArray() -> [[Int]] { + return [ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9], + ] + } + @JS func roundtripNestedIntArray(_ values: [[Int]]) -> [[Int]] { + return values + } + + @JS func takeNestedPointArray(_ points: [[Point]]) {} + @JS func makeNestedPointArray() -> [[Point]] { + return [ + [Point(x: 0.0, y: 0.0), Point(x: 1.0, y: 1.0)], + [Point(x: 2.0, y: 2.0), Point(x: 3.0, y: 3.0)], + [Point(x: 4.0, y: 4.0), Point(x: 5.0, y: 5.0)], + ] + } + @JS func roundtripNestedPointArray(_ points: [[Point]]) -> [[Point]] { + return points + } + + // MARK: Optional Element Arrays + + @JS func takeOptionalIntArray(_ values: [Int?]) {} + @JS func makeOptionalIntArray() -> [Int?] { + return [1, nil, 3, nil, 5, nil, 7, nil, 9, nil] + } + @JS func roundtripOptionalIntArray(_ values: [Int?]) -> [Int?] { + return values + } + + @JS func takeOptionalPointArray(_ points: [Point?]) {} + @JS func makeOptionalPointArray() -> [Point?] { + return [ + Point(x: 0.0, y: 0.0), + nil, + Point(x: 2.0, y: 2.0), + nil, + Point(x: 4.0, y: 4.0), + ] + } + @JS func roundtripOptionalPointArray(_ points: [Point?]) -> [Point?] { + return points + } + + // MARK: Optional Arrays + + @JS func takeOptionalArray(_ values: [Int]?) {} + @JS func makeOptionalArraySome() -> [Int]? { + return [1, 2, 3, 4, 5] + } + @JS func makeOptionalArrayNone() -> [Int]? { + return nil + } + @JS func roundtripOptionalArray(_ values: [Int]?) -> [Int]? { + return values + } +} + @JS func run() { let call = Benchmark("Call") diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 9cf164d6d..569eb2eac 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -475,6 +475,51 @@ fileprivate func _bjs_struct_lift_ComplexStruct() -> Int32 { } #endif +extension Point: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { + let y = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let x = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + return Point(x: x, y: y) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + _swift_js_push_f64(self.x) + _swift_js_push_f64(self.y) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + 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(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Point") +fileprivate func _bjs_struct_lift_Point() -> Int32 +#else +fileprivate func _bjs_struct_lift_Point() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_run") @_cdecl("bjs_run") public func _bjs_run() -> Void { @@ -1427,6 +1472,650 @@ fileprivate func _bjs_ClassRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> } #endif +@_expose(wasm, "bjs_ArrayRoundtrip_init") +@_cdecl("bjs_ArrayRoundtrip_init") +public func _bjs_ArrayRoundtrip_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ArrayRoundtrip() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_takeIntArray") +@_cdecl("bjs_ArrayRoundtrip_takeIntArray") +public func _bjs_ArrayRoundtrip_takeIntArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeIntArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_makeIntArray") +@_cdecl("bjs_ArrayRoundtrip_makeIntArray") +public func _bjs_ArrayRoundtrip_makeIntArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeIntArray() + for __bjs_elem_ret in ret { + _swift_js_push_int(Int32(__bjs_elem_ret))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_roundtripIntArray") +@_cdecl("bjs_ArrayRoundtrip_roundtripIntArray") +public func _bjs_ArrayRoundtrip_roundtripIntArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripIntArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_int(Int32(__bjs_elem_ret))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_makeIntArrayLarge") +@_cdecl("bjs_ArrayRoundtrip_makeIntArrayLarge") +public func _bjs_ArrayRoundtrip_makeIntArrayLarge(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeIntArrayLarge() + for __bjs_elem_ret in ret { + _swift_js_push_int(Int32(__bjs_elem_ret))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_takeDoubleArray") +@_cdecl("bjs_ArrayRoundtrip_takeDoubleArray") +public func _bjs_ArrayRoundtrip_takeDoubleArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeDoubleArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Double] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + } + __result.reverse() + return __result + }()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_makeDoubleArray") +@_cdecl("bjs_ArrayRoundtrip_makeDoubleArray") +public func _bjs_ArrayRoundtrip_makeDoubleArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeDoubleArray() + for __bjs_elem_ret in ret { + _swift_js_push_f64(__bjs_elem_ret)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_roundtripDoubleArray") +@_cdecl("bjs_ArrayRoundtrip_roundtripDoubleArray") +public func _bjs_ArrayRoundtrip_roundtripDoubleArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripDoubleArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Double] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + _swift_js_push_f64(__bjs_elem_ret)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_takeStringArray") +@_cdecl("bjs_ArrayRoundtrip_takeStringArray") +public func _bjs_ArrayRoundtrip_takeStringArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeStringArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [String] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_makeStringArray") +@_cdecl("bjs_ArrayRoundtrip_makeStringArray") +public func _bjs_ArrayRoundtrip_makeStringArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeStringArray() + for __bjs_elem_ret in ret { + var __bjs_ret_elem = __bjs_elem_ret + __bjs_ret_elem.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + }} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_roundtripStringArray") +@_cdecl("bjs_ArrayRoundtrip_roundtripStringArray") +public func _bjs_ArrayRoundtrip_roundtripStringArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripStringArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [String] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + var __bjs_ret_elem = __bjs_elem_ret + __bjs_ret_elem.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + }} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_takePointArray") +@_cdecl("bjs_ArrayRoundtrip_takePointArray") +public func _bjs_ArrayRoundtrip_takePointArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takePointArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Point] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Point.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_makePointArray") +@_cdecl("bjs_ArrayRoundtrip_makePointArray") +public func _bjs_ArrayRoundtrip_makePointArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makePointArray() + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_roundtripPointArray") +@_cdecl("bjs_ArrayRoundtrip_roundtripPointArray") +public func _bjs_ArrayRoundtrip_roundtripPointArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripPointArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Point] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Point.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_makePointArrayLarge") +@_cdecl("bjs_ArrayRoundtrip_makePointArrayLarge") +public func _bjs_ArrayRoundtrip_makePointArrayLarge(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makePointArrayLarge() + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_takeNestedIntArray") +@_cdecl("bjs_ArrayRoundtrip_takeNestedIntArray") +public func _bjs_ArrayRoundtrip_takeNestedIntArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedIntArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[Int]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_makeNestedIntArray") +@_cdecl("bjs_ArrayRoundtrip_makeNestedIntArray") +public func _bjs_ArrayRoundtrip_makeNestedIntArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeNestedIntArray() + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + _swift_js_push_int(Int32(__bjs_elem_ret_elem))} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_roundtripNestedIntArray") +@_cdecl("bjs_ArrayRoundtrip_roundtripNestedIntArray") +public func _bjs_ArrayRoundtrip_roundtripNestedIntArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedIntArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[Int]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + _swift_js_push_int(Int32(__bjs_elem_ret_elem))} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_takeNestedPointArray") +@_cdecl("bjs_ArrayRoundtrip_takeNestedPointArray") +public func _bjs_ArrayRoundtrip_takeNestedPointArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedPointArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[Point]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Point] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Point.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_makeNestedPointArray") +@_cdecl("bjs_ArrayRoundtrip_makeNestedPointArray") +public func _bjs_ArrayRoundtrip_makeNestedPointArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeNestedPointArray() + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + __bjs_elem_ret_elem.bridgeJSLowerReturn()} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_roundtripNestedPointArray") +@_cdecl("bjs_ArrayRoundtrip_roundtripNestedPointArray") +public func _bjs_ArrayRoundtrip_roundtripNestedPointArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedPointArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [[Point]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append({ + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Point] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Point.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + for __bjs_elem_ret_elem in __bjs_elem_ret { + __bjs_elem_ret_elem.bridgeJSLowerReturn()} + _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_takeOptionalIntArray") +@_cdecl("bjs_ArrayRoundtrip_takeOptionalIntArray") +public func _bjs_ArrayRoundtrip_takeOptionalIntArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeOptionalIntArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_makeOptionalIntArray") +@_cdecl("bjs_ArrayRoundtrip_makeOptionalIntArray") +public func _bjs_ArrayRoundtrip_makeOptionalIntArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalIntArray() + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + _swift_js_push_int(Int32(__bjs_unwrapped_ret_elem))} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_roundtripOptionalIntArray") +@_cdecl("bjs_ArrayRoundtrip_roundtripOptionalIntArray") +public func _bjs_ArrayRoundtrip_roundtripOptionalIntArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripOptionalIntArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + _swift_js_push_int(Int32(__bjs_unwrapped_ret_elem))} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_takeOptionalPointArray") +@_cdecl("bjs_ArrayRoundtrip_takeOptionalPointArray") +public func _bjs_ArrayRoundtrip_takeOptionalPointArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeOptionalPointArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_makeOptionalPointArray") +@_cdecl("bjs_ArrayRoundtrip_makeOptionalPointArray") +public func _bjs_ArrayRoundtrip_makeOptionalPointArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalPointArray() + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_roundtripOptionalPointArray") +@_cdecl("bjs_ArrayRoundtrip_roundtripOptionalPointArray") +public func _bjs_ArrayRoundtrip_roundtripOptionalPointArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripOptionalPointArray(_: { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} + _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_array_length(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_takeOptionalArray") +@_cdecl("bjs_ArrayRoundtrip_takeOptionalArray") +public func _bjs_ArrayRoundtrip_takeOptionalArray(_ _self: UnsafeMutableRawPointer, _ values: Int32) -> Void { + #if arch(wasm32) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeOptionalArray(_: { + if values == 0 { + return Optional<[Int]>.none + } else { + return { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }() + } + }()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_makeOptionalArraySome") +@_cdecl("bjs_ArrayRoundtrip_makeOptionalArraySome") +public func _bjs_ArrayRoundtrip_makeOptionalArraySome(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalArraySome() + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + for __bjs_elem_ret in __bjs_unwrapped_ret { + _swift_js_push_int(Int32(__bjs_elem_ret))} + _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_makeOptionalArrayNone") +@_cdecl("bjs_ArrayRoundtrip_makeOptionalArrayNone") +public func _bjs_ArrayRoundtrip_makeOptionalArrayNone(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalArrayNone() + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + for __bjs_elem_ret in __bjs_unwrapped_ret { + _swift_js_push_int(Int32(__bjs_elem_ret))} + _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_roundtripOptionalArray") +@_cdecl("bjs_ArrayRoundtrip_roundtripOptionalArray") +public func _bjs_ArrayRoundtrip_roundtripOptionalArray(_ _self: UnsafeMutableRawPointer, _ values: Int32) -> Void { + #if arch(wasm32) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripOptionalArray(_: { + if values == 0 { + return Optional<[Int]>.none + } else { + return { + let __count = Int(_swift_js_pop_param_array_length()) + var __result: [Int] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + } + __result.reverse() + return __result + }() + } + }()) + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + for __bjs_elem_ret in __bjs_unwrapped_ret { + _swift_js_push_int(Int32(__bjs_elem_ret))} + _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayRoundtrip_deinit") +@_cdecl("bjs_ArrayRoundtrip_deinit") +public func _bjs_ArrayRoundtrip_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension ArrayRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ArrayRoundtrip_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_ArrayRoundtrip_wrap") +fileprivate func _bjs_ArrayRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ArrayRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoop") fileprivate func bjs_benchmarkHelperNoop() -> Void diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json index 42cbcb707..cb081ab39 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json @@ -1243,6 +1243,920 @@ ], "swiftCallName" : "ClassRoundtrip" + }, + { + "constructor" : { + "abiName" : "bjs_ArrayRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_ArrayRoundtrip_takeIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_makeIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeIntArray", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_roundtripIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_makeIntArrayLarge", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeIntArrayLarge", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_takeDoubleArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeDoubleArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_makeDoubleArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeDoubleArray", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_roundtripDoubleArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripDoubleArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_takeStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeStringArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_makeStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeStringArray", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_roundtripStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripStringArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_takePointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takePointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_makePointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makePointArray", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_roundtripPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_makePointArrayLarge", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makePointArrayLarge", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_takeNestedIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeNestedIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_makeNestedIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeNestedIntArray", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_roundtripNestedIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripNestedIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_takeNestedPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeNestedPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_makeNestedPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeNestedPointArray", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_roundtripNestedPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripNestedPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_takeOptionalIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeOptionalIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_makeOptionalIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalIntArray", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_roundtripOptionalIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_takeOptionalPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeOptionalPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_makeOptionalPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalPointArray", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_roundtripOptionalPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_takeOptionalArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeOptionalArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_makeOptionalArraySome", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalArraySome", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_makeOptionalArrayNone", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalArrayNone", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_ArrayRoundtrip_roundtripOptionalArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "name" : "ArrayRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "ArrayRoundtrip" } ], "enums" : [ @@ -1767,6 +2681,35 @@ } ], "swiftCallName" : "ComplexStruct" + }, + { + "methods" : [ + + ], + "name" : "Point", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "x", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "y", + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "Point" } ] }, diff --git a/Benchmarks/run.js b/Benchmarks/run.js index 7771887c5..5a1ae61e6 100644 --- a/Benchmarks/run.js +++ b/Benchmarks/run.js @@ -640,6 +640,235 @@ async function singleRun(results, nameFilter, iterations) { classRoundtrip.roundtripAddressClass(address) } }) + + // Array performance tests + const arrayRoundtrip = new exports.ArrayRoundtrip(); + + // Primitive Arrays - Int + benchmarkRunner("ArrayRoundtrip/takeIntArray", () => { + const arr = Array.from({length: 1000}, (_, i) => i + 1) + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.takeIntArray(arr) + } + }) + benchmarkRunner("ArrayRoundtrip/makeIntArray", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.makeIntArray() + } + }) + benchmarkRunner("ArrayRoundtrip/roundtripIntArray", () => { + const arr = Array.from({length: 1000}, (_, i) => i + 1) + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.roundtripIntArray(arr) + } + }) + benchmarkRunner("ArrayRoundtrip/makeIntArrayLarge", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.makeIntArrayLarge() + } + }) + + // Primitive Arrays - Double + benchmarkRunner("ArrayRoundtrip/takeDoubleArray", () => { + const arr = Array.from({length: 1000}, (_, i) => (i + 1) * 1.1) + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.takeDoubleArray(arr) + } + }) + benchmarkRunner("ArrayRoundtrip/makeDoubleArray", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.makeDoubleArray() + } + }) + benchmarkRunner("ArrayRoundtrip/roundtripDoubleArray", () => { + const arr = Array.from({length: 1000}, (_, i) => (i + 1) * 1.1) + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.roundtripDoubleArray(arr) + } + }) + + // Primitive Arrays - String + benchmarkRunner("ArrayRoundtrip/takeStringArray", () => { + const arr = ["one", "two", "three", "four", "five"] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.takeStringArray(arr) + } + }) + benchmarkRunner("ArrayRoundtrip/makeStringArray", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.makeStringArray() + } + }) + benchmarkRunner("ArrayRoundtrip/roundtripStringArray", () => { + const arr = ["one", "two", "three", "four", "five"] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.roundtripStringArray(arr) + } + }) + + // Struct Arrays + benchmarkRunner("ArrayRoundtrip/takePointArray", () => { + const arr = [ + { x: 0.0, y: 0.0 }, + { x: 1.0, y: 1.0 }, + { x: 2.0, y: 2.0 }, + { x: 3.0, y: 3.0 }, + { x: 4.0, y: 4.0 } + ] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.takePointArray(arr) + } + }) + benchmarkRunner("ArrayRoundtrip/makePointArray", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.makePointArray() + } + }) + benchmarkRunner("ArrayRoundtrip/roundtripPointArray", () => { + const arr = [ + { x: 0.0, y: 0.0 }, + { x: 1.0, y: 1.0 }, + { x: 2.0, y: 2.0 }, + { x: 3.0, y: 3.0 }, + { x: 4.0, y: 4.0 } + ] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.roundtripPointArray(arr) + } + }) + benchmarkRunner("ArrayRoundtrip/makePointArrayLarge", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.makePointArrayLarge() + } + }) + + // Nested Arrays + benchmarkRunner("ArrayRoundtrip/takeNestedIntArray", () => { + const arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.takeNestedIntArray(arr) + } + }) + benchmarkRunner("ArrayRoundtrip/makeNestedIntArray", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.makeNestedIntArray() + } + }) + benchmarkRunner("ArrayRoundtrip/roundtripNestedIntArray", () => { + const arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.roundtripNestedIntArray(arr) + } + }) + + benchmarkRunner("ArrayRoundtrip/takeNestedPointArray", () => { + const arr = [ + [{ x: 0.0, y: 0.0 }, { x: 1.0, y: 1.0 }], + [{ x: 2.0, y: 2.0 }, { x: 3.0, y: 3.0 }], + [{ x: 4.0, y: 4.0 }, { x: 5.0, y: 5.0 }] + ] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.takeNestedPointArray(arr) + } + }) + benchmarkRunner("ArrayRoundtrip/makeNestedPointArray", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.makeNestedPointArray() + } + }) + benchmarkRunner("ArrayRoundtrip/roundtripNestedPointArray", () => { + const arr = [ + [{ x: 0.0, y: 0.0 }, { x: 1.0, y: 1.0 }], + [{ x: 2.0, y: 2.0 }, { x: 3.0, y: 3.0 }], + [{ x: 4.0, y: 4.0 }, { x: 5.0, y: 5.0 }] + ] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.roundtripNestedPointArray(arr) + } + }) + + // Optional Element Arrays + benchmarkRunner("ArrayRoundtrip/takeOptionalIntArray", () => { + const arr = [1, null, 3, null, 5, null, 7, null, 9, null] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.takeOptionalIntArray(arr) + } + }) + benchmarkRunner("ArrayRoundtrip/makeOptionalIntArray", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.makeOptionalIntArray() + } + }) + benchmarkRunner("ArrayRoundtrip/roundtripOptionalIntArray", () => { + const arr = [1, null, 3, null, 5, null, 7, null, 9, null] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.roundtripOptionalIntArray(arr) + } + }) + + benchmarkRunner("ArrayRoundtrip/takeOptionalPointArray", () => { + const arr = [ + { x: 0.0, y: 0.0 }, + null, + { x: 2.0, y: 2.0 }, + null, + { x: 4.0, y: 4.0 } + ] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.takeOptionalPointArray(arr) + } + }) + benchmarkRunner("ArrayRoundtrip/makeOptionalPointArray", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.makeOptionalPointArray() + } + }) + benchmarkRunner("ArrayRoundtrip/roundtripOptionalPointArray", () => { + const arr = [ + { x: 0.0, y: 0.0 }, + null, + { x: 2.0, y: 2.0 }, + null, + { x: 4.0, y: 4.0 } + ] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.roundtripOptionalPointArray(arr) + } + }) + + // Optional Arrays + benchmarkRunner("ArrayRoundtrip/takeOptionalArraySome", () => { + const arr = [1, 2, 3, 4, 5] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.takeOptionalArray(arr) + } + }) + benchmarkRunner("ArrayRoundtrip/takeOptionalArrayNone", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.takeOptionalArray(null) + } + }) + benchmarkRunner("ArrayRoundtrip/makeOptionalArraySome", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.makeOptionalArraySome() + } + }) + benchmarkRunner("ArrayRoundtrip/makeOptionalArrayNone", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.makeOptionalArrayNone() + } + }) + benchmarkRunner("ArrayRoundtrip/roundtripOptionalArraySome", () => { + const arr = [1, 2, 3, 4, 5] + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.roundtripOptionalArray(arr) + } + }) + benchmarkRunner("ArrayRoundtrip/roundtripOptionalArrayNone", () => { + for (let i = 0; i < iterations; i++) { + arrayRoundtrip.roundtripOptionalArray(null) + } + }) } /** From bffab39b75e76e4d953720c72d8a571cea398c1e Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Sat, 31 Jan 2026 04:57:55 +0700 Subject: [PATCH 116/252] BridgeJS: Add UInt support (#551) --- .../Sources/BridgeJSCore/ExportSwift.swift | 13 ++-- .../Sources/BridgeJSCore/ImportTS.swift | 4 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 2 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 39 +++++++----- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 7 ++- .../Inputs/PrimitiveParameters.swift | 2 +- .../Inputs/PrimitiveReturn.swift | 1 + .../PrimitiveParameters.Export.d.ts | 2 +- .../PrimitiveParameters.Export.js | 4 +- .../PrimitiveReturn.Export.d.ts | 1 + .../PrimitiveReturn.Export.js | 4 ++ .../ExportSwiftTests/PrimitiveParameters.json | 13 +++- .../PrimitiveParameters.swift | 4 +- .../ExportSwiftTests/PrimitiveReturn.json | 17 +++++ .../ExportSwiftTests/PrimitiveReturn.swift | 11 ++++ .../JavaScriptKit/BridgeJSIntrinsics.swift | 63 +++++++++++++++++++ .../BridgeJSRuntimeTests/ExportAPITests.swift | 3 + .../Generated/BridgeJS.swift | 11 ++++ .../Generated/JavaScript/BridgeJS.json | 25 ++++++++ Tests/prelude.mjs | 3 + 20 files changed, 196 insertions(+), 33 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 5b0105bf6..dd28397df 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -800,7 +800,7 @@ struct StackCodegen { switch type { case .string: return "String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .int: + case .int, .uint: return "Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())" case .bool: return "Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())" @@ -873,7 +873,7 @@ struct StackCodegen { case .string: return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())" - case .int: + case .int, .uint: return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" case .bool: return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" @@ -945,7 +945,7 @@ struct StackCodegen { "var __bjs_\(raw: varPrefix) = \(raw: accessor)", "__bjs_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", ] - case .int: + case .int, .uint: return ["_swift_js_push_int(Int32(\(raw: accessor)))"] case .bool: return ["_swift_js_push_int(\(raw: accessor) ? 1 : 0)"] @@ -1052,7 +1052,7 @@ struct StackCodegen { "var __bjs_str_\(raw: varPrefix) = \(raw: unwrappedVar)", "__bjs_str_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", ] - case .int: + case .int, .uint: return ["_swift_js_push_int(Int32(\(raw: unwrappedVar)))"] case .bool: return ["_swift_js_push_int(\(raw: unwrappedVar) ? 1 : 0)"] @@ -1643,6 +1643,7 @@ extension BridgeType { switch self { case .bool: return "Bool" case .int: return "Int" + case .uint: return "UInt" case .float: return "Float" case .double: return "Double" case .string: return "String" @@ -1687,7 +1688,7 @@ extension BridgeType { func liftParameterInfo() throws -> LiftingIntrinsicInfo { switch self { case .bool: return .bool - case .int: return .int + case .int, .uint: return .int case .float: return .float case .double: return .double case .string: return .string @@ -1739,7 +1740,7 @@ extension BridgeType { func loweringReturnInfo() throws -> LoweringIntrinsicInfo { switch self { case .bool: return .bool - case .int: return .int + case .int, .uint: return .int case .float: return .float case .double: return .double case .string: return .string diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 8a6ad930b..9e5575c41 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -866,7 +866,7 @@ extension BridgeType { func loweringParameterInfo(context: BridgeContext = .importTS) throws -> LoweringParameterInfo { switch self { case .bool: return .bool - case .int: return .int + case .int, .uint: return .int case .float: return .float case .double: return .double case .string: return .string @@ -960,7 +960,7 @@ extension BridgeType { ) throws -> LiftingReturnInfo { switch self { case .bool: return .bool - case .int: return .int + case .int, .uint: return .int case .float: return .float case .double: return .double case .string: return .string diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 794637d9e..4e2c9f86d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -3401,7 +3401,7 @@ extension BridgeType { return "void" case .string: return "string" - case .int: + case .int, .uint: return "number" case .float: return "number" diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index c0282cd3c..cf0919304 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -149,6 +149,15 @@ struct IntrinsicJSFragment: Sendable { } ) + /// Convert signed Int32 to unsigned for UInt values + static let uintLiftReturn = IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanupCode in + return ["\(arguments[0]) >>> 0"] + } + ) + static let uintLiftParameter = uintLiftReturn + static let stringLowerParameter = IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanupCode in @@ -519,7 +528,7 @@ struct IntrinsicJSFragment: Sendable { case .bool: printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalBool);") printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalBool) = undefined;") - case .int: + case .int, .uint: printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalInt);") printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = undefined;") case .float: @@ -651,7 +660,7 @@ struct IntrinsicJSFragment: Sendable { printer.write( "bjs[\"swift_js_return_optional_bool\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) ? 1 : 0) : 0);" ) - case .int: + case .int, .uint: printer.write( "bjs[\"swift_js_return_optional_int\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) | 0) : 0);" ) @@ -937,7 +946,7 @@ struct IntrinsicJSFragment: Sendable { ) printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(value));") printer.write("\(targetVar) = String(\(objectLabel));") - case .int: + case .int, .uint: printer.write("\(targetVar) = \(value) | 0;") case .bool: printer.write("\(targetVar) = \(value) !== 0;") @@ -1121,7 +1130,7 @@ struct IntrinsicJSFragment: Sendable { case .string: printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(result);") printer.write("return;") - case .int: + case .int, .uint: printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(result);") printer.write("return;") case .bool: @@ -1370,7 +1379,7 @@ struct IntrinsicJSFragment: Sendable { /// Returns a fragment that lowers a JS value to Wasm core values for parameters static func lowerParameter(type: BridgeType) throws -> IntrinsicJSFragment { switch type { - case .int, .float, .double, .bool, .unsafePointer: return .identity + case .int, .uint, .float, .double, .bool, .unsafePointer: return .identity case .string: return .stringLowerParameter case .jsObject: return .jsObjectLowerParameter case .swiftHeapObject: @@ -1414,6 +1423,7 @@ struct IntrinsicJSFragment: Sendable { static func liftReturn(type: BridgeType) throws -> IntrinsicJSFragment { switch type { case .int, .float, .double: return .identity + case .uint: return .uintLiftReturn case .bool: return .boolLiftReturn case .string: return .stringLiftReturn case .jsObject: return .jsObjectLiftReturn @@ -1460,6 +1470,7 @@ struct IntrinsicJSFragment: Sendable { static func liftParameter(type: BridgeType, context: BridgeContext = .importTS) throws -> IntrinsicJSFragment { switch type { case .int, .float, .double: return .identity + case .uint: return .uintLiftParameter case .bool: return .boolLiftParameter case .string: return .stringLiftParameter case .jsObject: return .jsObjectLiftParameter @@ -1560,7 +1571,7 @@ struct IntrinsicJSFragment: Sendable { /// Returns a fragment that lowers a JS value to Wasm core values for return values static func lowerReturn(type: BridgeType, context: BridgeContext = .importTS) throws -> IntrinsicJSFragment { switch type { - case .int, .float, .double: return .identity + case .int, .uint, .float, .double: return .identity case .bool: return .boolLowerReturn case .string: return .stringLowerReturn case .jsObject: return .jsObjectLowerReturn @@ -1909,7 +1920,7 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .int: + case .int, .uint: return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in @@ -1967,7 +1978,7 @@ struct IntrinsicJSFragment: Sendable { cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") } cleanup.write("}") - case .int: + case .int, .uint: printer.write( "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) | 0) : 0);" ) @@ -2024,7 +2035,7 @@ struct IntrinsicJSFragment: Sendable { return [bVar] } ) - case .int: + case .int, .uint: return IntrinsicJSFragment( parameters: [], printCode: { arguments, scope, printer, cleanup in @@ -2214,7 +2225,7 @@ struct IntrinsicJSFragment: Sendable { return [bVar] } ) - case .int: + case .int, .uint: return IntrinsicJSFragment( parameters: [], printCode: { arguments, scope, printer, cleanup in @@ -2363,7 +2374,7 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .int: + case .int, .uint: return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in @@ -2779,7 +2790,7 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .int: + case .int, .uint: return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in @@ -3009,7 +3020,7 @@ struct IntrinsicJSFragment: Sendable { } else { // Handle optional primitive types using helper switch wrappedType { - case .int: + case .int, .uint: pushOptionalPrimitive( value: value, isSomeVar: isSomeVar, @@ -3260,7 +3271,7 @@ struct IntrinsicJSFragment: Sendable { return [bVar] } ) - case .int: + case .int, .uint: return IntrinsicJSFragment( parameters: [], printCode: { arguments, scope, printer, cleanup in diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index d2f60cc4c..33cc94479 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -127,7 +127,7 @@ public struct UnsafePointerType: Codable, Equatable, Hashable, Sendable { } public enum BridgeType: Codable, Equatable, Hashable, Sendable { - case int, float, double, string, bool, jsObject(String?), swiftHeapObject(String), void + case int, uint, float, double, string, bool, jsObject(String?), swiftHeapObject(String), void case unsafePointer(UnsafePointerType) indirect case optional(BridgeType) indirect case array(BridgeType) @@ -860,6 +860,8 @@ extension BridgeType { switch swiftType { case "Int": self = .int + case "UInt": + self = .uint case "Float": self = .float case "Double": @@ -887,7 +889,7 @@ extension BridgeType { switch self { case .void: return nil case .bool: return .i32 - case .int: return .i32 + case .int, .uint: return .i32 case .float: return .f32 case .double: return .f64 case .string: return nil @@ -933,6 +935,7 @@ extension BridgeType { public var mangleTypeName: String { switch self { case .int: return "Si" + case .uint: return "Su" case .float: return "Sf" case .double: return "Sd" case .string: return "SS" diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveParameters.swift index 62e780083..a0d4353eb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveParameters.swift @@ -1 +1 @@ -@JS func check(a: Int, b: Float, c: Double, d: Bool) {} +@JS func check(a: Int, b: UInt, c: Float, d: Double, e: Bool) {} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveReturn.swift index 96a5dbc3c..144a759ec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveReturn.swift @@ -1,4 +1,5 @@ @JS func checkInt() -> Int { fatalError() } +@JS func checkUInt() -> UInt { fatalError() } @JS func checkFloat() -> Float { fatalError() } @JS func checkDouble() -> Double { fatalError() } @JS func checkBool() -> Bool { fatalError() } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.d.ts index a9c37f378..9bf0e1e35 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.d.ts @@ -5,7 +5,7 @@ // `swift package bridge-js`. export type Exports = { - check(a: number, b: number, c: number, d: boolean): void; + check(a: number, b: number, c: number, d: number, e: boolean): void; } export type Imports = { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js index c4c355c6a..8e14c6c75 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js @@ -222,8 +222,8 @@ export async function createInstantiator(options, swift) { createExports: (instance) => { const js = swift.memory.heap; const exports = { - check: function bjs_check(a, b, c, d) { - instance.exports.bjs_check(a, b, c, d); + check: function bjs_check(a, b, c, d, e) { + instance.exports.bjs_check(a, b, c, d, e); }, }; _exports = exports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.d.ts index da7f59772..c726e1f5a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.d.ts @@ -6,6 +6,7 @@ export type Exports = { checkInt(): number; + checkUInt(): number; checkFloat(): number; checkDouble(): number; checkBool(): boolean; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js index e36b1820f..f187fa8f0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js @@ -226,6 +226,10 @@ export async function createInstantiator(options, swift) { const ret = instance.exports.bjs_checkInt(); return ret; }, + checkUInt: function bjs_checkUInt() { + const ret = instance.exports.bjs_checkUInt(); + return ret >>> 0; + }, checkFloat: function bjs_checkFloat() { const ret = instance.exports.bjs_checkFloat(); return ret; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json index ab2539abf..3b45bf30f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json @@ -29,7 +29,7 @@ "label" : "b", "name" : "b", "type" : { - "float" : { + "uint" : { } } @@ -38,7 +38,7 @@ "label" : "c", "name" : "c", "type" : { - "double" : { + "float" : { } } @@ -46,6 +46,15 @@ { "label" : "d", "name" : "d", + "type" : { + "double" : { + + } + } + }, + { + "label" : "e", + "name" : "e", "type" : { "bool" : { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift index bb3ea0fd8..f91e1e213 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift @@ -1,8 +1,8 @@ @_expose(wasm, "bjs_check") @_cdecl("bjs_check") -public func _bjs_check(_ a: Int32, _ b: Float32, _ c: Float64, _ d: Int32) -> Void { +public func _bjs_check(_ a: Int32, _ b: Int32, _ c: Float32, _ d: Float64, _ e: Int32) -> Void { #if arch(wasm32) - check(a: Int.bridgeJSLiftParameter(a), b: Float.bridgeJSLiftParameter(b), c: Double.bridgeJSLiftParameter(c), d: Bool.bridgeJSLiftParameter(d)) + check(a: Int.bridgeJSLiftParameter(a), b: UInt.bridgeJSLiftParameter(b), c: Float.bridgeJSLiftParameter(c), d: Double.bridgeJSLiftParameter(d), e: Bool.bridgeJSLiftParameter(e)) #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json index e63b4a242..d70b0c9b5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json @@ -24,6 +24,23 @@ } } }, + { + "abiName" : "bjs_checkUInt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "checkUInt", + "parameters" : [ + + ], + "returnType" : { + "uint" : { + + } + } + }, { "abiName" : "bjs_checkFloat", "effects" : { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift index 62b5826d3..74ee7b1c3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift @@ -9,6 +9,17 @@ public func _bjs_checkInt() -> Int32 { #endif } +@_expose(wasm, "bjs_checkUInt") +@_cdecl("bjs_checkUInt") +public func _bjs_checkUInt() -> Int32 { + #if arch(wasm32) + let ret = checkUInt() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_checkFloat") @_cdecl("bjs_checkFloat") public func _bjs_checkFloat() -> Float32 { diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index d8145e3a7..dcdb8f6d0 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -128,6 +128,23 @@ extension Int: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { } } +extension UInt: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { + // MARK: ImportTS + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + Int32(bitPattern: UInt32(self)) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> UInt { + UInt(UInt32(bitPattern: value)) + } + // MARK: ExportSwift + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> UInt { + UInt(UInt32(bitPattern: value)) + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { + Int32(bitPattern: UInt32(self)) + } +} + extension Float: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Float32 { @@ -918,6 +935,52 @@ extension Optional where Wrapped == Int { } } } + +extension Optional where Wrapped == UInt { + // MARK: ImportTS + + @available(*, unavailable, message: "Optional UInt type is not supported to be passed to imported JS functions") + @_spi(BridgeJS) public func bridgeJSLowerParameter() -> Void {} + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + isSome: Int32, value: Int32 + ) { + switch consume self { + case .none: + return (isSome: 0, value: 0) + case .some(let wrapped): + return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) + } + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> UInt? { + if isSome == 0 { + return nil + } else { + return UInt.bridgeJSLiftParameter(wrappedValue) + } + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> UInt? { + let isSome = _swift_js_get_optional_int_presence() + if isSome == 0 { + return nil + } else { + return UInt.bridgeJSLiftReturn(_swift_js_get_optional_int_value()) + } + } + + @_spi(BridgeJS) public func bridgeJSLowerReturn() -> Void { + switch self { + case .none: + _swift_js_return_optional_int(0, 0) + case .some(let value): + _swift_js_return_optional_int(1, value.bridgeJSLowerReturn()) + } + } +} extension Optional where Wrapped == String { // MARK: ExportSwift diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index af6ad530b..2aee862c6 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -13,6 +13,9 @@ func runJsWorks() -> Void @JS func roundTripInt(v: Int) -> Int { return v } +@JS func roundTripUInt(v: UInt) -> UInt { + return v +} @JS func roundTripFloat(v: Float) -> Float { return v } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 7f35f6725..948b454c4 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -3222,6 +3222,17 @@ public func _bjs_roundTripInt(_ v: Int32) -> Int32 { #endif } +@_expose(wasm, "bjs_roundTripUInt") +@_cdecl("bjs_roundTripUInt") +public func _bjs_roundTripUInt(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundTripUInt(v: UInt.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_roundTripFloat") @_cdecl("bjs_roundTripFloat") public func _bjs_roundTripFloat(_ v: Float32) -> Float32 { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 2f0f964be..c79139ea4 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -4651,6 +4651,31 @@ } } }, + { + "abiName" : "bjs_roundTripUInt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUInt", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "uint" : { + + } + } + } + ], + "returnType" : { + "uint" : { + + } + } + }, { "abiName" : "bjs_roundTripFloat", "effects" : { diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index b2a079c35..12307d605 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -155,6 +155,9 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { for (const v of [0, 1, -1, 2147483647, -2147483648]) { assert.equal(exports.roundTripInt(v), v); } + for (const v of [0, 1, 2147483647, 4294967295]) { + assert.equal(exports.roundTripUInt(v), v); + } for (const v of [ 0.0, 1.0, -1.0, NaN, From 8004473687df288021ecaf3465c6c46ec4d3ba1a Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 2 Feb 2026 11:15:29 +0900 Subject: [PATCH 117/252] Fix `ExperimentalCustomExecutors` SPI import build issues (#552) The custom executor feature is now hidden behind the `ExperimentalCustomExecutors` SPI until it goes through the evolution process. https://github.com/swiftlang/swift/pull/86808 --- .../JavaScriptEventLoop+ExecutorFactory.swift | 5 ++++- Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift b/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift index 574e8d03a..d31e03597 100644 --- a/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift +++ b/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift @@ -4,7 +4,7 @@ // See: https://github.com/swiftlang/swift/pull/80266 // See: https://forums.swift.org/t/pitch-2-custom-main-and-global-executors/78437 -import _Concurrency +@_spi(ExperimentalCustomExecutors) import _Concurrency import _CJavaScriptKit #if compiler(>=6.3) @@ -12,6 +12,7 @@ import _CJavaScriptKit // MARK: - MainExecutor Implementation // MainExecutor is used by the main actor to execute tasks on the main thread @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999, *) +@_spi(ExperimentalCustomExecutors) extension JavaScriptEventLoop: MainExecutor { public func run() throws { // This method is called from `swift_task_asyncMainDrainQueueImpl`. @@ -27,6 +28,7 @@ extension JavaScriptEventLoop: MainExecutor { extension JavaScriptEventLoop: TaskExecutor {} @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999, *) +@_spi(ExperimentalCustomExecutors) extension JavaScriptEventLoop: SchedulingExecutor { public func enqueue( _ job: consuming ExecutorJob, @@ -65,6 +67,7 @@ extension JavaScriptEventLoop: SchedulingExecutor { // MARK: - ExecutorFactory Implementation @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999, *) +@_spi(ExperimentalCustomExecutors) extension JavaScriptEventLoop: ExecutorFactory { // Forward all operations to the current thread's JavaScriptEventLoop instance final class CurrentThread: TaskExecutor, SchedulingExecutor, MainExecutor, SerialExecutor { diff --git a/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift b/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift index 960a59be0..4b4115602 100644 --- a/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift +++ b/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift @@ -1,5 +1,5 @@ import JavaScriptKit -import _Concurrency +@_spi(ExperimentalCustomExecutors) import _Concurrency import _CJavaScriptEventLoop import _CJavaScriptKit From d9c0301e5840e2ddf8bf4c116710f56781cfeceb Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 2 Feb 2026 19:14:24 +0900 Subject: [PATCH 118/252] BridgeJS: Rename stack manipulation imports - `swift_js_pop_param_int32` -> `swift_js_pop_i32` - `swift_js_pop_param_f32` -> `swift_js_pop_f32` - `swift_js_pop_param_f64` -> `swift_js_pop_f64` --- Benchmarks/Sources/Generated/BridgeJS.swift | 132 ++++---- .../Sources/BridgeJSCore/ExportSwift.swift | 66 ++-- .../Sources/BridgeJSLink/BridgeJSLink.swift | 10 +- .../ArrayParameter.Import.js | 10 +- .../BridgeJSLinkTests/ArrayTypes.Export.js | 10 +- .../BridgeJSLinkTests/Async.Export.js | 10 +- .../BridgeJSLinkTests/Async.Import.js | 10 +- .../DefaultParameters.Export.js | 10 +- .../EnumAssociatedValue.Export.js | 10 +- .../BridgeJSLinkTests/EnumCase.Export.js | 10 +- .../BridgeJSLinkTests/EnumNamespace.Export.js | 10 +- .../EnumNamespace.Global.Export.js | 10 +- .../BridgeJSLinkTests/EnumRawType.Export.js | 10 +- .../GlobalGetter.ImportMacros.js | 10 +- .../GlobalThisImports.ImportMacros.js | 10 +- .../ImportedTypeInExportedInterface.Export.js | 10 +- .../BridgeJSLinkTests/Interface.Import.js | 10 +- .../InvalidPropertyNames.Import.js | 10 +- .../BridgeJSLinkTests/MixedGlobal.Export.js | 10 +- .../BridgeJSLinkTests/MixedModules.Export.js | 10 +- .../BridgeJSLinkTests/MixedPrivate.Export.js | 10 +- .../MultipleImportedTypes.Import.js | 10 +- .../BridgeJSLinkTests/Namespaces.Export.js | 10 +- .../Namespaces.Global.Export.js | 10 +- .../BridgeJSLinkTests/Optionals.Export.js | 10 +- .../PrimitiveParameters.Export.js | 10 +- .../PrimitiveParameters.Import.js | 10 +- .../PrimitiveReturn.Export.js | 10 +- .../PrimitiveReturn.Import.js | 10 +- .../BridgeJSLinkTests/PropertyTypes.Export.js | 10 +- .../BridgeJSLinkTests/Protocol.Export.js | 10 +- .../BridgeJSLinkTests/ReExportFrom.Import.js | 10 +- .../StaticFunctions.Export.js | 10 +- .../StaticFunctions.Global.Export.js | 10 +- .../StaticProperties.Export.js | 10 +- .../StaticProperties.Global.Export.js | 10 +- .../BridgeJSLinkTests/StringEnum.Import.js | 10 +- .../StringParameter.Export.js | 10 +- .../StringParameter.Import.js | 10 +- .../BridgeJSLinkTests/StringReturn.Export.js | 10 +- .../BridgeJSLinkTests/StringReturn.Import.js | 10 +- .../BridgeJSLinkTests/SwiftClass.Export.js | 10 +- .../BridgeJSLinkTests/SwiftClosure.Export.js | 10 +- .../SwiftClosureImports.ImportMacros.js | 10 +- .../BridgeJSLinkTests/SwiftStruct.Export.js | 10 +- .../SwiftStructImports.ImportMacros.js | 10 +- .../TS2SkeletonLike.Import.js | 10 +- .../BridgeJSLinkTests/Throws.Export.js | 10 +- .../BridgeJSLinkTests/TypeAlias.Import.js | 10 +- .../TypeScriptClass.Import.js | 10 +- .../BridgeJSLinkTests/UnsafePointer.Export.js | 10 +- .../VoidParameterVoidReturn.Export.js | 10 +- .../VoidParameterVoidReturn.Import.js | 10 +- .../ExportSwiftTests/ArrayTypes.swift | 98 +++--- .../ExportSwiftTests/DefaultParameters.swift | 32 +- .../EnumAssociatedValue.swift | 36 +-- .../ExportSwiftTests/Protocol.swift | 16 +- .../StaticFunctions.Global.swift | 4 +- .../ExportSwiftTests/StaticFunctions.swift | 4 +- .../ExportSwiftTests/SwiftClosure.swift | 10 +- .../ExportSwiftTests/SwiftStruct.swift | 32 +- .../ExportSwiftTests/UnsafePointer.swift | 10 +- Plugins/PackageToJS/Templates/instantiate.js | 6 +- .../JavaScriptKit/BridgeJSIntrinsics.swift | 30 +- .../Generated/BridgeJS.swift | 282 +++++++++--------- 65 files changed, 634 insertions(+), 634 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 569eb2eac..fd45582e1 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -11,15 +11,15 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) case 2: - return .flag(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .flag(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) case 3: - return .rate(Float.bridgeJSLiftParameter(_swift_js_pop_param_f32())) + return .rate(Float.bridgeJSLiftParameter(_swift_js_pop_f32())) case 4: - return .precise(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + return .precise(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) case 5: return .info default: @@ -94,17 +94,17 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .error(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .error(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) case 2: - return .location(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .location(Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 3: - return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 4: - return .coordinates(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + return .coordinates(Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64())) case 5: - return .comprehensive(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .comprehensive(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 6: return .info default: @@ -249,11 +249,11 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { extension SimpleStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> SimpleStruct { - let precise = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) - let rate = Float.bridgeJSLiftParameter(_swift_js_pop_param_f32()) - let flag = Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let count = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let precise = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) + let rate = Float.bridgeJSLiftParameter(_swift_js_pop_f32()) + let flag = Bool.bridgeJSLiftParameter(_swift_js_pop_i32()) + let count = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) return SimpleStruct(name: name, count: count, flag: flag, rate: rate, precise: precise) } @@ -303,9 +303,9 @@ fileprivate func _bjs_struct_lift_SimpleStruct() -> Int32 { extension Address: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Address { - let zipCode = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let city = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let street = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let zipCode = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let city = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let street = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) return Address(street: street, city: city, zipCode: zipCode) } @@ -356,10 +356,10 @@ fileprivate func _bjs_struct_lift_Address() -> Int32 { extension Person: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Person { - let email = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let email = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32()) let address = Address.bridgeJSLiftParameter() - let age = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let age = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) return Person(name: name, age: age, address: address, email: email) } @@ -415,12 +415,12 @@ fileprivate func _bjs_struct_lift_Person() -> Int32 { extension ComplexStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ComplexStruct { - let metadata = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let tags = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let score = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) - let active = Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let title = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let id = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let metadata = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let tags = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let score = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) + let active = Bool.bridgeJSLiftParameter(_swift_js_pop_i32()) + let title = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let id = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) return ComplexStruct(id: id, title: title, active: active, score: score, tags: tags, metadata: metadata) } @@ -477,8 +477,8 @@ fileprivate func _bjs_struct_lift_ComplexStruct() -> Int32 { extension Point: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { - let y = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) - let x = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let y = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) + let x = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) return Point(x: x, y: y) } @@ -1488,11 +1488,11 @@ public func _bjs_ArrayRoundtrip_init() -> UnsafeMutableRawPointer { public func _bjs_ArrayRoundtrip_takeIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeIntArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -1520,11 +1520,11 @@ public func _bjs_ArrayRoundtrip_makeIntArray(_ _self: UnsafeMutableRawPointer) - public func _bjs_ArrayRoundtrip_roundtripIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripIntArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -1555,11 +1555,11 @@ public func _bjs_ArrayRoundtrip_makeIntArrayLarge(_ _self: UnsafeMutableRawPoint public func _bjs_ArrayRoundtrip_takeDoubleArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeDoubleArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Double] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) } __result.reverse() return __result @@ -1587,11 +1587,11 @@ public func _bjs_ArrayRoundtrip_makeDoubleArray(_ _self: UnsafeMutableRawPointer public func _bjs_ArrayRoundtrip_roundtripDoubleArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripDoubleArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Double] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) } __result.reverse() return __result @@ -1609,11 +1609,11 @@ public func _bjs_ArrayRoundtrip_roundtripDoubleArray(_ _self: UnsafeMutableRawPo public func _bjs_ArrayRoundtrip_takeStringArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeStringArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -1644,11 +1644,11 @@ public func _bjs_ArrayRoundtrip_makeStringArray(_ _self: UnsafeMutableRawPointer public func _bjs_ArrayRoundtrip_roundtripStringArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripStringArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -1669,7 +1669,7 @@ public func _bjs_ArrayRoundtrip_roundtripStringArray(_ _self: UnsafeMutableRawPo public func _bjs_ArrayRoundtrip_takePointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takePointArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1701,7 +1701,7 @@ public func _bjs_ArrayRoundtrip_makePointArray(_ _self: UnsafeMutableRawPointer) public func _bjs_ArrayRoundtrip_roundtripPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripPointArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1736,16 +1736,16 @@ public func _bjs_ArrayRoundtrip_makePointArrayLarge(_ _self: UnsafeMutableRawPoi public func _bjs_ArrayRoundtrip_takeNestedIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedIntArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[Int]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -1779,16 +1779,16 @@ public func _bjs_ArrayRoundtrip_makeNestedIntArray(_ _self: UnsafeMutableRawPoin public func _bjs_ArrayRoundtrip_roundtripNestedIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedIntArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[Int]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -1812,12 +1812,12 @@ public func _bjs_ArrayRoundtrip_roundtripNestedIntArray(_ _self: UnsafeMutableRa public func _bjs_ArrayRoundtrip_takeNestedPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedPointArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[Point]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1855,12 +1855,12 @@ public func _bjs_ArrayRoundtrip_makeNestedPointArray(_ _self: UnsafeMutableRawPo public func _bjs_ArrayRoundtrip_roundtripNestedPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedPointArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[Point]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1888,11 +1888,11 @@ public func _bjs_ArrayRoundtrip_roundtripNestedPointArray(_ _self: UnsafeMutable public func _bjs_ArrayRoundtrip_takeOptionalIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeOptionalIntArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -1923,11 +1923,11 @@ public func _bjs_ArrayRoundtrip_makeOptionalIntArray(_ _self: UnsafeMutableRawPo public func _bjs_ArrayRoundtrip_roundtripOptionalIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripOptionalIntArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -1948,11 +1948,11 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalIntArray(_ _self: UnsafeMutable public func _bjs_ArrayRoundtrip_takeOptionalPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeOptionalPointArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -1983,11 +1983,11 @@ public func _bjs_ArrayRoundtrip_makeOptionalPointArray(_ _self: UnsafeMutableRaw public func _bjs_ArrayRoundtrip_roundtripOptionalPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripOptionalPointArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -2012,11 +2012,11 @@ public func _bjs_ArrayRoundtrip_takeOptionalArray(_ _self: UnsafeMutableRawPoint return Optional<[Int]>.none } else { return { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -2069,11 +2069,11 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalArray(_ _self: UnsafeMutableRaw return Optional<[Int]>.none } else { return { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index dd28397df..d91024d10 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -799,41 +799,41 @@ struct StackCodegen { func liftExpression(for type: BridgeType) -> ExprSyntax { switch type { case .string: - return "String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + return "String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" case .int, .uint: - return "Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + return "Int.bridgeJSLiftParameter(_swift_js_pop_i32())" case .bool: - return "Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + return "Bool.bridgeJSLiftParameter(_swift_js_pop_i32())" case .float: - return "Float.bridgeJSLiftParameter(_swift_js_pop_param_f32())" + return "Float.bridgeJSLiftParameter(_swift_js_pop_f32())" case .double: - return "Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())" + return "Double.bridgeJSLiftParameter(_swift_js_pop_f64())" case .jsObject: - return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + return "JSObject.bridgeJSLiftParameter(_swift_js_pop_i32())" case .swiftHeapObject(let className): - return "\(raw: className).bridgeJSLiftParameter(_swift_js_pop_param_pointer())" + return "\(raw: className).bridgeJSLiftParameter(_swift_js_pop_pointer())" case .unsafePointer: - return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_param_pointer())" + return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_pointer())" case .swiftProtocol(let protocolName): // Protocols use their Any wrapper type for lifting let wrapperName = "Any\(protocolName)" - return "\(raw: wrapperName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" + return "\(raw: wrapperName).bridgeJSLiftParameter(_swift_js_pop_i32())" case .caseEnum(let enumName): - return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" + return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_i32())" case .rawValueEnum(let enumName, let rawType): switch rawType { case .string: return - "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" case .float: - return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_f32())" + return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_f32())" case .double: - return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_f64())" + return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_f64())" case .bool, .int, .int32, .int64, .uint, .uint32, .uint64: - return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" + return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_i32())" } case .associatedValueEnum(let enumName): - return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_param_int32())" + return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_i32())" case .swiftStruct(let structName): return "\(raw: structName).bridgeJSLiftParameter()" case .optional(let wrappedType): @@ -845,7 +845,7 @@ struct StackCodegen { // Namespace enums are not passed as values return "()" case .closure: - return "JSObject.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + return "JSObject.bridgeJSLiftParameter(_swift_js_pop_i32())" case .array(let elementType): return liftArrayExpression(elementType: elementType) } @@ -856,7 +856,7 @@ struct StackCodegen { let swiftTypeName = elementType.swiftType return """ { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [\(raw: swiftTypeName)] = [] __result.reserveCapacity(__count) for _ in 0..<__count { @@ -872,49 +872,49 @@ struct StackCodegen { switch wrappedType { case .string: return - "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())" case .int, .uint: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + return "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" case .bool: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + return "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" case .float: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f32())" + return "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f32())" case .double: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f64())" + return "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f64())" case .caseEnum(let enumName): return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" case .rawValueEnum(let enumName, let rawType): switch rawType { case .string: return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())" case .float: return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f32())" + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f32())" case .double: return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f64())" + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f64())" case .bool, .int, .int32, .int64, .uint, .uint32, .uint64: return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" } case .swiftStruct(let nestedName): - return "Optional<\(raw: nestedName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32())" + return "Optional<\(raw: nestedName)>.bridgeJSLiftParameter(_swift_js_pop_i32())" case .swiftHeapObject(let className): return - "Optional<\(raw: className)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_pointer())" + "Optional<\(raw: className)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_pointer())" case .associatedValueEnum(let enumName): return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" case .jsObject: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + return "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" case .array(let elementType): let arrayLift = liftArrayExpression(elementType: elementType) let swiftTypeName = elementType.swiftType return """ { - let __isSome = _swift_js_pop_param_int32() + let __isSome = _swift_js_pop_i32() if __isSome == 0 { return Optional<[\(raw: swiftTypeName)]>.none } else { @@ -924,7 +924,7 @@ struct StackCodegen { """ default: // Fallback for other optional types - return "Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())" + return "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 4e2c9f86d..dc20ee73a 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -416,17 +416,17 @@ public struct BridgeJSLink { printer.write("\(JSGlueVariableScope.reservedTmpRetStrings).push(value);") } printer.write("}") - printer.write("bjs[\"swift_js_pop_param_int32\"] = function() {") + printer.write("bjs[\"swift_js_pop_i32\"] = function() {") printer.indent { printer.write("return \(JSGlueVariableScope.reservedTmpParamInts).pop();") } printer.write("}") - printer.write("bjs[\"swift_js_pop_param_f32\"] = function() {") + printer.write("bjs[\"swift_js_pop_f32\"] = function() {") printer.indent { printer.write("return \(JSGlueVariableScope.reservedTmpParamF32s).pop();") } printer.write("}") - printer.write("bjs[\"swift_js_pop_param_f64\"] = function() {") + printer.write("bjs[\"swift_js_pop_f64\"] = function() {") printer.indent { printer.write("return \(JSGlueVariableScope.reservedTmpParamF64s).pop();") } @@ -436,7 +436,7 @@ public struct BridgeJSLink { printer.write("\(JSGlueVariableScope.reservedTmpRetPointers).push(pointer);") } printer.write("}") - printer.write("bjs[\"swift_js_pop_param_pointer\"] = function() {") + printer.write("bjs[\"swift_js_pop_pointer\"] = function() {") printer.indent { printer.write("return \(JSGlueVariableScope.reservedTmpParamPointers).pop();") } @@ -446,7 +446,7 @@ public struct BridgeJSLink { printer.write("\(JSGlueVariableScope.reservedTmpRetArrayLengths).push(len | 0);") } printer.write("}") - printer.write("bjs[\"swift_js_pop_param_array_length\"] = function() {") + printer.write("bjs[\"swift_js_pop_array_length\"] = function() {") printer.indent { printer.write("return \(JSGlueVariableScope.reservedTmpParamArrayLengths).pop();") } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js index e0b1c0561..30b8318bb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js index 9416bb546..b99d6dabf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js @@ -115,25 +115,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js index cffc92db4..77c342a4a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js index 9259ae32d..9bc5e68f6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index dd0f2af21..10610bffe 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -141,25 +141,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index c22bd2b18..93a671ce0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -563,25 +563,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js index 1adfe67bf..bce9a1e13 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js @@ -112,25 +112,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index ceb2b2fd5..7fa29cbeb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -113,25 +113,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js index 94e886cb5..144189324 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js @@ -132,25 +132,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js index 896b925f3..7d26b5a93 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js @@ -163,25 +163,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js index d0d035a38..7c209def8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js index 6a5969915..e5f0cd3ee 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js index ba9024495..c9534033f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js index 2dd3e0cee..681816a95 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index 220b91e94..5a1deb65a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js index fd05b0884..c1b926130 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js index 69c674b51..ae95f4431 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js index 33013eae7..63dd5b663 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index 08f8ab83e..f4833046b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index bd48815c5..0d7b5da19 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js index 26ba1bba7..6e7b72de5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js index 64340972b..979053ca9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js index 8e14c6c75..e7dc4822a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js index a06cc4974..5bc929c84 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js index f187fa8f0..15ba11dd9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js index a19f3c0ac..3fb51061f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js index 5699a3e3d..db62b9a72 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index 4fd02029d..6f0810c05 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -152,25 +152,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js index 1cdc061e1..10ab693ec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index 4d8b282fa..a77b18b37 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -139,25 +139,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js index 5e712ef85..317e80b89 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js @@ -139,25 +139,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js index 40c09140d..d7e384d43 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js @@ -93,25 +93,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js index f5e30215c..b9b4307cc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js @@ -93,25 +93,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js index e634e4147..9712e79e0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js index 3155c6611..c06d3fb4e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js index 7c3999c87..fb12e02f6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js index d0fd0eb1c..52b0ffc2e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js index dc5b94a17..b81ff5526 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js index 6fb8849f6..189cab792 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js index d32c5a27d..ada39cb45 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js @@ -190,25 +190,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js index 51d52e0e5..5f3d4bb0c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js index 5e528e7bc..fe124a7d6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js @@ -282,25 +282,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js index 8683a87f6..23937d680 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js @@ -103,25 +103,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js index 5ff21f227..feac2e1be 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js index 664794d4a..1b6ecbf8b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js index 0aa603d8a..2bbe333e2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index f442cd882..be93e6af4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js index 95602db76..a6d141ebf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js @@ -108,25 +108,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js index 67eb8bc8f..1328d8af1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js @@ -88,25 +88,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js index 915f64367..dbb6cc0ba 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js @@ -89,25 +89,25 @@ export async function createInstantiator(options, swift) { const value = textDecoder.decode(bytes); tmpRetStrings.push(value); } - bjs["swift_js_pop_param_int32"] = function() { + bjs["swift_js_pop_i32"] = function() { return tmpParamInts.pop(); } - bjs["swift_js_pop_param_f32"] = function() { + bjs["swift_js_pop_f32"] = function() { return tmpParamF32s.pop(); } - bjs["swift_js_pop_param_f64"] = function() { + bjs["swift_js_pop_f64"] = function() { return tmpParamF64s.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { tmpRetPointers.push(pointer); } - bjs["swift_js_pop_param_pointer"] = function() { + bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_param_array_length"] = function() { + bjs["swift_js_pop_array_length"] = function() { return tmpParamArrayLengths.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift index 8142d6905..b897ab42f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift @@ -46,8 +46,8 @@ extension Status: _BridgedSwiftEnumNoPayload { extension Point: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { - let y = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) - let x = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let y = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) + let x = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) return Point(x: x, y: y) } @@ -94,11 +94,11 @@ fileprivate func _bjs_struct_lift_Point() -> Int32 { public func _bjs_processIntArray() -> Void { #if arch(wasm32) let ret = processIntArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -116,11 +116,11 @@ public func _bjs_processIntArray() -> Void { public func _bjs_processStringArray() -> Void { #if arch(wasm32) let ret = processStringArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -141,11 +141,11 @@ public func _bjs_processStringArray() -> Void { public func _bjs_processDoubleArray() -> Void { #if arch(wasm32) let ret = processDoubleArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Double] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) } __result.reverse() return __result @@ -163,11 +163,11 @@ public func _bjs_processDoubleArray() -> Void { public func _bjs_processBoolArray() -> Void { #if arch(wasm32) let ret = processBoolArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Bool] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -185,7 +185,7 @@ public func _bjs_processBoolArray() -> Void { public func _bjs_processPointArray() -> Void { #if arch(wasm32) let ret = processPointArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -207,11 +207,11 @@ public func _bjs_processPointArray() -> Void { public func _bjs_processDirectionArray() -> Void { #if arch(wasm32) let ret = processDirectionArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Direction] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Direction.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Direction.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -229,11 +229,11 @@ public func _bjs_processDirectionArray() -> Void { public func _bjs_processStatusArray() -> Void { #if arch(wasm32) let ret = processStatusArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Status] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Status.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Status.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -251,11 +251,11 @@ public func _bjs_processStatusArray() -> Void { public func _bjs_sumIntArray() -> Int32 { #if arch(wasm32) let ret = sumIntArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -271,7 +271,7 @@ public func _bjs_sumIntArray() -> Int32 { public func _bjs_findFirstPoint(_ matchingBytes: Int32, _ matchingLength: Int32) -> Void { #if arch(wasm32) let ret = findFirstPoint(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -291,11 +291,11 @@ public func _bjs_findFirstPoint(_ matchingBytes: Int32, _ matchingLength: Int32) public func _bjs_processUnsafeRawPointerArray() -> Void { #if arch(wasm32) let ret = processUnsafeRawPointerArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [UnsafeRawPointer] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + __result.append(UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer())) } __result.reverse() return __result @@ -313,11 +313,11 @@ public func _bjs_processUnsafeRawPointerArray() -> Void { public func _bjs_processUnsafeMutableRawPointerArray() -> Void { #if arch(wasm32) let ret = processUnsafeMutableRawPointerArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [UnsafeMutableRawPointer] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + __result.append(UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer())) } __result.reverse() return __result @@ -335,11 +335,11 @@ public func _bjs_processUnsafeMutableRawPointerArray() -> Void { public func _bjs_processOpaquePointerArray() -> Void { #if arch(wasm32) let ret = processOpaquePointerArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [OpaquePointer] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + __result.append(OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_pointer())) } __result.reverse() return __result @@ -357,11 +357,11 @@ public func _bjs_processOpaquePointerArray() -> Void { public func _bjs_processOptionalIntArray() -> Void { #if arch(wasm32) let ret = processOptionalIntArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -382,11 +382,11 @@ public func _bjs_processOptionalIntArray() -> Void { public func _bjs_processOptionalStringArray() -> Void { #if arch(wasm32) let ret = processOptionalStringArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -414,11 +414,11 @@ public func _bjs_processOptionalArray(_ values: Int32) -> Void { return Optional<[Int]>.none } else { return { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -441,11 +441,11 @@ public func _bjs_processOptionalArray(_ values: Int32) -> Void { public func _bjs_processOptionalPointArray() -> Void { #if arch(wasm32) let ret = processOptionalPointArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -466,11 +466,11 @@ public func _bjs_processOptionalPointArray() -> Void { public func _bjs_processOptionalDirectionArray() -> Void { #if arch(wasm32) let ret = processOptionalDirectionArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -491,11 +491,11 @@ public func _bjs_processOptionalDirectionArray() -> Void { public func _bjs_processOptionalStatusArray() -> Void { #if arch(wasm32) let ret = processOptionalStatusArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -516,16 +516,16 @@ public func _bjs_processOptionalStatusArray() -> Void { public func _bjs_processNestedIntArray() -> Void { #if arch(wasm32) let ret = processNestedIntArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[Int]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -549,16 +549,16 @@ public func _bjs_processNestedIntArray() -> Void { public func _bjs_processNestedStringArray() -> Void { #if arch(wasm32) let ret = processNestedStringArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[String]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -585,12 +585,12 @@ public func _bjs_processNestedStringArray() -> Void { public func _bjs_processNestedPointArray() -> Void { #if arch(wasm32) let ret = processNestedPointArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[Point]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -618,11 +618,11 @@ public func _bjs_processNestedPointArray() -> Void { public func _bjs_processItemArray() -> Void { #if arch(wasm32) let ret = processItemArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Item] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Item.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + __result.append(Item.bridgeJSLiftParameter(_swift_js_pop_pointer())) } __result.reverse() return __result @@ -640,16 +640,16 @@ public func _bjs_processItemArray() -> Void { public func _bjs_processNestedItemArray() -> Void { #if arch(wasm32) let ret = processNestedItemArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[Item]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Item] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Item.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + __result.append(Item.bridgeJSLiftParameter(_swift_js_pop_pointer())) } __result.reverse() return __result diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index 7803860a3..f4d02f14f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -39,9 +39,9 @@ extension Status: _BridgedSwiftCaseEnum { extension Config: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Config { - let enabled = Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let value = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let enabled = Bool.bridgeJSLiftParameter(_swift_js_pop_i32()) + let value = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) return Config(name: name, value: value, enabled: enabled) } @@ -89,7 +89,7 @@ fileprivate func _bjs_struct_lift_Config() -> Int32 { extension MathOperations: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MathOperations { - let baseValue = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let baseValue = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) return MathOperations(baseValue: baseValue) } @@ -322,11 +322,11 @@ public func _bjs_testOptionalStructWithValueDefault(_ point: Int32) -> Void { public func _bjs_testIntArrayDefault() -> Void { #if arch(wasm32) let ret = testIntArrayDefault(values: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -344,11 +344,11 @@ public func _bjs_testIntArrayDefault() -> Void { public func _bjs_testStringArrayDefault() -> Void { #if arch(wasm32) let ret = testStringArrayDefault(names: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -369,11 +369,11 @@ public func _bjs_testStringArrayDefault() -> Void { public func _bjs_testDoubleArrayDefault() -> Void { #if arch(wasm32) let ret = testDoubleArrayDefault(values: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Double] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) } __result.reverse() return __result @@ -391,11 +391,11 @@ public func _bjs_testDoubleArrayDefault() -> Void { public func _bjs_testBoolArrayDefault() -> Void { #if arch(wasm32) let ret = testBoolArrayDefault(flags: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Bool] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -413,11 +413,11 @@ public func _bjs_testBoolArrayDefault() -> Void { public func _bjs_testEmptyArrayDefault() -> Void { #if arch(wasm32) let ret = testEmptyArrayDefault(items: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -435,11 +435,11 @@ public func _bjs_testEmptyArrayDefault() -> Void { public func _bjs_testMixedWithArrayDefault(_ nameBytes: Int32, _ nameLength: Int32, _ enabled: Int32) -> Void { #if arch(wasm32) let ret = testMixedWithArrayDefault(name: String.bridgeJSLiftParameter(nameBytes, nameLength), values: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift index 13239108f..fa9e791ee 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift @@ -2,15 +2,15 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) case 2: - return .flag(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .flag(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) case 3: - return .rate(Float.bridgeJSLiftParameter(_swift_js_pop_param_f32())) + return .rate(Float.bridgeJSLiftParameter(_swift_js_pop_f32())) case 4: - return .precise(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + return .precise(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) case 5: return .info default: @@ -85,15 +85,15 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .error(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .error(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) case 2: - return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 3: - return .coordinates(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + return .coordinates(Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64())) case 4: - return .comprehensive(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .comprehensive(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 5: return .info default: @@ -224,11 +224,11 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Utilities.Result { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .failure(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .failure(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) case 2: - return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) default: fatalError("Unknown Utilities.Result case ID: \(caseId)") } @@ -303,9 +303,9 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> NetworkingResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .failure(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .failure(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) default: fatalError("Unknown NetworkingResult case ID: \(caseId)") } @@ -364,11 +364,11 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIOptionalResult { switch caseId { case 0: - return .success(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .failure(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .failure(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 2: - return .status(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .status(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())) default: fatalError("Unknown APIOptionalResult case ID: \(caseId)") } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index 7592f2960..cccbbf524 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -366,9 +366,9 @@ extension Result: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Result { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) default: fatalError("Unknown Result case ID: \(caseId)") } @@ -423,11 +423,11 @@ extension Priority: _BridgedSwiftEnumNoPayload { public func _bjs_processDelegates() -> Void { #if arch(wasm32) let ret = processDelegates(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [AnyMyViewControllerDelegate] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(AnyMyViewControllerDelegate.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(AnyMyViewControllerDelegate.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -654,11 +654,11 @@ fileprivate func _bjs_MyViewController_wrap(_ pointer: UnsafeMutableRawPointer) public func _bjs_DelegateManager_init() -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = DelegateManager(delegates: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [AnyMyViewControllerDelegate] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(AnyMyViewControllerDelegate.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(AnyMyViewControllerDelegate.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -697,11 +697,11 @@ public func _bjs_DelegateManager_delegates_get(_ _self: UnsafeMutableRawPointer) public func _bjs_DelegateManager_delegates_set(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) DelegateManager.bridgeJSLiftParameter(_self).delegates = { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [AnyMyViewControllerDelegate] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(AnyMyViewControllerDelegate.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(AnyMyViewControllerDelegate.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift index 8a5b56065..6d1f56f50 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift @@ -48,9 +48,9 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) default: fatalError("Unknown APIResult case ID: \(caseId)") } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift index 8a5b56065..6d1f56f50 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift @@ -48,9 +48,9 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) default: fatalError("Unknown APIResult case ID: \(caseId)") } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift index 7d0ae15da..feddadf15 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift @@ -677,15 +677,15 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) case 2: - return .flag(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .flag(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) case 3: - return .rate(Float.bridgeJSLiftParameter(_swift_js_pop_param_f32())) + return .rate(Float.bridgeJSLiftParameter(_swift_js_pop_f32())) case 4: - return .precise(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + return .precise(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) case 5: return .info default: diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift index ca164c1bf..35fbe039c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift @@ -3,11 +3,11 @@ extension Precision: _BridgedSwiftEnumNoPayload { extension DataPoint: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> DataPoint { - let optFlag = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let optCount = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let label = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let y = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) - let x = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let optFlag = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let optCount = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let label = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let y = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) + let x = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) return DataPoint(x: x, y: y, label: label, optCount: optCount, optFlag: optFlag) } @@ -76,9 +76,9 @@ public func _bjs_DataPoint_init(_ x: Float64, _ y: Float64, _ labelBytes: Int32, extension Address: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Address { - let zipCode = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let city = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let street = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let zipCode = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let city = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let street = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) return Address(street: street, city: city, zipCode: zipCode) } @@ -133,10 +133,10 @@ fileprivate func _bjs_struct_lift_Address() -> Int32 { extension Person: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Person { - let email = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let email = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32()) let address = Address.bridgeJSLiftParameter() - let age = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let age = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) return Person(name: name, age: age, address: address, email: email) } @@ -192,8 +192,8 @@ fileprivate func _bjs_struct_lift_Person() -> Int32 { extension Session: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Session { - let owner = Greeter.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) - let id = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let owner = Greeter.bridgeJSLiftParameter(_swift_js_pop_pointer()) + let id = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) return Session(id: id, owner: owner) } @@ -237,9 +237,9 @@ fileprivate func _bjs_struct_lift_Session() -> Int32 { extension Measurement: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Measurement { - let optionalPrecision = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f32()) - let precision = Precision.bridgeJSLiftParameter(_swift_js_pop_param_f32()) - let value = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let optionalPrecision = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f32()) + let precision = Precision.bridgeJSLiftParameter(_swift_js_pop_f32()) + let value = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) return Measurement(value: value, precision: precision, optionalPrecision: optionalPrecision) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift index 3ef3b9939..4c368908b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift @@ -1,10 +1,10 @@ extension PointerFields: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PointerFields { - let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) - let ptr = UnsafePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) - let opaque = OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) - let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) - let raw = UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) + let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) + let ptr = UnsafePointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) + let opaque = OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) + let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) + let raw = UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) return PointerFields(raw: raw, mutRaw: mutRaw, opaque: opaque, ptr: ptr, mutPtr: mutPtr) } diff --git a/Plugins/PackageToJS/Templates/instantiate.js b/Plugins/PackageToJS/Templates/instantiate.js index 1ab35de35..462df924b 100644 --- a/Plugins/PackageToJS/Templates/instantiate.js +++ b/Plugins/PackageToJS/Templates/instantiate.js @@ -44,9 +44,9 @@ async function createInstantiator(options, swift) { swift_js_push_f32: unexpectedBjsCall, swift_js_push_f64: unexpectedBjsCall, swift_js_push_string: unexpectedBjsCall, - swift_js_pop_param_int32: unexpectedBjsCall, - swift_js_pop_param_f32: unexpectedBjsCall, - swift_js_pop_param_f64: unexpectedBjsCall, + swift_js_pop_i32: unexpectedBjsCall, + swift_js_pop_f32: unexpectedBjsCall, + swift_js_pop_f64: unexpectedBjsCall, swift_js_return_optional_bool: unexpectedBjsCall, swift_js_return_optional_int: unexpectedBjsCall, swift_js_return_optional_string: unexpectedBjsCall, diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index dcdb8f6d0..3f4914ca0 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -452,28 +452,28 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_pop_param_int32") -@_spi(BridgeJS) public func _swift_js_pop_param_int32() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_pop_i32") +@_spi(BridgeJS) public func _swift_js_pop_i32() -> Int32 #else -@_spi(BridgeJS) public func _swift_js_pop_param_int32() -> Int32 { +@_spi(BridgeJS) public func _swift_js_pop_i32() -> Int32 { _onlyAvailableOnWasm() } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_pop_param_f32") -@_spi(BridgeJS) public func _swift_js_pop_param_f32() -> Float32 +@_extern(wasm, module: "bjs", name: "swift_js_pop_f32") +@_spi(BridgeJS) public func _swift_js_pop_f32() -> Float32 #else -@_spi(BridgeJS) public func _swift_js_pop_param_f32() -> Float32 { +@_spi(BridgeJS) public func _swift_js_pop_f32() -> Float32 { _onlyAvailableOnWasm() } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_pop_param_f64") -@_spi(BridgeJS) public func _swift_js_pop_param_f64() -> Float64 +@_extern(wasm, module: "bjs", name: "swift_js_pop_f64") +@_spi(BridgeJS) public func _swift_js_pop_f64() -> Float64 #else -@_spi(BridgeJS) public func _swift_js_pop_param_f64() -> Float64 { +@_spi(BridgeJS) public func _swift_js_pop_f64() -> Float64 { _onlyAvailableOnWasm() } #endif @@ -490,10 +490,10 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_pop_param_array_length") -@_spi(BridgeJS) public func _swift_js_pop_param_array_length() -> Int32 +@_extern(wasm, module: "bjs", name: "swift_js_pop_array_length") +@_spi(BridgeJS) public func _swift_js_pop_array_length() -> Int32 #else -@_spi(BridgeJS) public func _swift_js_pop_param_array_length() -> Int32 { +@_spi(BridgeJS) public func _swift_js_pop_array_length() -> Int32 { _onlyAvailableOnWasm() } #endif @@ -704,10 +704,10 @@ func _swift_js_return_optional_double(_ isSome: Int32, _ value: Float64) { #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_pop_param_pointer") -@_spi(BridgeJS) public func _swift_js_pop_param_pointer() -> UnsafeMutableRawPointer +@_extern(wasm, module: "bjs", name: "swift_js_pop_pointer") +@_spi(BridgeJS) public func _swift_js_pop_pointer() -> UnsafeMutableRawPointer #else -@_spi(BridgeJS) public func _swift_js_pop_param_pointer() -> UnsafeMutableRawPointer { +@_spi(BridgeJS) public func _swift_js_pop_pointer() -> UnsafeMutableRawPointer { _onlyAvailableOnWasm() } #endif diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 948b454c4..0cc31abc4 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -1438,15 +1438,15 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) case 2: - return .flag(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .flag(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) case 3: - return .rate(Float.bridgeJSLiftParameter(_swift_js_pop_param_f32())) + return .rate(Float.bridgeJSLiftParameter(_swift_js_pop_f32())) case 4: - return .precise(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + return .precise(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) case 5: return .info default: @@ -1521,17 +1521,17 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .error(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .error(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) case 2: - return .location(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .location(Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 3: - return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 4: - return .coordinates(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + return .coordinates(Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64())) case 5: - return .comprehensive(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .comprehensive(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 6: return .info default: @@ -1678,11 +1678,11 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Utilities.Result { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .failure(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .failure(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) case 2: - return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()), String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) default: fatalError("Unknown Utilities.Result case ID: \(caseId)") } @@ -1757,9 +1757,9 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> API.NetworkingResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .failure(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + return .failure(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) default: fatalError("Unknown API.NetworkingResult case ID: \(caseId)") } @@ -1818,11 +1818,11 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIOptionalResult { switch caseId { case 0: - return .success(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .success(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())) case 1: - return .failure(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .failure(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) case 2: - return .status(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()), Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + return .status(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())) default: fatalError("Unknown APIOptionalResult case ID: \(caseId)") } @@ -2220,8 +2220,8 @@ public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_se extension Point: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { - let y = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let x = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let y = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let x = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) return Point(x: x, y: y) } @@ -2265,11 +2265,11 @@ fileprivate func _bjs_struct_lift_Point() -> Int32 { extension PointerFields: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PointerFields { - let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) - let ptr = UnsafePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) - let opaque = OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) - let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) - let raw = UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer()) + let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) + let ptr = UnsafePointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) + let opaque = OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) + let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) + let raw = UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) return PointerFields(raw: raw, mutRaw: mutRaw, opaque: opaque, ptr: ptr, mutPtr: mutPtr) } @@ -2327,11 +2327,11 @@ public func _bjs_PointerFields_init(_ raw: UnsafeMutableRawPointer, _ mutRaw: Un extension DataPoint: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> DataPoint { - let optFlag = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let optCount = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let label = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let y = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) - let x = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let optFlag = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let optCount = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let label = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let y = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) + let x = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) return DataPoint(x: x, y: y, label: label, optCount: optCount, optFlag: optFlag) } @@ -2400,9 +2400,9 @@ public func _bjs_DataPoint_init(_ x: Float64, _ y: Float64, _ labelBytes: Int32, extension Address: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Address { - let zipCode = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let city = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let street = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let zipCode = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let city = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let street = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) return Address(street: street, city: city, zipCode: zipCode) } @@ -2457,11 +2457,11 @@ fileprivate func _bjs_struct_lift_Address() -> Int32 { extension Contact: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Contact { - let secondaryAddress = Optional
        .bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let email = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let secondaryAddress = Optional
        .bridgeJSLiftParameter(_swift_js_pop_i32()) + let email = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32()) let address = Address.bridgeJSLiftParameter() - let age = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let age = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) return Contact(name: name, age: age, address: address, email: email, secondaryAddress: secondaryAddress) } @@ -2522,10 +2522,10 @@ fileprivate func _bjs_struct_lift_Contact() -> Int32 { extension Config: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Config { - let status = Status.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let direction = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let theme = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let status = Status.bridgeJSLiftParameter(_swift_js_pop_i32()) + let direction = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let theme = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) return Config(name: name, theme: theme, direction: direction, status: status) } @@ -2585,8 +2585,8 @@ fileprivate func _bjs_struct_lift_Config() -> Int32 { extension SessionData: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> SessionData { - let owner = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_pointer()) - let id = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let owner = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_pointer()) + let id = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) return SessionData(id: id, owner: owner) } @@ -2634,10 +2634,10 @@ fileprivate func _bjs_struct_lift_SessionData() -> Int32 { extension ValidationReport: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ValidationReport { - let outcome = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let status = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let result = APIResult.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let id = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let outcome = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let status = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let result = APIResult.bridgeJSLiftParameter(_swift_js_pop_i32()) + let id = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) return ValidationReport(id: id, result: result, status: status, outcome: outcome) } @@ -2691,16 +2691,16 @@ fileprivate func _bjs_struct_lift_ValidationReport() -> Int32 { extension AdvancedConfig: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> AdvancedConfig { - let overrideDefaults = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let overrideDefaults = Optional.bridgeJSLiftParameter(_swift_js_pop_i32()) let defaults = ConfigStruct.bridgeJSLiftParameter() - let location = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let metadata = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let result = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let status = Status.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let theme = Theme.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let enabled = Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let title = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let id = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let location = Optional.bridgeJSLiftParameter(_swift_js_pop_i32()) + let metadata = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let result = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let status = Status.bridgeJSLiftParameter(_swift_js_pop_i32()) + let theme = Theme.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let enabled = Bool.bridgeJSLiftParameter(_swift_js_pop_i32()) + let title = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let id = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) return AdvancedConfig(id: id, title: title, enabled: enabled, theme: theme, status: status, result: result, metadata: metadata, location: location, defaults: defaults, overrideDefaults: overrideDefaults) } @@ -2774,10 +2774,10 @@ fileprivate func _bjs_struct_lift_AdvancedConfig() -> Int32 { extension MeasurementConfig: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MeasurementConfig { - let optionalRatio = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f64()) - let optionalPrecision = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_f32()) - let ratio = Ratio.bridgeJSLiftParameter(_swift_js_pop_param_f64()) - let precision = Precision.bridgeJSLiftParameter(_swift_js_pop_param_f32()) + let optionalRatio = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f64()) + let optionalPrecision = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f32()) + let ratio = Ratio.bridgeJSLiftParameter(_swift_js_pop_f64()) + let precision = Precision.bridgeJSLiftParameter(_swift_js_pop_f32()) return MeasurementConfig(precision: precision, ratio: ratio, optionalPrecision: optionalPrecision, optionalRatio: optionalRatio) } @@ -2831,7 +2831,7 @@ fileprivate func _bjs_struct_lift_MeasurementConfig() -> Int32 { extension MathOperations: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MathOperations { - let baseValue = Double.bridgeJSLiftParameter(_swift_js_pop_param_f64()) + let baseValue = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) return MathOperations(baseValue: baseValue) } @@ -2918,8 +2918,8 @@ public func _bjs_MathOperations_static_subtract(_ a: Float64, _ b: Float64) -> F extension CopyableCart: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> CopyableCart { - let note = Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32()) - let x = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let note = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32()) + let x = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) return CopyableCart(x: x, note: note) } @@ -2981,8 +2981,8 @@ public func _bjs_CopyableCart_static_fromJSObject(_ object: Int32) -> Void { extension CopyableCartItem: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> CopyableCartItem { - let quantity = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let sku = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let quantity = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let sku = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) return CopyableCartItem(sku: sku, quantity: quantity) } @@ -3029,9 +3029,9 @@ fileprivate func _bjs_struct_lift_CopyableCartItem() -> Int32 { extension CopyableNestedCart: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> CopyableNestedCart { - let shippingAddress = Optional
        .bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let shippingAddress = Optional
        .bridgeJSLiftParameter(_swift_js_pop_i32()) let item = CopyableCartItem.bridgeJSLiftParameter() - let id = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) + let id = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) return CopyableNestedCart(id: id, item: item, shippingAddress: shippingAddress) } @@ -3091,8 +3091,8 @@ public func _bjs_CopyableNestedCart_static_fromJSObject(_ object: Int32) -> Void extension ConfigStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ConfigStruct { - let value = Int.bridgeJSLiftParameter(_swift_js_pop_param_int32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32()) + let value = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) return ConfigStruct(name: name, value: value) } @@ -4567,11 +4567,11 @@ public func _bjs_testEmptyInit(_ object: UnsafeMutableRawPointer) -> UnsafeMutab public func _bjs_arrayWithDefault() -> Int32 { #if arch(wasm32) let ret = arrayWithDefault(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -4591,11 +4591,11 @@ public func _bjs_arrayWithOptionalDefault(_ values: Int32) -> Int32 { return Optional<[Int]>.none } else { return { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -4613,11 +4613,11 @@ public func _bjs_arrayWithOptionalDefault(_ values: Int32) -> Int32 { public func _bjs_arrayMixedDefaults(_ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { #if arch(wasm32) let ret = arrayMixedDefaults(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength), values: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -4666,11 +4666,11 @@ public func _bjs_makeAdder(_ base: Int32) -> UnsafeMutableRawPointer { public func _bjs_roundTripIntArray() -> Void { #if arch(wasm32) let ret = roundTripIntArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -4688,11 +4688,11 @@ public func _bjs_roundTripIntArray() -> Void { public func _bjs_roundTripStringArray() -> Void { #if arch(wasm32) let ret = roundTripStringArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -4713,11 +4713,11 @@ public func _bjs_roundTripStringArray() -> Void { public func _bjs_roundTripDoubleArray() -> Void { #if arch(wasm32) let ret = roundTripDoubleArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Double] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) } __result.reverse() return __result @@ -4735,11 +4735,11 @@ public func _bjs_roundTripDoubleArray() -> Void { public func _bjs_roundTripBoolArray() -> Void { #if arch(wasm32) let ret = roundTripBoolArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Bool] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -4757,11 +4757,11 @@ public func _bjs_roundTripBoolArray() -> Void { public func _bjs_roundTripDirectionArray() -> Void { #if arch(wasm32) let ret = roundTripDirectionArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Direction] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Direction.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Direction.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -4779,11 +4779,11 @@ public func _bjs_roundTripDirectionArray() -> Void { public func _bjs_roundTripStatusArray() -> Void { #if arch(wasm32) let ret = roundTripStatusArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Status] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Status.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Status.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -4801,11 +4801,11 @@ public func _bjs_roundTripStatusArray() -> Void { public func _bjs_roundTripThemeArray() -> Void { #if arch(wasm32) let ret = roundTripThemeArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Theme] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Theme.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(Theme.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -4826,11 +4826,11 @@ public func _bjs_roundTripThemeArray() -> Void { public func _bjs_roundTripHttpStatusArray() -> Void { #if arch(wasm32) let ret = roundTripHttpStatusArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [HttpStatus] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(HttpStatus.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(HttpStatus.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -4848,7 +4848,7 @@ public func _bjs_roundTripHttpStatusArray() -> Void { public func _bjs_roundTripDataPointArray() -> Void { #if arch(wasm32) let ret = roundTripDataPointArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [DataPoint] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4870,11 +4870,11 @@ public func _bjs_roundTripDataPointArray() -> Void { public func _bjs_roundTripGreeterArray() -> Void { #if arch(wasm32) let ret = roundTripGreeterArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Greeter] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Greeter.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + __result.append(Greeter.bridgeJSLiftParameter(_swift_js_pop_pointer())) } __result.reverse() return __result @@ -4892,11 +4892,11 @@ public func _bjs_roundTripGreeterArray() -> Void { public func _bjs_roundTripOptionalIntArray() -> Void { #if arch(wasm32) let ret = roundTripOptionalIntArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -4917,11 +4917,11 @@ public func _bjs_roundTripOptionalIntArray() -> Void { public func _bjs_roundTripOptionalStringArray() -> Void { #if arch(wasm32) let ret = roundTripOptionalStringArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -4945,11 +4945,11 @@ public func _bjs_roundTripOptionalStringArray() -> Void { public func _bjs_roundTripOptionalDataPointArray() -> Void { #if arch(wasm32) let ret = roundTripOptionalDataPointArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -4970,11 +4970,11 @@ public func _bjs_roundTripOptionalDataPointArray() -> Void { public func _bjs_roundTripOptionalDirectionArray() -> Void { #if arch(wasm32) let ret = roundTripOptionalDirectionArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -4995,11 +4995,11 @@ public func _bjs_roundTripOptionalDirectionArray() -> Void { public func _bjs_roundTripOptionalStatusArray() -> Void { #if arch(wasm32) let ret = roundTripOptionalStatusArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -5024,11 +5024,11 @@ public func _bjs_roundTripOptionalIntArrayType(_ values: Int32) -> Void { return Optional<[Int]>.none } else { return { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -5055,11 +5055,11 @@ public func _bjs_roundTripOptionalStringArrayType(_ values: Int32) -> Void { return Optional<[String]>.none } else { return { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -5089,11 +5089,11 @@ public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { return Optional<[Greeter]>.none } else { return { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Greeter] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Greeter.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + __result.append(Greeter.bridgeJSLiftParameter(_swift_js_pop_pointer())) } __result.reverse() return __result @@ -5116,16 +5116,16 @@ public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { public func _bjs_roundTripNestedIntArray() -> Void { #if arch(wasm32) let ret = roundTripNestedIntArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[Int]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -5149,16 +5149,16 @@ public func _bjs_roundTripNestedIntArray() -> Void { public func _bjs_roundTripNestedStringArray() -> Void { #if arch(wasm32) let ret = roundTripNestedStringArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[String]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_param_int32(), _swift_js_pop_param_int32())) + __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) } __result.reverse() return __result @@ -5185,16 +5185,16 @@ public func _bjs_roundTripNestedStringArray() -> Void { public func _bjs_roundTripNestedDoubleArray() -> Void { #if arch(wasm32) let ret = roundTripNestedDoubleArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[Double]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Double] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_param_f64())) + __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) } __result.reverse() return __result @@ -5218,16 +5218,16 @@ public func _bjs_roundTripNestedDoubleArray() -> Void { public func _bjs_roundTripNestedBoolArray() -> Void { #if arch(wasm32) let ret = roundTripNestedBoolArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[Bool]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Bool] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -5251,12 +5251,12 @@ public func _bjs_roundTripNestedBoolArray() -> Void { public func _bjs_roundTripNestedDataPointArray() -> Void { #if arch(wasm32) let ret = roundTripNestedDataPointArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[DataPoint]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [DataPoint] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5284,16 +5284,16 @@ public func _bjs_roundTripNestedDataPointArray() -> Void { public func _bjs_roundTripNestedDirectionArray() -> Void { #if arch(wasm32) let ret = roundTripNestedDirectionArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[Direction]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Direction] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Direction.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(Direction.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -5317,16 +5317,16 @@ public func _bjs_roundTripNestedDirectionArray() -> Void { public func _bjs_roundTripNestedGreeterArray() -> Void { #if arch(wasm32) let ret = roundTripNestedGreeterArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [[Greeter]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [Greeter] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Greeter.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + __result.append(Greeter.bridgeJSLiftParameter(_swift_js_pop_pointer())) } __result.reverse() return __result @@ -5350,11 +5350,11 @@ public func _bjs_roundTripNestedGreeterArray() -> Void { public func _bjs_roundTripUnsafeRawPointerArray() -> Void { #if arch(wasm32) let ret = roundTripUnsafeRawPointerArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [UnsafeRawPointer] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + __result.append(UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer())) } __result.reverse() return __result @@ -5372,11 +5372,11 @@ public func _bjs_roundTripUnsafeRawPointerArray() -> Void { public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { #if arch(wasm32) let ret = roundTripUnsafeMutableRawPointerArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [UnsafeMutableRawPointer] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + __result.append(UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer())) } __result.reverse() return __result @@ -5394,11 +5394,11 @@ public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { public func _bjs_roundTripOpaquePointerArray() -> Void { #if arch(wasm32) let ret = roundTripOpaquePointerArray(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [OpaquePointer] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_param_pointer())) + __result.append(OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_pointer())) } __result.reverse() return __result @@ -5416,11 +5416,11 @@ public func _bjs_roundTripOpaquePointerArray() -> Void { public func _bjs_consumeDataProcessorArrayType() -> Int32 { #if arch(wasm32) let ret = consumeDataProcessorArrayType(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [AnyDataProcessor] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(AnyDataProcessor.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(AnyDataProcessor.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result @@ -5436,11 +5436,11 @@ public func _bjs_consumeDataProcessorArrayType() -> Int32 { public func _bjs_roundTripDataProcessorArrayType() -> Void { #if arch(wasm32) let ret = roundTripDataProcessorArrayType(_: { - let __count = Int(_swift_js_pop_param_array_length()) + let __count = Int(_swift_js_pop_array_length()) var __result: [AnyDataProcessor] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(AnyDataProcessor.bridgeJSLiftParameter(_swift_js_pop_param_int32())) + __result.append(AnyDataProcessor.bridgeJSLiftParameter(_swift_js_pop_i32())) } __result.reverse() return __result From dbc216afc4836e0977b0345f43462ef7a463a50e Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 2 Feb 2026 19:23:30 +0900 Subject: [PATCH 119/252] BridgeJS: Remove `swift_js_pop_array_length` --- Benchmarks/Sources/Generated/BridgeJS.swift | 44 +++++----- .../Sources/BridgeJSCore/ExportSwift.swift | 2 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 6 -- .../Sources/BridgeJSLink/JSGlueGen.swift | 4 +- .../ArrayParameter.Import.js | 4 - .../BridgeJSLinkTests/ArrayTypes.Export.js | 58 +++++++------- .../BridgeJSLinkTests/Async.Export.js | 4 - .../BridgeJSLinkTests/Async.Import.js | 4 - .../DefaultParameters.Export.js | 16 ++-- .../EnumAssociatedValue.Export.js | 4 - .../BridgeJSLinkTests/EnumCase.Export.js | 4 - .../BridgeJSLinkTests/EnumNamespace.Export.js | 4 - .../EnumNamespace.Global.Export.js | 4 - .../BridgeJSLinkTests/EnumRawType.Export.js | 4 - .../GlobalGetter.ImportMacros.js | 4 - .../GlobalThisImports.ImportMacros.js | 4 - .../ImportedTypeInExportedInterface.Export.js | 4 - .../BridgeJSLinkTests/Interface.Import.js | 4 - .../InvalidPropertyNames.Import.js | 4 - .../BridgeJSLinkTests/MixedGlobal.Export.js | 4 - .../BridgeJSLinkTests/MixedModules.Export.js | 4 - .../BridgeJSLinkTests/MixedPrivate.Export.js | 4 - .../MultipleImportedTypes.Import.js | 4 - .../BridgeJSLinkTests/Namespaces.Export.js | 4 - .../Namespaces.Global.Export.js | 4 - .../BridgeJSLinkTests/Optionals.Export.js | 4 - .../PrimitiveParameters.Export.js | 4 - .../PrimitiveParameters.Import.js | 4 - .../PrimitiveReturn.Export.js | 4 - .../PrimitiveReturn.Import.js | 4 - .../BridgeJSLinkTests/PropertyTypes.Export.js | 4 - .../BridgeJSLinkTests/Protocol.Export.js | 10 +-- .../BridgeJSLinkTests/ReExportFrom.Import.js | 4 - .../StaticFunctions.Export.js | 4 - .../StaticFunctions.Global.Export.js | 4 - .../StaticProperties.Export.js | 4 - .../StaticProperties.Global.Export.js | 4 - .../BridgeJSLinkTests/StringEnum.Import.js | 4 - .../StringParameter.Export.js | 4 - .../StringParameter.Import.js | 4 - .../BridgeJSLinkTests/StringReturn.Export.js | 4 - .../BridgeJSLinkTests/StringReturn.Import.js | 4 - .../BridgeJSLinkTests/SwiftClass.Export.js | 4 - .../BridgeJSLinkTests/SwiftClosure.Export.js | 4 - .../SwiftClosureImports.ImportMacros.js | 4 - .../BridgeJSLinkTests/SwiftStruct.Export.js | 4 - .../SwiftStructImports.ImportMacros.js | 4 - .../TS2SkeletonLike.Import.js | 4 - .../BridgeJSLinkTests/Throws.Export.js | 4 - .../BridgeJSLinkTests/TypeAlias.Import.js | 4 - .../TypeScriptClass.Import.js | 4 - .../BridgeJSLinkTests/UnsafePointer.Export.js | 4 - .../VoidParameterVoidReturn.Export.js | 4 - .../VoidParameterVoidReturn.Import.js | 4 - .../ExportSwiftTests/ArrayTypes.swift | 54 ++++++------- .../ExportSwiftTests/DefaultParameters.swift | 12 +-- .../ExportSwiftTests/Protocol.swift | 6 +- .../JavaScriptKit/BridgeJSIntrinsics.swift | 9 --- .../Generated/BridgeJS.swift | 80 +++++++++---------- 59 files changed, 136 insertions(+), 353 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index fd45582e1..a582a1bed 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -1488,7 +1488,7 @@ public func _bjs_ArrayRoundtrip_init() -> UnsafeMutableRawPointer { public func _bjs_ArrayRoundtrip_takeIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeIntArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1520,7 +1520,7 @@ public func _bjs_ArrayRoundtrip_makeIntArray(_ _self: UnsafeMutableRawPointer) - public func _bjs_ArrayRoundtrip_roundtripIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripIntArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1555,7 +1555,7 @@ public func _bjs_ArrayRoundtrip_makeIntArrayLarge(_ _self: UnsafeMutableRawPoint public func _bjs_ArrayRoundtrip_takeDoubleArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeDoubleArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Double] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1587,7 +1587,7 @@ public func _bjs_ArrayRoundtrip_makeDoubleArray(_ _self: UnsafeMutableRawPointer public func _bjs_ArrayRoundtrip_roundtripDoubleArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripDoubleArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Double] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1609,7 +1609,7 @@ public func _bjs_ArrayRoundtrip_roundtripDoubleArray(_ _self: UnsafeMutableRawPo public func _bjs_ArrayRoundtrip_takeStringArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeStringArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1644,7 +1644,7 @@ public func _bjs_ArrayRoundtrip_makeStringArray(_ _self: UnsafeMutableRawPointer public func _bjs_ArrayRoundtrip_roundtripStringArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripStringArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1669,7 +1669,7 @@ public func _bjs_ArrayRoundtrip_roundtripStringArray(_ _self: UnsafeMutableRawPo public func _bjs_ArrayRoundtrip_takePointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takePointArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1701,7 +1701,7 @@ public func _bjs_ArrayRoundtrip_makePointArray(_ _self: UnsafeMutableRawPointer) public func _bjs_ArrayRoundtrip_roundtripPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripPointArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1736,12 +1736,12 @@ public func _bjs_ArrayRoundtrip_makePointArrayLarge(_ _self: UnsafeMutableRawPoi public func _bjs_ArrayRoundtrip_takeNestedIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedIntArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[Int]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1779,12 +1779,12 @@ public func _bjs_ArrayRoundtrip_makeNestedIntArray(_ _self: UnsafeMutableRawPoin public func _bjs_ArrayRoundtrip_roundtripNestedIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedIntArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[Int]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1812,12 +1812,12 @@ public func _bjs_ArrayRoundtrip_roundtripNestedIntArray(_ _self: UnsafeMutableRa public func _bjs_ArrayRoundtrip_takeNestedPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedPointArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[Point]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1855,12 +1855,12 @@ public func _bjs_ArrayRoundtrip_makeNestedPointArray(_ _self: UnsafeMutableRawPo public func _bjs_ArrayRoundtrip_roundtripNestedPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedPointArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[Point]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1888,7 +1888,7 @@ public func _bjs_ArrayRoundtrip_roundtripNestedPointArray(_ _self: UnsafeMutable public func _bjs_ArrayRoundtrip_takeOptionalIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeOptionalIntArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1923,7 +1923,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalIntArray(_ _self: UnsafeMutableRawPo public func _bjs_ArrayRoundtrip_roundtripOptionalIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripOptionalIntArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1948,7 +1948,7 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalIntArray(_ _self: UnsafeMutable public func _bjs_ArrayRoundtrip_takeOptionalPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) ArrayRoundtrip.bridgeJSLiftParameter(_self).takeOptionalPointArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -1983,7 +1983,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalPointArray(_ _self: UnsafeMutableRaw public func _bjs_ArrayRoundtrip_roundtripOptionalPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripOptionalPointArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -2012,7 +2012,7 @@ public func _bjs_ArrayRoundtrip_takeOptionalArray(_ _self: UnsafeMutableRawPoint return Optional<[Int]>.none } else { return { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -2069,7 +2069,7 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalArray(_ _self: UnsafeMutableRaw return Optional<[Int]>.none } else { return { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index d91024d10..62c0475ea 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -856,7 +856,7 @@ struct StackCodegen { let swiftTypeName = elementType.swiftType return """ { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [\(raw: swiftTypeName)] = [] __result.reserveCapacity(__count) for _ in 0..<__count { diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index dc20ee73a..8c2cbe474 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -257,7 +257,6 @@ public struct BridgeJSLink { "let \(JSGlueVariableScope.reservedTmpParamPointers) = [];", "let \(JSGlueVariableScope.reservedTmpStructCleanups) = [];", "let \(JSGlueVariableScope.reservedTmpRetArrayLengths) = [];", - "let \(JSGlueVariableScope.reservedTmpParamArrayLengths) = [];", "const \(JSGlueVariableScope.reservedEnumHelpers) = {};", "const \(JSGlueVariableScope.reservedStructHelpers) = {};", "", @@ -446,11 +445,6 @@ public struct BridgeJSLink { printer.write("\(JSGlueVariableScope.reservedTmpRetArrayLengths).push(len | 0);") } printer.write("}") - printer.write("bjs[\"swift_js_pop_array_length\"] = function() {") - printer.indent { - printer.write("return \(JSGlueVariableScope.reservedTmpParamArrayLengths).pop();") - } - printer.write("}") printer.write("bjs[\"swift_js_struct_cleanup\"] = function(cleanupId) {") printer.indent { printer.write("if (cleanupId === 0) { return; }") diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index cf0919304..5ff651282 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -32,7 +32,6 @@ final class JSGlueVariableScope { static let reservedTmpParamPointers = "tmpParamPointers" static let reservedTmpStructCleanups = "tmpStructCleanups" static let reservedTmpRetArrayLengths = "tmpRetArrayLengths" - static let reservedTmpParamArrayLengths = "tmpParamArrayLengths" static let reservedEnumHelpers = "enumHelpers" static let reservedStructHelpers = "structHelpers" @@ -63,7 +62,6 @@ final class JSGlueVariableScope { reservedTmpParamPointers, reservedTmpStructCleanups, reservedTmpRetArrayLengths, - reservedTmpParamArrayLengths, reservedEnumHelpers, reservedStructHelpers, ] @@ -2172,7 +2170,7 @@ struct IntrinsicJSFragment: Sendable { } } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamArrayLengths).push(\(arr).length);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(arr).length);") cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") return [] } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js index 30b8318bb..be84c1438 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js index b99d6dabf..89c574bb3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js @@ -43,7 +43,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -133,9 +132,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; @@ -302,7 +298,7 @@ export async function createInstantiator(options, swift) { for (const elem of values) { tmpParamInts.push((elem | 0)); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_processIntArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -325,7 +321,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); }); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_processStringArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -342,7 +338,7 @@ export async function createInstantiator(options, swift) { for (const elem of values) { tmpParamF64s.push(elem); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_processDoubleArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -359,7 +355,7 @@ export async function createInstantiator(options, swift) { for (const elem of values) { tmpParamInts.push(elem ? 1 : 0); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_processBoolArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -379,7 +375,7 @@ export async function createInstantiator(options, swift) { if (cleanup) { cleanup(); } }); } - tmpParamArrayLengths.push(points.length); + tmpParamInts.push(points.length); instance.exports.bjs_processPointArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -396,7 +392,7 @@ export async function createInstantiator(options, swift) { for (const elem of directions) { tmpParamInts.push((elem | 0)); } - tmpParamArrayLengths.push(directions.length); + tmpParamInts.push(directions.length); instance.exports.bjs_processDirectionArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -413,7 +409,7 @@ export async function createInstantiator(options, swift) { for (const elem of statuses) { tmpParamInts.push((elem | 0)); } - tmpParamArrayLengths.push(statuses.length); + tmpParamInts.push(statuses.length); instance.exports.bjs_processStatusArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -430,7 +426,7 @@ export async function createInstantiator(options, swift) { for (const elem of values) { tmpParamInts.push((elem | 0)); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); const ret = instance.exports.bjs_sumIntArray(); for (const cleanup of arrayCleanups) { cleanup(); } return ret; @@ -443,7 +439,7 @@ export async function createInstantiator(options, swift) { if (cleanup) { cleanup(); } }); } - tmpParamArrayLengths.push(points.length); + tmpParamInts.push(points.length); const matchingBytes = textEncoder.encode(matching); const matchingId = swift.memory.retain(matchingBytes); instance.exports.bjs_findFirstPoint(matchingId, matchingBytes.length); @@ -457,7 +453,7 @@ export async function createInstantiator(options, swift) { for (const elem of values) { tmpParamPointers.push((elem | 0)); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_processUnsafeRawPointerArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -474,7 +470,7 @@ export async function createInstantiator(options, swift) { for (const elem of values) { tmpParamPointers.push((elem | 0)); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_processUnsafeMutableRawPointerArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -491,7 +487,7 @@ export async function createInstantiator(options, swift) { for (const elem of values) { tmpParamPointers.push((elem | 0)); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_processOpaquePointerArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -514,7 +510,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(isSome); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_processOptionalIntArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -549,7 +545,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(isSome); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_processOptionalStringArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -576,7 +572,7 @@ export async function createInstantiator(options, swift) { for (const elem of values) { tmpParamInts.push((elem | 0)); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); } instance.exports.bjs_processOptionalArray(+isSome); @@ -608,7 +604,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(isSome); } - tmpParamArrayLengths.push(points.length); + tmpParamInts.push(points.length); instance.exports.bjs_processOptionalPointArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -638,7 +634,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(isSome); } - tmpParamArrayLengths.push(directions.length); + tmpParamInts.push(directions.length); instance.exports.bjs_processOptionalDirectionArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -668,7 +664,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(isSome); } - tmpParamArrayLengths.push(statuses.length); + tmpParamInts.push(statuses.length); instance.exports.bjs_processOptionalStatusArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -694,12 +690,12 @@ export async function createInstantiator(options, swift) { for (const elem1 of elem) { tmpParamInts.push((elem1 | 0)); } - tmpParamArrayLengths.push(elem.length); + tmpParamInts.push(elem.length); arrayCleanups.push(() => { for (const cleanup of arrayCleanups1) { cleanup(); } }); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_processNestedIntArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -730,12 +726,12 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); }); } - tmpParamArrayLengths.push(elem.length); + tmpParamInts.push(elem.length); arrayCleanups.push(() => { for (const cleanup of arrayCleanups1) { cleanup(); } }); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_processNestedStringArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -763,12 +759,12 @@ export async function createInstantiator(options, swift) { if (cleanup) { cleanup(); } }); } - tmpParamArrayLengths.push(elem.length); + tmpParamInts.push(elem.length); arrayCleanups.push(() => { for (const cleanup of arrayCleanups1) { cleanup(); } }); } - tmpParamArrayLengths.push(points.length); + tmpParamInts.push(points.length); instance.exports.bjs_processNestedPointArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -791,7 +787,7 @@ export async function createInstantiator(options, swift) { for (const elem of items) { tmpParamPointers.push(elem.pointer); } - tmpParamArrayLengths.push(items.length); + tmpParamInts.push(items.length); instance.exports.bjs_processItemArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -811,12 +807,12 @@ export async function createInstantiator(options, swift) { for (const elem1 of elem) { tmpParamPointers.push(elem1.pointer); } - tmpParamArrayLengths.push(elem.length); + tmpParamInts.push(elem.length); arrayCleanups.push(() => { for (const cleanup of arrayCleanups1) { cleanup(); } }); } - tmpParamArrayLengths.push(items.length); + tmpParamInts.push(items.length); instance.exports.bjs_processNestedItemArray(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js index 77c342a4a..a83274e1a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js index 9bc5e68f6..ff3551e31 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index 10610bffe..6b9785933 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -36,7 +36,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -159,9 +158,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; @@ -566,7 +562,7 @@ export async function createInstantiator(options, swift) { for (const elem of values) { tmpParamInts.push((elem | 0)); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_testIntArrayDefault(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -589,7 +585,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); }); } - tmpParamArrayLengths.push(names.length); + tmpParamInts.push(names.length); instance.exports.bjs_testStringArrayDefault(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -606,7 +602,7 @@ export async function createInstantiator(options, swift) { for (const elem of values) { tmpParamF64s.push(elem); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_testDoubleArrayDefault(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -623,7 +619,7 @@ export async function createInstantiator(options, swift) { for (const elem of flags) { tmpParamInts.push(elem ? 1 : 0); } - tmpParamArrayLengths.push(flags.length); + tmpParamInts.push(flags.length); instance.exports.bjs_testBoolArrayDefault(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -640,7 +636,7 @@ export async function createInstantiator(options, swift) { for (const elem of items) { tmpParamInts.push((elem | 0)); } - tmpParamArrayLengths.push(items.length); + tmpParamInts.push(items.length); instance.exports.bjs_testEmptyArrayDefault(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; @@ -659,7 +655,7 @@ export async function createInstantiator(options, swift) { for (const elem of values) { tmpParamInts.push((elem | 0)); } - tmpParamArrayLengths.push(values.length); + tmpParamInts.push(values.length); instance.exports.bjs_testMixedWithArrayDefault(nameId, nameBytes.length, enabled); const ret = tmpRetString; tmpRetString = undefined; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index 93a671ce0..d1bf82d39 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -505,7 +505,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -581,9 +580,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js index bce9a1e13..5b5a631cd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js @@ -54,7 +54,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -130,9 +129,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index 7fa29cbeb..936080db8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -55,7 +55,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -131,9 +130,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js index 144189324..9e4b57dbe 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js @@ -74,7 +74,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -150,9 +149,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js index 7d26b5a93..1ef43bd79 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js @@ -105,7 +105,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -181,9 +180,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js index 7c209def8..ac53d326f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js index e5f0cd3ee..724df077e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js index c9534033f..231873ab0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js index 681816a95..b1dd75c44 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index 5a1deb65a..50de3378c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js index c1b926130..d11b74338 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js index ae95f4431..f39b6209b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js index 63dd5b663..a78095948 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index f4833046b..d6adac3c0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index 0d7b5da19..5342ac94e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js index 6e7b72de5..e262b76fc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js index 979053ca9..df4337f5f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js index e7dc4822a..ccde5f78f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js index 5bc929c84..4d7787868 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js index 15ba11dd9..35069b2e4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js index 3fb51061f..c07676bc4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js index db62b9a72..7e5e3c1ca 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index 6f0810c05..6d51db5e6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -94,7 +94,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -170,9 +169,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; @@ -703,7 +699,7 @@ export async function createInstantiator(options, swift) { const objId = swift.memory.retain(elem); tmpParamInts.push(objId); } - tmpParamArrayLengths.push(delegates.length); + tmpParamInts.push(delegates.length); const ret = instance.exports.bjs_DelegateManager_init(); for (const cleanup of arrayCleanups) { cleanup(); } return DelegateManager.__construct(ret); @@ -730,7 +726,7 @@ export async function createInstantiator(options, swift) { const objId = swift.memory.retain(elem); tmpParamInts.push(objId); } - tmpParamArrayLengths.push(value.length); + tmpParamInts.push(value.length); instance.exports.bjs_DelegateManager_delegates_set(this.pointer); for (const cleanup of arrayCleanups) { cleanup(); } } @@ -745,7 +741,7 @@ export async function createInstantiator(options, swift) { const objId = swift.memory.retain(elem); tmpParamInts.push(objId); } - tmpParamArrayLengths.push(delegates.length); + tmpParamInts.push(delegates.length); instance.exports.bjs_processDelegates(); const arrayLen = tmpRetArrayLengths.pop(); const arrayResult = []; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js index 10ab693ec..3a3cc4fd6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index a77b18b37..cdf2e4d80 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -81,7 +81,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -157,9 +156,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js index 317e80b89..51833fee1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js @@ -81,7 +81,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -157,9 +156,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js index d7e384d43..91ced0c67 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js @@ -35,7 +35,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -111,9 +110,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js index b9b4307cc..c374d9a6f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js @@ -35,7 +35,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -111,9 +110,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js index 9712e79e0..a836bf2b5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js index c06d3fb4e..9a9c9cdc2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js index fb12e02f6..9ebd38074 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js index 52b0ffc2e..cfe649726 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js index b81ff5526..75c9a1d47 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js index 189cab792..e7f76436c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js index ada39cb45..9d18cd143 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js @@ -132,7 +132,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -208,9 +207,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js index 5f3d4bb0c..a51be1c96 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js index fe124a7d6..745998d8e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js @@ -35,7 +35,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -300,9 +299,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js index 23937d680..916be5c96 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -121,9 +120,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js index feac2e1be..d87b8b6cb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js index 1b6ecbf8b..8c039e374 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js index 2bbe333e2..94012ee5d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index be93e6af4..01646bc60 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js index a6d141ebf..1b7fd5ceb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -126,9 +125,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js index 1328d8af1..bc542c373 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -106,9 +105,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js index dbb6cc0ba..7f99e811e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js @@ -30,7 +30,6 @@ export async function createInstantiator(options, swift) { let tmpParamPointers = []; let tmpStructCleanups = []; let tmpRetArrayLengths = []; - let tmpParamArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_array_length"] = function(len) { tmpRetArrayLengths.push(len | 0); } - bjs["swift_js_pop_array_length"] = function() { - return tmpParamArrayLengths.pop(); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift index b897ab42f..7c0d12892 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift @@ -94,7 +94,7 @@ fileprivate func _bjs_struct_lift_Point() -> Int32 { public func _bjs_processIntArray() -> Void { #if arch(wasm32) let ret = processIntArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -116,7 +116,7 @@ public func _bjs_processIntArray() -> Void { public func _bjs_processStringArray() -> Void { #if arch(wasm32) let ret = processStringArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -141,7 +141,7 @@ public func _bjs_processStringArray() -> Void { public func _bjs_processDoubleArray() -> Void { #if arch(wasm32) let ret = processDoubleArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Double] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -163,7 +163,7 @@ public func _bjs_processDoubleArray() -> Void { public func _bjs_processBoolArray() -> Void { #if arch(wasm32) let ret = processBoolArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Bool] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -185,7 +185,7 @@ public func _bjs_processBoolArray() -> Void { public func _bjs_processPointArray() -> Void { #if arch(wasm32) let ret = processPointArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -207,7 +207,7 @@ public func _bjs_processPointArray() -> Void { public func _bjs_processDirectionArray() -> Void { #if arch(wasm32) let ret = processDirectionArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Direction] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -229,7 +229,7 @@ public func _bjs_processDirectionArray() -> Void { public func _bjs_processStatusArray() -> Void { #if arch(wasm32) let ret = processStatusArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Status] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -251,7 +251,7 @@ public func _bjs_processStatusArray() -> Void { public func _bjs_sumIntArray() -> Int32 { #if arch(wasm32) let ret = sumIntArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -271,7 +271,7 @@ public func _bjs_sumIntArray() -> Int32 { public func _bjs_findFirstPoint(_ matchingBytes: Int32, _ matchingLength: Int32) -> Void { #if arch(wasm32) let ret = findFirstPoint(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -291,7 +291,7 @@ public func _bjs_findFirstPoint(_ matchingBytes: Int32, _ matchingLength: Int32) public func _bjs_processUnsafeRawPointerArray() -> Void { #if arch(wasm32) let ret = processUnsafeRawPointerArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [UnsafeRawPointer] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -313,7 +313,7 @@ public func _bjs_processUnsafeRawPointerArray() -> Void { public func _bjs_processUnsafeMutableRawPointerArray() -> Void { #if arch(wasm32) let ret = processUnsafeMutableRawPointerArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [UnsafeMutableRawPointer] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -335,7 +335,7 @@ public func _bjs_processUnsafeMutableRawPointerArray() -> Void { public func _bjs_processOpaquePointerArray() -> Void { #if arch(wasm32) let ret = processOpaquePointerArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [OpaquePointer] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -357,7 +357,7 @@ public func _bjs_processOpaquePointerArray() -> Void { public func _bjs_processOptionalIntArray() -> Void { #if arch(wasm32) let ret = processOptionalIntArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -382,7 +382,7 @@ public func _bjs_processOptionalIntArray() -> Void { public func _bjs_processOptionalStringArray() -> Void { #if arch(wasm32) let ret = processOptionalStringArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -414,7 +414,7 @@ public func _bjs_processOptionalArray(_ values: Int32) -> Void { return Optional<[Int]>.none } else { return { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -441,7 +441,7 @@ public func _bjs_processOptionalArray(_ values: Int32) -> Void { public func _bjs_processOptionalPointArray() -> Void { #if arch(wasm32) let ret = processOptionalPointArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -466,7 +466,7 @@ public func _bjs_processOptionalPointArray() -> Void { public func _bjs_processOptionalDirectionArray() -> Void { #if arch(wasm32) let ret = processOptionalDirectionArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -491,7 +491,7 @@ public func _bjs_processOptionalDirectionArray() -> Void { public func _bjs_processOptionalStatusArray() -> Void { #if arch(wasm32) let ret = processOptionalStatusArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -516,12 +516,12 @@ public func _bjs_processOptionalStatusArray() -> Void { public func _bjs_processNestedIntArray() -> Void { #if arch(wasm32) let ret = processNestedIntArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[Int]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -549,12 +549,12 @@ public func _bjs_processNestedIntArray() -> Void { public func _bjs_processNestedStringArray() -> Void { #if arch(wasm32) let ret = processNestedStringArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[String]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -585,12 +585,12 @@ public func _bjs_processNestedStringArray() -> Void { public func _bjs_processNestedPointArray() -> Void { #if arch(wasm32) let ret = processNestedPointArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[Point]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Point] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -618,7 +618,7 @@ public func _bjs_processNestedPointArray() -> Void { public func _bjs_processItemArray() -> Void { #if arch(wasm32) let ret = processItemArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Item] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -640,12 +640,12 @@ public func _bjs_processItemArray() -> Void { public func _bjs_processNestedItemArray() -> Void { #if arch(wasm32) let ret = processNestedItemArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[Item]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Item] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index f4d02f14f..b60a3c782 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -322,7 +322,7 @@ public func _bjs_testOptionalStructWithValueDefault(_ point: Int32) -> Void { public func _bjs_testIntArrayDefault() -> Void { #if arch(wasm32) let ret = testIntArrayDefault(values: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -344,7 +344,7 @@ public func _bjs_testIntArrayDefault() -> Void { public func _bjs_testStringArrayDefault() -> Void { #if arch(wasm32) let ret = testStringArrayDefault(names: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -369,7 +369,7 @@ public func _bjs_testStringArrayDefault() -> Void { public func _bjs_testDoubleArrayDefault() -> Void { #if arch(wasm32) let ret = testDoubleArrayDefault(values: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Double] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -391,7 +391,7 @@ public func _bjs_testDoubleArrayDefault() -> Void { public func _bjs_testBoolArrayDefault() -> Void { #if arch(wasm32) let ret = testBoolArrayDefault(flags: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Bool] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -413,7 +413,7 @@ public func _bjs_testBoolArrayDefault() -> Void { public func _bjs_testEmptyArrayDefault() -> Void { #if arch(wasm32) let ret = testEmptyArrayDefault(items: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -435,7 +435,7 @@ public func _bjs_testEmptyArrayDefault() -> Void { public func _bjs_testMixedWithArrayDefault(_ nameBytes: Int32, _ nameLength: Int32, _ enabled: Int32) -> Void { #if arch(wasm32) let ret = testMixedWithArrayDefault(name: String.bridgeJSLiftParameter(nameBytes, nameLength), values: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index cccbbf524..b22bc404b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -423,7 +423,7 @@ extension Priority: _BridgedSwiftEnumNoPayload { public func _bjs_processDelegates() -> Void { #if arch(wasm32) let ret = processDelegates(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [AnyMyViewControllerDelegate] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -654,7 +654,7 @@ fileprivate func _bjs_MyViewController_wrap(_ pointer: UnsafeMutableRawPointer) public func _bjs_DelegateManager_init() -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = DelegateManager(delegates: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [AnyMyViewControllerDelegate] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -697,7 +697,7 @@ public func _bjs_DelegateManager_delegates_get(_ _self: UnsafeMutableRawPointer) public func _bjs_DelegateManager_delegates_set(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) DelegateManager.bridgeJSLiftParameter(_self).delegates = { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [AnyMyViewControllerDelegate] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 3f4914ca0..4737a2d50 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -489,15 +489,6 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo } #endif -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_pop_array_length") -@_spi(BridgeJS) public func _swift_js_pop_array_length() -> Int32 -#else -@_spi(BridgeJS) public func _swift_js_pop_array_length() -> Int32 { - _onlyAvailableOnWasm() -} -#endif - // MARK: Struct bridging helpers (JS-side lowering/raising) #if arch(wasm32) diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 0cc31abc4..1476436ae 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -4567,7 +4567,7 @@ public func _bjs_testEmptyInit(_ object: UnsafeMutableRawPointer) -> UnsafeMutab public func _bjs_arrayWithDefault() -> Int32 { #if arch(wasm32) let ret = arrayWithDefault(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4591,7 +4591,7 @@ public func _bjs_arrayWithOptionalDefault(_ values: Int32) -> Int32 { return Optional<[Int]>.none } else { return { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4613,7 +4613,7 @@ public func _bjs_arrayWithOptionalDefault(_ values: Int32) -> Int32 { public func _bjs_arrayMixedDefaults(_ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { #if arch(wasm32) let ret = arrayMixedDefaults(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength), values: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4666,7 +4666,7 @@ public func _bjs_makeAdder(_ base: Int32) -> UnsafeMutableRawPointer { public func _bjs_roundTripIntArray() -> Void { #if arch(wasm32) let ret = roundTripIntArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4688,7 +4688,7 @@ public func _bjs_roundTripIntArray() -> Void { public func _bjs_roundTripStringArray() -> Void { #if arch(wasm32) let ret = roundTripStringArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4713,7 +4713,7 @@ public func _bjs_roundTripStringArray() -> Void { public func _bjs_roundTripDoubleArray() -> Void { #if arch(wasm32) let ret = roundTripDoubleArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Double] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4735,7 +4735,7 @@ public func _bjs_roundTripDoubleArray() -> Void { public func _bjs_roundTripBoolArray() -> Void { #if arch(wasm32) let ret = roundTripBoolArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Bool] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4757,7 +4757,7 @@ public func _bjs_roundTripBoolArray() -> Void { public func _bjs_roundTripDirectionArray() -> Void { #if arch(wasm32) let ret = roundTripDirectionArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Direction] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4779,7 +4779,7 @@ public func _bjs_roundTripDirectionArray() -> Void { public func _bjs_roundTripStatusArray() -> Void { #if arch(wasm32) let ret = roundTripStatusArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Status] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4801,7 +4801,7 @@ public func _bjs_roundTripStatusArray() -> Void { public func _bjs_roundTripThemeArray() -> Void { #if arch(wasm32) let ret = roundTripThemeArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Theme] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4826,7 +4826,7 @@ public func _bjs_roundTripThemeArray() -> Void { public func _bjs_roundTripHttpStatusArray() -> Void { #if arch(wasm32) let ret = roundTripHttpStatusArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [HttpStatus] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4848,7 +4848,7 @@ public func _bjs_roundTripHttpStatusArray() -> Void { public func _bjs_roundTripDataPointArray() -> Void { #if arch(wasm32) let ret = roundTripDataPointArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [DataPoint] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4870,7 +4870,7 @@ public func _bjs_roundTripDataPointArray() -> Void { public func _bjs_roundTripGreeterArray() -> Void { #if arch(wasm32) let ret = roundTripGreeterArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Greeter] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4892,7 +4892,7 @@ public func _bjs_roundTripGreeterArray() -> Void { public func _bjs_roundTripOptionalIntArray() -> Void { #if arch(wasm32) let ret = roundTripOptionalIntArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4917,7 +4917,7 @@ public func _bjs_roundTripOptionalIntArray() -> Void { public func _bjs_roundTripOptionalStringArray() -> Void { #if arch(wasm32) let ret = roundTripOptionalStringArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4945,7 +4945,7 @@ public func _bjs_roundTripOptionalStringArray() -> Void { public func _bjs_roundTripOptionalDataPointArray() -> Void { #if arch(wasm32) let ret = roundTripOptionalDataPointArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4970,7 +4970,7 @@ public func _bjs_roundTripOptionalDataPointArray() -> Void { public func _bjs_roundTripOptionalDirectionArray() -> Void { #if arch(wasm32) let ret = roundTripOptionalDirectionArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -4995,7 +4995,7 @@ public func _bjs_roundTripOptionalDirectionArray() -> Void { public func _bjs_roundTripOptionalStatusArray() -> Void { #if arch(wasm32) let ret = roundTripOptionalStatusArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5024,7 +5024,7 @@ public func _bjs_roundTripOptionalIntArrayType(_ values: Int32) -> Void { return Optional<[Int]>.none } else { return { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5055,7 +5055,7 @@ public func _bjs_roundTripOptionalStringArrayType(_ values: Int32) -> Void { return Optional<[String]>.none } else { return { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5089,7 +5089,7 @@ public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { return Optional<[Greeter]>.none } else { return { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Greeter] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5116,12 +5116,12 @@ public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { public func _bjs_roundTripNestedIntArray() -> Void { #if arch(wasm32) let ret = roundTripNestedIntArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[Int]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Int] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5149,12 +5149,12 @@ public func _bjs_roundTripNestedIntArray() -> Void { public func _bjs_roundTripNestedStringArray() -> Void { #if arch(wasm32) let ret = roundTripNestedStringArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[String]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [String] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5185,12 +5185,12 @@ public func _bjs_roundTripNestedStringArray() -> Void { public func _bjs_roundTripNestedDoubleArray() -> Void { #if arch(wasm32) let ret = roundTripNestedDoubleArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[Double]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Double] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5218,12 +5218,12 @@ public func _bjs_roundTripNestedDoubleArray() -> Void { public func _bjs_roundTripNestedBoolArray() -> Void { #if arch(wasm32) let ret = roundTripNestedBoolArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[Bool]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Bool] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5251,12 +5251,12 @@ public func _bjs_roundTripNestedBoolArray() -> Void { public func _bjs_roundTripNestedDataPointArray() -> Void { #if arch(wasm32) let ret = roundTripNestedDataPointArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[DataPoint]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [DataPoint] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5284,12 +5284,12 @@ public func _bjs_roundTripNestedDataPointArray() -> Void { public func _bjs_roundTripNestedDirectionArray() -> Void { #if arch(wasm32) let ret = roundTripNestedDirectionArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[Direction]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Direction] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5317,12 +5317,12 @@ public func _bjs_roundTripNestedDirectionArray() -> Void { public func _bjs_roundTripNestedGreeterArray() -> Void { #if arch(wasm32) let ret = roundTripNestedGreeterArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [[Greeter]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { __result.append({ - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [Greeter] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5350,7 +5350,7 @@ public func _bjs_roundTripNestedGreeterArray() -> Void { public func _bjs_roundTripUnsafeRawPointerArray() -> Void { #if arch(wasm32) let ret = roundTripUnsafeRawPointerArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [UnsafeRawPointer] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5372,7 +5372,7 @@ public func _bjs_roundTripUnsafeRawPointerArray() -> Void { public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { #if arch(wasm32) let ret = roundTripUnsafeMutableRawPointerArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [UnsafeMutableRawPointer] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5394,7 +5394,7 @@ public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { public func _bjs_roundTripOpaquePointerArray() -> Void { #if arch(wasm32) let ret = roundTripOpaquePointerArray(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [OpaquePointer] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5416,7 +5416,7 @@ public func _bjs_roundTripOpaquePointerArray() -> Void { public func _bjs_consumeDataProcessorArrayType() -> Int32 { #if arch(wasm32) let ret = consumeDataProcessorArrayType(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [AnyDataProcessor] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { @@ -5436,7 +5436,7 @@ public func _bjs_consumeDataProcessorArrayType() -> Int32 { public func _bjs_roundTripDataProcessorArrayType() -> Void { #if arch(wasm32) let ret = roundTripDataProcessorArrayType(_: { - let __count = Int(_swift_js_pop_array_length()) + let __count = Int(_swift_js_pop_i32()) var __result: [AnyDataProcessor] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { From 8c82550721aafc8d05dd09f3fe6552bfb74fc8fd Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 2 Feb 2026 19:26:52 +0900 Subject: [PATCH 120/252] BridgeJS: Remove `swift_js_push_array_length` --- Benchmarks/Sources/Generated/BridgeJS.swift | 50 ++++++------- .../Sources/BridgeJSCore/ExportSwift.swift | 2 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 6 -- .../Sources/BridgeJSLink/JSGlueGen.swift | 4 +- .../ArrayParameter.Import.js | 4 -- .../BridgeJSLinkTests/ArrayTypes.Export.js | 54 +++++++------- .../BridgeJSLinkTests/Async.Export.js | 4 -- .../BridgeJSLinkTests/Async.Import.js | 4 -- .../DefaultParameters.Export.js | 14 ++-- .../EnumAssociatedValue.Export.js | 4 -- .../BridgeJSLinkTests/EnumCase.Export.js | 4 -- .../BridgeJSLinkTests/EnumNamespace.Export.js | 4 -- .../EnumNamespace.Global.Export.js | 4 -- .../BridgeJSLinkTests/EnumRawType.Export.js | 4 -- .../GlobalGetter.ImportMacros.js | 4 -- .../GlobalThisImports.ImportMacros.js | 4 -- .../ImportedTypeInExportedInterface.Export.js | 4 -- .../BridgeJSLinkTests/Interface.Import.js | 4 -- .../InvalidPropertyNames.Import.js | 4 -- .../BridgeJSLinkTests/MixedGlobal.Export.js | 4 -- .../BridgeJSLinkTests/MixedModules.Export.js | 4 -- .../BridgeJSLinkTests/MixedPrivate.Export.js | 4 -- .../MultipleImportedTypes.Import.js | 4 -- .../BridgeJSLinkTests/Namespaces.Export.js | 4 -- .../Namespaces.Global.Export.js | 4 -- .../BridgeJSLinkTests/Optionals.Export.js | 4 -- .../PrimitiveParameters.Export.js | 4 -- .../PrimitiveParameters.Import.js | 4 -- .../PrimitiveReturn.Export.js | 4 -- .../PrimitiveReturn.Import.js | 4 -- .../BridgeJSLinkTests/PropertyTypes.Export.js | 4 -- .../BridgeJSLinkTests/Protocol.Export.js | 8 +-- .../BridgeJSLinkTests/ReExportFrom.Import.js | 4 -- .../StaticFunctions.Export.js | 4 -- .../StaticFunctions.Global.Export.js | 4 -- .../StaticProperties.Export.js | 4 -- .../StaticProperties.Global.Export.js | 4 -- .../BridgeJSLinkTests/StringEnum.Import.js | 4 -- .../StringParameter.Export.js | 4 -- .../StringParameter.Import.js | 4 -- .../BridgeJSLinkTests/StringReturn.Export.js | 4 -- .../BridgeJSLinkTests/StringReturn.Import.js | 4 -- .../BridgeJSLinkTests/SwiftClass.Export.js | 4 -- .../BridgeJSLinkTests/SwiftClosure.Export.js | 4 -- .../SwiftClosureImports.ImportMacros.js | 4 -- .../BridgeJSLinkTests/SwiftStruct.Export.js | 4 -- .../SwiftStructImports.ImportMacros.js | 4 -- .../TS2SkeletonLike.Import.js | 4 -- .../BridgeJSLinkTests/Throws.Export.js | 4 -- .../BridgeJSLinkTests/TypeAlias.Import.js | 4 -- .../TypeScriptClass.Import.js | 4 -- .../BridgeJSLinkTests/UnsafePointer.Export.js | 4 -- .../VoidParameterVoidReturn.Export.js | 4 -- .../VoidParameterVoidReturn.Import.js | 4 -- .../ExportSwiftTests/ArrayTypes.swift | 50 ++++++------- .../ExportSwiftTests/DefaultParameters.swift | 10 +-- .../ExportSwiftTests/Protocol.swift | 4 +- .../JavaScriptKit/BridgeJSIntrinsics.swift | 11 --- .../Generated/BridgeJS.swift | 72 +++++++++---------- 59 files changed, 127 insertions(+), 346 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index a582a1bed..5572db46e 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -1509,7 +1509,7 @@ public func _bjs_ArrayRoundtrip_makeIntArray(_ _self: UnsafeMutableRawPointer) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeIntArray() for __bjs_elem_ret in ret { _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1531,7 +1531,7 @@ public func _bjs_ArrayRoundtrip_roundtripIntArray(_ _self: UnsafeMutableRawPoint }()) for __bjs_elem_ret in ret { _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1544,7 +1544,7 @@ public func _bjs_ArrayRoundtrip_makeIntArrayLarge(_ _self: UnsafeMutableRawPoint let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeIntArrayLarge() for __bjs_elem_ret in ret { _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1576,7 +1576,7 @@ public func _bjs_ArrayRoundtrip_makeDoubleArray(_ _self: UnsafeMutableRawPointer let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeDoubleArray() for __bjs_elem_ret in ret { _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1598,7 +1598,7 @@ public func _bjs_ArrayRoundtrip_roundtripDoubleArray(_ _self: UnsafeMutableRawPo }()) for __bjs_elem_ret in ret { _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1633,7 +1633,7 @@ public func _bjs_ArrayRoundtrip_makeStringArray(_ _self: UnsafeMutableRawPointer __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1658,7 +1658,7 @@ public func _bjs_ArrayRoundtrip_roundtripStringArray(_ _self: UnsafeMutableRawPo __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1690,7 +1690,7 @@ public func _bjs_ArrayRoundtrip_makePointArray(_ _self: UnsafeMutableRawPointer) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makePointArray() for __bjs_elem_ret in ret { __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1712,7 +1712,7 @@ public func _bjs_ArrayRoundtrip_roundtripPointArray(_ _self: UnsafeMutableRawPoi }()) for __bjs_elem_ret in ret { __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1725,7 +1725,7 @@ public func _bjs_ArrayRoundtrip_makePointArrayLarge(_ _self: UnsafeMutableRawPoi let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makePointArrayLarge() for __bjs_elem_ret in ret { __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1767,8 +1767,8 @@ public func _bjs_ArrayRoundtrip_makeNestedIntArray(_ _self: UnsafeMutableRawPoin for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { _swift_js_push_int(Int32(__bjs_elem_ret_elem))} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1800,8 +1800,8 @@ public func _bjs_ArrayRoundtrip_roundtripNestedIntArray(_ _self: UnsafeMutableRa for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { _swift_js_push_int(Int32(__bjs_elem_ret_elem))} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1843,8 +1843,8 @@ public func _bjs_ArrayRoundtrip_makeNestedPointArray(_ _self: UnsafeMutableRawPo for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { __bjs_elem_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1876,8 +1876,8 @@ public func _bjs_ArrayRoundtrip_roundtripNestedPointArray(_ _self: UnsafeMutable for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { __bjs_elem_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1912,7 +1912,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalIntArray(_ _self: UnsafeMutableRawPo if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { _swift_js_push_int(Int32(__bjs_unwrapped_ret_elem))} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1937,7 +1937,7 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalIntArray(_ _self: UnsafeMutable if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { _swift_js_push_int(Int32(__bjs_unwrapped_ret_elem))} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1972,7 +1972,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalPointArray(_ _self: UnsafeMutableRaw if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1997,7 +1997,7 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalPointArray(_ _self: UnsafeMutab if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -2037,7 +2037,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalArraySome(_ _self: UnsafeMutableRawP if let __bjs_unwrapped_ret = ret { for __bjs_elem_ret in __bjs_unwrapped_ret { _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -2053,7 +2053,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalArrayNone(_ _self: UnsafeMutableRawP if let __bjs_unwrapped_ret = ret { for __bjs_elem_ret in __bjs_unwrapped_ret { _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -2084,7 +2084,7 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalArray(_ _self: UnsafeMutableRaw if let __bjs_unwrapped_ret = ret { for __bjs_elem_ret in __bjs_unwrapped_ret { _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 62c0475ea..567b16ee0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1014,7 +1014,7 @@ struct StackCodegen { } statements.append("}") - statements.append("_swift_js_push_array_length(Int32(\(raw: accessor).count))") + statements.append("_swift_js_push_int(Int32(\(raw: accessor).count))") return statements } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 8c2cbe474..be120d4c8 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -256,7 +256,6 @@ public struct BridgeJSLink { "let \(JSGlueVariableScope.reservedTmpRetPointers) = [];", "let \(JSGlueVariableScope.reservedTmpParamPointers) = [];", "let \(JSGlueVariableScope.reservedTmpStructCleanups) = [];", - "let \(JSGlueVariableScope.reservedTmpRetArrayLengths) = [];", "const \(JSGlueVariableScope.reservedEnumHelpers) = {};", "const \(JSGlueVariableScope.reservedStructHelpers) = {};", "", @@ -440,11 +439,6 @@ public struct BridgeJSLink { printer.write("return \(JSGlueVariableScope.reservedTmpParamPointers).pop();") } printer.write("}") - printer.write("bjs[\"swift_js_push_array_length\"] = function(len) {") - printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpRetArrayLengths).push(len | 0);") - } - printer.write("}") printer.write("bjs[\"swift_js_struct_cleanup\"] = function(cleanupId) {") printer.indent { printer.write("if (cleanupId === 0) { return; }") diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 5ff651282..28f756a43 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -31,7 +31,6 @@ final class JSGlueVariableScope { static let reservedTmpRetPointers = "tmpRetPointers" static let reservedTmpParamPointers = "tmpParamPointers" static let reservedTmpStructCleanups = "tmpStructCleanups" - static let reservedTmpRetArrayLengths = "tmpRetArrayLengths" static let reservedEnumHelpers = "enumHelpers" static let reservedStructHelpers = "structHelpers" @@ -61,7 +60,6 @@ final class JSGlueVariableScope { reservedTmpRetPointers, reservedTmpParamPointers, reservedTmpStructCleanups, - reservedTmpRetArrayLengths, reservedEnumHelpers, reservedStructHelpers, ] @@ -2186,7 +2184,7 @@ struct IntrinsicJSFragment: Sendable { let lenVar = scope.variable("arrayLen") let iVar = scope.variable("i") - printer.write("const \(lenVar) = \(JSGlueVariableScope.reservedTmpRetArrayLengths).pop();") + printer.write("const \(lenVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") printer.write("const \(resultVar) = [];") printer.write("for (let \(iVar) = 0; \(iVar) < \(lenVar); \(iVar)++) {") printer.indent { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js index be84c1438..cb77759da 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js index 89c574bb3..5abce72bb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js @@ -42,7 +42,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -129,9 +128,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; @@ -300,7 +296,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(values.length); instance.exports.bjs_processIntArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const int = tmpRetInts.pop(); @@ -323,7 +319,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(values.length); instance.exports.bjs_processStringArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const string = tmpRetStrings.pop(); @@ -340,7 +336,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(values.length); instance.exports.bjs_processDoubleArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const f64 = tmpRetF64s.pop(); @@ -357,7 +353,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(values.length); instance.exports.bjs_processBoolArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const bool = tmpRetInts.pop() !== 0; @@ -377,7 +373,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(points.length); instance.exports.bjs_processPointArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const struct = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); @@ -394,7 +390,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(directions.length); instance.exports.bjs_processDirectionArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const caseId = tmpRetInts.pop(); @@ -411,7 +407,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(statuses.length); instance.exports.bjs_processStatusArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const rawValue = tmpRetInts.pop(); @@ -455,7 +451,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(values.length); instance.exports.bjs_processUnsafeRawPointerArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const pointer = tmpRetPointers.pop(); @@ -472,7 +468,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(values.length); instance.exports.bjs_processUnsafeMutableRawPointerArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const pointer = tmpRetPointers.pop(); @@ -489,7 +485,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(values.length); instance.exports.bjs_processOpaquePointerArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const pointer = tmpRetPointers.pop(); @@ -512,7 +508,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(values.length); instance.exports.bjs_processOptionalIntArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const isSome1 = tmpRetInts.pop(); @@ -547,7 +543,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(values.length); instance.exports.bjs_processOptionalStringArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const isSome1 = tmpRetInts.pop(); @@ -579,7 +575,7 @@ export async function createInstantiator(options, swift) { const isSome1 = tmpRetInts.pop(); let optResult; if (isSome1) { - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const int = tmpRetInts.pop(); @@ -606,7 +602,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(points.length); instance.exports.bjs_processOptionalPointArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const isSome1 = tmpRetInts.pop(); @@ -636,7 +632,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(directions.length); instance.exports.bjs_processOptionalDirectionArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const isSome1 = tmpRetInts.pop(); @@ -666,7 +662,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(statuses.length); instance.exports.bjs_processOptionalStatusArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const isSome1 = tmpRetInts.pop(); @@ -697,10 +693,10 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(values.length); instance.exports.bjs_processNestedIntArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const arrayLen1 = tmpRetArrayLengths.pop(); + const arrayLen1 = tmpRetInts.pop(); const arrayResult1 = []; for (let i1 = 0; i1 < arrayLen1; i1++) { const int = tmpRetInts.pop(); @@ -733,10 +729,10 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(values.length); instance.exports.bjs_processNestedStringArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const arrayLen1 = tmpRetArrayLengths.pop(); + const arrayLen1 = tmpRetInts.pop(); const arrayResult1 = []; for (let i1 = 0; i1 < arrayLen1; i1++) { const string = tmpRetStrings.pop(); @@ -766,10 +762,10 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(points.length); instance.exports.bjs_processNestedPointArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const arrayLen1 = tmpRetArrayLengths.pop(); + const arrayLen1 = tmpRetInts.pop(); const arrayResult1 = []; for (let i1 = 0; i1 < arrayLen1; i1++) { const struct = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); @@ -789,7 +785,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(items.length); instance.exports.bjs_processItemArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const ptr = tmpRetPointers.pop(); @@ -814,10 +810,10 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(items.length); instance.exports.bjs_processNestedItemArray(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const arrayLen1 = tmpRetArrayLengths.pop(); + const arrayLen1 = tmpRetInts.pop(); const arrayResult1 = []; for (let i1 = 0; i1 < arrayLen1; i1++) { const ptr = tmpRetPointers.pop(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js index a83274e1a..afdd6e578 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js index ff3551e31..50b71fef0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index 6b9785933..dfbf187f8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -35,7 +35,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -155,9 +154,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; @@ -564,7 +560,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(values.length); instance.exports.bjs_testIntArrayDefault(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const int = tmpRetInts.pop(); @@ -587,7 +583,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(names.length); instance.exports.bjs_testStringArrayDefault(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const string = tmpRetStrings.pop(); @@ -604,7 +600,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(values.length); instance.exports.bjs_testDoubleArrayDefault(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const f64 = tmpRetF64s.pop(); @@ -621,7 +617,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(flags.length); instance.exports.bjs_testBoolArrayDefault(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const bool = tmpRetInts.pop() !== 0; @@ -638,7 +634,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(items.length); instance.exports.bjs_testEmptyArrayDefault(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const int = tmpRetInts.pop(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index d1bf82d39..ff6813db9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -504,7 +504,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -577,9 +576,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js index 5b5a631cd..1858b6aed 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js @@ -53,7 +53,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -126,9 +125,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index 936080db8..457b71af3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -54,7 +54,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -127,9 +126,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js index 9e4b57dbe..6c3e7b2cd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js @@ -73,7 +73,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -146,9 +145,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js index 1ef43bd79..9189b3e5a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js @@ -104,7 +104,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -177,9 +176,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js index ac53d326f..1b48c018b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js index 724df077e..98b94270c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js index 231873ab0..6f835d8e8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js index b1dd75c44..48959038e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index 50de3378c..1908f78c0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js index d11b74338..bbd8acf95 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js index f39b6209b..7328c7978 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js index a78095948..df5a2824d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index d6adac3c0..be1baccad 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index 5342ac94e..b843caf53 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js index e262b76fc..c13941e40 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js index df4337f5f..159667388 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js index ccde5f78f..e14c49547 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js index 4d7787868..3bf604348 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js index 35069b2e4..04be2979b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js index c07676bc4..a24360f8e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js index 7e5e3c1ca..917a0e17b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index 6d51db5e6..b25433743 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -93,7 +93,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -166,9 +165,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; @@ -709,7 +705,7 @@ export async function createInstantiator(options, swift) { } get delegates() { instance.exports.bjs_DelegateManager_delegates_get(this.pointer); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const objId = tmpRetInts.pop(); @@ -743,7 +739,7 @@ export async function createInstantiator(options, swift) { } tmpParamInts.push(delegates.length); instance.exports.bjs_processDelegates(); - const arrayLen = tmpRetArrayLengths.pop(); + const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const objId1 = tmpRetInts.pop(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js index 3a3cc4fd6..7ece6c8f4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index cdf2e4d80..85aa83fe4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -80,7 +80,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -153,9 +152,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js index 51833fee1..3ba252268 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js @@ -80,7 +80,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -153,9 +152,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js index 91ced0c67..7cba70388 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js @@ -34,7 +34,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js index c374d9a6f..4e621547a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js @@ -34,7 +34,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -107,9 +106,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js index a836bf2b5..5feacfdac 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js index 9a9c9cdc2..c3ed2fbbd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js index 9ebd38074..de72a94c0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js index cfe649726..05a0206ea 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js index 75c9a1d47..2a60e1aba 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js index e7f76436c..8af3295cf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js index 9d18cd143..ee89aa98d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js @@ -131,7 +131,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -204,9 +203,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js index a51be1c96..7ff9cc0b5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js index 745998d8e..36b0d1685 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js @@ -34,7 +34,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -296,9 +295,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js index 916be5c96..7102f173e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -117,9 +116,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js index d87b8b6cb..97cf902e7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js index 8c039e374..202a39045 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js index 94012ee5d..b6cab607b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index 01646bc60..97204e7d7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js index 1b7fd5ceb..737fd1867 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -122,9 +121,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js index bc542c373..b50901edd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -102,9 +101,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js index 7f99e811e..bcda74570 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetPointers = []; let tmpParamPointers = []; let tmpStructCleanups = []; - let tmpRetArrayLengths = []; const enumHelpers = {}; const structHelpers = {}; @@ -103,9 +102,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return tmpParamPointers.pop(); } - bjs["swift_js_push_array_length"] = function(len) { - tmpRetArrayLengths.push(len | 0); - } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } const index = (cleanupId | 0) - 1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift index 7c0d12892..19971fc0b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift @@ -105,7 +105,7 @@ public func _bjs_processIntArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -130,7 +130,7 @@ public func _bjs_processStringArray() -> Void { __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -152,7 +152,7 @@ public func _bjs_processDoubleArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -174,7 +174,7 @@ public func _bjs_processBoolArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int(__bjs_elem_ret ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -196,7 +196,7 @@ public func _bjs_processPointArray() -> Void { }()) for __bjs_elem_ret in ret { __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -218,7 +218,7 @@ public func _bjs_processDirectionArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -240,7 +240,7 @@ public func _bjs_processStatusArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -302,7 +302,7 @@ public func _bjs_processUnsafeRawPointerArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -324,7 +324,7 @@ public func _bjs_processUnsafeMutableRawPointerArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -346,7 +346,7 @@ public func _bjs_processOpaquePointerArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -371,7 +371,7 @@ public func _bjs_processOptionalIntArray() -> Void { if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { _swift_js_push_int(Int32(__bjs_unwrapped_ret_elem))} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -399,7 +399,7 @@ public func _bjs_processOptionalStringArray() -> Void { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -429,7 +429,7 @@ public func _bjs_processOptionalArray(_ values: Int32) -> Void { if let __bjs_unwrapped_ret = ret { for __bjs_elem_ret in __bjs_unwrapped_ret { _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -455,7 +455,7 @@ public func _bjs_processOptionalPointArray() -> Void { if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -480,7 +480,7 @@ public func _bjs_processOptionalDirectionArray() -> Void { if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { _swift_js_push_int(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -505,7 +505,7 @@ public func _bjs_processOptionalStatusArray() -> Void { if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { _swift_js_push_int(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -537,8 +537,8 @@ public func _bjs_processNestedIntArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { _swift_js_push_int(Int32(__bjs_elem_ret_elem))} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -573,8 +573,8 @@ public func _bjs_processNestedStringArray() -> Void { __bjs_ret_elem_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -606,8 +606,8 @@ public func _bjs_processNestedPointArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { __bjs_elem_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -629,7 +629,7 @@ public func _bjs_processItemArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -661,8 +661,8 @@ public func _bjs_processNestedItemArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { _swift_js_push_pointer(__bjs_elem_ret_elem.bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index b60a3c782..6827af228 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -333,7 +333,7 @@ public func _bjs_testIntArrayDefault() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -358,7 +358,7 @@ public func _bjs_testStringArrayDefault() -> Void { __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -380,7 +380,7 @@ public func _bjs_testDoubleArrayDefault() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -402,7 +402,7 @@ public func _bjs_testBoolArrayDefault() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int(__bjs_elem_ret ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -424,7 +424,7 @@ public func _bjs_testEmptyArrayDefault() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index b22bc404b..02a202268 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -434,7 +434,7 @@ public func _bjs_processDelegates() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int((__bjs_elem_ret as! AnyMyViewControllerDelegate).bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -686,7 +686,7 @@ public func _bjs_DelegateManager_delegates_get(_ _self: UnsafeMutableRawPointer) let ret = DelegateManager.bridgeJSLiftParameter(_self).delegates for __bjs_elem_ret in ret { _swift_js_push_int((__bjs_elem_ret as! AnyMyViewControllerDelegate).bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 4737a2d50..0bf62648c 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -478,17 +478,6 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo } #endif -// MARK: Array length operations - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_push_array_length") -@_spi(BridgeJS) public func _swift_js_push_array_length(_ length: Int32) -#else -@_spi(BridgeJS) public func _swift_js_push_array_length(_ length: Int32) { - _onlyAvailableOnWasm() -} -#endif - // MARK: Struct bridging helpers (JS-side lowering/raising) #if arch(wasm32) diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 1476436ae..e9b2aa903 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -4677,7 +4677,7 @@ public func _bjs_roundTripIntArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4702,7 +4702,7 @@ public func _bjs_roundTripStringArray() -> Void { __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4724,7 +4724,7 @@ public func _bjs_roundTripDoubleArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4746,7 +4746,7 @@ public func _bjs_roundTripBoolArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int(__bjs_elem_ret ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4768,7 +4768,7 @@ public func _bjs_roundTripDirectionArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4790,7 +4790,7 @@ public func _bjs_roundTripStatusArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4815,7 +4815,7 @@ public func _bjs_roundTripThemeArray() -> Void { __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4837,7 +4837,7 @@ public func _bjs_roundTripHttpStatusArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4859,7 +4859,7 @@ public func _bjs_roundTripDataPointArray() -> Void { }()) for __bjs_elem_ret in ret { __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4881,7 +4881,7 @@ public func _bjs_roundTripGreeterArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4906,7 +4906,7 @@ public func _bjs_roundTripOptionalIntArray() -> Void { if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { _swift_js_push_int(Int32(__bjs_unwrapped_ret_elem))} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4934,7 +4934,7 @@ public func _bjs_roundTripOptionalStringArray() -> Void { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4959,7 +4959,7 @@ public func _bjs_roundTripOptionalDataPointArray() -> Void { if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4984,7 +4984,7 @@ public func _bjs_roundTripOptionalDirectionArray() -> Void { if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { _swift_js_push_int(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5009,7 +5009,7 @@ public func _bjs_roundTripOptionalStatusArray() -> Void { if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { _swift_js_push_int(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5039,7 +5039,7 @@ public func _bjs_roundTripOptionalIntArrayType(_ values: Int32) -> Void { if let __bjs_unwrapped_ret = ret { for __bjs_elem_ret in __bjs_unwrapped_ret { _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -5073,7 +5073,7 @@ public func _bjs_roundTripOptionalStringArrayType(_ values: Int32) -> Void { __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -5104,7 +5104,7 @@ public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { if let __bjs_unwrapped_ret = ret { for __bjs_elem_ret in __bjs_unwrapped_ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -5137,8 +5137,8 @@ public func _bjs_roundTripNestedIntArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { _swift_js_push_int(Int32(__bjs_elem_ret_elem))} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5173,8 +5173,8 @@ public func _bjs_roundTripNestedStringArray() -> Void { __bjs_ret_elem_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5206,8 +5206,8 @@ public func _bjs_roundTripNestedDoubleArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { _swift_js_push_f64(__bjs_elem_ret_elem)} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5239,8 +5239,8 @@ public func _bjs_roundTripNestedBoolArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { _swift_js_push_int(__bjs_elem_ret_elem ? 1 : 0)} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5272,8 +5272,8 @@ public func _bjs_roundTripNestedDataPointArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { __bjs_elem_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5305,8 +5305,8 @@ public func _bjs_roundTripNestedDirectionArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { _swift_js_push_int(Int32(__bjs_elem_ret_elem.bridgeJSLowerParameter()))} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5338,8 +5338,8 @@ public func _bjs_roundTripNestedGreeterArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { _swift_js_push_pointer(__bjs_elem_ret_elem.bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(__bjs_elem_ret.count))} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(__bjs_elem_ret.count))} + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5361,7 +5361,7 @@ public func _bjs_roundTripUnsafeRawPointerArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5383,7 +5383,7 @@ public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5405,7 +5405,7 @@ public func _bjs_roundTripOpaquePointerArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5447,7 +5447,7 @@ public func _bjs_roundTripDataProcessorArrayType() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_int((__bjs_elem_ret as! AnyDataProcessor).bridgeJSLowerReturn())} - _swift_js_push_array_length(Int32(ret.count)) + _swift_js_push_int(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif From e604fa6707143373082aba77326ef4ca75ba0e28 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 2 Feb 2026 19:28:34 +0900 Subject: [PATCH 121/252] BridgeJS: Rename swift_js_push_int -> swift_js_push_i32 --- Benchmarks/Sources/Generated/BridgeJS.swift | 134 ++++----- .../Sources/BridgeJSCore/ExportSwift.swift | 28 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 2 +- .../ArrayParameter.Import.js | 2 +- .../BridgeJSLinkTests/ArrayTypes.Export.js | 2 +- .../BridgeJSLinkTests/Async.Export.js | 2 +- .../BridgeJSLinkTests/Async.Import.js | 2 +- .../DefaultParameters.Export.js | 2 +- .../EnumAssociatedValue.Export.js | 2 +- .../BridgeJSLinkTests/EnumCase.Export.js | 2 +- .../BridgeJSLinkTests/EnumNamespace.Export.js | 2 +- .../EnumNamespace.Global.Export.js | 2 +- .../BridgeJSLinkTests/EnumRawType.Export.js | 2 +- .../GlobalGetter.ImportMacros.js | 2 +- .../GlobalThisImports.ImportMacros.js | 2 +- .../ImportedTypeInExportedInterface.Export.js | 2 +- .../BridgeJSLinkTests/Interface.Import.js | 2 +- .../InvalidPropertyNames.Import.js | 2 +- .../BridgeJSLinkTests/MixedGlobal.Export.js | 2 +- .../BridgeJSLinkTests/MixedModules.Export.js | 2 +- .../BridgeJSLinkTests/MixedPrivate.Export.js | 2 +- .../MultipleImportedTypes.Import.js | 2 +- .../BridgeJSLinkTests/Namespaces.Export.js | 2 +- .../Namespaces.Global.Export.js | 2 +- .../BridgeJSLinkTests/Optionals.Export.js | 2 +- .../PrimitiveParameters.Export.js | 2 +- .../PrimitiveParameters.Import.js | 2 +- .../PrimitiveReturn.Export.js | 2 +- .../PrimitiveReturn.Import.js | 2 +- .../BridgeJSLinkTests/PropertyTypes.Export.js | 2 +- .../BridgeJSLinkTests/Protocol.Export.js | 2 +- .../BridgeJSLinkTests/ReExportFrom.Import.js | 2 +- .../StaticFunctions.Export.js | 2 +- .../StaticFunctions.Global.Export.js | 2 +- .../StaticProperties.Export.js | 2 +- .../StaticProperties.Global.Export.js | 2 +- .../BridgeJSLinkTests/StringEnum.Import.js | 2 +- .../StringParameter.Export.js | 2 +- .../StringParameter.Import.js | 2 +- .../BridgeJSLinkTests/StringReturn.Export.js | 2 +- .../BridgeJSLinkTests/StringReturn.Import.js | 2 +- .../BridgeJSLinkTests/SwiftClass.Export.js | 2 +- .../BridgeJSLinkTests/SwiftClosure.Export.js | 2 +- .../SwiftClosureImports.ImportMacros.js | 2 +- .../BridgeJSLinkTests/SwiftStruct.Export.js | 2 +- .../SwiftStructImports.ImportMacros.js | 2 +- .../TS2SkeletonLike.Import.js | 2 +- .../BridgeJSLinkTests/Throws.Export.js | 2 +- .../BridgeJSLinkTests/TypeAlias.Import.js | 2 +- .../TypeScriptClass.Import.js | 2 +- .../BridgeJSLinkTests/UnsafePointer.Export.js | 2 +- .../VoidParameterVoidReturn.Export.js | 2 +- .../VoidParameterVoidReturn.Import.js | 2 +- .../ExportSwiftTests/ArrayTypes.swift | 80 ++--- .../ExportSwiftTests/DefaultParameters.swift | 20 +- .../EnumAssociatedValue.swift | 92 +++--- .../ExportSwiftTests/Protocol.swift | 12 +- .../StaticFunctions.Global.swift | 4 +- .../ExportSwiftTests/StaticFunctions.swift | 4 +- .../ExportSwiftTests/SwiftClosure.swift | 8 +- .../ExportSwiftTests/SwiftStruct.swift | 20 +- Plugins/PackageToJS/Templates/instantiate.js | 2 +- .../JavaScriptKit/BridgeJSIntrinsics.swift | 10 +- .../Generated/BridgeJS.swift | 284 +++++++++--------- 64 files changed, 400 insertions(+), 400 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 5572db46e..86f4c87dc 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -38,10 +38,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } return Int32(0) case .failure(let param0): - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) return Int32(1) case .flag(let param0): - _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_i32(param0 ? 1 : 0) return Int32(2) case .rate(let param0): _swift_js_push_f32(param0) @@ -74,10 +74,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) case .flag(let param0): _swift_js_push_tag(Int32(2)) - _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_i32(param0 ? 1 : 0) case .rate(let param0): _swift_js_push_tag(Int32(3)) _swift_js_push_f32(param0) @@ -127,7 +127,7 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) return Int32(1) case .location(let param0, let param1, let param2): _swift_js_push_f64(param0) @@ -138,8 +138,8 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } return Int32(2) case .status(let param0, let param1, let param2): - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(Int32(param1)) var __bjs_param2 = param2 __bjs_param2.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) @@ -151,10 +151,10 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_f64(param2) return Int32(4) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(param1 ? 1 : 0) - _swift_js_push_int(Int32(param2)) - _swift_js_push_int(Int32(param3)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(param1 ? 1 : 0) + _swift_js_push_i32(Int32(param2)) + _swift_js_push_i32(Int32(param3)) _swift_js_push_f64(param4) _swift_js_push_f64(param5) var __bjs_param6 = param6 @@ -199,7 +199,7 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) case .location(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) _swift_js_push_f64(param0) @@ -210,8 +210,8 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(3)) - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(Int32(param1)) var __bjs_param2 = param2 __bjs_param2.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) @@ -223,10 +223,10 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_f64(param2) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): _swift_js_push_tag(Int32(5)) - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(param1 ? 1 : 0) - _swift_js_push_int(Int32(param2)) - _swift_js_push_int(Int32(param3)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(param1 ? 1 : 0) + _swift_js_push_i32(Int32(param2)) + _swift_js_push_i32(Int32(param3)) _swift_js_push_f64(param4) _swift_js_push_f64(param5) var __bjs_param6 = param6 @@ -262,8 +262,8 @@ extension SimpleStruct: _BridgedSwiftStruct { __bjs_name.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(self.count)) - _swift_js_push_int(self.flag ? 1 : 0) + _swift_js_push_i32(Int32(self.count)) + _swift_js_push_i32(self.flag ? 1 : 0) _swift_js_push_f32(self.rate) _swift_js_push_f64(self.precise) } @@ -318,7 +318,7 @@ extension Address: _BridgedSwiftStruct { __bjs_city.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(self.zipCode)) + _swift_js_push_i32(Int32(self.zipCode)) } init(unsafelyCopying jsObject: JSObject) { @@ -368,7 +368,7 @@ extension Person: _BridgedSwiftStruct { __bjs_name.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(self.age)) + _swift_js_push_i32(Int32(self.age)) self.address.bridgeJSLowerReturn() let __bjs_isSome_email = self.email != nil if let __bjs_unwrapped_email = self.email { @@ -377,7 +377,7 @@ extension Person: _BridgedSwiftStruct { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } - _swift_js_push_int(__bjs_isSome_email ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_email ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -425,12 +425,12 @@ extension ComplexStruct: _BridgedSwiftStruct { } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_int(Int32(self.id)) + _swift_js_push_i32(Int32(self.id)) var __bjs_title = self.title __bjs_title.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(self.active ? 1 : 0) + _swift_js_push_i32(self.active ? 1 : 0) _swift_js_push_f64(self.score) var __bjs_tags = self.tags __bjs_tags.withUTF8 { ptr in @@ -1508,8 +1508,8 @@ public func _bjs_ArrayRoundtrip_makeIntArray(_ _self: UnsafeMutableRawPointer) - #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeIntArray() for __bjs_elem_ret in ret { - _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1530,8 +1530,8 @@ public func _bjs_ArrayRoundtrip_roundtripIntArray(_ _self: UnsafeMutableRawPoint return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1543,8 +1543,8 @@ public func _bjs_ArrayRoundtrip_makeIntArrayLarge(_ _self: UnsafeMutableRawPoint #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeIntArrayLarge() for __bjs_elem_ret in ret { - _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1576,7 +1576,7 @@ public func _bjs_ArrayRoundtrip_makeDoubleArray(_ _self: UnsafeMutableRawPointer let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeDoubleArray() for __bjs_elem_ret in ret { _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1598,7 +1598,7 @@ public func _bjs_ArrayRoundtrip_roundtripDoubleArray(_ _self: UnsafeMutableRawPo }()) for __bjs_elem_ret in ret { _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1633,7 +1633,7 @@ public func _bjs_ArrayRoundtrip_makeStringArray(_ _self: UnsafeMutableRawPointer __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1658,7 +1658,7 @@ public func _bjs_ArrayRoundtrip_roundtripStringArray(_ _self: UnsafeMutableRawPo __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1690,7 +1690,7 @@ public func _bjs_ArrayRoundtrip_makePointArray(_ _self: UnsafeMutableRawPointer) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makePointArray() for __bjs_elem_ret in ret { __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1712,7 +1712,7 @@ public func _bjs_ArrayRoundtrip_roundtripPointArray(_ _self: UnsafeMutableRawPoi }()) for __bjs_elem_ret in ret { __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1725,7 +1725,7 @@ public func _bjs_ArrayRoundtrip_makePointArrayLarge(_ _self: UnsafeMutableRawPoi let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makePointArrayLarge() for __bjs_elem_ret in ret { __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1766,9 +1766,9 @@ public func _bjs_ArrayRoundtrip_makeNestedIntArray(_ _self: UnsafeMutableRawPoin let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeNestedIntArray() for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_int(Int32(__bjs_elem_ret_elem))} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret_elem))} + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1799,9 +1799,9 @@ public func _bjs_ArrayRoundtrip_roundtripNestedIntArray(_ _self: UnsafeMutableRa }()) for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_int(Int32(__bjs_elem_ret_elem))} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret_elem))} + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1843,8 +1843,8 @@ public func _bjs_ArrayRoundtrip_makeNestedPointArray(_ _self: UnsafeMutableRawPo for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { __bjs_elem_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1876,8 +1876,8 @@ public func _bjs_ArrayRoundtrip_roundtripNestedPointArray(_ _self: UnsafeMutable for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { __bjs_elem_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1910,9 +1910,9 @@ public func _bjs_ArrayRoundtrip_makeOptionalIntArray(_ _self: UnsafeMutableRawPo for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_int(Int32(__bjs_unwrapped_ret_elem))} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_unwrapped_ret_elem))} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1935,9 +1935,9 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalIntArray(_ _self: UnsafeMutable for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_int(Int32(__bjs_unwrapped_ret_elem))} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_unwrapped_ret_elem))} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1971,8 +1971,8 @@ public func _bjs_ArrayRoundtrip_makeOptionalPointArray(_ _self: UnsafeMutableRaw let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -1996,8 +1996,8 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalPointArray(_ _self: UnsafeMutab let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -2036,9 +2036,9 @@ public func _bjs_ArrayRoundtrip_makeOptionalArraySome(_ _self: UnsafeMutableRawP let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { for __bjs_elem_ret in __bjs_unwrapped_ret { - _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} - _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + _swift_js_push_i32(Int32(__bjs_elem_ret))} + _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") #endif @@ -2052,9 +2052,9 @@ public func _bjs_ArrayRoundtrip_makeOptionalArrayNone(_ _self: UnsafeMutableRawP let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { for __bjs_elem_ret in __bjs_unwrapped_ret { - _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} - _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + _swift_js_push_i32(Int32(__bjs_elem_ret))} + _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") #endif @@ -2083,9 +2083,9 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalArray(_ _self: UnsafeMutableRaw let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { for __bjs_elem_ret in __bjs_unwrapped_ret { - _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} - _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + _swift_js_push_i32(Int32(__bjs_elem_ret))} + _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 567b16ee0..d7d5c8200 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -946,24 +946,24 @@ struct StackCodegen { "__bjs_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", ] case .int, .uint: - return ["_swift_js_push_int(Int32(\(raw: accessor)))"] + return ["_swift_js_push_i32(Int32(\(raw: accessor)))"] case .bool: - return ["_swift_js_push_int(\(raw: accessor) ? 1 : 0)"] + return ["_swift_js_push_i32(\(raw: accessor) ? 1 : 0)"] case .float: return ["_swift_js_push_f32(\(raw: accessor))"] case .double: return ["_swift_js_push_f64(\(raw: accessor))"] case .jsObject: - return ["_swift_js_push_int(\(raw: accessor).bridgeJSLowerReturn())"] + return ["_swift_js_push_i32(\(raw: accessor).bridgeJSLowerReturn())"] case .swiftHeapObject: return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] case .unsafePointer: return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] case .swiftProtocol(let protocolName): let wrapperName = "Any\(protocolName)" - return ["_swift_js_push_int((\(raw: accessor) as! \(raw: wrapperName)).bridgeJSLowerReturn())"] + return ["_swift_js_push_i32((\(raw: accessor) as! \(raw: wrapperName)).bridgeJSLowerReturn())"] case .caseEnum: - return ["_swift_js_push_int(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] + return ["_swift_js_push_i32(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] case .rawValueEnum(_, let rawType): switch rawType { case .string: @@ -976,7 +976,7 @@ struct StackCodegen { case .double: return ["_swift_js_push_f64(\(raw: accessor).bridgeJSLowerParameter())"] default: - return ["_swift_js_push_int(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] + return ["_swift_js_push_i32(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] } case .associatedValueEnum: return ["\(raw: accessor).bridgeJSLowerReturn()"] @@ -1014,7 +1014,7 @@ struct StackCodegen { } statements.append("}") - statements.append("_swift_js_push_int(Int32(\(raw: accessor).count))") + statements.append("_swift_js_push_i32(Int32(\(raw: accessor).count))") return statements } @@ -1037,7 +1037,7 @@ struct StackCodegen { } statements.append("}") - statements.append("_swift_js_push_int(__bjs_isSome_\(raw: varPrefix) ? 1 : 0)") + statements.append("_swift_js_push_i32(__bjs_isSome_\(raw: varPrefix) ? 1 : 0)") return statements } @@ -1053,15 +1053,15 @@ struct StackCodegen { "__bjs_str_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", ] case .int, .uint: - return ["_swift_js_push_int(Int32(\(raw: unwrappedVar)))"] + return ["_swift_js_push_i32(Int32(\(raw: unwrappedVar)))"] case .bool: - return ["_swift_js_push_int(\(raw: unwrappedVar) ? 1 : 0)"] + return ["_swift_js_push_i32(\(raw: unwrappedVar) ? 1 : 0)"] case .float: return ["_swift_js_push_f32(\(raw: unwrappedVar))"] case .double: return ["_swift_js_push_f64(\(raw: unwrappedVar))"] case .caseEnum: - return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] + return ["_swift_js_push_i32(\(raw: unwrappedVar).bridgeJSLowerParameter())"] case .rawValueEnum(_, let rawType): switch rawType { case .string: @@ -1074,16 +1074,16 @@ struct StackCodegen { case .double: return ["_swift_js_push_f64(\(raw: unwrappedVar).bridgeJSLowerParameter())"] default: - return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] + return ["_swift_js_push_i32(\(raw: unwrappedVar).bridgeJSLowerParameter())"] } case .swiftStruct: return ["\(raw: unwrappedVar).bridgeJSLowerReturn()"] case .swiftHeapObject: return ["_swift_js_push_pointer(\(raw: unwrappedVar).bridgeJSLowerReturn())"] case .associatedValueEnum: - return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerParameter())"] + return ["_swift_js_push_i32(\(raw: unwrappedVar).bridgeJSLowerParameter())"] case .jsObject: - return ["_swift_js_push_int(\(raw: unwrappedVar).bridgeJSLowerReturn())"] + return ["_swift_js_push_i32(\(raw: unwrappedVar).bridgeJSLowerReturn())"] case .array(let elementType): return lowerArrayStatements(elementType: elementType, accessor: unwrappedVar, varPrefix: varPrefix) default: diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index be120d4c8..60b55cd47 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -390,7 +390,7 @@ public struct BridgeJSLink { printer.write("\(JSGlueVariableScope.reservedTmpRetTag) = tag;") } printer.write("}") - printer.write("bjs[\"swift_js_push_int\"] = function(v) {") + printer.write("bjs[\"swift_js_push_i32\"] = function(v) {") printer.indent { printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(v | 0);") } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js index cb77759da..8add18b9f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js index 5abce72bb..7388f4150 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js @@ -99,7 +99,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js index afdd6e578..4015b6261 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js index 50b71fef0..981cecbe5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js index dfbf187f8..978272568 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js @@ -125,7 +125,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js index ff6813db9..2d8dbc0ca 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js @@ -547,7 +547,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js index 1858b6aed..89a0f0897 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js @@ -96,7 +96,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index 457b71af3..b01148873 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -97,7 +97,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js index 6c3e7b2cd..77c327e8d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js @@ -116,7 +116,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js index 9189b3e5a..c1865adfc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js @@ -147,7 +147,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js index 1b48c018b..b3b809476 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js index 98b94270c..35a3d76ec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js index 6f835d8e8..094c2241d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js index 48959038e..1d25a2954 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index 1908f78c0..833436226 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js index bbd8acf95..f079de1da 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js index 7328c7978..2c43b91e8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js index df5a2824d..4b8ce8a66 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index be1baccad..f8cfd7366 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js index b843caf53..ae7bf7451 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js index c13941e40..671868eab 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js index 159667388..2c08e3d9f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js index e14c49547..0a92510f7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js index 3bf604348..fe6c3ae04 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js index 04be2979b..836a82f21 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js index a24360f8e..e3263af05 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js index 917a0e17b..fc13a471a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js index b25433743..24c02750f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js @@ -136,7 +136,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js index 7ece6c8f4..94e22ffc4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js index 85aa83fe4..8b5a54315 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js @@ -123,7 +123,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js index 3ba252268..e7bebfe6c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js @@ -123,7 +123,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js index 7cba70388..ee127ed07 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js @@ -77,7 +77,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js index 4e621547a..9806fc631 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js @@ -77,7 +77,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js index 5feacfdac..373b433b6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js index c3ed2fbbd..021adcba3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js index de72a94c0..718f776c7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js index 05a0206ea..479b313dd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js index 2a60e1aba..bb5278068 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js index 8af3295cf..d04cd6507 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js index ee89aa98d..40378d042 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js @@ -174,7 +174,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js index 7ff9cc0b5..9ab218df1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js index 36b0d1685..a3d60d0bd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js @@ -266,7 +266,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js index 7102f173e..f4e7e61e9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js @@ -87,7 +87,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js index 97cf902e7..45c273115 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js index 202a39045..5a492295a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js index b6cab607b..406d7f0f3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index 97204e7d7..d83919051 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js index 737fd1867..2ac28b7e9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js @@ -92,7 +92,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js index b50901edd..8a2fabca9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js @@ -72,7 +72,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js index bcda74570..2944bcf5a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js @@ -73,7 +73,7 @@ export async function createInstantiator(options, swift) { bjs["swift_js_push_tag"] = function(tag) { tmpRetTag = tag; } - bjs["swift_js_push_int"] = function(v) { + bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift index 19971fc0b..711694c9d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift @@ -104,8 +104,8 @@ public func _bjs_processIntArray() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -130,7 +130,7 @@ public func _bjs_processStringArray() -> Void { __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -152,7 +152,7 @@ public func _bjs_processDoubleArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -173,8 +173,8 @@ public func _bjs_processBoolArray() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int(__bjs_elem_ret ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_elem_ret ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -196,7 +196,7 @@ public func _bjs_processPointArray() -> Void { }()) for __bjs_elem_ret in ret { __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -217,8 +217,8 @@ public func _bjs_processDirectionArray() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -239,8 +239,8 @@ public func _bjs_processStatusArray() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -302,7 +302,7 @@ public func _bjs_processUnsafeRawPointerArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -324,7 +324,7 @@ public func _bjs_processUnsafeMutableRawPointerArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -346,7 +346,7 @@ public func _bjs_processOpaquePointerArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -369,9 +369,9 @@ public func _bjs_processOptionalIntArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_int(Int32(__bjs_unwrapped_ret_elem))} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_unwrapped_ret_elem))} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -398,8 +398,8 @@ public func _bjs_processOptionalStringArray() -> Void { __bjs_str_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -428,9 +428,9 @@ public func _bjs_processOptionalArray(_ values: Int32) -> Void { let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { for __bjs_elem_ret in __bjs_unwrapped_ret { - _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} - _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + _swift_js_push_i32(Int32(__bjs_elem_ret))} + _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") #endif @@ -454,8 +454,8 @@ public func _bjs_processOptionalPointArray() -> Void { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -478,9 +478,9 @@ public func _bjs_processOptionalDirectionArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_int(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -503,9 +503,9 @@ public func _bjs_processOptionalStatusArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_int(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -536,9 +536,9 @@ public func _bjs_processNestedIntArray() -> Void { }()) for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_int(Int32(__bjs_elem_ret_elem))} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret_elem))} + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -573,8 +573,8 @@ public func _bjs_processNestedStringArray() -> Void { __bjs_ret_elem_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -606,8 +606,8 @@ public func _bjs_processNestedPointArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { __bjs_elem_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -629,7 +629,7 @@ public func _bjs_processItemArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -661,8 +661,8 @@ public func _bjs_processNestedItemArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { _swift_js_push_pointer(__bjs_elem_ret_elem.bridgeJSLowerReturn())} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index 6827af228..5232bdd53 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -50,8 +50,8 @@ extension Config: _BridgedSwiftStruct { __bjs_name.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(self.value)) - _swift_js_push_int(self.enabled ? 1 : 0) + _swift_js_push_i32(Int32(self.value)) + _swift_js_push_i32(self.enabled ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -332,8 +332,8 @@ public func _bjs_testIntArrayDefault() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -358,7 +358,7 @@ public func _bjs_testStringArrayDefault() -> Void { __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -380,7 +380,7 @@ public func _bjs_testDoubleArrayDefault() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -401,8 +401,8 @@ public func _bjs_testBoolArrayDefault() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int(__bjs_elem_ret ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_elem_ret ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -423,8 +423,8 @@ public func _bjs_testEmptyArrayDefault() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift index fa9e791ee..e35da2f77 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift @@ -29,10 +29,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } return Int32(0) case .failure(let param0): - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) return Int32(1) case .flag(let param0): - _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_i32(param0 ? 1 : 0) return Int32(2) case .rate(let param0): _swift_js_push_f32(param0) @@ -65,10 +65,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) case .flag(let param0): _swift_js_push_tag(Int32(2)) - _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_i32(param0 ? 1 : 0) case .rate(let param0): _swift_js_push_tag(Int32(3)) _swift_js_push_f32(param0) @@ -116,11 +116,11 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) return Int32(1) case .status(let param0, let param1, let param2): - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(Int32(param1)) var __bjs_param2 = param2 __bjs_param2.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) @@ -132,10 +132,10 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_f64(param2) return Int32(3) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(param1 ? 1 : 0) - _swift_js_push_int(Int32(param2)) - _swift_js_push_int(Int32(param3)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(param1 ? 1 : 0) + _swift_js_push_i32(Int32(param2)) + _swift_js_push_i32(Int32(param3)) _swift_js_push_f64(param4) _swift_js_push_f64(param5) var __bjs_param6 = param6 @@ -180,11 +180,11 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(Int32(param1)) var __bjs_param2 = param2 __bjs_param2.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) @@ -196,10 +196,10 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_f64(param2) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): _swift_js_push_tag(Int32(4)) - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(param1 ? 1 : 0) - _swift_js_push_int(Int32(param2)) - _swift_js_push_int(Int32(param3)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(param1 ? 1 : 0) + _swift_js_push_i32(Int32(param2)) + _swift_js_push_i32(Int32(param3)) _swift_js_push_f64(param4) _swift_js_push_f64(param5) var __bjs_param6 = param6 @@ -249,11 +249,11 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) return Int32(1) case .status(let param0, let param1, let param2): - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(Int32(param1)) var __bjs_param2 = param2 __bjs_param2.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) @@ -286,11 +286,11 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(Int32(param1)) var __bjs_param2 = param2 __bjs_param2.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) @@ -326,7 +326,7 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) return Int32(1) } } @@ -355,7 +355,7 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) } } } @@ -386,31 +386,31 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } - _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(0) case .failure(let param0, let param1): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_int(Int32(__bjs_unwrapped_param0)) + _swift_js_push_i32(Int32(__bjs_unwrapped_param0)) } - _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_int(__bjs_unwrapped_param1 ? 1 : 0) + _swift_js_push_i32(__bjs_unwrapped_param1 ? 1 : 0) } - _swift_js_push_int(__bjs_isSome_param1 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) return Int32(1) case .status(let param0, let param1, let param2): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_int(__bjs_unwrapped_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_unwrapped_param0 ? 1 : 0) } - _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_int(Int32(__bjs_unwrapped_param1)) + _swift_js_push_i32(Int32(__bjs_unwrapped_param1)) } - _swift_js_push_int(__bjs_isSome_param1 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { var __bjs_str_param2 = __bjs_unwrapped_param2 @@ -418,7 +418,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } - _swift_js_push_int(__bjs_isSome_param2 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) return Int32(2) } } @@ -444,31 +444,31 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } - _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) case .failure(let param0, let param1): _swift_js_push_tag(Int32(1)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_int(Int32(__bjs_unwrapped_param0)) + _swift_js_push_i32(Int32(__bjs_unwrapped_param0)) } - _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_int(__bjs_unwrapped_param1 ? 1 : 0) + _swift_js_push_i32(__bjs_unwrapped_param1 ? 1 : 0) } - _swift_js_push_int(__bjs_isSome_param1 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_int(__bjs_unwrapped_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_unwrapped_param0 ? 1 : 0) } - _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_int(Int32(__bjs_unwrapped_param1)) + _swift_js_push_i32(Int32(__bjs_unwrapped_param1)) } - _swift_js_push_int(__bjs_isSome_param1 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { var __bjs_str_param2 = __bjs_unwrapped_param2 @@ -476,7 +476,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } - _swift_js_push_int(__bjs_isSome_param2 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index 02a202268..0558e2a1f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -385,7 +385,7 @@ extension Result: _BridgedSwiftAssociatedValueEnum { } return Int32(0) case .failure(let param0): - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) return Int32(1) } } @@ -410,7 +410,7 @@ extension Result: _BridgedSwiftAssociatedValueEnum { } case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) } } } @@ -433,8 +433,8 @@ public func _bjs_processDelegates() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int((__bjs_elem_ret as! AnyMyViewControllerDelegate).bridgeJSLowerReturn())} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32((__bjs_elem_ret as! AnyMyViewControllerDelegate).bridgeJSLowerReturn())} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -685,8 +685,8 @@ public func _bjs_DelegateManager_delegates_get(_ _self: UnsafeMutableRawPointer) #if arch(wasm32) let ret = DelegateManager.bridgeJSLiftParameter(_self).delegates for __bjs_elem_ret in ret { - _swift_js_push_int((__bjs_elem_ret as! AnyMyViewControllerDelegate).bridgeJSLowerReturn())} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32((__bjs_elem_ret as! AnyMyViewControllerDelegate).bridgeJSLowerReturn())} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift index 6d1f56f50..378eff8bb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift @@ -67,7 +67,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } return Int32(0) case .failure(let param0): - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) return Int32(1) } } @@ -92,7 +92,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift index 6d1f56f50..378eff8bb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift @@ -67,7 +67,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } return Int32(0) case .failure(let param0): - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) return Int32(1) } } @@ -92,7 +92,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift index feddadf15..415aa54f6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift @@ -704,10 +704,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } return Int32(0) case .failure(let param0): - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) return Int32(1) case .flag(let param0): - _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_i32(param0 ? 1 : 0) return Int32(2) case .rate(let param0): _swift_js_push_f32(param0) @@ -740,10 +740,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) case .flag(let param0): _swift_js_push_tag(Int32(2)) - _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_i32(param0 ? 1 : 0) case .rate(let param0): _swift_js_push_tag(Int32(3)) _swift_js_push_f32(param0) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift index 35fbe039c..af4428979 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift @@ -20,14 +20,14 @@ extension DataPoint: _BridgedSwiftStruct { } let __bjs_isSome_optCount = self.optCount != nil if let __bjs_unwrapped_optCount = self.optCount { - _swift_js_push_int(Int32(__bjs_unwrapped_optCount)) + _swift_js_push_i32(Int32(__bjs_unwrapped_optCount)) } - _swift_js_push_int(__bjs_isSome_optCount ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_optCount ? 1 : 0) let __bjs_isSome_optFlag = self.optFlag != nil if let __bjs_unwrapped_optFlag = self.optFlag { - _swift_js_push_int(__bjs_unwrapped_optFlag ? 1 : 0) + _swift_js_push_i32(__bjs_unwrapped_optFlag ? 1 : 0) } - _swift_js_push_int(__bjs_isSome_optFlag ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_optFlag ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -93,9 +93,9 @@ extension Address: _BridgedSwiftStruct { } let __bjs_isSome_zipCode = self.zipCode != nil if let __bjs_unwrapped_zipCode = self.zipCode { - _swift_js_push_int(Int32(__bjs_unwrapped_zipCode)) + _swift_js_push_i32(Int32(__bjs_unwrapped_zipCode)) } - _swift_js_push_int(__bjs_isSome_zipCode ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_zipCode ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -145,7 +145,7 @@ extension Person: _BridgedSwiftStruct { __bjs_name.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(self.age)) + _swift_js_push_i32(Int32(self.age)) self.address.bridgeJSLowerReturn() let __bjs_isSome_email = self.email != nil if let __bjs_unwrapped_email = self.email { @@ -154,7 +154,7 @@ extension Person: _BridgedSwiftStruct { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } - _swift_js_push_int(__bjs_isSome_email ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_email ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -198,7 +198,7 @@ extension Session: _BridgedSwiftStruct { } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_int(Int32(self.id)) + _swift_js_push_i32(Int32(self.id)) _swift_js_push_pointer(self.owner.bridgeJSLowerReturn()) } @@ -250,7 +250,7 @@ extension Measurement: _BridgedSwiftStruct { if let __bjs_unwrapped_optionalPrecision = self.optionalPrecision { _swift_js_push_f32(__bjs_unwrapped_optionalPrecision.bridgeJSLowerParameter()) } - _swift_js_push_int(__bjs_isSome_optionalPrecision ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_optionalPrecision ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { diff --git a/Plugins/PackageToJS/Templates/instantiate.js b/Plugins/PackageToJS/Templates/instantiate.js index 462df924b..54a7212c6 100644 --- a/Plugins/PackageToJS/Templates/instantiate.js +++ b/Plugins/PackageToJS/Templates/instantiate.js @@ -40,7 +40,7 @@ async function createInstantiator(options, swift) { swift_js_retain: unexpectedBjsCall, swift_js_release: unexpectedBjsCall, swift_js_push_tag: unexpectedBjsCall, - swift_js_push_int: unexpectedBjsCall, + swift_js_push_i32: unexpectedBjsCall, swift_js_push_f32: unexpectedBjsCall, swift_js_push_f64: unexpectedBjsCall, swift_js_push_string: unexpectedBjsCall, diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 0bf62648c..1e7893c82 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -425,10 +425,10 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_push_int") -@_spi(BridgeJS) public func _swift_js_push_int(_ value: Int32) +@_extern(wasm, module: "bjs", name: "swift_js_push_i32") +@_spi(BridgeJS) public func _swift_js_push_i32(_ value: Int32) #else -@_spi(BridgeJS) public func _swift_js_push_int(_ value: Int32) { +@_spi(BridgeJS) public func _swift_js_push_i32(_ value: Int32) { _onlyAvailableOnWasm() } #endif @@ -1491,10 +1491,10 @@ extension Optional where Wrapped: _BridgedSwiftStruct { @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { switch consume self { case .none: - _swift_js_push_int(0) // Push only isSome=0 (no struct fields) + _swift_js_push_i32(0) // Push only isSome=0 (no struct fields) case .some(let value): value.bridgeJSLowerReturn() // Push all struct fields FIRST - _swift_js_push_int(1) // Then push isSome=1 LAST (so it's popped FIRST by JS) + _swift_js_push_i32(1) // Then push isSome=1 LAST (so it's popped FIRST by JS) } } } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index e9b2aa903..35a53805d 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -1465,10 +1465,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } return Int32(0) case .failure(let param0): - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) return Int32(1) case .flag(let param0): - _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_i32(param0 ? 1 : 0) return Int32(2) case .rate(let param0): _swift_js_push_f32(param0) @@ -1501,10 +1501,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_int(Int32(param0)) + _swift_js_push_i32(Int32(param0)) case .flag(let param0): _swift_js_push_tag(Int32(2)) - _swift_js_push_int(param0 ? 1 : 0) + _swift_js_push_i32(param0 ? 1 : 0) case .rate(let param0): _swift_js_push_tag(Int32(3)) _swift_js_push_f32(param0) @@ -1554,7 +1554,7 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) return Int32(1) case .location(let param0, let param1, let param2): _swift_js_push_f64(param0) @@ -1565,8 +1565,8 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } return Int32(2) case .status(let param0, let param1, let param2): - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(Int32(param1)) var __bjs_param2 = param2 __bjs_param2.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) @@ -1578,10 +1578,10 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_f64(param2) return Int32(4) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(param1 ? 1 : 0) - _swift_js_push_int(Int32(param2)) - _swift_js_push_int(Int32(param3)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(param1 ? 1 : 0) + _swift_js_push_i32(Int32(param2)) + _swift_js_push_i32(Int32(param3)) _swift_js_push_f64(param4) _swift_js_push_f64(param5) var __bjs_param6 = param6 @@ -1626,7 +1626,7 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) case .location(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) _swift_js_push_f64(param0) @@ -1637,8 +1637,8 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(3)) - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(Int32(param1)) var __bjs_param2 = param2 __bjs_param2.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) @@ -1650,10 +1650,10 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_f64(param2) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): _swift_js_push_tag(Int32(5)) - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(param1 ? 1 : 0) - _swift_js_push_int(Int32(param2)) - _swift_js_push_int(Int32(param3)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(param1 ? 1 : 0) + _swift_js_push_i32(Int32(param2)) + _swift_js_push_i32(Int32(param3)) _swift_js_push_f64(param4) _swift_js_push_f64(param5) var __bjs_param6 = param6 @@ -1703,11 +1703,11 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) return Int32(1) case .status(let param0, let param1, let param2): - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(Int32(param1)) var __bjs_param2 = param2 __bjs_param2.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) @@ -1740,11 +1740,11 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) - _swift_js_push_int(param0 ? 1 : 0) - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(param0 ? 1 : 0) + _swift_js_push_i32(Int32(param1)) var __bjs_param2 = param2 __bjs_param2.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) @@ -1780,7 +1780,7 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) return Int32(1) } } @@ -1809,7 +1809,7 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { __bjs_param0.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(param1)) + _swift_js_push_i32(Int32(param1)) } } } @@ -1840,31 +1840,31 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } - _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(0) case .failure(let param0, let param1): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_int(Int32(__bjs_unwrapped_param0)) + _swift_js_push_i32(Int32(__bjs_unwrapped_param0)) } - _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_int(__bjs_unwrapped_param1 ? 1 : 0) + _swift_js_push_i32(__bjs_unwrapped_param1 ? 1 : 0) } - _swift_js_push_int(__bjs_isSome_param1 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) return Int32(1) case .status(let param0, let param1, let param2): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_int(__bjs_unwrapped_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_unwrapped_param0 ? 1 : 0) } - _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_int(Int32(__bjs_unwrapped_param1)) + _swift_js_push_i32(Int32(__bjs_unwrapped_param1)) } - _swift_js_push_int(__bjs_isSome_param1 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { var __bjs_str_param2 = __bjs_unwrapped_param2 @@ -1872,7 +1872,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } - _swift_js_push_int(__bjs_isSome_param2 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) return Int32(2) } } @@ -1898,31 +1898,31 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } - _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) case .failure(let param0, let param1): _swift_js_push_tag(Int32(1)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_int(Int32(__bjs_unwrapped_param0)) + _swift_js_push_i32(Int32(__bjs_unwrapped_param0)) } - _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_int(__bjs_unwrapped_param1 ? 1 : 0) + _swift_js_push_i32(__bjs_unwrapped_param1 ? 1 : 0) } - _swift_js_push_int(__bjs_isSome_param1 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_int(__bjs_unwrapped_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_unwrapped_param0 ? 1 : 0) } - _swift_js_push_int(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_int(Int32(__bjs_unwrapped_param1)) + _swift_js_push_i32(Int32(__bjs_unwrapped_param1)) } - _swift_js_push_int(__bjs_isSome_param1 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { var __bjs_str_param2 = __bjs_unwrapped_param2 @@ -1930,7 +1930,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } - _swift_js_push_int(__bjs_isSome_param2 ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) } } } @@ -2226,8 +2226,8 @@ extension Point: _BridgedSwiftStruct { } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_int(Int32(self.x)) - _swift_js_push_int(Int32(self.y)) + _swift_js_push_i32(Int32(self.x)) + _swift_js_push_i32(Int32(self.y)) } init(unsafelyCopying jsObject: JSObject) { @@ -2344,14 +2344,14 @@ extension DataPoint: _BridgedSwiftStruct { } let __bjs_isSome_optCount = self.optCount != nil if let __bjs_unwrapped_optCount = self.optCount { - _swift_js_push_int(Int32(__bjs_unwrapped_optCount)) + _swift_js_push_i32(Int32(__bjs_unwrapped_optCount)) } - _swift_js_push_int(__bjs_isSome_optCount ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_optCount ? 1 : 0) let __bjs_isSome_optFlag = self.optFlag != nil if let __bjs_unwrapped_optFlag = self.optFlag { - _swift_js_push_int(__bjs_unwrapped_optFlag ? 1 : 0) + _swift_js_push_i32(__bjs_unwrapped_optFlag ? 1 : 0) } - _swift_js_push_int(__bjs_isSome_optFlag ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_optFlag ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -2417,9 +2417,9 @@ extension Address: _BridgedSwiftStruct { } let __bjs_isSome_zipCode = self.zipCode != nil if let __bjs_unwrapped_zipCode = self.zipCode { - _swift_js_push_int(Int32(__bjs_unwrapped_zipCode)) + _swift_js_push_i32(Int32(__bjs_unwrapped_zipCode)) } - _swift_js_push_int(__bjs_isSome_zipCode ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_zipCode ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -2470,7 +2470,7 @@ extension Contact: _BridgedSwiftStruct { __bjs_name.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(self.age)) + _swift_js_push_i32(Int32(self.age)) self.address.bridgeJSLowerReturn() let __bjs_isSome_email = self.email != nil if let __bjs_unwrapped_email = self.email { @@ -2479,12 +2479,12 @@ extension Contact: _BridgedSwiftStruct { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } - _swift_js_push_int(__bjs_isSome_email ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_email ? 1 : 0) let __bjs_isSome_secondaryAddress = self.secondaryAddress != nil if let __bjs_unwrapped_secondaryAddress = self.secondaryAddress { __bjs_unwrapped_secondaryAddress.bridgeJSLowerReturn() } - _swift_js_push_int(__bjs_isSome_secondaryAddress ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_secondaryAddress ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -2541,13 +2541,13 @@ extension Config: _BridgedSwiftStruct { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } - _swift_js_push_int(__bjs_isSome_theme ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_theme ? 1 : 0) let __bjs_isSome_direction = self.direction != nil if let __bjs_unwrapped_direction = self.direction { - _swift_js_push_int(__bjs_unwrapped_direction.bridgeJSLowerParameter()) + _swift_js_push_i32(__bjs_unwrapped_direction.bridgeJSLowerParameter()) } - _swift_js_push_int(__bjs_isSome_direction ? 1 : 0) - _swift_js_push_int(Int32(self.status.bridgeJSLowerParameter())) + _swift_js_push_i32(__bjs_isSome_direction ? 1 : 0) + _swift_js_push_i32(Int32(self.status.bridgeJSLowerParameter())) } init(unsafelyCopying jsObject: JSObject) { @@ -2591,12 +2591,12 @@ extension SessionData: _BridgedSwiftStruct { } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_int(Int32(self.id)) + _swift_js_push_i32(Int32(self.id)) let __bjs_isSome_owner = self.owner != nil if let __bjs_unwrapped_owner = self.owner { _swift_js_push_pointer(__bjs_unwrapped_owner.bridgeJSLowerReturn()) } - _swift_js_push_int(__bjs_isSome_owner ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_owner ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -2642,18 +2642,18 @@ extension ValidationReport: _BridgedSwiftStruct { } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_int(Int32(self.id)) + _swift_js_push_i32(Int32(self.id)) self.result.bridgeJSLowerReturn() let __bjs_isSome_status = self.status != nil if let __bjs_unwrapped_status = self.status { - _swift_js_push_int(__bjs_unwrapped_status.bridgeJSLowerParameter()) + _swift_js_push_i32(__bjs_unwrapped_status.bridgeJSLowerParameter()) } - _swift_js_push_int(__bjs_isSome_status ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_status ? 1 : 0) let __bjs_isSome_outcome = self.outcome != nil if let __bjs_unwrapped_outcome = self.outcome { - _swift_js_push_int(__bjs_unwrapped_outcome.bridgeJSLowerParameter()) + _swift_js_push_i32(__bjs_unwrapped_outcome.bridgeJSLowerParameter()) } - _swift_js_push_int(__bjs_isSome_outcome ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_outcome ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -2705,38 +2705,38 @@ extension AdvancedConfig: _BridgedSwiftStruct { } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_int(Int32(self.id)) + _swift_js_push_i32(Int32(self.id)) var __bjs_title = self.title __bjs_title.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(self.enabled ? 1 : 0) + _swift_js_push_i32(self.enabled ? 1 : 0) var __bjs_theme = self.theme.rawValue __bjs_theme.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(self.status.bridgeJSLowerParameter())) + _swift_js_push_i32(Int32(self.status.bridgeJSLowerParameter())) let __bjs_isSome_result = self.result != nil if let __bjs_unwrapped_result = self.result { - _swift_js_push_int(__bjs_unwrapped_result.bridgeJSLowerParameter()) + _swift_js_push_i32(__bjs_unwrapped_result.bridgeJSLowerParameter()) } - _swift_js_push_int(__bjs_isSome_result ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_result ? 1 : 0) let __bjs_isSome_metadata = self.metadata != nil if let __bjs_unwrapped_metadata = self.metadata { - _swift_js_push_int(__bjs_unwrapped_metadata.bridgeJSLowerReturn()) + _swift_js_push_i32(__bjs_unwrapped_metadata.bridgeJSLowerReturn()) } - _swift_js_push_int(__bjs_isSome_metadata ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_metadata ? 1 : 0) let __bjs_isSome_location = self.location != nil if let __bjs_unwrapped_location = self.location { __bjs_unwrapped_location.bridgeJSLowerReturn() } - _swift_js_push_int(__bjs_isSome_location ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_location ? 1 : 0) self.defaults.bridgeJSLowerReturn() let __bjs_isSome_overrideDefaults = self.overrideDefaults != nil if let __bjs_unwrapped_overrideDefaults = self.overrideDefaults { __bjs_unwrapped_overrideDefaults.bridgeJSLowerReturn() } - _swift_js_push_int(__bjs_isSome_overrideDefaults ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_overrideDefaults ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -2788,12 +2788,12 @@ extension MeasurementConfig: _BridgedSwiftStruct { if let __bjs_unwrapped_optionalPrecision = self.optionalPrecision { _swift_js_push_f32(__bjs_unwrapped_optionalPrecision.bridgeJSLowerParameter()) } - _swift_js_push_int(__bjs_isSome_optionalPrecision ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_optionalPrecision ? 1 : 0) let __bjs_isSome_optionalRatio = self.optionalRatio != nil if let __bjs_unwrapped_optionalRatio = self.optionalRatio { _swift_js_push_f64(__bjs_unwrapped_optionalRatio.bridgeJSLowerParameter()) } - _swift_js_push_int(__bjs_isSome_optionalRatio ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_optionalRatio ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -2924,7 +2924,7 @@ extension CopyableCart: _BridgedSwiftStruct { } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_int(Int32(self.x)) + _swift_js_push_i32(Int32(self.x)) let __bjs_isSome_note = self.note != nil if let __bjs_unwrapped_note = self.note { var __bjs_str_note = __bjs_unwrapped_note @@ -2932,7 +2932,7 @@ extension CopyableCart: _BridgedSwiftStruct { _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } } - _swift_js_push_int(__bjs_isSome_note ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_note ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -2991,7 +2991,7 @@ extension CopyableCartItem: _BridgedSwiftStruct { __bjs_sku.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(self.quantity)) + _swift_js_push_i32(Int32(self.quantity)) } init(unsafelyCopying jsObject: JSObject) { @@ -3036,13 +3036,13 @@ extension CopyableNestedCart: _BridgedSwiftStruct { } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_int(Int32(self.id)) + _swift_js_push_i32(Int32(self.id)) self.item.bridgeJSLowerReturn() let __bjs_isSome_shippingAddress = self.shippingAddress != nil if let __bjs_unwrapped_shippingAddress = self.shippingAddress { __bjs_unwrapped_shippingAddress.bridgeJSLowerReturn() } - _swift_js_push_int(__bjs_isSome_shippingAddress ? 1 : 0) + _swift_js_push_i32(__bjs_isSome_shippingAddress ? 1 : 0) } init(unsafelyCopying jsObject: JSObject) { @@ -3101,7 +3101,7 @@ extension ConfigStruct: _BridgedSwiftStruct { __bjs_name.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } - _swift_js_push_int(Int32(self.value)) + _swift_js_push_i32(Int32(self.value)) } init(unsafelyCopying jsObject: JSObject) { @@ -4676,8 +4676,8 @@ public func _bjs_roundTripIntArray() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4702,7 +4702,7 @@ public func _bjs_roundTripStringArray() -> Void { __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4724,7 +4724,7 @@ public func _bjs_roundTripDoubleArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4745,8 +4745,8 @@ public func _bjs_roundTripBoolArray() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int(__bjs_elem_ret ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_elem_ret ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4767,8 +4767,8 @@ public func _bjs_roundTripDirectionArray() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4789,8 +4789,8 @@ public func _bjs_roundTripStatusArray() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4815,7 +4815,7 @@ public func _bjs_roundTripThemeArray() -> Void { __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4836,8 +4836,8 @@ public func _bjs_roundTripHttpStatusArray() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4859,7 +4859,7 @@ public func _bjs_roundTripDataPointArray() -> Void { }()) for __bjs_elem_ret in ret { __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4881,7 +4881,7 @@ public func _bjs_roundTripGreeterArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4904,9 +4904,9 @@ public func _bjs_roundTripOptionalIntArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_int(Int32(__bjs_unwrapped_ret_elem))} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_unwrapped_ret_elem))} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4933,8 +4933,8 @@ public func _bjs_roundTripOptionalStringArray() -> Void { __bjs_str_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4958,8 +4958,8 @@ public func _bjs_roundTripOptionalDataPointArray() -> Void { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -4982,9 +4982,9 @@ public func _bjs_roundTripOptionalDirectionArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_int(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5007,9 +5007,9 @@ public func _bjs_roundTripOptionalStatusArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_int(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} - _swift_js_push_int(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5038,9 +5038,9 @@ public func _bjs_roundTripOptionalIntArrayType(_ values: Int32) -> Void { let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { for __bjs_elem_ret in __bjs_unwrapped_ret { - _swift_js_push_int(Int32(__bjs_elem_ret))} - _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} - _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + _swift_js_push_i32(Int32(__bjs_elem_ret))} + _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") #endif @@ -5073,8 +5073,8 @@ public func _bjs_roundTripOptionalStringArrayType(_ values: Int32) -> Void { __bjs_ret_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} - _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") #endif @@ -5104,8 +5104,8 @@ public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { if let __bjs_unwrapped_ret = ret { for __bjs_elem_ret in __bjs_unwrapped_ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_int(Int32(__bjs_unwrapped_ret.count))} - _swift_js_push_int(__bjs_isSome_ret ? 1 : 0) + _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") #endif @@ -5136,9 +5136,9 @@ public func _bjs_roundTripNestedIntArray() -> Void { }()) for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_int(Int32(__bjs_elem_ret_elem))} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret_elem))} + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5173,8 +5173,8 @@ public func _bjs_roundTripNestedStringArray() -> Void { __bjs_ret_elem_elem.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5206,8 +5206,8 @@ public func _bjs_roundTripNestedDoubleArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { _swift_js_push_f64(__bjs_elem_ret_elem)} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5238,9 +5238,9 @@ public func _bjs_roundTripNestedBoolArray() -> Void { }()) for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_int(__bjs_elem_ret_elem ? 1 : 0)} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(__bjs_elem_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5272,8 +5272,8 @@ public func _bjs_roundTripNestedDataPointArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { __bjs_elem_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5304,9 +5304,9 @@ public func _bjs_roundTripNestedDirectionArray() -> Void { }()) for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_int(Int32(__bjs_elem_ret_elem.bridgeJSLowerParameter()))} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret_elem.bridgeJSLowerParameter()))} + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5338,8 +5338,8 @@ public func _bjs_roundTripNestedGreeterArray() -> Void { for __bjs_elem_ret in ret { for __bjs_elem_ret_elem in __bjs_elem_ret { _swift_js_push_pointer(__bjs_elem_ret_elem.bridgeJSLowerReturn())} - _swift_js_push_int(Int32(__bjs_elem_ret.count))} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5361,7 +5361,7 @@ public func _bjs_roundTripUnsafeRawPointerArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5383,7 +5383,7 @@ public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5405,7 +5405,7 @@ public func _bjs_roundTripOpaquePointerArray() -> Void { }()) for __bjs_elem_ret in ret { _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif @@ -5446,8 +5446,8 @@ public func _bjs_roundTripDataProcessorArrayType() -> Void { return __result }()) for __bjs_elem_ret in ret { - _swift_js_push_int((__bjs_elem_ret as! AnyDataProcessor).bridgeJSLowerReturn())} - _swift_js_push_int(Int32(ret.count)) + _swift_js_push_i32((__bjs_elem_ret as! AnyDataProcessor).bridgeJSLowerReturn())} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif From d4c16e4ae7c8a7408058974142164dfffe7ad162 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Tue, 3 Feb 2026 01:24:31 +0100 Subject: [PATCH 122/252] Fix: Ensure `BridgeJS.Macros.swift` is processed by `SwiftToSkeleton` (#556) Fix: Ensure BridgeJS.Macros.swift is processed by SwiftToSkeleton Regenerate BridgeJS files --- .../Sources/BridgeJSTool/BridgeJSTool.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index f75619489..dd37fb3bc 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -113,6 +113,7 @@ import BridgeJSUtilities let bridgeJsGlobalDtsPath = targetDirectory.appending(path: "bridge-js.global.d.ts") let hasDts = FileManager.default.fileExists(atPath: bridgeJsDtsPath.path) let hasGlobalDts = FileManager.default.fileExists(atPath: bridgeJsGlobalDtsPath.path) + var generatedMacrosPath: String? = nil if hasDts || hasGlobalDts { guard let tsconfigPath = doubleDashOptions["project"] else { throw BridgeJSToolError("--project option is required when processing .d.ts files") @@ -128,9 +129,19 @@ import BridgeJSUtilities progress: progress, outputPath: bridgeJSMacrosPath.path ) + generatedMacrosPath = bridgeJSMacrosPath.path } - let inputFiles = inputSwiftFiles(targetDirectory: targetDirectory, positionalArguments: positionalArguments) + var inputFiles = inputSwiftFiles(targetDirectory: targetDirectory, positionalArguments: positionalArguments) + // BridgeJS.Macros.swift contains imported declarations (@JSFunction, @JSClass, etc.) that need + // to be processed by SwiftToSkeleton to populate the imported skeleton. The command plugin + // filters out Generated/ files, so we explicitly add it here after generation. + if let macrosPath = generatedMacrosPath, FileManager.default.fileExists(atPath: macrosPath) { + // Only add if not already present (when running directly vs through plugin) + if !inputFiles.contains(macrosPath) { + inputFiles.append(macrosPath) + } + } let swiftToSkeleton = SwiftToSkeleton( progress: progress, moduleName: moduleName, From 36d4c7369e614a4cdd46af011b18df3224856c58 Mon Sep 17 00:00:00 2001 From: zhiqipan <12974112+zhiqipan@users.noreply.github.com> Date: Tue, 3 Feb 2026 01:02:25 +0000 Subject: [PATCH 123/252] Fix missing comma in @_expose attribute for SwiftSyntax602 (#555) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix missing comma in @_expose attribute for SwiftSyntax602 The SwiftSyntax602 code path in `buildExposeAttributes` was using array literal syntax to construct `LabeledExprListSyntax`, which doesn't set `trailingComma` on the AST nodes. This resulted in malformed attributes: `@_expose(wasm "name")` instead of `@_expose(wasm, "name")`. The fix uses the result builder syntax with explicit `.with(\.trailingComma, .commaToken())` to ensure the comma is present in the generated code. Also adds a dedicated `bridgejs-test` CI job that tests BridgeJS with multiple Swift/SwiftSyntax version combinations to ensure both code paths (pre-602 and 602+) are exercised: - Swift 6.0.3 with SwiftSyntax 600.0.1 - Swift 6.1.2 with SwiftSyntax 601.0.1 - Swift 6.2 with SwiftSyntax 602.0.0 Co-Authored-By: Claude Opus 4.5 * Rename CI job to test-bridgejs-against-swift-versions * Simplify CI: let SPM resolve SwiftSyntax version naturally Remove sed-based version pinning that caused linker errors on Swift 6.2. Swift 6.2 ships with prebuilt SwiftSyntax 602.0.0, and forcing an exact version caused duplicate symbol errors during linking. Each Swift version naturally resolves to compatible SwiftSyntax: - Swift 6.0.x → SwiftSyntax 600.x - Swift 6.1.x → SwiftSyntax 601.x - Swift 6.2.x → SwiftSyntax 602.x Co-Authored-By: Claude Opus 4.5 * Remove Swift 6.0.3 from test matrix The codebase uses trailing commas in argument lists (BridgeJSToolInternal.swift) which requires Swift 6.1+. Testing with 6.1.2 and 6.2 covers both SwiftSyntax code paths (non-602 and 602). Co-Authored-By: Claude Opus 4.5 * Force SwiftSyntax 602.x for Swift 6.2 CI job On Swift 6.2, SPM resolves to SwiftSyntax 600.0.1 by default (per Package.swift), which doesn't have the SwiftSyntax602 module. Use sed to temporarily force SwiftSyntax 602.x so we actually test the SwiftSyntax602 code path. This also may avoid the prebuilt binary linker conflicts that occur with SwiftSyntax 600.0.1 on Swift 6.2. Co-Authored-By: Claude Opus 4.5 * Disable experimental SwiftSyntax prebuilts for BridgeJS tests * Override swift-syntax version via environment variable --------- Co-authored-by: Claude Opus 4.5 Co-authored-by: Yuta Saito --- .github/workflows/test.yml | 27 +++++++++++++++++++ Plugins/BridgeJS/Package.swift | 4 ++- .../Sources/BridgeJSCore/ImportTS.swift | 9 ++++--- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fc7392f7f..6b5ace046 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -67,6 +67,33 @@ jobs: - run: swift test --package-path ./Plugins/PackageToJS - run: swift test --package-path ./Plugins/BridgeJS + test-bridgejs-against-swift-versions: + name: Test BridgeJS against Swift versions + strategy: + matrix: + entry: + - image: "swift:6.1.2" + swift-syntax-version: "601.0.0" + - image: "swift:6.2" + swift-syntax-version: "602.0.0" + runs-on: ubuntu-latest + container: + image: ${{ matrix.entry.image }} + steps: + - uses: actions/checkout@v6 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Install TypeScript + run: npm install --prefix Plugins/BridgeJS/Sources/TS2Swift/JavaScript + - name: Run BridgeJS tests + # NOTE: Seems like the prebuilt SwiftSyntax binaries are not compatible with + # non-macro dependents, so disable experimental prebuilts for now. + run: swift test --disable-experimental-prebuilts --package-path ./Plugins/BridgeJS + env: + BRIDGEJS_OVERRIDE_SWIFT_SYNTAX_VERSION: ${{ matrix.entry.swift-syntax-version }} + native-build: # Check native build to make it easy to develop applications by Xcode name: Build for native target diff --git a/Plugins/BridgeJS/Package.swift b/Plugins/BridgeJS/Package.swift index eb675c86b..01a3c6d41 100644 --- a/Plugins/BridgeJS/Package.swift +++ b/Plugins/BridgeJS/Package.swift @@ -3,11 +3,13 @@ import CompilerPluginSupport import PackageDescription +let swiftSyntaxVersion = Context.environment["BRIDGEJS_OVERRIDE_SWIFT_SYNTAX_VERSION"] ?? "600.0.1" + let package = Package( name: "BridgeJS", platforms: [.macOS(.v13)], dependencies: [ - .package(url: "https://github.com/swiftlang/swift-syntax", from: "600.0.1"), + .package(url: "https://github.com/swiftlang/swift-syntax", from: Version(swiftSyntaxVersion)!), // Development dependencies .package(url: "https://github.com/apple/swift-argument-parser", from: "1.7.0"), ], diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 9e5575c41..7c391eea0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -760,10 +760,11 @@ enum SwiftCodePattern { return AttributeListSyntax { #if canImport(SwiftSyntax602) let exposeAttrArgs = AttributeSyntax.Arguments.argumentList( - [ - LabeledExprSyntax(label: nil, expression: DeclReferenceExprSyntax(baseName: "wasm")), - LabeledExprSyntax(label: nil, expression: StringLiteralExprSyntax(content: abiName)), - ] + LabeledExprListSyntax { + LabeledExprSyntax(label: nil, expression: DeclReferenceExprSyntax(baseName: "wasm")) + .with(\.trailingComma, .commaToken()) + LabeledExprSyntax(label: nil, expression: StringLiteralExprSyntax(content: abiName)) + } ) let cdeclAttrArgs = AttributeSyntax.Arguments.argumentList( [ From b0bf4a3b87688119ece2c9e695da38950f0079ed Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 3 Feb 2026 10:28:51 +0900 Subject: [PATCH 124/252] Examples: Build SwiftSyntax in debug mode for macro plugins (#558) --- Examples/ActorOnWebWorker/build.sh | 4 ++-- Examples/Basic/build.sh | 2 +- Examples/Multithreading/build.sh | 4 ++-- Examples/OffscrenCanvas/build.sh | 4 ++-- Examples/PlayBridgeJS/build.sh | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Examples/ActorOnWebWorker/build.sh b/Examples/ActorOnWebWorker/build.sh index 62b31144c..4def77883 100755 --- a/Examples/ActorOnWebWorker/build.sh +++ b/Examples/ActorOnWebWorker/build.sh @@ -1,5 +1,5 @@ #!/bin/bash set -euxo pipefail -swift package --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1_threads:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1-threads}}" -c release \ +swift package --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1_threads:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1-threads}}" \ plugin --allow-writing-to-package-directory \ - js --use-cdn --output ./Bundle + js --use-cdn --output ./Bundle -c release diff --git a/Examples/Basic/build.sh b/Examples/Basic/build.sh index 7b5864c44..2351f4e2d 100755 --- a/Examples/Basic/build.sh +++ b/Examples/Basic/build.sh @@ -1,3 +1,3 @@ #!/bin/bash set -euxo pipefail -swift package --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1}}" -c "${1:-debug}" js --use-cdn +swift package --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1}}" js --use-cdn -c "${1:-debug}" diff --git a/Examples/Multithreading/build.sh b/Examples/Multithreading/build.sh index 62b31144c..4def77883 100755 --- a/Examples/Multithreading/build.sh +++ b/Examples/Multithreading/build.sh @@ -1,5 +1,5 @@ #!/bin/bash set -euxo pipefail -swift package --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1_threads:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1-threads}}" -c release \ +swift package --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1_threads:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1-threads}}" \ plugin --allow-writing-to-package-directory \ - js --use-cdn --output ./Bundle + js --use-cdn --output ./Bundle -c release diff --git a/Examples/OffscrenCanvas/build.sh b/Examples/OffscrenCanvas/build.sh index 62b31144c..4def77883 100755 --- a/Examples/OffscrenCanvas/build.sh +++ b/Examples/OffscrenCanvas/build.sh @@ -1,5 +1,5 @@ #!/bin/bash set -euxo pipefail -swift package --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1_threads:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1-threads}}" -c release \ +swift package --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1_threads:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1-threads}}" \ plugin --allow-writing-to-package-directory \ - js --use-cdn --output ./Bundle + js --use-cdn --output ./Bundle -c release diff --git a/Examples/PlayBridgeJS/build.sh b/Examples/PlayBridgeJS/build.sh index 97e4b0f95..d2589f798 100755 --- a/Examples/PlayBridgeJS/build.sh +++ b/Examples/PlayBridgeJS/build.sh @@ -1,5 +1,5 @@ #!/bin/bash set -euxo pipefail -env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1}}" -c "${1:-debug}" \ +env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1}}" \ plugin --allow-writing-to-package-directory \ - js --use-cdn --output ./Bundle + js --use-cdn --output ./Bundle -c "${1:-debug}" From 4af19840a86c36ab7b9726a36b1d875f324e5804 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 3 Feb 2026 11:48:36 +0900 Subject: [PATCH 125/252] BridgeJS: Fix macro test suites silently ignoring failures (#559) * BridgeJS: Fix macro test suites silently ignoring failures * BridgeJS: Fix macro unit tests and macro implementations to pass tests --- Plugins/BridgeJS/Package.swift | 2 +- .../Sources/BridgeJSMacros/JSClassMacro.swift | 9 +- .../BridgeJSMacros/JSFunctionMacro.swift | 18 ++- .../BridgeJSMacros/JSGetterMacro.swift | 17 +++ .../BridgeJSMacros/JSSetterMacro.swift | 38 ++++- .../JSClassMacroTests.swift | 54 +++---- .../JSFunctionMacroTests.swift | 135 +++++++++--------- .../JSGetterMacroTests.swift | 110 +++++++------- .../JSSetterMacroTests.swift | 107 +++++++------- .../BridgeJSMacrosTests/TestSupport.swift | 52 +++++++ 10 files changed, 347 insertions(+), 195 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSMacrosTests/TestSupport.swift diff --git a/Plugins/BridgeJS/Package.swift b/Plugins/BridgeJS/Package.swift index 01a3c6d41..a03172f17 100644 --- a/Plugins/BridgeJS/Package.swift +++ b/Plugins/BridgeJS/Package.swift @@ -72,7 +72,7 @@ let package = Package( name: "BridgeJSMacrosTests", dependencies: [ "BridgeJSMacros", - .product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"), + .product(name: "SwiftSyntaxMacrosGenericTestSupport", package: "swift-syntax"), ] ), diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift index 8a3f83f05..2641df4bf 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift @@ -66,9 +66,16 @@ extension JSClassMacro: ExtensionMacro { conformingTo protocols: [TypeSyntax], in context: some MacroExpansionContext ) throws -> [ExtensionDeclSyntax] { - guard declaration.is(StructDeclSyntax.self) else { return [] } + guard let structDecl = declaration.as(StructDeclSyntax.self) else { return [] } guard !protocols.isEmpty else { return [] } + // Do not add extension if the struct already conforms to _JSBridgedClass + if let clause = structDecl.inheritanceClause, + clause.inheritedTypes.contains(where: { $0.type.trimmed.description == "_JSBridgedClass" }) + { + return [] + } + let conformanceList = protocols.map { $0.trimmed.description }.joined(separator: ", ") return [ try ExtensionDeclSyntax("extension \(type.trimmed): \(raw: conformanceList) {}") diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift index 7dfd635f9..a51bf10c5 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift @@ -47,7 +47,7 @@ extension JSFunctionMacro: BodyMacro { context.diagnose( Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedDeclaration) ) - return [] + return [CodeBlockItemSyntax(stringLiteral: "fatalError(\"@JSFunction init must be inside a type\")")] } let glueName = JSMacroHelper.glueName(baseName: "init", enclosingTypeName: enclosingTypeName) @@ -70,3 +70,19 @@ extension JSFunctionMacro: BodyMacro { return [] } } + +extension JSFunctionMacro: PeerMacro { + /// Emits a diagnostic when @JSFunction is applied to a declaration that is not a function or initializer. + /// BodyMacro is only invoked for declarations with optional code blocks (e.g. functions, initializers), + /// so for vars and other decls we need PeerMacro to run and diagnose. + public static func expansion( + of node: AttributeSyntax, + providingPeersOf declaration: some DeclSyntaxProtocol, + in context: some MacroExpansionContext + ) throws -> [DeclSyntax] { + if declaration.is(FunctionDeclSyntax.self) { return [] } + if declaration.is(InitializerDeclSyntax.self) { return [] } + context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedDeclaration)) + return [] + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift index b996facfa..44c3620cf 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift @@ -60,3 +60,20 @@ extension JSGetterMacro: AccessorMacro { ] } } + +extension JSGetterMacro: PeerMacro { + /// Emits a diagnostic when @JSGetter is applied to a declaration that is not a variable (e.g. a function). + /// AccessorMacro may not be invoked for non-property declarations. For variables with multiple + /// bindings, the compiler emits its own diagnostic; we only diagnose non-variable decls here. + public static func expansion( + of node: AttributeSyntax, + providingPeersOf declaration: some DeclSyntaxProtocol, + in context: some MacroExpansionContext + ) throws -> [DeclSyntax] { + guard declaration.is(VariableDeclSyntax.self) else { + context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedVariable)) + return [] + } + return [] + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift index bb9fd1f21..3c7280079 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift @@ -25,13 +25,23 @@ extension JSSetterMacro: BodyMacro { let rawFunctionName = JSMacroHelper.stripBackticks(functionName) guard rawFunctionName.hasPrefix("set"), rawFunctionName.count > 3 else { context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.invalidSetterName)) - return [] + return [ + CodeBlockItemSyntax( + stringLiteral: + "fatalError(\"@JSSetter function name must start with 'set' followed by a property name\")" + ) + ] } let propertyName = String(rawFunctionName.dropFirst(3)) guard !propertyName.isEmpty else { context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.invalidSetterName)) - return [] + return [ + CodeBlockItemSyntax( + stringLiteral: + "fatalError(\"@JSSetter function name must start with 'set' followed by a property name\")" + ) + ] } // Convert first character to lowercase (e.g., "Foo" -> "foo") @@ -56,7 +66,11 @@ extension JSSetterMacro: BodyMacro { let parameters = functionDecl.signature.parameterClause.parameters guard let firstParam = parameters.first else { context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.setterRequiresParameter)) - return [] + return [ + CodeBlockItemSyntax( + stringLiteral: "fatalError(\"@JSSetter function must have at least one parameter\")" + ) + ] } let paramName = firstParam.secondName ?? firstParam.firstName @@ -69,3 +83,21 @@ extension JSSetterMacro: BodyMacro { return [CodeBlockItemSyntax(stringLiteral: "try \(call)")] } } + +extension JSSetterMacro: PeerMacro { + /// Emits a diagnostic when @JSSetter is applied to a declaration that is not a function. + /// BodyMacro is only invoked for declarations with optional code blocks (e.g. functions). + public static func expansion( + of node: AttributeSyntax, + providingPeersOf declaration: some DeclSyntaxProtocol, + in context: some MacroExpansionContext + ) throws -> [DeclSyntax] { + guard declaration.is(FunctionDeclSyntax.self) else { + context.diagnose( + Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedSetterDeclaration) + ) + return [] + } + return [] + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift index b27b93941..7640916e4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift @@ -1,8 +1,7 @@ import SwiftDiagnostics import SwiftSyntax import SwiftSyntaxMacroExpansion -import SwiftSyntaxMacros -import SwiftSyntaxMacrosTestSupport +import SwiftSyntaxMacrosGenericTestSupport import Testing import BridgeJSMacros @@ -13,7 +12,7 @@ import BridgeJSMacros ] @Test func emptyStruct() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSClass struct MyClass { @@ -21,6 +20,7 @@ import BridgeJSMacros """, expandedSource: """ struct MyClass { + let jsObject: JSObject init(unsafelyWrapping jsObject: JSObject) { @@ -32,12 +32,12 @@ import BridgeJSMacros } """, macroSpecs: macroSpecs, - indentationWidth: indentationWidth + indentationWidth: indentationWidth, ) } @Test func structWithExistingJSObject() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSClass struct MyClass { @@ -62,7 +62,7 @@ import BridgeJSMacros } @Test func structWithExistingInit() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSClass struct MyClass { @@ -73,11 +73,11 @@ import BridgeJSMacros """, expandedSource: """ struct MyClass { - let jsObject: JSObject - init(unsafelyWrapping jsObject: JSObject) { self.jsObject = jsObject } + + let jsObject: JSObject } extension MyClass: _JSBridgedClass { @@ -89,7 +89,7 @@ import BridgeJSMacros } @Test func structWithBothExisting() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSClass struct MyClass { @@ -118,7 +118,7 @@ import BridgeJSMacros } @Test func structWithMembers() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSClass struct MyClass { @@ -127,10 +127,10 @@ import BridgeJSMacros """, expandedSource: """ struct MyClass { - let jsObject: JSObject - var name: String + let jsObject: JSObject + init(unsafelyWrapping jsObject: JSObject) { self.jsObject = jsObject } @@ -145,7 +145,7 @@ import BridgeJSMacros } @Test func _class() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSClass class MyClass { @@ -168,7 +168,7 @@ import BridgeJSMacros } @Test func _enum() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSClass enum MyEnum { @@ -191,7 +191,7 @@ import BridgeJSMacros } @Test func _actor() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSClass actor MyActor { @@ -214,7 +214,7 @@ import BridgeJSMacros } @Test func structWithDifferentJSObjectName() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSClass struct MyClass { @@ -223,10 +223,10 @@ import BridgeJSMacros """, expandedSource: """ struct MyClass { - let jsObject: JSObject - var otherProperty: String + let jsObject: JSObject + init(unsafelyWrapping jsObject: JSObject) { self.jsObject = jsObject } @@ -241,7 +241,7 @@ import BridgeJSMacros } @Test func structWithDifferentInit() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSClass struct MyClass { @@ -251,11 +251,11 @@ import BridgeJSMacros """, expandedSource: """ struct MyClass { - let jsObject: JSObject - init(name: String) { } + let jsObject: JSObject + init(unsafelyWrapping jsObject: JSObject) { self.jsObject = jsObject } @@ -270,7 +270,7 @@ import BridgeJSMacros } @Test func structWithMultipleMembers() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSClass struct MyClass { @@ -280,11 +280,11 @@ import BridgeJSMacros """, expandedSource: """ struct MyClass { - let jsObject: JSObject - var name: String var age: Int + let jsObject: JSObject + init(unsafelyWrapping jsObject: JSObject) { self.jsObject = jsObject } @@ -299,7 +299,7 @@ import BridgeJSMacros } @Test func structWithComment() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ /// Documentation comment @JSClass @@ -309,6 +309,7 @@ import BridgeJSMacros expandedSource: """ /// Documentation comment struct MyClass { + let jsObject: JSObject init(unsafelyWrapping jsObject: JSObject) { @@ -325,7 +326,7 @@ import BridgeJSMacros } @Test func structAlreadyConforms() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSClass struct MyClass: _JSBridgedClass { @@ -333,6 +334,7 @@ import BridgeJSMacros """, expandedSource: """ struct MyClass: _JSBridgedClass { + let jsObject: JSObject init(unsafelyWrapping jsObject: JSObject) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift index 8cfdd66e0..756935e7d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift @@ -1,15 +1,18 @@ import SwiftDiagnostics import SwiftSyntax -import SwiftSyntaxMacros -import SwiftSyntaxMacrosTestSupport +import SwiftSyntaxMacroExpansion +import SwiftSyntaxMacrosGenericTestSupport import Testing import BridgeJSMacros @Suite struct JSFunctionMacroTests { private let indentationWidth: Trivia = .spaces(4) + private let macroSpecs: [String: MacroSpec] = [ + "JSFunction": MacroSpec(type: JSFunctionMacro.self) + ] @Test func topLevelFunction() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSFunction func greet(name: String) -> String @@ -19,13 +22,13 @@ import BridgeJSMacros return _$greet(name) } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func topLevelFunctionVoidReturn() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSFunction func log(message: String) @@ -35,13 +38,13 @@ import BridgeJSMacros _$log(message) } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func topLevelFunctionWithExplicitVoidReturn() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSFunction func log(message: String) -> Void @@ -51,13 +54,13 @@ import BridgeJSMacros _$log(message) } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func topLevelFunctionWithEmptyTupleReturn() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSFunction func log(message: String) -> () @@ -67,13 +70,13 @@ import BridgeJSMacros _$log(message) } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func topLevelFunctionThrows() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSFunction func parse(json: String) throws -> [String: Any] @@ -83,13 +86,13 @@ import BridgeJSMacros return try _$parse(json) } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func topLevelFunctionAsync() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSFunction func fetch(url: String) async -> String @@ -99,13 +102,13 @@ import BridgeJSMacros return await _$fetch(url) } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func topLevelFunctionAsyncThrows() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSFunction func fetch(url: String) async throws -> String @@ -115,13 +118,13 @@ import BridgeJSMacros return try await _$fetch(url) } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func topLevelFunctionWithUnderscoreParameter() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSFunction func process(_ value: Int) -> Int @@ -131,13 +134,13 @@ import BridgeJSMacros return _$process(value) } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func topLevelFunctionWithMultipleParameters() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSFunction func add(a: Int, b: Int) -> Int @@ -147,13 +150,13 @@ import BridgeJSMacros return _$add(a, b) } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func instanceMethod() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ struct MyClass { @JSFunction @@ -167,13 +170,13 @@ import BridgeJSMacros } } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func staticMethod() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ struct MyClass { @JSFunction @@ -183,17 +186,17 @@ import BridgeJSMacros expandedSource: """ struct MyClass { static func create() -> MyClass { - return _$create() + return _$MyClass_create() } } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func classMethod() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ class MyClass { @JSFunction @@ -203,17 +206,17 @@ import BridgeJSMacros expandedSource: """ class MyClass { class func create() -> MyClass { - return _$create() + return _$MyClass_create() } } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func initializer() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ struct MyClass { @JSFunction @@ -228,13 +231,13 @@ import BridgeJSMacros } } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func initializerThrows() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ struct MyClass { @JSFunction @@ -249,13 +252,13 @@ import BridgeJSMacros } } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func initializerAsyncThrows() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ struct MyClass { @JSFunction @@ -270,19 +273,21 @@ import BridgeJSMacros } } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func initializerWithoutEnclosingType() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSFunction init() """, expandedSource: """ - init() + init() { + fatalError("@JSFunction init must be inside a type") + } """, diagnostics: [ DiagnosticSpec( @@ -291,13 +296,13 @@ import BridgeJSMacros column: 1 ) ], - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func unsupportedDeclaration() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSFunction var property: String @@ -312,13 +317,13 @@ import BridgeJSMacros column: 1 ) ], - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func enumInstanceMethod() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ enum MyEnum { @JSFunction @@ -332,13 +337,13 @@ import BridgeJSMacros } } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func actorInstanceMethod() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ actor MyActor { @JSFunction @@ -352,13 +357,13 @@ import BridgeJSMacros } } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func functionWithExistingBody() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSFunction func greet(name: String) -> String { @@ -370,8 +375,8 @@ import BridgeJSMacros return _$greet(name) } """, - macros: ["JSFunction": JSFunctionMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift index 8c7f3c119..2796c1014 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift @@ -1,15 +1,18 @@ import SwiftDiagnostics import SwiftSyntax -import SwiftSyntaxMacros -import SwiftSyntaxMacrosTestSupport +import SwiftSyntaxMacroExpansion +import SwiftSyntaxMacrosGenericTestSupport import Testing import BridgeJSMacros @Suite struct JSGetterMacroTests { private let indentationWidth: Trivia = .spaces(4) + private let macroSpecs: [String: MacroSpec] = [ + "JSGetter": MacroSpec(type: JSGetterMacro.self) + ] @Test func topLevelVariable() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSGetter var count: Int @@ -21,13 +24,13 @@ import BridgeJSMacros } } """, - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func topLevelLet() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSGetter let constant: String @@ -39,13 +42,13 @@ import BridgeJSMacros } } """, - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func instanceProperty() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ struct MyClass { @JSGetter @@ -61,13 +64,13 @@ import BridgeJSMacros } } """, - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func instanceLetProperty() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ struct MyClass { @JSGetter @@ -83,13 +86,13 @@ import BridgeJSMacros } } """, - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func staticProperty() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ struct MyClass { @JSGetter @@ -100,18 +103,18 @@ import BridgeJSMacros struct MyClass { static var version: String { get throws(JSException) { - return try _$version_get() + return try _$MyClass_version_get() } } } """, - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func classProperty() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ class MyClass { @JSGetter @@ -122,18 +125,18 @@ import BridgeJSMacros class MyClass { class var version: String { get throws(JSException) { - return try _$version_get() + return try _$MyClass_version_get() } } } """, - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func enumProperty() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ enum MyEnum { @JSGetter @@ -149,13 +152,13 @@ import BridgeJSMacros } } """, - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func actorProperty() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ actor MyActor { @JSGetter @@ -171,13 +174,13 @@ import BridgeJSMacros } } """, - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func variableWithExistingAccessor() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSGetter var count: Int { @@ -194,13 +197,13 @@ import BridgeJSMacros } } """, - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func variableWithInitializer() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSGetter var count: Int = 0 @@ -212,13 +215,13 @@ import BridgeJSMacros } } """, - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func multipleBindings() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSGetter var x: Int, y: Int @@ -228,19 +231,25 @@ import BridgeJSMacros """, diagnostics: [ DiagnosticSpec( - message: "@JSGetter can only be applied to single-variable declarations.", + message: "accessor macro can only be applied to a single variable", line: 1, column: 1, severity: .error - ) + ), + DiagnosticSpec( + message: "peer macro can only be applied to a single variable", + line: 1, + column: 1, + severity: .error + ), ], - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func unsupportedDeclaration() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSGetter func test() {} @@ -256,13 +265,15 @@ import BridgeJSMacros severity: .error ) ], - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } + #if canImport(SwiftSyntax601) + // https://github.com/swiftlang/swift-syntax/pull/2722 @Test func variableWithTrailingComment() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSGetter var count: Int // comment @@ -274,13 +285,14 @@ import BridgeJSMacros } } """, - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } + #endif @Test func variableWithUnderscoreName() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSGetter var _internal: String @@ -288,12 +300,12 @@ import BridgeJSMacros expandedSource: """ var _internal: String { get throws(JSException) { - return try _$internal_get() + return try _$_internal_get() } } """, - macros: ["JSGetter": JSGetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift index 83289e092..1ed4e1081 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift @@ -1,15 +1,18 @@ import SwiftDiagnostics import SwiftSyntax -import SwiftSyntaxMacros -import SwiftSyntaxMacrosTestSupport +import SwiftSyntaxMacroExpansion +import SwiftSyntaxMacrosGenericTestSupport import Testing import BridgeJSMacros @Suite struct JSSetterMacroTests { private let indentationWidth: Trivia = .spaces(4) + private let macroSpecs: [String: MacroSpec] = [ + "JSSetter": MacroSpec(type: JSSetterMacro.self) + ] @Test func topLevelSetter() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSSetter func setFoo(_ value: Foo) throws(JSException) @@ -19,13 +22,13 @@ import BridgeJSMacros try _$foo_set(value) } """, - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func topLevelSetterWithNamedParameter() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSSetter func setCount(count: Int) throws(JSException) @@ -35,13 +38,13 @@ import BridgeJSMacros try _$count_set(count) } """, - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func instanceSetter() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ struct MyClass { @JSSetter @@ -55,13 +58,13 @@ import BridgeJSMacros } } """, - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func staticSetter() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ struct MyClass { @JSSetter @@ -71,17 +74,17 @@ import BridgeJSMacros expandedSource: """ struct MyClass { static func setVersion(_ version: String) throws(JSException) { - try _$version_set(version) + try _$MyClass_version_set(version) } } """, - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func classSetter() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ class MyClass { @JSSetter @@ -91,17 +94,17 @@ import BridgeJSMacros expandedSource: """ class MyClass { class func setConfig(_ config: Config) throws(JSException) { - try _$config_set(config) + try _$MyClass_config_set(config) } } """, - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func enumSetter() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ enum MyEnum { @JSSetter @@ -115,13 +118,13 @@ import BridgeJSMacros } } """, - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func actorSetter() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ actor MyActor { @JSSetter @@ -135,13 +138,13 @@ import BridgeJSMacros } } """, - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func setterWithExistingBody() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSSetter func setFoo(_ value: Foo) throws(JSException) { @@ -153,19 +156,21 @@ import BridgeJSMacros try _$foo_set(value) } """, - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func invalidSetterName() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSSetter func updateFoo(_ value: Foo) throws(JSException) """, expandedSource: """ - func updateFoo(_ value: Foo) throws(JSException) + func updateFoo(_ value: Foo) throws(JSException) { + fatalError("@JSSetter function name must start with 'set' followed by a property name") + } """, diagnostics: [ DiagnosticSpec( @@ -175,19 +180,21 @@ import BridgeJSMacros column: 1 ) ], - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func setterNameTooShort() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSSetter func set(_ value: Foo) throws(JSException) """, expandedSource: """ - func set(_ value: Foo) throws(JSException) + func set(_ value: Foo) throws(JSException) { + fatalError("@JSSetter function name must start with 'set' followed by a property name") + } """, diagnostics: [ DiagnosticSpec( @@ -197,19 +204,21 @@ import BridgeJSMacros column: 1 ) ], - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func setterWithoutParameter() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSSetter func setFoo() throws(JSException) """, expandedSource: """ - func setFoo() throws(JSException) + func setFoo() throws(JSException) { + fatalError("@JSSetter function must have at least one parameter") + } """, diagnostics: [ DiagnosticSpec( @@ -218,13 +227,13 @@ import BridgeJSMacros column: 1 ) ], - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func unsupportedDeclaration() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSSetter var property: String @@ -239,13 +248,13 @@ import BridgeJSMacros column: 1 ) ], - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func setterWithMultipleWords() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSSetter func setConnectionTimeout(_ timeout: Int) throws(JSException) @@ -255,13 +264,13 @@ import BridgeJSMacros try _$connectionTimeout_set(timeout) } """, - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } @Test func setterWithSingleLetterProperty() { - assertMacroExpansion( + TestSupport.assertMacroExpansion( """ @JSSetter func setX(_ x: Int) throws(JSException) @@ -271,8 +280,8 @@ import BridgeJSMacros try _$x_set(x) } """, - macros: ["JSSetter": JSSetterMacro.self], - indentationWidth: indentationWidth + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, ) } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/TestSupport.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/TestSupport.swift new file mode 100644 index 000000000..84e343281 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/TestSupport.swift @@ -0,0 +1,52 @@ +import SwiftSyntaxMacrosGenericTestSupport +import Testing +import SwiftSyntax +import SwiftDiagnostics +import SwiftSyntaxMacroExpansion + +enum TestSupport { + static func failureHandler(spec: TestFailureSpec) { + Issue.record( + Comment(rawValue: spec.message), + sourceLocation: .init( + fileID: spec.location.fileID, + filePath: spec.location.filePath, + line: spec.location.line, + column: spec.location.column + ) + ) + } + + static func assertMacroExpansion( + _ originalSource: String, + expandedSource expectedExpandedSource: String, + diagnostics: [DiagnosticSpec] = [], + macroSpecs: [String: MacroSpec], + applyFixIts: [String]? = nil, + fixedSource expectedFixedSource: String? = nil, + testModuleName: String = "TestModule", + testFileName: String = "test.swift", + indentationWidth: Trivia = .spaces(4), + fileID: StaticString = #fileID, + filePath: StaticString = #filePath, + line: UInt = #line, + column: UInt = #column + ) { + SwiftSyntaxMacrosGenericTestSupport.assertMacroExpansion( + originalSource, + expandedSource: expectedExpandedSource, + diagnostics: diagnostics, + macroSpecs: macroSpecs, + applyFixIts: applyFixIts, + fixedSource: expectedFixedSource, + testModuleName: testModuleName, + testFileName: testFileName, + indentationWidth: indentationWidth, + failureHandler: TestSupport.failureHandler, + fileID: fileID, + filePath: filePath, + line: line, + column: column + ) + } +} From 4fa48cf5dd6c5b686b22d832b1953f495d746de4 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 3 Feb 2026 16:18:51 +0700 Subject: [PATCH 126/252] BridgeJS: Fix namespace enum with `@JS(namespace:)` attribute (#562) --- .../Sources/BridgeJSCore/ExportSwift.swift | 9 +- .../BridgeJSCore/SwiftToSkeleton.swift | 8 +- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 10 +- .../Inputs/EnumNamespace.swift | 15 +- .../EnumNamespace.Export.d.ts | 9 + .../BridgeJSLinkTests/EnumNamespace.Export.js | 24 +++ .../EnumNamespace.Global.Export.d.ts | 18 ++ .../EnumNamespace.Global.Export.js | 36 ++++ .../EnumNamespace.Global.json | 123 ++++++++++++ .../EnumNamespace.Global.swift | 47 +++++ .../ExportSwiftTests/EnumNamespace.json | 123 ++++++++++++ .../ExportSwiftTests/EnumNamespace.swift | 47 +++++ .../StaticFunctions.Global.json | 2 +- .../ExportSwiftTests/StaticFunctions.json | 2 +- .../StaticProperties.Global.json | 10 +- .../ExportSwiftTests/StaticProperties.json | 10 +- .../Generated/JavaScript/BridgeJS.json | 10 +- .../BridgeJSRuntimeTests/ExportAPITests.swift | 21 ++ .../Generated/BridgeJS.swift | 44 +++++ .../Generated/JavaScript/BridgeJS.json | 185 +++++++++++++++++- Tests/prelude.mjs | 10 + 21 files changed, 723 insertions(+), 40 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index d7d5c8200..1f8f72ad7 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -533,14 +533,9 @@ public class ExportSwift { if function.effects.isStatic, let staticContext = function.staticContext { let callName: String switch staticContext { - case .className(let baseName), .enumName(let baseName), .structName(let baseName): + case .className(let baseName), .enumName(let baseName), .structName(let baseName), + .namespaceEnum(let baseName): callName = "\(baseName).\(function.name)" - case .namespaceEnum: - if let namespace = function.namespace, !namespace.isEmpty { - callName = "\(namespace.joined(separator: ".")).\(function.name)" - } else { - callName = function.name - } } builder.call(name: callName, returnType: function.returnType) } else { diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index ea79d3f3b..b780012f0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -990,7 +990,8 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { } let isNamespaceEnum = exportedEnumByName[enumKey]?.cases.isEmpty ?? true - staticContext = isNamespaceEnum ? .namespaceEnum : .enumName(enumName) + let swiftCallName = exportedEnumByName[enumKey]?.swiftCallName ?? enumName + staticContext = isNamespaceEnum ? .namespaceEnum(swiftCallName) : .enumName(enumName) case .protocolBody(_, _): return nil case .structBody(let structName, _): @@ -1187,7 +1188,10 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { return .skipChildren } let isNamespaceEnum = exportedEnumByName[enumKey]?.cases.isEmpty ?? true - staticContext = isStatic ? (isNamespaceEnum ? .namespaceEnum : .enumName(enumName)) : nil + // Use swiftCallName for the full Swift call path (handles nested enums correctly) + let swiftCallName = exportedEnumByName[enumKey]?.swiftCallName ?? enumName + staticContext = + isStatic ? (isNamespaceEnum ? .namespaceEnum(swiftCallName) : .enumName(swiftCallName)) : nil case .topLevel: diagnose(node: node, message: "@JS var must be inside a @JS class or enum") return .skipChildren diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 33cc94479..5013dda66 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -242,7 +242,7 @@ public enum StaticContext: Codable, Equatable, Sendable { case className(String) case structName(String) case enumName(String) - case namespaceEnum + case namespaceEnum(String) } // MARK: - Struct Skeleton @@ -533,13 +533,9 @@ public struct ExportedProperty: Codable, Equatable, Sendable { public func callName(prefix: String? = nil) -> String { if let staticContext = staticContext { switch staticContext { - case .className(let baseName), .enumName(let baseName), .structName(let baseName): + case .className(let baseName), .enumName(let baseName), .structName(let baseName), + .namespaceEnum(let baseName): return "\(baseName).\(name)" - case .namespaceEnum: - if let namespace = namespace, !namespace.isEmpty { - let namespacePath = namespace.joined(separator: ".") - return "\(namespacePath).\(name)" - } } } if let prefix = prefix { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumNamespace.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumNamespace.swift index 26a4e9c3a..dbf044834 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumNamespace.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumNamespace.swift @@ -53,4 +53,17 @@ enum Internal { } } -// TODO: Add namespace enum with static functions when supported +@JS(namespace: "Services.Graph") +enum GraphOperations { + @JS static func createGraph(rootId: Int) -> Int { + return rootId * 10 + } + + @JS static func nodeCount(graphId: Int) -> Int { + return graphId + } + + @JS static func validate(graphId: Int) throws(JSException) -> Bool { + return graphId > 0 + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts index b8b92d14e..a6934d6e7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts @@ -84,6 +84,15 @@ export type Exports = { }, }, }, + Services: { + Graph: { + GraphOperations: { + createGraph(rootId: number): number; + nodeCount(graphId: number): number; + validate(graphId: number): boolean; + }, + }, + }, Utils: { Converter: { new(): Converter; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js index b01148873..1eb483365 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js @@ -332,6 +332,30 @@ export async function createInstantiator(options, swift) { }, }, }, + Services: { + Graph: { + GraphOperations: { + createGraph: function bjs_Services_Graph_GraphOperations_static_createGraph(rootId) { + const ret = instance.exports.bjs_Services_Graph_GraphOperations_static_createGraph(rootId); + return ret; + }, + nodeCount: function bjs_Services_Graph_GraphOperations_static_nodeCount(graphId) { + const ret = instance.exports.bjs_Services_Graph_GraphOperations_static_nodeCount(graphId); + return ret; + }, + validate: function bjs_Services_Graph_GraphOperations_static_validate(graphId) { + const ret = instance.exports.bjs_Services_Graph_GraphOperations_static_validate(graphId); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; + throw error; + } + return ret !== 0; + }, + }, + }, + }, Utils: { Converter, }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.d.ts index 4261ca3bb..f1dc0a926 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.d.ts @@ -58,6 +58,15 @@ declare global { } } } + namespace Services { + namespace Graph { + namespace GraphOperations { + createGraph(rootId: number): number; + nodeCount(graphId: number): number; + validate(graphId: number): boolean; + } + } + } namespace Utils { class Converter { constructor(); @@ -103,6 +112,15 @@ export type Exports = { }, }, }, + Services: { + Graph: { + GraphOperations: { + createGraph(rootId: number): number; + nodeCount(graphId: number): number; + validate(graphId: number): boolean; + }, + }, + }, Utils: { Converter: { new(): Converter; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js index 77c327e8d..f48a0050e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js @@ -349,6 +349,15 @@ export async function createInstantiator(options, swift) { if (typeof globalThis.Networking.APIV2.Internal === 'undefined') { globalThis.Networking.APIV2.Internal = {}; } + if (typeof globalThis.Services === 'undefined') { + globalThis.Services = {}; + } + if (typeof globalThis.Services.Graph === 'undefined') { + globalThis.Services.Graph = {}; + } + if (typeof globalThis.Services.Graph.GraphOperations === 'undefined') { + globalThis.Services.Graph.GraphOperations = {}; + } if (typeof globalThis.Utils === 'undefined') { globalThis.Utils = {}; } @@ -369,6 +378,30 @@ export async function createInstantiator(options, swift) { }, }, }, + Services: { + Graph: { + GraphOperations: { + createGraph: function bjs_Services_Graph_GraphOperations_static_createGraph(rootId) { + const ret = instance.exports.bjs_Services_Graph_GraphOperations_static_createGraph(rootId); + return ret; + }, + nodeCount: function bjs_Services_Graph_GraphOperations_static_nodeCount(graphId) { + const ret = instance.exports.bjs_Services_Graph_GraphOperations_static_nodeCount(graphId); + return ret; + }, + validate: function bjs_Services_Graph_GraphOperations_static_validate(graphId) { + const ret = instance.exports.bjs_Services_Graph_GraphOperations_static_validate(graphId); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; + throw error; + } + return ret !== 0; + }, + }, + }, + }, Utils: { Converter, }, @@ -377,6 +410,9 @@ export async function createInstantiator(options, swift) { globalThis.Utils.Converter = exports.Utils.Converter; globalThis.Networking.API.HTTPServer = exports.Networking.API.HTTPServer; globalThis.Networking.APIV2.Internal.TestServer = exports.Networking.APIV2.Internal.TestServer; + globalThis.Services.Graph.GraphOperations.createGraph = exports.Services.Graph.GraphOperations.createGraph; + globalThis.Services.Graph.GraphOperations.nodeCount = exports.Services.Graph.GraphOperations.nodeCount; + globalThis.Services.Graph.GraphOperations.validate = exports.Services.Graph.GraphOperations.validate; return exports; }, } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json index 42a084c44..135908d7f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json @@ -400,6 +400,129 @@ ], "swiftCallName" : "Internal.SupportedMethod", "tsFullPath" : "Networking.APIV2.Internal.SupportedMethod" + }, + { + "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" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "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" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "GraphOperations" + } + } + }, + { + "abiName" : "bjs_Services_Graph_GraphOperations_static_validate", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : true + }, + "name" : "validate", + "namespace" : [ + "Services", + "Graph", + "GraphOperations" + ], + "parameters" : [ + { + "label" : "graphId", + "name" : "graphId", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "GraphOperations" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GraphOperations", + "tsFullPath" : "Services.Graph.GraphOperations" } ], "exposeToGlobal" : true, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift index 9683b5307..43e3f69a4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift @@ -82,6 +82,53 @@ extension Internal.SupportedMethod: _BridgedSwiftCaseEnum { } } +@_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 +} + +@_expose(wasm, "bjs_Services_Graph_GraphOperations_static_validate") +@_cdecl("bjs_Services_Graph_GraphOperations_static_validate") +public func _bjs_Services_Graph_GraphOperations_static_validate(_ graphId: Int32) -> Int32 { + #if arch(wasm32) + do { + let ret = try GraphOperations.validate(graphId: Int.bridgeJSLiftParameter(graphId)) + 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_Converter_init") @_cdecl("bjs_Converter_init") public func _bjs_Converter_init() -> UnsafeMutableRawPointer { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json index 23bb06429..374ae13f4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json @@ -400,6 +400,129 @@ ], "swiftCallName" : "Internal.SupportedMethod", "tsFullPath" : "Networking.APIV2.Internal.SupportedMethod" + }, + { + "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" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "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" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "GraphOperations" + } + } + }, + { + "abiName" : "bjs_Services_Graph_GraphOperations_static_validate", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : true + }, + "name" : "validate", + "namespace" : [ + "Services", + "Graph", + "GraphOperations" + ], + "parameters" : [ + { + "label" : "graphId", + "name" : "graphId", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "GraphOperations" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GraphOperations", + "tsFullPath" : "Services.Graph.GraphOperations" } ], "exposeToGlobal" : false, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift index 9683b5307..43e3f69a4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift @@ -82,6 +82,53 @@ extension Internal.SupportedMethod: _BridgedSwiftCaseEnum { } } +@_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 +} + +@_expose(wasm, "bjs_Services_Graph_GraphOperations_static_validate") +@_cdecl("bjs_Services_Graph_GraphOperations_static_validate") +public func _bjs_Services_Graph_GraphOperations_static_validate(_ graphId: Int32) -> Int32 { + #if arch(wasm32) + do { + let ret = try GraphOperations.validate(graphId: Int.bridgeJSLiftParameter(graphId)) + 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_Converter_init") @_cdecl("bjs_Converter_init") public func _bjs_Converter_init() -> UnsafeMutableRawPointer { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json index 3b6937c30..0eec726c8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json @@ -311,7 +311,7 @@ }, "staticContext" : { "namespaceEnum" : { - + "_0" : "Utils.String" } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json index 652465dff..372504135 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json @@ -311,7 +311,7 @@ }, "staticContext" : { "namespaceEnum" : { - + "_0" : "Utils.String" } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json index 4ec19f83c..28457fb63 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json @@ -220,7 +220,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "PropertyNamespace" } }, "type" : { @@ -238,7 +238,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "PropertyNamespace" } }, "type" : { @@ -274,7 +274,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "PropertyNamespace.Nested" } }, "type" : { @@ -293,7 +293,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "PropertyNamespace.Nested" } }, "type" : { @@ -312,7 +312,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "PropertyNamespace.Nested" } }, "type" : { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json index 0e8b2de22..829c20718 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json @@ -220,7 +220,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "PropertyNamespace" } }, "type" : { @@ -238,7 +238,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "PropertyNamespace" } }, "type" : { @@ -274,7 +274,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "PropertyNamespace.Nested" } }, "type" : { @@ -293,7 +293,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "PropertyNamespace.Nested" } }, "type" : { @@ -312,7 +312,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "PropertyNamespace.Nested" } }, "type" : { diff --git a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json index 8b91ea964..e7bcf59b6 100644 --- a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json @@ -406,7 +406,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "GlobalStaticPropertyNamespace" } }, "type" : { @@ -424,7 +424,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "GlobalStaticPropertyNamespace" } }, "type" : { @@ -460,7 +460,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "GlobalStaticPropertyNamespace.NestedProperties" } }, "type" : { @@ -479,7 +479,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "GlobalStaticPropertyNamespace.NestedProperties" } }, "type" : { @@ -498,7 +498,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "GlobalStaticPropertyNamespace.NestedProperties" } }, "type" : { diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 2aee862c6..f82106ac1 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -295,6 +295,16 @@ struct TestError: Error { return String(value) } } + + @JS enum StringUtils { + @JS static func uppercase(_ text: String) -> String { + return text.uppercased() + } + + @JS static func lowercase(_ text: String) -> String { + return text.lowercased() + } + } } @JS enum Networking { @@ -788,6 +798,17 @@ enum APIOptionalResult { } } +@JS(namespace: "Services.Graph") +enum GraphOperations { + @JS static func createGraph(rootId: Int) -> Int { + return rootId * 10 + } + + @JS static func nodeCount(graphId: Int) -> Int { + return graphId + } +} + // MARK: - Default Parameters @JS func testStringDefault(message: String = "Hello World") -> String { diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 35a53805d..42f360ce7 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -1350,6 +1350,28 @@ extension TSDirection: _BridgedSwiftCaseEnum { extension TSTheme: _BridgedSwiftEnumNoPayload { } +@_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 @@ -1992,6 +2014,28 @@ public func _bjs_StaticUtils_Nested_static_roundtrip(_ valueBytes: Int32, _ valu #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 diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index c79139ea4..5d75ef55e 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -3500,6 +3500,91 @@ { "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", @@ -4356,7 +4441,7 @@ }, "staticContext" : { "namespaceEnum" : { - + "_0" : "StaticUtils.Nested" } } } @@ -4367,6 +4452,94 @@ "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" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "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" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "GraphOperations" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GraphOperations", + "tsFullPath" : "Services.Graph.GraphOperations" + }, { "cases" : [ { @@ -4501,7 +4674,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "StaticPropertyNamespace" } }, "type" : { @@ -4519,7 +4692,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "StaticPropertyNamespace" } }, "type" : { @@ -4555,7 +4728,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "StaticPropertyNamespace.NestedProperties" } }, "type" : { @@ -4574,7 +4747,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "StaticPropertyNamespace.NestedProperties" } }, "type" : { @@ -4593,7 +4766,7 @@ ], "staticContext" : { "namespaceEnum" : { - + "_0" : "StaticPropertyNamespace.NestedProperties" } }, "type" : { diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 12307d605..0319ce424 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -527,6 +527,11 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(converter.toString(123), "123"); converter.release(); + assert.equal(exports.Utils.StringUtils.uppercase("hello"), "HELLO"); + assert.equal(exports.Utils.StringUtils.uppercase(""), ""); + assert.equal(exports.Utils.StringUtils.lowercase("WORLD"), "world"); + assert.equal(exports.Utils.StringUtils.lowercase("HeLLo"), "hello"); + const httpServer = new exports.Networking.API.HTTPServer(); httpServer.call(exports.Networking.API.Method.Get); httpServer.call(exports.Networking.API.Method.Post); @@ -717,6 +722,11 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(exports.StaticUtils.Nested.roundtrip("hello world"), "hello world"); assert.equal(exports.StaticUtils.Nested.roundtrip("test"), "test"); + assert.equal(exports.Services.Graph.GraphOperations.createGraph(5), 50); + assert.equal(exports.Services.Graph.GraphOperations.createGraph(0), 0); + assert.equal(exports.Services.Graph.GraphOperations.nodeCount(42), 42); + assert.equal(exports.Services.Graph.GraphOperations.nodeCount(0), 0); + // Test default parameters assert.equal(exports.testStringDefault(), "Hello World"); assert.equal(exports.testStringDefault("Custom Message"), "Custom Message"); From d0724f291a7c66b464653284edb0ff1aef7070dd Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 3 Feb 2026 17:33:06 +0700 Subject: [PATCH 127/252] BridgeJS: Add intrinsic extensions for stack-based lifting and refactor Swift glue code generation to use them (#554) BridgeJS: Add reusable intrinsics for stack-based types --- .../Sources/Generated/BridgeJS.Macros.swift | 2 +- Benchmarks/Sources/Generated/BridgeJS.swift | 514 +++------ .../Generated/BridgeJS.Macros.swift | 2 +- .../Sources/BridgeJSCore/ExportSwift.swift | 244 ++--- .../Sources/TS2Swift/JavaScript/src/cli.js | 2 +- .../TS2Swift/JavaScript/src/processor.js | 4 +- .../ExportSwiftTests/ArrayTypes.swift | 299 +----- .../ExportSwiftTests/DefaultParameters.swift | 108 +- .../EnumAssociatedValue.swift | 272 ++--- .../EnumNamespace.Global.swift | 4 +- .../ExportSwiftTests/EnumNamespace.swift | 4 +- .../ExportSwiftTests/EnumRawType.swift | 24 +- .../ExportSwiftTests/Protocol.swift | 67 +- .../StaticFunctions.Global.swift | 18 +- .../ExportSwiftTests/StaticFunctions.swift | 18 +- .../ExportSwiftTests/SwiftClosure.swift | 40 +- .../ExportSwiftTests/SwiftStruct.swift | 79 +- .../ExportSwiftTests/UnsafePointer.swift | 20 +- .../ImportTSTests/ArrayParameter.Macros.swift | 2 +- .../ImportTSTests/Async.Macros.swift | 2 +- .../ImportTSTests/Interface.Macros.swift | 2 +- .../InvalidPropertyNames.Macros.swift | 2 +- .../MultipleImportedTypes.Macros.swift | 2 +- .../PrimitiveParameters.Macros.swift | 2 +- .../PrimitiveReturn.Macros.swift | 2 +- .../ImportTSTests/ReExportFrom.Macros.swift | 2 +- .../ImportTSTests/StringEnum.Macros.swift | 4 +- .../StringParameter.Macros.swift | 2 +- .../ImportTSTests/StringReturn.Macros.swift | 2 +- .../TS2SkeletonLike.Macros.swift | 2 +- .../ImportTSTests/TypeAlias.Macros.swift | 2 +- .../TypeScriptClass.Macros.swift | 2 +- .../VoidParameterVoidReturn.Macros.swift | 2 +- Plugins/PackageToJS/Templates/instantiate.js | 3 + .../JavaScriptKit/BridgeJSIntrinsics.swift | 355 ++++++- .../Generated/BridgeJS.swift | 4 +- .../BridgeJSRuntimeTests/ExportAPITests.swift | 6 + .../Generated/BridgeJS.Macros.swift | 4 +- .../Generated/BridgeJS.swift | 981 +++++------------- .../Generated/JavaScript/BridgeJS.json | 78 ++ Tests/prelude.mjs | 2 + 41 files changed, 1223 insertions(+), 1963 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.Macros.swift b/Benchmarks/Sources/Generated/BridgeJS.Macros.swift index bc2ceb32b..edf727004 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.Macros.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func benchmarkHelperNoop() throws (JSException) -> Void diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 86f4c87dc..1a413268d 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -11,15 +11,15 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .failure(Int.bridgeJSLiftParameter()) case 2: - return .flag(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .flag(Bool.bridgeJSLiftParameter()) case 3: - return .rate(Float.bridgeJSLiftParameter(_swift_js_pop_f32())) + return .rate(Float.bridgeJSLiftParameter()) case 4: - return .precise(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) + return .precise(Double.bridgeJSLiftParameter()) case 5: return .info default: @@ -32,22 +32,19 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .failure(let param0): - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() return Int32(1) case .flag(let param0): - _swift_js_push_i32(param0 ? 1 : 0) + param0.bridgeJSLowerStackReturn() return Int32(2) case .rate(let param0): - _swift_js_push_f32(param0) + param0.bridgeJSLowerStackReturn() return Int32(3) case .precise(let param0): - _swift_js_push_f64(param0) + param0.bridgeJSLowerStackReturn() return Int32(4) case .info: return Int32(5) @@ -68,22 +65,19 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() case .flag(let param0): _swift_js_push_tag(Int32(2)) - _swift_js_push_i32(param0 ? 1 : 0) + param0.bridgeJSLowerStackReturn() case .rate(let param0): _swift_js_push_tag(Int32(3)) - _swift_js_push_f32(param0) + param0.bridgeJSLowerStackReturn() case .precise(let param0): _swift_js_push_tag(Int32(4)) - _swift_js_push_f64(param0) + param0.bridgeJSLowerStackReturn() case .info: _swift_js_push_tag(Int32(5)) } @@ -94,17 +88,17 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .error(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .error(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) case 2: - return .location(Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .location(Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) case 3: - return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .status(Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) case 4: - return .coordinates(Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64())) + return .coordinates(Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter()) case 5: - return .comprehensive(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .comprehensive(Bool.bridgeJSLiftParameter(), Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), String.bridgeJSLiftParameter(), String.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) case 6: return .info default: @@ -117,58 +111,37 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .error(let param0, let param1): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() return Int32(1) case .location(let param0, let param1, let param2): - _swift_js_push_f64(param0) - _swift_js_push_f64(param1) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() return Int32(2) case .status(let param0, let param1, let param2): - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(Int32(param1)) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() return Int32(3) case .coordinates(let param0, let param1, let param2): - _swift_js_push_f64(param0) - _swift_js_push_f64(param1) - _swift_js_push_f64(param2) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() return Int32(4) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(param1 ? 1 : 0) - _swift_js_push_i32(Int32(param2)) - _swift_js_push_i32(Int32(param3)) - _swift_js_push_f64(param4) - _swift_js_push_f64(param5) - var __bjs_param6 = param6 - __bjs_param6.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_param7 = param7 - __bjs_param7.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_param8 = param8 - __bjs_param8.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() + param3.bridgeJSLowerStackReturn() + param4.bridgeJSLowerStackReturn() + param5.bridgeJSLowerStackReturn() + param6.bridgeJSLowerStackReturn() + param7.bridgeJSLowerStackReturn() + param8.bridgeJSLowerStackReturn() return Int32(5) case .info: return Int32(6) @@ -189,58 +162,37 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .error(let param0, let param1): _swift_js_push_tag(Int32(1)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() case .location(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) - _swift_js_push_f64(param0) - _swift_js_push_f64(param1) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(3)) - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(Int32(param1)) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() case .coordinates(let param0, let param1, let param2): _swift_js_push_tag(Int32(4)) - _swift_js_push_f64(param0) - _swift_js_push_f64(param1) - _swift_js_push_f64(param2) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): _swift_js_push_tag(Int32(5)) - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(param1 ? 1 : 0) - _swift_js_push_i32(Int32(param2)) - _swift_js_push_i32(Int32(param3)) - _swift_js_push_f64(param4) - _swift_js_push_f64(param5) - var __bjs_param6 = param6 - __bjs_param6.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_param7 = param7 - __bjs_param7.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_param8 = param8 - __bjs_param8.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() + param3.bridgeJSLowerStackReturn() + param4.bridgeJSLowerStackReturn() + param5.bridgeJSLowerStackReturn() + param6.bridgeJSLowerStackReturn() + param7.bridgeJSLowerStackReturn() + param8.bridgeJSLowerStackReturn() case .info: _swift_js_push_tag(Int32(6)) } @@ -249,23 +201,20 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { extension SimpleStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> SimpleStruct { - let precise = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) - let rate = Float.bridgeJSLiftParameter(_swift_js_pop_f32()) - let flag = Bool.bridgeJSLiftParameter(_swift_js_pop_i32()) - let count = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let precise = Double.bridgeJSLiftParameter() + let rate = Float.bridgeJSLiftParameter() + let flag = Bool.bridgeJSLiftParameter() + let count = Int.bridgeJSLiftParameter() + let name = String.bridgeJSLiftParameter() return SimpleStruct(name: name, count: count, flag: flag, rate: rate, precise: precise) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - var __bjs_name = self.name - __bjs_name.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(self.count)) - _swift_js_push_i32(self.flag ? 1 : 0) - _swift_js_push_f32(self.rate) - _swift_js_push_f64(self.precise) + self.name.bridgeJSLowerStackReturn() + self.count.bridgeJSLowerStackReturn() + self.flag.bridgeJSLowerStackReturn() + self.rate.bridgeJSLowerStackReturn() + self.precise.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -303,22 +252,16 @@ fileprivate func _bjs_struct_lift_SimpleStruct() -> Int32 { extension Address: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Address { - let zipCode = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) - let city = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let street = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let zipCode = Int.bridgeJSLiftParameter() + let city = String.bridgeJSLiftParameter() + let street = String.bridgeJSLiftParameter() return Address(street: street, city: city, zipCode: zipCode) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - var __bjs_street = self.street - __bjs_street.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_city = self.city - __bjs_city.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(self.zipCode)) + self.street.bridgeJSLowerStackReturn() + self.city.bridgeJSLowerStackReturn() + self.zipCode.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -356,26 +299,20 @@ fileprivate func _bjs_struct_lift_Address() -> Int32 { extension Person: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Person { - let email = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32()) + let email = Optional.bridgeJSLiftParameter() let address = Address.bridgeJSLiftParameter() - let age = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let age = Int.bridgeJSLiftParameter() + let name = String.bridgeJSLiftParameter() return Person(name: name, age: age, address: address, email: email) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - var __bjs_name = self.name - __bjs_name.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(self.age)) + self.name.bridgeJSLowerStackReturn() + self.age.bridgeJSLowerStackReturn() self.address.bridgeJSLowerReturn() let __bjs_isSome_email = self.email != nil if let __bjs_unwrapped_email = self.email { - var __bjs_str_email = __bjs_unwrapped_email - __bjs_str_email.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + __bjs_unwrapped_email.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_email ? 1 : 0) } @@ -415,31 +352,22 @@ fileprivate func _bjs_struct_lift_Person() -> Int32 { extension ComplexStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ComplexStruct { - let metadata = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let tags = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let score = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) - let active = Bool.bridgeJSLiftParameter(_swift_js_pop_i32()) - let title = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let id = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let metadata = String.bridgeJSLiftParameter() + let tags = String.bridgeJSLiftParameter() + let score = Double.bridgeJSLiftParameter() + let active = Bool.bridgeJSLiftParameter() + let title = String.bridgeJSLiftParameter() + let id = Int.bridgeJSLiftParameter() return ComplexStruct(id: id, title: title, active: active, score: score, tags: tags, metadata: metadata) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_i32(Int32(self.id)) - var __bjs_title = self.title - __bjs_title.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(self.active ? 1 : 0) - _swift_js_push_f64(self.score) - var __bjs_tags = self.tags - __bjs_tags.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_metadata = self.metadata - __bjs_metadata.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + self.id.bridgeJSLowerStackReturn() + self.title.bridgeJSLowerStackReturn() + self.active.bridgeJSLowerStackReturn() + self.score.bridgeJSLowerStackReturn() + self.tags.bridgeJSLowerStackReturn() + self.metadata.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -477,14 +405,14 @@ fileprivate func _bjs_struct_lift_ComplexStruct() -> Int32 { extension Point: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { - let y = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) - let x = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) + let y = Double.bridgeJSLiftParameter() + let x = Double.bridgeJSLiftParameter() return Point(x: x, y: y) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_f64(self.x) - _swift_js_push_f64(self.y) + self.x.bridgeJSLowerStackReturn() + self.y.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -1487,16 +1415,7 @@ public func _bjs_ArrayRoundtrip_init() -> UnsafeMutableRawPointer { @_cdecl("bjs_ArrayRoundtrip_takeIntArray") public func _bjs_ArrayRoundtrip_takeIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - ArrayRoundtrip.bridgeJSLiftParameter(_self).takeIntArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeIntArray(_: [Int].bridgeJSLiftParameter()) #else fatalError("Only available on WebAssembly") #endif @@ -1507,9 +1426,7 @@ public func _bjs_ArrayRoundtrip_takeIntArray(_ _self: UnsafeMutableRawPointer) - public func _bjs_ArrayRoundtrip_makeIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeIntArray() - for __bjs_elem_ret in ret { - _swift_js_push_i32(Int32(__bjs_elem_ret))} - _swift_js_push_i32(Int32(ret.count)) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1519,19 +1436,8 @@ public func _bjs_ArrayRoundtrip_makeIntArray(_ _self: UnsafeMutableRawPointer) - @_cdecl("bjs_ArrayRoundtrip_roundtripIntArray") public func _bjs_ArrayRoundtrip_roundtripIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripIntArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32(Int32(__bjs_elem_ret))} - _swift_js_push_i32(Int32(ret.count)) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripIntArray(_: [Int].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1542,9 +1448,7 @@ public func _bjs_ArrayRoundtrip_roundtripIntArray(_ _self: UnsafeMutableRawPoint public func _bjs_ArrayRoundtrip_makeIntArrayLarge(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeIntArrayLarge() - for __bjs_elem_ret in ret { - _swift_js_push_i32(Int32(__bjs_elem_ret))} - _swift_js_push_i32(Int32(ret.count)) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1554,16 +1458,7 @@ public func _bjs_ArrayRoundtrip_makeIntArrayLarge(_ _self: UnsafeMutableRawPoint @_cdecl("bjs_ArrayRoundtrip_takeDoubleArray") public func _bjs_ArrayRoundtrip_takeDoubleArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - ArrayRoundtrip.bridgeJSLiftParameter(_self).takeDoubleArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Double] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) - } - __result.reverse() - return __result - }()) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeDoubleArray(_: [Double].bridgeJSLiftParameter()) #else fatalError("Only available on WebAssembly") #endif @@ -1574,9 +1469,7 @@ public func _bjs_ArrayRoundtrip_takeDoubleArray(_ _self: UnsafeMutableRawPointer public func _bjs_ArrayRoundtrip_makeDoubleArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeDoubleArray() - for __bjs_elem_ret in ret { - _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_i32(Int32(ret.count)) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1586,19 +1479,8 @@ public func _bjs_ArrayRoundtrip_makeDoubleArray(_ _self: UnsafeMutableRawPointer @_cdecl("bjs_ArrayRoundtrip_roundtripDoubleArray") public func _bjs_ArrayRoundtrip_roundtripDoubleArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripDoubleArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Double] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_i32(Int32(ret.count)) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripDoubleArray(_: [Double].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1608,16 +1490,7 @@ public func _bjs_ArrayRoundtrip_roundtripDoubleArray(_ _self: UnsafeMutableRawPo @_cdecl("bjs_ArrayRoundtrip_takeStringArray") public func _bjs_ArrayRoundtrip_takeStringArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - ArrayRoundtrip.bridgeJSLiftParameter(_self).takeStringArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [String] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeStringArray(_: [String].bridgeJSLiftParameter()) #else fatalError("Only available on WebAssembly") #endif @@ -1628,12 +1501,7 @@ public func _bjs_ArrayRoundtrip_takeStringArray(_ _self: UnsafeMutableRawPointer public func _bjs_ArrayRoundtrip_makeStringArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeStringArray() - for __bjs_elem_ret in ret { - var __bjs_ret_elem = __bjs_elem_ret - __bjs_ret_elem.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - }} - _swift_js_push_i32(Int32(ret.count)) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1643,22 +1511,8 @@ public func _bjs_ArrayRoundtrip_makeStringArray(_ _self: UnsafeMutableRawPointer @_cdecl("bjs_ArrayRoundtrip_roundtripStringArray") public func _bjs_ArrayRoundtrip_roundtripStringArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripStringArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [String] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - var __bjs_ret_elem = __bjs_elem_ret - __bjs_ret_elem.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - }} - _swift_js_push_i32(Int32(ret.count)) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripStringArray(_: [String].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1668,16 +1522,7 @@ public func _bjs_ArrayRoundtrip_roundtripStringArray(_ _self: UnsafeMutableRawPo @_cdecl("bjs_ArrayRoundtrip_takePointArray") public func _bjs_ArrayRoundtrip_takePointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - ArrayRoundtrip.bridgeJSLiftParameter(_self).takePointArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Point] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Point.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takePointArray(_: [Point].bridgeJSLiftParameter()) #else fatalError("Only available on WebAssembly") #endif @@ -1688,9 +1533,7 @@ public func _bjs_ArrayRoundtrip_takePointArray(_ _self: UnsafeMutableRawPointer) public func _bjs_ArrayRoundtrip_makePointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makePointArray() - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1700,19 +1543,8 @@ public func _bjs_ArrayRoundtrip_makePointArray(_ _self: UnsafeMutableRawPointer) @_cdecl("bjs_ArrayRoundtrip_roundtripPointArray") public func _bjs_ArrayRoundtrip_roundtripPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripPointArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Point] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Point.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripPointArray(_: [Point].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1723,9 +1555,7 @@ public func _bjs_ArrayRoundtrip_roundtripPointArray(_ _self: UnsafeMutableRawPoi public func _bjs_ArrayRoundtrip_makePointArrayLarge(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makePointArrayLarge() - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1740,16 +1570,7 @@ public func _bjs_ArrayRoundtrip_takeNestedIntArray(_ _self: UnsafeMutableRawPoin var __result: [[Int]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + __result.append([Int].bridgeJSLiftParameter()) } __result.reverse() return __result @@ -1765,9 +1586,7 @@ public func _bjs_ArrayRoundtrip_makeNestedIntArray(_ _self: UnsafeMutableRawPoin #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeNestedIntArray() for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_i32(Int32(__bjs_elem_ret_elem))} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -1783,24 +1602,13 @@ public func _bjs_ArrayRoundtrip_roundtripNestedIntArray(_ _self: UnsafeMutableRa var __result: [[Int]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + __result.append([Int].bridgeJSLiftParameter()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_i32(Int32(__bjs_elem_ret_elem))} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -1816,16 +1624,7 @@ public func _bjs_ArrayRoundtrip_takeNestedPointArray(_ _self: UnsafeMutableRawPo var __result: [[Point]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [Point] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Point.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) + __result.append([Point].bridgeJSLiftParameter()) } __result.reverse() return __result @@ -1841,9 +1640,7 @@ public func _bjs_ArrayRoundtrip_makeNestedPointArray(_ _self: UnsafeMutableRawPo #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeNestedPointArray() for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - __bjs_elem_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -1859,24 +1656,13 @@ public func _bjs_ArrayRoundtrip_roundtripNestedPointArray(_ _self: UnsafeMutable var __result: [[Point]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [Point] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Point.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) + __result.append([Point].bridgeJSLiftParameter()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - __bjs_elem_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -1892,7 +1678,7 @@ public func _bjs_ArrayRoundtrip_takeOptionalIntArray(_ _self: UnsafeMutableRawPo var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -1910,7 +1696,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalIntArray(_ _self: UnsafeMutableRawPo for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_i32(Int32(__bjs_unwrapped_ret_elem))} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} _swift_js_push_i32(Int32(ret.count)) #else @@ -1927,7 +1713,7 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalIntArray(_ _self: UnsafeMutable var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -1935,7 +1721,7 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalIntArray(_ _self: UnsafeMutable for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_i32(Int32(__bjs_unwrapped_ret_elem))} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} _swift_js_push_i32(Int32(ret.count)) #else @@ -1952,7 +1738,7 @@ public func _bjs_ArrayRoundtrip_takeOptionalPointArray(_ _self: UnsafeMutableRaw var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -1987,7 +1773,7 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalPointArray(_ _self: UnsafeMutab var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -2011,16 +1797,7 @@ public func _bjs_ArrayRoundtrip_takeOptionalArray(_ _self: UnsafeMutableRawPoint if values == 0 { return Optional<[Int]>.none } else { - return { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }() + return [Int].bridgeJSLiftParameter() } }()) #else @@ -2035,9 +1812,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalArraySome(_ _self: UnsafeMutableRawP let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalArraySome() let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - for __bjs_elem_ret in __bjs_unwrapped_ret { - _swift_js_push_i32(Int32(__bjs_elem_ret))} - _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + __bjs_unwrapped_ret.bridgeJSLowerReturn()} _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -2051,9 +1826,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalArrayNone(_ _self: UnsafeMutableRawP let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalArrayNone() let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - for __bjs_elem_ret in __bjs_unwrapped_ret { - _swift_js_push_i32(Int32(__bjs_elem_ret))} - _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + __bjs_unwrapped_ret.bridgeJSLowerReturn()} _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -2068,23 +1841,12 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalArray(_ _self: UnsafeMutableRaw if values == 0 { return Optional<[Int]>.none } else { - return { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }() + return [Int].bridgeJSLiftParameter() } }()) let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - for __bjs_elem_ret in __bjs_unwrapped_ret { - _swift_js_push_i32(Int32(__bjs_elem_ret))} - _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + __bjs_unwrapped_ret.bridgeJSLowerReturn()} _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift index 221302716..cc62396ea 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func createTS2Swift() throws (JSException) -> TS2Swift diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 1f8f72ad7..0c5debeac 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -793,60 +793,56 @@ struct StackCodegen { /// - Returns: An ExprSyntax representing the lift expression func liftExpression(for type: BridgeType) -> ExprSyntax { switch type { - case .string: - return "String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" - case .int, .uint: - return "Int.bridgeJSLiftParameter(_swift_js_pop_i32())" - case .bool: - return "Bool.bridgeJSLiftParameter(_swift_js_pop_i32())" - case .float: - return "Float.bridgeJSLiftParameter(_swift_js_pop_f32())" - case .double: - return "Double.bridgeJSLiftParameter(_swift_js_pop_f64())" - case .jsObject: - return "JSObject.bridgeJSLiftParameter(_swift_js_pop_i32())" - case .swiftHeapObject(let className): - return "\(raw: className).bridgeJSLiftParameter(_swift_js_pop_pointer())" + case .string, .int, .uint, .bool, .float, .double, + .jsObject, .swiftStruct, .swiftHeapObject: + return "\(raw: type.swiftType).bridgeJSLiftParameter()" case .unsafePointer: - return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_pointer())" + return "\(raw: type.swiftType).bridgeJSLiftParameter()" case .swiftProtocol(let protocolName): - // Protocols use their Any wrapper type for lifting - let wrapperName = "Any\(protocolName)" - return "\(raw: wrapperName).bridgeJSLiftParameter(_swift_js_pop_i32())" - case .caseEnum(let enumName): - return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_i32())" - case .rawValueEnum(let enumName, let rawType): + return "Any\(raw: protocolName).bridgeJSLiftParameter(_swift_js_pop_i32())" + case .caseEnum: + return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_i32())" + case .rawValueEnum(_, let rawType): switch rawType { case .string: return - "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" + "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" case .float: - return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_f32())" + return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_f32())" case .double: - return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_f64())" + return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_f64())" case .bool, .int, .int32, .int64, .uint, .uint32, .uint64: - return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_i32())" + return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_i32())" } - case .associatedValueEnum(let enumName): - return "\(raw: enumName).bridgeJSLiftParameter(_swift_js_pop_i32())" - case .swiftStruct(let structName): - return "\(raw: structName).bridgeJSLiftParameter()" + case .associatedValueEnum: + return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_i32())" case .optional(let wrappedType): return liftOptionalExpression(wrappedType: wrappedType) - case .void: - // Void shouldn't be lifted, but return a placeholder - return "()" - case .namespaceEnum: - // Namespace enums are not passed as values - return "()" - case .closure: - return "JSObject.bridgeJSLiftParameter(_swift_js_pop_i32())" case .array(let elementType): return liftArrayExpression(elementType: elementType) + case .closure: + return "JSObject.bridgeJSLiftParameter()" + case .void, .namespaceEnum: + return "()" } } func liftArrayExpression(elementType: BridgeType) -> ExprSyntax { + switch elementType { + case .int, .uint, .float, .double, .string, .bool, + .jsObject, .swiftStruct, .caseEnum, .swiftHeapObject, + .unsafePointer, .rawValueEnum, .associatedValueEnum: + return "[\(raw: elementType.swiftType)].bridgeJSLiftParameter()" + case .swiftProtocol(let protocolName): + return "[Any\(raw: protocolName)].bridgeJSLiftParameter()" + case .optional, .array, .closure: + return liftArrayExpressionInline(elementType: elementType) + case .void, .namespaceEnum: + fatalError("Invalid array element type: \(elementType)") + } + } + + private func liftArrayExpressionInline(elementType: BridgeType) -> ExprSyntax { let elementLift = liftExpression(for: elementType) let swiftTypeName = elementType.swiftType return """ @@ -865,45 +861,9 @@ struct StackCodegen { private func liftOptionalExpression(wrappedType: BridgeType) -> ExprSyntax { switch wrappedType { - case .string: - return - "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())" - case .int, .uint: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" - case .bool: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" - case .float: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f32())" - case .double: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f64())" - case .caseEnum(let enumName): - return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" - case .rawValueEnum(let enumName, let rawType): - switch rawType { - case .string: - return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())" - case .float: - return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f32())" - case .double: - return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f64())" - case .bool, .int, .int32, .int64, .uint, .uint32, .uint64: - return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" - } - case .swiftStruct(let nestedName): - return "Optional<\(raw: nestedName)>.bridgeJSLiftParameter(_swift_js_pop_i32())" - case .swiftHeapObject(let className): - return - "Optional<\(raw: className)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_pointer())" - case .associatedValueEnum(let enumName): - return - "Optional<\(raw: enumName)>.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" - case .jsObject: - return "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" + case .string, .int, .uint, .bool, .float, .double, .jsObject, + .swiftStruct, .swiftHeapObject, .caseEnum, .associatedValueEnum, .rawValueEnum: + return "Optional<\(raw: wrappedType.swiftType)>.bridgeJSLiftParameter()" case .array(let elementType): let arrayLift = liftArrayExpression(elementType: elementType) let swiftTypeName = elementType.swiftType @@ -917,9 +877,8 @@ struct StackCodegen { } }() """ - default: - // Fallback for other optional types - return "Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" + case .void, .namespaceEnum, .closure, .optional, .unsafePointer, .swiftProtocol: + fatalError("Invalid optional wrapped type: \(wrappedType)") } } @@ -935,56 +894,23 @@ struct StackCodegen { varPrefix: String ) -> [CodeBlockItemSyntax] { switch type { - case .string: - return [ - "var __bjs_\(raw: varPrefix) = \(raw: accessor)", - "__bjs_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", - ] - case .int, .uint: - return ["_swift_js_push_i32(Int32(\(raw: accessor)))"] - case .bool: - return ["_swift_js_push_i32(\(raw: accessor) ? 1 : 0)"] - case .float: - return ["_swift_js_push_f32(\(raw: accessor))"] - case .double: - return ["_swift_js_push_f64(\(raw: accessor))"] + case .string, .int, .uint, .bool, .float, .double: + return ["\(raw: accessor).bridgeJSLowerStackReturn()"] case .jsObject: - return ["_swift_js_push_i32(\(raw: accessor).bridgeJSLowerReturn())"] - case .swiftHeapObject: - return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] - case .unsafePointer: - return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] + return ["\(raw: accessor).bridgeJSLowerStackReturn()"] + case .swiftHeapObject, .unsafePointer, .closure: + return ["\(raw: accessor).bridgeJSLowerStackReturn()"] case .swiftProtocol(let protocolName): let wrapperName = "Any\(protocolName)" - return ["_swift_js_push_i32((\(raw: accessor) as! \(raw: wrapperName)).bridgeJSLowerReturn())"] - case .caseEnum: - return ["_swift_js_push_i32(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - return [ - "var __bjs_\(raw: varPrefix) = \(raw: accessor).rawValue", - "__bjs_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", - ] - case .float: - return ["_swift_js_push_f32(\(raw: accessor).bridgeJSLowerParameter())"] - case .double: - return ["_swift_js_push_f64(\(raw: accessor).bridgeJSLowerParameter())"] - default: - return ["_swift_js_push_i32(Int32(\(raw: accessor).bridgeJSLowerParameter()))"] - } - case .associatedValueEnum: - return ["\(raw: accessor).bridgeJSLowerReturn()"] - case .swiftStruct: + return ["(\(raw: accessor) as! \(raw: wrapperName)).bridgeJSLowerStackReturn()"] + case .caseEnum, .rawValueEnum: + return ["\(raw: accessor).bridgeJSLowerStackReturn()"] + case .associatedValueEnum, .swiftStruct: return ["\(raw: accessor).bridgeJSLowerReturn()"] case .optional(let wrappedType): return lowerOptionalStatements(wrappedType: wrappedType, accessor: accessor, varPrefix: varPrefix) - case .void: + case .void, .namespaceEnum: return [] - case .namespaceEnum: - return [] - case .closure: - return ["_swift_js_push_pointer(\(raw: accessor).bridgeJSLowerReturn())"] case .array(let elementType): return lowerArrayStatements(elementType: elementType, accessor: accessor, varPrefix: varPrefix) } @@ -994,6 +920,29 @@ struct StackCodegen { elementType: BridgeType, accessor: String, varPrefix: String + ) -> [CodeBlockItemSyntax] { + switch elementType { + case .int, .uint, .float, .double, .string, .bool, + .jsObject, .swiftStruct, .caseEnum, .swiftHeapObject, + .unsafePointer, .rawValueEnum, .associatedValueEnum: + return ["\(raw: accessor).bridgeJSLowerReturn()"] + case .swiftProtocol(let protocolName): + return ["\(raw: accessor).map { $0 as! Any\(raw: protocolName) }.bridgeJSLowerReturn()"] + case .optional, .array, .closure: + return lowerArrayStatementsInline( + elementType: elementType, + accessor: accessor, + varPrefix: varPrefix + ) + case .void, .namespaceEnum: + fatalError("Invalid array element type: \(elementType)") + } + } + + private func lowerArrayStatementsInline( + elementType: BridgeType, + accessor: String, + varPrefix: String ) -> [CodeBlockItemSyntax] { var statements: [CodeBlockItemSyntax] = [] let elementVarName = "__bjs_elem_\(varPrefix)" @@ -1042,43 +991,20 @@ struct StackCodegen { varPrefix: String ) -> [CodeBlockItemSyntax] { switch wrappedType { - case .string: - return [ - "var __bjs_str_\(raw: varPrefix) = \(raw: unwrappedVar)", - "__bjs_str_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", - ] - case .int, .uint: - return ["_swift_js_push_i32(Int32(\(raw: unwrappedVar)))"] - case .bool: - return ["_swift_js_push_i32(\(raw: unwrappedVar) ? 1 : 0)"] - case .float: - return ["_swift_js_push_f32(\(raw: unwrappedVar))"] - case .double: - return ["_swift_js_push_f64(\(raw: unwrappedVar))"] - case .caseEnum: - return ["_swift_js_push_i32(\(raw: unwrappedVar).bridgeJSLowerParameter())"] - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - return [ - "var __bjs_str_\(raw: varPrefix) = \(raw: unwrappedVar).rawValue", - "__bjs_str_\(raw: varPrefix).withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) }", - ] - case .float: - return ["_swift_js_push_f32(\(raw: unwrappedVar).bridgeJSLowerParameter())"] - case .double: - return ["_swift_js_push_f64(\(raw: unwrappedVar).bridgeJSLowerParameter())"] - default: - return ["_swift_js_push_i32(\(raw: unwrappedVar).bridgeJSLowerParameter())"] - } + case .string, .int, .uint, .bool, .float, .double: + return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] + case .caseEnum, .rawValueEnum: + // Enums conform to _BridgedSwiftStackType + return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] case .swiftStruct: return ["\(raw: unwrappedVar).bridgeJSLowerReturn()"] case .swiftHeapObject: - return ["_swift_js_push_pointer(\(raw: unwrappedVar).bridgeJSLowerReturn())"] + return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] case .associatedValueEnum: + // Push payloads via bridgeJSLowerParameter(), then push the returned case ID return ["_swift_js_push_i32(\(raw: unwrappedVar).bridgeJSLowerParameter())"] case .jsObject: - return ["_swift_js_push_i32(\(raw: unwrappedVar).bridgeJSLowerReturn())"] + return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] case .array(let elementType): return lowerArrayStatements(elementType: elementType, accessor: unwrappedVar, varPrefix: varPrefix) default: @@ -1145,7 +1071,17 @@ struct EnumCodegen { } private func renderRawValueEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { - return "extension \(raw: enumDef.swiftCallName): _BridgedSwiftEnumNoPayload {}" + let typeName = enumDef.swiftCallName + guard enumDef.rawType != nil else { + return """ + extension \(raw: typeName): _BridgedSwiftEnumNoPayload {} + """ + } + // When rawType is present, conform to _BridgedSwiftRawValueEnum which provides + // default implementations for _BridgedSwiftStackType methods via protocol extension. + return """ + extension \(raw: typeName): _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} + """ } private func renderAssociatedValueEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js index 645be1f5a..922b8dbbc 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js @@ -154,7 +154,7 @@ export function main(args) { "// To update this file, just rebuild your project or run", "// `swift package bridge-js`.", "", - "@_spi(Experimental) import JavaScriptKit", + "@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit", "", "", ].join("\n"); diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index e48510466..1d2d0f64f 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -399,7 +399,7 @@ export class TypeProcessor { this.swiftLines.push(` case ${this.renderIdentifier(name)} = "${raw.replaceAll("\"", "\\\\\"")}"`); } this.swiftLines.push("}"); - this.swiftLines.push(`extension ${swiftEnumName}: _BridgedSwiftEnumNoPayload {}`); + this.swiftLines.push(`extension ${swiftEnumName}: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {}`); this.swiftLines.push(""); return; } @@ -410,7 +410,7 @@ export class TypeProcessor { this.swiftLines.push(` case ${this.renderIdentifier(name)} = ${raw}`); } this.swiftLines.push("}"); - this.swiftLines.push(`extension ${swiftEnumName}: _BridgedSwiftEnumNoPayload {}`); + this.swiftLines.push(`extension ${swiftEnumName}: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {}`); this.swiftLines.push(""); return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift index 711694c9d..55a6258b0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift @@ -41,19 +41,19 @@ extension Direction: _BridgedSwiftCaseEnum { } } -extension Status: _BridgedSwiftEnumNoPayload { +extension Status: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } extension Point: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { - let y = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) - let x = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) + let y = Double.bridgeJSLiftParameter() + let x = Double.bridgeJSLiftParameter() return Point(x: x, y: y) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_f64(self.x) - _swift_js_push_f64(self.y) + self.x.bridgeJSLowerStackReturn() + self.y.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -93,19 +93,8 @@ fileprivate func _bjs_struct_lift_Point() -> Int32 { @_cdecl("bjs_processIntArray") public func _bjs_processIntArray() -> Void { #if arch(wasm32) - let ret = processIntArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32(Int32(__bjs_elem_ret))} - _swift_js_push_i32(Int32(ret.count)) + let ret = processIntArray(_: [Int].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -115,22 +104,8 @@ public func _bjs_processIntArray() -> Void { @_cdecl("bjs_processStringArray") public func _bjs_processStringArray() -> Void { #if arch(wasm32) - let ret = processStringArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [String] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - var __bjs_ret_elem = __bjs_elem_ret - __bjs_ret_elem.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - }} - _swift_js_push_i32(Int32(ret.count)) + let ret = processStringArray(_: [String].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -140,19 +115,8 @@ public func _bjs_processStringArray() -> Void { @_cdecl("bjs_processDoubleArray") public func _bjs_processDoubleArray() -> Void { #if arch(wasm32) - let ret = processDoubleArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Double] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_i32(Int32(ret.count)) + let ret = processDoubleArray(_: [Double].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -162,19 +126,8 @@ public func _bjs_processDoubleArray() -> Void { @_cdecl("bjs_processBoolArray") public func _bjs_processBoolArray() -> Void { #if arch(wasm32) - let ret = processBoolArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Bool] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32(__bjs_elem_ret ? 1 : 0)} - _swift_js_push_i32(Int32(ret.count)) + let ret = processBoolArray(_: [Bool].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -184,19 +137,8 @@ public func _bjs_processBoolArray() -> Void { @_cdecl("bjs_processPointArray") public func _bjs_processPointArray() -> Void { #if arch(wasm32) - let ret = processPointArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Point] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Point.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = processPointArray(_: [Point].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -206,19 +148,8 @@ public func _bjs_processPointArray() -> Void { @_cdecl("bjs_processDirectionArray") public func _bjs_processDirectionArray() -> Void { #if arch(wasm32) - let ret = processDirectionArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Direction] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Direction.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_i32(Int32(ret.count)) + let ret = processDirectionArray(_: [Direction].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -228,19 +159,8 @@ public func _bjs_processDirectionArray() -> Void { @_cdecl("bjs_processStatusArray") public func _bjs_processStatusArray() -> Void { #if arch(wasm32) - let ret = processStatusArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Status] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Status.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_i32(Int32(ret.count)) + let ret = processStatusArray(_: [Status].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -250,16 +170,7 @@ public func _bjs_processStatusArray() -> Void { @_cdecl("bjs_sumIntArray") public func _bjs_sumIntArray() -> Int32 { #if arch(wasm32) - let ret = sumIntArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + let ret = sumIntArray(_: [Int].bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -270,16 +181,7 @@ public func _bjs_sumIntArray() -> Int32 { @_cdecl("bjs_findFirstPoint") public func _bjs_findFirstPoint(_ matchingBytes: Int32, _ matchingLength: Int32) -> Void { #if arch(wasm32) - let ret = findFirstPoint(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Point] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Point.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }(), matching: String.bridgeJSLiftParameter(matchingBytes, matchingLength)) + let ret = findFirstPoint(_: [Point].bridgeJSLiftParameter(), matching: String.bridgeJSLiftParameter(matchingBytes, matchingLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -290,19 +192,8 @@ public func _bjs_findFirstPoint(_ matchingBytes: Int32, _ matchingLength: Int32) @_cdecl("bjs_processUnsafeRawPointerArray") public func _bjs_processUnsafeRawPointerArray() -> Void { #if arch(wasm32) - let ret = processUnsafeRawPointerArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [UnsafeRawPointer] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(ret.count)) + let ret = processUnsafeRawPointerArray(_: [UnsafeRawPointer].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -312,19 +203,8 @@ public func _bjs_processUnsafeRawPointerArray() -> Void { @_cdecl("bjs_processUnsafeMutableRawPointerArray") public func _bjs_processUnsafeMutableRawPointerArray() -> Void { #if arch(wasm32) - let ret = processUnsafeMutableRawPointerArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [UnsafeMutableRawPointer] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(ret.count)) + let ret = processUnsafeMutableRawPointerArray(_: [UnsafeMutableRawPointer].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -334,19 +214,8 @@ public func _bjs_processUnsafeMutableRawPointerArray() -> Void { @_cdecl("bjs_processOpaquePointerArray") public func _bjs_processOpaquePointerArray() -> Void { #if arch(wasm32) - let ret = processOpaquePointerArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [OpaquePointer] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_pointer())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(ret.count)) + let ret = processOpaquePointerArray(_: [OpaquePointer].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -361,7 +230,7 @@ public func _bjs_processOptionalIntArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -369,7 +238,7 @@ public func _bjs_processOptionalIntArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_i32(Int32(__bjs_unwrapped_ret_elem))} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} _swift_js_push_i32(Int32(ret.count)) #else @@ -386,7 +255,7 @@ public func _bjs_processOptionalStringArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -394,10 +263,7 @@ public func _bjs_processOptionalStringArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - var __bjs_str_ret_elem = __bjs_unwrapped_ret_elem - __bjs_str_ret_elem.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - }} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} _swift_js_push_i32(Int32(ret.count)) #else @@ -413,23 +279,12 @@ public func _bjs_processOptionalArray(_ values: Int32) -> Void { if values == 0 { return Optional<[Int]>.none } else { - return { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }() + return [Int].bridgeJSLiftParameter() } }()) let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - for __bjs_elem_ret in __bjs_unwrapped_ret { - _swift_js_push_i32(Int32(__bjs_elem_ret))} - _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + __bjs_unwrapped_ret.bridgeJSLowerReturn()} _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -445,7 +300,7 @@ public func _bjs_processOptionalPointArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -470,7 +325,7 @@ public func _bjs_processOptionalDirectionArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -478,7 +333,7 @@ public func _bjs_processOptionalDirectionArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_i32(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} _swift_js_push_i32(Int32(ret.count)) #else @@ -495,7 +350,7 @@ public func _bjs_processOptionalStatusArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -503,7 +358,7 @@ public func _bjs_processOptionalStatusArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_i32(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} _swift_js_push_i32(Int32(ret.count)) #else @@ -520,24 +375,13 @@ public func _bjs_processNestedIntArray() -> Void { var __result: [[Int]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + __result.append([Int].bridgeJSLiftParameter()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_i32(Int32(__bjs_elem_ret_elem))} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -553,27 +397,13 @@ public func _bjs_processNestedStringArray() -> Void { var __result: [[String]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [String] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + __result.append([String].bridgeJSLiftParameter()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - var __bjs_ret_elem_elem = __bjs_elem_ret_elem - __bjs_ret_elem_elem.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - }} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -589,24 +419,13 @@ public func _bjs_processNestedPointArray() -> Void { var __result: [[Point]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [Point] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Point.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) + __result.append([Point].bridgeJSLiftParameter()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - __bjs_elem_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -617,19 +436,8 @@ public func _bjs_processNestedPointArray() -> Void { @_cdecl("bjs_processItemArray") public func _bjs_processItemArray() -> Void { #if arch(wasm32) - let ret = processItemArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Item] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Item.bridgeJSLiftParameter(_swift_js_pop_pointer())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(ret.count)) + let ret = processItemArray(_: [Item].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -644,24 +452,13 @@ public func _bjs_processNestedItemArray() -> Void { var __result: [[Item]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [Item] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Item.bridgeJSLiftParameter(_swift_js_pop_pointer())) - } - __result.reverse() - return __result - }()) + __result.append([Item].bridgeJSLiftParameter()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_pointer(__bjs_elem_ret_elem.bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index 5232bdd53..4c4c69c99 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -39,19 +39,16 @@ extension Status: _BridgedSwiftCaseEnum { extension Config: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Config { - let enabled = Bool.bridgeJSLiftParameter(_swift_js_pop_i32()) - let value = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let enabled = Bool.bridgeJSLiftParameter() + let value = Int.bridgeJSLiftParameter() + let name = String.bridgeJSLiftParameter() return Config(name: name, value: value, enabled: enabled) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - var __bjs_name = self.name - __bjs_name.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(self.value)) - _swift_js_push_i32(self.enabled ? 1 : 0) + self.name.bridgeJSLowerStackReturn() + self.value.bridgeJSLowerStackReturn() + self.enabled.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -89,12 +86,12 @@ fileprivate func _bjs_struct_lift_Config() -> Int32 { extension MathOperations: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MathOperations { - let baseValue = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) + let baseValue = Double.bridgeJSLiftParameter() return MathOperations(baseValue: baseValue) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_f64(self.baseValue) + self.baseValue.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -321,19 +318,8 @@ public func _bjs_testOptionalStructWithValueDefault(_ point: Int32) -> Void { @_cdecl("bjs_testIntArrayDefault") public func _bjs_testIntArrayDefault() -> Void { #if arch(wasm32) - let ret = testIntArrayDefault(values: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32(Int32(__bjs_elem_ret))} - _swift_js_push_i32(Int32(ret.count)) + let ret = testIntArrayDefault(values: [Int].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -343,22 +329,8 @@ public func _bjs_testIntArrayDefault() -> Void { @_cdecl("bjs_testStringArrayDefault") public func _bjs_testStringArrayDefault() -> Void { #if arch(wasm32) - let ret = testStringArrayDefault(names: { - let __count = Int(_swift_js_pop_i32()) - var __result: [String] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - var __bjs_ret_elem = __bjs_elem_ret - __bjs_ret_elem.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - }} - _swift_js_push_i32(Int32(ret.count)) + let ret = testStringArrayDefault(names: [String].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -368,19 +340,8 @@ public func _bjs_testStringArrayDefault() -> Void { @_cdecl("bjs_testDoubleArrayDefault") public func _bjs_testDoubleArrayDefault() -> Void { #if arch(wasm32) - let ret = testDoubleArrayDefault(values: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Double] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_i32(Int32(ret.count)) + let ret = testDoubleArrayDefault(values: [Double].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -390,19 +351,8 @@ public func _bjs_testDoubleArrayDefault() -> Void { @_cdecl("bjs_testBoolArrayDefault") public func _bjs_testBoolArrayDefault() -> Void { #if arch(wasm32) - let ret = testBoolArrayDefault(flags: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Bool] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32(__bjs_elem_ret ? 1 : 0)} - _swift_js_push_i32(Int32(ret.count)) + let ret = testBoolArrayDefault(flags: [Bool].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -412,19 +362,8 @@ public func _bjs_testBoolArrayDefault() -> Void { @_cdecl("bjs_testEmptyArrayDefault") public func _bjs_testEmptyArrayDefault() -> Void { #if arch(wasm32) - let ret = testEmptyArrayDefault(items: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32(Int32(__bjs_elem_ret))} - _swift_js_push_i32(Int32(ret.count)) + let ret = testEmptyArrayDefault(items: [Int].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -434,16 +373,7 @@ public func _bjs_testEmptyArrayDefault() -> Void { @_cdecl("bjs_testMixedWithArrayDefault") public func _bjs_testMixedWithArrayDefault(_ nameBytes: Int32, _ nameLength: Int32, _ enabled: Int32) -> Void { #if arch(wasm32) - let ret = testMixedWithArrayDefault(name: String.bridgeJSLiftParameter(nameBytes, nameLength), values: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }(), enabled: Bool.bridgeJSLiftParameter(enabled)) + let ret = testMixedWithArrayDefault(name: String.bridgeJSLiftParameter(nameBytes, nameLength), values: [Int].bridgeJSLiftParameter(), enabled: Bool.bridgeJSLiftParameter(enabled)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift index e35da2f77..0854cba74 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift @@ -2,15 +2,15 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .failure(Int.bridgeJSLiftParameter()) case 2: - return .flag(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .flag(Bool.bridgeJSLiftParameter()) case 3: - return .rate(Float.bridgeJSLiftParameter(_swift_js_pop_f32())) + return .rate(Float.bridgeJSLiftParameter()) case 4: - return .precise(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) + return .precise(Double.bridgeJSLiftParameter()) case 5: return .info default: @@ -23,22 +23,19 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .failure(let param0): - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() return Int32(1) case .flag(let param0): - _swift_js_push_i32(param0 ? 1 : 0) + param0.bridgeJSLowerStackReturn() return Int32(2) case .rate(let param0): - _swift_js_push_f32(param0) + param0.bridgeJSLowerStackReturn() return Int32(3) case .precise(let param0): - _swift_js_push_f64(param0) + param0.bridgeJSLowerStackReturn() return Int32(4) case .info: return Int32(5) @@ -59,22 +56,19 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() case .flag(let param0): _swift_js_push_tag(Int32(2)) - _swift_js_push_i32(param0 ? 1 : 0) + param0.bridgeJSLowerStackReturn() case .rate(let param0): _swift_js_push_tag(Int32(3)) - _swift_js_push_f32(param0) + param0.bridgeJSLowerStackReturn() case .precise(let param0): _swift_js_push_tag(Int32(4)) - _swift_js_push_f64(param0) + param0.bridgeJSLowerStackReturn() case .info: _swift_js_push_tag(Int32(5)) } @@ -85,15 +79,15 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .error(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .error(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) case 2: - return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .status(Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) case 3: - return .coordinates(Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64())) + return .coordinates(Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter()) case 4: - return .comprehensive(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .comprehensive(Bool.bridgeJSLiftParameter(), Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), String.bridgeJSLiftParameter(), String.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) case 5: return .info default: @@ -106,50 +100,32 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .error(let param0, let param1): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() return Int32(1) case .status(let param0, let param1, let param2): - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(Int32(param1)) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() return Int32(2) case .coordinates(let param0, let param1, let param2): - _swift_js_push_f64(param0) - _swift_js_push_f64(param1) - _swift_js_push_f64(param2) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() return Int32(3) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(param1 ? 1 : 0) - _swift_js_push_i32(Int32(param2)) - _swift_js_push_i32(Int32(param3)) - _swift_js_push_f64(param4) - _swift_js_push_f64(param5) - var __bjs_param6 = param6 - __bjs_param6.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_param7 = param7 - __bjs_param7.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_param8 = param8 - __bjs_param8.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() + param3.bridgeJSLowerStackReturn() + param4.bridgeJSLowerStackReturn() + param5.bridgeJSLowerStackReturn() + param6.bridgeJSLowerStackReturn() + param7.bridgeJSLowerStackReturn() + param8.bridgeJSLowerStackReturn() return Int32(4) case .info: return Int32(5) @@ -170,50 +146,32 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .error(let param0, let param1): _swift_js_push_tag(Int32(1)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(Int32(param1)) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() case .coordinates(let param0, let param1, let param2): _swift_js_push_tag(Int32(3)) - _swift_js_push_f64(param0) - _swift_js_push_f64(param1) - _swift_js_push_f64(param2) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): _swift_js_push_tag(Int32(4)) - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(param1 ? 1 : 0) - _swift_js_push_i32(Int32(param2)) - _swift_js_push_i32(Int32(param3)) - _swift_js_push_f64(param4) - _swift_js_push_f64(param5) - var __bjs_param6 = param6 - __bjs_param6.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_param7 = param7 - __bjs_param7.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_param8 = param8 - __bjs_param8.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() + param3.bridgeJSLowerStackReturn() + param4.bridgeJSLowerStackReturn() + param5.bridgeJSLowerStackReturn() + param6.bridgeJSLowerStackReturn() + param7.bridgeJSLowerStackReturn() + param8.bridgeJSLowerStackReturn() case .info: _swift_js_push_tag(Int32(5)) } @@ -224,11 +182,11 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Utilities.Result { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .failure(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .failure(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) case 2: - return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .status(Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) default: fatalError("Unknown Utilities.Result case ID: \(caseId)") } @@ -239,25 +197,16 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .failure(let param0, let param1): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() return Int32(1) case .status(let param0, let param1, let param2): - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(Int32(param1)) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() return Int32(2) } } @@ -276,25 +225,16 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .failure(let param0, let param1): _swift_js_push_tag(Int32(1)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(Int32(param1)) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() } } } @@ -303,9 +243,9 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> NetworkingResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .failure(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .failure(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) default: fatalError("Unknown NetworkingResult case ID: \(caseId)") } @@ -316,17 +256,11 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .failure(let param0, let param1): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() return Int32(1) } } @@ -345,17 +279,11 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .failure(let param0, let param1): _swift_js_push_tag(Int32(1)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() } } } @@ -364,11 +292,11 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIOptionalResult { switch caseId { case 0: - return .success(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(Optional.bridgeJSLiftParameter()) case 1: - return .failure(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .failure(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) case 2: - return .status(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())) + return .status(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) default: fatalError("Unknown APIOptionalResult case ID: \(caseId)") } @@ -381,42 +309,36 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { case .success(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - var __bjs_str_param0 = __bjs_unwrapped_param0 - __bjs_str_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(0) case .failure(let param0, let param1): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(Int32(__bjs_unwrapped_param0)) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_i32(__bjs_unwrapped_param1 ? 1 : 0) + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) return Int32(1) case .status(let param0, let param1, let param2): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0 ? 1 : 0) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_i32(Int32(__bjs_unwrapped_param1)) + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { - var __bjs_str_param2 = __bjs_unwrapped_param2 - __bjs_str_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + __bjs_unwrapped_param2.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) return Int32(2) @@ -439,42 +361,36 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_tag(Int32(0)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - var __bjs_str_param0 = __bjs_unwrapped_param0 - __bjs_str_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) case .failure(let param0, let param1): _swift_js_push_tag(Int32(1)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(Int32(__bjs_unwrapped_param0)) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_i32(__bjs_unwrapped_param1 ? 1 : 0) + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0 ? 1 : 0) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_i32(Int32(__bjs_unwrapped_param1)) + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { - var __bjs_str_param2 = __bjs_unwrapped_param2 - __bjs_str_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + __bjs_unwrapped_param2.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift index 43e3f69a4..b1b5e9c8c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift @@ -41,10 +41,10 @@ extension Networking.API.Method: _BridgedSwiftCaseEnum { } } -extension Configuration.LogLevel: _BridgedSwiftEnumNoPayload { +extension Configuration.LogLevel: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension Configuration.Port: _BridgedSwiftEnumNoPayload { +extension Configuration.Port: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } extension Internal.SupportedMethod: _BridgedSwiftCaseEnum { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift index 43e3f69a4..b1b5e9c8c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift @@ -41,10 +41,10 @@ extension Networking.API.Method: _BridgedSwiftCaseEnum { } } -extension Configuration.LogLevel: _BridgedSwiftEnumNoPayload { +extension Configuration.LogLevel: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension Configuration.Port: _BridgedSwiftEnumNoPayload { +extension Configuration.Port: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } extension Internal.SupportedMethod: _BridgedSwiftCaseEnum { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift index 12fdeba04..55c902af0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift @@ -1,37 +1,37 @@ -extension Theme: _BridgedSwiftEnumNoPayload { +extension Theme: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension TSTheme: _BridgedSwiftEnumNoPayload { +extension TSTheme: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension FeatureFlag: _BridgedSwiftEnumNoPayload { +extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension HttpStatus: _BridgedSwiftEnumNoPayload { +extension HttpStatus: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension TSHttpStatus: _BridgedSwiftEnumNoPayload { +extension TSHttpStatus: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension Priority: _BridgedSwiftEnumNoPayload { +extension Priority: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension FileSize: _BridgedSwiftEnumNoPayload { +extension FileSize: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension UserId: _BridgedSwiftEnumNoPayload { +extension UserId: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension TokenId: _BridgedSwiftEnumNoPayload { +extension TokenId: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension SessionId: _BridgedSwiftEnumNoPayload { +extension SessionId: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension Precision: _BridgedSwiftEnumNoPayload { +extension Precision: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension Ratio: _BridgedSwiftEnumNoPayload { +extension Ratio: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } @_expose(wasm, "bjs_setTheme") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index 0558e2a1f..21178521d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -359,16 +359,16 @@ extension Direction: _BridgedSwiftCaseEnum { } } -extension ExampleEnum: _BridgedSwiftEnumNoPayload { +extension ExampleEnum: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } extension Result: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Result { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .failure(Int.bridgeJSLiftParameter()) default: fatalError("Unknown Result case ID: \(caseId)") } @@ -379,13 +379,10 @@ extension Result: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .failure(let param0): - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() return Int32(1) } } @@ -404,37 +401,25 @@ extension Result: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() } } } -extension Priority: _BridgedSwiftEnumNoPayload { +extension Priority: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } @_expose(wasm, "bjs_processDelegates") @_cdecl("bjs_processDelegates") public func _bjs_processDelegates() -> Void { #if arch(wasm32) - let ret = processDelegates(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [AnyMyViewControllerDelegate] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(AnyMyViewControllerDelegate.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32((__bjs_elem_ret as! AnyMyViewControllerDelegate).bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(ret.count)) + let ret = processDelegates(_: [AnyMyViewControllerDelegate].bridgeJSLiftParameter()) + ret.map { + $0 as! AnyMyViewControllerDelegate + } .bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -653,16 +638,7 @@ fileprivate func _bjs_MyViewController_wrap(_ pointer: UnsafeMutableRawPointer) @_cdecl("bjs_DelegateManager_init") public func _bjs_DelegateManager_init() -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = DelegateManager(delegates: { - let __count = Int(_swift_js_pop_i32()) - var __result: [AnyMyViewControllerDelegate] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(AnyMyViewControllerDelegate.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + let ret = DelegateManager(delegates: [AnyMyViewControllerDelegate].bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -684,9 +660,9 @@ public func _bjs_DelegateManager_notifyAll(_ _self: UnsafeMutableRawPointer) -> public func _bjs_DelegateManager_delegates_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = DelegateManager.bridgeJSLiftParameter(_self).delegates - for __bjs_elem_ret in ret { - _swift_js_push_i32((__bjs_elem_ret as! AnyMyViewControllerDelegate).bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(ret.count)) + ret.map { + $0 as! AnyMyViewControllerDelegate + } .bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -696,16 +672,7 @@ public func _bjs_DelegateManager_delegates_get(_ _self: UnsafeMutableRawPointer) @_cdecl("bjs_DelegateManager_delegates_set") public func _bjs_DelegateManager_delegates_set(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - DelegateManager.bridgeJSLiftParameter(_self).delegates = { - let __count = Int(_swift_js_pop_i32()) - var __result: [AnyMyViewControllerDelegate] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(AnyMyViewControllerDelegate.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }() + DelegateManager.bridgeJSLiftParameter(_self).delegates = [AnyMyViewControllerDelegate].bridgeJSLiftParameter() #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift index 378eff8bb..ed6cb98c0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift @@ -48,9 +48,9 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .failure(Int.bridgeJSLiftParameter()) default: fatalError("Unknown APIResult case ID: \(caseId)") } @@ -61,13 +61,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .failure(let param0): - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() return Int32(1) } } @@ -86,13 +83,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift index 378eff8bb..ed6cb98c0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift @@ -48,9 +48,9 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .failure(Int.bridgeJSLiftParameter()) default: fatalError("Unknown APIResult case ID: \(caseId)") } @@ -61,13 +61,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .failure(let param0): - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() return Int32(1) } } @@ -86,13 +83,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift index 415aa54f6..df6046693 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift @@ -667,25 +667,25 @@ extension Direction: _BridgedSwiftCaseEnum { } } -extension Theme: _BridgedSwiftEnumNoPayload { +extension Theme: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension HttpStatus: _BridgedSwiftEnumNoPayload { +extension HttpStatus: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .failure(Int.bridgeJSLiftParameter()) case 2: - return .flag(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .flag(Bool.bridgeJSLiftParameter()) case 3: - return .rate(Float.bridgeJSLiftParameter(_swift_js_pop_f32())) + return .rate(Float.bridgeJSLiftParameter()) case 4: - return .precise(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) + return .precise(Double.bridgeJSLiftParameter()) case 5: return .info default: @@ -698,22 +698,19 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .failure(let param0): - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() return Int32(1) case .flag(let param0): - _swift_js_push_i32(param0 ? 1 : 0) + param0.bridgeJSLowerStackReturn() return Int32(2) case .rate(let param0): - _swift_js_push_f32(param0) + param0.bridgeJSLowerStackReturn() return Int32(3) case .precise(let param0): - _swift_js_push_f64(param0) + param0.bridgeJSLowerStackReturn() return Int32(4) case .info: return Int32(5) @@ -734,22 +731,19 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() case .flag(let param0): _swift_js_push_tag(Int32(2)) - _swift_js_push_i32(param0 ? 1 : 0) + param0.bridgeJSLowerStackReturn() case .rate(let param0): _swift_js_push_tag(Int32(3)) - _swift_js_push_f32(param0) + param0.bridgeJSLowerStackReturn() case .precise(let param0): _swift_js_push_tag(Int32(4)) - _swift_js_push_f64(param0) + param0.bridgeJSLowerStackReturn() case .info: _swift_js_push_tag(Int32(5)) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift index af4428979..9b7ddd024 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift @@ -1,31 +1,28 @@ -extension Precision: _BridgedSwiftEnumNoPayload { +extension Precision: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } extension DataPoint: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> DataPoint { - let optFlag = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let optCount = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let label = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let y = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) - let x = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) + let optFlag = Optional.bridgeJSLiftParameter() + let optCount = Optional.bridgeJSLiftParameter() + let label = String.bridgeJSLiftParameter() + let y = Double.bridgeJSLiftParameter() + let x = Double.bridgeJSLiftParameter() return DataPoint(x: x, y: y, label: label, optCount: optCount, optFlag: optFlag) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_f64(self.x) - _swift_js_push_f64(self.y) - var __bjs_label = self.label - __bjs_label.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + self.x.bridgeJSLowerStackReturn() + self.y.bridgeJSLowerStackReturn() + self.label.bridgeJSLowerStackReturn() let __bjs_isSome_optCount = self.optCount != nil if let __bjs_unwrapped_optCount = self.optCount { - _swift_js_push_i32(Int32(__bjs_unwrapped_optCount)) + __bjs_unwrapped_optCount.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optCount ? 1 : 0) let __bjs_isSome_optFlag = self.optFlag != nil if let __bjs_unwrapped_optFlag = self.optFlag { - _swift_js_push_i32(__bjs_unwrapped_optFlag ? 1 : 0) + __bjs_unwrapped_optFlag.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optFlag ? 1 : 0) } @@ -76,24 +73,18 @@ public func _bjs_DataPoint_init(_ x: Float64, _ y: Float64, _ labelBytes: Int32, extension Address: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Address { - let zipCode = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let city = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let street = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let zipCode = Optional.bridgeJSLiftParameter() + let city = String.bridgeJSLiftParameter() + let street = String.bridgeJSLiftParameter() return Address(street: street, city: city, zipCode: zipCode) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - var __bjs_street = self.street - __bjs_street.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_city = self.city - __bjs_city.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + self.street.bridgeJSLowerStackReturn() + self.city.bridgeJSLowerStackReturn() let __bjs_isSome_zipCode = self.zipCode != nil if let __bjs_unwrapped_zipCode = self.zipCode { - _swift_js_push_i32(Int32(__bjs_unwrapped_zipCode)) + __bjs_unwrapped_zipCode.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_zipCode ? 1 : 0) } @@ -133,26 +124,20 @@ fileprivate func _bjs_struct_lift_Address() -> Int32 { extension Person: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Person { - let email = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32()) + let email = Optional.bridgeJSLiftParameter() let address = Address.bridgeJSLiftParameter() - let age = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let age = Int.bridgeJSLiftParameter() + let name = String.bridgeJSLiftParameter() return Person(name: name, age: age, address: address, email: email) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - var __bjs_name = self.name - __bjs_name.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(self.age)) + self.name.bridgeJSLowerStackReturn() + self.age.bridgeJSLowerStackReturn() self.address.bridgeJSLowerReturn() let __bjs_isSome_email = self.email != nil if let __bjs_unwrapped_email = self.email { - var __bjs_str_email = __bjs_unwrapped_email - __bjs_str_email.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + __bjs_unwrapped_email.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_email ? 1 : 0) } @@ -192,14 +177,14 @@ fileprivate func _bjs_struct_lift_Person() -> Int32 { extension Session: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Session { - let owner = Greeter.bridgeJSLiftParameter(_swift_js_pop_pointer()) - let id = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let owner = Greeter.bridgeJSLiftParameter() + let id = Int.bridgeJSLiftParameter() return Session(id: id, owner: owner) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_i32(Int32(self.id)) - _swift_js_push_pointer(self.owner.bridgeJSLowerReturn()) + self.id.bridgeJSLowerStackReturn() + self.owner.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -237,18 +222,18 @@ fileprivate func _bjs_struct_lift_Session() -> Int32 { extension Measurement: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Measurement { - let optionalPrecision = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f32()) + let optionalPrecision = Optional.bridgeJSLiftParameter() let precision = Precision.bridgeJSLiftParameter(_swift_js_pop_f32()) - let value = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) + let value = Double.bridgeJSLiftParameter() return Measurement(value: value, precision: precision, optionalPrecision: optionalPrecision) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_f64(self.value) - _swift_js_push_f32(self.precision.bridgeJSLowerParameter()) + self.value.bridgeJSLowerStackReturn() + self.precision.bridgeJSLowerStackReturn() let __bjs_isSome_optionalPrecision = self.optionalPrecision != nil if let __bjs_unwrapped_optionalPrecision = self.optionalPrecision { - _swift_js_push_f32(__bjs_unwrapped_optionalPrecision.bridgeJSLowerParameter()) + __bjs_unwrapped_optionalPrecision.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optionalPrecision ? 1 : 0) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift index 4c368908b..752cc6bc3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift @@ -1,19 +1,19 @@ extension PointerFields: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PointerFields { - let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) - let ptr = UnsafePointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) - let opaque = OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) - let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) - let raw = UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) + let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter() + let ptr = UnsafePointer.bridgeJSLiftParameter() + let opaque = OpaquePointer.bridgeJSLiftParameter() + let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter() + let raw = UnsafeRawPointer.bridgeJSLiftParameter() return PointerFields(raw: raw, mutRaw: mutRaw, opaque: opaque, ptr: ptr, mutPtr: mutPtr) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_pointer(self.raw.bridgeJSLowerReturn()) - _swift_js_push_pointer(self.mutRaw.bridgeJSLowerReturn()) - _swift_js_push_pointer(self.opaque.bridgeJSLowerReturn()) - _swift_js_push_pointer(self.ptr.bridgeJSLowerReturn()) - _swift_js_push_pointer(self.mutPtr.bridgeJSLowerReturn()) + self.raw.bridgeJSLowerStackReturn() + self.mutRaw.bridgeJSLowerStackReturn() + self.opaque.bridgeJSLowerStackReturn() + self.ptr.bridgeJSLowerStackReturn() + self.mutPtr.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift index cf1118df0..551385093 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func checkArray(_ a: JSObject) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift index dd0377377..032fcadfc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func asyncReturnVoid() throws (JSException) -> JSPromise diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift index 5d13234ca..8c60cd218 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func returnAnimatable() throws (JSException) -> Animatable diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift index 43d6a3eb9..37ccd0287 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func createArrayBuffer() throws (JSException) -> ArrayBufferLike diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift index 47efcbc84..f7b2ebc3b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func createDatabaseConnection(_ config: JSObject) throws (JSException) -> DatabaseConnection diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift index eea42f30d..72f503afa 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift @@ -4,6 +4,6 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func check(_ a: Double, _ b: Bool) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift index 15867131d..1f24ec359 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func checkNumber() throws (JSException) -> Double diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.Macros.swift index 0c0dfb362..f71778e26 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func jsRoundTripNumber(_ v: Double) throws (JSException) -> Double diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.Macros.swift index b0049af28..7140ecac7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.Macros.swift @@ -4,13 +4,13 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit enum FeatureFlag: String { case foo = "foo" case bar = "bar" } -extension FeatureFlag: _BridgedSwiftEnumNoPayload {} +extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} @JSFunction func takesFeatureFlag(_ flag: FeatureFlag) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift index 38fe0dd2b..75ba0eefd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func checkString(_ a: String) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift index 60aae03c4..c7618d7ac 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift @@ -4,6 +4,6 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func checkString() throws (JSException) -> String diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift index e0d6c9d24..eab06f1db 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func createTS2Skeleton() throws (JSException) -> TypeScriptProcessor diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift index 62b2b4663..ef9500566 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift @@ -4,6 +4,6 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func checkSimple(_ a: Double) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift index 1fbf3376d..a0857a57e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSClass struct Greeter { @JSGetter var name: String diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift index b3a7fc6f6..7247e3aff 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift @@ -4,6 +4,6 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func check() throws (JSException) -> Void diff --git a/Plugins/PackageToJS/Templates/instantiate.js b/Plugins/PackageToJS/Templates/instantiate.js index 54a7212c6..c17d78841 100644 --- a/Plugins/PackageToJS/Templates/instantiate.js +++ b/Plugins/PackageToJS/Templates/instantiate.js @@ -62,6 +62,9 @@ async function createInstantiator(options, swift) { swift_js_get_optional_double_presence: unexpectedBjsCall, swift_js_get_optional_double_value: unexpectedBjsCall, swift_js_get_optional_heap_object_pointer: unexpectedBjsCall, + swift_js_push_pointer: unexpectedBjsCall, + swift_js_pop_pointer: unexpectedBjsCall, + swift_js_struct_cleanup: unexpectedBjsCall, } }, /** @param {WebAssembly.Instance} instance */ diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 1e7893c82..7b2d97f06 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -64,6 +64,8 @@ import _CJavaScriptKit // // MARK: ExportSwift // @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ ...) -> <#Self#> { // } +// @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> <#Self#> { +// } // @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> <#WasmCoreType#> { // } // } @@ -75,7 +77,10 @@ import _CJavaScriptKit // - `func bridgeJSLowerParameter()`: lower the given higher-level parameter to a WebAssembly core type // - `func bridgeJSLiftReturn(_ ...) -> <#TargetType#>`: lift the given Wasm core type return value to a higher-level type // - `func bridgeJSLiftParameter(_ ...) -> <#TargetType#>`: lift the given Wasm core type parameters to a higher-level type +// - `func bridgeJSLiftParameter() -> <#TargetType#>`: no-arg overload that pops parameters from the param stack internally. +// Note: Pop order must match Swift's left-to-right argument evaluation order. // - `func bridgeJSLowerReturn() -> <#WasmCoreType#>`: lower the given higher-level return value to a Wasm core type +// - `func bridgeJSLowerStackReturn()`: push the value onto the return stack (used by _BridgedSwiftStackType for array elements) // // Optional types (ExportSwift only) additionally define: // - `func bridgeJSLowerParameterWithRetain()`: lower optional heap object with ownership transfer for escaping closures @@ -94,7 +99,13 @@ public protocol _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { consuming func bridgeJSLowerReturn() -> WasmCoreType } -extension Bool: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { +public protocol _BridgedSwiftStackType { + associatedtype StackLiftResult = Self + static func bridgeJSLiftParameter() -> StackLiftResult + consuming func bridgeJSLowerStackReturn() +} + +extension Bool: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { self ? 1 : 0 @@ -106,12 +117,18 @@ extension Bool: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Bool { value == 1 } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Bool { + bridgeJSLiftParameter(_swift_js_pop_i32()) + } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { self ? 1 : 0 } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_i32(self ? 1 : 0) + } } -extension Int: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { +extension Int: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { Int32(self) @@ -123,12 +140,18 @@ extension Int: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Int { Int(value) } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Int { + bridgeJSLiftParameter(_swift_js_pop_i32()) + } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { Int32(self) } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_i32(Int32(self)) + } } -extension UInt: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { +extension UInt: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { Int32(bitPattern: UInt32(self)) @@ -140,12 +163,54 @@ extension UInt: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> UInt { UInt(UInt32(bitPattern: value)) } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UInt { + bridgeJSLiftParameter(_swift_js_pop_i32()) + } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { Int32(bitPattern: UInt32(self)) } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_i32(Int32(bitPattern: UInt32(self))) + } +} + +extension Int32: _BridgedSwiftStackType { + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Int32 { + _swift_js_pop_i32() + } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_i32(self) + } +} + +extension Int64: _BridgedSwiftStackType { + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Int64 { + Int64(_swift_js_pop_i32()) + } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_i32(Int32(self)) + } +} + +extension UInt32: _BridgedSwiftStackType { + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UInt32 { + UInt32(bitPattern: _swift_js_pop_i32()) + } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_i32(Int32(bitPattern: self)) + } } -extension Float: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { +extension UInt64: _BridgedSwiftStackType { + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UInt64 { + UInt64(UInt32(bitPattern: _swift_js_pop_i32())) + } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_i32(Int32(bitPattern: UInt32(self))) + } +} + +extension Float: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Float32 { Float32(self) @@ -157,12 +222,18 @@ extension Float: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Float32) -> Float { Float(value) } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Float { + bridgeJSLiftParameter(_swift_js_pop_f32()) + } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Float32 { Float32(self) } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_f32(Float32(self)) + } } -extension Double: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { +extension Double: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Float64 { Float64(self) @@ -174,12 +245,20 @@ extension Double: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Float64) -> Double { Double(value) } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Double { + bridgeJSLiftParameter(_swift_js_pop_f64()) + } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Float64 { Float64(self) } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_f64(Float64(self)) + } } -extension String { +extension String: _BridgedSwiftStackType { + public typealias StackLiftResult = String + // MARK: ImportTS @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { @@ -210,14 +289,30 @@ extension String { } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> String { + let bytes = _swift_js_pop_i32() + let count = _swift_js_pop_i32() + return bridgeJSLiftParameter(bytes, count) + } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { return self.withUTF8 { ptr in _swift_js_return_string(ptr.baseAddress, Int32(ptr.count)) } } + + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + self.withUTF8 { ptr in + _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) + } + } } -extension JSObject { +extension JSObject: _BridgedSwiftStackType { + // JSObject is a non-final class, so we must explicitly specify the associated type + // rather than relying on the default `Self` (which Swift requires for covariant returns). + public typealias StackLiftResult = JSObject + // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { @@ -233,15 +328,23 @@ extension JSObject { JSObject(id: JavaScriptObjectRef(bitPattern: id)) } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> JSObject { + bridgeJSLiftParameter(_swift_js_pop_i32()) + } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Int32 { return _swift_js_retain(Int32(bitPattern: self.id)) } + + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_i32(bridgeJSLowerReturn()) + } } /// A protocol that Swift heap objects exposed to JavaScript via `@JS class` must conform to. /// /// The conformance is automatically synthesized by the BridgeJS code generator. -public protocol _BridgedSwiftHeapObject: AnyObject {} +public protocol _BridgedSwiftHeapObject: AnyObject, _BridgedSwiftStackType {} /// Define the lowering/lifting for `_BridgedSwiftHeapObject` extension _BridgedSwiftHeapObject { @@ -260,10 +363,16 @@ extension _BridgedSwiftHeapObject { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ pointer: UnsafeMutableRawPointer) -> Self { Unmanaged.fromOpaque(pointer).takeUnretainedValue() } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + bridgeJSLiftParameter(_swift_js_pop_pointer()) + } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { // Perform a manual retain on the object, which will be balanced by a release called via FinalizationRegistry return Unmanaged.passRetained(self).toOpaque() } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_pointer(Unmanaged.passRetained(self).toOpaque()) + } } // MARK: Closure Box Protocol @@ -289,17 +398,25 @@ extension _JSBridgedClass { /// A protocol that Swift protocol wrappers exposed from JavaScript must conform to. /// /// The conformance is automatically synthesized by the BridgeJS code generator. -public protocol _BridgedSwiftProtocolWrapper { +public protocol _BridgedSwiftProtocolWrapper: _BridgedSwiftStackType { var jsObject: JSObject { get } static func bridgeJSLiftParameter(_ value: Int32) -> Self } extension _BridgedSwiftProtocolWrapper { // MARK: ExportSwift + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + bridgeJSLiftParameter(_swift_js_pop_i32()) + } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Int32 { jsObject.bridgeJSLowerReturn() } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_i32(jsObject.bridgeJSLowerReturn()) + } + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { jsObject.bridgeJSLowerParameter() } @@ -310,10 +427,29 @@ extension _BridgedSwiftProtocolWrapper { /// The conformance is automatically synthesized by the BridgeJS code generator. public protocol _BridgedSwiftEnumNoPayload {} +/// A protocol for raw value enums that enables automatic stack operations. +/// +/// Conforming to this protocol provides default implementations of `_BridgedSwiftStackType` +/// methods by delegating to the raw value's stack operations. The raw value type must itself +/// conform to `_BridgedSwiftStackType`. +/// +/// The conformance is automatically synthesized by the BridgeJS code generator. +public protocol _BridgedSwiftRawValueEnum: _BridgedSwiftStackType, RawRepresentable +where RawValue: _BridgedSwiftStackType, RawValue.StackLiftResult == RawValue {} + +extension _BridgedSwiftRawValueEnum { + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(rawValue: RawValue.bridgeJSLiftParameter())! + } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + rawValue.bridgeJSLowerStackReturn() + } +} + /// A protocol that Swift case enum types (enums without raw values or associated values) conform to. /// /// The conformance is automatically synthesized by the BridgeJS code generator. -public protocol _BridgedSwiftCaseEnum { +public protocol _BridgedSwiftCaseEnum: _BridgedSwiftStackType { // MARK: ImportTS @_spi(BridgeJS) consuming func bridgeJSLowerParameter() -> Int32 @_spi(BridgeJS) static func bridgeJSLiftReturn(_ value: Int32) -> Self @@ -323,10 +459,20 @@ public protocol _BridgedSwiftCaseEnum { @_spi(BridgeJS) consuming func bridgeJSLowerReturn() -> Int32 } +extension _BridgedSwiftCaseEnum { + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + bridgeJSLiftParameter(_swift_js_pop_i32()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_i32(bridgeJSLowerReturn()) + } +} + /// A protocol that Swift associated value enum types conform to. /// /// The conformance is automatically synthesized by the BridgeJS code generator. -public protocol _BridgedSwiftAssociatedValueEnum: _BridgedSwiftTypeLoweredIntoVoidType { +public protocol _BridgedSwiftAssociatedValueEnum: _BridgedSwiftTypeLoweredIntoVoidType, _BridgedSwiftStackType { // MARK: ImportTS @_spi(BridgeJS) consuming func bridgeJSLowerParameter() -> Int32 @_spi(BridgeJS) static func bridgeJSLiftReturn(_ caseId: Int32) -> Self @@ -336,10 +482,20 @@ public protocol _BridgedSwiftAssociatedValueEnum: _BridgedSwiftTypeLoweredIntoVo @_spi(BridgeJS) consuming func bridgeJSLowerReturn() -> Void } +extension _BridgedSwiftAssociatedValueEnum { + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + bridgeJSLiftParameter(_swift_js_pop_i32()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + bridgeJSLowerReturn() + } +} + /// A protocol that Swift struct types conform to. /// /// The conformance is automatically synthesized by the BridgeJS code generator. -public protocol _BridgedSwiftStruct: _BridgedSwiftTypeLoweredIntoVoidType { +public protocol _BridgedSwiftStruct: _BridgedSwiftTypeLoweredIntoVoidType, _BridgedSwiftStackType { // MARK: ExportSwift @_spi(BridgeJS) static func bridgeJSLiftParameter() -> Self @_spi(BridgeJS) consuming func bridgeJSLowerReturn() -> Void @@ -359,6 +515,10 @@ extension _BridgedSwiftStruct { let jsObject = JSObject.bridgeJSLiftReturn(objectId) return Self(unsafelyCopying: jsObject) } + + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + bridgeJSLowerReturn() + } } extension _BridgedSwiftEnumNoPayload where Self: RawRepresentable, RawValue == String { @@ -685,16 +845,20 @@ func _swift_js_return_optional_double(_ isSome: Int32, _ value: Float64) { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_pop_pointer") -@_spi(BridgeJS) public func _swift_js_pop_pointer() -> UnsafeMutableRawPointer +private func _swift_js_pop_pointer_extern() -> UnsafeMutableRawPointer #else -@_spi(BridgeJS) public func _swift_js_pop_pointer() -> UnsafeMutableRawPointer { +private func _swift_js_pop_pointer_extern() -> UnsafeMutableRawPointer { _onlyAvailableOnWasm() } #endif +@_spi(BridgeJS) @inline(never) public func _swift_js_pop_pointer() -> UnsafeMutableRawPointer { + _swift_js_pop_pointer_extern() +} + // MARK: - UnsafePointer family -extension UnsafeMutableRawPointer { +extension UnsafeMutableRawPointer: _BridgedSwiftStackType { // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { self } @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn( @@ -713,10 +877,16 @@ extension UnsafeMutableRawPointer { { pointer } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UnsafeMutableRawPointer { + bridgeJSLiftParameter(_swift_js_pop_pointer()) + } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { self } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_pointer(self) + } } -extension UnsafeRawPointer { +extension UnsafeRawPointer: _BridgedSwiftStackType { // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { UnsafeMutableRawPointer(mutating: self) @@ -737,12 +907,18 @@ extension UnsafeRawPointer { { UnsafeRawPointer(pointer) } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UnsafeRawPointer { + bridgeJSLiftParameter(_swift_js_pop_pointer()) + } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { bridgeJSLowerParameter() } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_pointer(UnsafeMutableRawPointer(mutating: self)) + } } -extension OpaquePointer { +extension OpaquePointer: _BridgedSwiftStackType { // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { UnsafeMutableRawPointer(mutating: UnsafeRawPointer(self)) @@ -763,12 +939,18 @@ extension OpaquePointer { { OpaquePointer(UnsafeRawPointer(pointer)) } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> OpaquePointer { + bridgeJSLiftParameter(_swift_js_pop_pointer()) + } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { bridgeJSLowerParameter() } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_pointer(UnsafeMutableRawPointer(mutating: UnsafeRawPointer(self))) + } } -extension UnsafePointer { +extension UnsafePointer: _BridgedSwiftStackType { // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { UnsafeMutableRawPointer(mutating: UnsafeRawPointer(self)) @@ -789,12 +971,18 @@ extension UnsafePointer { { UnsafeRawPointer(pointer).assumingMemoryBound(to: Pointee.self) } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UnsafePointer { + bridgeJSLiftParameter(_swift_js_pop_pointer()) + } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { bridgeJSLowerParameter() } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_pointer(bridgeJSLowerParameter()) + } } -extension UnsafeMutablePointer { +extension UnsafeMutablePointer: _BridgedSwiftStackType { // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { UnsafeMutableRawPointer(self) @@ -815,9 +1003,15 @@ extension UnsafeMutablePointer { { pointer.assumingMemoryBound(to: Pointee.self) } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UnsafeMutablePointer { + bridgeJSLiftParameter(_swift_js_pop_pointer()) + } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { bridgeJSLowerParameter() } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_pointer(bridgeJSLowerParameter()) + } } extension Optional where Wrapped == Bool { @@ -847,6 +1041,12 @@ extension Optional where Wrapped == Bool { } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Bool? { + let isSome = _swift_js_pop_i32() + let wrappedValue = _swift_js_pop_i32() + return bridgeJSLiftParameter(isSome, wrappedValue) + } + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Bool? { switch value { case -1: @@ -897,6 +1097,12 @@ extension Optional where Wrapped == Int { } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Int? { + let isSome = _swift_js_pop_i32() + let wrappedValue = _swift_js_pop_i32() + return bridgeJSLiftParameter(isSome, wrappedValue) + } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Int? { let isSome = _swift_js_get_optional_int_presence() if isSome == 0 { @@ -943,6 +1149,12 @@ extension Optional where Wrapped == UInt { } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UInt? { + let isSome = _swift_js_pop_i32() + let wrappedValue = _swift_js_pop_i32() + return bridgeJSLiftParameter(isSome, wrappedValue) + } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> UInt? { let isSome = _swift_js_get_optional_int_presence() if isSome == 0 { @@ -984,6 +1196,13 @@ extension Optional where Wrapped == String { } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> String? { + let isSome = _swift_js_pop_i32() + let bytes = _swift_js_pop_i32() + let count = _swift_js_pop_i32() + return bridgeJSLiftParameter(isSome, bytes, count) + } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> String? { let length = _swift_js_get_optional_string() if length < 0 { @@ -1026,6 +1245,12 @@ extension Optional where Wrapped == JSObject { } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> JSObject? { + let isSome = _swift_js_pop_i32() + let objectId = _swift_js_pop_i32() + return bridgeJSLiftParameter(isSome, objectId) + } + @_spi(BridgeJS) public func bridgeJSLowerReturn() -> Void { switch self { case .none: @@ -1053,7 +1278,7 @@ extension Optional where Wrapped: _BridgedSwiftProtocolWrapper { case .none: _swift_js_return_optional_object(0, 0) case .some(let wrapper): - let retainedId = wrapper.bridgeJSLowerReturn() + let retainedId: Int32 = wrapper.bridgeJSLowerReturn() _swift_js_return_optional_object(1, retainedId) } } @@ -1121,6 +1346,12 @@ extension Optional where Wrapped: _BridgedSwiftHeapObject { } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + let isSome = _swift_js_pop_i32() + let pointer = _swift_js_pop_pointer() + return bridgeJSLiftParameter(isSome, pointer) + } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { let pointer = _swift_js_get_optional_heap_object_pointer() if pointer == UnsafeMutableRawPointer(bitPattern: 0) { @@ -1135,7 +1366,7 @@ extension Optional where Wrapped: _BridgedSwiftHeapObject { case .none: _swift_js_return_optional_heap_object(0, nil) case .some(let value): - let retainedPointer = value.bridgeJSLowerReturn() + let retainedPointer: UnsafeMutableRawPointer = value.bridgeJSLowerReturn() _swift_js_return_optional_heap_object(1, retainedPointer) } } @@ -1162,6 +1393,12 @@ extension Optional where Wrapped == Float { } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Float? { + let isSome = _swift_js_pop_i32() + let wrappedValue = _swift_js_pop_f32() + return bridgeJSLiftParameter(isSome, wrappedValue) + } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Float? { let isSome = _swift_js_get_optional_float_presence() if isSome == 0 { @@ -1204,6 +1441,12 @@ extension Optional where Wrapped == Double { } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Double? { + let isSome = _swift_js_pop_i32() + let wrappedValue = _swift_js_pop_f64() + return bridgeJSLiftParameter(isSome, wrappedValue) + } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Double? { let isSome = _swift_js_get_optional_double_presence() if isSome == 0 { @@ -1244,6 +1487,12 @@ extension Optional where Wrapped: _BridgedSwiftCaseEnum { } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + let isSome = _swift_js_pop_i32() + let wrappedValue = _swift_js_pop_i32() + return bridgeJSLiftParameter(isSome, wrappedValue) + } + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Wrapped? { if value == -1 { return nil @@ -1303,6 +1552,13 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + let isSome = _swift_js_pop_i32() + let bytes = _swift_js_pop_i32() + let count = _swift_js_pop_i32() + return bridgeJSLiftParameter(isSome, bytes, count) + } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { let length = _swift_js_get_optional_string() if length < 0 { @@ -1335,6 +1591,12 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + let isSome = _swift_js_pop_i32() + let wrappedValue = _swift_js_pop_i32() + return bridgeJSLiftParameter(isSome, wrappedValue) + } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { let isSome = _swift_js_get_optional_int_presence() if isSome == 0 { @@ -1359,6 +1621,12 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + let isSome = _swift_js_pop_i32() + let wrappedValue = _swift_js_pop_i32() + return bridgeJSLiftParameter(isSome, wrappedValue) + } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { let optionalRawValue: Bool? = self?.rawValue optionalRawValue.bridgeJSLowerReturn() @@ -1384,6 +1652,12 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + let isSome = _swift_js_pop_i32() + let wrappedValue = _swift_js_pop_f32() + return bridgeJSLiftParameter(isSome, wrappedValue) + } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { let isSome = _swift_js_get_optional_float_presence() if isSome == 0 { @@ -1419,6 +1693,12 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + let isSome = _swift_js_pop_i32() + let wrappedValue = _swift_js_pop_f64() + return bridgeJSLiftParameter(isSome, wrappedValue) + } + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { let isSome = _swift_js_get_optional_double_presence() if isSome == 0 { @@ -1457,6 +1737,12 @@ extension Optional where Wrapped: _BridgedSwiftAssociatedValueEnum { } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + let isSome = _swift_js_pop_i32() + let caseId = _swift_js_pop_i32() + return bridgeJSLiftParameter(isSome, caseId) + } + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ caseId: Int32) -> Wrapped? { if caseId == -1 { return nil @@ -1488,6 +1774,11 @@ extension Optional where Wrapped: _BridgedSwiftStruct { } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + let isSome = _swift_js_pop_i32() + return bridgeJSLiftParameter(isSome) + } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { switch consume self { case .none: @@ -1498,3 +1789,25 @@ extension Optional where Wrapped: _BridgedSwiftStruct { } } } + +// MARK: - Array Support + +extension Array where Element: _BridgedSwiftStackType, Element.StackLiftResult == Element { + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> [Element] { + let count = Int(_swift_js_pop_i32()) + var result: [Element] = [] + result.reserveCapacity(count) + for _ in 0.. [OpaquePointer] { return values } +@JS func roundTripUnsafePointerArray(_ values: [UnsafePointer]) -> [UnsafePointer] { + return values +} +@JS func roundTripUnsafeMutablePointerArray(_ values: [UnsafeMutablePointer]) -> [UnsafeMutablePointer] { + return values +} @JS func consumeDataProcessorArrayType(_ processors: [DataProcessor]) -> Int { return processors.count diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index b0b24137a..6836000c6 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) import JavaScriptKit +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit @JSFunction func jsRoundTripVoid() throws (JSException) -> Void @@ -26,7 +26,7 @@ enum FeatureFlag: String { case foo = "foo" case bar = "bar" } -extension FeatureFlag: _BridgedSwiftEnumNoPayload {} +extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} @JSFunction func jsRoundTripFeatureFlag(_ flag: FeatureFlag) throws (JSException) -> FeatureFlag diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 42f360ce7..55a77466e 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -1292,16 +1292,16 @@ extension Status: _BridgedSwiftCaseEnum { } } -extension Theme: _BridgedSwiftEnumNoPayload { +extension Theme: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension HttpStatus: _BridgedSwiftEnumNoPayload { +extension HttpStatus: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension Precision: _BridgedSwiftEnumNoPayload { +extension Precision: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension Ratio: _BridgedSwiftEnumNoPayload { +extension Ratio: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } extension TSDirection: _BridgedSwiftCaseEnum { @@ -1347,7 +1347,7 @@ extension TSDirection: _BridgedSwiftCaseEnum { } } -extension TSTheme: _BridgedSwiftEnumNoPayload { +extension TSTheme: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } @_expose(wasm, "bjs_Utils_StringUtils_static_uppercase") @@ -1415,10 +1415,10 @@ extension Networking.API.Method: _BridgedSwiftCaseEnum { } } -extension Configuration.LogLevel: _BridgedSwiftEnumNoPayload { +extension Configuration.LogLevel: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } -extension Configuration.Port: _BridgedSwiftEnumNoPayload { +extension Configuration.Port: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } extension Internal.SupportedMethod: _BridgedSwiftCaseEnum { @@ -1460,15 +1460,15 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .failure(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .failure(Int.bridgeJSLiftParameter()) case 2: - return .flag(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .flag(Bool.bridgeJSLiftParameter()) case 3: - return .rate(Float.bridgeJSLiftParameter(_swift_js_pop_f32())) + return .rate(Float.bridgeJSLiftParameter()) case 4: - return .precise(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) + return .precise(Double.bridgeJSLiftParameter()) case 5: return .info default: @@ -1481,22 +1481,19 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .failure(let param0): - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() return Int32(1) case .flag(let param0): - _swift_js_push_i32(param0 ? 1 : 0) + param0.bridgeJSLowerStackReturn() return Int32(2) case .rate(let param0): - _swift_js_push_f32(param0) + param0.bridgeJSLowerStackReturn() return Int32(3) case .precise(let param0): - _swift_js_push_f64(param0) + param0.bridgeJSLowerStackReturn() return Int32(4) case .info: return Int32(5) @@ -1517,22 +1514,19 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .failure(let param0): _swift_js_push_tag(Int32(1)) - _swift_js_push_i32(Int32(param0)) + param0.bridgeJSLowerStackReturn() case .flag(let param0): _swift_js_push_tag(Int32(2)) - _swift_js_push_i32(param0 ? 1 : 0) + param0.bridgeJSLowerStackReturn() case .rate(let param0): _swift_js_push_tag(Int32(3)) - _swift_js_push_f32(param0) + param0.bridgeJSLowerStackReturn() case .precise(let param0): _swift_js_push_tag(Int32(4)) - _swift_js_push_f64(param0) + param0.bridgeJSLowerStackReturn() case .info: _swift_js_push_tag(Int32(5)) } @@ -1543,17 +1537,17 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .error(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .error(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) case 2: - return .location(Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .location(Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) case 3: - return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .status(Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) case 4: - return .coordinates(Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64())) + return .coordinates(Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter()) case 5: - return .comprehensive(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), Double.bridgeJSLiftParameter(_swift_js_pop_f64()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .comprehensive(Bool.bridgeJSLiftParameter(), Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), String.bridgeJSLiftParameter(), String.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) case 6: return .info default: @@ -1566,58 +1560,37 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .error(let param0, let param1): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() return Int32(1) case .location(let param0, let param1, let param2): - _swift_js_push_f64(param0) - _swift_js_push_f64(param1) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() return Int32(2) case .status(let param0, let param1, let param2): - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(Int32(param1)) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() return Int32(3) case .coordinates(let param0, let param1, let param2): - _swift_js_push_f64(param0) - _swift_js_push_f64(param1) - _swift_js_push_f64(param2) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() return Int32(4) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(param1 ? 1 : 0) - _swift_js_push_i32(Int32(param2)) - _swift_js_push_i32(Int32(param3)) - _swift_js_push_f64(param4) - _swift_js_push_f64(param5) - var __bjs_param6 = param6 - __bjs_param6.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_param7 = param7 - __bjs_param7.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_param8 = param8 - __bjs_param8.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() + param3.bridgeJSLowerStackReturn() + param4.bridgeJSLowerStackReturn() + param5.bridgeJSLowerStackReturn() + param6.bridgeJSLowerStackReturn() + param7.bridgeJSLowerStackReturn() + param8.bridgeJSLowerStackReturn() return Int32(5) case .info: return Int32(6) @@ -1638,58 +1611,37 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .error(let param0, let param1): _swift_js_push_tag(Int32(1)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() case .location(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) - _swift_js_push_f64(param0) - _swift_js_push_f64(param1) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(3)) - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(Int32(param1)) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() case .coordinates(let param0, let param1, let param2): _swift_js_push_tag(Int32(4)) - _swift_js_push_f64(param0) - _swift_js_push_f64(param1) - _swift_js_push_f64(param2) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): _swift_js_push_tag(Int32(5)) - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(param1 ? 1 : 0) - _swift_js_push_i32(Int32(param2)) - _swift_js_push_i32(Int32(param3)) - _swift_js_push_f64(param4) - _swift_js_push_f64(param5) - var __bjs_param6 = param6 - __bjs_param6.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_param7 = param7 - __bjs_param7.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_param8 = param8 - __bjs_param8.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() + param3.bridgeJSLowerStackReturn() + param4.bridgeJSLowerStackReturn() + param5.bridgeJSLowerStackReturn() + param6.bridgeJSLowerStackReturn() + param7.bridgeJSLowerStackReturn() + param8.bridgeJSLowerStackReturn() case .info: _swift_js_push_tag(Int32(6)) } @@ -1700,11 +1652,11 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Utilities.Result { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .failure(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .failure(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) case 2: - return .status(Bool.bridgeJSLiftParameter(_swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32()), String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .status(Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) default: fatalError("Unknown Utilities.Result case ID: \(caseId)") } @@ -1715,25 +1667,16 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .failure(let param0, let param1): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() return Int32(1) case .status(let param0, let param1, let param2): - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(Int32(param1)) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() return Int32(2) } } @@ -1752,25 +1695,16 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .failure(let param0, let param1): _swift_js_push_tag(Int32(1)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) - _swift_js_push_i32(param0 ? 1 : 0) - _swift_js_push_i32(Int32(param1)) - var __bjs_param2 = param2 - __bjs_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() + param2.bridgeJSLowerStackReturn() } } } @@ -1779,9 +1713,9 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> API.NetworkingResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(String.bridgeJSLiftParameter()) case 1: - return .failure(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Int.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .failure(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) default: fatalError("Unknown API.NetworkingResult case ID: \(caseId)") } @@ -1792,17 +1726,11 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .success(let param0): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() return Int32(0) case .failure(let param0, let param1): - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() return Int32(1) } } @@ -1821,17 +1749,11 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): _swift_js_push_tag(Int32(0)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + param0.bridgeJSLowerStackReturn() case .failure(let param0, let param1): _swift_js_push_tag(Int32(1)) - var __bjs_param0 = param0 - __bjs_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(param1)) + param0.bridgeJSLowerStackReturn() + param1.bridgeJSLowerStackReturn() } } } @@ -1840,11 +1762,11 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIOptionalResult { switch caseId { case 0: - return .success(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())) + return .success(Optional.bridgeJSLiftParameter()) case 1: - return .failure(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + return .failure(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) case 2: - return .status(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()), Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())) + return .status(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) default: fatalError("Unknown APIOptionalResult case ID: \(caseId)") } @@ -1857,42 +1779,36 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { case .success(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - var __bjs_str_param0 = __bjs_unwrapped_param0 - __bjs_str_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(0) case .failure(let param0, let param1): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(Int32(__bjs_unwrapped_param0)) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_i32(__bjs_unwrapped_param1 ? 1 : 0) + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) return Int32(1) case .status(let param0, let param1, let param2): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0 ? 1 : 0) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_i32(Int32(__bjs_unwrapped_param1)) + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { - var __bjs_str_param2 = __bjs_unwrapped_param2 - __bjs_str_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + __bjs_unwrapped_param2.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) return Int32(2) @@ -1915,42 +1831,36 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_tag(Int32(0)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - var __bjs_str_param0 = __bjs_unwrapped_param0 - __bjs_str_param0.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) case .failure(let param0, let param1): _swift_js_push_tag(Int32(1)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(Int32(__bjs_unwrapped_param0)) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_i32(__bjs_unwrapped_param1 ? 1 : 0) + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) case .status(let param0, let param1, let param2): _swift_js_push_tag(Int32(2)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0 ? 1 : 0) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - _swift_js_push_i32(Int32(__bjs_unwrapped_param1)) + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { - var __bjs_str_param2 = __bjs_unwrapped_param2 - __bjs_str_param2.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + __bjs_unwrapped_param2.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) } @@ -2264,14 +2174,14 @@ public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_se extension Point: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { - let y = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) - let x = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let y = Int.bridgeJSLiftParameter() + let x = Int.bridgeJSLiftParameter() return Point(x: x, y: y) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_i32(Int32(self.x)) - _swift_js_push_i32(Int32(self.y)) + self.x.bridgeJSLowerStackReturn() + self.y.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -2309,20 +2219,20 @@ fileprivate func _bjs_struct_lift_Point() -> Int32 { extension PointerFields: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PointerFields { - let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) - let ptr = UnsafePointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) - let opaque = OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) - let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) - let raw = UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer()) + let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter() + let ptr = UnsafePointer.bridgeJSLiftParameter() + let opaque = OpaquePointer.bridgeJSLiftParameter() + let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter() + let raw = UnsafeRawPointer.bridgeJSLiftParameter() return PointerFields(raw: raw, mutRaw: mutRaw, opaque: opaque, ptr: ptr, mutPtr: mutPtr) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_pointer(self.raw.bridgeJSLowerReturn()) - _swift_js_push_pointer(self.mutRaw.bridgeJSLowerReturn()) - _swift_js_push_pointer(self.opaque.bridgeJSLowerReturn()) - _swift_js_push_pointer(self.ptr.bridgeJSLowerReturn()) - _swift_js_push_pointer(self.mutPtr.bridgeJSLowerReturn()) + self.raw.bridgeJSLowerStackReturn() + self.mutRaw.bridgeJSLowerStackReturn() + self.opaque.bridgeJSLowerStackReturn() + self.ptr.bridgeJSLowerStackReturn() + self.mutPtr.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -2371,29 +2281,26 @@ public func _bjs_PointerFields_init(_ raw: UnsafeMutableRawPointer, _ mutRaw: Un extension DataPoint: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> DataPoint { - let optFlag = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let optCount = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let label = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let y = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) - let x = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) + let optFlag = Optional.bridgeJSLiftParameter() + let optCount = Optional.bridgeJSLiftParameter() + let label = String.bridgeJSLiftParameter() + let y = Double.bridgeJSLiftParameter() + let x = Double.bridgeJSLiftParameter() return DataPoint(x: x, y: y, label: label, optCount: optCount, optFlag: optFlag) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_f64(self.x) - _swift_js_push_f64(self.y) - var __bjs_label = self.label - __bjs_label.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + self.x.bridgeJSLowerStackReturn() + self.y.bridgeJSLowerStackReturn() + self.label.bridgeJSLowerStackReturn() let __bjs_isSome_optCount = self.optCount != nil if let __bjs_unwrapped_optCount = self.optCount { - _swift_js_push_i32(Int32(__bjs_unwrapped_optCount)) + __bjs_unwrapped_optCount.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optCount ? 1 : 0) let __bjs_isSome_optFlag = self.optFlag != nil if let __bjs_unwrapped_optFlag = self.optFlag { - _swift_js_push_i32(__bjs_unwrapped_optFlag ? 1 : 0) + __bjs_unwrapped_optFlag.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optFlag ? 1 : 0) } @@ -2444,24 +2351,18 @@ public func _bjs_DataPoint_init(_ x: Float64, _ y: Float64, _ labelBytes: Int32, extension Address: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Address { - let zipCode = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let city = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let street = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let zipCode = Optional.bridgeJSLiftParameter() + let city = String.bridgeJSLiftParameter() + let street = String.bridgeJSLiftParameter() return Address(street: street, city: city, zipCode: zipCode) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - var __bjs_street = self.street - __bjs_street.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - var __bjs_city = self.city - __bjs_city.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + self.street.bridgeJSLowerStackReturn() + self.city.bridgeJSLowerStackReturn() let __bjs_isSome_zipCode = self.zipCode != nil if let __bjs_unwrapped_zipCode = self.zipCode { - _swift_js_push_i32(Int32(__bjs_unwrapped_zipCode)) + __bjs_unwrapped_zipCode.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_zipCode ? 1 : 0) } @@ -2501,27 +2402,21 @@ fileprivate func _bjs_struct_lift_Address() -> Int32 { extension Contact: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Contact { - let secondaryAddress = Optional
        .bridgeJSLiftParameter(_swift_js_pop_i32()) - let email = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32()) + let secondaryAddress = Optional
        .bridgeJSLiftParameter() + let email = Optional.bridgeJSLiftParameter() let address = Address.bridgeJSLiftParameter() - let age = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let age = Int.bridgeJSLiftParameter() + let name = String.bridgeJSLiftParameter() return Contact(name: name, age: age, address: address, email: email, secondaryAddress: secondaryAddress) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - var __bjs_name = self.name - __bjs_name.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(self.age)) + self.name.bridgeJSLowerStackReturn() + self.age.bridgeJSLowerStackReturn() self.address.bridgeJSLowerReturn() let __bjs_isSome_email = self.email != nil if let __bjs_unwrapped_email = self.email { - var __bjs_str_email = __bjs_unwrapped_email - __bjs_str_email.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + __bjs_unwrapped_email.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_email ? 1 : 0) let __bjs_isSome_secondaryAddress = self.secondaryAddress != nil @@ -2567,31 +2462,25 @@ fileprivate func _bjs_struct_lift_Contact() -> Int32 { extension Config: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Config { let status = Status.bridgeJSLiftParameter(_swift_js_pop_i32()) - let direction = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let theme = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let direction = Optional.bridgeJSLiftParameter() + let theme = Optional.bridgeJSLiftParameter() + let name = String.bridgeJSLiftParameter() return Config(name: name, theme: theme, direction: direction, status: status) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - var __bjs_name = self.name - __bjs_name.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + self.name.bridgeJSLowerStackReturn() let __bjs_isSome_theme = self.theme != nil if let __bjs_unwrapped_theme = self.theme { - var __bjs_str_theme = __bjs_unwrapped_theme.rawValue - __bjs_str_theme.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + __bjs_unwrapped_theme.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_theme ? 1 : 0) let __bjs_isSome_direction = self.direction != nil if let __bjs_unwrapped_direction = self.direction { - _swift_js_push_i32(__bjs_unwrapped_direction.bridgeJSLowerParameter()) + __bjs_unwrapped_direction.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_direction ? 1 : 0) - _swift_js_push_i32(Int32(self.status.bridgeJSLowerParameter())) + self.status.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -2629,16 +2518,16 @@ fileprivate func _bjs_struct_lift_Config() -> Int32 { extension SessionData: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> SessionData { - let owner = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_pointer()) - let id = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let owner = Optional.bridgeJSLiftParameter() + let id = Int.bridgeJSLiftParameter() return SessionData(id: id, owner: owner) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_i32(Int32(self.id)) + self.id.bridgeJSLowerStackReturn() let __bjs_isSome_owner = self.owner != nil if let __bjs_unwrapped_owner = self.owner { - _swift_js_push_pointer(__bjs_unwrapped_owner.bridgeJSLowerReturn()) + __bjs_unwrapped_owner.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_owner ? 1 : 0) } @@ -2678,19 +2567,19 @@ fileprivate func _bjs_struct_lift_SessionData() -> Int32 { extension ValidationReport: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ValidationReport { - let outcome = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let status = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let outcome = Optional.bridgeJSLiftParameter() + let status = Optional.bridgeJSLiftParameter() let result = APIResult.bridgeJSLiftParameter(_swift_js_pop_i32()) - let id = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let id = Int.bridgeJSLiftParameter() return ValidationReport(id: id, result: result, status: status, outcome: outcome) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_i32(Int32(self.id)) + self.id.bridgeJSLowerStackReturn() self.result.bridgeJSLowerReturn() let __bjs_isSome_status = self.status != nil if let __bjs_unwrapped_status = self.status { - _swift_js_push_i32(__bjs_unwrapped_status.bridgeJSLowerParameter()) + __bjs_unwrapped_status.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_status ? 1 : 0) let __bjs_isSome_outcome = self.outcome != nil @@ -2735,31 +2624,25 @@ fileprivate func _bjs_struct_lift_ValidationReport() -> Int32 { extension AdvancedConfig: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> AdvancedConfig { - let overrideDefaults = Optional.bridgeJSLiftParameter(_swift_js_pop_i32()) + let overrideDefaults = Optional.bridgeJSLiftParameter() let defaults = ConfigStruct.bridgeJSLiftParameter() - let location = Optional.bridgeJSLiftParameter(_swift_js_pop_i32()) - let metadata = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let result = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let location = Optional.bridgeJSLiftParameter() + let metadata = Optional.bridgeJSLiftParameter() + let result = Optional.bridgeJSLiftParameter() let status = Status.bridgeJSLiftParameter(_swift_js_pop_i32()) let theme = Theme.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let enabled = Bool.bridgeJSLiftParameter(_swift_js_pop_i32()) - let title = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) - let id = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let enabled = Bool.bridgeJSLiftParameter() + let title = String.bridgeJSLiftParameter() + let id = Int.bridgeJSLiftParameter() 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 bridgeJSLowerReturn() { - _swift_js_push_i32(Int32(self.id)) - var __bjs_title = self.title - __bjs_title.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(self.enabled ? 1 : 0) - var __bjs_theme = self.theme.rawValue - __bjs_theme.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(self.status.bridgeJSLowerParameter())) + self.id.bridgeJSLowerStackReturn() + self.title.bridgeJSLowerStackReturn() + self.enabled.bridgeJSLowerStackReturn() + self.theme.bridgeJSLowerStackReturn() + self.status.bridgeJSLowerStackReturn() let __bjs_isSome_result = self.result != nil if let __bjs_unwrapped_result = self.result { _swift_js_push_i32(__bjs_unwrapped_result.bridgeJSLowerParameter()) @@ -2767,7 +2650,7 @@ extension AdvancedConfig: _BridgedSwiftStruct { _swift_js_push_i32(__bjs_isSome_result ? 1 : 0) let __bjs_isSome_metadata = self.metadata != nil if let __bjs_unwrapped_metadata = self.metadata { - _swift_js_push_i32(__bjs_unwrapped_metadata.bridgeJSLowerReturn()) + __bjs_unwrapped_metadata.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_metadata ? 1 : 0) let __bjs_isSome_location = self.location != nil @@ -2818,24 +2701,24 @@ fileprivate func _bjs_struct_lift_AdvancedConfig() -> Int32 { extension MeasurementConfig: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MeasurementConfig { - let optionalRatio = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f64()) - let optionalPrecision = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_f32()) + let optionalRatio = Optional.bridgeJSLiftParameter() + let optionalPrecision = Optional.bridgeJSLiftParameter() let ratio = Ratio.bridgeJSLiftParameter(_swift_js_pop_f64()) let precision = Precision.bridgeJSLiftParameter(_swift_js_pop_f32()) return MeasurementConfig(precision: precision, ratio: ratio, optionalPrecision: optionalPrecision, optionalRatio: optionalRatio) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_f32(self.precision.bridgeJSLowerParameter()) - _swift_js_push_f64(self.ratio.bridgeJSLowerParameter()) + self.precision.bridgeJSLowerStackReturn() + self.ratio.bridgeJSLowerStackReturn() let __bjs_isSome_optionalPrecision = self.optionalPrecision != nil if let __bjs_unwrapped_optionalPrecision = self.optionalPrecision { - _swift_js_push_f32(__bjs_unwrapped_optionalPrecision.bridgeJSLowerParameter()) + __bjs_unwrapped_optionalPrecision.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optionalPrecision ? 1 : 0) let __bjs_isSome_optionalRatio = self.optionalRatio != nil if let __bjs_unwrapped_optionalRatio = self.optionalRatio { - _swift_js_push_f64(__bjs_unwrapped_optionalRatio.bridgeJSLowerParameter()) + __bjs_unwrapped_optionalRatio.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optionalRatio ? 1 : 0) } @@ -2875,12 +2758,12 @@ fileprivate func _bjs_struct_lift_MeasurementConfig() -> Int32 { extension MathOperations: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MathOperations { - let baseValue = Double.bridgeJSLiftParameter(_swift_js_pop_f64()) + let baseValue = Double.bridgeJSLiftParameter() return MathOperations(baseValue: baseValue) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_f64(self.baseValue) + self.baseValue.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -2962,19 +2845,16 @@ public func _bjs_MathOperations_static_subtract(_ a: Float64, _ b: Float64) -> F extension CopyableCart: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> CopyableCart { - let note = Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32()) - let x = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let note = Optional.bridgeJSLiftParameter() + let x = Int.bridgeJSLiftParameter() return CopyableCart(x: x, note: note) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_i32(Int32(self.x)) + self.x.bridgeJSLowerStackReturn() let __bjs_isSome_note = self.note != nil if let __bjs_unwrapped_note = self.note { - var __bjs_str_note = __bjs_unwrapped_note - __bjs_str_note.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } + __bjs_unwrapped_note.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_note ? 1 : 0) } @@ -3025,17 +2905,14 @@ public func _bjs_CopyableCart_static_fromJSObject(_ object: Int32) -> Void { extension CopyableCartItem: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> CopyableCartItem { - let quantity = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) - let sku = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let quantity = Int.bridgeJSLiftParameter() + let sku = String.bridgeJSLiftParameter() return CopyableCartItem(sku: sku, quantity: quantity) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - var __bjs_sku = self.sku - __bjs_sku.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(self.quantity)) + self.sku.bridgeJSLowerStackReturn() + self.quantity.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -3073,14 +2950,14 @@ fileprivate func _bjs_struct_lift_CopyableCartItem() -> Int32 { extension CopyableNestedCart: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> CopyableNestedCart { - let shippingAddress = Optional
        .bridgeJSLiftParameter(_swift_js_pop_i32()) + let shippingAddress = Optional
        .bridgeJSLiftParameter() let item = CopyableCartItem.bridgeJSLiftParameter() - let id = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) + let id = Int.bridgeJSLiftParameter() return CopyableNestedCart(id: id, item: item, shippingAddress: shippingAddress) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - _swift_js_push_i32(Int32(self.id)) + self.id.bridgeJSLowerStackReturn() self.item.bridgeJSLowerReturn() let __bjs_isSome_shippingAddress = self.shippingAddress != nil if let __bjs_unwrapped_shippingAddress = self.shippingAddress { @@ -3135,17 +3012,14 @@ public func _bjs_CopyableNestedCart_static_fromJSObject(_ object: Int32) -> Void extension ConfigStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ConfigStruct { - let value = Int.bridgeJSLiftParameter(_swift_js_pop_i32()) - let name = String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let value = Int.bridgeJSLiftParameter() + let name = String.bridgeJSLiftParameter() return ConfigStruct(name: name, value: value) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - var __bjs_name = self.name - __bjs_name.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - } - _swift_js_push_i32(Int32(self.value)) + self.name.bridgeJSLowerStackReturn() + self.value.bridgeJSLowerStackReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -4610,16 +4484,7 @@ public func _bjs_testEmptyInit(_ object: UnsafeMutableRawPointer) -> UnsafeMutab @_cdecl("bjs_arrayWithDefault") public func _bjs_arrayWithDefault() -> Int32 { #if arch(wasm32) - let ret = arrayWithDefault(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + let ret = arrayWithDefault(_: [Int].bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -4634,16 +4499,7 @@ public func _bjs_arrayWithOptionalDefault(_ values: Int32) -> Int32 { if values == 0 { return Optional<[Int]>.none } else { - return { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }() + return [Int].bridgeJSLiftParameter() } }()) return ret.bridgeJSLowerReturn() @@ -4656,16 +4512,7 @@ public func _bjs_arrayWithOptionalDefault(_ values: Int32) -> Int32 { @_cdecl("bjs_arrayMixedDefaults") public func _bjs_arrayMixedDefaults(_ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { #if arch(wasm32) - let ret = arrayMixedDefaults(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength), values: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }(), suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) + let ret = arrayMixedDefaults(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength), values: [Int].bridgeJSLiftParameter(), suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -4709,19 +4556,8 @@ public func _bjs_makeAdder(_ base: Int32) -> UnsafeMutableRawPointer { @_cdecl("bjs_roundTripIntArray") public func _bjs_roundTripIntArray() -> Void { #if arch(wasm32) - let ret = roundTripIntArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32(Int32(__bjs_elem_ret))} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripIntArray(_: [Int].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -4731,22 +4567,8 @@ public func _bjs_roundTripIntArray() -> Void { @_cdecl("bjs_roundTripStringArray") public func _bjs_roundTripStringArray() -> Void { #if arch(wasm32) - let ret = roundTripStringArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [String] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - var __bjs_ret_elem = __bjs_elem_ret - __bjs_ret_elem.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - }} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripStringArray(_: [String].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -4756,19 +4578,8 @@ public func _bjs_roundTripStringArray() -> Void { @_cdecl("bjs_roundTripDoubleArray") public func _bjs_roundTripDoubleArray() -> Void { #if arch(wasm32) - let ret = roundTripDoubleArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Double] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_f64(__bjs_elem_ret)} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripDoubleArray(_: [Double].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -4778,19 +4589,8 @@ public func _bjs_roundTripDoubleArray() -> Void { @_cdecl("bjs_roundTripBoolArray") public func _bjs_roundTripBoolArray() -> Void { #if arch(wasm32) - let ret = roundTripBoolArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Bool] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32(__bjs_elem_ret ? 1 : 0)} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripBoolArray(_: [Bool].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -4800,19 +4600,8 @@ public func _bjs_roundTripBoolArray() -> Void { @_cdecl("bjs_roundTripDirectionArray") public func _bjs_roundTripDirectionArray() -> Void { #if arch(wasm32) - let ret = roundTripDirectionArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Direction] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Direction.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripDirectionArray(_: [Direction].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -4822,19 +4611,8 @@ public func _bjs_roundTripDirectionArray() -> Void { @_cdecl("bjs_roundTripStatusArray") public func _bjs_roundTripStatusArray() -> Void { #if arch(wasm32) - let ret = roundTripStatusArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Status] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Status.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripStatusArray(_: [Status].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -4844,22 +4622,8 @@ public func _bjs_roundTripStatusArray() -> Void { @_cdecl("bjs_roundTripThemeArray") public func _bjs_roundTripThemeArray() -> Void { #if arch(wasm32) - let ret = roundTripThemeArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Theme] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Theme.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - var __bjs_ret_elem = __bjs_elem_ret.rawValue - __bjs_ret_elem.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - }} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripThemeArray(_: [Theme].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -4869,19 +4633,8 @@ public func _bjs_roundTripThemeArray() -> Void { @_cdecl("bjs_roundTripHttpStatusArray") public func _bjs_roundTripHttpStatusArray() -> Void { #if arch(wasm32) - let ret = roundTripHttpStatusArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [HttpStatus] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(HttpStatus.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32(Int32(__bjs_elem_ret.bridgeJSLowerParameter()))} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripHttpStatusArray(_: [HttpStatus].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -4891,19 +4644,8 @@ public func _bjs_roundTripHttpStatusArray() -> Void { @_cdecl("bjs_roundTripDataPointArray") public func _bjs_roundTripDataPointArray() -> Void { #if arch(wasm32) - let ret = roundTripDataPointArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [DataPoint] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(DataPoint.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripDataPointArray(_: [DataPoint].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -4913,19 +4655,8 @@ public func _bjs_roundTripDataPointArray() -> Void { @_cdecl("bjs_roundTripGreeterArray") public func _bjs_roundTripGreeterArray() -> Void { #if arch(wasm32) - let ret = roundTripGreeterArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Greeter] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Greeter.bridgeJSLiftParameter(_swift_js_pop_pointer())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripGreeterArray(_: [Greeter].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -4940,7 +4671,7 @@ public func _bjs_roundTripOptionalIntArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -4948,7 +4679,7 @@ public func _bjs_roundTripOptionalIntArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_i32(Int32(__bjs_unwrapped_ret_elem))} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} _swift_js_push_i32(Int32(ret.count)) #else @@ -4965,7 +4696,7 @@ public func _bjs_roundTripOptionalStringArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32(), _swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -4973,10 +4704,7 @@ public func _bjs_roundTripOptionalStringArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - var __bjs_str_ret_elem = __bjs_unwrapped_ret_elem - __bjs_str_ret_elem.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - }} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} _swift_js_push_i32(Int32(ret.count)) #else @@ -4993,7 +4721,7 @@ public func _bjs_roundTripOptionalDataPointArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -5018,7 +4746,7 @@ public func _bjs_roundTripOptionalDirectionArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -5026,7 +4754,7 @@ public func _bjs_roundTripOptionalDirectionArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_i32(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} _swift_js_push_i32(Int32(ret.count)) #else @@ -5043,7 +4771,7 @@ public func _bjs_roundTripOptionalStatusArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -5051,7 +4779,7 @@ public func _bjs_roundTripOptionalStatusArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - _swift_js_push_i32(__bjs_unwrapped_ret_elem.bridgeJSLowerParameter())} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} _swift_js_push_i32(Int32(ret.count)) #else @@ -5067,23 +4795,12 @@ public func _bjs_roundTripOptionalIntArrayType(_ values: Int32) -> Void { if values == 0 { return Optional<[Int]>.none } else { - return { - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }() + return [Int].bridgeJSLiftParameter() } }()) let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - for __bjs_elem_ret in __bjs_unwrapped_ret { - _swift_js_push_i32(Int32(__bjs_elem_ret))} - _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + __bjs_unwrapped_ret.bridgeJSLowerReturn()} _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -5098,26 +4815,12 @@ public func _bjs_roundTripOptionalStringArrayType(_ values: Int32) -> Void { if values == 0 { return Optional<[String]>.none } else { - return { - let __count = Int(_swift_js_pop_i32()) - var __result: [String] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) - } - __result.reverse() - return __result - }() + return [String].bridgeJSLiftParameter() } }()) let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - for __bjs_elem_ret in __bjs_unwrapped_ret { - var __bjs_ret_elem = __bjs_elem_ret - __bjs_ret_elem.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - }} - _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + __bjs_unwrapped_ret.bridgeJSLowerReturn()} _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -5132,23 +4835,12 @@ public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { if greeters == 0 { return Optional<[Greeter]>.none } else { - return { - let __count = Int(_swift_js_pop_i32()) - var __result: [Greeter] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Greeter.bridgeJSLiftParameter(_swift_js_pop_pointer())) - } - __result.reverse() - return __result - }() + return [Greeter].bridgeJSLiftParameter() } }()) let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - for __bjs_elem_ret in __bjs_unwrapped_ret { - _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(__bjs_unwrapped_ret.count))} + __bjs_unwrapped_ret.bridgeJSLowerReturn()} _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -5164,24 +4856,13 @@ public func _bjs_roundTripNestedIntArray() -> Void { var __result: [[Int]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [Int] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Int.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + __result.append([Int].bridgeJSLiftParameter()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_i32(Int32(__bjs_elem_ret_elem))} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5197,27 +4878,13 @@ public func _bjs_roundTripNestedStringArray() -> Void { var __result: [[String]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [String] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(String.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + __result.append([String].bridgeJSLiftParameter()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - var __bjs_ret_elem_elem = __bjs_elem_ret_elem - __bjs_ret_elem_elem.withUTF8 { ptr in - _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) - }} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5233,24 +4900,13 @@ public func _bjs_roundTripNestedDoubleArray() -> Void { var __result: [[Double]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [Double] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Double.bridgeJSLiftParameter(_swift_js_pop_f64())) - } - __result.reverse() - return __result - }()) + __result.append([Double].bridgeJSLiftParameter()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_f64(__bjs_elem_ret_elem)} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5266,24 +4922,13 @@ public func _bjs_roundTripNestedBoolArray() -> Void { var __result: [[Bool]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [Bool] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Bool.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + __result.append([Bool].bridgeJSLiftParameter()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_i32(__bjs_elem_ret_elem ? 1 : 0)} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5299,24 +4944,13 @@ public func _bjs_roundTripNestedDataPointArray() -> Void { var __result: [[DataPoint]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [DataPoint] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(DataPoint.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) + __result.append([DataPoint].bridgeJSLiftParameter()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - __bjs_elem_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5332,24 +4966,13 @@ public func _bjs_roundTripNestedDirectionArray() -> Void { var __result: [[Direction]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [Direction] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Direction.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + __result.append([Direction].bridgeJSLiftParameter()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_i32(Int32(__bjs_elem_ret_elem.bridgeJSLowerParameter()))} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5365,24 +4988,13 @@ public func _bjs_roundTripNestedGreeterArray() -> Void { var __result: [[Greeter]] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append({ - let __count = Int(_swift_js_pop_i32()) - var __result: [Greeter] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Greeter.bridgeJSLiftParameter(_swift_js_pop_pointer())) - } - __result.reverse() - return __result - }()) + __result.append([Greeter].bridgeJSLiftParameter()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - for __bjs_elem_ret_elem in __bjs_elem_ret { - _swift_js_push_pointer(__bjs_elem_ret_elem.bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(__bjs_elem_ret.count))} + __bjs_elem_ret.bridgeJSLowerReturn()} _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5393,19 +5005,8 @@ public func _bjs_roundTripNestedGreeterArray() -> Void { @_cdecl("bjs_roundTripUnsafeRawPointerArray") public func _bjs_roundTripUnsafeRawPointerArray() -> Void { #if arch(wasm32) - let ret = roundTripUnsafeRawPointerArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [UnsafeRawPointer] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(UnsafeRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripUnsafeRawPointerArray(_: [UnsafeRawPointer].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -5415,19 +5016,8 @@ public func _bjs_roundTripUnsafeRawPointerArray() -> Void { @_cdecl("bjs_roundTripUnsafeMutableRawPointerArray") public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { #if arch(wasm32) - let ret = roundTripUnsafeMutableRawPointerArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [UnsafeMutableRawPointer] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(UnsafeMutableRawPointer.bridgeJSLiftParameter(_swift_js_pop_pointer())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripUnsafeMutableRawPointerArray(_: [UnsafeMutableRawPointer].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -5437,19 +5027,30 @@ public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { @_cdecl("bjs_roundTripOpaquePointerArray") public func _bjs_roundTripOpaquePointerArray() -> Void { #if arch(wasm32) - let ret = roundTripOpaquePointerArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [OpaquePointer] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(OpaquePointer.bridgeJSLiftParameter(_swift_js_pop_pointer())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_pointer(__bjs_elem_ret.bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOpaquePointerArray(_: [OpaquePointer].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUnsafePointerArray") +@_cdecl("bjs_roundTripUnsafePointerArray") +public func _bjs_roundTripUnsafePointerArray() -> Void { + #if arch(wasm32) + let ret = roundTripUnsafePointerArray(_: [UnsafePointer].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUnsafeMutablePointerArray") +@_cdecl("bjs_roundTripUnsafeMutablePointerArray") +public func _bjs_roundTripUnsafeMutablePointerArray() -> Void { + #if arch(wasm32) + let ret = roundTripUnsafeMutablePointerArray(_: [UnsafeMutablePointer].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -5459,16 +5060,7 @@ public func _bjs_roundTripOpaquePointerArray() -> Void { @_cdecl("bjs_consumeDataProcessorArrayType") public func _bjs_consumeDataProcessorArrayType() -> Int32 { #if arch(wasm32) - let ret = consumeDataProcessorArrayType(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [AnyDataProcessor] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(AnyDataProcessor.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) + let ret = consumeDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5479,19 +5071,10 @@ public func _bjs_consumeDataProcessorArrayType() -> Int32 { @_cdecl("bjs_roundTripDataProcessorArrayType") public func _bjs_roundTripDataProcessorArrayType() -> Void { #if arch(wasm32) - let ret = roundTripDataProcessorArrayType(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [AnyDataProcessor] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(AnyDataProcessor.bridgeJSLiftParameter(_swift_js_pop_i32())) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - _swift_js_push_i32((__bjs_elem_ret as! AnyDataProcessor).bridgeJSLowerReturn())} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSLiftParameter()) + ret.map { + $0 as! AnyDataProcessor + } .bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 5d75ef55e..e31c69a51 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -9310,6 +9310,84 @@ } } }, + { + "abiName" : "bjs_roundTripUnsafePointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUnsafePointerArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripUnsafeMutablePointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUnsafeMutablePointerArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } + } + } + } + } + }, { "abiName" : "bjs_consumeDataProcessorArrayType", "effects" : { diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 0319ce424..684ff02fc 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -1395,6 +1395,8 @@ function testArraySupport(exports) { assert.deepEqual(exports.roundTripUnsafeRawPointerArray(pointerValues), pointerValues); assert.deepEqual(exports.roundTripUnsafeMutableRawPointerArray(pointerValues), pointerValues); assert.deepEqual(exports.roundTripOpaquePointerArray(pointerValues), pointerValues); + assert.deepEqual(exports.roundTripUnsafePointerArray(pointerValues), pointerValues); + assert.deepEqual(exports.roundTripUnsafeMutablePointerArray(pointerValues), pointerValues); assert.deepEqual(exports.roundTripUnsafeRawPointerArray([]), []); // Default values From 794e7862bf526aec3eb80607b08e183b10398e8a Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 3 Feb 2026 20:02:07 +0900 Subject: [PATCH 128/252] BridgeJS: Re-organize snapshot test structure (#561) --- .github/workflows/test.yml | 2 +- .gitignore | 2 +- CONTRIBUTING.md | 6 + Plugins/BridgeJS/Package.swift | 2 +- Plugins/BridgeJS/README.md | 8 +- .../Sources/TS2Swift/JavaScript/package.json | 3 + .../Sources/TS2Swift/JavaScript/src/cli.js | 129 +- .../test/__snapshots__/ts2swift.test.js.snap | 313 ++++ .../test/fixtures}/ArrayParameter.d.ts | 0 .../JavaScript/test/fixtures}/Async.d.ts | 0 .../JavaScript/test/fixtures}/Interface.d.ts | 0 .../test/fixtures}/InvalidPropertyNames.d.ts | 0 .../test/fixtures}/MultipleImportedTypes.d.ts | 0 .../test/fixtures}/PrimitiveParameters.d.ts | 0 .../test/fixtures}/PrimitiveReturn.d.ts | 0 .../test/fixtures}/ReExportFrom.d.ts | 0 .../JavaScript/test/fixtures}/StringEnum.d.ts | 0 .../test/fixtures}/StringParameter.d.ts | 0 .../test/fixtures}/StringReturn.d.ts | 0 .../fixtures}/Support/ReExportTarget.d.ts | 0 .../test/fixtures}/TS2SkeletonLike.d.ts | 0 .../JavaScript/test/fixtures}/TypeAlias.d.ts | 0 .../test/fixtures}/TypeScriptClass.d.ts | 0 .../fixtures}/VoidParameterVoidReturn.d.ts | 0 .../JavaScript/test/fixtures}/tsconfig.json | 0 .../TS2Swift/JavaScript/test/ts2swift.test.js | 41 + .../TS2Swift/JavaScript/vitest.config.js | 9 + .../JSGetterMacroTests.swift | 2 +- .../BridgeJSCodegenTests.swift | 169 ++ .../BridgeJSToolTests/BridgeJSLinkTests.swift | 61 +- .../BridgeJSToolTests/ExportSwiftTests.swift | 158 -- .../BridgeJSToolTests/ImportTSTests.swift | 101 -- .../Inputs/{ => MacroSwift}/ArrayTypes.swift | 4 + .../Inputs/{ => MacroSwift}/Async.swift | 0 .../{ => MacroSwift}/DefaultParameters.swift | 0 .../EnumAssociatedValue.swift | 0 .../Inputs/{ => MacroSwift}/EnumCase.swift | 0 .../{ => MacroSwift}/EnumNamespace.swift | 0 .../Inputs/{ => MacroSwift}/EnumRawType.swift | 10 + .../MacroSwift}/GlobalGetter.swift | 0 .../MacroSwift}/GlobalThisImports.swift | 0 .../ImportedTypeInExportedInterface.swift | 0 .../MacroSwift/InvalidPropertyNames.swift | 29 + .../Inputs/MacroSwift/JSClass.swift | 15 + .../Inputs/{ => MacroSwift}/MixedGlobal.swift | 0 .../{ => MacroSwift}/MixedPrivate.swift | 0 .../Multifile}/CrossFileClassA.swift | 0 .../Multifile}/CrossFileClassB.swift | 0 .../Multifile}/CrossFileFunctionA.swift | 0 .../Multifile}/CrossFileFunctionB.swift | 0 .../Inputs/{ => MacroSwift}/Namespaces.swift | 0 .../Inputs/{ => MacroSwift}/Optionals.swift | 0 .../MacroSwift/PrimitiveParameters.swift | 2 + .../{ => MacroSwift}/PrimitiveReturn.swift | 3 + .../{ => MacroSwift}/PropertyTypes.swift | 0 .../Inputs/{ => MacroSwift}/Protocol.swift | 0 .../{ => MacroSwift}/StaticFunctions.swift | 0 .../{ => MacroSwift}/StaticProperties.swift | 0 .../Inputs/MacroSwift/StringParameter.swift | 5 + .../Inputs/MacroSwift/StringReturn.swift | 2 + .../Inputs/{ => MacroSwift}/SwiftClass.swift | 0 .../{ => MacroSwift}/SwiftClosure.swift | 0 .../MacroSwift}/SwiftClosureImports.swift | 0 .../Inputs/{ => MacroSwift}/SwiftStruct.swift | 0 .../MacroSwift}/SwiftStructImports.swift | 0 .../Inputs/{ => MacroSwift}/Throws.swift | 0 .../{ => MacroSwift}/UnsafePointer.swift | 0 .../MacroSwift/VoidParameterVoidReturn.swift | 2 + .../Inputs/PrimitiveParameters.swift | 1 - .../Inputs/StringParameter.swift | 2 - .../Inputs/StringReturn.swift | 1 - .../Inputs/VoidParameterVoidReturn.swift | 1 - .../TS2SwiftVitestTests.swift | 34 + .../BridgeJSCodegenTests/ArrayTypes.json | 1059 +++++++++++ .../ArrayTypes.swift | 54 +- .../BridgeJSCodegenTests/Async.json | 187 ++ .../Async.swift | 0 .../CrossFileFunctionTypes.ReverseOrder.json | 152 ++ .../CrossFileFunctionTypes.ReverseOrder.swift | 0 .../CrossFileFunctionTypes.json | 152 ++ .../CrossFileFunctionTypes.swift | 0 .../CrossFileTypeResolution.ReverseOrder.json | 64 + ...CrossFileTypeResolution.ReverseOrder.swift | 0 .../CrossFileTypeResolution.json | 64 + .../CrossFileTypeResolution.swift | 0 .../DefaultParameters.json | 1273 ++++++++++++++ .../DefaultParameters.swift | 0 .../EnumAssociatedValue.json | 847 +++++++++ .../EnumAssociatedValue.swift | 0 .../BridgeJSCodegenTests/EnumCase.json | 323 ++++ .../EnumCase.swift | 0 .../EnumNamespace.Global.json | 541 ++++++ .../EnumNamespace.Global.swift | 0 .../BridgeJSCodegenTests/EnumNamespace.json | 541 ++++++ .../EnumNamespace.swift | 0 .../BridgeJSCodegenTests/EnumRawType.json | 1543 +++++++++++++++++ .../EnumRawType.swift | 44 +- .../BridgeJSCodegenTests/GlobalGetter.json | 71 + .../GlobalGetter.swift} | 4 +- .../GlobalThisImports.json | 126 ++ .../GlobalThisImports.swift} | 10 +- .../ImportedTypeInExportedInterface.json | 65 + .../ImportedTypeInExportedInterface.swift | 17 + .../InvalidPropertyNames.json | 258 +++ .../InvalidPropertyNames.swift | 99 +- .../BridgeJSCodegenTests/JSClass.json | 172 ++ .../JSClass.swift} | 68 +- .../BridgeJSCodegenTests/MixedGlobal.json | 79 + .../MixedGlobal.swift | 0 .../BridgeJSCodegenTests/MixedPrivate.json | 79 + .../MixedPrivate.swift | 0 .../Namespaces.Global.json | 185 ++ .../Namespaces.Global.swift | 0 .../BridgeJSCodegenTests/Namespaces.json | 185 ++ .../Namespaces.swift | 0 .../BridgeJSCodegenTests/Optionals.json | 702 ++++++++ .../Optionals.swift | 0 .../PrimitiveParameters.json | 118 ++ .../PrimitiveParameters.swift | 27 + .../BridgeJSCodegenTests/PrimitiveReturn.json | 138 ++ .../PrimitiveReturn.swift | 34 + .../BridgeJSCodegenTests/PropertyTypes.json | 363 ++++ .../PropertyTypes.swift | 0 .../BridgeJSCodegenTests/Protocol.json | 901 ++++++++++ .../Protocol.swift | 0 .../StaticFunctions.Global.json | 339 ++++ .../StaticFunctions.Global.swift | 0 .../BridgeJSCodegenTests/StaticFunctions.json | 339 ++++ .../StaticFunctions.swift | 0 .../StaticProperties.Global.json | 342 ++++ .../StaticProperties.Global.swift | 0 .../StaticProperties.json | 342 ++++ .../StaticProperties.swift | 0 .../BridgeJSCodegenTests/StringParameter.json | 125 ++ .../StringParameter.swift | 25 +- .../BridgeJSCodegenTests/StringReturn.json | 59 + .../StringReturn.swift | 13 +- .../BridgeJSCodegenTests/SwiftClass.json | 145 ++ .../SwiftClass.swift | 0 .../BridgeJSCodegenTests/SwiftClosure.json | 1078 ++++++++++++ .../SwiftClosure.swift | 0 .../SwiftClosureImports.json | 110 ++ .../SwiftClosureImports.swift} | 30 +- .../BridgeJSCodegenTests/SwiftStruct.json | 523 ++++++ .../SwiftStruct.swift | 0 .../SwiftStructImports.json | 94 + .../SwiftStructImports.swift | 64 + .../BridgeJSCodegenTests/Throws.json | 37 + .../Throws.swift | 0 .../BridgeJSCodegenTests/UnsafePointer.json | 416 +++++ .../UnsafePointer.swift | 0 .../VoidParameterVoidReturn.json | 59 + .../VoidParameterVoidReturn.swift | 12 +- .../ArrayParameter.Import.d.ts | 20 - .../ArrayParameter.Import.js | 245 --- ...ArrayTypes.Export.d.ts => ArrayTypes.d.ts} | 3 + .../{ArrayTypes.Export.js => ArrayTypes.js} | 23 + .../BridgeJSLinkTests/Async.Import.d.ts | 24 - .../BridgeJSLinkTests/Async.Import.js | 289 --- .../{Async.Export.d.ts => Async.d.ts} | 0 .../{Async.Export.js => Async.js} | 0 ...ers.Export.d.ts => DefaultParameters.d.ts} | 0 ...ameters.Export.js => DefaultParameters.js} | 0 ...e.Export.d.ts => EnumAssociatedValue.d.ts} | 0 ...Value.Export.js => EnumAssociatedValue.js} | 0 .../{EnumCase.Export.d.ts => EnumCase.d.ts} | 0 .../{EnumCase.Export.js => EnumCase.js} | 0 ....Export.d.ts => EnumNamespace.Global.d.ts} | 0 ...obal.Export.js => EnumNamespace.Global.js} | 0 ...mespace.Export.d.ts => EnumNamespace.d.ts} | 0 ...umNamespace.Export.js => EnumNamespace.js} | 0 ...umRawType.Export.d.ts => EnumRawType.d.ts} | 2 + .../{EnumRawType.Export.js => EnumRawType.js} | 45 +- ...er.ImportMacros.d.ts => GlobalGetter.d.ts} | 0 ...Getter.ImportMacros.js => GlobalGetter.js} | 0 ...portMacros.d.ts => GlobalThisImports.d.ts} | 0 ...s.ImportMacros.js => GlobalThisImports.js} | 0 ...s => ImportedTypeInExportedInterface.d.ts} | 0 ....js => ImportedTypeInExportedInterface.js} | 0 .../BridgeJSLinkTests/Interface.Import.d.ts | 22 - .../BridgeJSLinkTests/Interface.Import.js | 251 --- ....Import.d.ts => InvalidPropertyNames.d.ts} | 5 - ...ames.Import.js => InvalidPropertyNames.js} | 27 - ...peScriptClass.Import.d.ts => JSClass.d.ts} | 5 + .../{TypeScriptClass.Import.js => JSClass.js} | 27 + ...xedGlobal.Export.d.ts => MixedGlobal.d.ts} | 0 .../{MixedGlobal.Export.js => MixedGlobal.js} | 0 ...dModules.Export.d.ts => MixedModules.d.ts} | 0 ...MixedModules.Export.js => MixedModules.js} | 0 ...dPrivate.Export.d.ts => MixedPrivate.d.ts} | 0 ...MixedPrivate.Export.js => MixedPrivate.js} | 0 .../MultipleImportedTypes.Import.d.ts | 36 - .../MultipleImportedTypes.Import.js | 354 ---- ...bal.Export.d.ts => Namespaces.Global.d.ts} | 0 ....Global.Export.js => Namespaces.Global.js} | 0 ...Namespaces.Export.d.ts => Namespaces.d.ts} | 0 .../{Namespaces.Export.js => Namespaces.js} | 0 .../{Optionals.Export.d.ts => Optionals.d.ts} | 0 .../{Optionals.Export.js => Optionals.js} | 0 .../PrimitiveParameters.Export.js | 225 --- .../PrimitiveParameters.Import.d.ts | 18 - ...s.Export.d.ts => PrimitiveParameters.d.ts} | 1 + ...eters.Import.js => PrimitiveParameters.js} | 3 + .../PrimitiveReturn.Import.d.ts | 19 - .../PrimitiveReturn.Import.js | 242 --- ...eturn.Export.d.ts => PrimitiveReturn.d.ts} | 2 + ...iveReturn.Export.js => PrimitiveReturn.js} | 20 + ...tyTypes.Export.d.ts => PropertyTypes.d.ts} | 0 ...opertyTypes.Export.js => PropertyTypes.js} | 0 .../{Protocol.Export.d.ts => Protocol.d.ts} | 0 .../{Protocol.Export.js => Protocol.js} | 0 .../ReExportFrom.Import.d.ts | 24 - .../BridgeJSLinkTests/ReExportFrom.Import.js | 252 --- ...xport.d.ts => StaticFunctions.Global.d.ts} | 0 ...al.Export.js => StaticFunctions.Global.js} | 0 ...tions.Export.d.ts => StaticFunctions.d.ts} | 0 ...Functions.Export.js => StaticFunctions.js} | 0 ...port.d.ts => StaticProperties.Global.d.ts} | 0 ...l.Export.js => StaticProperties.Global.js} | 0 ...ties.Export.d.ts => StaticProperties.d.ts} | 0 ...operties.Export.js => StaticProperties.js} | 0 .../BridgeJSLinkTests/StringEnum.Import.d.ts | 19 - .../BridgeJSLinkTests/StringEnum.Import.js | 242 --- .../StringParameter.Export.d.ts | 19 - .../StringParameter.Export.js | 237 --- ...meter.Import.d.ts => StringParameter.d.ts} | 2 + ...Parameter.Import.js => StringParameter.js} | 15 + .../BridgeJSLinkTests/StringReturn.Export.js | 228 --- .../StringReturn.Import.d.ts | 18 - ...ngReturn.Export.d.ts => StringReturn.d.ts} | 1 + ...StringReturn.Import.js => StringReturn.js} | 6 + ...SwiftClass.Export.d.ts => SwiftClass.d.ts} | 0 .../{SwiftClass.Export.js => SwiftClass.js} | 0 ...tClosure.Export.d.ts => SwiftClosure.d.ts} | 0 ...SwiftClosure.Export.js => SwiftClosure.js} | 0 ...rtMacros.d.ts => SwiftClosureImports.d.ts} | 0 ...ImportMacros.js => SwiftClosureImports.js} | 0 ...iftStruct.Export.d.ts => SwiftStruct.d.ts} | 0 .../{SwiftStruct.Export.js => SwiftStruct.js} | 0 ...ortMacros.d.ts => SwiftStructImports.d.ts} | 0 ....ImportMacros.js => SwiftStructImports.js} | 0 .../TS2SkeletonLike.Import.d.ts | 28 - .../TS2SkeletonLike.Import.js | 293 ---- .../{Throws.Export.d.ts => Throws.d.ts} | 0 .../{Throws.Export.js => Throws.js} | 0 .../BridgeJSLinkTests/TypeAlias.Import.d.ts | 18 - .../BridgeJSLinkTests/TypeAlias.Import.js | 231 --- ...Pointer.Export.d.ts => UnsafePointer.d.ts} | 0 ...safePointer.Export.js => UnsafePointer.js} | 0 .../VoidParameterVoidReturn.Export.d.ts | 18 - .../VoidParameterVoidReturn.Export.js | 225 --- ...port.d.ts => VoidParameterVoidReturn.d.ts} | 1 + ...n.Import.js => VoidParameterVoidReturn.js} | 3 + .../ExportSwiftTests/ArrayTypes.json | 983 ----------- .../__Snapshots__/ExportSwiftTests/Async.json | 184 -- .../CrossFileFunctionTypes.ReverseOrder.json | 149 -- .../CrossFileFunctionTypes.json | 149 -- .../CrossFileTypeResolution.ReverseOrder.json | 61 - .../CrossFileTypeResolution.json | 61 - .../ExportSwiftTests/DefaultParameters.json | 1270 -------------- .../ExportSwiftTests/EnumAssociatedValue.json | 844 --------- .../ExportSwiftTests/EnumCase.json | 320 ---- .../EnumNamespace.Global.json | 538 ------ .../ExportSwiftTests/EnumNamespace.json | 538 ------ .../ExportSwiftTests/EnumRawType.json | 1498 ---------------- .../ImportedTypeInExportedInterface.json | 34 - .../ExportSwiftTests/MixedGlobal.json | 76 - .../ExportSwiftTests/MixedPrivate.json | 76 - .../ExportSwiftTests/Namespaces.Global.json | 182 -- .../ExportSwiftTests/Namespaces.json | 182 -- .../ExportSwiftTests/Optionals.json | 699 -------- .../ExportSwiftTests/PrimitiveParameters.json | 78 - .../PrimitiveParameters.swift | 9 - .../ExportSwiftTests/PrimitiveReturn.json | 102 -- .../ExportSwiftTests/PropertyTypes.json | 360 ---- .../ExportSwiftTests/Protocol.json | 898 ---------- .../StaticFunctions.Global.json | 336 ---- .../ExportSwiftTests/StaticFunctions.json | 336 ---- .../StaticProperties.Global.json | 339 ---- .../ExportSwiftTests/StaticProperties.json | 339 ---- .../ExportSwiftTests/StringParameter.json | 67 - .../ExportSwiftTests/StringParameter.swift | 20 - .../ExportSwiftTests/StringReturn.json | 34 - .../ExportSwiftTests/StringReturn.swift | 10 - .../ExportSwiftTests/SwiftClass.json | 142 -- .../ExportSwiftTests/SwiftClosure.json | 1075 ------------ .../ExportSwiftTests/SwiftStruct.json | 520 ------ .../ExportSwiftTests/Throws.json | 34 - .../ExportSwiftTests/UnsafePointer.json | 413 ----- .../VoidParameterVoidReturn.json | 34 - .../VoidParameterVoidReturn.swift | 9 - .../ImportTSTests/ArrayParameter.Macros.swift | 13 - .../ImportTSTests/ArrayParameter.swift | 51 - .../ImportTSTests/Async.Macros.swift | 21 - .../__Snapshots__/ImportTSTests/Async.swift | 124 -- .../ImportTSTests/Interface.Macros.swift | 14 - .../ImportTSTests/Interface.swift | 55 - .../InvalidPropertyNames.Macros.swift | 44 - .../MultipleImportedTypes.Macros.swift | 33 - .../ImportTSTests/MultipleImportedTypes.swift | 254 --- .../PrimitiveParameters.Macros.swift | 9 - .../ImportTSTests/PrimitiveParameters.swift | 17 - .../PrimitiveReturn.Macros.swift | 11 - .../ImportTSTests/PrimitiveReturn.swift | 33 - .../ImportTSTests/ReExportFrom.Macros.swift | 14 - .../ImportTSTests/ReExportFrom.swift | 53 - .../ImportTSTests/StringEnum.Macros.swift | 17 - .../ImportTSTests/StringEnum.swift | 33 - .../StringParameter.Macros.swift | 11 - .../ImportTSTests/StringReturn.Macros.swift | 9 - .../SwiftStructImports.ImportMacros.swift | 19 - .../TS2SkeletonLike.Macros.swift | 22 - .../ImportTSTests/TS2SkeletonLike.swift | 127 -- .../ImportTSTests/TypeAlias.Macros.swift | 9 - .../ImportTSTests/TypeAlias.swift | 16 - .../TypeScriptClass.Macros.swift | 16 - .../VoidParameterVoidReturn.Macros.swift | 9 - package-lock.json | 1397 +++++++++++++-- package.json | 3 +- 319 files changed, 16721 insertions(+), 18314 deletions(-) create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/ArrayParameter.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/Async.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/Interface.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/InvalidPropertyNames.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/MultipleImportedTypes.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/PrimitiveParameters.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/PrimitiveReturn.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/ReExportFrom.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/StringEnum.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/StringParameter.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/StringReturn.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/Support/ReExportTarget.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/TS2SkeletonLike.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/TypeAlias.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/TypeScriptClass.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/VoidParameterVoidReturn.d.ts (100%) rename Plugins/BridgeJS/{Tests/BridgeJSToolTests/Inputs => Sources/TS2Swift/JavaScript/test/fixtures}/tsconfig.json (100%) create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/vitest.config.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSCodegenTests.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/ArrayTypes.swift (88%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/Async.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/DefaultParameters.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/EnumAssociatedValue.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/EnumCase.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/EnumNamespace.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/EnumRawType.swift (91%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/{ImportMacroInputs => Inputs/MacroSwift}/GlobalGetter.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/{ImportMacroInputs => Inputs/MacroSwift}/GlobalThisImports.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/ImportedTypeInExportedInterface.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/InvalidPropertyNames.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClass.swift rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/MixedGlobal.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/MixedPrivate.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/{MultifileInputs => Inputs/MacroSwift/Multifile}/CrossFileClassA.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/{MultifileInputs => Inputs/MacroSwift/Multifile}/CrossFileClassB.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/{MultifileInputs => Inputs/MacroSwift/Multifile}/CrossFileFunctionA.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/{MultifileInputs => Inputs/MacroSwift/Multifile}/CrossFileFunctionB.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/Namespaces.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/Optionals.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/PrimitiveParameters.swift rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/PrimitiveReturn.swift (65%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/PropertyTypes.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/Protocol.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/StaticFunctions.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/StaticProperties.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/StringParameter.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/StringReturn.swift rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/SwiftClass.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/SwiftClosure.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/{ImportMacroInputs => Inputs/MacroSwift}/SwiftClosureImports.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/SwiftStruct.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/{ImportMacroInputs => Inputs/MacroSwift}/SwiftStructImports.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/Throws.swift (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/{ => MacroSwift}/UnsafePointer.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/VoidParameterVoidReturn.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveParameters.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringParameter.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringReturn.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/VoidParameterVoidReturn.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/TS2SwiftVitestTests.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/ArrayTypes.swift (91%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/Async.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.ReverseOrder.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/CrossFileFunctionTypes.ReverseOrder.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/CrossFileFunctionTypes.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/CrossFileTypeResolution.ReverseOrder.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/CrossFileTypeResolution.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/DefaultParameters.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/EnumAssociatedValue.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumCase.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/EnumCase.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/EnumNamespace.Global.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/EnumNamespace.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/EnumRawType.swift (90%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ImportTSTests/GlobalGetter.ImportMacros.swift => BridgeJSCodegenTests/GlobalGetter.swift} (88%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ImportTSTests/GlobalThisImports.ImportMacros.swift => BridgeJSCodegenTests/GlobalThisImports.swift} (88%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/ImportedTypeInExportedInterface.swift (62%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ImportTSTests => BridgeJSCodegenTests}/InvalidPropertyNames.swift (77%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ImportTSTests/TypeScriptClass.swift => BridgeJSCodegenTests/JSClass.swift} (55%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedGlobal.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/MixedGlobal.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedPrivate.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/MixedPrivate.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/Namespaces.Global.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/Namespaces.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/Optionals.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/PrimitiveReturn.swift (59%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/PropertyTypes.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/Protocol.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/StaticFunctions.Global.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/StaticFunctions.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/StaticProperties.Global.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/StaticProperties.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringParameter.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ImportTSTests => BridgeJSCodegenTests}/StringParameter.swift (54%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringReturn.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ImportTSTests => BridgeJSCodegenTests}/StringReturn.swift (53%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/SwiftClass.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/SwiftClosure.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ImportTSTests/SwiftClosureImports.ImportMacros.swift => BridgeJSCodegenTests/SwiftClosureImports.swift} (62%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/SwiftStruct.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Throws.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/Throws.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ExportSwiftTests => BridgeJSCodegenTests}/UnsafePointer.swift (100%) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/VoidParameterVoidReturn.json rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/{ImportTSTests => BridgeJSCodegenTests}/VoidParameterVoidReturn.swift (54%) delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.d.ts delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{ArrayTypes.Export.d.ts => ArrayTypes.d.ts} (96%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{ArrayTypes.Export.js => ArrayTypes.js} (97%) delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.d.ts delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Async.Export.d.ts => Async.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Async.Export.js => Async.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{DefaultParameters.Export.d.ts => DefaultParameters.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{DefaultParameters.Export.js => DefaultParameters.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{EnumAssociatedValue.Export.d.ts => EnumAssociatedValue.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{EnumAssociatedValue.Export.js => EnumAssociatedValue.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{EnumCase.Export.d.ts => EnumCase.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{EnumCase.Export.js => EnumCase.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{EnumNamespace.Global.Export.d.ts => EnumNamespace.Global.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{EnumNamespace.Global.Export.js => EnumNamespace.Global.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{EnumNamespace.Export.d.ts => EnumNamespace.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{EnumNamespace.Export.js => EnumNamespace.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{EnumRawType.Export.d.ts => EnumRawType.d.ts} (98%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{EnumRawType.Export.js => EnumRawType.js} (91%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{GlobalGetter.ImportMacros.d.ts => GlobalGetter.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{GlobalGetter.ImportMacros.js => GlobalGetter.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{GlobalThisImports.ImportMacros.d.ts => GlobalThisImports.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{GlobalThisImports.ImportMacros.js => GlobalThisImports.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{ImportedTypeInExportedInterface.Export.d.ts => ImportedTypeInExportedInterface.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{ImportedTypeInExportedInterface.Export.js => ImportedTypeInExportedInterface.js} (100%) delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.d.ts delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{InvalidPropertyNames.Import.d.ts => InvalidPropertyNames.d.ts} (85%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{InvalidPropertyNames.Import.js => InvalidPropertyNames.js} (93%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{TypeScriptClass.Import.d.ts => JSClass.d.ts} (81%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{TypeScriptClass.Import.js => JSClass.js} (89%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{MixedGlobal.Export.d.ts => MixedGlobal.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{MixedGlobal.Export.js => MixedGlobal.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{MixedModules.Export.d.ts => MixedModules.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{MixedModules.Export.js => MixedModules.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{MixedPrivate.Export.d.ts => MixedPrivate.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{MixedPrivate.Export.js => MixedPrivate.js} (100%) delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.d.ts delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Namespaces.Global.Export.d.ts => Namespaces.Global.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Namespaces.Global.Export.js => Namespaces.Global.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Namespaces.Export.d.ts => Namespaces.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Namespaces.Export.js => Namespaces.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Optionals.Export.d.ts => Optionals.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Optionals.Export.js => Optionals.js} (100%) delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.d.ts rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{PrimitiveParameters.Export.d.ts => PrimitiveParameters.d.ts} (93%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{PrimitiveParameters.Import.js => PrimitiveParameters.js} (98%) delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.d.ts delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{PrimitiveReturn.Export.d.ts => PrimitiveReturn.d.ts} (91%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{PrimitiveReturn.Export.js => PrimitiveReturn.js} (92%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{PropertyTypes.Export.d.ts => PropertyTypes.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{PropertyTypes.Export.js => PropertyTypes.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Protocol.Export.d.ts => Protocol.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Protocol.Export.js => Protocol.js} (100%) delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.d.ts delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StaticFunctions.Global.Export.d.ts => StaticFunctions.Global.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StaticFunctions.Global.Export.js => StaticFunctions.Global.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StaticFunctions.Export.d.ts => StaticFunctions.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StaticFunctions.Export.js => StaticFunctions.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StaticProperties.Global.Export.d.ts => StaticProperties.Global.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StaticProperties.Global.Export.js => StaticProperties.Global.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StaticProperties.Export.d.ts => StaticProperties.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StaticProperties.Export.js => StaticProperties.js} (100%) delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.d.ts delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.d.ts delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StringParameter.Import.d.ts => StringParameter.d.ts} (89%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StringParameter.Import.js => StringParameter.js} (92%) delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.d.ts rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StringReturn.Export.d.ts => StringReturn.d.ts} (95%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{StringReturn.Import.js => StringReturn.js} (97%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{SwiftClass.Export.d.ts => SwiftClass.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{SwiftClass.Export.js => SwiftClass.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{SwiftClosure.Export.d.ts => SwiftClosure.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{SwiftClosure.Export.js => SwiftClosure.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{SwiftClosureImports.ImportMacros.d.ts => SwiftClosureImports.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{SwiftClosureImports.ImportMacros.js => SwiftClosureImports.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{SwiftStruct.Export.d.ts => SwiftStruct.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{SwiftStruct.Export.js => SwiftStruct.js} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{SwiftStructImports.ImportMacros.d.ts => SwiftStructImports.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{SwiftStructImports.ImportMacros.js => SwiftStructImports.js} (100%) delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.d.ts delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Throws.Export.d.ts => Throws.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{Throws.Export.js => Throws.js} (100%) delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.d.ts delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{UnsafePointer.Export.d.ts => UnsafePointer.d.ts} (100%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{UnsafePointer.Export.js => UnsafePointer.js} (100%) delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.d.ts delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{VoidParameterVoidReturn.Import.d.ts => VoidParameterVoidReturn.d.ts} (96%) rename Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/{VoidParameterVoidReturn.Import.js => VoidParameterVoidReturn.js} (98%) delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftStructImports.ImportMacros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift delete mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6b5ace046..2859b7043 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -86,7 +86,7 @@ jobs: with: node-version: '20' - name: Install TypeScript - run: npm install --prefix Plugins/BridgeJS/Sources/TS2Swift/JavaScript + run: npm install - name: Run BridgeJS tests # NOTE: Seems like the prebuilt SwiftSyntax binaries are not compatible with # non-macro dependents, so disable experimental prebuilts for now. diff --git a/.gitignore b/.gitignore index 8dba07278..c34d4dfe2 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ xcuserdata/ Examples/*/Bundle Examples/*/package-lock.json Package.resolved -Plugins/BridgeJS/Sources/JavaScript/package-lock.json +Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package-lock.json Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/**/*.actual bridge-js.config.local.json _site/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 339a268ee..d984555e6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -60,6 +60,12 @@ Tests for `BridgeJS` plugin: swift test --package-path ./Plugins/BridgeJS ``` +This runs both the TS2Swift Vitest suite (TypeScript `.d.ts` -> Swift macro output) and the Swift codegen/link tests. For fast iteration on the ts2swift tool only, run Vitest directly: + +```bash +cd Plugins/BridgeJS/Sources/TS2Swift/JavaScript && npm test +``` + To update snapshot test files when expected output changes: ```bash diff --git a/Plugins/BridgeJS/Package.swift b/Plugins/BridgeJS/Package.swift index a03172f17..49aa161c9 100644 --- a/Plugins/BridgeJS/Package.swift +++ b/Plugins/BridgeJS/Package.swift @@ -59,7 +59,7 @@ let package = Package( "BridgeJSLink", "TS2Swift", ], - exclude: ["__Snapshots__", "Inputs", "MultifileInputs", "ImportMacroInputs"] + exclude: ["__Snapshots__", "Inputs"] ), .macro( name: "BridgeJSMacros", diff --git a/Plugins/BridgeJS/README.md b/Plugins/BridgeJS/README.md index 0e84674ac..0559dc3fb 100644 --- a/Plugins/BridgeJS/README.md +++ b/Plugins/BridgeJS/README.md @@ -100,7 +100,7 @@ graph LR | `Foundation.URL` | `string` | - | [#496](https://github.com/swiftwasm/JavaScriptKit/issues/496) | | Generics | - | - | [#398](https://github.com/swiftwasm/JavaScriptKit/issues/398) | -### Import-specific (TypeScript → Swift) +### Import-specific (TypeScript -> Swift) | TypeScript Type | Swift Type | Status | |:----------------|:-----------|:-------| @@ -163,6 +163,12 @@ Return values use direct Wasm returns for primitives, and imported intrinsic fun For detailed semantics, see the [How It Works sections](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/exporting-swift-class#How-It-Works) in the user documentation. +## Testing + +- **Full BridgeJS tests** (Swift + TS2Swift Vitest): `swift test --package-path ./Plugins/BridgeJS` +- **TS2Swift only** (fast iteration on `.d.ts` -> Swift): `npm -C Sources/TS2Swift/JavaScript test` +- **Regenerate snapshot artifacts**: `UPDATE_SNAPSHOTS=1 swift test --package-path ./Plugins/BridgeJS` + ## Debug utilities `BridgeJSToolInternal` exposes pipeline stages for debugging: diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json index d6b34558d..de3af1ab8 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json @@ -5,5 +5,8 @@ }, "bin": { "ts2swift": "./bin/ts2swift.js" + }, + "scripts": { + "test": "vitest run" } } diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js index 922b8dbbc..766cd0432 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js @@ -76,13 +76,80 @@ function printUsage() { console.error('Usage: ts2swift -p [--global ]... [-o output.swift]'); } +/** + * Run ts2swift for a single input file (programmatic API, no process I/O). + * @param {string} filePath - Path to the .d.ts file + * @param {{ tsconfigPath: string, logLevel?: string, globalFiles?: string[] }} options + * @returns {string} Generated Swift source + * @throws {Error} on parse/type-check errors (diagnostics are included in the message) + */ +export function run(filePath, options) { + const { tsconfigPath, logLevel = 'info', globalFiles: globalFilesOpt = [] } = options; + const globalFiles = Array.isArray(globalFilesOpt) ? globalFilesOpt : (globalFilesOpt ? [globalFilesOpt] : []); + + const diagnosticEngine = new DiagnosticEngine(logLevel); + + const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile); + const configParseResult = ts.parseJsonConfigFileContent( + configFile.config, + ts.sys, + path.dirname(path.resolve(tsconfigPath)) + ); + + if (configParseResult.errors.length > 0) { + const message = ts.formatDiagnosticsWithColorAndContext(configParseResult.errors, { + getCanonicalFileName: (fileName) => fileName, + getNewLine: () => ts.sys.newLine, + getCurrentDirectory: () => ts.sys.getCurrentDirectory(), + }); + throw new Error(`TypeScript config/parse errors:\n${message}`); + } + + const program = TypeProcessor.createProgram([filePath, ...globalFiles], configParseResult.options); + const diagnostics = program.getSemanticDiagnostics(); + if (diagnostics.length > 0) { + const message = ts.formatDiagnosticsWithColorAndContext(diagnostics, { + getCanonicalFileName: (fileName) => fileName, + getNewLine: () => ts.sys.newLine, + getCurrentDirectory: () => ts.sys.getCurrentDirectory(), + }); + throw new Error(`TypeScript semantic errors:\n${message}`); + } + + const prelude = [ + "// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit", + "", + "", + ].join("\n"); + + /** @type {string[]} */ + const bodies = []; + const globalFileSet = new Set(globalFiles); + for (const inputPath of [filePath, ...globalFiles]) { + const processor = new TypeProcessor(program.getTypeChecker(), diagnosticEngine, { + defaultImportFromGlobal: globalFileSet.has(inputPath), + }); + const result = processor.processTypeDeclarations(program, inputPath); + const body = result.content.trim(); + if (body.length > 0) bodies.push(body); + } + + const hasAny = bodies.length > 0; + return hasAny ? prelude + bodies.join("\n\n") + "\n" : ""; +} + /** * Main function to run the CLI * @param {string[]} args - Command-line arguments * @returns {void} */ export function main(args) { - // Parse command line arguments const options = parseArgs({ args, options: { @@ -118,64 +185,24 @@ export function main(args) { } const filePath = options.positionals[0]; - const diagnosticEngine = new DiagnosticEngine(options.values["log-level"] || "info"); - - diagnosticEngine.print("verbose", `Processing ${filePath}...`); - - // Create TypeScript program and process declarations - const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile); - const configParseResult = ts.parseJsonConfigFileContent( - configFile.config, - ts.sys, - path.dirname(path.resolve(tsconfigPath)) - ); - - if (configParseResult.errors.length > 0) { - diagnosticEngine.tsDiagnose(configParseResult.errors); - process.exit(1); - } - + const logLevel = options.values["log-level"] || "info"; /** @type {string[]} */ const globalFiles = Array.isArray(options.values.global) ? options.values.global : (options.values.global ? [options.values.global] : []); - const program = TypeProcessor.createProgram([filePath, ...globalFiles], configParseResult.options); - const diagnostics = program.getSemanticDiagnostics(); - if (diagnostics.length > 0) { - diagnosticEngine.tsDiagnose(diagnostics); - process.exit(1); - } - - const prelude = [ - "// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit", - "", - "", - ].join("\n"); + const diagnosticEngine = new DiagnosticEngine(logLevel); + diagnosticEngine.print("verbose", `Processing ${filePath}...`); - /** @type {string[]} */ - const bodies = []; - const globalFileSet = new Set(globalFiles); - for (const inputPath of [filePath, ...globalFiles]) { - const processor = new TypeProcessor(program.getTypeChecker(), diagnosticEngine, { - defaultImportFromGlobal: globalFileSet.has(inputPath), - }); - const result = processor.processTypeDeclarations(program, inputPath); - const body = result.content.trim(); - if (body.length > 0) bodies.push(body); + let swiftOutput; + try { + swiftOutput = run(filePath, { tsconfigPath, logLevel, globalFiles }); + } catch (err) { + console.error(err.message); + process.exit(1); } - - const hasAny = bodies.length > 0; - const swiftOutput = hasAny ? prelude + bodies.join("\n\n") + "\n" : ""; - if (options.values.output) { - if (hasAny) { + if (swiftOutput.length > 0) { fs.mkdirSync(path.dirname(options.values.output), { recursive: true }); fs.writeFileSync(options.values.output, swiftOutput); } diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap new file mode 100644 index 000000000..5b5316a40 --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -0,0 +1,313 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`ts2swift > snapshots Swift output for ArrayParameter.d.ts > ArrayParameter 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func checkArray(_ a: JSObject) throws (JSException) -> Void + +@JSFunction func checkArrayWithLength(_ a: JSObject, _ b: Double) throws (JSException) -> Void + +@JSFunction func checkArray(_ a: JSObject) throws (JSException) -> Void +" +`; + +exports[`ts2swift > snapshots Swift output for Async.d.ts > Async 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func asyncReturnVoid() throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripInt(_ v: Double) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripString(_ v: String) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripBool(_ v: Bool) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripFloat(_ v: Double) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripDouble(_ v: Double) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripJSObject(_ v: JSObject) throws (JSException) -> JSPromise +" +`; + +exports[`ts2swift > snapshots Swift output for Interface.d.ts > Interface 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func returnAnimatable() throws (JSException) -> Animatable + +@JSClass struct Animatable { + @JSFunction func animate(_ keyframes: JSObject, _ options: JSObject) throws (JSException) -> JSObject + @JSFunction func getAnimations(_ options: JSObject) throws (JSException) -> JSObject +} +" +`; + +exports[`ts2swift > snapshots Swift output for InvalidPropertyNames.d.ts > InvalidPropertyNames 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func createArrayBuffer() throws (JSException) -> ArrayBufferLike + +@JSClass struct ArrayBufferLike { + @JSGetter var byteLength: Double + @JSFunction func slice(_ begin: Double, _ end: Double) throws (JSException) -> ArrayBufferLike +} + +@JSFunction func createWeirdObject() throws (JSException) -> WeirdNaming + +@JSClass struct WeirdNaming { + @JSGetter var normalProperty: String + @JSSetter func setNormalProperty(_ value: String) throws (JSException) + @JSGetter(jsName: "property-with-dashes") var property_with_dashes: Double + @JSSetter(jsName: "property-with-dashes") func setProperty_with_dashes(_ value: Double) throws (JSException) + @JSGetter(jsName: "123invalidStart") var _123invalidStart: Bool + @JSSetter(jsName: "123invalidStart") func set_123invalidStart(_ value: Bool) throws (JSException) + @JSGetter(jsName: "property with spaces") var property_with_spaces: String + @JSSetter(jsName: "property with spaces") func setProperty_with_spaces(_ value: String) throws (JSException) + @JSGetter(jsName: "@specialChar") var _specialChar: Double + @JSSetter(jsName: "@specialChar") func set_specialChar(_ value: Double) throws (JSException) + @JSGetter var constructor: String + @JSSetter func setConstructor(_ value: String) throws (JSException) + @JSGetter var \`for\`: String + @JSSetter func setFor(_ value: String) throws (JSException) + @JSGetter var \`Any\`: String + @JSSetter(jsName: "Any") func setAny(_ value: String) throws (JSException) + @JSFunction func \`as\`() throws (JSException) -> Void + @JSFunction func \`try\`() throws (JSException) -> Void +} + +@JSClass(jsName: "$Weird") struct _Weird { + @JSFunction init() throws (JSException) + @JSFunction(jsName: "method-with-dashes") func method_with_dashes() throws (JSException) -> Void +} + +@JSFunction func createWeirdClass() throws (JSException) -> _Weird +" +`; + +exports[`ts2swift > snapshots Swift output for MultipleImportedTypes.d.ts > MultipleImportedTypes 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func createDatabaseConnection(_ config: JSObject) throws (JSException) -> DatabaseConnection + +@JSClass struct DatabaseConnection { + @JSFunction func connect(_ url: String) throws (JSException) -> Void + @JSFunction func execute(_ query: String) throws (JSException) -> JSObject + @JSGetter var isConnected: Bool + @JSGetter var connectionTimeout: Double + @JSSetter func setConnectionTimeout(_ value: Double) throws (JSException) +} + +@JSFunction func createLogger(_ level: String) throws (JSException) -> Logger + +@JSClass struct Logger { + @JSFunction func log(_ message: String) throws (JSException) -> Void + @JSFunction func error(_ message: String, _ error: JSObject) throws (JSException) -> Void + @JSGetter var level: String +} + +@JSFunction func getConfigManager() throws (JSException) -> ConfigManager + +@JSClass struct ConfigManager { + @JSFunction func get(_ key: String) throws (JSException) -> JSObject + @JSFunction func set(_ key: String, _ value: JSObject) throws (JSException) -> Void + @JSGetter var configPath: String +} +" +`; + +exports[`ts2swift > snapshots Swift output for PrimitiveParameters.d.ts > PrimitiveParameters 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func check(_ a: Double, _ b: Bool) throws (JSException) -> Void +" +`; + +exports[`ts2swift > snapshots Swift output for PrimitiveReturn.d.ts > PrimitiveReturn 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func checkNumber() throws (JSException) -> Double + +@JSFunction func checkBoolean() throws (JSException) -> Bool +" +`; + +exports[`ts2swift > snapshots Swift output for ReExportFrom.d.ts > ReExportFrom 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func jsRoundTripNumber(_ v: Double) throws (JSException) -> Double + +@JSClass struct JsGreeter { + @JSFunction init(_ name: String) throws (JSException) + @JSFunction func greet() throws (JSException) -> String +} +" +`; + +exports[`ts2swift > snapshots Swift output for StringEnum.d.ts > StringEnum 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +enum FeatureFlag: String { + case foo = "foo" + case bar = "bar" +} +extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} + +@JSFunction func takesFeatureFlag(_ flag: FeatureFlag) throws (JSException) -> Void + +@JSFunction func returnsFeatureFlag() throws (JSException) -> FeatureFlag +" +`; + +exports[`ts2swift > snapshots Swift output for StringParameter.d.ts > StringParameter 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func checkString(_ a: String) throws (JSException) -> Void + +@JSFunction func checkStringWithLength(_ a: String, _ b: Double) throws (JSException) -> Void +" +`; + +exports[`ts2swift > snapshots Swift output for StringReturn.d.ts > StringReturn 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func checkString() throws (JSException) -> String +" +`; + +exports[`ts2swift > snapshots Swift output for TS2SkeletonLike.d.ts > TS2SkeletonLike 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func createTS2Skeleton() throws (JSException) -> TypeScriptProcessor + +@JSClass struct TypeScriptProcessor { + @JSFunction func convert(_ ts: String) throws (JSException) -> String + @JSFunction func validate(_ ts: String) throws (JSException) -> Bool + @JSGetter var version: String +} + +@JSFunction func createCodeGenerator(_ format: String) throws (JSException) -> CodeGenerator + +@JSClass struct CodeGenerator { + @JSFunction func generate(_ input: JSObject) throws (JSException) -> String + @JSGetter var outputFormat: String +} +" +`; + +exports[`ts2swift > snapshots Swift output for TypeAlias.d.ts > TypeAlias 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func checkSimple(_ a: Double) throws (JSException) -> Void +" +`; + +exports[`ts2swift > snapshots Swift output for TypeScriptClass.d.ts > TypeScriptClass 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSClass struct Greeter { + @JSGetter var name: String + @JSSetter func setName(_ value: String) throws (JSException) + @JSGetter var age: Double + @JSFunction init(_ name: String) throws (JSException) + @JSFunction func greet() throws (JSException) -> String + @JSFunction func changeName(_ name: String) throws (JSException) -> Void +} +" +`; + +exports[`ts2swift > snapshots Swift output for VoidParameterVoidReturn.d.ts > VoidParameterVoidReturn 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func check() throws (JSException) -> Void +" +`; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ArrayParameter.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ArrayParameter.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ArrayParameter.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ArrayParameter.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Async.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/Async.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Async.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/Async.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Interface.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/Interface.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Interface.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/Interface.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/InvalidPropertyNames.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/InvalidPropertyNames.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/InvalidPropertyNames.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/InvalidPropertyNames.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MultipleImportedTypes.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/MultipleImportedTypes.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MultipleImportedTypes.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/MultipleImportedTypes.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveParameters.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/PrimitiveParameters.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveParameters.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/PrimitiveParameters.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveReturn.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/PrimitiveReturn.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveReturn.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/PrimitiveReturn.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ReExportFrom.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ReExportFrom.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ReExportFrom.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ReExportFrom.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringEnum.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StringEnum.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringEnum.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StringEnum.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringParameter.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StringParameter.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringParameter.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StringParameter.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringReturn.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StringReturn.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringReturn.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StringReturn.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Support/ReExportTarget.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/Support/ReExportTarget.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Support/ReExportTarget.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/Support/ReExportTarget.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/TS2SkeletonLike.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TS2SkeletonLike.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/TS2SkeletonLike.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TS2SkeletonLike.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/TypeAlias.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TypeAlias.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/TypeAlias.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TypeAlias.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/TypeScriptClass.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TypeScriptClass.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/TypeScriptClass.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TypeScriptClass.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/VoidParameterVoidReturn.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/VoidParameterVoidReturn.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/VoidParameterVoidReturn.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/VoidParameterVoidReturn.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/tsconfig.json b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/tsconfig.json similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/tsconfig.json rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/tsconfig.json diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js new file mode 100644 index 000000000..a65386924 --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js @@ -0,0 +1,41 @@ +// @ts-check +import { describe, it, expect } from 'vitest'; +import { readdirSync } from 'fs'; +import { fileURLToPath } from 'url'; +import path from 'path'; +import { run } from '../src/cli.js'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +/** Path to BridgeJSToolTests/Inputs/TypeScript (.d.ts fixtures and tsconfig). */ +const inputsDir = path.resolve(__dirname, 'fixtures'); +const tsconfigPath = path.join(inputsDir, 'tsconfig.json'); + +function runTs2Swift(dtsPath) { + return run(dtsPath, { tsconfigPath, logLevel: 'error' }); +} + +function collectDtsInputs() { + const entries = readdirSync(inputsDir, { withFileTypes: true }); + return entries + .filter((e) => e.isFile() && e.name.endsWith('.d.ts')) + .map((e) => e.name) + .sort(); +} + +describe('ts2swift', () => { + const dtsFiles = collectDtsInputs(); + if (dtsFiles.length === 0) { + it.skip('no .d.ts fixtures found in BridgeJSToolTests/Inputs', () => {}); + return; + } + + for (const dtsFile of dtsFiles) { + it(`snapshots Swift output for ${dtsFile}`, () => { + const dtsPath = path.join(inputsDir, dtsFile); + const swiftOutput = runTs2Swift(dtsPath); + const name = dtsFile.replace(/\.d\.ts$/, ''); + expect(swiftOutput).toMatchSnapshot(name); + }); + } +}); diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/vitest.config.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/vitest.config.js new file mode 100644 index 000000000..d5d33a7e1 --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/vitest.config.js @@ -0,0 +1,9 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + snapshotFormat: { + escapeString: false, + }, + }, +}); diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift index 2796c1014..6e47475b1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift @@ -270,7 +270,7 @@ import BridgeJSMacros ) } - #if canImport(SwiftSyntax601) + #if canImport(SwiftSyntax602) // https://github.com/swiftlang/swift-syntax/pull/2722 @Test func variableWithTrailingComment() { TestSupport.assertMacroExpansion( diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSCodegenTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSCodegenTests.swift new file mode 100644 index 000000000..ed83bc074 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSCodegenTests.swift @@ -0,0 +1,169 @@ +import Foundation +import SwiftSyntax +import SwiftParser +import Testing + +@testable import BridgeJSCore +@testable import BridgeJSSkeleton + +@Suite struct BridgeJSCodegenTests { + static let inputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent().appendingPathComponent( + "Inputs" + ).appendingPathComponent("MacroSwift") + static let multifileInputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent() + .appendingPathComponent("Inputs").appendingPathComponent("MacroSwift").appendingPathComponent("Multifile") + + private func snapshotCodegen( + skeleton: BridgeJSSkeleton, + name: String, + filePath: String = #filePath, + function: String = #function, + sourceLocation: Testing.SourceLocation = #_sourceLocation + ) throws { + var swiftParts: [String] = [] + if let closureSupport = try ClosureCodegen().renderSupport(for: skeleton) { + swiftParts.append(closureSupport) + } + if let exported = skeleton.exported { + let exportSwift = ExportSwift( + progress: .silent, + moduleName: skeleton.moduleName, + skeleton: exported + ) + if let s = try exportSwift.finalize() { + swiftParts.append(s) + } + } + if let imported = skeleton.imported { + let importTS = ImportTS(progress: .silent, moduleName: skeleton.moduleName, skeleton: imported) + if let s = try importTS.finalize() { + swiftParts.append(s) + } + } + let combinedSwift = + swiftParts + .map { $0.trimmingCharacters(in: .newlines) } + .filter { !$0.isEmpty } + .joined(separator: "\n\n") + try assertSnapshot( + name: name, + filePath: filePath, + function: function, + sourceLocation: sourceLocation, + input: combinedSwift.data(using: String.Encoding.utf8)!, + fileExtension: "swift" + ) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys] + let skeletonData = try encoder.encode(skeleton) + try assertSnapshot( + name: name, + filePath: filePath, + function: function, + sourceLocation: sourceLocation, + input: skeletonData, + fileExtension: "json" + ) + } + + static func collectInputs() -> [String] { + let fileManager = FileManager.default + let inputs = try! fileManager.contentsOfDirectory(atPath: Self.inputsDirectory.path) + return inputs.filter { $0.hasSuffix(".swift") }.sorted() + } + + @Test(arguments: collectInputs()) + func codegenSnapshot(input: String) throws { + let url = Self.inputsDirectory.appendingPathComponent(input) + let name = url.deletingPathExtension().lastPathComponent + let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + swiftAPI.addSourceFile(sourceFile, inputFilePath: input) + let skeleton = try swiftAPI.finalize() + try snapshotCodegen(skeleton: skeleton, name: name) + } + + @Test(arguments: [ + "Namespaces.swift", + "StaticFunctions.swift", + "StaticProperties.swift", + "EnumNamespace.swift", + ]) + func codegenSnapshotWithGlobal(input: String) throws { + let url = Self.inputsDirectory.appendingPathComponent(input) + let name = url.deletingPathExtension().lastPathComponent + let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: true) + swiftAPI.addSourceFile(sourceFile, inputFilePath: input) + let skeleton = try swiftAPI.finalize() + try snapshotCodegen(skeleton: skeleton, name: name + ".Global") + } + + @Test + func codegenCrossFileTypeResolution() throws { + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + let classBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassB.swift") + swiftAPI.addSourceFile( + Parser.parse(source: try String(contentsOf: classBURL, encoding: .utf8)), + inputFilePath: "CrossFileClassB.swift" + ) + let classAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassA.swift") + swiftAPI.addSourceFile( + Parser.parse(source: try String(contentsOf: classAURL, encoding: .utf8)), + inputFilePath: "CrossFileClassA.swift" + ) + let skeleton = try swiftAPI.finalize() + try snapshotCodegen(skeleton: skeleton, name: "CrossFileTypeResolution") + } + + @Test + func codegenCrossFileTypeResolutionReverseOrder() throws { + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + let classAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassA.swift") + swiftAPI.addSourceFile( + Parser.parse(source: try String(contentsOf: classAURL, encoding: .utf8)), + inputFilePath: "CrossFileClassA.swift" + ) + let classBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassB.swift") + swiftAPI.addSourceFile( + Parser.parse(source: try String(contentsOf: classBURL, encoding: .utf8)), + inputFilePath: "CrossFileClassB.swift" + ) + let skeleton = try swiftAPI.finalize() + try snapshotCodegen(skeleton: skeleton, name: "CrossFileTypeResolution.ReverseOrder") + } + + @Test + func codegenCrossFileFunctionTypes() throws { + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + let functionBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionB.swift") + swiftAPI.addSourceFile( + Parser.parse(source: try String(contentsOf: functionBURL, encoding: .utf8)), + inputFilePath: "CrossFileFunctionB.swift" + ) + let functionAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionA.swift") + swiftAPI.addSourceFile( + Parser.parse(source: try String(contentsOf: functionAURL, encoding: .utf8)), + inputFilePath: "CrossFileFunctionA.swift" + ) + let skeleton = try swiftAPI.finalize() + try snapshotCodegen(skeleton: skeleton, name: "CrossFileFunctionTypes") + } + + @Test + func codegenCrossFileFunctionTypesReverseOrder() throws { + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + let functionAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionA.swift") + swiftAPI.addSourceFile( + Parser.parse(source: try String(contentsOf: functionAURL, encoding: .utf8)), + inputFilePath: "CrossFileFunctionA.swift" + ) + let functionBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionB.swift") + swiftAPI.addSourceFile( + Parser.parse(source: try String(contentsOf: functionBURL, encoding: .utf8)), + inputFilePath: "CrossFileFunctionB.swift" + ) + let skeleton = try swiftAPI.finalize() + try snapshotCodegen(skeleton: skeleton, name: "CrossFileFunctionTypes.ReverseOrder") + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift index 16de8617e..711b04512 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift @@ -4,7 +4,6 @@ import SwiftParser import Testing @testable import BridgeJSLink @testable import BridgeJSCore -@testable import TS2Swift @testable import BridgeJSSkeleton @Suite struct BridgeJSLinkTests { @@ -36,10 +35,7 @@ import Testing static let inputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent().appendingPathComponent( "Inputs" - ) - - static let importMacroInputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent() - .appendingPathComponent("ImportMacroInputs") + ).appendingPathComponent("MacroSwift") static func collectInputs(extension: String) -> [String] { let fileManager = FileManager.default @@ -47,56 +43,9 @@ import Testing return inputs.filter { $0.hasSuffix(`extension`) } } - static func collectImportMacroInputs() -> [String] { - let fileManager = FileManager.default - let inputs = try! fileManager.contentsOfDirectory(atPath: Self.importMacroInputsDirectory.path) - return inputs.filter { $0.hasSuffix(".swift") } - } - @Test(arguments: collectInputs(extension: ".swift")) - func snapshotExport(input: String) throws { + func snapshot(input: String) throws { let url = Self.inputsDirectory.appendingPathComponent(input) - let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) - let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) - swiftAPI.addSourceFile(sourceFile, inputFilePath: input) - let name = url.deletingPathExtension().lastPathComponent - - let outputSkeleton = try swiftAPI.finalize() - let bridgeJSLink: BridgeJSLink = BridgeJSLink( - skeletons: [outputSkeleton], - sharedMemory: false - ) - try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Export") - } - - @Test(arguments: collectInputs(extension: ".d.ts")) - func snapshotImport(input: String) throws { - let url = Self.inputsDirectory.appendingPathComponent(input) - let name = url.deletingPathExtension().deletingPathExtension().lastPathComponent - let tsconfigPath = url.deletingLastPathComponent().appendingPathComponent("tsconfig.json") - - let nodePath = try #require(which("node")) - let swiftSource = try invokeTS2Swift( - dtsFile: url.path, - tsconfigPath: tsconfigPath.path, - nodePath: nodePath, - progress: .silent - ) - - let sourceFile = Parser.parse(source: swiftSource) - let importSwift = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) - importSwift.addSourceFile(sourceFile, inputFilePath: "\(name).Macros.swift") - let skeleton = try importSwift.finalize() - let bridgeJSLink = BridgeJSLink( - skeletons: [skeleton], - sharedMemory: false - ) - try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Import") - } - - @Test(arguments: collectImportMacroInputs()) - func snapshotImportMacroInput(input: String) throws { - let url = Self.importMacroInputsDirectory.appendingPathComponent(input) let name = url.deletingPathExtension().lastPathComponent let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) @@ -108,7 +57,7 @@ import Testing encoder.outputFormatting = [.prettyPrinted, .sortedKeys] let unifiedData = try encoder.encode(importResult) try bridgeJSLink.addSkeletonFile(data: unifiedData) - try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".ImportMacros") + try snapshot(bridgeJSLink: bridgeJSLink, name: name) } @Test(arguments: [ @@ -130,7 +79,7 @@ import Testing ], sharedMemory: false ) - try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Global.Export") + try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Global") } @Test @@ -154,6 +103,6 @@ import Testing ], sharedMemory: false ) - try snapshot(bridgeJSLink: bridgeJSLink, name: "MixedModules.Export") + try snapshot(bridgeJSLink: bridgeJSLink, name: "MixedModules") } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift deleted file mode 100644 index fb31ac837..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ExportSwiftTests.swift +++ /dev/null @@ -1,158 +0,0 @@ -import Foundation -import SwiftSyntax -import SwiftParser -import Testing - -@testable import BridgeJSCore -@testable import BridgeJSSkeleton - -@Suite struct ExportSwiftTests { - private func snapshot( - skeleton: BridgeJSSkeleton, - name: String? = nil, - filePath: String = #filePath, - function: String = #function, - sourceLocation: Testing.SourceLocation = #_sourceLocation - ) throws { - guard let exported = skeleton.exported else { return } - let exportSwift = ExportSwift( - progress: .silent, - moduleName: skeleton.moduleName, - skeleton: exported - ) - let closureSupport = try ClosureCodegen().renderSupport(for: skeleton) - let exportResult = try #require(try exportSwift.finalize()) - let outputSwift = ([closureSupport, exportResult] as [String?]) - .compactMap { $0?.trimmingCharacters(in: .newlines) } - .filter { !$0.isEmpty } - .joined(separator: "\n\n") - try assertSnapshot( - name: name, - filePath: filePath, - function: function, - sourceLocation: sourceLocation, - input: outputSwift.data(using: .utf8)!, - fileExtension: "swift" - ) - let encoder = JSONEncoder() - encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - let outputSkeletonData = try encoder.encode(exported) - try assertSnapshot( - name: name, - filePath: filePath, - function: function, - sourceLocation: sourceLocation, - input: outputSkeletonData, - fileExtension: "json" - ) - } - - static let inputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent().appendingPathComponent( - "Inputs" - ) - - static let multifileInputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent() - .appendingPathComponent( - "MultifileInputs" - ) - - static func collectInputs() -> [String] { - let fileManager = FileManager.default - let inputs = try! fileManager.contentsOfDirectory(atPath: Self.inputsDirectory.path) - return inputs.filter { $0.hasSuffix(".swift") } - } - - @Test(arguments: collectInputs()) - func snapshot(input: String) throws { - let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) - let url = Self.inputsDirectory.appendingPathComponent(input) - let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) - swiftAPI.addSourceFile(sourceFile, inputFilePath: input) - let name = url.deletingPathExtension().lastPathComponent - try snapshot(skeleton: swiftAPI.finalize(), name: name) - } - - @Test(arguments: [ - "Namespaces.swift", - "StaticFunctions.swift", - "StaticProperties.swift", - "EnumNamespace.swift", - ]) - func snapshotWithGlobal(input: String) throws { - let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: true) - let url = Self.inputsDirectory.appendingPathComponent(input) - let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) - swiftAPI.addSourceFile(sourceFile, inputFilePath: input) - let name = url.deletingPathExtension().lastPathComponent - try snapshot(skeleton: swiftAPI.finalize(), name: name + ".Global") - } - - @Test - func snapshotCrossFileTypeResolution() throws { - // Test that types defined in one file can be referenced from another file - // This tests the fix for cross-file type resolution in BridgeJS - let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) - - // Add ClassB first, then ClassA (which references ClassB) - let classBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassB.swift") - let classBSourceFile = Parser.parse(source: try String(contentsOf: classBURL, encoding: .utf8)) - swiftAPI.addSourceFile(classBSourceFile, inputFilePath: "CrossFileClassB.swift") - - let classAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassA.swift") - let classASourceFile = Parser.parse(source: try String(contentsOf: classAURL, encoding: .utf8)) - swiftAPI.addSourceFile(classASourceFile, inputFilePath: "CrossFileClassA.swift") - - try snapshot(skeleton: swiftAPI.finalize(), name: "CrossFileTypeResolution") - } - - @Test - func snapshotCrossFileTypeResolutionReverseOrder() throws { - // Test that types can be resolved regardless of the order files are added - // Add ClassA first (which references ClassB), then ClassB - let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) - - let classAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassA.swift") - let classASourceFile = Parser.parse(source: try String(contentsOf: classAURL, encoding: .utf8)) - swiftAPI.addSourceFile(classASourceFile, inputFilePath: "CrossFileClassA.swift") - - let classBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileClassB.swift") - let classBSourceFile = Parser.parse(source: try String(contentsOf: classBURL, encoding: .utf8)) - swiftAPI.addSourceFile(classBSourceFile, inputFilePath: "CrossFileClassB.swift") - - try snapshot(skeleton: swiftAPI.finalize(), name: "CrossFileTypeResolution.ReverseOrder") - } - - @Test - func snapshotCrossFileFunctionTypes() throws { - // Test that functions and methods can use cross-file types as parameters and return types - let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) - - // Add FunctionB first, then FunctionA (which references FunctionB in methods and functions) - let functionBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionB.swift") - let functionBSourceFile = Parser.parse(source: try String(contentsOf: functionBURL, encoding: .utf8)) - swiftAPI.addSourceFile(functionBSourceFile, inputFilePath: "CrossFileFunctionB.swift") - - let functionAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionA.swift") - let functionASourceFile = Parser.parse(source: try String(contentsOf: functionAURL, encoding: .utf8)) - swiftAPI.addSourceFile(functionASourceFile, inputFilePath: "CrossFileFunctionA.swift") - - try snapshot(skeleton: swiftAPI.finalize(), name: "CrossFileFunctionTypes") - } - - @Test - func snapshotCrossFileFunctionTypesReverseOrder() throws { - // Test that function types can be resolved regardless of the order files are added - let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) - - // Add FunctionA first (which references FunctionB), then FunctionB - let functionAURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionA.swift") - let functionASourceFile = Parser.parse(source: try String(contentsOf: functionAURL, encoding: .utf8)) - swiftAPI.addSourceFile(functionASourceFile, inputFilePath: "CrossFileFunctionA.swift") - - let functionBURL = Self.multifileInputsDirectory.appendingPathComponent("CrossFileFunctionB.swift") - let functionBSourceFile = Parser.parse(source: try String(contentsOf: functionBURL, encoding: .utf8)) - swiftAPI.addSourceFile(functionBSourceFile, inputFilePath: "CrossFileFunctionB.swift") - - try snapshot(skeleton: swiftAPI.finalize(), name: "CrossFileFunctionTypes.ReverseOrder") - } -} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift deleted file mode 100644 index 89c7dd11d..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift +++ /dev/null @@ -1,101 +0,0 @@ -import Testing -import Foundation -import SwiftParser -@testable import BridgeJSCore -@testable import TS2Swift -@testable import BridgeJSSkeleton - -@Suite struct ImportTSTests { - static let inputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent().appendingPathComponent( - "Inputs" - ) - static let importMacroInputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent() - .appendingPathComponent("ImportMacroInputs") - - static func collectInputs() -> [String] { - let fileManager = FileManager.default - let inputs = try! fileManager.contentsOfDirectory(atPath: Self.inputsDirectory.path) - return inputs.filter { $0.hasSuffix(".d.ts") } - } - - static func collectImportMacroInputs() -> [String] { - let fileManager = FileManager.default - let inputs = try! fileManager.contentsOfDirectory(atPath: Self.importMacroInputsDirectory.path) - return inputs.filter { $0.hasSuffix(".swift") } - } - - @Test(arguments: collectInputs()) - func snapshot(input: String) throws { - let url = Self.inputsDirectory.appendingPathComponent(input) - let name = url.deletingPathExtension().deletingPathExtension().deletingPathExtension().lastPathComponent - let nodePath = try #require(which("node")) - let tsconfigPath = url.deletingLastPathComponent().appendingPathComponent("tsconfig.json") - - let swiftSource = try invokeTS2Swift( - dtsFile: url.path, - tsconfigPath: tsconfigPath.path, - nodePath: nodePath, - progress: .silent - ) - try assertSnapshot( - name: name + ".Macros", - filePath: #filePath, - function: #function, - input: swiftSource.data(using: .utf8)!, - fileExtension: "swift" - ) - - let sourceFile = Parser.parse(source: swiftSource) - let importSwift = SwiftToSkeleton(progress: .silent, moduleName: "Check", exposeToGlobal: false) - importSwift.addSourceFile(sourceFile, inputFilePath: "\(name).Macros.swift") - let skeleton = try importSwift.finalize() - - guard let imported = skeleton.imported else { return } - - let importTS = ImportTS(progress: .silent, moduleName: "Check", skeleton: imported) - let importResult = try #require(try importTS.finalize()) - let closureSupport = try ClosureCodegen().renderSupport( - for: BridgeJSSkeleton(moduleName: "Check", imported: imported) - ) - let outputSwift = ([closureSupport, importResult] as [String?]) - .compactMap { $0?.trimmingCharacters(in: .newlines) } - .filter { !$0.isEmpty } - .joined(separator: "\n\n") - try assertSnapshot( - name: name, - filePath: #filePath, - function: #function, - input: outputSwift.data(using: .utf8)!, - fileExtension: "swift" - ) - } - - @Test(arguments: collectImportMacroInputs()) - func snapshotImportMacroInput(input: String) throws { - let url = Self.importMacroInputsDirectory.appendingPathComponent(input) - let name = url.deletingPathExtension().lastPathComponent - - let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) - let importSwift = SwiftToSkeleton(progress: .silent, moduleName: "Check", exposeToGlobal: false) - importSwift.addSourceFile(sourceFile, inputFilePath: "\(name).swift") - let skeleton = try importSwift.finalize() - - guard let imported = skeleton.imported else { return } - let importTS = ImportTS(progress: .silent, moduleName: "Check", skeleton: imported) - let importResult = try #require(try importTS.finalize()) - let closureSupport = try ClosureCodegen().renderSupport( - for: BridgeJSSkeleton(moduleName: "Check", imported: imported) - ) - let outputSwift = ([closureSupport, importResult] as [String?]) - .compactMap { $0?.trimmingCharacters(in: .newlines) } - .filter { !$0.isEmpty } - .joined(separator: "\n\n") - try assertSnapshot( - name: name + ".ImportMacros", - filePath: #filePath, - function: #function, - input: outputSwift.data(using: .utf8)!, - fileExtension: "swift" - ) - } -} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ArrayTypes.swift similarity index 88% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ArrayTypes.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ArrayTypes.swift index 8454b7520..678bc3698 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ArrayTypes.swift @@ -54,3 +54,7 @@ @JS func processItemArray(_ items: [Item]) -> [Item] @JS func processNestedItemArray(_ items: [[Item]]) -> [[Item]] + +@JSFunction func checkArray(_ a: JSObject) throws(JSException) -> Void +@JSFunction func checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void +@JSFunction func checkArray(_ a: JSObject) throws(JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Async.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Async.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Async.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Async.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/DefaultParameters.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/DefaultParameters.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/DefaultParameters.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/EnumAssociatedValue.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumAssociatedValue.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/EnumAssociatedValue.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumCase.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/EnumCase.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumCase.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/EnumCase.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumNamespace.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/EnumNamespace.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumNamespace.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/EnumNamespace.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumRawType.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/EnumRawType.swift similarity index 91% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumRawType.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/EnumRawType.swift index 13b502eac..6e18c913c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/EnumRawType.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/EnumRawType.swift @@ -124,3 +124,13 @@ @JS func processTheme(_ theme: Theme) -> HttpStatus @JS func convertPriority(_ status: HttpStatus) -> Priority @JS func validateSession(_ session: SessionId) -> Theme + +enum FeatureFlag: String { + case foo = "foo" + case bar = "bar" +} +extension FeatureFlag: _BridgedSwiftEnumNoPayload {} + +@JSFunction func takesFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> Void + +@JSFunction func returnsFeatureFlag() throws(JSException) -> FeatureFlag diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/GlobalGetter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/GlobalGetter.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/GlobalGetter.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/GlobalGetter.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/GlobalThisImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/GlobalThisImports.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/GlobalThisImports.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/GlobalThisImports.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ImportedTypeInExportedInterface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ImportedTypeInExportedInterface.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/ImportedTypeInExportedInterface.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ImportedTypeInExportedInterface.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/InvalidPropertyNames.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/InvalidPropertyNames.swift new file mode 100644 index 000000000..ea5755dec --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/InvalidPropertyNames.swift @@ -0,0 +1,29 @@ +@JSFunction func createWeirdObject() throws(JSException) -> WeirdNaming + +@JSClass struct WeirdNaming { + @JSGetter var normalProperty: String + @JSSetter func setNormalProperty(_ value: String) throws(JSException) + @JSGetter(jsName: "property-with-dashes") var property_with_dashes: Double + @JSSetter(jsName: "property-with-dashes") func setProperty_with_dashes(_ value: Double) throws(JSException) + @JSGetter(jsName: "123invalidStart") var _123invalidStart: Bool + @JSSetter(jsName: "123invalidStart") func set_123invalidStart(_ value: Bool) throws(JSException) + @JSGetter(jsName: "property with spaces") var property_with_spaces: String + @JSSetter(jsName: "property with spaces") func setProperty_with_spaces(_ value: String) throws(JSException) + @JSGetter(jsName: "@specialChar") var _specialChar: Double + @JSSetter(jsName: "@specialChar") func set_specialChar(_ value: Double) throws(JSException) + @JSGetter var constructor: String + @JSSetter func setConstructor(_ value: String) throws(JSException) + @JSGetter var `for`: String + @JSSetter func setFor(_ value: String) throws(JSException) + @JSGetter var `Any`: String + @JSSetter(jsName: "Any") func setAny(_ value: String) throws(JSException) + @JSFunction func `as`() throws(JSException) -> Void + @JSFunction func `try`() throws(JSException) -> Void +} + +@JSClass(jsName: "$Weird") struct _Weird { + @JSFunction init() throws(JSException) + @JSFunction(jsName: "method-with-dashes") func method_with_dashes() throws(JSException) -> Void +} + +@JSFunction func createWeirdClass() throws(JSException) -> _Weird diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClass.swift new file mode 100644 index 000000000..6459f5354 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClass.swift @@ -0,0 +1,15 @@ +@JSClass struct Greeter { + @JSGetter var name: String + @JSSetter func setName(_ value: String) throws(JSException) + @JSGetter var age: Double + @JSFunction init(_ name: String) throws(JSException) + @JSFunction func greet() throws(JSException) -> String + @JSFunction func changeName(_ name: String) throws(JSException) -> Void +} + +@JSFunction func returnAnimatable() throws(JSException) -> Animatable + +@JSClass struct Animatable { + @JSFunction func animate(_ keyframes: JSObject, _ options: JSObject) throws(JSException) -> JSObject + @JSFunction func getAnimations(_ options: JSObject) throws(JSException) -> JSObject +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MixedGlobal.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/MixedGlobal.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MixedGlobal.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/MixedGlobal.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MixedPrivate.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/MixedPrivate.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MixedPrivate.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/MixedPrivate.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileClassA.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/CrossFileClassA.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileClassA.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/CrossFileClassA.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileClassB.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/CrossFileClassB.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileClassB.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/CrossFileClassB.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileFunctionA.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/CrossFileFunctionA.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileFunctionA.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/CrossFileFunctionA.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileFunctionB.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/CrossFileFunctionB.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/MultifileInputs/CrossFileFunctionB.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/CrossFileFunctionB.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Namespaces.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Namespaces.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Namespaces.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Namespaces.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Optionals.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Optionals.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/PrimitiveParameters.swift new file mode 100644 index 000000000..97495d947 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/PrimitiveParameters.swift @@ -0,0 +1,2 @@ +@JS func check(a: Int, b: UInt, c: Float, d: Double, e: Bool) {} +@JSFunction func check(_ a: Double, _ b: Bool) throws(JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/PrimitiveReturn.swift similarity index 65% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveReturn.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/PrimitiveReturn.swift index 144a759ec..d2a65faef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/PrimitiveReturn.swift @@ -3,3 +3,6 @@ @JS func checkFloat() -> Float { fatalError() } @JS func checkDouble() -> Double { fatalError() } @JS func checkBool() -> Bool { fatalError() } + +@JSFunction func checkNumber() throws(JSException) -> Double +@JSFunction func checkBoolean() throws(JSException) -> Bool diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PropertyTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/PropertyTypes.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PropertyTypes.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/PropertyTypes.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Protocol.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Protocol.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/StaticFunctions.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StaticFunctions.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/StaticFunctions.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StaticProperties.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/StaticProperties.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StaticProperties.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/StaticProperties.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/StringParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/StringParameter.swift new file mode 100644 index 000000000..32fc62f32 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/StringParameter.swift @@ -0,0 +1,5 @@ +@JS func checkString(a: String) {} +@JS func roundtripString(a: String) -> String { return a } + +@JSFunction func checkString(_ a: String) throws(JSException) -> Void +@JSFunction func checkStringWithLength(_ a: String, _ b: Double) throws(JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/StringReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/StringReturn.swift new file mode 100644 index 000000000..4b5bc088a --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/StringReturn.swift @@ -0,0 +1,2 @@ +@JS func checkString() -> String { fatalError() } +@JSFunction func checkString() throws(JSException) -> String diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftClass.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClosure.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftClosure.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClosure.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftClosureImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClosureImports.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftClosureImports.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClosureImports.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftStruct.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/SwiftStruct.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftStruct.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftStructImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftStructImports.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportMacroInputs/SwiftStructImports.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftStructImports.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Throws.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Throws.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Throws.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Throws.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/UnsafePointer.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/UnsafePointer.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/UnsafePointer.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/UnsafePointer.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/VoidParameterVoidReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/VoidParameterVoidReturn.swift new file mode 100644 index 000000000..4b9cd0d02 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/VoidParameterVoidReturn.swift @@ -0,0 +1,2 @@ +@JS func check() {} +@JSFunction func check() throws(JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveParameters.swift deleted file mode 100644 index a0d4353eb..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/PrimitiveParameters.swift +++ /dev/null @@ -1 +0,0 @@ -@JS func check(a: Int, b: UInt, c: Float, d: Double, e: Bool) {} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringParameter.swift deleted file mode 100644 index c735c56f7..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringParameter.swift +++ /dev/null @@ -1,2 +0,0 @@ -@JS func checkString(a: String) {} -@JS func roundtripString(a: String) -> String { return a } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringReturn.swift deleted file mode 100644 index fe070f0db..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/StringReturn.swift +++ /dev/null @@ -1 +0,0 @@ -@JS func checkString() -> String { fatalError() } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/VoidParameterVoidReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/VoidParameterVoidReturn.swift deleted file mode 100644 index ba0cf5d23..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/VoidParameterVoidReturn.swift +++ /dev/null @@ -1 +0,0 @@ -@JS func check() {} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/TS2SwiftVitestTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/TS2SwiftVitestTests.swift new file mode 100644 index 000000000..bb3d2e0a4 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/TS2SwiftVitestTests.swift @@ -0,0 +1,34 @@ +import Foundation +import Testing + +/// Runs the TS2Swift JavaScript test suite (Vitest) so that `swift test --package-path ./Plugins/BridgeJS` +/// validates both the TypeScript ts2swift output and the Swift codegen. For fast iteration on ts2swift, +/// run `npm test` directly in `Sources/TS2Swift/JavaScript`. +@Suite struct TS2SwiftVitestTests { + @Test + func ts2SwiftVitestSuitePasses() throws { + let testFileURL = URL(fileURLWithPath: #filePath) + let ts2SwiftJSDir = + testFileURL + .deletingLastPathComponent() // BridgeJSToolTests + .deletingLastPathComponent() // Tests + .deletingLastPathComponent() // BridgeJS package root + .appendingPathComponent("Sources") + .appendingPathComponent("TS2Swift") + .appendingPathComponent("JavaScript") + let process = Process() + process.executableURL = URL(fileURLWithPath: "/usr/bin/env") + var arguments = ["npm", "run", "test"] + if ProcessInfo.processInfo.environment["UPDATE_SNAPSHOTS"] != nil { + arguments.append(contentsOf: ["--", "--update"]) + } + process.arguments = arguments + process.currentDirectoryURL = ts2SwiftJSDir + try process.run() + process.waitUntilExit() + #expect( + process.terminationStatus == 0, + "TS2Swift Vitest suite failed (exit code \(process.terminationStatus)). Run `cd Sources/TS2Swift/JavaScript && npm test` for details." + ) + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json new file mode 100644 index 000000000..c90347177 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json @@ -0,0 +1,1059 @@ +{ + "exported" : { + "classes" : [ + { + "methods" : [ + + ], + "name" : "Item", + "properties" : [ + + ], + "swiftCallName" : "Item" + } + ], + "enums" : [ + { + "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" : "pending", + "rawValue" : "0" + }, + { + "associatedValues" : [ + + ], + "name" : "active", + "rawValue" : "1" + }, + { + "associatedValues" : [ + + ], + "name" : "completed", + "rawValue" : "2" + } + ], + "emitStyle" : "const", + "name" : "Status", + "rawType" : "Int", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Status", + "tsFullPath" : "Status" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_processIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_processStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processStringArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_processDoubleArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDoubleArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_processBoolArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processBoolArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "abiName" : "bjs_processPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + }, + { + "abiName" : "bjs_processDirectionArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDirectionArray", + "parameters" : [ + { + "label" : "_", + "name" : "directions", + "type" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "abiName" : "bjs_processStatusArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processStatusArray", + "parameters" : [ + { + "label" : "_", + "name" : "statuses", + "type" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Status", + "_1" : "Int" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Status", + "_1" : "Int" + } + } + } + } + }, + { + "abiName" : "bjs_sumIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "sumIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_findFirstPoint", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "findFirstPoint", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + }, + { + "label" : "matching", + "name" : "matching", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Point" + } + } + }, + { + "abiName" : "bjs_processUnsafeRawPointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processUnsafeRawPointerArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + } + } + }, + { + "abiName" : "bjs_processUnsafeMutableRawPointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processUnsafeMutableRawPointerArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + } + }, + { + "abiName" : "bjs_processOpaquePointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOpaquePointerArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalStringArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalDirectionArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalDirectionArray", + "parameters" : [ + { + "label" : "_", + "name" : "directions", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalStatusArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalStatusArray", + "parameters" : [ + { + "label" : "_", + "name" : "statuses", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Status", + "_1" : "Int" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Status", + "_1" : "Int" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processNestedIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processNestedIntArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processNestedStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processNestedStringArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processNestedPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processNestedPointArray", + "parameters" : [ + { + "label" : "_", + "name" : "points", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processItemArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processItemArray", + "parameters" : [ + { + "label" : "_", + "name" : "items", + "type" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Item" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Item" + } + } + } + } + }, + { + "abiName" : "bjs_processNestedItemArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processNestedItemArray", + "parameters" : [ + { + "label" : "_", + "name" : "items", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Item" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Item" + } + } + } + } + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + { + "methods" : [ + + ], + "name" : "Point", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "x", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "y", + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "Point" + } + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "checkArray", + "parameters" : [ + { + "name" : "a", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "checkArrayWithLength", + "parameters" : [ + { + "name" : "a", + "type" : { + "jsObject" : { + + } + } + }, + { + "name" : "b", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "checkArray", + "parameters" : [ + { + "name" : "a", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift similarity index 91% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift index 55a6258b0..4452446b9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift @@ -488,4 +488,56 @@ fileprivate func _bjs_Item_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 fileprivate func _bjs_Item_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_checkArray") +fileprivate func bjs_checkArray(_ a: Int32) -> Void +#else +fileprivate func bjs_checkArray(_ a: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$checkArray(_ a: JSObject) throws(JSException) -> Void { + let aValue = a.bridgeJSLowerParameter() + bjs_checkArray(aValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_checkArrayWithLength") +fileprivate func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void +#else +fileprivate func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void { + let aValue = a.bridgeJSLowerParameter() + let bValue = b.bridgeJSLowerParameter() + bjs_checkArrayWithLength(aValue, bValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_checkArray") +fileprivate func bjs_checkArray(_ a: Int32) -> Void +#else +fileprivate func bjs_checkArray(_ a: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$checkArray(_ a: JSObject) throws(JSException) -> Void { + let aValue = a.bridgeJSLowerParameter() + bjs_checkArray(aValue) + if let error = _swift_js_take_exception() { + throw error + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.json new file mode 100644 index 000000000..a780871ba --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.json @@ -0,0 +1,187 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_asyncReturnVoid", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncReturnVoid", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripInt", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripInt", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripString", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripString", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripBool", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripBool", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripFloat", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripFloat", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "float" : { + + } + } + } + ], + "returnType" : { + "float" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripDouble", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripDouble", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripJSObject", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripJSObject", + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.ReverseOrder.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.ReverseOrder.json new file mode 100644 index 000000000..9b056b650 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.ReverseOrder.json @@ -0,0 +1,152 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_FunctionA_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_FunctionA_processB", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processB", + "parameters" : [ + { + "label" : "b", + "name" : "b", + "type" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_FunctionA_createB", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createB", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "name" : "FunctionA", + "properties" : [ + + ], + "swiftCallName" : "FunctionA" + }, + { + "constructor" : { + "abiName" : "bjs_FunctionB_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "FunctionB", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "FunctionB" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_standaloneFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "standaloneFunction", + "parameters" : [ + { + "label" : "b", + "name" : "b", + "type" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.ReverseOrder.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.ReverseOrder.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.json new file mode 100644 index 000000000..d76a1622d --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.json @@ -0,0 +1,152 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_FunctionB_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "FunctionB", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "FunctionB" + }, + { + "constructor" : { + "abiName" : "bjs_FunctionA_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_FunctionA_processB", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processB", + "parameters" : [ + { + "label" : "b", + "name" : "b", + "type" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_FunctionA_createB", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createB", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "name" : "FunctionA", + "properties" : [ + + ], + "swiftCallName" : "FunctionA" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_standaloneFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "standaloneFunction", + "parameters" : [ + { + "label" : "b", + "name" : "b", + "type" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "FunctionB" + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.json new file mode 100644 index 000000000..7f21c86cf --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.json @@ -0,0 +1,64 @@ +{ + "exported" : { + "classes" : [ + { + "methods" : [ + + ], + "name" : "ClassA", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "linkedB", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "ClassB" + } + } + } + } + } + ], + "swiftCallName" : "ClassA" + }, + { + "constructor" : { + "abiName" : "bjs_ClassB_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + + ], + "name" : "ClassB", + "properties" : [ + + ], + "swiftCallName" : "ClassB" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.json new file mode 100644 index 000000000..3f8129109 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.json @@ -0,0 +1,64 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_ClassB_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + + ], + "name" : "ClassB", + "properties" : [ + + ], + "swiftCallName" : "ClassB" + }, + { + "methods" : [ + + ], + "name" : "ClassA", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "linkedB", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "ClassB" + } + } + } + } + } + ], + "swiftCallName" : "ClassA" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.json new file mode 100644 index 000000000..64cc1a845 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.json @@ -0,0 +1,1273 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_DefaultGreeter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "DefaultGreeter", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "DefaultGreeter" + }, + { + "constructor" : { + "abiName" : "bjs_EmptyGreeter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + + ], + "name" : "EmptyGreeter", + "properties" : [ + + ], + "swiftCallName" : "EmptyGreeter" + }, + { + "constructor" : { + "abiName" : "bjs_ConstructorDefaults_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" : { + "int" : { + + } + } + }, + { + "defaultValue" : { + "bool" : { + "_0" : true + } + }, + "label" : "enabled", + "name" : "enabled", + "type" : { + "bool" : { + + } + } + }, + { + "defaultValue" : { + "enumCase" : { + "_0" : "Status", + "_1" : "active" + } + }, + "label" : "status", + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + }, + { + "defaultValue" : { + "null" : { + + } + }, + "label" : "tag", + "name" : "tag", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "ConstructorDefaults", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "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" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "swiftCallName" : "ConstructorDefaults" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "active" + }, + { + "associatedValues" : [ + + ], + "name" : "inactive" + }, + { + "associatedValues" : [ + + ], + "name" : "pending" + } + ], + "emitStyle" : "const", + "explicitAccessControl" : "public", + "name" : "Status", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Status", + "tsFullPath" : "Status" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_testStringDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testStringDefault", + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "Hello World" + } + }, + "label" : "message", + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_testNegativeIntDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testNegativeIntDefault", + "parameters" : [ + { + "defaultValue" : { + "int" : { + "_0" : -42 + } + }, + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_testBoolDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testBoolDefault", + "parameters" : [ + { + "defaultValue" : { + "bool" : { + "_0" : true + } + }, + "label" : "flag", + "name" : "flag", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_testNegativeFloatDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testNegativeFloatDefault", + "parameters" : [ + { + "defaultValue" : { + "float" : { + "_0" : -273.15 + } + }, + "label" : "temp", + "name" : "temp", + "type" : { + "float" : { + + } + } + } + ], + "returnType" : { + "float" : { + + } + } + }, + { + "abiName" : "bjs_testDoubleDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testDoubleDefault", + "parameters" : [ + { + "defaultValue" : { + "double" : { + "_0" : 2.718 + } + }, + "label" : "precision", + "name" : "precision", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_testOptionalDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testOptionalDefault", + "parameters" : [ + { + "defaultValue" : { + "null" : { + + } + }, + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testOptionalStringDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testOptionalStringDefault", + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "Hi" + } + }, + "label" : "greeting", + "name" : "greeting", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testMultipleDefaults", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testMultipleDefaults", + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "Default Title" + } + }, + "label" : "title", + "name" : "title", + "type" : { + "string" : { + + } + } + }, + { + "defaultValue" : { + "int" : { + "_0" : 10 + } + }, + "label" : "count", + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "defaultValue" : { + "bool" : { + "_0" : false + } + }, + "label" : "enabled", + "name" : "enabled", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_testEnumDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testEnumDefault", + "parameters" : [ + { + "defaultValue" : { + "enumCase" : { + "_0" : "Status", + "_1" : "active" + } + }, + "label" : "status", + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Status" + } + } + }, + { + "abiName" : "bjs_testComplexInit", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testComplexInit", + "parameters" : [ + { + "defaultValue" : { + "objectWithArguments" : { + "_0" : "DefaultGreeter", + "_1" : [ + { + "string" : { + "_0" : "DefaultUser" + } + } + ] + } + }, + "label" : "greeter", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "DefaultGreeter" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "DefaultGreeter" + } + } + }, + { + "abiName" : "bjs_testEmptyInit", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testEmptyInit", + "parameters" : [ + { + "defaultValue" : { + "object" : { + "_0" : "EmptyGreeter" + } + }, + "label" : "greeter", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "EmptyGreeter" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "EmptyGreeter" + } + } + }, + { + "abiName" : "bjs_testOptionalStructDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testOptionalStructDefault", + "parameters" : [ + { + "defaultValue" : { + "null" : { + + } + }, + "label" : "point", + "name" : "point", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } + }, + { + "abiName" : "bjs_testOptionalStructWithValueDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testOptionalStructWithValueDefault", + "parameters" : [ + { + "defaultValue" : { + "structLiteral" : { + "_0" : "Config", + "_1" : [ + { + "name" : "name", + "value" : { + "string" : { + "_0" : "default" + } + } + }, + { + "name" : "value", + "value" : { + "int" : { + "_0" : 42 + } + } + }, + { + "name" : "enabled", + "value" : { + "bool" : { + "_0" : true + } + } + } + ] + } + }, + "label" : "point", + "name" : "point", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } + }, + { + "abiName" : "bjs_testIntArrayDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testIntArrayDefault", + "parameters" : [ + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "int" : { + "_0" : 1 + } + }, + { + "int" : { + "_0" : 2 + } + }, + { + "int" : { + "_0" : 3 + } + } + ] + } + }, + "label" : "values", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testStringArrayDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testStringArrayDefault", + "parameters" : [ + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "string" : { + "_0" : "a" + } + }, + { + "string" : { + "_0" : "b" + } + }, + { + "string" : { + "_0" : "c" + } + } + ] + } + }, + "label" : "names", + "name" : "names", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testDoubleArrayDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testDoubleArrayDefault", + "parameters" : [ + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "double" : { + "_0" : 1.5 + } + }, + { + "double" : { + "_0" : 2.5 + } + }, + { + "double" : { + "_0" : 3.5 + } + } + ] + } + }, + "label" : "values", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testBoolArrayDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testBoolArrayDefault", + "parameters" : [ + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "bool" : { + "_0" : true + } + }, + { + "bool" : { + "_0" : false + } + }, + { + "bool" : { + "_0" : true + } + } + ] + } + }, + "label" : "flags", + "name" : "flags", + "type" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testEmptyArrayDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testEmptyArrayDefault", + "parameters" : [ + { + "defaultValue" : { + "array" : { + "_0" : [ + + ] + } + }, + "label" : "items", + "name" : "items", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testMixedWithArrayDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testMixedWithArrayDefault", + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "test" + } + }, + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "int" : { + "_0" : 10 + } + }, + { + "int" : { + "_0" : 20 + } + }, + { + "int" : { + "_0" : 30 + } + } + ] + } + }, + "label" : "values", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "defaultValue" : { + "bool" : { + "_0" : true + } + }, + "label" : "enabled", + "name" : "enabled", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + { + "methods" : [ + + ], + "name" : "Config", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "value", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "enabled", + "type" : { + "bool" : { + + } + } + } + ], + "swiftCallName" : "Config" + }, + { + "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" + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json new file mode 100644 index 000000000..ecf045c3c --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json @@ -0,0 +1,847 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "int" : { + + } + } + } + ], + "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" : { + "int" : { + + } + } + } + ], + "name" : "error" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "status" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + } + ], + "name" : "coordinates" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "status" + } + ], + "emitStyle" : "const", + "name" : "Result", + "namespace" : [ + "Utilities" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utilities.Result", + "tsFullPath" : "Utilities.Result" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + } + ], + "name" : "failure" + } + ], + "emitStyle" : "const", + "name" : "NetworkingResult", + "namespace" : [ + "API" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "NetworkingResult", + "tsFullPath" : "API.NetworkingResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ + { + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "name" : "status" + } + ], + "emitStyle" : "const", + "name" : "APIOptionalResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "APIOptionalResult", + "tsFullPath" : "APIOptionalResult" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_handle", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "handle", + "parameters" : [ + { + "label" : "result", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getResult", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "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_roundTripOptionalAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalAPIResult", + "parameters" : [ + { + "label" : "result", + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "abiName" : "bjs_handleComplex", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "handleComplex", + "parameters" : [ + { + "label" : "result", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getComplexResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getComplexResult", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "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_roundTripOptionalComplexResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalComplexResult", + "parameters" : [ + { + "label" : "result", + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalUtilitiesResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalUtilitiesResult", + "parameters" : [ + { + "label" : "result", + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "Utilities.Result" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "Utilities.Result" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalNetworkingResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalNetworkingResult", + "parameters" : [ + { + "label" : "result", + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "NetworkingResult" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "NetworkingResult" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalAPIOptionalResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalAPIOptionalResult", + "parameters" : [ + { + "label" : "result", + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + } + } + } + }, + { + "abiName" : "bjs_compareAPIResults", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "compareAPIResults", + "parameters" : [ + { + "label" : "result1", + "name" : "result1", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + } + } + } + }, + { + "label" : "result2", + "name" : "result2", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + } + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumCase.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumCase.json new file mode 100644 index 000000000..2d5d5f2fa --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumCase.json @@ -0,0 +1,323 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + { + "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" : "north" + }, + { + "associatedValues" : [ + + ], + "name" : "south" + }, + { + "associatedValues" : [ + + ], + "name" : "east" + }, + { + "associatedValues" : [ + + ], + "name" : "west" + } + ], + "emitStyle" : "tsEnum", + "name" : "TSDirection", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "TSDirection", + "tsFullPath" : "TSDirection" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "success" + } + ], + "emitStyle" : "const", + "explicitAccessControl" : "public", + "name" : "PublicStatus", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "PublicStatus", + "tsFullPath" : "PublicStatus" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_setDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setDirection", + "parameters" : [ + { + "label" : "_", + "name" : "direction", + "type" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "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_roundTripOptionalDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalDirection", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "abiName" : "bjs_setTSDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setTSDirection", + "parameters" : [ + { + "label" : "_", + "name" : "direction", + "type" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getTSDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTSDirection", + "parameters" : [ + + ], + "returnType" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalTSDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTSDirection", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumCase.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumCase.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.json new file mode 100644 index 000000000..65b8ba350 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.json @@ -0,0 +1,541 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Converter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_Converter_toString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "toString", + "namespace" : [ + "Utils" + ], + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Converter", + "namespace" : [ + "Utils" + ], + "properties" : [ + + ], + "swiftCallName" : "Utils.Converter" + }, + { + "constructor" : { + "abiName" : "bjs_HTTPServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_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_TestServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_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" + } + ], + "enums" : [ + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Utils", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utils", + "tsFullPath" : "Utils" + }, + { + "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" : [ + + ], + "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" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "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" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "GraphOperations" + } + } + }, + { + "abiName" : "bjs_Services_Graph_GraphOperations_static_validate", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : true + }, + "name" : "validate", + "namespace" : [ + "Services", + "Graph", + "GraphOperations" + ], + "parameters" : [ + { + "label" : "graphId", + "name" : "graphId", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "GraphOperations" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GraphOperations", + "tsFullPath" : "Services.Graph.GraphOperations" + } + ], + "exposeToGlobal" : true, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.json new file mode 100644 index 000000000..9b800c743 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.json @@ -0,0 +1,541 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Converter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_Converter_toString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "toString", + "namespace" : [ + "Utils" + ], + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Converter", + "namespace" : [ + "Utils" + ], + "properties" : [ + + ], + "swiftCallName" : "Utils.Converter" + }, + { + "constructor" : { + "abiName" : "bjs_HTTPServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_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_TestServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_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" + } + ], + "enums" : [ + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Utils", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utils", + "tsFullPath" : "Utils" + }, + { + "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" : [ + + ], + "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" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "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" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "GraphOperations" + } + } + }, + { + "abiName" : "bjs_Services_Graph_GraphOperations_static_validate", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : true + }, + "name" : "validate", + "namespace" : [ + "Services", + "Graph", + "GraphOperations" + ], + "parameters" : [ + { + "label" : "graphId", + "name" : "graphId", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "GraphOperations" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GraphOperations", + "tsFullPath" : "Services.Graph.GraphOperations" + } + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.json new file mode 100644 index 000000000..20ef1f42f --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.json @@ -0,0 +1,1543 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + { + "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" : "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" : [ + { + "associatedValues" : [ + + ], + "name" : "enabled", + "rawValue" : "true" + }, + { + "associatedValues" : [ + + ], + "name" : "disabled", + "rawValue" : "false" + } + ], + "emitStyle" : "const", + "name" : "FeatureFlag", + "rawType" : "Bool", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "FeatureFlag", + "tsFullPath" : "FeatureFlag" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "ok", + "rawValue" : "200" + }, + { + "associatedValues" : [ + + ], + "name" : "notFound", + "rawValue" : "404" + }, + { + "associatedValues" : [ + + ], + "name" : "serverError", + "rawValue" : "500" + } + ], + "emitStyle" : "const", + "name" : "HttpStatus", + "rawType" : "Int", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "HttpStatus", + "tsFullPath" : "HttpStatus" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "ok", + "rawValue" : "200" + }, + { + "associatedValues" : [ + + ], + "name" : "notFound", + "rawValue" : "404" + }, + { + "associatedValues" : [ + + ], + "name" : "serverError", + "rawValue" : "500" + } + ], + "emitStyle" : "tsEnum", + "name" : "TSHttpStatus", + "rawType" : "Int", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "TSHttpStatus", + "tsFullPath" : "TSHttpStatus" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "lowest", + "rawValue" : "-1" + }, + { + "associatedValues" : [ + + ], + "name" : "low", + "rawValue" : "2" + }, + { + "associatedValues" : [ + + ], + "name" : "medium", + "rawValue" : "3" + }, + { + "associatedValues" : [ + + ], + "name" : "high", + "rawValue" : "4" + }, + { + "associatedValues" : [ + + ], + "name" : "highest", + "rawValue" : "5" + } + ], + "emitStyle" : "const", + "name" : "Priority", + "rawType" : "Int32", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Priority", + "tsFullPath" : "Priority" + }, + { + "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" : "guest", + "rawValue" : "0" + }, + { + "associatedValues" : [ + + ], + "name" : "user", + "rawValue" : "1000" + }, + { + "associatedValues" : [ + + ], + "name" : "admin", + "rawValue" : "9999" + } + ], + "emitStyle" : "const", + "name" : "UserId", + "rawType" : "UInt", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "UserId", + "tsFullPath" : "UserId" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "invalid", + "rawValue" : "0" + }, + { + "associatedValues" : [ + + ], + "name" : "session", + "rawValue" : "12345" + }, + { + "associatedValues" : [ + + ], + "name" : "refresh", + "rawValue" : "67890" + } + ], + "emitStyle" : "const", + "name" : "TokenId", + "rawType" : "UInt32", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "TokenId", + "tsFullPath" : "TokenId" + }, + { + "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" + }, + { + "associatedValues" : [ + + ], + "name" : "pi", + "rawValue" : "3.14159" + } + ], + "emitStyle" : "const", + "name" : "Ratio", + "rawType" : "Double", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Ratio", + "tsFullPath" : "Ratio" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_setTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setTheme", + "parameters" : [ + { + "label" : "_", + "name" : "theme", + "type" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTheme", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTheme", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "abiName" : "bjs_setTSTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setTSTheme", + "parameters" : [ + { + "label" : "_", + "name" : "theme", + "type" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getTSTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTSTheme", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalTSTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTSTheme", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + } + } + }, + { + "abiName" : "bjs_setFeatureFlag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setFeatureFlag", + "parameters" : [ + { + "label" : "_", + "name" : "flag", + "type" : { + "rawValueEnum" : { + "_0" : "FeatureFlag", + "_1" : "String" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getFeatureFlag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getFeatureFlag", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "FeatureFlag", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalFeatureFlag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalFeatureFlag", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FeatureFlag", + "_1" : "String" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FeatureFlag", + "_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" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getHttpStatus", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, + { + "abiName" : "bjs_setTSHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setTSHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "status", + "type" : { + "rawValueEnum" : { + "_0" : "TSHttpStatus", + "_1" : "Int" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getTSHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTSHttpStatus", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "TSHttpStatus", + "_1" : "Int" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "TSHttpStatus", + "_1" : "Int" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "TSHttpStatus", + "_1" : "Int" + } + } + } + } + }, + { + "abiName" : "bjs_setPriority", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setPriority", + "parameters" : [ + { + "label" : "_", + "name" : "priority", + "type" : { + "rawValueEnum" : { + "_0" : "Priority", + "_1" : "Int32" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getPriority", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getPriority", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Priority", + "_1" : "Int32" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalPriority", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalPriority", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Priority", + "_1" : "Int32" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Priority", + "_1" : "Int32" + } + } + } + } + }, + { + "abiName" : "bjs_setFileSize", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setFileSize", + "parameters" : [ + { + "label" : "_", + "name" : "size", + "type" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getFileSize", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getFileSize", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalFileSize", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalFileSize", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + } + } + } + }, + { + "abiName" : "bjs_setUserId", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setUserId", + "parameters" : [ + { + "label" : "_", + "name" : "id", + "type" : { + "rawValueEnum" : { + "_0" : "UserId", + "_1" : "UInt" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getUserId", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getUserId", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "UserId", + "_1" : "UInt" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalUserId", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalUserId", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "UserId", + "_1" : "UInt" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "UserId", + "_1" : "UInt" + } + } + } + } + }, + { + "abiName" : "bjs_setTokenId", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setTokenId", + "parameters" : [ + { + "label" : "_", + "name" : "token", + "type" : { + "rawValueEnum" : { + "_0" : "TokenId", + "_1" : "UInt32" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getTokenId", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTokenId", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "TokenId", + "_1" : "UInt32" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalTokenId", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTokenId", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "TokenId", + "_1" : "UInt32" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "TokenId", + "_1" : "UInt32" + } + } + } + } + }, + { + "abiName" : "bjs_setSessionId", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setSessionId", + "parameters" : [ + { + "label" : "_", + "name" : "session", + "type" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getSessionId", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getSessionId", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalSessionId", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalSessionId", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + } + } + } + }, + { + "abiName" : "bjs_setPrecision", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setPrecision", + "parameters" : [ + { + "label" : "_", + "name" : "precision", + "type" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getPrecision", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getPrecision", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalPrecision", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalPrecision", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + } + } + } + }, + { + "abiName" : "bjs_setRatio", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setRatio", + "parameters" : [ + { + "label" : "_", + "name" : "ratio", + "type" : { + "rawValueEnum" : { + "_0" : "Ratio", + "_1" : "Double" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getRatio", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getRatio", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Ratio", + "_1" : "Double" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalRatio", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalRatio", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Ratio", + "_1" : "Double" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Ratio", + "_1" : "Double" + } + } + } + } + }, + { + "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_convertPriority", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "convertPriority", + "parameters" : [ + { + "label" : "_", + "name" : "status", + "type" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Priority", + "_1" : "Int32" + } + } + }, + { + "abiName" : "bjs_validateSession", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "validateSession", + "parameters" : [ + { + "label" : "_", + "name" : "session", + "type" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "takesFeatureFlag", + "parameters" : [ + { + "name" : "flag", + "type" : { + "rawValueEnum" : { + "_0" : "FeatureFlag", + "_1" : "String" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "returnsFeatureFlag", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "FeatureFlag", + "_1" : "String" + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.swift similarity index 90% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.swift index 55c902af0..210361b3b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.swift @@ -100,9 +100,9 @@ public func _bjs_roundTripOptionalTSTheme(_ inputIsSome: Int32, _ inputBytes: In @_expose(wasm, "bjs_setFeatureFlag") @_cdecl("bjs_setFeatureFlag") -public func _bjs_setFeatureFlag(_ flag: Int32) -> Void { +public func _bjs_setFeatureFlag(_ flagBytes: Int32, _ flagLength: Int32) -> Void { #if arch(wasm32) - setFeatureFlag(_: FeatureFlag.bridgeJSLiftParameter(flag)) + setFeatureFlag(_: FeatureFlag.bridgeJSLiftParameter(flagBytes, flagLength)) #else fatalError("Only available on WebAssembly") #endif @@ -110,7 +110,7 @@ public func _bjs_setFeatureFlag(_ flag: Int32) -> Void { @_expose(wasm, "bjs_getFeatureFlag") @_cdecl("bjs_getFeatureFlag") -public func _bjs_getFeatureFlag() -> Int32 { +public func _bjs_getFeatureFlag() -> Void { #if arch(wasm32) let ret = getFeatureFlag() return ret.bridgeJSLowerReturn() @@ -121,9 +121,9 @@ public func _bjs_getFeatureFlag() -> Int32 { @_expose(wasm, "bjs_roundTripOptionalFeatureFlag") @_cdecl("bjs_roundTripOptionalFeatureFlag") -public func _bjs_roundTripOptionalFeatureFlag(_ inputIsSome: Int32, _ inputValue: Int32) -> Void { +public func _bjs_roundTripOptionalFeatureFlag(_ inputIsSome: Int32, _ inputBytes: Int32, _ inputLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalFeatureFlag(_: Optional.bridgeJSLiftParameter(inputIsSome, inputValue)) + let ret = roundTripOptionalFeatureFlag(_: Optional.bridgeJSLiftParameter(inputIsSome, inputBytes, inputLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -449,4 +449,38 @@ public func _bjs_validateSession(_ session: Int32) -> Void { #else fatalError("Only available on WebAssembly") #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_takesFeatureFlag") +fileprivate func bjs_takesFeatureFlag(_ flag: Int32) -> Void +#else +fileprivate func bjs_takesFeatureFlag(_ flag: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$takesFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> Void { + let flagValue = flag.bridgeJSLowerParameter() + bjs_takesFeatureFlag(flagValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_returnsFeatureFlag") +fileprivate func bjs_returnsFeatureFlag() -> Int32 +#else +fileprivate func bjs_returnsFeatureFlag() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$returnsFeatureFlag() throws(JSException) -> FeatureFlag { + let ret = bjs_returnsFeatureFlag() + if let error = _swift_js_take_exception() { + throw error + } + return FeatureFlag.bridgeJSLiftReturn(ret) } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.json new file mode 100644 index 000000000..c9be60d8a --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.json @@ -0,0 +1,71 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + + ], + "globalGetters" : [ + { + "name" : "console", + "type" : { + "jsObject" : { + "_0" : "JSConsole" + } + } + } + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + { + "name" : "log", + "parameters" : [ + { + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "JSConsole", + "setters" : [ + + ] + } + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalGetter.ImportMacros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.swift similarity index 88% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalGetter.ImportMacros.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.swift index b5442b09e..da3f1367b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalGetter.ImportMacros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.swift @@ -1,5 +1,5 @@ #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_console_get") +@_extern(wasm, module: "TestModule", name: "bjs_console_get") fileprivate func bjs_console_get() -> Int32 #else fileprivate func bjs_console_get() -> Int32 { @@ -16,7 +16,7 @@ func _$console_get() throws(JSException) -> JSConsole { } #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_JSConsole_log") +@_extern(wasm, module: "TestModule", name: "bjs_JSConsole_log") fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void #else fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.json new file mode 100644 index 000000000..5cec23259 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.json @@ -0,0 +1,126 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "from" : "global", + "jsName" : "parseInt", + "name" : "parseInt", + "parameters" : [ + { + "name" : "string", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + } + ], + "globalGetters" : [ + { + "from" : "global", + "name" : "console", + "type" : { + "jsObject" : { + "_0" : "JSConsole" + } + } + } + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + { + "name" : "log", + "parameters" : [ + { + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "JSConsole", + "setters" : [ + + ] + }, + { + "constructor" : { + "parameters" : [ + { + "name" : "url", + "type" : { + "string" : { + + } + } + } + ] + }, + "from" : "global", + "getters" : [ + + ], + "methods" : [ + { + "name" : "close", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "WebSocket", + "setters" : [ + + ] + } + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalThisImports.ImportMacros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.swift similarity index 88% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalThisImports.ImportMacros.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.swift index 503da6189..56353b253 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/GlobalThisImports.ImportMacros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.swift @@ -1,5 +1,5 @@ #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_console_get") +@_extern(wasm, module: "TestModule", name: "bjs_console_get") fileprivate func bjs_console_get() -> Int32 #else fileprivate func bjs_console_get() -> Int32 { @@ -16,7 +16,7 @@ func _$console_get() throws(JSException) -> JSConsole { } #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_parseInt") +@_extern(wasm, module: "TestModule", name: "bjs_parseInt") fileprivate func bjs_parseInt(_ string: Int32) -> Float64 #else fileprivate func bjs_parseInt(_ string: Int32) -> Float64 { @@ -34,7 +34,7 @@ func _$parseInt(_ string: String) throws(JSException) -> Double { } #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_JSConsole_log") +@_extern(wasm, module: "TestModule", name: "bjs_JSConsole_log") fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void #else fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void { @@ -52,7 +52,7 @@ func _$JSConsole_log(_ self: JSObject, _ message: String) throws(JSException) -> } #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WebSocket_init") +@_extern(wasm, module: "TestModule", name: "bjs_WebSocket_init") fileprivate func bjs_WebSocket_init(_ url: Int32) -> Int32 #else fileprivate func bjs_WebSocket_init(_ url: Int32) -> Int32 { @@ -61,7 +61,7 @@ fileprivate func bjs_WebSocket_init(_ url: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WebSocket_close") +@_extern(wasm, module: "TestModule", name: "bjs_WebSocket_close") fileprivate func bjs_WebSocket_close(_ self: Int32) -> Void #else fileprivate func bjs_WebSocket_close(_ self: Int32) -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json new file mode 100644 index 000000000..10a18983b --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json @@ -0,0 +1,65 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_makeFoo", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "makeFoo", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "Foo" + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + + ], + "types" : [ + { + "constructor" : { + "parameters" : [ + + ] + }, + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "Foo", + "setters" : [ + + ] + } + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift similarity index 62% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift index 0bebd4e73..29b615b0f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift @@ -21,4 +21,21 @@ public func _bjs_makeFoo() -> Int32 { #else fatalError("Only available on WebAssembly") #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Foo_init") +fileprivate func bjs_Foo_init() -> Int32 +#else +fileprivate func bjs_Foo_init() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$Foo_init() throws(JSException) -> JSObject { + let ret = bjs_Foo_init() + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.json new file mode 100644 index 000000000..40b97c12b --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.json @@ -0,0 +1,258 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "createWeirdObject", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "WeirdNaming" + } + } + }, + { + "name" : "createWeirdClass", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "_Weird" + } + } + } + ], + "types" : [ + { + "getters" : [ + { + "name" : "normalProperty", + "type" : { + "string" : { + + } + } + }, + { + "jsName" : "property-with-dashes", + "name" : "property_with_dashes", + "type" : { + "double" : { + + } + } + }, + { + "jsName" : "123invalidStart", + "name" : "_123invalidStart", + "type" : { + "bool" : { + + } + } + }, + { + "jsName" : "property with spaces", + "name" : "property_with_spaces", + "type" : { + "string" : { + + } + } + }, + { + "jsName" : "@specialChar", + "name" : "_specialChar", + "type" : { + "double" : { + + } + } + }, + { + "name" : "constructor", + "type" : { + "string" : { + + } + } + }, + { + "name" : "for", + "type" : { + "string" : { + + } + } + }, + { + "name" : "Any", + "type" : { + "string" : { + + } + } + } + ], + "methods" : [ + { + "name" : "as", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "try", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "WeirdNaming", + "setters" : [ + { + "functionName" : "normalProperty_set", + "name" : "normalProperty", + "type" : { + "string" : { + + } + } + }, + { + "functionName" : "property_with_dashes_set", + "jsName" : "property-with-dashes", + "name" : "property_with_dashes", + "type" : { + "double" : { + + } + } + }, + { + "functionName" : "_123invalidStart_set", + "jsName" : "123invalidStart", + "name" : "_123invalidStart", + "type" : { + "bool" : { + + } + } + }, + { + "functionName" : "property_with_spaces_set", + "jsName" : "property with spaces", + "name" : "property_with_spaces", + "type" : { + "string" : { + + } + } + }, + { + "functionName" : "_specialChar_set", + "jsName" : "@specialChar", + "name" : "_specialChar", + "type" : { + "double" : { + + } + } + }, + { + "functionName" : "constructor_set", + "name" : "constructor", + "type" : { + "string" : { + + } + } + }, + { + "functionName" : "for_set", + "name" : "for", + "type" : { + "string" : { + + } + } + }, + { + "functionName" : "any_set", + "jsName" : "Any", + "name" : "any", + "type" : { + "string" : { + + } + } + } + ] + }, + { + "constructor" : { + "parameters" : [ + + ] + }, + "getters" : [ + + ], + "jsName" : "$Weird", + "methods" : [ + { + "jsName" : "method-with-dashes", + "name" : "method_with_dashes", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "_Weird", + "setters" : [ + + ] + } + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.swift similarity index 77% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.swift index 0ef52d4d7..86e72bb53 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.swift @@ -1,22 +1,5 @@ #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_createArrayBuffer") -fileprivate func bjs_createArrayBuffer() -> Int32 -#else -fileprivate func bjs_createArrayBuffer() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$createArrayBuffer() throws(JSException) -> ArrayBufferLike { - let ret = bjs_createArrayBuffer() - if let error = _swift_js_take_exception() { - throw error - } - return ArrayBufferLike.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_createWeirdObject") +@_extern(wasm, module: "TestModule", name: "bjs_createWeirdObject") fileprivate func bjs_createWeirdObject() -> Int32 #else fileprivate func bjs_createWeirdObject() -> Int32 { @@ -33,7 +16,7 @@ func _$createWeirdObject() throws(JSException) -> WeirdNaming { } #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_createWeirdClass") +@_extern(wasm, module: "TestModule", name: "bjs_createWeirdClass") fileprivate func bjs_createWeirdClass() -> Int32 #else fileprivate func bjs_createWeirdClass() -> Int32 { @@ -50,45 +33,7 @@ func _$createWeirdClass() throws(JSException) -> _Weird { } #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_ArrayBufferLike_byteLength_get") -fileprivate func bjs_ArrayBufferLike_byteLength_get(_ self: Int32) -> Float64 -#else -fileprivate func bjs_ArrayBufferLike_byteLength_get(_ self: Int32) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_ArrayBufferLike_slice") -fileprivate func bjs_ArrayBufferLike_slice(_ self: Int32, _ begin: Float64, _ end: Float64) -> Int32 -#else -fileprivate func bjs_ArrayBufferLike_slice(_ self: Int32, _ begin: Float64, _ end: Float64) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$ArrayBufferLike_byteLength_get(_ self: JSObject) throws(JSException) -> Double { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_ArrayBufferLike_byteLength_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -func _$ArrayBufferLike_slice(_ self: JSObject, _ begin: Double, _ end: Double) throws(JSException) -> ArrayBufferLike { - let selfValue = self.bridgeJSLowerParameter() - let beginValue = begin.bridgeJSLowerParameter() - let endValue = end.bridgeJSLowerParameter() - let ret = bjs_ArrayBufferLike_slice(selfValue, beginValue, endValue) - if let error = _swift_js_take_exception() { - throw error - } - return ArrayBufferLike.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_normalProperty_get") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_normalProperty_get") fileprivate func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 #else fileprivate func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 { @@ -97,7 +42,7 @@ fileprivate func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_property_with_dashes_get") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_property_with_dashes_get") fileprivate func bjs_WeirdNaming_property_with_dashes_get(_ self: Int32) -> Float64 #else fileprivate func bjs_WeirdNaming_property_with_dashes_get(_ self: Int32) -> Float64 { @@ -106,7 +51,7 @@ fileprivate func bjs_WeirdNaming_property_with_dashes_get(_ self: Int32) -> Floa #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming__123invalidStart_get") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming__123invalidStart_get") fileprivate func bjs_WeirdNaming__123invalidStart_get(_ self: Int32) -> Int32 #else fileprivate func bjs_WeirdNaming__123invalidStart_get(_ self: Int32) -> Int32 { @@ -115,7 +60,7 @@ fileprivate func bjs_WeirdNaming__123invalidStart_get(_ self: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_property_with_spaces_get") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_property_with_spaces_get") fileprivate func bjs_WeirdNaming_property_with_spaces_get(_ self: Int32) -> Int32 #else fileprivate func bjs_WeirdNaming_property_with_spaces_get(_ self: Int32) -> Int32 { @@ -124,7 +69,7 @@ fileprivate func bjs_WeirdNaming_property_with_spaces_get(_ self: Int32) -> Int3 #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming__specialChar_get") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming__specialChar_get") fileprivate func bjs_WeirdNaming__specialChar_get(_ self: Int32) -> Float64 #else fileprivate func bjs_WeirdNaming__specialChar_get(_ self: Int32) -> Float64 { @@ -133,7 +78,7 @@ fileprivate func bjs_WeirdNaming__specialChar_get(_ self: Int32) -> Float64 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_constructor_get") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_constructor_get") fileprivate func bjs_WeirdNaming_constructor_get(_ self: Int32) -> Int32 #else fileprivate func bjs_WeirdNaming_constructor_get(_ self: Int32) -> Int32 { @@ -142,7 +87,7 @@ fileprivate func bjs_WeirdNaming_constructor_get(_ self: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_get") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_for_get") fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 #else fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 { @@ -151,7 +96,7 @@ fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_Any_get") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_Any_get") fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 #else fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 { @@ -160,7 +105,7 @@ fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_normalProperty_set") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_normalProperty_set") fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void #else fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void { @@ -169,7 +114,7 @@ fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: I #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_property_with_dashes_set") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_property_with_dashes_set") fileprivate func bjs_WeirdNaming_property_with_dashes_set(_ self: Int32, _ newValue: Float64) -> Void #else fileprivate func bjs_WeirdNaming_property_with_dashes_set(_ self: Int32, _ newValue: Float64) -> Void { @@ -178,7 +123,7 @@ fileprivate func bjs_WeirdNaming_property_with_dashes_set(_ self: Int32, _ newVa #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming__123invalidStart_set") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming__123invalidStart_set") fileprivate func bjs_WeirdNaming__123invalidStart_set(_ self: Int32, _ newValue: Int32) -> Void #else fileprivate func bjs_WeirdNaming__123invalidStart_set(_ self: Int32, _ newValue: Int32) -> Void { @@ -187,7 +132,7 @@ fileprivate func bjs_WeirdNaming__123invalidStart_set(_ self: Int32, _ newValue: #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_property_with_spaces_set") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_property_with_spaces_set") fileprivate func bjs_WeirdNaming_property_with_spaces_set(_ self: Int32, _ newValue: Int32) -> Void #else fileprivate func bjs_WeirdNaming_property_with_spaces_set(_ self: Int32, _ newValue: Int32) -> Void { @@ -196,7 +141,7 @@ fileprivate func bjs_WeirdNaming_property_with_spaces_set(_ self: Int32, _ newVa #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming__specialChar_set") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming__specialChar_set") fileprivate func bjs_WeirdNaming__specialChar_set(_ self: Int32, _ newValue: Float64) -> Void #else fileprivate func bjs_WeirdNaming__specialChar_set(_ self: Int32, _ newValue: Float64) -> Void { @@ -205,7 +150,7 @@ fileprivate func bjs_WeirdNaming__specialChar_set(_ self: Int32, _ newValue: Flo #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_constructor_set") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_constructor_set") fileprivate func bjs_WeirdNaming_constructor_set(_ self: Int32, _ newValue: Int32) -> Void #else fileprivate func bjs_WeirdNaming_constructor_set(_ self: Int32, _ newValue: Int32) -> Void { @@ -214,7 +159,7 @@ fileprivate func bjs_WeirdNaming_constructor_set(_ self: Int32, _ newValue: Int3 #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_set") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_for_set") fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void #else fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void { @@ -223,7 +168,7 @@ fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Vo #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_any_set") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_any_set") fileprivate func bjs_WeirdNaming_any_set(_ self: Int32, _ newValue: Int32) -> Void #else fileprivate func bjs_WeirdNaming_any_set(_ self: Int32, _ newValue: Int32) -> Void { @@ -232,7 +177,7 @@ fileprivate func bjs_WeirdNaming_any_set(_ self: Int32, _ newValue: Int32) -> Vo #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_as") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_as") fileprivate func bjs_WeirdNaming_as(_ self: Int32) -> Void #else fileprivate func bjs_WeirdNaming_as(_ self: Int32) -> Void { @@ -241,7 +186,7 @@ fileprivate func bjs_WeirdNaming_as(_ self: Int32) -> Void { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_try") +@_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_try") fileprivate func bjs_WeirdNaming_try(_ self: Int32) -> Void #else fileprivate func bjs_WeirdNaming_try(_ self: Int32) -> Void { @@ -410,7 +355,7 @@ func _$WeirdNaming_try(_ self: JSObject) throws(JSException) -> Void { } #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs__Weird_init") +@_extern(wasm, module: "TestModule", name: "bjs__Weird_init") fileprivate func bjs__Weird_init() -> Int32 #else fileprivate func bjs__Weird_init() -> Int32 { @@ -419,7 +364,7 @@ fileprivate func bjs__Weird_init() -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs__Weird_method_with_dashes") +@_extern(wasm, module: "TestModule", name: "bjs__Weird_method_with_dashes") fileprivate func bjs__Weird_method_with_dashes(_ self: Int32) -> Void #else fileprivate func bjs__Weird_method_with_dashes(_ self: Int32) -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.json new file mode 100644 index 000000000..07906a404 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.json @@ -0,0 +1,172 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "returnAnimatable", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "Animatable" + } + } + } + ], + "types" : [ + { + "constructor" : { + "parameters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + "getters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "name" : "age", + "type" : { + "double" : { + + } + } + } + ], + "methods" : [ + { + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "name" : "changeName", + "parameters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "Greeter", + "setters" : [ + { + "functionName" : "name_set", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + { + "getters" : [ + + ], + "methods" : [ + { + "name" : "animate", + "parameters" : [ + { + "name" : "keyframes", + "type" : { + "jsObject" : { + + } + } + }, + { + "name" : "options", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "name" : "getAnimations", + "parameters" : [ + { + "name" : "options", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + } + ], + "name" : "Animatable", + "setters" : [ + + ] + } + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.swift similarity index 55% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.swift index 67c778975..09e828fba 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.swift @@ -1,5 +1,22 @@ #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Greeter_init") +@_extern(wasm, module: "TestModule", name: "bjs_returnAnimatable") +fileprivate func bjs_returnAnimatable() -> Int32 +#else +fileprivate func bjs_returnAnimatable() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$returnAnimatable() throws(JSException) -> Animatable { + let ret = bjs_returnAnimatable() + if let error = _swift_js_take_exception() { + throw error + } + return Animatable.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Greeter_init") fileprivate func bjs_Greeter_init(_ name: Int32) -> Int32 #else fileprivate func bjs_Greeter_init(_ name: Int32) -> Int32 { @@ -8,7 +25,7 @@ fileprivate func bjs_Greeter_init(_ name: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Greeter_name_get") +@_extern(wasm, module: "TestModule", name: "bjs_Greeter_name_get") fileprivate func bjs_Greeter_name_get(_ self: Int32) -> Int32 #else fileprivate func bjs_Greeter_name_get(_ self: Int32) -> Int32 { @@ -17,7 +34,7 @@ fileprivate func bjs_Greeter_name_get(_ self: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Greeter_age_get") +@_extern(wasm, module: "TestModule", name: "bjs_Greeter_age_get") fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 #else fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 { @@ -26,7 +43,7 @@ fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Greeter_name_set") +@_extern(wasm, module: "TestModule", name: "bjs_Greeter_name_set") fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void #else fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { @@ -35,7 +52,7 @@ fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Greeter_greet") +@_extern(wasm, module: "TestModule", name: "bjs_Greeter_greet") fileprivate func bjs_Greeter_greet(_ self: Int32) -> Int32 #else fileprivate func bjs_Greeter_greet(_ self: Int32) -> Int32 { @@ -44,7 +61,7 @@ fileprivate func bjs_Greeter_greet(_ self: Int32) -> Int32 { #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Greeter_changeName") +@_extern(wasm, module: "TestModule", name: "bjs_Greeter_changeName") fileprivate func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void #else fileprivate func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void { @@ -104,4 +121,43 @@ func _$Greeter_changeName(_ self: JSObject, _ name: String) throws(JSException) if let error = _swift_js_take_exception() { throw error } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Animatable_animate") +fileprivate func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 +#else +fileprivate func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Animatable_getAnimations") +fileprivate func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 +#else +fileprivate func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$Animatable_animate(_ self: JSObject, _ keyframes: JSObject, _ options: JSObject) throws(JSException) -> JSObject { + let selfValue = self.bridgeJSLowerParameter() + let keyframesValue = keyframes.bridgeJSLowerParameter() + let optionsValue = options.bridgeJSLowerParameter() + let ret = bjs_Animatable_animate(selfValue, keyframesValue, optionsValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$Animatable_getAnimations(_ self: JSObject, _ options: JSObject) throws(JSException) -> JSObject { + let selfValue = self.bridgeJSLowerParameter() + let optionsValue = options.bridgeJSLowerParameter() + let ret = bjs_Animatable_getAnimations(selfValue, optionsValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedGlobal.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedGlobal.json new file mode 100644 index 000000000..1241c232d --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedGlobal.json @@ -0,0 +1,79 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_GlobalClass_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_GlobalClass_greet", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "GlobalClass", + "namespace" : [ + "GlobalAPI" + ], + "properties" : [ + + ], + "swiftCallName" : "GlobalClass" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_GlobalAPI_globalFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "globalFunction", + "namespace" : [ + "GlobalAPI" + ], + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedGlobal.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedGlobal.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedPrivate.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedPrivate.json new file mode 100644 index 000000000..96e188fd2 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedPrivate.json @@ -0,0 +1,79 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_PrivateClass_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_PrivateClass_greet", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "PrivateClass", + "namespace" : [ + "PrivateAPI" + ], + "properties" : [ + + ], + "swiftCallName" : "PrivateClass" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_PrivateAPI_privateFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "privateFunction", + "namespace" : [ + "PrivateAPI" + ], + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedPrivate.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedPrivate.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.json new file mode 100644 index 000000000..a87bffa6b --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.json @@ -0,0 +1,185 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Greeter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_Greeter_greet", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Greeter", + "namespace" : [ + "__Swift", + "Foundation" + ], + "properties" : [ + + ], + "swiftCallName" : "Greeter" + }, + { + "constructor" : { + "abiName" : "bjs_Converter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_Converter_toString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "toString", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Converter", + "namespace" : [ + "Utils", + "Converters" + ], + "properties" : [ + + ], + "swiftCallName" : "Converter" + }, + { + "methods" : [ + { + "abiName" : "bjs_UUID_uuidString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "uuidString", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "UUID", + "namespace" : [ + "__Swift", + "Foundation" + ], + "properties" : [ + + ], + "swiftCallName" : "UUID" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : true, + "functions" : [ + { + "abiName" : "bjs_plainFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "plainFunction", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_MyModule_Utils_namespacedFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "namespacedFunction", + "namespace" : [ + "MyModule", + "Utils" + ], + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.json new file mode 100644 index 000000000..766d93a5d --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.json @@ -0,0 +1,185 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Greeter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_Greeter_greet", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Greeter", + "namespace" : [ + "__Swift", + "Foundation" + ], + "properties" : [ + + ], + "swiftCallName" : "Greeter" + }, + { + "constructor" : { + "abiName" : "bjs_Converter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_Converter_toString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "toString", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Converter", + "namespace" : [ + "Utils", + "Converters" + ], + "properties" : [ + + ], + "swiftCallName" : "Converter" + }, + { + "methods" : [ + { + "abiName" : "bjs_UUID_uuidString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "uuidString", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "UUID", + "namespace" : [ + "__Swift", + "Foundation" + ], + "properties" : [ + + ], + "swiftCallName" : "UUID" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_plainFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "plainFunction", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_MyModule_Utils_namespacedFunction", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "namespacedFunction", + "namespace" : [ + "MyModule", + "Utils" + ], + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json new file mode 100644 index 000000000..2af32886b --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json @@ -0,0 +1,702 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Greeter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ] + }, + "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" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "Greeter", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "swiftCallName" : "Greeter" + }, + { + "constructor" : { + "abiName" : "bjs_OptionalPropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + + ], + "name" : "OptionalPropertyHolder", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalName", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalAge", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalGreeter", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "swiftCallName" : "OptionalPropertyHolder" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_roundTripOptionalClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalClass", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "abiName" : "bjs_testOptionalPropertyRoundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testOptionalPropertyRoundtrip", + "parameters" : [ + { + "label" : "_", + "name" : "holder", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "OptionalPropertyHolder" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "OptionalPropertyHolder" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripString", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripInt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripInt", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripBool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripBool", + "parameters" : [ + { + "label" : "flag", + "name" : "flag", + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripFloat", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripFloat", + "parameters" : [ + { + "label" : "number", + "name" : "number", + "type" : { + "optional" : { + "_0" : { + "float" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "float" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripDouble", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDouble", + "parameters" : [ + { + "label" : "precision", + "name" : "precision", + "type" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripSyntax", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripSyntax", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripMixSyntax", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripMixSyntax", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripSwiftSyntax", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripSwiftSyntax", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripMixedSwiftSyntax", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripMixedSwiftSyntax", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripWithSpaces", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripWithSpaces", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripAlias", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripAlias", + "parameters" : [ + { + "label" : "age", + "name" : "age", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalAlias", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalAlias", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testMixedOptionals", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testMixedOptionals", + "parameters" : [ + { + "label" : "firstName", + "name" : "firstName", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "label" : "lastName", + "name" : "lastName", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "label" : "age", + "name" : "age", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "label" : "active", + "name" : "active", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.json new file mode 100644 index 000000000..8b586dbe0 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.json @@ -0,0 +1,118 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_check", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "check", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "int" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "uint" : { + + } + } + }, + { + "label" : "c", + "name" : "c", + "type" : { + "float" : { + + } + } + }, + { + "label" : "d", + "name" : "d", + "type" : { + "double" : { + + } + } + }, + { + "label" : "e", + "name" : "e", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "check", + "parameters" : [ + { + "name" : "a", + "type" : { + "double" : { + + } + } + }, + { + "name" : "b", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.swift new file mode 100644 index 000000000..763cf8ca4 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.swift @@ -0,0 +1,27 @@ +@_expose(wasm, "bjs_check") +@_cdecl("bjs_check") +public func _bjs_check(_ a: Int32, _ b: Int32, _ c: Float32, _ d: Float64, _ e: Int32) -> Void { + #if arch(wasm32) + check(a: Int.bridgeJSLiftParameter(a), b: UInt.bridgeJSLiftParameter(b), c: Float.bridgeJSLiftParameter(c), d: Double.bridgeJSLiftParameter(d), e: Bool.bridgeJSLiftParameter(e)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_check") +fileprivate func bjs_check(_ a: Float64, _ b: Int32) -> Void +#else +fileprivate func bjs_check(_ a: Float64, _ b: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$check(_ a: Double, _ b: Bool) throws(JSException) -> Void { + let aValue = a.bridgeJSLowerParameter() + let bValue = b.bridgeJSLowerParameter() + bjs_check(aValue, bValue) + if let error = _swift_js_take_exception() { + throw error + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.json new file mode 100644 index 000000000..aae09ea49 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.json @@ -0,0 +1,138 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_checkInt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "checkInt", + "parameters" : [ + + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_checkUInt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "checkUInt", + "parameters" : [ + + ], + "returnType" : { + "uint" : { + + } + } + }, + { + "abiName" : "bjs_checkFloat", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "checkFloat", + "parameters" : [ + + ], + "returnType" : { + "float" : { + + } + } + }, + { + "abiName" : "bjs_checkDouble", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "checkDouble", + "parameters" : [ + + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_checkBool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "checkBool", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "checkNumber", + "parameters" : [ + + ], + "returnType" : { + "double" : { + + } + } + }, + { + "name" : "checkBoolean", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.swift similarity index 59% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.swift index 74ee7b1c3..3bbb2809b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.swift @@ -51,4 +51,38 @@ public func _bjs_checkBool() -> Int32 { #else fatalError("Only available on WebAssembly") #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_checkNumber") +fileprivate func bjs_checkNumber() -> Float64 +#else +fileprivate func bjs_checkNumber() -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$checkNumber() throws(JSException) -> Double { + let ret = bjs_checkNumber() + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_checkBoolean") +fileprivate func bjs_checkBoolean() -> Int32 +#else +fileprivate func bjs_checkBoolean() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$checkBoolean() throws(JSException) -> Bool { + let ret = bjs_checkBoolean() + if let error = _swift_js_take_exception() { + throw error + } + return Bool.bridgeJSLiftReturn(ret) } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.json new file mode 100644 index 000000000..1c71b2b8f --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.json @@ -0,0 +1,363 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_PropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "intValue", + "name" : "intValue", + "type" : { + "int" : { + + } + } + }, + { + "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" : { + + } + } + } + ] + }, + "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" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + }, + { + "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" : "PropertyHolder" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "lazyValue", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "computedReadonly", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "computedReadWrite", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "observedProperty", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "PropertyHolder" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_createPropertyHolder", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createPropertyHolder", + "parameters" : [ + { + "label" : "intValue", + "name" : "intValue", + "type" : { + "int" : { + + } + } + }, + { + "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" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json new file mode 100644 index 000000000..5713a2898 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json @@ -0,0 +1,901 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Helper_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_Helper_increment", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "increment", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "Helper", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "Helper" + }, + { + "constructor" : { + "abiName" : "bjs_MyViewController_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "delegate", + "name" : "delegate", + "type" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_MyViewController_triggerEvent", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "triggerEvent", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewController_updateValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "updateValue", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewController_updateCount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "updateCount", + "parameters" : [ + { + "label" : "_", + "name" : "count", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_MyViewController_updateLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "updateLabel", + "parameters" : [ + { + "label" : "_", + "name" : "prefix", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "suffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewController_checkEvenCount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "checkEvenCount", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_MyViewController_sendHelper", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "sendHelper", + "parameters" : [ + { + "label" : "_", + "name" : "helper", + "type" : { + "swiftHeapObject" : { + "_0" : "Helper" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "MyViewController", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "delegate", + "type" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "secondDelegate", + "type" : { + "optional" : { + "_0" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + } + } + } + ], + "swiftCallName" : "MyViewController" + }, + { + "constructor" : { + "abiName" : "bjs_DelegateManager_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "delegates", + "name" : "delegates", + "type" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_DelegateManager_notifyAll", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "notifyAll", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "DelegateManager", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "delegates", + "type" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + } + } + } + ], + "swiftCallName" : "DelegateManager" + } + ], + "enums" : [ + { + "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" : "test", + "rawValue" : "test" + }, + { + "associatedValues" : [ + + ], + "name" : "test2", + "rawValue" : "test2" + } + ], + "emitStyle" : "const", + "name" : "ExampleEnum", + "rawType" : "String", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "ExampleEnum", + "tsFullPath" : "ExampleEnum" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "int" : { + + } + } + } + ], + "name" : "failure" + } + ], + "emitStyle" : "const", + "name" : "Result", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Result", + "tsFullPath" : "Result" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "low", + "rawValue" : "-1" + }, + { + "associatedValues" : [ + + ], + "name" : "medium", + "rawValue" : "0" + }, + { + "associatedValues" : [ + + ], + "name" : "high", + "rawValue" : "1" + } + ], + "emitStyle" : "const", + "name" : "Priority", + "rawType" : "Int", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Priority", + "tsFullPath" : "Priority" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_processDelegates", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDelegates", + "parameters" : [ + { + "label" : "_", + "name" : "delegates", + "type" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "MyViewControllerDelegate" + } + } + } + } + } + ], + "protocols" : [ + { + "methods" : [ + { + "abiName" : "bjs_MyViewControllerDelegate_onSomethingHappened", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "onSomethingHappened", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_onValueChanged", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "onValueChanged", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_onCountUpdated", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "onCountUpdated", + "parameters" : [ + { + "label" : "count", + "name" : "count", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_onLabelUpdated", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "onLabelUpdated", + "parameters" : [ + { + "label" : "_", + "name" : "prefix", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "suffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_isCountEven", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "isCountEven", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_onHelperUpdated", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "onHelperUpdated", + "parameters" : [ + { + "label" : "_", + "name" : "helper", + "type" : { + "swiftHeapObject" : { + "_0" : "Helper" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_createHelper", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createHelper", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Helper" + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_onOptionalHelperUpdated", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "onOptionalHelperUpdated", + "parameters" : [ + { + "label" : "_", + "name" : "helper", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Helper" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_createOptionalHelper", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createOptionalHelper", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Helper" + } + } + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_createEnum", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createEnum", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "ExampleEnum", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_handleResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "handleResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "Result" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_MyViewControllerDelegate_getResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getResult", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "Result" + } + } + } + ], + "name" : "MyViewControllerDelegate", + "properties" : [ + { + "isReadonly" : false, + "name" : "eventCount", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "name" : "delegateName", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "name" : "optionalName", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "optionalRawEnum", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "ExampleEnum", + "_1" : "String" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "rawStringEnum", + "type" : { + "rawValueEnum" : { + "_0" : "ExampleEnum", + "_1" : "String" + } + } + }, + { + "isReadonly" : false, + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "Result" + } + } + }, + { + "isReadonly" : false, + "name" : "optionalResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "Result" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "direction", + "type" : { + "caseEnum" : { + "_0" : "Direction" + } + } + }, + { + "isReadonly" : false, + "name" : "directionOptional", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "priority", + "type" : { + "rawValueEnum" : { + "_0" : "Priority", + "_1" : "Int" + } + } + }, + { + "isReadonly" : false, + "name" : "priorityOptional", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Priority", + "_1" : "Int" + } + } + } + } + } + ] + } + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.json new file mode 100644 index 000000000..b0eac3313 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.json @@ -0,0 +1,339 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_MathUtils_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_MathUtils_static_subtract", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "subtract", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "int" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "className" : { + "_0" : "MathUtils" + } + } + }, + { + "abiName" : "bjs_MathUtils_static_add", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "add", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "int" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "className" : { + "_0" : "MathUtils" + } + } + }, + { + "abiName" : "bjs_MathUtils_multiply", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "multiply", + "parameters" : [ + { + "label" : "x", + "name" : "x", + "type" : { + "int" : { + + } + } + }, + { + "label" : "y", + "name" : "y", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + } + ], + "name" : "MathUtils", + "properties" : [ + + ], + "swiftCallName" : "MathUtils" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "scientific" + }, + { + "associatedValues" : [ + + ], + "name" : "basic" + } + ], + "emitStyle" : "const", + "name" : "Calculator", + "staticMethods" : [ + { + "abiName" : "bjs_Calculator_static_square", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "square", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "enumName" : { + "_0" : "Calculator" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Calculator", + "tsFullPath" : "Calculator" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "int" : { + + } + } + } + ], + "name" : "failure" + } + ], + "emitStyle" : "const", + "name" : "APIResult", + "staticMethods" : [ + { + "abiName" : "bjs_APIResult_static_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundtrip", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "staticContext" : { + "enumName" : { + "_0" : "APIResult" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "APIResult", + "tsFullPath" : "APIResult" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Utils", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utils", + "tsFullPath" : "Utils" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "String", + "namespace" : [ + "Utils" + ], + "staticMethods" : [ + { + "abiName" : "bjs_Utils_String_static_uppercase", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "uppercase", + "namespace" : [ + "Utils", + "String" + ], + "parameters" : [ + { + "label" : "_", + "name" : "text", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "Utils.String" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utils.String", + "tsFullPath" : "Utils.String" + } + ], + "exposeToGlobal" : true, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.json new file mode 100644 index 000000000..e4ec22855 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.json @@ -0,0 +1,339 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_MathUtils_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_MathUtils_static_subtract", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "subtract", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "int" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "className" : { + "_0" : "MathUtils" + } + } + }, + { + "abiName" : "bjs_MathUtils_static_add", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "add", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "int" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "className" : { + "_0" : "MathUtils" + } + } + }, + { + "abiName" : "bjs_MathUtils_multiply", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "multiply", + "parameters" : [ + { + "label" : "x", + "name" : "x", + "type" : { + "int" : { + + } + } + }, + { + "label" : "y", + "name" : "y", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + } + ], + "name" : "MathUtils", + "properties" : [ + + ], + "swiftCallName" : "MathUtils" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "scientific" + }, + { + "associatedValues" : [ + + ], + "name" : "basic" + } + ], + "emitStyle" : "const", + "name" : "Calculator", + "staticMethods" : [ + { + "abiName" : "bjs_Calculator_static_square", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "square", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "enumName" : { + "_0" : "Calculator" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Calculator", + "tsFullPath" : "Calculator" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "int" : { + + } + } + } + ], + "name" : "failure" + } + ], + "emitStyle" : "const", + "name" : "APIResult", + "staticMethods" : [ + { + "abiName" : "bjs_APIResult_static_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundtrip", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "staticContext" : { + "enumName" : { + "_0" : "APIResult" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "APIResult", + "tsFullPath" : "APIResult" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Utils", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utils", + "tsFullPath" : "Utils" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "String", + "namespace" : [ + "Utils" + ], + "staticMethods" : [ + { + "abiName" : "bjs_Utils_String_static_uppercase", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "uppercase", + "namespace" : [ + "Utils", + "String" + ], + "parameters" : [ + { + "label" : "_", + "name" : "text", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "Utils.String" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utils.String", + "tsFullPath" : "Utils.String" + } + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.json new file mode 100644 index 000000000..9b1d0d6b8 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.json @@ -0,0 +1,342 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_PropertyClass_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + + ], + "name" : "PropertyClass", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : true, + "name" : "staticConstant", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "staticVariable", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "jsObjectProperty", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "jsObject" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "classVariable", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "computedProperty", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "readOnlyComputed", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "optionalProperty", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "swiftCallName" : "PropertyClass" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "value1" + }, + { + "associatedValues" : [ + + ], + "name" : "value2" + } + ], + "emitStyle" : "const", + "name" : "PropertyEnum", + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "enumProperty", + "staticContext" : { + "enumName" : { + "_0" : "PropertyEnum" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "enumConstant", + "staticContext" : { + "enumName" : { + "_0" : "PropertyEnum" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "computedEnum", + "staticContext" : { + "enumName" : { + "_0" : "PropertyEnum" + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "PropertyEnum", + "tsFullPath" : "PropertyEnum" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "PropertyNamespace", + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "namespaceProperty", + "namespace" : [ + "PropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "PropertyNamespace" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "namespaceConstant", + "namespace" : [ + "PropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "PropertyNamespace" + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "PropertyNamespace", + "tsFullPath" : "PropertyNamespace" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Nested", + "namespace" : [ + "PropertyNamespace" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedProperty", + "namespace" : [ + "PropertyNamespace", + "Nested" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "PropertyNamespace.Nested" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "nestedConstant", + "namespace" : [ + "PropertyNamespace", + "Nested" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "PropertyNamespace.Nested" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedDouble", + "namespace" : [ + "PropertyNamespace", + "Nested" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "PropertyNamespace.Nested" + } + }, + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "PropertyNamespace.Nested", + "tsFullPath" : "PropertyNamespace.Nested" + } + ], + "exposeToGlobal" : true, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.json new file mode 100644 index 000000000..b3ccf7e93 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.json @@ -0,0 +1,342 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_PropertyClass_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + + ], + "name" : "PropertyClass", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : true, + "name" : "staticConstant", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "staticVariable", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "jsObjectProperty", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "jsObject" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "classVariable", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "computedProperty", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "readOnlyComputed", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "optionalProperty", + "staticContext" : { + "className" : { + "_0" : "PropertyClass" + } + }, + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "swiftCallName" : "PropertyClass" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "value1" + }, + { + "associatedValues" : [ + + ], + "name" : "value2" + } + ], + "emitStyle" : "const", + "name" : "PropertyEnum", + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "enumProperty", + "staticContext" : { + "enumName" : { + "_0" : "PropertyEnum" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "enumConstant", + "staticContext" : { + "enumName" : { + "_0" : "PropertyEnum" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "computedEnum", + "staticContext" : { + "enumName" : { + "_0" : "PropertyEnum" + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "PropertyEnum", + "tsFullPath" : "PropertyEnum" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "PropertyNamespace", + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "namespaceProperty", + "namespace" : [ + "PropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "PropertyNamespace" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "namespaceConstant", + "namespace" : [ + "PropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "PropertyNamespace" + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "PropertyNamespace", + "tsFullPath" : "PropertyNamespace" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Nested", + "namespace" : [ + "PropertyNamespace" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedProperty", + "namespace" : [ + "PropertyNamespace", + "Nested" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "PropertyNamespace.Nested" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "nestedConstant", + "namespace" : [ + "PropertyNamespace", + "Nested" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "PropertyNamespace.Nested" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedDouble", + "namespace" : [ + "PropertyNamespace", + "Nested" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "PropertyNamespace.Nested" + } + }, + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "PropertyNamespace.Nested", + "tsFullPath" : "PropertyNamespace.Nested" + } + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringParameter.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringParameter.json new file mode 100644 index 000000000..b0aa8c35b --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringParameter.json @@ -0,0 +1,125 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_checkString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "checkString", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_roundtripString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripString", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "checkString", + "parameters" : [ + { + "name" : "a", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "checkStringWithLength", + "parameters" : [ + { + "name" : "a", + "type" : { + "string" : { + + } + } + }, + { + "name" : "b", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringParameter.swift similarity index 54% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringParameter.swift index 694c44e06..e9e3c2d89 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringParameter.swift @@ -1,5 +1,26 @@ +@_expose(wasm, "bjs_checkString") +@_cdecl("bjs_checkString") +public func _bjs_checkString(_ aBytes: Int32, _ aLength: Int32) -> Void { + #if arch(wasm32) + checkString(a: String.bridgeJSLiftParameter(aBytes, aLength)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundtripString") +@_cdecl("bjs_roundtripString") +public func _bjs_roundtripString(_ aBytes: Int32, _ aLength: Int32) -> Void { + #if arch(wasm32) + let ret = roundtripString(a: String.bridgeJSLiftParameter(aBytes, aLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_checkString") +@_extern(wasm, module: "TestModule", name: "bjs_checkString") fileprivate func bjs_checkString(_ a: Int32) -> Void #else fileprivate func bjs_checkString(_ a: Int32) -> Void { @@ -16,7 +37,7 @@ func _$checkString(_ a: String) throws(JSException) -> Void { } #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_checkStringWithLength") +@_extern(wasm, module: "TestModule", name: "bjs_checkStringWithLength") fileprivate func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void #else fileprivate func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringReturn.json new file mode 100644 index 000000000..3f9271592 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringReturn.json @@ -0,0 +1,59 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_checkString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "checkString", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "checkString", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringReturn.swift similarity index 53% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringReturn.swift index bde90ea74..9de24ef73 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringReturn.swift @@ -1,5 +1,16 @@ +@_expose(wasm, "bjs_checkString") +@_cdecl("bjs_checkString") +public func _bjs_checkString() -> Void { + #if arch(wasm32) + let ret = checkString() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_checkString") +@_extern(wasm, module: "TestModule", name: "bjs_checkString") fileprivate func bjs_checkString() -> Int32 #else fileprivate func bjs_checkString() -> Int32 { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.json new file mode 100644 index 000000000..9fe717651 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.json @@ -0,0 +1,145 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Greeter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + "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" : { + + } + } + } + ], + "name" : "Greeter", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "Greeter" + }, + { + "explicitAccessControl" : "public", + "methods" : [ + + ], + "name" : "PublicGreeter", + "properties" : [ + + ], + "swiftCallName" : "PublicGreeter" + }, + { + "explicitAccessControl" : "package", + "methods" : [ + + ], + "name" : "PackageGreeter", + "properties" : [ + + ], + "swiftCallName" : "PackageGreeter" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_takeGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeGreeter", + "parameters" : [ + { + "label" : "greeter", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json new file mode 100644 index 000000000..345582e86 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json @@ -0,0 +1,1078 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Person_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + "explicitAccessControl" : "public", + "methods" : [ + + ], + "name" : "Person", + "properties" : [ + + ], + "swiftCallName" : "Person" + }, + { + "constructor" : { + "abiName" : "bjs_TestProcessor_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "transform", + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSS_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_TestProcessor_getTransform", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTransform", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSS_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_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" : "10TestModuleSS_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_printTogether", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "printTogether", + "parameters" : [ + { + "label" : "person", + "name" : "person", + "type" : { + "swiftHeapObject" : { + "_0" : "Person" + } + } + }, + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "label" : "ratio", + "name" : "ratio", + "type" : { + "double" : { + + } + } + }, + { + "label" : "customTransform", + "name" : "customTransform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq6PersonCSqSSSqSd_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Person" + } + } + } + }, + { + "optional" : { + "_0" : { + "string" : { + + } + } + } + }, + { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtrip", + "parameters" : [ + { + "label" : "_", + "name" : "personClosure", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule6PersonC_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "swiftHeapObject" : { + "_0" : "Person" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule6PersonC_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "swiftHeapObject" : { + "_0" : "Person" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_roundtripOptional", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptional", + "parameters" : [ + { + "label" : "_", + "name" : "personClosure", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq6PersonC_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Person" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq6PersonC_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Person" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_processDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDirection", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule9DirectionO_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "caseEnum" : { + "_0" : "Direction" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_processTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processTheme", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule5ThemeO_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_processHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule10HttpStatusO_Si", + "moduleName" : "TestModule", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_processAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule9APIResultO_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_makeDirectionChecker", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeDirectionChecker", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule9DirectionO_Sb", + "moduleName" : "TestModule", + "parameters" : [ + { + "caseEnum" : { + "_0" : "Direction" + } + } + ], + "returnType" : { + "bool" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_makeThemeValidator", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeThemeValidator", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule5ThemeO_Sb", + "moduleName" : "TestModule", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + ], + "returnType" : { + "bool" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_makeStatusCodeExtractor", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeStatusCodeExtractor", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule10HttpStatusO_Si", + "moduleName" : "TestModule", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_makeAPIResultHandler", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultHandler", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule9APIResultO_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TestProcessor_processOptionalDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalDirection", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq9DirectionO_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_processOptionalTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalTheme", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq5ThemeO_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_processOptionalAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq9APIResultO_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TestProcessor_makeOptionalDirectionFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalDirectionFormatter", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq9DirectionO_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "name" : "TestProcessor", + "properties" : [ + + ], + "swiftCallName" : "TestProcessor" + } + ], + "enums" : [ + { + "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" : "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" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "int" : { + + } + } + } + ], + "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" + } + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json new file mode 100644 index 000000000..12f76a912 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json @@ -0,0 +1,110 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "applyInt", + "parameters" : [ + { + "name" : "value", + "type" : { + "int" : { + + } + } + }, + { + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSi_Si", + "moduleName" : "TestModule", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "name" : "makeAdder", + "parameters" : [ + { + "name" : "base", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSi_Si", + "moduleName" : "TestModule", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftClosureImports.ImportMacros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.swift similarity index 62% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftClosureImports.ImportMacros.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.swift index 9e0959157..c833a54d1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftClosureImports.ImportMacros.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.swift @@ -1,22 +1,22 @@ #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_Check_5CheckSi_Si") -fileprivate func invoke_js_callback_Check_5CheckSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSi_Si") +fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_Check_5CheckSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private final class _BJS_ClosureBox_5CheckSi_Si: _BridgedSwiftClosureBox { +private final class _BJS_ClosureBox_10TestModuleSi_Si: _BridgedSwiftClosureBox { let closure: (Int) -> Int init(_ closure: @escaping (Int) -> Int) { self.closure = closure } } -private enum _BJS_Closure_5CheckSi_Si { +private enum _BJS_Closure_10TestModuleSi_Si { static func bridgeJSLower(_ closure: @escaping (Int) -> Int) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_5CheckSi_Si(closure) + let box = _BJS_ClosureBox_10TestModuleSi_Si(closure) return Unmanaged.passRetained(box).toOpaque() } static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Int { @@ -25,7 +25,7 @@ private enum _BJS_Closure_5CheckSi_Si { #if arch(wasm32) let callbackValue = callback.bridgeJSLowerParameter() let param0Value = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_Check_5CheckSi_Si(callbackValue, param0Value) + let ret = invoke_js_callback_TestModule_10TestModuleSi_Si(callbackValue, param0Value) return Int.bridgeJSLiftReturn(ret) #else fatalError("Only available on WebAssembly") @@ -34,11 +34,11 @@ private enum _BJS_Closure_5CheckSi_Si { } } -@_expose(wasm, "invoke_swift_closure_Check_5CheckSi_Si") -@_cdecl("invoke_swift_closure_Check_5CheckSi_Si") -public func _invoke_swift_closure_Check_5CheckSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSi_Si") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSi_Si") +public func _invoke_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_5CheckSi_Si>.fromOpaque(boxPtr).takeUnretainedValue() + let box = Unmanaged<_BJS_ClosureBox_10TestModuleSi_Si>.fromOpaque(boxPtr).takeUnretainedValue() let result = box.closure(Int.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else @@ -47,7 +47,7 @@ public func _invoke_swift_closure_Check_5CheckSi_Si(_ boxPtr: UnsafeMutableRawPo } #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_applyInt") +@_extern(wasm, module: "TestModule", name: "bjs_applyInt") fileprivate func bjs_applyInt(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 #else fileprivate func bjs_applyInt(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 { @@ -57,7 +57,7 @@ fileprivate func bjs_applyInt(_ value: Int32, _ transform: UnsafeMutableRawPoint func _$applyInt(_ value: Int, _ transform: @escaping (Int) -> Int) throws(JSException) -> Int { let valueValue = value.bridgeJSLowerParameter() - let transformPointer = _BJS_Closure_5CheckSi_Si.bridgeJSLower(transform) + let transformPointer = _BJS_Closure_10TestModuleSi_Si.bridgeJSLower(transform) let ret = bjs_applyInt(valueValue, transformPointer) if let error = _swift_js_take_exception() { throw error @@ -66,7 +66,7 @@ func _$applyInt(_ value: Int, _ transform: @escaping (Int) -> Int) throws(JSExce } #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_makeAdder") +@_extern(wasm, module: "TestModule", name: "bjs_makeAdder") fileprivate func bjs_makeAdder(_ base: Int32) -> Int32 #else fileprivate func bjs_makeAdder(_ base: Int32) -> Int32 { @@ -80,5 +80,5 @@ func _$makeAdder(_ base: Int) throws(JSException) -> (Int) -> Int { if let error = _swift_js_take_exception() { throw error } - return _BJS_Closure_5CheckSi_Si.bridgeJSLift(ret) + return _BJS_Closure_10TestModuleSi_Si.bridgeJSLift(ret) } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json new file mode 100644 index 000000000..fa5f333f0 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json @@ -0,0 +1,523 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Greeter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_Greeter_greet", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Greeter", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "Greeter" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "rough", + "rawValue" : "0.1" + }, + { + "associatedValues" : [ + + ], + "name" : "fine", + "rawValue" : "0.001" + } + ], + "emitStyle" : "const", + "name" : "Precision", + "rawType" : "Float", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Precision", + "tsFullPath" : "Precision" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtrip", + "parameters" : [ + { + "label" : "_", + "name" : "session", + "type" : { + "swiftStruct" : { + "_0" : "Person" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Person" + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + { + "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" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "label" : "optFlag", + "name" : "optFlag", + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ] + }, + "methods" : [ + + ], + "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" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optFlag", + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "swiftCallName" : "DataPoint" + }, + { + "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" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "swiftCallName" : "Address" + }, + { + "methods" : [ + + ], + "name" : "Person", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "age", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "address", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "email", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "swiftCallName" : "Person" + }, + { + "methods" : [ + + ], + "name" : "Session", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "owner", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "swiftCallName" : "Session" + }, + { + "methods" : [ + + ], + "name" : "Measurement", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "value", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "precision", + "type" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optionalPrecision", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + } + } + } + } + ], + "swiftCallName" : "Measurement" + }, + { + "methods" : [ + { + "abiName" : "bjs_ConfigStruct_static_update", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "update", + "parameters" : [ + { + "label" : "_", + "name" : "timeout", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + }, + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + } + } + ], + "name" : "ConfigStruct", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : true, + "name" : "maxRetries", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "defaultConfig", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "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" + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.json new file mode 100644 index 000000000..50af441a9 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.json @@ -0,0 +1,94 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + { + "methods" : [ + + ], + "name" : "Point", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "x", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "y", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "Point" + } + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "translate", + "parameters" : [ + { + "name" : "point", + "type" : { + "swiftStruct" : { + "_0" : "Point" + } + } + }, + { + "name" : "dx", + "type" : { + "int" : { + + } + } + }, + { + "name" : "dy", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift new file mode 100644 index 000000000..187f3369a --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift @@ -0,0 +1,64 @@ +extension Point: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { + let y = Int.bridgeJSLiftParameter() + let x = Int.bridgeJSLiftParameter() + return Point(x: x, y: y) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + self.x.bridgeJSLowerStackReturn() + self.y.bridgeJSLowerStackReturn() + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + 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(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Point") +fileprivate func _bjs_struct_lift_Point() -> Int32 +#else +fileprivate func _bjs_struct_lift_Point() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_translate") +fileprivate func bjs_translate(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 +#else +fileprivate func bjs_translate(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$translate(_ point: Point, _ dx: Int, _ dy: Int) throws(JSException) -> Point { + let pointObjectId = point.bridgeJSLowerParameter() + let dxValue = dx.bridgeJSLowerParameter() + let dyValue = dy.bridgeJSLowerParameter() + let ret = bjs_translate(pointObjectId, dxValue, dyValue) + if let error = _swift_js_take_exception() { + throw error + } + return Point.bridgeJSLiftReturn(ret) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Throws.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Throws.json new file mode 100644 index 000000000..02796479f --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Throws.json @@ -0,0 +1,37 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_throwsSomething", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsSomething", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Throws.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Throws.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.json new file mode 100644 index 000000000..1eb9e47ec --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.json @@ -0,0 +1,416 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_takeUnsafeRawPointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeUnsafeRawPointer", + "parameters" : [ + { + "label" : "_", + "name" : "p", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_takeUnsafeMutableRawPointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeUnsafeMutableRawPointer", + "parameters" : [ + { + "label" : "_", + "name" : "p", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_takeOpaquePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeOpaquePointer", + "parameters" : [ + { + "label" : "_", + "name" : "p", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_takeUnsafePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeUnsafePointer", + "parameters" : [ + { + "label" : "_", + "name" : "p", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_takeUnsafeMutablePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeUnsafeMutablePointer", + "parameters" : [ + { + "label" : "_", + "name" : "p", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_returnUnsafeRawPointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "returnUnsafeRawPointer", + "parameters" : [ + + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + }, + { + "abiName" : "bjs_returnUnsafeMutableRawPointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "returnUnsafeMutableRawPointer", + "parameters" : [ + + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + }, + { + "abiName" : "bjs_returnOpaquePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "returnOpaquePointer", + "parameters" : [ + + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + }, + { + "abiName" : "bjs_returnUnsafePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "returnUnsafePointer", + "parameters" : [ + + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } + } + } + }, + { + "abiName" : "bjs_returnUnsafeMutablePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "returnUnsafeMutablePointer", + "parameters" : [ + + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } + } + } + }, + { + "abiName" : "bjs_roundTripPointerFields", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripPointerFields", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "PointerFields" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "PointerFields" + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + { + "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" + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/VoidParameterVoidReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/VoidParameterVoidReturn.json new file mode 100644 index 000000000..14da32841 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/VoidParameterVoidReturn.json @@ -0,0 +1,59 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_check", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "check", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "check", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/VoidParameterVoidReturn.swift similarity index 54% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/VoidParameterVoidReturn.swift index 2a2622ce0..3fa9619f8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/VoidParameterVoidReturn.swift @@ -1,5 +1,15 @@ +@_expose(wasm, "bjs_check") +@_cdecl("bjs_check") +public func _bjs_check() -> Void { + #if arch(wasm32) + check() + #else + fatalError("Only available on WebAssembly") + #endif +} + #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_check") +@_extern(wasm, module: "TestModule", name: "bjs_check") fileprivate func bjs_check() -> Void #else fileprivate func bjs_check() -> Void { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.d.ts deleted file mode 100644 index 2a6771ca7..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -// 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 type Exports = { -} -export type Imports = { - checkArray(a: any): void; - checkArrayWithLength(a: any, b: number): void; - checkArray(a: any): void; -} -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/ArrayParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js deleted file mode 100644 index 8add18b9f..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayParameter.Import.js +++ /dev/null @@ -1,245 +0,0 @@ -// 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; - 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 tmpRetTag; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; - let tmpStructCleanups = []; - const enumHelpers = {}; - const structHelpers = {}; - - let _exports = null; - let bjs = null; - - return { - /** - * @param {WebAssembly.Imports} importObject - */ - addImports: (importObject, importsContext) => { - bjs = {}; - importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); - bjs["swift_js_return_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { - const source = swift.memory.getObject(sourceId); - const bytes = new Uint8Array(memory.buffer, bytesPtr); - bytes.set(source); - } - bjs["swift_js_make_js_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - return swift.memory.retain(textDecoder.decode(bytes)); - } - 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_tag"] = function(tag) { - tmpRetTag = tag; - } - bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); - } - bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); - } - bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); - } - bjs["swift_js_push_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); - } - bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); - } - bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); - } - bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); - } - bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); - } - bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); - } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.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 { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - } - 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; - } - const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; - TestModule["bjs_checkArray"] = function bjs_checkArray(a) { - try { - imports.checkArray(swift.memory.getObject(a)); - } catch (error) { - setException(error); - } - } - TestModule["bjs_checkArrayWithLength"] = function bjs_checkArrayWithLength(a, b) { - try { - imports.checkArrayWithLength(swift.memory.getObject(a), b); - } catch (error) { - setException(error); - } - } - TestModule["bjs_checkArray"] = function bjs_checkArray(a) { - try { - imports.checkArray(swift.memory.getObject(a)); - } catch (error) { - setException(error); - } - } - }, - setInstance: (i) => { - instance = i; - memory = instance.exports.memory; - - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; - const exports = { - }; - _exports = exports; - return exports; - }, - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts similarity index 96% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts index 988626f3e..1bb9ff18c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts @@ -66,6 +66,9 @@ export type Exports = { Status: StatusObject } export type Imports = { + checkArray(a: any): void; + checkArrayWithLength(a: any, b: number): void; + checkArray(a: any): void; } export function createInstantiator(options: { imports: Imports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js similarity index 97% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 7388f4150..3cb11c794 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -69,6 +69,7 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); @@ -247,6 +248,28 @@ export async function createInstantiator(options, swift) { const obj = Item.__construct(pointer); return swift.memory.retain(obj); }; + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_checkArray"] = function bjs_checkArray(a) { + try { + imports.checkArray(swift.memory.getObject(a)); + } catch (error) { + setException(error); + } + } + TestModule["bjs_checkArrayWithLength"] = function bjs_checkArrayWithLength(a, b) { + try { + imports.checkArrayWithLength(swift.memory.getObject(a), b); + } catch (error) { + setException(error); + } + } + TestModule["bjs_checkArray"] = function bjs_checkArray(a) { + try { + imports.checkArray(swift.memory.getObject(a)); + } catch (error) { + setException(error); + } + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.d.ts deleted file mode 100644 index dea0bd186..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -// 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 type Exports = { -} -export type Imports = { - asyncReturnVoid(): JSPromise; - asyncRoundTripInt(v: number): JSPromise; - asyncRoundTripString(v: string): JSPromise; - asyncRoundTripBool(v: boolean): JSPromise; - asyncRoundTripFloat(v: number): JSPromise; - asyncRoundTripDouble(v: number): JSPromise; - asyncRoundTripJSObject(v: any): JSPromise; -} -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/Async.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js deleted file mode 100644 index 981cecbe5..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Import.js +++ /dev/null @@ -1,289 +0,0 @@ -// 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; - 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 tmpRetTag; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; - let tmpStructCleanups = []; - const enumHelpers = {}; - const structHelpers = {}; - - let _exports = null; - let bjs = null; - - return { - /** - * @param {WebAssembly.Imports} importObject - */ - addImports: (importObject, importsContext) => { - bjs = {}; - importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); - bjs["swift_js_return_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { - const source = swift.memory.getObject(sourceId); - const bytes = new Uint8Array(memory.buffer, bytesPtr); - bytes.set(source); - } - bjs["swift_js_make_js_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - return swift.memory.retain(textDecoder.decode(bytes)); - } - 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_tag"] = function(tag) { - tmpRetTag = tag; - } - bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); - } - bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); - } - bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); - } - bjs["swift_js_push_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); - } - bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); - } - bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); - } - bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); - } - bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); - } - bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); - } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.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 { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - } - 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; - } - const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; - TestModule["bjs_asyncReturnVoid"] = function bjs_asyncReturnVoid() { - try { - let ret = imports.asyncReturnVoid(); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_asyncRoundTripInt"] = function bjs_asyncRoundTripInt(v) { - try { - let ret = imports.asyncRoundTripInt(v); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_asyncRoundTripString"] = function bjs_asyncRoundTripString(v) { - try { - const vObject = swift.memory.getObject(v); - swift.memory.release(v); - let ret = imports.asyncRoundTripString(vObject); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_asyncRoundTripBool"] = function bjs_asyncRoundTripBool(v) { - try { - let ret = imports.asyncRoundTripBool(v !== 0); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_asyncRoundTripFloat"] = function bjs_asyncRoundTripFloat(v) { - try { - let ret = imports.asyncRoundTripFloat(v); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_asyncRoundTripDouble"] = function bjs_asyncRoundTripDouble(v) { - try { - let ret = imports.asyncRoundTripDouble(v); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_asyncRoundTripJSObject"] = function bjs_asyncRoundTripJSObject(v) { - try { - let ret = imports.asyncRoundTripJSObject(swift.memory.getObject(v)); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - }, - setInstance: (i) => { - instance = i; - memory = instance.exports.memory; - - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; - const exports = { - }; - _exports = exports; - return exports; - }, - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts similarity index 98% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts index d321b99fb..170d7f07d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts @@ -161,6 +161,8 @@ export type Exports = { Ratio: RatioObject } export type Imports = { + takesFeatureFlag(flag: FeatureFlagTag): void; + returnsFeatureFlag(): FeatureFlagTag; } export function createInstantiator(options: { imports: Imports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js similarity index 91% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index c1865adfc..1e137e6eb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -117,6 +117,7 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); @@ -276,6 +277,25 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_takesFeatureFlag"] = function bjs_takesFeatureFlag(flag) { + try { + const flagObject = swift.memory.getObject(flag); + swift.memory.release(flag); + imports.takesFeatureFlag(flagObject); + } catch (error) { + setException(error); + } + } + TestModule["bjs_returnsFeatureFlag"] = function bjs_returnsFeatureFlag() { + try { + let ret = imports.returnsFeatureFlag(); + tmpRetBytes = textEncoder.encode(ret); + return tmpRetBytes.length; + } catch (error) { + setException(error); + } + } }, setInstance: (i) => { instance = i; @@ -344,17 +364,30 @@ export async function createInstantiator(options, swift) { return optResult; }, setFeatureFlag: function bjs_setFeatureFlag(flag) { - instance.exports.bjs_setFeatureFlag(flag); + const flagBytes = textEncoder.encode(flag); + const flagId = swift.memory.retain(flagBytes); + instance.exports.bjs_setFeatureFlag(flagId, flagBytes.length); + swift.memory.release(flagId); }, getFeatureFlag: function bjs_getFeatureFlag() { - const ret = instance.exports.bjs_getFeatureFlag(); - return ret !== 0; + instance.exports.bjs_getFeatureFlag(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; }, roundTripOptionalFeatureFlag: function bjs_roundTripOptionalFeatureFlag(input) { const isSome = input != null; - instance.exports.bjs_roundTripOptionalFeatureFlag(+isSome, isSome ? input : 0); - const optResult = tmpRetOptionalBool; - tmpRetOptionalBool = undefined; + let inputId, inputBytes; + if (isSome) { + inputBytes = textEncoder.encode(input); + inputId = swift.memory.retain(inputBytes); + } + instance.exports.bjs_roundTripOptionalFeatureFlag(+isSome, isSome ? inputId : 0, isSome ? inputBytes.length : 0); + const optResult = tmpRetString; + tmpRetString = undefined; + if (inputId != undefined) { + swift.memory.release(inputId); + } return optResult; }, setHttpStatus: function bjs_setHttpStatus(status) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.ImportMacros.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.ImportMacros.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.d.ts deleted file mode 100644 index ccd371b71..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -// 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 interface Animatable { - animate(keyframes: any, options: any): any; - getAnimations(options: any): any; -} -export type Exports = { -} -export type Imports = { - returnAnimatable(): Animatable; -} -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/Interface.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js deleted file mode 100644 index 1d25a2954..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Interface.Import.js +++ /dev/null @@ -1,251 +0,0 @@ -// 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; - 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 tmpRetTag; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; - let tmpStructCleanups = []; - const enumHelpers = {}; - const structHelpers = {}; - - let _exports = null; - let bjs = null; - - return { - /** - * @param {WebAssembly.Imports} importObject - */ - addImports: (importObject, importsContext) => { - bjs = {}; - importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); - bjs["swift_js_return_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { - const source = swift.memory.getObject(sourceId); - const bytes = new Uint8Array(memory.buffer, bytesPtr); - bytes.set(source); - } - bjs["swift_js_make_js_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - return swift.memory.retain(textDecoder.decode(bytes)); - } - 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_tag"] = function(tag) { - tmpRetTag = tag; - } - bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); - } - bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); - } - bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); - } - bjs["swift_js_push_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); - } - bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); - } - bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); - } - bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); - } - bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); - } - bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); - } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.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 { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - } - 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; - } - const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; - TestModule["bjs_returnAnimatable"] = function bjs_returnAnimatable() { - try { - let ret = imports.returnAnimatable(); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_Animatable_animate"] = function bjs_Animatable_animate(self, keyframes, options) { - try { - let ret = swift.memory.getObject(self).animate(swift.memory.getObject(keyframes), swift.memory.getObject(options)); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_Animatable_getAnimations"] = function bjs_Animatable_getAnimations(self, options) { - try { - let ret = swift.memory.getObject(self).getAnimations(swift.memory.getObject(options)); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - }, - setInstance: (i) => { - instance = i; - memory = instance.exports.memory; - - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; - const exports = { - }; - _exports = exports; - return exports; - }, - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.d.ts similarity index 85% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.d.ts index 2efd24317..ac0e05a91 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.d.ts @@ -4,10 +4,6 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -export interface ArrayBufferLike { - slice(begin: number, end: number): ArrayBufferLike; - readonly byteLength: number; -} export interface WeirdNaming { as(): void; try(): void; @@ -26,7 +22,6 @@ export interface _Weird { export type Exports = { } export type Imports = { - createArrayBuffer(): ArrayBufferLike; createWeirdObject(): WeirdNaming; createWeirdClass(): _Weird; _Weird: { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js similarity index 93% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js index 833436226..ab030062a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js @@ -203,15 +203,6 @@ export async function createInstantiator(options, swift) { return pointer || 0; } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; - TestModule["bjs_createArrayBuffer"] = function bjs_createArrayBuffer() { - try { - let ret = imports.createArrayBuffer(); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } TestModule["bjs_createWeirdObject"] = function bjs_createWeirdObject() { try { let ret = imports.createWeirdObject(); @@ -230,24 +221,6 @@ export async function createInstantiator(options, swift) { return 0 } } - TestModule["bjs_ArrayBufferLike_byteLength_get"] = function bjs_ArrayBufferLike_byteLength_get(self) { - try { - let ret = swift.memory.getObject(self).byteLength; - return ret; - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_ArrayBufferLike_slice"] = function bjs_ArrayBufferLike_slice(self, begin, end) { - try { - let ret = swift.memory.getObject(self).slice(begin, end); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } TestModule["bjs_WeirdNaming_normalProperty_get"] = function bjs_WeirdNaming_normalProperty_get(self) { try { let ret = swift.memory.getObject(self).normalProperty; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.d.ts similarity index 81% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.d.ts index 24d3d8fac..aaf227cf7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.d.ts @@ -10,9 +10,14 @@ export interface Greeter { name: string; readonly age: number; } +export interface Animatable { + animate(keyframes: any, options: any): any; + getAnimations(options: any): any; +} export type Exports = { } export type Imports = { + returnAnimatable(): Animatable; Greeter: { new(name: string): Greeter; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js similarity index 89% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js index d83919051..5b7541b1c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js @@ -203,6 +203,15 @@ export async function createInstantiator(options, swift) { return pointer || 0; } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_returnAnimatable"] = function bjs_returnAnimatable() { + try { + let ret = imports.returnAnimatable(); + return swift.memory.retain(ret); + } catch (error) { + setException(error); + return 0 + } + } TestModule["bjs_Greeter_init"] = function bjs_Greeter_init(name) { try { const nameObject = swift.memory.getObject(name); @@ -258,6 +267,24 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_Animatable_animate"] = function bjs_Animatable_animate(self, keyframes, options) { + try { + let ret = swift.memory.getObject(self).animate(swift.memory.getObject(keyframes), swift.memory.getObject(options)); + return swift.memory.retain(ret); + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_Animatable_getAnimations"] = function bjs_Animatable_getAnimations(self, options) { + try { + let ret = swift.memory.getObject(self).getAnimations(swift.memory.getObject(options)); + return swift.memory.retain(ret); + } catch (error) { + setException(error); + return 0 + } + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.d.ts deleted file mode 100644 index 83fe3c141..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -// 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 interface DatabaseConnection { - connect(url: string): void; - execute(query: string): any; - readonly isConnected: boolean; - connectionTimeout: number; -} -export interface Logger { - log(message: string): void; - error(message: string, error: any): void; - readonly level: string; -} -export interface ConfigManager { - get(key: string): any; - set(key: string, value: any): void; - readonly configPath: string; -} -export type Exports = { -} -export type Imports = { - createDatabaseConnection(config: any): DatabaseConnection; - createLogger(level: string): Logger; - getConfigManager(): ConfigManager; -} -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/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js deleted file mode 100644 index f8cfd7366..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ /dev/null @@ -1,354 +0,0 @@ -// 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; - 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 tmpRetTag; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; - let tmpStructCleanups = []; - const enumHelpers = {}; - const structHelpers = {}; - - let _exports = null; - let bjs = null; - - return { - /** - * @param {WebAssembly.Imports} importObject - */ - addImports: (importObject, importsContext) => { - bjs = {}; - importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); - bjs["swift_js_return_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { - const source = swift.memory.getObject(sourceId); - const bytes = new Uint8Array(memory.buffer, bytesPtr); - bytes.set(source); - } - bjs["swift_js_make_js_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - return swift.memory.retain(textDecoder.decode(bytes)); - } - 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_tag"] = function(tag) { - tmpRetTag = tag; - } - bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); - } - bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); - } - bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); - } - bjs["swift_js_push_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); - } - bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); - } - bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); - } - bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); - } - bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); - } - bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); - } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.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 { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - } - 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; - } - const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; - TestModule["bjs_createDatabaseConnection"] = function bjs_createDatabaseConnection(config) { - try { - let ret = imports.createDatabaseConnection(swift.memory.getObject(config)); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_createLogger"] = function bjs_createLogger(level) { - try { - const levelObject = swift.memory.getObject(level); - swift.memory.release(level); - let ret = imports.createLogger(levelObject); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_getConfigManager"] = function bjs_getConfigManager() { - try { - let ret = imports.getConfigManager(); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_DatabaseConnection_isConnected_get"] = function bjs_DatabaseConnection_isConnected_get(self) { - try { - let ret = swift.memory.getObject(self).isConnected; - return ret ? 1 : 0; - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_DatabaseConnection_connectionTimeout_get"] = function bjs_DatabaseConnection_connectionTimeout_get(self) { - try { - let ret = swift.memory.getObject(self).connectionTimeout; - return ret; - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_DatabaseConnection_connectionTimeout_set"] = function bjs_DatabaseConnection_connectionTimeout_set(self, newValue) { - try { - swift.memory.getObject(self).connectionTimeout = newValue; - } catch (error) { - setException(error); - } - } - TestModule["bjs_DatabaseConnection_connect"] = function bjs_DatabaseConnection_connect(self, url) { - try { - const urlObject = swift.memory.getObject(url); - swift.memory.release(url); - swift.memory.getObject(self).connect(urlObject); - } catch (error) { - setException(error); - } - } - TestModule["bjs_DatabaseConnection_execute"] = function bjs_DatabaseConnection_execute(self, query) { - try { - const queryObject = swift.memory.getObject(query); - swift.memory.release(query); - let ret = swift.memory.getObject(self).execute(queryObject); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_Logger_level_get"] = function bjs_Logger_level_get(self) { - try { - let ret = swift.memory.getObject(self).level; - tmpRetBytes = textEncoder.encode(ret); - return tmpRetBytes.length; - } catch (error) { - setException(error); - } - } - TestModule["bjs_Logger_log"] = function bjs_Logger_log(self, message) { - try { - const messageObject = swift.memory.getObject(message); - swift.memory.release(message); - swift.memory.getObject(self).log(messageObject); - } catch (error) { - setException(error); - } - } - TestModule["bjs_Logger_error"] = function bjs_Logger_error(self, message, error) { - try { - const messageObject = swift.memory.getObject(message); - swift.memory.release(message); - swift.memory.getObject(self).error(messageObject, swift.memory.getObject(error)); - } catch (error) { - setException(error); - } - } - TestModule["bjs_ConfigManager_configPath_get"] = function bjs_ConfigManager_configPath_get(self) { - try { - let ret = swift.memory.getObject(self).configPath; - tmpRetBytes = textEncoder.encode(ret); - return tmpRetBytes.length; - } catch (error) { - setException(error); - } - } - TestModule["bjs_ConfigManager_get"] = function bjs_ConfigManager_get(self, key) { - try { - const keyObject = swift.memory.getObject(key); - swift.memory.release(key); - let ret = swift.memory.getObject(self).get(keyObject); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_ConfigManager_set"] = function bjs_ConfigManager_set(self, key, value) { - try { - const keyObject = swift.memory.getObject(key); - swift.memory.release(key); - swift.memory.getObject(self).set(keyObject, swift.memory.getObject(value)); - } catch (error) { - setException(error); - } - } - }, - setInstance: (i) => { - instance = i; - memory = instance.exports.memory; - - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; - const exports = { - }; - _exports = exports; - return exports; - }, - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js deleted file mode 100644 index 0a92510f7..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.js +++ /dev/null @@ -1,225 +0,0 @@ -// 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; - 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 tmpRetTag; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; - let tmpStructCleanups = []; - 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) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { - const source = swift.memory.getObject(sourceId); - const bytes = new Uint8Array(memory.buffer, bytesPtr); - bytes.set(source); - } - bjs["swift_js_make_js_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - return swift.memory.retain(textDecoder.decode(bytes)); - } - 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_tag"] = function(tag) { - tmpRetTag = tag; - } - bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); - } - bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); - } - bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); - } - bjs["swift_js_push_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); - } - bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); - } - bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); - } - bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); - } - bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); - } - bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); - } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.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 { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - } - 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; - } - }, - setInstance: (i) => { - instance = i; - memory = instance.exports.memory; - - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; - const exports = { - check: function bjs_check(a, b, c, d, e) { - instance.exports.bjs_check(a, b, c, d, e); - }, - }; - _exports = exports; - return exports; - }, - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.d.ts deleted file mode 100644 index 5442ebfa2..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// 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 type Exports = { -} -export type Imports = { - check(a: number, b: boolean): void; -} -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/PrimitiveParameters.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.d.ts similarity index 93% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.d.ts index 9bf0e1e35..961f97635 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.d.ts @@ -8,6 +8,7 @@ export type Exports = { check(a: number, b: number, c: number, d: number, e: boolean): void; } export type Imports = { + check(a: number, b: boolean): void; } export function createInstantiator(options: { imports: Imports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js similarity index 98% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js index fe6c3ae04..97e03063a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js @@ -223,6 +223,9 @@ export async function createInstantiator(options, swift) { createExports: (instance) => { const js = swift.memory.heap; const exports = { + check: function bjs_check(a, b, c, d, e) { + instance.exports.bjs_check(a, b, c, d, e); + }, }; _exports = exports; return exports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.d.ts deleted file mode 100644 index ad63bd7d0..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -// 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 type Exports = { -} -export type Imports = { - checkNumber(): number; - checkBoolean(): boolean; -} -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/PrimitiveReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js deleted file mode 100644 index e3263af05..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Import.js +++ /dev/null @@ -1,242 +0,0 @@ -// 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; - 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 tmpRetTag; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; - let tmpStructCleanups = []; - const enumHelpers = {}; - const structHelpers = {}; - - let _exports = null; - let bjs = null; - - return { - /** - * @param {WebAssembly.Imports} importObject - */ - addImports: (importObject, importsContext) => { - bjs = {}; - importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); - bjs["swift_js_return_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { - const source = swift.memory.getObject(sourceId); - const bytes = new Uint8Array(memory.buffer, bytesPtr); - bytes.set(source); - } - bjs["swift_js_make_js_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - return swift.memory.retain(textDecoder.decode(bytes)); - } - 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_tag"] = function(tag) { - tmpRetTag = tag; - } - bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); - } - bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); - } - bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); - } - bjs["swift_js_push_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); - } - bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); - } - bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); - } - bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); - } - bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); - } - bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); - } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.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 { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - } - 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; - } - const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; - TestModule["bjs_checkNumber"] = function bjs_checkNumber() { - try { - let ret = imports.checkNumber(); - return ret; - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_checkBoolean"] = function bjs_checkBoolean() { - try { - let ret = imports.checkBoolean(); - return ret ? 1 : 0; - } catch (error) { - setException(error); - return 0 - } - } - }, - setInstance: (i) => { - instance = i; - memory = instance.exports.memory; - - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; - const exports = { - }; - _exports = exports; - return exports; - }, - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.d.ts similarity index 91% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.d.ts index c726e1f5a..77e269d16 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.d.ts @@ -12,6 +12,8 @@ export type Exports = { checkBool(): boolean; } export type Imports = { + checkNumber(): number; + checkBoolean(): boolean; } export function createInstantiator(options: { imports: Imports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js similarity index 92% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js index 836a82f21..871310bb8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.Export.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js @@ -42,6 +42,7 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); @@ -201,6 +202,25 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_checkNumber"] = function bjs_checkNumber() { + try { + let ret = imports.checkNumber(); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_checkBoolean"] = function bjs_checkBoolean() { + try { + let ret = imports.checkBoolean(); + return ret ? 1 : 0; + } catch (error) { + setException(error); + return 0 + } + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.d.ts deleted file mode 100644 index db6d2be05..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -// 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 interface JsGreeter { - greet(): string; -} -export type Exports = { -} -export type Imports = { - jsRoundTripNumber(v: number): number; - JsGreeter: { - new(name: string): JsGreeter; - } -} -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/ReExportFrom.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js deleted file mode 100644 index 94e22ffc4..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ReExportFrom.Import.js +++ /dev/null @@ -1,252 +0,0 @@ -// 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; - 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 tmpRetTag; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; - let tmpStructCleanups = []; - const enumHelpers = {}; - const structHelpers = {}; - - let _exports = null; - let bjs = null; - - return { - /** - * @param {WebAssembly.Imports} importObject - */ - addImports: (importObject, importsContext) => { - bjs = {}; - importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); - bjs["swift_js_return_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { - const source = swift.memory.getObject(sourceId); - const bytes = new Uint8Array(memory.buffer, bytesPtr); - bytes.set(source); - } - bjs["swift_js_make_js_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - return swift.memory.retain(textDecoder.decode(bytes)); - } - 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_tag"] = function(tag) { - tmpRetTag = tag; - } - bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); - } - bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); - } - bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); - } - bjs["swift_js_push_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); - } - bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); - } - bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); - } - bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); - } - bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); - } - bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); - } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.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 { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - } - 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; - } - const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; - TestModule["bjs_jsRoundTripNumber"] = function bjs_jsRoundTripNumber(v) { - try { - let ret = imports.jsRoundTripNumber(v); - return ret; - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_JsGreeter_init"] = function bjs_JsGreeter_init(name) { - try { - const nameObject = swift.memory.getObject(name); - swift.memory.release(name); - return swift.memory.retain(new imports.JsGreeter(nameObject)); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_JsGreeter_greet"] = function bjs_JsGreeter_greet(self) { - try { - let ret = swift.memory.getObject(self).greet(); - tmpRetBytes = textEncoder.encode(ret); - return tmpRetBytes.length; - } catch (error) { - setException(error); - } - } - }, - setInstance: (i) => { - instance = i; - memory = instance.exports.memory; - - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; - const exports = { - }; - _exports = exports; - return exports; - }, - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.d.ts deleted file mode 100644 index bb9f163cc..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -// 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 type Exports = { -} -export type Imports = { - takesFeatureFlag(flag: FeatureFlagTag): void; - returnsFeatureFlag(): FeatureFlagTag; -} -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/StringEnum.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js deleted file mode 100644 index 373b433b6..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringEnum.Import.js +++ /dev/null @@ -1,242 +0,0 @@ -// 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; - 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 tmpRetTag; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; - let tmpStructCleanups = []; - const enumHelpers = {}; - const structHelpers = {}; - - let _exports = null; - let bjs = null; - - return { - /** - * @param {WebAssembly.Imports} importObject - */ - addImports: (importObject, importsContext) => { - bjs = {}; - importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); - bjs["swift_js_return_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { - const source = swift.memory.getObject(sourceId); - const bytes = new Uint8Array(memory.buffer, bytesPtr); - bytes.set(source); - } - bjs["swift_js_make_js_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - return swift.memory.retain(textDecoder.decode(bytes)); - } - 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_tag"] = function(tag) { - tmpRetTag = tag; - } - bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); - } - bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); - } - bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); - } - bjs["swift_js_push_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); - } - bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); - } - bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); - } - bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); - } - bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); - } - bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); - } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.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 { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - } - 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; - } - const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; - TestModule["bjs_takesFeatureFlag"] = function bjs_takesFeatureFlag(flag) { - try { - const flagObject = swift.memory.getObject(flag); - swift.memory.release(flag); - imports.takesFeatureFlag(flagObject); - } catch (error) { - setException(error); - } - } - TestModule["bjs_returnsFeatureFlag"] = function bjs_returnsFeatureFlag() { - try { - let ret = imports.returnsFeatureFlag(); - tmpRetBytes = textEncoder.encode(ret); - return tmpRetBytes.length; - } catch (error) { - setException(error); - } - } - }, - setInstance: (i) => { - instance = i; - memory = instance.exports.memory; - - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; - const exports = { - }; - _exports = exports; - return exports; - }, - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.d.ts deleted file mode 100644 index 229436712..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -// 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 type Exports = { - checkString(a: string): void; - roundtripString(a: string): string; -} -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/StringParameter.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js deleted file mode 100644 index 021adcba3..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Export.js +++ /dev/null @@ -1,237 +0,0 @@ -// 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; - 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 tmpRetTag; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; - let tmpStructCleanups = []; - 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) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { - const source = swift.memory.getObject(sourceId); - const bytes = new Uint8Array(memory.buffer, bytesPtr); - bytes.set(source); - } - bjs["swift_js_make_js_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - return swift.memory.retain(textDecoder.decode(bytes)); - } - 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_tag"] = function(tag) { - tmpRetTag = tag; - } - bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); - } - bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); - } - bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); - } - bjs["swift_js_push_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); - } - bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); - } - bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); - } - bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); - } - bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); - } - bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); - } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.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 { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - } - 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; - } - }, - setInstance: (i) => { - instance = i; - memory = instance.exports.memory; - - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; - const exports = { - checkString: function bjs_checkString(a) { - const aBytes = textEncoder.encode(a); - const aId = swift.memory.retain(aBytes); - instance.exports.bjs_checkString(aId, aBytes.length); - swift.memory.release(aId); - }, - roundtripString: function bjs_roundtripString(a) { - const aBytes = textEncoder.encode(a); - const aId = swift.memory.retain(aBytes); - instance.exports.bjs_roundtripString(aId, aBytes.length); - const ret = tmpRetString; - tmpRetString = undefined; - swift.memory.release(aId); - return ret; - }, - }; - _exports = exports; - return exports; - }, - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.d.ts similarity index 89% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.d.ts index 09fd7b638..5e45162a1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.d.ts @@ -5,6 +5,8 @@ // `swift package bridge-js`. export type Exports = { + checkString(a: string): void; + roundtripString(a: string): string; } export type Imports = { checkString(a: string): void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js similarity index 92% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js index 718f776c7..03a4bc9b1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js @@ -234,6 +234,21 @@ export async function createInstantiator(options, swift) { createExports: (instance) => { const js = swift.memory.heap; const exports = { + checkString: function bjs_checkString(a) { + const aBytes = textEncoder.encode(a); + const aId = swift.memory.retain(aBytes); + instance.exports.bjs_checkString(aId, aBytes.length); + swift.memory.release(aId); + }, + roundtripString: function bjs_roundtripString(a) { + const aBytes = textEncoder.encode(a); + const aId = swift.memory.retain(aBytes); + instance.exports.bjs_roundtripString(aId, aBytes.length); + const ret = tmpRetString; + tmpRetString = undefined; + swift.memory.release(aId); + return ret; + }, }; _exports = exports; return exports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js deleted file mode 100644 index 479b313dd..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.js +++ /dev/null @@ -1,228 +0,0 @@ -// 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; - 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 tmpRetTag; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; - let tmpStructCleanups = []; - 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) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { - const source = swift.memory.getObject(sourceId); - const bytes = new Uint8Array(memory.buffer, bytesPtr); - bytes.set(source); - } - bjs["swift_js_make_js_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - return swift.memory.retain(textDecoder.decode(bytes)); - } - 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_tag"] = function(tag) { - tmpRetTag = tag; - } - bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); - } - bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); - } - bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); - } - bjs["swift_js_push_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); - } - bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); - } - bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); - } - bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); - } - bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); - } - bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); - } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.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 { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - } - 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; - } - }, - setInstance: (i) => { - instance = i; - memory = instance.exports.memory; - - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; - const exports = { - checkString: function bjs_checkString() { - instance.exports.bjs_checkString(); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - }, - }; - _exports = exports; - return exports; - }, - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.d.ts deleted file mode 100644 index cb7783667..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// 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 type Exports = { -} -export type Imports = { - checkString(): string; -} -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/StringReturn.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.d.ts similarity index 95% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.d.ts index c6a9f65a4..b43ff062c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Export.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.d.ts @@ -8,6 +8,7 @@ export type Exports = { checkString(): string; } export type Imports = { + checkString(): string; } export function createInstantiator(options: { imports: Imports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js similarity index 97% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js index bb5278068..98ea9fa4a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js @@ -225,6 +225,12 @@ export async function createInstantiator(options, swift) { createExports: (instance) => { const js = swift.memory.heap; const exports = { + checkString: function bjs_checkString() { + instance.exports.bjs_checkString(); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + }, }; _exports = exports; return exports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.ImportMacros.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.ImportMacros.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.d.ts deleted file mode 100644 index 26d56fb6c..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -// 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 interface TypeScriptProcessor { - convert(ts: string): string; - validate(ts: string): boolean; - readonly version: string; -} -export interface CodeGenerator { - generate(input: any): string; - readonly outputFormat: string; -} -export type Exports = { -} -export type Imports = { - createTS2Skeleton(): TypeScriptProcessor; - createCodeGenerator(format: string): CodeGenerator; -} -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/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js deleted file mode 100644 index 45c273115..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ /dev/null @@ -1,293 +0,0 @@ -// 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; - 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 tmpRetTag; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; - let tmpStructCleanups = []; - const enumHelpers = {}; - const structHelpers = {}; - - let _exports = null; - let bjs = null; - - return { - /** - * @param {WebAssembly.Imports} importObject - */ - addImports: (importObject, importsContext) => { - bjs = {}; - importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); - bjs["swift_js_return_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { - const source = swift.memory.getObject(sourceId); - const bytes = new Uint8Array(memory.buffer, bytesPtr); - bytes.set(source); - } - bjs["swift_js_make_js_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - return swift.memory.retain(textDecoder.decode(bytes)); - } - 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_tag"] = function(tag) { - tmpRetTag = tag; - } - bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); - } - bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); - } - bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); - } - bjs["swift_js_push_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); - } - bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); - } - bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); - } - bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); - } - bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); - } - bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); - } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.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 { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - } - 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; - } - const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; - TestModule["bjs_createTS2Skeleton"] = function bjs_createTS2Skeleton() { - try { - let ret = imports.createTS2Skeleton(); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_createCodeGenerator"] = function bjs_createCodeGenerator(format) { - try { - const formatObject = swift.memory.getObject(format); - swift.memory.release(format); - let ret = imports.createCodeGenerator(formatObject); - return swift.memory.retain(ret); - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_TypeScriptProcessor_version_get"] = function bjs_TypeScriptProcessor_version_get(self) { - try { - let ret = swift.memory.getObject(self).version; - tmpRetBytes = textEncoder.encode(ret); - return tmpRetBytes.length; - } catch (error) { - setException(error); - } - } - TestModule["bjs_TypeScriptProcessor_convert"] = function bjs_TypeScriptProcessor_convert(self, ts) { - try { - const tsObject = swift.memory.getObject(ts); - swift.memory.release(ts); - let ret = swift.memory.getObject(self).convert(tsObject); - tmpRetBytes = textEncoder.encode(ret); - return tmpRetBytes.length; - } catch (error) { - setException(error); - } - } - TestModule["bjs_TypeScriptProcessor_validate"] = function bjs_TypeScriptProcessor_validate(self, ts) { - try { - const tsObject = swift.memory.getObject(ts); - swift.memory.release(ts); - let ret = swift.memory.getObject(self).validate(tsObject); - return ret ? 1 : 0; - } catch (error) { - setException(error); - return 0 - } - } - TestModule["bjs_CodeGenerator_outputFormat_get"] = function bjs_CodeGenerator_outputFormat_get(self) { - try { - let ret = swift.memory.getObject(self).outputFormat; - tmpRetBytes = textEncoder.encode(ret); - return tmpRetBytes.length; - } catch (error) { - setException(error); - } - } - TestModule["bjs_CodeGenerator_generate"] = function bjs_CodeGenerator_generate(self, input) { - try { - let ret = swift.memory.getObject(self).generate(swift.memory.getObject(input)); - tmpRetBytes = textEncoder.encode(ret); - return tmpRetBytes.length; - } catch (error) { - setException(error); - } - } - }, - setInstance: (i) => { - instance = i; - memory = instance.exports.memory; - - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; - const exports = { - }; - _exports = exports; - return exports; - }, - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.d.ts deleted file mode 100644 index da5dfb076..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// 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 type Exports = { -} -export type Imports = { - checkSimple(a: number): void; -} -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/TypeAlias.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js deleted file mode 100644 index 406d7f0f3..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeAlias.Import.js +++ /dev/null @@ -1,231 +0,0 @@ -// 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; - 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 tmpRetTag; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; - let tmpStructCleanups = []; - const enumHelpers = {}; - const structHelpers = {}; - - let _exports = null; - let bjs = null; - - return { - /** - * @param {WebAssembly.Imports} importObject - */ - addImports: (importObject, importsContext) => { - bjs = {}; - importObject["bjs"] = bjs; - const imports = options.getImports(importsContext); - bjs["swift_js_return_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { - const source = swift.memory.getObject(sourceId); - const bytes = new Uint8Array(memory.buffer, bytesPtr); - bytes.set(source); - } - bjs["swift_js_make_js_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - return swift.memory.retain(textDecoder.decode(bytes)); - } - 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_tag"] = function(tag) { - tmpRetTag = tag; - } - bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); - } - bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); - } - bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); - } - bjs["swift_js_push_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); - } - bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); - } - bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); - } - bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); - } - bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); - } - bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); - } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.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 { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - } - 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; - } - const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; - TestModule["bjs_checkSimple"] = function bjs_checkSimple(a) { - try { - imports.checkSimple(a); - } catch (error) { - setException(error); - } - } - }, - setInstance: (i) => { - instance = i; - memory = instance.exports.memory; - - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; - const exports = { - }; - _exports = exports; - return exports; - }, - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.d.ts similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.d.ts diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js similarity index 100% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.Export.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.d.ts deleted file mode 100644 index be85a00fd..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// 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 type Exports = { - check(): void; -} -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/VoidParameterVoidReturn.Export.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js deleted file mode 100644 index 8a2fabca9..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Export.js +++ /dev/null @@ -1,225 +0,0 @@ -// 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; - 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 tmpRetTag; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; - let tmpStructCleanups = []; - 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) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { - const source = swift.memory.getObject(sourceId); - const bytes = new Uint8Array(memory.buffer, bytesPtr); - bytes.set(source); - } - bjs["swift_js_make_js_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - return swift.memory.retain(textDecoder.decode(bytes)); - } - 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_tag"] = function(tag) { - tmpRetTag = tag; - } - bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); - } - bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); - } - bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); - } - bjs["swift_js_push_string"] = function(ptr, len) { - const bytes = new Uint8Array(memory.buffer, ptr, len); - const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); - } - bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); - } - bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); - } - bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); - } - bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); - } - bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); - } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.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 { - const bytes = new Uint8Array(memory.buffer, ptr, len); - tmpRetString = textDecoder.decode(bytes); - } - } - 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; - } - }, - setInstance: (i) => { - instance = i; - memory = instance.exports.memory; - - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; - const exports = { - check: function bjs_check() { - instance.exports.bjs_check(); - }, - }; - _exports = exports; - return exports; - }, - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.d.ts similarity index 96% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.d.ts rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.d.ts index 8cd1e806e..7acba67a0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.d.ts @@ -5,6 +5,7 @@ // `swift package bridge-js`. export type Exports = { + check(): void; } export type Imports = { check(): void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js similarity index 98% rename from Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js rename to Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js index 2944bcf5a..f37cbd90b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js @@ -223,6 +223,9 @@ export async function createInstantiator(options, swift) { createExports: (instance) => { const js = swift.memory.heap; const exports = { + check: function bjs_check() { + instance.exports.bjs_check(); + }, }; _exports = exports; return exports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.json deleted file mode 100644 index c796433dd..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ArrayTypes.json +++ /dev/null @@ -1,983 +0,0 @@ -{ - "classes" : [ - { - "methods" : [ - - ], - "name" : "Item", - "properties" : [ - - ], - "swiftCallName" : "Item" - } - ], - "enums" : [ - { - "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" : "pending", - "rawValue" : "0" - }, - { - "associatedValues" : [ - - ], - "name" : "active", - "rawValue" : "1" - }, - { - "associatedValues" : [ - - ], - "name" : "completed", - "rawValue" : "2" - } - ], - "emitStyle" : "const", - "name" : "Status", - "rawType" : "Int", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Status", - "tsFullPath" : "Status" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_processIntArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processIntArray", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "abiName" : "bjs_processStringArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processStringArray", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_processDoubleArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processDoubleArray", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - }, - { - "abiName" : "bjs_processBoolArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processBoolArray", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "bool" : { - - } - } - } - } - }, - { - "abiName" : "bjs_processPointArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processPointArray", - "parameters" : [ - { - "label" : "_", - "name" : "points", - "type" : { - "array" : { - "_0" : { - "swiftStruct" : { - "_0" : "Point" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "swiftStruct" : { - "_0" : "Point" - } - } - } - } - }, - { - "abiName" : "bjs_processDirectionArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processDirectionArray", - "parameters" : [ - { - "label" : "_", - "name" : "directions", - "type" : { - "array" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - }, - { - "abiName" : "bjs_processStatusArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processStatusArray", - "parameters" : [ - { - "label" : "_", - "name" : "statuses", - "type" : { - "array" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Status", - "_1" : "Int" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Status", - "_1" : "Int" - } - } - } - } - }, - { - "abiName" : "bjs_sumIntArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "sumIntArray", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_findFirstPoint", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "findFirstPoint", - "parameters" : [ - { - "label" : "_", - "name" : "points", - "type" : { - "array" : { - "_0" : { - "swiftStruct" : { - "_0" : "Point" - } - } - } - } - }, - { - "label" : "matching", - "name" : "matching", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Point" - } - } - }, - { - "abiName" : "bjs_processUnsafeRawPointerArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processUnsafeRawPointerArray", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } - } - } - } - } - }, - { - "abiName" : "bjs_processUnsafeMutableRawPointerArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processUnsafeMutableRawPointerArray", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } - } - } - } - } - }, - { - "abiName" : "bjs_processOpaquePointerArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOpaquePointerArray", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } - } - } - } - } - }, - { - "abiName" : "bjs_processOptionalIntArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalIntArray", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - } - } - }, - { - "abiName" : "bjs_processOptionalStringArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalStringArray", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - } - }, - { - "abiName" : "bjs_processOptionalArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalArray", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "optional" : { - "_0" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - } - } - } - }, - { - "abiName" : "bjs_processOptionalPointArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalPointArray", - "parameters" : [ - { - "label" : "_", - "name" : "points", - "type" : { - "array" : { - "_0" : { - "optional" : { - "_0" : { - "swiftStruct" : { - "_0" : "Point" - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "optional" : { - "_0" : { - "swiftStruct" : { - "_0" : "Point" - } - } - } - } - } - } - }, - { - "abiName" : "bjs_processOptionalDirectionArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalDirectionArray", - "parameters" : [ - { - "label" : "_", - "name" : "directions", - "type" : { - "array" : { - "_0" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - } - } - }, - { - "abiName" : "bjs_processOptionalStatusArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalStatusArray", - "parameters" : [ - { - "label" : "_", - "name" : "statuses", - "type" : { - "array" : { - "_0" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Status", - "_1" : "Int" - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Status", - "_1" : "Int" - } - } - } - } - } - } - }, - { - "abiName" : "bjs_processNestedIntArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processNestedIntArray", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - } - } - } - }, - { - "abiName" : "bjs_processNestedStringArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processNestedStringArray", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - } - }, - { - "abiName" : "bjs_processNestedPointArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processNestedPointArray", - "parameters" : [ - { - "label" : "_", - "name" : "points", - "type" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "swiftStruct" : { - "_0" : "Point" - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "swiftStruct" : { - "_0" : "Point" - } - } - } - } - } - } - }, - { - "abiName" : "bjs_processItemArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processItemArray", - "parameters" : [ - { - "label" : "_", - "name" : "items", - "type" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Item" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Item" - } - } - } - } - }, - { - "abiName" : "bjs_processNestedItemArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processNestedItemArray", - "parameters" : [ - { - "label" : "_", - "name" : "items", - "type" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Item" - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Item" - } - } - } - } - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - { - "methods" : [ - - ], - "name" : "Point", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "x", - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "y", - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "Point" - } - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json deleted file mode 100644 index 77c5b3678..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.json +++ /dev/null @@ -1,184 +0,0 @@ -{ - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_asyncReturnVoid", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncReturnVoid", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripInt", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripInt", - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripString", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripString", - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripBool", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripBool", - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripFloat", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripFloat", - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "float" : { - - } - } - } - ], - "returnType" : { - "float" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripDouble", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripDouble", - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripJSObject", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripJSObject", - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "jsObject" : { - - } - } - } - ], - "returnType" : { - "jsObject" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.json deleted file mode 100644 index 97def2060..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_FunctionA_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_FunctionA_processB", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processB", - "parameters" : [ - { - "label" : "b", - "name" : "b", - "type" : { - "swiftHeapObject" : { - "_0" : "FunctionB" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_FunctionA_createB", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createB", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "FunctionB" - } - } - } - ], - "name" : "FunctionA", - "properties" : [ - - ], - "swiftCallName" : "FunctionA" - }, - { - "constructor" : { - "abiName" : "bjs_FunctionB_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "FunctionB", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "FunctionB" - } - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_standaloneFunction", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "standaloneFunction", - "parameters" : [ - { - "label" : "b", - "name" : "b", - "type" : { - "swiftHeapObject" : { - "_0" : "FunctionB" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "FunctionB" - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.json deleted file mode 100644 index acfa4c9ef..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_FunctionB_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "FunctionB", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "FunctionB" - }, - { - "constructor" : { - "abiName" : "bjs_FunctionA_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_FunctionA_processB", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processB", - "parameters" : [ - { - "label" : "b", - "name" : "b", - "type" : { - "swiftHeapObject" : { - "_0" : "FunctionB" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_FunctionA_createB", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createB", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "FunctionB" - } - } - } - ], - "name" : "FunctionA", - "properties" : [ - - ], - "swiftCallName" : "FunctionA" - } - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_standaloneFunction", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "standaloneFunction", - "parameters" : [ - { - "label" : "b", - "name" : "b", - "type" : { - "swiftHeapObject" : { - "_0" : "FunctionB" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "FunctionB" - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.json deleted file mode 100644 index de5fb19b0..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "classes" : [ - { - "methods" : [ - - ], - "name" : "ClassA", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "linkedB", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "ClassB" - } - } - } - } - } - ], - "swiftCallName" : "ClassA" - }, - { - "constructor" : { - "abiName" : "bjs_ClassB_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - - ], - "name" : "ClassB", - "properties" : [ - - ], - "swiftCallName" : "ClassB" - } - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.json deleted file mode 100644 index 53a5f858c..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_ClassB_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - - ], - "name" : "ClassB", - "properties" : [ - - ], - "swiftCallName" : "ClassB" - }, - { - "methods" : [ - - ], - "name" : "ClassA", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "linkedB", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "ClassB" - } - } - } - } - } - ], - "swiftCallName" : "ClassA" - } - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json deleted file mode 100644 index f2e6a4e2e..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.json +++ /dev/null @@ -1,1270 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_DefaultGreeter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "DefaultGreeter", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "DefaultGreeter" - }, - { - "constructor" : { - "abiName" : "bjs_EmptyGreeter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - - ], - "name" : "EmptyGreeter", - "properties" : [ - - ], - "swiftCallName" : "EmptyGreeter" - }, - { - "constructor" : { - "abiName" : "bjs_ConstructorDefaults_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" : { - "int" : { - - } - } - }, - { - "defaultValue" : { - "bool" : { - "_0" : true - } - }, - "label" : "enabled", - "name" : "enabled", - "type" : { - "bool" : { - - } - } - }, - { - "defaultValue" : { - "enumCase" : { - "_0" : "Status", - "_1" : "active" - } - }, - "label" : "status", - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - }, - { - "defaultValue" : { - "null" : { - - } - }, - "label" : "tag", - "name" : "tag", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "ConstructorDefaults", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "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" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "swiftCallName" : "ConstructorDefaults" - } - ], - "enums" : [ - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "active" - }, - { - "associatedValues" : [ - - ], - "name" : "inactive" - }, - { - "associatedValues" : [ - - ], - "name" : "pending" - } - ], - "emitStyle" : "const", - "explicitAccessControl" : "public", - "name" : "Status", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Status", - "tsFullPath" : "Status" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_testStringDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testStringDefault", - "parameters" : [ - { - "defaultValue" : { - "string" : { - "_0" : "Hello World" - } - }, - "label" : "message", - "name" : "message", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_testNegativeIntDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testNegativeIntDefault", - "parameters" : [ - { - "defaultValue" : { - "int" : { - "_0" : -42 - } - }, - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_testBoolDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testBoolDefault", - "parameters" : [ - { - "defaultValue" : { - "bool" : { - "_0" : true - } - }, - "label" : "flag", - "name" : "flag", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_testNegativeFloatDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testNegativeFloatDefault", - "parameters" : [ - { - "defaultValue" : { - "float" : { - "_0" : -273.15 - } - }, - "label" : "temp", - "name" : "temp", - "type" : { - "float" : { - - } - } - } - ], - "returnType" : { - "float" : { - - } - } - }, - { - "abiName" : "bjs_testDoubleDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testDoubleDefault", - "parameters" : [ - { - "defaultValue" : { - "double" : { - "_0" : 2.718 - } - }, - "label" : "precision", - "name" : "precision", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_testOptionalDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testOptionalDefault", - "parameters" : [ - { - "defaultValue" : { - "null" : { - - } - }, - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_testOptionalStringDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testOptionalStringDefault", - "parameters" : [ - { - "defaultValue" : { - "string" : { - "_0" : "Hi" - } - }, - "label" : "greeting", - "name" : "greeting", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_testMultipleDefaults", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testMultipleDefaults", - "parameters" : [ - { - "defaultValue" : { - "string" : { - "_0" : "Default Title" - } - }, - "label" : "title", - "name" : "title", - "type" : { - "string" : { - - } - } - }, - { - "defaultValue" : { - "int" : { - "_0" : 10 - } - }, - "label" : "count", - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "defaultValue" : { - "bool" : { - "_0" : false - } - }, - "label" : "enabled", - "name" : "enabled", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_testEnumDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testEnumDefault", - "parameters" : [ - { - "defaultValue" : { - "enumCase" : { - "_0" : "Status", - "_1" : "active" - } - }, - "label" : "status", - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Status" - } - } - }, - { - "abiName" : "bjs_testComplexInit", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testComplexInit", - "parameters" : [ - { - "defaultValue" : { - "objectWithArguments" : { - "_0" : "DefaultGreeter", - "_1" : [ - { - "string" : { - "_0" : "DefaultUser" - } - } - ] - } - }, - "label" : "greeter", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "DefaultGreeter" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "DefaultGreeter" - } - } - }, - { - "abiName" : "bjs_testEmptyInit", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testEmptyInit", - "parameters" : [ - { - "defaultValue" : { - "object" : { - "_0" : "EmptyGreeter" - } - }, - "label" : "greeter", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "EmptyGreeter" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "EmptyGreeter" - } - } - }, - { - "abiName" : "bjs_testOptionalStructDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testOptionalStructDefault", - "parameters" : [ - { - "defaultValue" : { - "null" : { - - } - }, - "label" : "point", - "name" : "point", - "type" : { - "optional" : { - "_0" : { - "swiftStruct" : { - "_0" : "Config" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "swiftStruct" : { - "_0" : "Config" - } - } - } - } - }, - { - "abiName" : "bjs_testOptionalStructWithValueDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testOptionalStructWithValueDefault", - "parameters" : [ - { - "defaultValue" : { - "structLiteral" : { - "_0" : "Config", - "_1" : [ - { - "name" : "name", - "value" : { - "string" : { - "_0" : "default" - } - } - }, - { - "name" : "value", - "value" : { - "int" : { - "_0" : 42 - } - } - }, - { - "name" : "enabled", - "value" : { - "bool" : { - "_0" : true - } - } - } - ] - } - }, - "label" : "point", - "name" : "point", - "type" : { - "optional" : { - "_0" : { - "swiftStruct" : { - "_0" : "Config" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "swiftStruct" : { - "_0" : "Config" - } - } - } - } - }, - { - "abiName" : "bjs_testIntArrayDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testIntArrayDefault", - "parameters" : [ - { - "defaultValue" : { - "array" : { - "_0" : [ - { - "int" : { - "_0" : 1 - } - }, - { - "int" : { - "_0" : 2 - } - }, - { - "int" : { - "_0" : 3 - } - } - ] - } - }, - "label" : "values", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "abiName" : "bjs_testStringArrayDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testStringArrayDefault", - "parameters" : [ - { - "defaultValue" : { - "array" : { - "_0" : [ - { - "string" : { - "_0" : "a" - } - }, - { - "string" : { - "_0" : "b" - } - }, - { - "string" : { - "_0" : "c" - } - } - ] - } - }, - "label" : "names", - "name" : "names", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_testDoubleArrayDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testDoubleArrayDefault", - "parameters" : [ - { - "defaultValue" : { - "array" : { - "_0" : [ - { - "double" : { - "_0" : 1.5 - } - }, - { - "double" : { - "_0" : 2.5 - } - }, - { - "double" : { - "_0" : 3.5 - } - } - ] - } - }, - "label" : "values", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - }, - { - "abiName" : "bjs_testBoolArrayDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testBoolArrayDefault", - "parameters" : [ - { - "defaultValue" : { - "array" : { - "_0" : [ - { - "bool" : { - "_0" : true - } - }, - { - "bool" : { - "_0" : false - } - }, - { - "bool" : { - "_0" : true - } - } - ] - } - }, - "label" : "flags", - "name" : "flags", - "type" : { - "array" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "bool" : { - - } - } - } - } - }, - { - "abiName" : "bjs_testEmptyArrayDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testEmptyArrayDefault", - "parameters" : [ - { - "defaultValue" : { - "array" : { - "_0" : [ - - ] - } - }, - "label" : "items", - "name" : "items", - "type" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "abiName" : "bjs_testMixedWithArrayDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testMixedWithArrayDefault", - "parameters" : [ - { - "defaultValue" : { - "string" : { - "_0" : "test" - } - }, - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "defaultValue" : { - "array" : { - "_0" : [ - { - "int" : { - "_0" : 10 - } - }, - { - "int" : { - "_0" : 20 - } - }, - { - "int" : { - "_0" : 30 - } - } - ] - } - }, - "label" : "values", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "defaultValue" : { - "bool" : { - "_0" : true - } - }, - "label" : "enabled", - "name" : "enabled", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - { - "methods" : [ - - ], - "name" : "Config", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "value", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "enabled", - "type" : { - "bool" : { - - } - } - } - ], - "swiftCallName" : "Config" - }, - { - "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" - } - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json deleted file mode 100644 index ab7fbfd9d..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.json +++ /dev/null @@ -1,844 +0,0 @@ -{ - "classes" : [ - - ], - "enums" : [ - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "int" : { - - } - } - } - ], - "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" : { - "int" : { - - } - } - } - ], - "name" : "error" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "status" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - } - ], - "name" : "coordinates" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - } - ], - "name" : "failure" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "status" - } - ], - "emitStyle" : "const", - "name" : "Result", - "namespace" : [ - "Utilities" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utilities.Result", - "tsFullPath" : "Utilities.Result" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - } - ], - "name" : "failure" - } - ], - "emitStyle" : "const", - "name" : "NetworkingResult", - "namespace" : [ - "API" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "NetworkingResult", - "tsFullPath" : "API.NetworkingResult" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "name" : "failure" - }, - { - "associatedValues" : [ - { - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - }, - { - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "name" : "status" - } - ], - "emitStyle" : "const", - "name" : "APIOptionalResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "APIOptionalResult", - "tsFullPath" : "APIOptionalResult" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_handle", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "handle", - "parameters" : [ - { - "label" : "result", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getResult", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "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_roundTripOptionalAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalAPIResult", - "parameters" : [ - { - "label" : "result", - "name" : "result", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - }, - { - "abiName" : "bjs_handleComplex", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "handleComplex", - "parameters" : [ - { - "label" : "result", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getComplexResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getComplexResult", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "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_roundTripOptionalComplexResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalComplexResult", - "parameters" : [ - { - "label" : "result", - "name" : "result", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalUtilitiesResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalUtilitiesResult", - "parameters" : [ - { - "label" : "result", - "name" : "result", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalNetworkingResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalNetworkingResult", - "parameters" : [ - { - "label" : "result", - "name" : "result", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "NetworkingResult" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "NetworkingResult" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalAPIOptionalResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalAPIOptionalResult", - "parameters" : [ - { - "label" : "result", - "name" : "result", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" - } - } - } - } - }, - { - "abiName" : "bjs_compareAPIResults", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "compareAPIResults", - "parameters" : [ - { - "label" : "result1", - "name" : "result1", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" - } - } - } - } - }, - { - "label" : "result2", - "name" : "result2", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" - } - } - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json deleted file mode 100644 index ca6fabceb..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.json +++ /dev/null @@ -1,320 +0,0 @@ -{ - "classes" : [ - - ], - "enums" : [ - { - "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" : "north" - }, - { - "associatedValues" : [ - - ], - "name" : "south" - }, - { - "associatedValues" : [ - - ], - "name" : "east" - }, - { - "associatedValues" : [ - - ], - "name" : "west" - } - ], - "emitStyle" : "tsEnum", - "name" : "TSDirection", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "TSDirection", - "tsFullPath" : "TSDirection" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "success" - } - ], - "emitStyle" : "const", - "explicitAccessControl" : "public", - "name" : "PublicStatus", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "PublicStatus", - "tsFullPath" : "PublicStatus" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_setDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setDirection", - "parameters" : [ - { - "label" : "_", - "name" : "direction", - "type" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "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_roundTripOptionalDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalDirection", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - }, - { - "abiName" : "bjs_setTSDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setTSDirection", - "parameters" : [ - { - "label" : "_", - "name" : "direction", - "type" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getTSDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTSDirection", - "parameters" : [ - - ], - "returnType" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTSDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTSDirection", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json deleted file mode 100644 index 135908d7f..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.json +++ /dev/null @@ -1,538 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_Converter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_Converter_toString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "toString", - "namespace" : [ - "Utils" - ], - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "Converter", - "namespace" : [ - "Utils" - ], - "properties" : [ - - ], - "swiftCallName" : "Utils.Converter" - }, - { - "constructor" : { - "abiName" : "bjs_HTTPServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_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_TestServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_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" - } - ], - "enums" : [ - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Utils", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utils", - "tsFullPath" : "Utils" - }, - { - "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" : [ - - ], - "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" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "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" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "GraphOperations" - } - } - }, - { - "abiName" : "bjs_Services_Graph_GraphOperations_static_validate", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : true - }, - "name" : "validate", - "namespace" : [ - "Services", - "Graph", - "GraphOperations" - ], - "parameters" : [ - { - "label" : "graphId", - "name" : "graphId", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "GraphOperations" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GraphOperations", - "tsFullPath" : "Services.Graph.GraphOperations" - } - ], - "exposeToGlobal" : true, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json deleted file mode 100644 index 374ae13f4..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.json +++ /dev/null @@ -1,538 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_Converter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_Converter_toString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "toString", - "namespace" : [ - "Utils" - ], - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "Converter", - "namespace" : [ - "Utils" - ], - "properties" : [ - - ], - "swiftCallName" : "Utils.Converter" - }, - { - "constructor" : { - "abiName" : "bjs_HTTPServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_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_TestServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_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" - } - ], - "enums" : [ - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Utils", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utils", - "tsFullPath" : "Utils" - }, - { - "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" : [ - - ], - "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" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "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" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "GraphOperations" - } - } - }, - { - "abiName" : "bjs_Services_Graph_GraphOperations_static_validate", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : true - }, - "name" : "validate", - "namespace" : [ - "Services", - "Graph", - "GraphOperations" - ], - "parameters" : [ - { - "label" : "graphId", - "name" : "graphId", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "GraphOperations" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GraphOperations", - "tsFullPath" : "Services.Graph.GraphOperations" - } - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json deleted file mode 100644 index 078772ff2..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.json +++ /dev/null @@ -1,1498 +0,0 @@ -{ - "classes" : [ - - ], - "enums" : [ - { - "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" : "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" : [ - { - "associatedValues" : [ - - ], - "name" : "enabled", - "rawValue" : "true" - }, - { - "associatedValues" : [ - - ], - "name" : "disabled", - "rawValue" : "false" - } - ], - "emitStyle" : "const", - "name" : "FeatureFlag", - "rawType" : "Bool", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "FeatureFlag", - "tsFullPath" : "FeatureFlag" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "ok", - "rawValue" : "200" - }, - { - "associatedValues" : [ - - ], - "name" : "notFound", - "rawValue" : "404" - }, - { - "associatedValues" : [ - - ], - "name" : "serverError", - "rawValue" : "500" - } - ], - "emitStyle" : "const", - "name" : "HttpStatus", - "rawType" : "Int", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "HttpStatus", - "tsFullPath" : "HttpStatus" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "ok", - "rawValue" : "200" - }, - { - "associatedValues" : [ - - ], - "name" : "notFound", - "rawValue" : "404" - }, - { - "associatedValues" : [ - - ], - "name" : "serverError", - "rawValue" : "500" - } - ], - "emitStyle" : "tsEnum", - "name" : "TSHttpStatus", - "rawType" : "Int", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "TSHttpStatus", - "tsFullPath" : "TSHttpStatus" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "lowest", - "rawValue" : "-1" - }, - { - "associatedValues" : [ - - ], - "name" : "low", - "rawValue" : "2" - }, - { - "associatedValues" : [ - - ], - "name" : "medium", - "rawValue" : "3" - }, - { - "associatedValues" : [ - - ], - "name" : "high", - "rawValue" : "4" - }, - { - "associatedValues" : [ - - ], - "name" : "highest", - "rawValue" : "5" - } - ], - "emitStyle" : "const", - "name" : "Priority", - "rawType" : "Int32", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Priority", - "tsFullPath" : "Priority" - }, - { - "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" : "guest", - "rawValue" : "0" - }, - { - "associatedValues" : [ - - ], - "name" : "user", - "rawValue" : "1000" - }, - { - "associatedValues" : [ - - ], - "name" : "admin", - "rawValue" : "9999" - } - ], - "emitStyle" : "const", - "name" : "UserId", - "rawType" : "UInt", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "UserId", - "tsFullPath" : "UserId" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "invalid", - "rawValue" : "0" - }, - { - "associatedValues" : [ - - ], - "name" : "session", - "rawValue" : "12345" - }, - { - "associatedValues" : [ - - ], - "name" : "refresh", - "rawValue" : "67890" - } - ], - "emitStyle" : "const", - "name" : "TokenId", - "rawType" : "UInt32", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "TokenId", - "tsFullPath" : "TokenId" - }, - { - "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" - }, - { - "associatedValues" : [ - - ], - "name" : "pi", - "rawValue" : "3.14159" - } - ], - "emitStyle" : "const", - "name" : "Ratio", - "rawType" : "Double", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Ratio", - "tsFullPath" : "Ratio" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_setTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setTheme", - "parameters" : [ - { - "label" : "_", - "name" : "theme", - "type" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTheme", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTheme", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - }, - { - "abiName" : "bjs_setTSTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setTSTheme", - "parameters" : [ - { - "label" : "_", - "name" : "theme", - "type" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getTSTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTSTheme", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTSTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTSTheme", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - } - } - }, - { - "abiName" : "bjs_setFeatureFlag", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setFeatureFlag", - "parameters" : [ - { - "label" : "_", - "name" : "flag", - "type" : { - "rawValueEnum" : { - "_0" : "FeatureFlag", - "_1" : "Bool" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getFeatureFlag", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getFeatureFlag", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "FeatureFlag", - "_1" : "Bool" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalFeatureFlag", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalFeatureFlag", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "FeatureFlag", - "_1" : "Bool" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "FeatureFlag", - "_1" : "Bool" - } - } - } - } - }, - { - "abiName" : "bjs_setHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setHttpStatus", - "parameters" : [ - { - "label" : "_", - "name" : "status", - "type" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getHttpStatus", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalHttpStatus", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - }, - { - "abiName" : "bjs_setTSHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setTSHttpStatus", - "parameters" : [ - { - "label" : "_", - "name" : "status", - "type" : { - "rawValueEnum" : { - "_0" : "TSHttpStatus", - "_1" : "Int" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getTSHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTSHttpStatus", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "TSHttpStatus", - "_1" : "Int" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalHttpStatus", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSHttpStatus", - "_1" : "Int" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSHttpStatus", - "_1" : "Int" - } - } - } - } - }, - { - "abiName" : "bjs_setPriority", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setPriority", - "parameters" : [ - { - "label" : "_", - "name" : "priority", - "type" : { - "rawValueEnum" : { - "_0" : "Priority", - "_1" : "Int32" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getPriority", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getPriority", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Priority", - "_1" : "Int32" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalPriority", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalPriority", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Priority", - "_1" : "Int32" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Priority", - "_1" : "Int32" - } - } - } - } - }, - { - "abiName" : "bjs_setFileSize", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setFileSize", - "parameters" : [ - { - "label" : "_", - "name" : "size", - "type" : { - "rawValueEnum" : { - "_0" : "FileSize", - "_1" : "Int64" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getFileSize", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getFileSize", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "FileSize", - "_1" : "Int64" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalFileSize", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalFileSize", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "FileSize", - "_1" : "Int64" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "FileSize", - "_1" : "Int64" - } - } - } - } - }, - { - "abiName" : "bjs_setUserId", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setUserId", - "parameters" : [ - { - "label" : "_", - "name" : "id", - "type" : { - "rawValueEnum" : { - "_0" : "UserId", - "_1" : "UInt" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getUserId", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getUserId", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "UserId", - "_1" : "UInt" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalUserId", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalUserId", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "UserId", - "_1" : "UInt" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "UserId", - "_1" : "UInt" - } - } - } - } - }, - { - "abiName" : "bjs_setTokenId", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setTokenId", - "parameters" : [ - { - "label" : "_", - "name" : "token", - "type" : { - "rawValueEnum" : { - "_0" : "TokenId", - "_1" : "UInt32" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getTokenId", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTokenId", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "TokenId", - "_1" : "UInt32" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTokenId", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTokenId", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TokenId", - "_1" : "UInt32" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TokenId", - "_1" : "UInt32" - } - } - } - } - }, - { - "abiName" : "bjs_setSessionId", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setSessionId", - "parameters" : [ - { - "label" : "_", - "name" : "session", - "type" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getSessionId", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getSessionId", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalSessionId", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalSessionId", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - } - } - } - }, - { - "abiName" : "bjs_setPrecision", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setPrecision", - "parameters" : [ - { - "label" : "_", - "name" : "precision", - "type" : { - "rawValueEnum" : { - "_0" : "Precision", - "_1" : "Float" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getPrecision", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getPrecision", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Precision", - "_1" : "Float" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalPrecision", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalPrecision", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Precision", - "_1" : "Float" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Precision", - "_1" : "Float" - } - } - } - } - }, - { - "abiName" : "bjs_setRatio", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setRatio", - "parameters" : [ - { - "label" : "_", - "name" : "ratio", - "type" : { - "rawValueEnum" : { - "_0" : "Ratio", - "_1" : "Double" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getRatio", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getRatio", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Ratio", - "_1" : "Double" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalRatio", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalRatio", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Ratio", - "_1" : "Double" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Ratio", - "_1" : "Double" - } - } - } - } - }, - { - "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_convertPriority", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "convertPriority", - "parameters" : [ - { - "label" : "_", - "name" : "status", - "type" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Priority", - "_1" : "Int32" - } - } - }, - { - "abiName" : "bjs_validateSession", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "validateSession", - "parameters" : [ - { - "label" : "_", - "name" : "session", - "type" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.json deleted file mode 100644 index 6ee073ca8..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/ImportedTypeInExportedInterface.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_makeFoo", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "makeFoo", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - "_0" : "Foo" - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json deleted file mode 100644 index 5409a400e..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_GlobalClass_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_GlobalClass_greet", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "greet", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "GlobalClass", - "namespace" : [ - "GlobalAPI" - ], - "properties" : [ - - ], - "swiftCallName" : "GlobalClass" - } - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_GlobalAPI_globalFunction", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "globalFunction", - "namespace" : [ - "GlobalAPI" - ], - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json deleted file mode 100644 index bc58d985e..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_PrivateClass_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_PrivateClass_greet", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "greet", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "PrivateClass", - "namespace" : [ - "PrivateAPI" - ], - "properties" : [ - - ], - "swiftCallName" : "PrivateClass" - } - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_PrivateAPI_privateFunction", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "privateFunction", - "namespace" : [ - "PrivateAPI" - ], - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json deleted file mode 100644 index eb11e983f..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.json +++ /dev/null @@ -1,182 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_Greeter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_Greeter_greet", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "greet", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "Greeter", - "namespace" : [ - "__Swift", - "Foundation" - ], - "properties" : [ - - ], - "swiftCallName" : "Greeter" - }, - { - "constructor" : { - "abiName" : "bjs_Converter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_Converter_toString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "toString", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "Converter", - "namespace" : [ - "Utils", - "Converters" - ], - "properties" : [ - - ], - "swiftCallName" : "Converter" - }, - { - "methods" : [ - { - "abiName" : "bjs_UUID_uuidString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "uuidString", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "UUID", - "namespace" : [ - "__Swift", - "Foundation" - ], - "properties" : [ - - ], - "swiftCallName" : "UUID" - } - ], - "enums" : [ - - ], - "exposeToGlobal" : true, - "functions" : [ - { - "abiName" : "bjs_plainFunction", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "plainFunction", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_MyModule_Utils_namespacedFunction", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "namespacedFunction", - "namespace" : [ - "MyModule", - "Utils" - ], - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json deleted file mode 100644 index 914b7b894..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.json +++ /dev/null @@ -1,182 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_Greeter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_Greeter_greet", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "greet", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "Greeter", - "namespace" : [ - "__Swift", - "Foundation" - ], - "properties" : [ - - ], - "swiftCallName" : "Greeter" - }, - { - "constructor" : { - "abiName" : "bjs_Converter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_Converter_toString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "toString", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "Converter", - "namespace" : [ - "Utils", - "Converters" - ], - "properties" : [ - - ], - "swiftCallName" : "Converter" - }, - { - "methods" : [ - { - "abiName" : "bjs_UUID_uuidString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "uuidString", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "UUID", - "namespace" : [ - "__Swift", - "Foundation" - ], - "properties" : [ - - ], - "swiftCallName" : "UUID" - } - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_plainFunction", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "plainFunction", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_MyModule_Utils_namespacedFunction", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "namespacedFunction", - "namespace" : [ - "MyModule", - "Utils" - ], - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json deleted file mode 100644 index b3a4fc2c0..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.json +++ /dev/null @@ -1,699 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_Greeter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ] - }, - "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" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "Greeter", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "swiftCallName" : "Greeter" - }, - { - "constructor" : { - "abiName" : "bjs_OptionalPropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - - ], - "name" : "OptionalPropertyHolder", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalName", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalAge", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalGreeter", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "swiftCallName" : "OptionalPropertyHolder" - } - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_roundTripOptionalClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalClass", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - }, - { - "abiName" : "bjs_testOptionalPropertyRoundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testOptionalPropertyRoundtrip", - "parameters" : [ - { - "label" : "_", - "name" : "holder", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "OptionalPropertyHolder" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "OptionalPropertyHolder" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripString", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripInt", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripBool", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripBool", - "parameters" : [ - { - "label" : "flag", - "name" : "flag", - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripFloat", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripFloat", - "parameters" : [ - { - "label" : "number", - "name" : "number", - "type" : { - "optional" : { - "_0" : { - "float" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "float" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripDouble", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripDouble", - "parameters" : [ - { - "label" : "precision", - "name" : "precision", - "type" : { - "optional" : { - "_0" : { - "double" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "double" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripSyntax", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripSyntax", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripMixSyntax", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripMixSyntax", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripSwiftSyntax", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripSwiftSyntax", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripMixedSwiftSyntax", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripMixedSwiftSyntax", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripWithSpaces", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripWithSpaces", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "double" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "double" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripAlias", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripAlias", - "parameters" : [ - { - "label" : "age", - "name" : "age", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalAlias", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalAlias", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_testMixedOptionals", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testMixedOptionals", - "parameters" : [ - { - "label" : "firstName", - "name" : "firstName", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "label" : "lastName", - "name" : "lastName", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "label" : "age", - "name" : "age", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "label" : "active", - "name" : "active", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json deleted file mode 100644 index 3b45bf30f..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_check", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "check", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "int" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "uint" : { - - } - } - }, - { - "label" : "c", - "name" : "c", - "type" : { - "float" : { - - } - } - }, - { - "label" : "d", - "name" : "d", - "type" : { - "double" : { - - } - } - }, - { - "label" : "e", - "name" : "e", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift deleted file mode 100644 index f91e1e213..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift +++ /dev/null @@ -1,9 +0,0 @@ -@_expose(wasm, "bjs_check") -@_cdecl("bjs_check") -public func _bjs_check(_ a: Int32, _ b: Int32, _ c: Float32, _ d: Float64, _ e: Int32) -> Void { - #if arch(wasm32) - check(a: Int.bridgeJSLiftParameter(a), b: UInt.bridgeJSLiftParameter(b), c: Float.bridgeJSLiftParameter(c), d: Double.bridgeJSLiftParameter(d), e: Bool.bridgeJSLiftParameter(e)) - #else - fatalError("Only available on WebAssembly") - #endif -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json deleted file mode 100644 index d70b0c9b5..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_checkInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "checkInt", - "parameters" : [ - - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_checkUInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "checkUInt", - "parameters" : [ - - ], - "returnType" : { - "uint" : { - - } - } - }, - { - "abiName" : "bjs_checkFloat", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "checkFloat", - "parameters" : [ - - ], - "returnType" : { - "float" : { - - } - } - }, - { - "abiName" : "bjs_checkDouble", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "checkDouble", - "parameters" : [ - - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_checkBool", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "checkBool", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json deleted file mode 100644 index 43d05d9fa..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.json +++ /dev/null @@ -1,360 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_PropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "intValue", - "name" : "intValue", - "type" : { - "int" : { - - } - } - }, - { - "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" : { - - } - } - } - ] - }, - "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" : { - "int" : { - - } - } - }, - { - "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" : { - "int" : { - - } - } - }, - { - "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" : "PropertyHolder" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "lazyValue", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "computedReadonly", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "computedReadWrite", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "observedProperty", - "type" : { - "int" : { - - } - } - } - ], - "swiftCallName" : "PropertyHolder" - } - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_createPropertyHolder", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createPropertyHolder", - "parameters" : [ - { - "label" : "intValue", - "name" : "intValue", - "type" : { - "int" : { - - } - } - }, - { - "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" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json deleted file mode 100644 index eb8f2426a..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.json +++ /dev/null @@ -1,898 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_Helper_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_Helper_increment", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "increment", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "Helper", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "swiftCallName" : "Helper" - }, - { - "constructor" : { - "abiName" : "bjs_MyViewController_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "delegate", - "name" : "delegate", - "type" : { - "swiftProtocol" : { - "_0" : "MyViewControllerDelegate" - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_MyViewController_triggerEvent", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "triggerEvent", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_MyViewController_updateValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "updateValue", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_MyViewController_updateCount", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "updateCount", - "parameters" : [ - { - "label" : "_", - "name" : "count", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_MyViewController_updateLabel", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "updateLabel", - "parameters" : [ - { - "label" : "_", - "name" : "prefix", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "suffix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_MyViewController_checkEvenCount", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "checkEvenCount", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_MyViewController_sendHelper", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "sendHelper", - "parameters" : [ - { - "label" : "_", - "name" : "helper", - "type" : { - "swiftHeapObject" : { - "_0" : "Helper" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "MyViewController", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "delegate", - "type" : { - "swiftProtocol" : { - "_0" : "MyViewControllerDelegate" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "secondDelegate", - "type" : { - "optional" : { - "_0" : { - "swiftProtocol" : { - "_0" : "MyViewControllerDelegate" - } - } - } - } - } - ], - "swiftCallName" : "MyViewController" - }, - { - "constructor" : { - "abiName" : "bjs_DelegateManager_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "delegates", - "name" : "delegates", - "type" : { - "array" : { - "_0" : { - "swiftProtocol" : { - "_0" : "MyViewControllerDelegate" - } - } - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_DelegateManager_notifyAll", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "notifyAll", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "DelegateManager", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "delegates", - "type" : { - "array" : { - "_0" : { - "swiftProtocol" : { - "_0" : "MyViewControllerDelegate" - } - } - } - } - } - ], - "swiftCallName" : "DelegateManager" - } - ], - "enums" : [ - { - "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" : "test", - "rawValue" : "test" - }, - { - "associatedValues" : [ - - ], - "name" : "test2", - "rawValue" : "test2" - } - ], - "emitStyle" : "const", - "name" : "ExampleEnum", - "rawType" : "String", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "ExampleEnum", - "tsFullPath" : "ExampleEnum" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "int" : { - - } - } - } - ], - "name" : "failure" - } - ], - "emitStyle" : "const", - "name" : "Result", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Result", - "tsFullPath" : "Result" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "low", - "rawValue" : "-1" - }, - { - "associatedValues" : [ - - ], - "name" : "medium", - "rawValue" : "0" - }, - { - "associatedValues" : [ - - ], - "name" : "high", - "rawValue" : "1" - } - ], - "emitStyle" : "const", - "name" : "Priority", - "rawType" : "Int", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Priority", - "tsFullPath" : "Priority" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_processDelegates", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processDelegates", - "parameters" : [ - { - "label" : "_", - "name" : "delegates", - "type" : { - "array" : { - "_0" : { - "swiftProtocol" : { - "_0" : "MyViewControllerDelegate" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "swiftProtocol" : { - "_0" : "MyViewControllerDelegate" - } - } - } - } - } - ], - "protocols" : [ - { - "methods" : [ - { - "abiName" : "bjs_MyViewControllerDelegate_onSomethingHappened", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "onSomethingHappened", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_MyViewControllerDelegate_onValueChanged", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "onValueChanged", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_MyViewControllerDelegate_onCountUpdated", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "onCountUpdated", - "parameters" : [ - { - "label" : "count", - "name" : "count", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_MyViewControllerDelegate_onLabelUpdated", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "onLabelUpdated", - "parameters" : [ - { - "label" : "_", - "name" : "prefix", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "suffix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_MyViewControllerDelegate_isCountEven", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "isCountEven", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_MyViewControllerDelegate_onHelperUpdated", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "onHelperUpdated", - "parameters" : [ - { - "label" : "_", - "name" : "helper", - "type" : { - "swiftHeapObject" : { - "_0" : "Helper" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_MyViewControllerDelegate_createHelper", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createHelper", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Helper" - } - } - }, - { - "abiName" : "bjs_MyViewControllerDelegate_onOptionalHelperUpdated", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "onOptionalHelperUpdated", - "parameters" : [ - { - "label" : "_", - "name" : "helper", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Helper" - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_MyViewControllerDelegate_createOptionalHelper", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createOptionalHelper", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Helper" - } - } - } - } - }, - { - "abiName" : "bjs_MyViewControllerDelegate_createEnum", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createEnum", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "ExampleEnum", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_MyViewControllerDelegate_handleResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "handleResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "Result" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_MyViewControllerDelegate_getResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getResult", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "Result" - } - } - } - ], - "name" : "MyViewControllerDelegate", - "properties" : [ - { - "isReadonly" : false, - "name" : "eventCount", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "name" : "delegateName", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "name" : "optionalName", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "optionalRawEnum", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "ExampleEnum", - "_1" : "String" - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "rawStringEnum", - "type" : { - "rawValueEnum" : { - "_0" : "ExampleEnum", - "_1" : "String" - } - } - }, - { - "isReadonly" : false, - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "Result" - } - } - }, - { - "isReadonly" : false, - "name" : "optionalResult", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "Result" - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "direction", - "type" : { - "caseEnum" : { - "_0" : "Direction" - } - } - }, - { - "isReadonly" : false, - "name" : "directionOptional", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "priority", - "type" : { - "rawValueEnum" : { - "_0" : "Priority", - "_1" : "Int" - } - } - }, - { - "isReadonly" : false, - "name" : "priorityOptional", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Priority", - "_1" : "Int" - } - } - } - } - } - ] - } - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json deleted file mode 100644 index 0eec726c8..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.json +++ /dev/null @@ -1,336 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_MathUtils_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_MathUtils_static_subtract", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "subtract", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "int" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "className" : { - "_0" : "MathUtils" - } - } - }, - { - "abiName" : "bjs_MathUtils_static_add", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "add", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "int" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "className" : { - "_0" : "MathUtils" - } - } - }, - { - "abiName" : "bjs_MathUtils_multiply", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "multiply", - "parameters" : [ - { - "label" : "x", - "name" : "x", - "type" : { - "int" : { - - } - } - }, - { - "label" : "y", - "name" : "y", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - } - ], - "name" : "MathUtils", - "properties" : [ - - ], - "swiftCallName" : "MathUtils" - } - ], - "enums" : [ - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "scientific" - }, - { - "associatedValues" : [ - - ], - "name" : "basic" - } - ], - "emitStyle" : "const", - "name" : "Calculator", - "staticMethods" : [ - { - "abiName" : "bjs_Calculator_static_square", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "square", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "enumName" : { - "_0" : "Calculator" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Calculator", - "tsFullPath" : "Calculator" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "int" : { - - } - } - } - ], - "name" : "failure" - } - ], - "emitStyle" : "const", - "name" : "APIResult", - "staticMethods" : [ - { - "abiName" : "bjs_APIResult_static_roundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundtrip", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "staticContext" : { - "enumName" : { - "_0" : "APIResult" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "APIResult", - "tsFullPath" : "APIResult" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Utils", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utils", - "tsFullPath" : "Utils" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "String", - "namespace" : [ - "Utils" - ], - "staticMethods" : [ - { - "abiName" : "bjs_Utils_String_static_uppercase", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "uppercase", - "namespace" : [ - "Utils", - "String" - ], - "parameters" : [ - { - "label" : "_", - "name" : "text", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "Utils.String" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utils.String", - "tsFullPath" : "Utils.String" - } - ], - "exposeToGlobal" : true, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json deleted file mode 100644 index 372504135..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.json +++ /dev/null @@ -1,336 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_MathUtils_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_MathUtils_static_subtract", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "subtract", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "int" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "className" : { - "_0" : "MathUtils" - } - } - }, - { - "abiName" : "bjs_MathUtils_static_add", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "add", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "int" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "className" : { - "_0" : "MathUtils" - } - } - }, - { - "abiName" : "bjs_MathUtils_multiply", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "multiply", - "parameters" : [ - { - "label" : "x", - "name" : "x", - "type" : { - "int" : { - - } - } - }, - { - "label" : "y", - "name" : "y", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - } - ], - "name" : "MathUtils", - "properties" : [ - - ], - "swiftCallName" : "MathUtils" - } - ], - "enums" : [ - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "scientific" - }, - { - "associatedValues" : [ - - ], - "name" : "basic" - } - ], - "emitStyle" : "const", - "name" : "Calculator", - "staticMethods" : [ - { - "abiName" : "bjs_Calculator_static_square", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "square", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "enumName" : { - "_0" : "Calculator" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Calculator", - "tsFullPath" : "Calculator" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "int" : { - - } - } - } - ], - "name" : "failure" - } - ], - "emitStyle" : "const", - "name" : "APIResult", - "staticMethods" : [ - { - "abiName" : "bjs_APIResult_static_roundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundtrip", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "staticContext" : { - "enumName" : { - "_0" : "APIResult" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "APIResult", - "tsFullPath" : "APIResult" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Utils", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utils", - "tsFullPath" : "Utils" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "String", - "namespace" : [ - "Utils" - ], - "staticMethods" : [ - { - "abiName" : "bjs_Utils_String_static_uppercase", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "uppercase", - "namespace" : [ - "Utils", - "String" - ], - "parameters" : [ - { - "label" : "_", - "name" : "text", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "Utils.String" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utils.String", - "tsFullPath" : "Utils.String" - } - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json deleted file mode 100644 index 28457fb63..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.json +++ /dev/null @@ -1,339 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_PropertyClass_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - - ], - "name" : "PropertyClass", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : true, - "name" : "staticConstant", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "staticVariable", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "jsObjectProperty", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "jsObject" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "classVariable", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "computedProperty", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "readOnlyComputed", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "optionalProperty", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "swiftCallName" : "PropertyClass" - } - ], - "enums" : [ - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "value1" - }, - { - "associatedValues" : [ - - ], - "name" : "value2" - } - ], - "emitStyle" : "const", - "name" : "PropertyEnum", - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "enumProperty", - "staticContext" : { - "enumName" : { - "_0" : "PropertyEnum" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "enumConstant", - "staticContext" : { - "enumName" : { - "_0" : "PropertyEnum" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "computedEnum", - "staticContext" : { - "enumName" : { - "_0" : "PropertyEnum" - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "PropertyEnum", - "tsFullPath" : "PropertyEnum" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "PropertyNamespace", - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "namespaceProperty", - "namespace" : [ - "PropertyNamespace" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "PropertyNamespace" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "namespaceConstant", - "namespace" : [ - "PropertyNamespace" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "PropertyNamespace" - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "PropertyNamespace", - "tsFullPath" : "PropertyNamespace" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Nested", - "namespace" : [ - "PropertyNamespace" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "nestedProperty", - "namespace" : [ - "PropertyNamespace", - "Nested" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "PropertyNamespace.Nested" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "nestedConstant", - "namespace" : [ - "PropertyNamespace", - "Nested" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "PropertyNamespace.Nested" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "nestedDouble", - "namespace" : [ - "PropertyNamespace", - "Nested" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "PropertyNamespace.Nested" - } - }, - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "PropertyNamespace.Nested", - "tsFullPath" : "PropertyNamespace.Nested" - } - ], - "exposeToGlobal" : true, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json deleted file mode 100644 index 829c20718..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.json +++ /dev/null @@ -1,339 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_PropertyClass_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - - ], - "name" : "PropertyClass", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : true, - "name" : "staticConstant", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "staticVariable", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "jsObjectProperty", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "jsObject" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "classVariable", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "computedProperty", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "readOnlyComputed", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "optionalProperty", - "staticContext" : { - "className" : { - "_0" : "PropertyClass" - } - }, - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "swiftCallName" : "PropertyClass" - } - ], - "enums" : [ - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "value1" - }, - { - "associatedValues" : [ - - ], - "name" : "value2" - } - ], - "emitStyle" : "const", - "name" : "PropertyEnum", - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "enumProperty", - "staticContext" : { - "enumName" : { - "_0" : "PropertyEnum" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "enumConstant", - "staticContext" : { - "enumName" : { - "_0" : "PropertyEnum" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "computedEnum", - "staticContext" : { - "enumName" : { - "_0" : "PropertyEnum" - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "PropertyEnum", - "tsFullPath" : "PropertyEnum" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "PropertyNamespace", - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "namespaceProperty", - "namespace" : [ - "PropertyNamespace" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "PropertyNamespace" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "namespaceConstant", - "namespace" : [ - "PropertyNamespace" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "PropertyNamespace" - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "PropertyNamespace", - "tsFullPath" : "PropertyNamespace" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Nested", - "namespace" : [ - "PropertyNamespace" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "nestedProperty", - "namespace" : [ - "PropertyNamespace", - "Nested" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "PropertyNamespace.Nested" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "nestedConstant", - "namespace" : [ - "PropertyNamespace", - "Nested" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "PropertyNamespace.Nested" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "nestedDouble", - "namespace" : [ - "PropertyNamespace", - "Nested" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "PropertyNamespace.Nested" - } - }, - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "PropertyNamespace.Nested", - "tsFullPath" : "PropertyNamespace.Nested" - } - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json deleted file mode 100644 index 9116fd482..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_checkString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "checkString", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_roundtripString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripString", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift deleted file mode 100644 index d980f5bc6..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift +++ /dev/null @@ -1,20 +0,0 @@ -@_expose(wasm, "bjs_checkString") -@_cdecl("bjs_checkString") -public func _bjs_checkString(_ aBytes: Int32, _ aLength: Int32) -> Void { - #if arch(wasm32) - checkString(a: String.bridgeJSLiftParameter(aBytes, aLength)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundtripString") -@_cdecl("bjs_roundtripString") -public func _bjs_roundtripString(_ aBytes: Int32, _ aLength: Int32) -> Void { - #if arch(wasm32) - let ret = roundtripString(a: String.bridgeJSLiftParameter(aBytes, aLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json deleted file mode 100644 index 01f9ca4b7..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_checkString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "checkString", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.swift deleted file mode 100644 index 1c260ec55..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.swift +++ /dev/null @@ -1,10 +0,0 @@ -@_expose(wasm, "bjs_checkString") -@_cdecl("bjs_checkString") -public func _bjs_checkString() -> Void { - #if arch(wasm32) - let ret = checkString() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json deleted file mode 100644 index b8f908c2d..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_Greeter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - } - ] - }, - "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" : { - - } - } - } - ], - "name" : "Greeter", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "Greeter" - }, - { - "explicitAccessControl" : "public", - "methods" : [ - - ], - "name" : "PublicGreeter", - "properties" : [ - - ], - "swiftCallName" : "PublicGreeter" - }, - { - "explicitAccessControl" : "package", - "methods" : [ - - ], - "name" : "PackageGreeter", - "properties" : [ - - ], - "swiftCallName" : "PackageGreeter" - } - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_takeGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeGreeter", - "parameters" : [ - { - "label" : "greeter", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json deleted file mode 100644 index 27627407b..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.json +++ /dev/null @@ -1,1075 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_Person_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - } - ] - }, - "explicitAccessControl" : "public", - "methods" : [ - - ], - "name" : "Person", - "properties" : [ - - ], - "swiftCallName" : "Person" - }, - { - "constructor" : { - "abiName" : "bjs_TestProcessor_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "transform", - "name" : "transform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSS_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_TestProcessor_getTransform", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTransform", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSS_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_TestProcessor_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" : "10TestModuleSS_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TestProcessor_printTogether", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "printTogether", - "parameters" : [ - { - "label" : "person", - "name" : "person", - "type" : { - "swiftHeapObject" : { - "_0" : "Person" - } - } - }, - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "label" : "ratio", - "name" : "ratio", - "type" : { - "double" : { - - } - } - }, - { - "label" : "customTransform", - "name" : "customTransform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSq6PersonCSqSSSqSd_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Person" - } - } - } - }, - { - "optional" : { - "_0" : { - "string" : { - - } - } - } - }, - { - "optional" : { - "_0" : { - "double" : { - - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TestProcessor_roundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtrip", - "parameters" : [ - { - "label" : "_", - "name" : "personClosure", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule6PersonC_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "swiftHeapObject" : { - "_0" : "Person" - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule6PersonC_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "swiftHeapObject" : { - "_0" : "Person" - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_TestProcessor_roundtripOptional", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripOptional", - "parameters" : [ - { - "label" : "_", - "name" : "personClosure", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSq6PersonC_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Person" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSq6PersonC_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Person" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_TestProcessor_processDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processDirection", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule9DirectionO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "caseEnum" : { - "_0" : "Direction" - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TestProcessor_processTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processTheme", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule5ThemeO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TestProcessor_processHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processHttpStatus", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule10HttpStatusO_Si", - "moduleName" : "TestModule", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - ], - "returnType" : { - "int" : { - - } - } - } - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_TestProcessor_processAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule9APIResultO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TestProcessor_makeDirectionChecker", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeDirectionChecker", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule9DirectionO_Sb", - "moduleName" : "TestModule", - "parameters" : [ - { - "caseEnum" : { - "_0" : "Direction" - } - } - ], - "returnType" : { - "bool" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_TestProcessor_makeThemeValidator", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeThemeValidator", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule5ThemeO_Sb", - "moduleName" : "TestModule", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - ], - "returnType" : { - "bool" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_TestProcessor_makeStatusCodeExtractor", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeStatusCodeExtractor", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule10HttpStatusO_Si", - "moduleName" : "TestModule", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - ], - "returnType" : { - "int" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_TestProcessor_makeAPIResultHandler", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultHandler", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule9APIResultO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_TestProcessor_processOptionalDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalDirection", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSq9DirectionO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TestProcessor_processOptionalTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalTheme", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSq5ThemeO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TestProcessor_processOptionalAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSq9APIResultO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TestProcessor_makeOptionalDirectionFormatter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeOptionalDirectionFormatter", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSq9DirectionO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "name" : "TestProcessor", - "properties" : [ - - ], - "swiftCallName" : "TestProcessor" - } - ], - "enums" : [ - { - "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" : "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" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "int" : { - - } - } - } - ], - "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" - } - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json deleted file mode 100644 index ca8f7c625..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.json +++ /dev/null @@ -1,520 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_Greeter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_Greeter_greet", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "greet", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "Greeter", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "Greeter" - } - ], - "enums" : [ - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "rough", - "rawValue" : "0.1" - }, - { - "associatedValues" : [ - - ], - "name" : "fine", - "rawValue" : "0.001" - } - ], - "emitStyle" : "const", - "name" : "Precision", - "rawType" : "Float", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Precision", - "tsFullPath" : "Precision" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_roundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtrip", - "parameters" : [ - { - "label" : "_", - "name" : "session", - "type" : { - "swiftStruct" : { - "_0" : "Person" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Person" - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - { - "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" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "label" : "optFlag", - "name" : "optFlag", - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ] - }, - "methods" : [ - - ], - "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" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optFlag", - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "swiftCallName" : "DataPoint" - }, - { - "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" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "swiftCallName" : "Address" - }, - { - "methods" : [ - - ], - "name" : "Person", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "age", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "address", - "type" : { - "swiftStruct" : { - "_0" : "Address" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "email", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "swiftCallName" : "Person" - }, - { - "methods" : [ - - ], - "name" : "Session", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "id", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "owner", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "swiftCallName" : "Session" - }, - { - "methods" : [ - - ], - "name" : "Measurement", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "value", - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "precision", - "type" : { - "rawValueEnum" : { - "_0" : "Precision", - "_1" : "Float" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optionalPrecision", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Precision", - "_1" : "Float" - } - } - } - } - } - ], - "swiftCallName" : "Measurement" - }, - { - "methods" : [ - { - "abiName" : "bjs_ConfigStruct_static_update", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "update", - "parameters" : [ - { - "label" : "_", - "name" : "timeout", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - }, - "staticContext" : { - "structName" : { - "_0" : "ConfigStruct" - } - } - } - ], - "name" : "ConfigStruct", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : true, - "name" : "maxRetries", - "staticContext" : { - "structName" : { - "_0" : "ConfigStruct" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "defaultConfig", - "staticContext" : { - "structName" : { - "_0" : "ConfigStruct" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "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" - } - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json deleted file mode 100644 index ad47cbf0b..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_throwsSomething", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsSomething", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.json deleted file mode 100644 index f38cd9440..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/UnsafePointer.json +++ /dev/null @@ -1,413 +0,0 @@ -{ - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_takeUnsafeRawPointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeUnsafeRawPointer", - "parameters" : [ - { - "label" : "_", - "name" : "p", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_takeUnsafeMutableRawPointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeUnsafeMutableRawPointer", - "parameters" : [ - { - "label" : "_", - "name" : "p", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_takeOpaquePointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeOpaquePointer", - "parameters" : [ - { - "label" : "_", - "name" : "p", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_takeUnsafePointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeUnsafePointer", - "parameters" : [ - { - "label" : "_", - "name" : "p", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_takeUnsafeMutablePointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeUnsafeMutablePointer", - "parameters" : [ - { - "label" : "_", - "name" : "p", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_returnUnsafeRawPointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "returnUnsafeRawPointer", - "parameters" : [ - - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } - } - } - }, - { - "abiName" : "bjs_returnUnsafeMutableRawPointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "returnUnsafeMutableRawPointer", - "parameters" : [ - - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } - } - } - }, - { - "abiName" : "bjs_returnOpaquePointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "returnOpaquePointer", - "parameters" : [ - - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } - } - } - }, - { - "abiName" : "bjs_returnUnsafePointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "returnUnsafePointer", - "parameters" : [ - - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" - } - } - } - }, - { - "abiName" : "bjs_returnUnsafeMutablePointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "returnUnsafeMutablePointer", - "parameters" : [ - - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" - } - } - } - }, - { - "abiName" : "bjs_roundTripPointerFields", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripPointerFields", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "PointerFields" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "PointerFields" - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - { - "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" - } - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json deleted file mode 100644 index b6b9c7bcb..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_check", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "check", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - } - ], - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.swift deleted file mode 100644 index d5bc03b15..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.swift +++ /dev/null @@ -1,9 +0,0 @@ -@_expose(wasm, "bjs_check") -@_cdecl("bjs_check") -public func _bjs_check() -> Void { - #if arch(wasm32) - check() - #else - fatalError("Only available on WebAssembly") - #endif -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift deleted file mode 100644 index 551385093..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift +++ /dev/null @@ -1,13 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSFunction func checkArray(_ a: JSObject) throws (JSException) -> Void - -@JSFunction func checkArrayWithLength(_ a: JSObject, _ b: Double) throws (JSException) -> Void - -@JSFunction func checkArray(_ a: JSObject) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift deleted file mode 100644 index 4e2cec8dc..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift +++ /dev/null @@ -1,51 +0,0 @@ -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_checkArray") -fileprivate func bjs_checkArray(_ a: Int32) -> Void -#else -fileprivate func bjs_checkArray(_ a: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$checkArray(_ a: JSObject) throws(JSException) -> Void { - let aValue = a.bridgeJSLowerParameter() - bjs_checkArray(aValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_checkArrayWithLength") -fileprivate func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void -#else -fileprivate func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void { - let aValue = a.bridgeJSLowerParameter() - let bValue = b.bridgeJSLowerParameter() - bjs_checkArrayWithLength(aValue, bValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_checkArray") -fileprivate func bjs_checkArray(_ a: Int32) -> Void -#else -fileprivate func bjs_checkArray(_ a: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$checkArray(_ a: JSObject) throws(JSException) -> Void { - let aValue = a.bridgeJSLowerParameter() - bjs_checkArray(aValue) - if let error = _swift_js_take_exception() { - throw error - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift deleted file mode 100644 index 032fcadfc..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift +++ /dev/null @@ -1,21 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSFunction func asyncReturnVoid() throws (JSException) -> JSPromise - -@JSFunction func asyncRoundTripInt(_ v: Double) throws (JSException) -> JSPromise - -@JSFunction func asyncRoundTripString(_ v: String) throws (JSException) -> JSPromise - -@JSFunction func asyncRoundTripBool(_ v: Bool) throws (JSException) -> JSPromise - -@JSFunction func asyncRoundTripFloat(_ v: Double) throws (JSException) -> JSPromise - -@JSFunction func asyncRoundTripDouble(_ v: Double) throws (JSException) -> JSPromise - -@JSFunction func asyncRoundTripJSObject(_ v: JSObject) throws (JSException) -> JSPromise diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift deleted file mode 100644 index 1cc954b0d..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift +++ /dev/null @@ -1,124 +0,0 @@ -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_asyncReturnVoid") -fileprivate func bjs_asyncReturnVoid() -> Int32 -#else -fileprivate func bjs_asyncReturnVoid() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$asyncReturnVoid() throws(JSException) -> JSPromise { - let ret = bjs_asyncReturnVoid() - if let error = _swift_js_take_exception() { - throw error - } - return JSPromise.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_asyncRoundTripInt") -fileprivate func bjs_asyncRoundTripInt(_ v: Float64) -> Int32 -#else -fileprivate func bjs_asyncRoundTripInt(_ v: Float64) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$asyncRoundTripInt(_ v: Double) throws(JSException) -> JSPromise { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_asyncRoundTripInt(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSPromise.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_asyncRoundTripString") -fileprivate func bjs_asyncRoundTripString(_ v: Int32) -> Int32 -#else -fileprivate func bjs_asyncRoundTripString(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$asyncRoundTripString(_ v: String) throws(JSException) -> JSPromise { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_asyncRoundTripString(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSPromise.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_asyncRoundTripBool") -fileprivate func bjs_asyncRoundTripBool(_ v: Int32) -> Int32 -#else -fileprivate func bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$asyncRoundTripBool(_ v: Bool) throws(JSException) -> JSPromise { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_asyncRoundTripBool(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSPromise.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_asyncRoundTripFloat") -fileprivate func bjs_asyncRoundTripFloat(_ v: Float64) -> Int32 -#else -fileprivate func bjs_asyncRoundTripFloat(_ v: Float64) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$asyncRoundTripFloat(_ v: Double) throws(JSException) -> JSPromise { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_asyncRoundTripFloat(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSPromise.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_asyncRoundTripDouble") -fileprivate func bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 -#else -fileprivate func bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$asyncRoundTripDouble(_ v: Double) throws(JSException) -> JSPromise { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_asyncRoundTripDouble(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSPromise.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_asyncRoundTripJSObject") -fileprivate func bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 -#else -fileprivate func bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$asyncRoundTripJSObject(_ v: JSObject) throws(JSException) -> JSPromise { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_asyncRoundTripJSObject(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSPromise.bridgeJSLiftReturn(ret) -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift deleted file mode 100644 index 8c60cd218..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift +++ /dev/null @@ -1,14 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSFunction func returnAnimatable() throws (JSException) -> Animatable - -@JSClass struct Animatable { - @JSFunction func animate(_ keyframes: JSObject, _ options: JSObject) throws (JSException) -> JSObject - @JSFunction func getAnimations(_ options: JSObject) throws (JSException) -> JSObject -} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift deleted file mode 100644 index fd16bd0d8..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift +++ /dev/null @@ -1,55 +0,0 @@ -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_returnAnimatable") -fileprivate func bjs_returnAnimatable() -> Int32 -#else -fileprivate func bjs_returnAnimatable() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$returnAnimatable() throws(JSException) -> Animatable { - let ret = bjs_returnAnimatable() - if let error = _swift_js_take_exception() { - throw error - } - return Animatable.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Animatable_animate") -fileprivate func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 -#else -fileprivate func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Animatable_getAnimations") -fileprivate func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 -#else -fileprivate func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$Animatable_animate(_ self: JSObject, _ keyframes: JSObject, _ options: JSObject) throws(JSException) -> JSObject { - let selfValue = self.bridgeJSLowerParameter() - let keyframesValue = keyframes.bridgeJSLowerParameter() - let optionsValue = options.bridgeJSLowerParameter() - let ret = bjs_Animatable_animate(selfValue, keyframesValue, optionsValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -func _$Animatable_getAnimations(_ self: JSObject, _ options: JSObject) throws(JSException) -> JSObject { - let selfValue = self.bridgeJSLowerParameter() - let optionsValue = options.bridgeJSLowerParameter() - let ret = bjs_Animatable_getAnimations(selfValue, optionsValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift deleted file mode 100644 index 37ccd0287..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift +++ /dev/null @@ -1,44 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSFunction func createArrayBuffer() throws (JSException) -> ArrayBufferLike - -@JSClass struct ArrayBufferLike { - @JSGetter var byteLength: Double - @JSFunction func slice(_ begin: Double, _ end: Double) throws (JSException) -> ArrayBufferLike -} - -@JSFunction func createWeirdObject() throws (JSException) -> WeirdNaming - -@JSClass struct WeirdNaming { - @JSGetter var normalProperty: String - @JSSetter func setNormalProperty(_ value: String) throws (JSException) - @JSGetter(jsName: "property-with-dashes") var property_with_dashes: Double - @JSSetter(jsName: "property-with-dashes") func setProperty_with_dashes(_ value: Double) throws (JSException) - @JSGetter(jsName: "123invalidStart") var _123invalidStart: Bool - @JSSetter(jsName: "123invalidStart") func set_123invalidStart(_ value: Bool) throws (JSException) - @JSGetter(jsName: "property with spaces") var property_with_spaces: String - @JSSetter(jsName: "property with spaces") func setProperty_with_spaces(_ value: String) throws (JSException) - @JSGetter(jsName: "@specialChar") var _specialChar: Double - @JSSetter(jsName: "@specialChar") func set_specialChar(_ value: Double) throws (JSException) - @JSGetter var constructor: String - @JSSetter func setConstructor(_ value: String) throws (JSException) - @JSGetter var `for`: String - @JSSetter func setFor(_ value: String) throws (JSException) - @JSGetter var `Any`: String - @JSSetter(jsName: "Any") func setAny(_ value: String) throws (JSException) - @JSFunction func `as`() throws (JSException) -> Void - @JSFunction func `try`() throws (JSException) -> Void -} - -@JSClass(jsName: "$Weird") struct _Weird { - @JSFunction init() throws (JSException) - @JSFunction(jsName: "method-with-dashes") func method_with_dashes() throws (JSException) -> Void -} - -@JSFunction func createWeirdClass() throws (JSException) -> _Weird diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift deleted file mode 100644 index f7b2ebc3b..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift +++ /dev/null @@ -1,33 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSFunction func createDatabaseConnection(_ config: JSObject) throws (JSException) -> DatabaseConnection - -@JSClass struct DatabaseConnection { - @JSFunction func connect(_ url: String) throws (JSException) -> Void - @JSFunction func execute(_ query: String) throws (JSException) -> JSObject - @JSGetter var isConnected: Bool - @JSGetter var connectionTimeout: Double - @JSSetter func setConnectionTimeout(_ value: Double) throws (JSException) -} - -@JSFunction func createLogger(_ level: String) throws (JSException) -> Logger - -@JSClass struct Logger { - @JSFunction func log(_ message: String) throws (JSException) -> Void - @JSFunction func error(_ message: String, _ error: JSObject) throws (JSException) -> Void - @JSGetter var level: String -} - -@JSFunction func getConfigManager() throws (JSException) -> ConfigManager - -@JSClass struct ConfigManager { - @JSFunction func get(_ key: String) throws (JSException) -> JSObject - @JSFunction func set(_ key: String, _ value: JSObject) throws (JSException) -> Void - @JSGetter var configPath: String -} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift deleted file mode 100644 index 1c1418af8..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift +++ /dev/null @@ -1,254 +0,0 @@ -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_createDatabaseConnection") -fileprivate func bjs_createDatabaseConnection(_ config: Int32) -> Int32 -#else -fileprivate func bjs_createDatabaseConnection(_ config: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$createDatabaseConnection(_ config: JSObject) throws(JSException) -> DatabaseConnection { - let configValue = config.bridgeJSLowerParameter() - let ret = bjs_createDatabaseConnection(configValue) - if let error = _swift_js_take_exception() { - throw error - } - return DatabaseConnection.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_createLogger") -fileprivate func bjs_createLogger(_ level: Int32) -> Int32 -#else -fileprivate func bjs_createLogger(_ level: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$createLogger(_ level: String) throws(JSException) -> Logger { - let levelValue = level.bridgeJSLowerParameter() - let ret = bjs_createLogger(levelValue) - if let error = _swift_js_take_exception() { - throw error - } - return Logger.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_getConfigManager") -fileprivate func bjs_getConfigManager() -> Int32 -#else -fileprivate func bjs_getConfigManager() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$getConfigManager() throws(JSException) -> ConfigManager { - let ret = bjs_getConfigManager() - if let error = _swift_js_take_exception() { - throw error - } - return ConfigManager.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_isConnected_get") -fileprivate func bjs_DatabaseConnection_isConnected_get(_ self: Int32) -> Int32 -#else -fileprivate func bjs_DatabaseConnection_isConnected_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connectionTimeout_get") -fileprivate func bjs_DatabaseConnection_connectionTimeout_get(_ self: Int32) -> Float64 -#else -fileprivate func bjs_DatabaseConnection_connectionTimeout_get(_ self: Int32) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connectionTimeout_set") -fileprivate func bjs_DatabaseConnection_connectionTimeout_set(_ self: Int32, _ newValue: Float64) -> Void -#else -fileprivate func bjs_DatabaseConnection_connectionTimeout_set(_ self: Int32, _ newValue: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connect") -fileprivate func bjs_DatabaseConnection_connect(_ self: Int32, _ url: Int32) -> Void -#else -fileprivate func bjs_DatabaseConnection_connect(_ self: Int32, _ url: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_execute") -fileprivate func bjs_DatabaseConnection_execute(_ self: Int32, _ query: Int32) -> Int32 -#else -fileprivate func bjs_DatabaseConnection_execute(_ self: Int32, _ query: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$DatabaseConnection_isConnected_get(_ self: JSObject) throws(JSException) -> Bool { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_DatabaseConnection_isConnected_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) -} - -func _$DatabaseConnection_connectionTimeout_get(_ self: JSObject) throws(JSException) -> Double { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_DatabaseConnection_connectionTimeout_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -func _$DatabaseConnection_connectionTimeout_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_DatabaseConnection_connectionTimeout_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$DatabaseConnection_connect(_ self: JSObject, _ url: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let urlValue = url.bridgeJSLowerParameter() - bjs_DatabaseConnection_connect(selfValue, urlValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$DatabaseConnection_execute(_ self: JSObject, _ query: String) throws(JSException) -> JSObject { - let selfValue = self.bridgeJSLowerParameter() - let queryValue = query.bridgeJSLowerParameter() - let ret = bjs_DatabaseConnection_execute(selfValue, queryValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Logger_level_get") -fileprivate func bjs_Logger_level_get(_ self: Int32) -> Int32 -#else -fileprivate func bjs_Logger_level_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Logger_log") -fileprivate func bjs_Logger_log(_ self: Int32, _ message: Int32) -> Void -#else -fileprivate func bjs_Logger_log(_ self: Int32, _ message: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Logger_error") -fileprivate func bjs_Logger_error(_ self: Int32, _ message: Int32, _ error: Int32) -> Void -#else -fileprivate func bjs_Logger_error(_ self: Int32, _ message: Int32, _ error: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$Logger_level_get(_ self: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Logger_level_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -func _$Logger_log(_ self: JSObject, _ message: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let messageValue = message.bridgeJSLowerParameter() - bjs_Logger_log(selfValue, messageValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$Logger_error(_ self: JSObject, _ message: String, _ error: JSObject) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let messageValue = message.bridgeJSLowerParameter() - let errorValue = error.bridgeJSLowerParameter() - bjs_Logger_error(selfValue, messageValue, errorValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_ConfigManager_configPath_get") -fileprivate func bjs_ConfigManager_configPath_get(_ self: Int32) -> Int32 -#else -fileprivate func bjs_ConfigManager_configPath_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_ConfigManager_get") -fileprivate func bjs_ConfigManager_get(_ self: Int32, _ key: Int32) -> Int32 -#else -fileprivate func bjs_ConfigManager_get(_ self: Int32, _ key: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_ConfigManager_set") -fileprivate func bjs_ConfigManager_set(_ self: Int32, _ key: Int32, _ value: Int32) -> Void -#else -fileprivate func bjs_ConfigManager_set(_ self: Int32, _ key: Int32, _ value: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$ConfigManager_configPath_get(_ self: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_ConfigManager_configPath_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -func _$ConfigManager_get(_ self: JSObject, _ key: String) throws(JSException) -> JSObject { - let selfValue = self.bridgeJSLowerParameter() - let keyValue = key.bridgeJSLowerParameter() - let ret = bjs_ConfigManager_get(selfValue, keyValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -func _$ConfigManager_set(_ self: JSObject, _ key: String, _ value: JSObject) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let keyValue = key.bridgeJSLowerParameter() - let valueValue = value.bridgeJSLowerParameter() - bjs_ConfigManager_set(selfValue, keyValue, valueValue) - if let error = _swift_js_take_exception() { - throw error - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift deleted file mode 100644 index 72f503afa..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift +++ /dev/null @@ -1,9 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSFunction func check(_ a: Double, _ b: Bool) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift deleted file mode 100644 index 6d59ca52f..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift +++ /dev/null @@ -1,17 +0,0 @@ -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_check") -fileprivate func bjs_check(_ a: Float64, _ b: Int32) -> Void -#else -fileprivate func bjs_check(_ a: Float64, _ b: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$check(_ a: Double, _ b: Bool) throws(JSException) -> Void { - let aValue = a.bridgeJSLowerParameter() - let bValue = b.bridgeJSLowerParameter() - bjs_check(aValue, bValue) - if let error = _swift_js_take_exception() { - throw error - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift deleted file mode 100644 index 1f24ec359..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift +++ /dev/null @@ -1,11 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSFunction func checkNumber() throws (JSException) -> Double - -@JSFunction func checkBoolean() throws (JSException) -> Bool diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift deleted file mode 100644 index 17f536ba5..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift +++ /dev/null @@ -1,33 +0,0 @@ -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_checkNumber") -fileprivate func bjs_checkNumber() -> Float64 -#else -fileprivate func bjs_checkNumber() -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$checkNumber() throws(JSException) -> Double { - let ret = bjs_checkNumber() - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_checkBoolean") -fileprivate func bjs_checkBoolean() -> Int32 -#else -fileprivate func bjs_checkBoolean() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$checkBoolean() throws(JSException) -> Bool { - let ret = bjs_checkBoolean() - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.Macros.swift deleted file mode 100644 index f71778e26..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.Macros.swift +++ /dev/null @@ -1,14 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSFunction func jsRoundTripNumber(_ v: Double) throws (JSException) -> Double - -@JSClass struct JsGreeter { - @JSFunction init(_ name: String) throws (JSException) - @JSFunction func greet() throws (JSException) -> String -} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.swift deleted file mode 100644 index 01c2b1e6e..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ReExportFrom.swift +++ /dev/null @@ -1,53 +0,0 @@ -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_jsRoundTripNumber") -fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 -#else -fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif - -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: "Check", name: "bjs_JsGreeter_init") -fileprivate func bjs_JsGreeter_init(_ name: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_init(_ name: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_JsGreeter_greet") -fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$JsGreeter_init(_ name: String) throws(JSException) -> JSObject { - let nameValue = name.bridgeJSLowerParameter() - let ret = bjs_JsGreeter_init(nameValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -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) -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.Macros.swift deleted file mode 100644 index 7140ecac7..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.Macros.swift +++ /dev/null @@ -1,17 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -enum FeatureFlag: String { - case foo = "foo" - case bar = "bar" -} -extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} - -@JSFunction func takesFeatureFlag(_ flag: FeatureFlag) throws (JSException) -> Void - -@JSFunction func returnsFeatureFlag() throws (JSException) -> FeatureFlag diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.swift deleted file mode 100644 index 3059865ac..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringEnum.swift +++ /dev/null @@ -1,33 +0,0 @@ -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_takesFeatureFlag") -fileprivate func bjs_takesFeatureFlag(_ flag: Int32) -> Void -#else -fileprivate func bjs_takesFeatureFlag(_ flag: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$takesFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> Void { - let flagValue = flag.bridgeJSLowerParameter() - bjs_takesFeatureFlag(flagValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_returnsFeatureFlag") -fileprivate func bjs_returnsFeatureFlag() -> Int32 -#else -fileprivate func bjs_returnsFeatureFlag() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$returnsFeatureFlag() throws(JSException) -> FeatureFlag { - let ret = bjs_returnsFeatureFlag() - if let error = _swift_js_take_exception() { - throw error - } - return FeatureFlag.bridgeJSLiftReturn(ret) -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift deleted file mode 100644 index 75ba0eefd..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift +++ /dev/null @@ -1,11 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSFunction func checkString(_ a: String) throws (JSException) -> Void - -@JSFunction func checkStringWithLength(_ a: String, _ b: Double) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift deleted file mode 100644 index c7618d7ac..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift +++ /dev/null @@ -1,9 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSFunction func checkString() throws (JSException) -> String diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftStructImports.ImportMacros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftStructImports.ImportMacros.swift deleted file mode 100644 index 54470e5de..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/SwiftStructImports.ImportMacros.swift +++ /dev/null @@ -1,19 +0,0 @@ -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_translate") -fileprivate func bjs_translate(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 -#else -fileprivate func bjs_translate(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$translate(_ point: Point, _ dx: Int, _ dy: Int) throws(JSException) -> Point { - let pointObjectId = point.bridgeJSLowerParameter() - let dxValue = dx.bridgeJSLowerParameter() - let dyValue = dy.bridgeJSLowerParameter() - let ret = bjs_translate(pointObjectId, dxValue, dyValue) - if let error = _swift_js_take_exception() { - throw error - } - return Point.bridgeJSLiftReturn(ret) -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift deleted file mode 100644 index eab06f1db..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift +++ /dev/null @@ -1,22 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSFunction func createTS2Skeleton() throws (JSException) -> TypeScriptProcessor - -@JSClass struct TypeScriptProcessor { - @JSFunction func convert(_ ts: String) throws (JSException) -> String - @JSFunction func validate(_ ts: String) throws (JSException) -> Bool - @JSGetter var version: String -} - -@JSFunction func createCodeGenerator(_ format: String) throws (JSException) -> CodeGenerator - -@JSClass struct CodeGenerator { - @JSFunction func generate(_ input: JSObject) throws (JSException) -> String - @JSGetter var outputFormat: String -} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift deleted file mode 100644 index 54d3b9156..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift +++ /dev/null @@ -1,127 +0,0 @@ -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_createTS2Skeleton") -fileprivate func bjs_createTS2Skeleton() -> Int32 -#else -fileprivate func bjs_createTS2Skeleton() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$createTS2Skeleton() throws(JSException) -> TypeScriptProcessor { - let ret = bjs_createTS2Skeleton() - if let error = _swift_js_take_exception() { - throw error - } - return TypeScriptProcessor.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_createCodeGenerator") -fileprivate func bjs_createCodeGenerator(_ format: Int32) -> Int32 -#else -fileprivate func bjs_createCodeGenerator(_ format: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$createCodeGenerator(_ format: String) throws(JSException) -> CodeGenerator { - let formatValue = format.bridgeJSLowerParameter() - let ret = bjs_createCodeGenerator(formatValue) - if let error = _swift_js_take_exception() { - throw error - } - return CodeGenerator.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_version_get") -fileprivate func bjs_TypeScriptProcessor_version_get(_ self: Int32) -> Int32 -#else -fileprivate func bjs_TypeScriptProcessor_version_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_convert") -fileprivate func bjs_TypeScriptProcessor_convert(_ self: Int32, _ ts: Int32) -> Int32 -#else -fileprivate func bjs_TypeScriptProcessor_convert(_ self: Int32, _ ts: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_validate") -fileprivate func bjs_TypeScriptProcessor_validate(_ self: Int32, _ ts: Int32) -> Int32 -#else -fileprivate func bjs_TypeScriptProcessor_validate(_ self: Int32, _ ts: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$TypeScriptProcessor_version_get(_ self: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_TypeScriptProcessor_version_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -func _$TypeScriptProcessor_convert(_ self: JSObject, _ ts: String) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let tsValue = ts.bridgeJSLowerParameter() - let ret = bjs_TypeScriptProcessor_convert(selfValue, tsValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -func _$TypeScriptProcessor_validate(_ self: JSObject, _ ts: String) throws(JSException) -> Bool { - let selfValue = self.bridgeJSLowerParameter() - let tsValue = ts.bridgeJSLowerParameter() - let ret = bjs_TypeScriptProcessor_validate(selfValue, tsValue) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_CodeGenerator_outputFormat_get") -fileprivate func bjs_CodeGenerator_outputFormat_get(_ self: Int32) -> Int32 -#else -fileprivate func bjs_CodeGenerator_outputFormat_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_CodeGenerator_generate") -fileprivate func bjs_CodeGenerator_generate(_ self: Int32, _ input: Int32) -> Int32 -#else -fileprivate func bjs_CodeGenerator_generate(_ self: Int32, _ input: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$CodeGenerator_outputFormat_get(_ self: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_CodeGenerator_outputFormat_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -func _$CodeGenerator_generate(_ self: JSObject, _ input: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let inputValue = input.bridgeJSLowerParameter() - let ret = bjs_CodeGenerator_generate(selfValue, inputValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift deleted file mode 100644 index ef9500566..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift +++ /dev/null @@ -1,9 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSFunction func checkSimple(_ a: Double) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift deleted file mode 100644 index 0b5d0c40d..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift +++ /dev/null @@ -1,16 +0,0 @@ -#if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_checkSimple") -fileprivate func bjs_checkSimple(_ a: Float64) -> Void -#else -fileprivate func bjs_checkSimple(_ a: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$checkSimple(_ a: Double) throws(JSException) -> Void { - let aValue = a.bridgeJSLowerParameter() - bjs_checkSimple(aValue) - if let error = _swift_js_take_exception() { - throw error - } -} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift deleted file mode 100644 index a0857a57e..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift +++ /dev/null @@ -1,16 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSClass struct Greeter { - @JSGetter var name: String - @JSSetter func setName(_ value: String) throws (JSException) - @JSGetter var age: Double - @JSFunction init(_ name: String) throws (JSException) - @JSFunction func greet() throws (JSException) -> String - @JSFunction func changeName(_ name: String) throws (JSException) -> Void -} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift deleted file mode 100644 index 7247e3aff..000000000 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift +++ /dev/null @@ -1,9 +0,0 @@ -// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit - -@JSFunction func check() throws (JSException) -> Void diff --git a/package-lock.json b/package-lock.json index bf7f36315..9366b618d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,8 @@ "rollup": "^4.37.0", "rollup-plugin-dts": "^6.2.1", "tslib": "^2.8.1", - "typescript": "^5.8.2" + "typescript": "^5.8.2", + "vitest": "^4.0.18" } }, "node_modules/@babel/code-frame": { @@ -51,11 +52,454 @@ "integrity": "sha512-54kpBQX69TZ8I1zyDC8sziv/zPT1zoIadv3CmdIZNZ5WDF1houMjAzRZ3dwWvhXObiEBjOxXyS8Ja7vA0EfGEQ==", "dev": true }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.2.tgz", + "integrity": "sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.2.tgz", + "integrity": "sha512-DVNI8jlPa7Ujbr1yjU2PfUSRtAUZPG9I1RwW4F4xFB1Imiu2on0ADiI/c3td+KmDtVKNbi+nffGDQMfcIMkwIA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.2.tgz", + "integrity": "sha512-pvz8ZZ7ot/RBphf8fv60ljmaoydPU12VuXHImtAs0XhLLw+EXBi2BLe3OYSBslR4rryHvweW5gmkKFwTiFy6KA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.2.tgz", + "integrity": "sha512-z8Ank4Byh4TJJOh4wpz8g2vDy75zFL0TlZlkUkEwYXuPSgX8yzep596n6mT7905kA9uHZsf/o2OJZubl2l3M7A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.2.tgz", + "integrity": "sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.2.tgz", + "integrity": "sha512-ZxtijOmlQCBWGwbVmwOF/UCzuGIbUkqB1faQRf5akQmxRJ1ujusWsb3CVfk/9iZKr2L5SMU5wPBi1UWbvL+VQA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.2.tgz", + "integrity": "sha512-lS/9CN+rgqQ9czogxlMcBMGd+l8Q3Nj1MFQwBZJyoEKI50XGxwuzznYdwcav6lpOGv5BqaZXqvBSiB/kJ5op+g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.2.tgz", + "integrity": "sha512-tAfqtNYb4YgPnJlEFu4c212HYjQWSO/w/h/lQaBK7RbwGIkBOuNKQI9tqWzx7Wtp7bTPaGC6MJvWI608P3wXYA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.2.tgz", + "integrity": "sha512-vWfq4GaIMP9AIe4yj1ZUW18RDhx6EPQKjwe7n8BbIecFtCQG4CfHGaHuh7fdfq+y3LIA2vGS/o9ZBGVxIDi9hw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.2.tgz", + "integrity": "sha512-hYxN8pr66NsCCiRFkHUAsxylNOcAQaxSSkHMMjcpx0si13t1LHFphxJZUiGwojB1a/Hd5OiPIqDdXONia6bhTw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.2.tgz", + "integrity": "sha512-MJt5BRRSScPDwG2hLelYhAAKh9imjHK5+NE/tvnRLbIqUWa+0E9N4WNMjmp/kXXPHZGqPLxggwVhz7QP8CTR8w==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.2.tgz", + "integrity": "sha512-lugyF1atnAT463aO6KPshVCJK5NgRnU4yb3FUumyVz+cGvZbontBgzeGFO1nF+dPueHD367a2ZXe1NtUkAjOtg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.2.tgz", + "integrity": "sha512-nlP2I6ArEBewvJ2gjrrkESEZkB5mIoaTswuqNFRv/WYd+ATtUpe9Y09RnJvgvdag7he0OWgEZWhviS1OTOKixw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.2.tgz", + "integrity": "sha512-C92gnpey7tUQONqg1n6dKVbx3vphKtTHJaNG2Ok9lGwbZil6DrfyecMsp9CrmXGQJmZ7iiVXvvZH6Ml5hL6XdQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.2.tgz", + "integrity": "sha512-B5BOmojNtUyN8AXlK0QJyvjEZkWwy/FKvakkTDCziX95AowLZKR6aCDhG7LeF7uMCXEJqwa8Bejz5LTPYm8AvA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.2.tgz", + "integrity": "sha512-p4bm9+wsPwup5Z8f4EpfN63qNagQ47Ua2znaqGH6bqLlmJ4bx97Y9JdqxgGZ6Y8xVTixUnEkoKSHcpRlDnNr5w==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.2.tgz", + "integrity": "sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.2.tgz", + "integrity": "sha512-Kj6DiBlwXrPsCRDeRvGAUb/LNrBASrfqAIok+xB0LxK8CHqxZ037viF13ugfsIpePH93mX7xfJp97cyDuTZ3cw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.2.tgz", + "integrity": "sha512-HwGDZ0VLVBY3Y+Nw0JexZy9o/nUAWq9MlV7cahpaXKW6TOzfVno3y3/M8Ga8u8Yr7GldLOov27xiCnqRZf0tCA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.2.tgz", + "integrity": "sha512-DNIHH2BPQ5551A7oSHD0CKbwIA/Ox7+78/AWkbS5QoRzaqlev2uFayfSxq68EkonB+IKjiuxBFoV8ESJy8bOHA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.2.tgz", + "integrity": "sha512-/it7w9Nb7+0KFIzjalNJVR5bOzA9Vay+yIPLVHfIQYG/j+j9VTH84aNB8ExGKPU4AzfaEvN9/V4HV+F+vo8OEg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.2.tgz", + "integrity": "sha512-LRBbCmiU51IXfeXk59csuX/aSaToeG7w48nMwA6049Y4J4+VbWALAuXcs+qcD04rHDuSCSRKdmY63sruDS5qag==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.2.tgz", + "integrity": "sha512-kMtx1yqJHTmqaqHPAzKCAkDaKsffmXkPHThSfRwZGyuqyIeBvf08KSsYXl+abf5HDAPMJIPnbBfXvP2ZC2TfHg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.2.tgz", + "integrity": "sha512-Yaf78O/B3Kkh+nKABUF++bvJv5Ijoy9AN1ww904rOXZFLWVc5OLOfL56W+C8F9xn5JQZa3UX6m+IktJnIb1Jjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.2.tgz", + "integrity": "sha512-Iuws0kxo4yusk7sw70Xa2E2imZU5HoixzxfGCdxwBdhiDgt9vX9VUCBhqcwY7/uh//78A1hMkkROMJq9l27oLQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.2.tgz", + "integrity": "sha512-sRdU18mcKf7F+YgheI/zGf5alZatMUTKj/jNS6l744f9u3WFu4v7twcUI9vu4mknF4Y9aDlblIie0IM+5xxaqQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" }, "node_modules/@rollup/plugin-typescript": { "version": "12.1.2", @@ -108,9 +552,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.37.0.tgz", - "integrity": "sha512-l7StVw6WAa8l3vA1ov80jyetOAEo1FtHvZDbzXDO/02Sq/QVvqlHkYoFwDJPIMj0GKiistsBudfx5tGFnwYWDQ==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.57.1.tgz", + "integrity": "sha512-A6ehUVSiSaaliTxai040ZpZ2zTevHYbvu/lDoeAteHI8QnaosIzm4qwtezfRg1jOYaUmnzLX1AOD6Z+UJjtifg==", "cpu": [ "arm" ], @@ -122,9 +566,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.37.0.tgz", - "integrity": "sha512-6U3SlVyMxezt8Y+/iEBcbp945uZjJwjZimu76xoG7tO1av9VO691z8PkhzQ85ith2I8R2RddEPeSfcbyPfD4hA==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.57.1.tgz", + "integrity": "sha512-dQaAddCY9YgkFHZcFNS/606Exo8vcLHwArFZ7vxXq4rigo2bb494/xKMMwRRQW6ug7Js6yXmBZhSBRuBvCCQ3w==", "cpu": [ "arm64" ], @@ -136,9 +580,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.37.0.tgz", - "integrity": "sha512-+iTQ5YHuGmPt10NTzEyMPbayiNTcOZDWsbxZYR1ZnmLnZxG17ivrPSWFO9j6GalY0+gV3Jtwrrs12DBscxnlYA==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.57.1.tgz", + "integrity": "sha512-crNPrwJOrRxagUYeMn/DZwqN88SDmwaJ8Cvi/TN1HnWBU7GwknckyosC2gd0IqYRsHDEnXf328o9/HC6OkPgOg==", "cpu": [ "arm64" ], @@ -150,9 +594,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.37.0.tgz", - "integrity": "sha512-m8W2UbxLDcmRKVjgl5J/k4B8d7qX2EcJve3Sut7YGrQoPtCIQGPH5AMzuFvYRWZi0FVS0zEY4c8uttPfX6bwYQ==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.57.1.tgz", + "integrity": "sha512-Ji8g8ChVbKrhFtig5QBV7iMaJrGtpHelkB3lsaKzadFBe58gmjfGXAOfI5FV0lYMH8wiqsxKQ1C9B0YTRXVy4w==", "cpu": [ "x64" ], @@ -164,9 +608,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.37.0.tgz", - "integrity": "sha512-FOMXGmH15OmtQWEt174v9P1JqqhlgYge/bUjIbiVD1nI1NeJ30HYT9SJlZMqdo1uQFyt9cz748F1BHghWaDnVA==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.57.1.tgz", + "integrity": "sha512-R+/WwhsjmwodAcz65guCGFRkMb4gKWTcIeLy60JJQbXrJ97BOXHxnkPFrP+YwFlaS0m+uWJTstrUA9o+UchFug==", "cpu": [ "arm64" ], @@ -178,9 +622,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.37.0.tgz", - "integrity": "sha512-SZMxNttjPKvV14Hjck5t70xS3l63sbVwl98g3FlVVx2YIDmfUIy29jQrsw06ewEYQ8lQSuY9mpAPlmgRD2iSsA==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.57.1.tgz", + "integrity": "sha512-IEQTCHeiTOnAUC3IDQdzRAGj3jOAYNr9kBguI7MQAAZK3caezRrg0GxAb6Hchg4lxdZEI5Oq3iov/w/hnFWY9Q==", "cpu": [ "x64" ], @@ -192,9 +636,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.37.0.tgz", - "integrity": "sha512-hhAALKJPidCwZcj+g+iN+38SIOkhK2a9bqtJR+EtyxrKKSt1ynCBeqrQy31z0oWU6thRZzdx53hVgEbRkuI19w==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.57.1.tgz", + "integrity": "sha512-F8sWbhZ7tyuEfsmOxwc2giKDQzN3+kuBLPwwZGyVkLlKGdV1nvnNwYD0fKQ8+XS6hp9nY7B+ZeK01EBUE7aHaw==", "cpu": [ "arm" ], @@ -206,9 +650,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.37.0.tgz", - "integrity": "sha512-jUb/kmn/Gd8epbHKEqkRAxq5c2EwRt0DqhSGWjPFxLeFvldFdHQs/n8lQ9x85oAeVb6bHcS8irhTJX2FCOd8Ag==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.57.1.tgz", + "integrity": "sha512-rGfNUfn0GIeXtBP1wL5MnzSj98+PZe/AXaGBCRmT0ts80lU5CATYGxXukeTX39XBKsxzFpEeK+Mrp9faXOlmrw==", "cpu": [ "arm" ], @@ -220,9 +664,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.37.0.tgz", - "integrity": "sha512-oNrJxcQT9IcbcmKlkF+Yz2tmOxZgG9D9GRq+1OE6XCQwCVwxixYAa38Z8qqPzQvzt1FCfmrHX03E0pWoXm1DqA==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.57.1.tgz", + "integrity": "sha512-MMtej3YHWeg/0klK2Qodf3yrNzz6CGjo2UntLvk2RSPlhzgLvYEB3frRvbEF2wRKh1Z2fDIg9KRPe1fawv7C+g==", "cpu": [ "arm64" ], @@ -234,9 +678,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.37.0.tgz", - "integrity": "sha512-pfxLBMls+28Ey2enpX3JvjEjaJMBX5XlPCZNGxj4kdJyHduPBXtxYeb8alo0a7bqOoWZW2uKynhHxF/MWoHaGQ==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.57.1.tgz", + "integrity": "sha512-1a/qhaaOXhqXGpMFMET9VqwZakkljWHLmZOX48R0I/YLbhdxr1m4gtG1Hq7++VhVUmf+L3sTAf9op4JlhQ5u1Q==", "cpu": [ "arm64" ], @@ -247,10 +691,24 @@ "linux" ] }, - "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.37.0.tgz", - "integrity": "sha512-yCE0NnutTC/7IGUq/PUHmoeZbIwq3KRh02e9SfFh7Vmc1Z7atuJRYWhRME5fKgT8aS20mwi1RyChA23qSyRGpA==", + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.57.1.tgz", + "integrity": "sha512-QWO6RQTZ/cqYtJMtxhkRkidoNGXc7ERPbZN7dVW5SdURuLeVU7lwKMpo18XdcmpWYd0qsP1bwKPf7DNSUinhvA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.57.1.tgz", + "integrity": "sha512-xpObYIf+8gprgWaPP32xiN5RVTi/s5FCR+XMXSKmhfoJjrpRAjCuuqQXyxUa/eJTdAE6eJ+KDKaoEqjZQxh3Gw==", "cpu": [ "loong64" ], @@ -261,10 +719,24 @@ "linux" ] }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.37.0.tgz", - "integrity": "sha512-NxcICptHk06E2Lh3a4Pu+2PEdZ6ahNHuK7o6Np9zcWkrBMuv21j10SQDJW3C9Yf/A/P7cutWoC/DptNLVsZ0VQ==", + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.57.1.tgz", + "integrity": "sha512-4BrCgrpZo4hvzMDKRqEaW1zeecScDCR+2nZ86ATLhAoJ5FQ+lbHVD3ttKe74/c7tNT9c6F2viwB3ufwp01Oh2w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.57.1.tgz", + "integrity": "sha512-NOlUuzesGauESAyEYFSe3QTUguL+lvrN1HtwEEsU2rOwdUDeTMJdO5dUYl/2hKf9jWydJrO9OL/XSSf65R5+Xw==", "cpu": [ "ppc64" ], @@ -276,9 +748,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.37.0.tgz", - "integrity": "sha512-PpWwHMPCVpFZLTfLq7EWJWvrmEuLdGn1GMYcm5MV7PaRgwCEYJAwiN94uBuZev0/J/hFIIJCsYw4nLmXA9J7Pw==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.57.1.tgz", + "integrity": "sha512-ptA88htVp0AwUUqhVghwDIKlvJMD/fmL/wrQj99PRHFRAG6Z5nbWoWG4o81Nt9FT+IuqUQi+L31ZKAFeJ5Is+A==", "cpu": [ "riscv64" ], @@ -290,9 +762,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.37.0.tgz", - "integrity": "sha512-DTNwl6a3CfhGTAOYZ4KtYbdS8b+275LSLqJVJIrPa5/JuIufWWZ/QFvkxp52gpmguN95eujrM68ZG+zVxa8zHA==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.57.1.tgz", + "integrity": "sha512-S51t7aMMTNdmAMPpBg7OOsTdn4tySRQvklmL3RpDRyknk87+Sp3xaumlatU+ppQ+5raY7sSTcC2beGgvhENfuw==", "cpu": [ "riscv64" ], @@ -304,103 +776,361 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.37.0.tgz", - "integrity": "sha512-hZDDU5fgWvDdHFuExN1gBOhCuzo/8TMpidfOR+1cPZJflcEzXdCy1LjnklQdW8/Et9sryOPJAKAQRw8Jq7Tg+A==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.57.1.tgz", + "integrity": "sha512-Bl00OFnVFkL82FHbEqy3k5CUCKH6OEJL54KCyx2oqsmZnFTR8IoNqBF+mjQVcRCT5sB6yOvK8A37LNm/kPJiZg==", "cpu": [ "s390x" ], "dev": true, "license": "MIT", - "optional": true, - "os": [ - "linux" - ] + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.57.1.tgz", + "integrity": "sha512-ABca4ceT4N+Tv/GtotnWAeXZUZuM/9AQyCyKYyKnpk4yoA7QIAuBt6Hkgpw8kActYlew2mvckXkvx0FfoInnLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.57.1.tgz", + "integrity": "sha512-HFps0JeGtuOR2convgRRkHCekD7j+gdAuXM+/i6kGzQtFhlCtQkpwtNzkNj6QhCDp7DRJ7+qC/1Vg2jt5iSOFw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.57.1.tgz", + "integrity": "sha512-H+hXEv9gdVQuDTgnqD+SQffoWoc0Of59AStSzTEj/feWTBAnSfSD3+Dql1ZruJQxmykT/JVY0dE8Ka7z0DH1hw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.57.1.tgz", + "integrity": "sha512-4wYoDpNg6o/oPximyc/NG+mYUejZrCU2q+2w6YZqrAs2UcNUChIZXjtafAiiZSUc7On8v5NyNj34Kzj/Ltk6dQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.57.1.tgz", + "integrity": "sha512-O54mtsV/6LW3P8qdTcamQmuC990HDfR71lo44oZMZlXU4tzLrbvTii87Ni9opq60ds0YzuAlEr/GNwuNluZyMQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.57.1.tgz", + "integrity": "sha512-P3dLS+IerxCT/7D2q2FYcRdWRl22dNbrbBEtxdWhXrfIMPP9lQhb5h4Du04mdl5Woq05jVCDPCMF7Ub0NAjIew==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.57.1.tgz", + "integrity": "sha512-VMBH2eOOaKGtIJYleXsi2B8CPVADrh+TyNxJ4mWPnKfLB/DBUmzW+5m1xUrcwWoMfSLagIRpjUFeW5CO5hyciQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.57.1.tgz", + "integrity": "sha512-mxRFDdHIWRxg3UfIIAwCm6NzvxG0jDX/wBN6KsQFTvKFqqg9vTrWUE68qEjHt19A5wwx5X5aUi2zuZT7YR0jrA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.13.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.14.tgz", + "integrity": "sha512-Zs/Ollc1SJ8nKUAgc7ivOEdIBM8JAKgrqqUYi2J997JuKO7/tpQC+WCetQ1sypiKCQWHdvdg9wBNpUPEWZae7w==", + "dev": true, + "peer": true, + "dependencies": { + "undici-types": "~6.20.0" + } + }, + "node_modules/@vitest/expect": { + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.0.18.tgz", + "integrity": "sha512-8sCWUyckXXYvx4opfzVY03EOiYVxyNrHS5QxX3DAIi5dpJAAkyJezHCP77VMX4HKA2LDT/Jpfo8i2r5BE3GnQQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.0.0", + "@types/chai": "^5.2.2", + "@vitest/spy": "4.0.18", + "@vitest/utils": "4.0.18", + "chai": "^6.2.1", + "tinyrainbow": "^3.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.0.18.tgz", + "integrity": "sha512-HhVd0MDnzzsgevnOWCBj5Otnzobjy5wLBe4EdeeFGv8luMsGcYqDuFRMcttKWZA5vVO8RFjexVovXvAM4JoJDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "4.0.18", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.21" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^6.0.0 || ^7.0.0-0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/mocker/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/@vitest/pretty-format": { + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.0.18.tgz", + "integrity": "sha512-P24GK3GulZWC5tz87ux0m8OADrQIUVDPIjjj65vBXYG17ZeU3qD7r+MNZ1RNv4l8CGU2vtTRqixrOi9fYk/yKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^3.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.0.18.tgz", + "integrity": "sha512-rpk9y12PGa22Jg6g5M3UVVnTS7+zycIGk9ZNGN+m6tZHKQb7jrP7/77WfZy13Y/EUDd52NDsLRQhYKtv7XfPQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "4.0.18", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.37.0.tgz", - "integrity": "sha512-pKivGpgJM5g8dwj0ywBwe/HeVAUSuVVJhUTa/URXjxvoyTT/AxsLTAbkHkDHG7qQxLoW2s3apEIl26uUe08LVQ==", - "cpu": [ - "x64" - ], + "node_modules/@vitest/snapshot": { + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.0.18.tgz", + "integrity": "sha512-PCiV0rcl7jKQjbgYqjtakly6T1uwv/5BQ9SwBLekVg/EaYeQFPiXcgrC2Y7vDMA8dM1SUEAEV82kgSQIlXNMvA==", "dev": true, "license": "MIT", - "optional": true, - "os": [ - "linux" - ] + "dependencies": { + "@vitest/pretty-format": "4.0.18", + "magic-string": "^0.30.21", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.37.0.tgz", - "integrity": "sha512-E2lPrLKE8sQbY/2bEkVTGDEk4/49UYRVWgj90MY8yPjpnGBQ+Xi1Qnr7b7UIWw1NOggdFQFOLZ8+5CzCiz143w==", - "cpu": [ - "x64" - ], + "node_modules/@vitest/spy": { + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.0.18.tgz", + "integrity": "sha512-cbQt3PTSD7P2OARdVW3qWER5EGq7PHlvE+QfzSC0lbwO+xnt7+XH06ZzFjFRgzUX//JmpxrCu92VdwvEPlWSNw==", "dev": true, "license": "MIT", - "optional": true, - "os": [ - "linux" - ] + "funding": { + "url": "https://opencollective.com/vitest" + } }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.37.0.tgz", - "integrity": "sha512-Jm7biMazjNzTU4PrQtr7VS8ibeys9Pn29/1bm4ph7CP2kf21950LgN+BaE2mJ1QujnvOc6p54eWWiVvn05SOBg==", - "cpu": [ - "arm64" - ], + "node_modules/@vitest/utils": { + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.0.18.tgz", + "integrity": "sha512-msMRKLMVLWygpK3u2Hybgi4MNjcYJvwTb0Ru09+fOyCXIgT5raYP041DRRdiJiI3k/2U6SEbAETB3YtBrUkCFA==", "dev": true, "license": "MIT", - "optional": true, - "os": [ - "win32" - ] + "dependencies": { + "@vitest/pretty-format": "4.0.18", + "tinyrainbow": "^3.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.37.0.tgz", - "integrity": "sha512-e3/1SFm1OjefWICB2Ucstg2dxYDkDTZGDYgwufcbsxTHyqQps1UQf33dFEChBNmeSsTOyrjw2JJq0zbG5GF6RA==", - "cpu": [ - "ia32" - ], + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", "dev": true, "license": "MIT", - "optional": true, - "os": [ - "win32" - ] + "engines": { + "node": ">=12" + } }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.37.0.tgz", - "integrity": "sha512-LWbXUBwn/bcLx2sSsqy7pK5o+Nr+VCoRoAohfJ5C/aBio9nfJmGQqHAhU6pwxV/RmyTk5AqdySma7uwWGlmeuA==", - "cpu": [ - "x64" - ], + "node_modules/chai": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", + "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", "dev": true, "license": "MIT", - "optional": true, - "os": [ - "win32" - ] + "engines": { + "node": ">=18" + } }, - "node_modules/@types/estree": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", - "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", "dev": true, "license": "MIT" }, - "node_modules/@types/node": { - "version": "22.13.14", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.14.tgz", - "integrity": "sha512-Zs/Ollc1SJ8nKUAgc7ivOEdIBM8JAKgrqqUYi2J997JuKO7/tpQC+WCetQ1sypiKCQWHdvdg9wBNpUPEWZae7w==", + "node_modules/esbuild": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.2.tgz", + "integrity": "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==", "dev": true, - "dependencies": { - "undici-types": "~6.20.0" + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.2", + "@esbuild/android-arm": "0.27.2", + "@esbuild/android-arm64": "0.27.2", + "@esbuild/android-x64": "0.27.2", + "@esbuild/darwin-arm64": "0.27.2", + "@esbuild/darwin-x64": "0.27.2", + "@esbuild/freebsd-arm64": "0.27.2", + "@esbuild/freebsd-x64": "0.27.2", + "@esbuild/linux-arm": "0.27.2", + "@esbuild/linux-arm64": "0.27.2", + "@esbuild/linux-ia32": "0.27.2", + "@esbuild/linux-loong64": "0.27.2", + "@esbuild/linux-mips64el": "0.27.2", + "@esbuild/linux-ppc64": "0.27.2", + "@esbuild/linux-riscv64": "0.27.2", + "@esbuild/linux-s390x": "0.27.2", + "@esbuild/linux-x64": "0.27.2", + "@esbuild/netbsd-arm64": "0.27.2", + "@esbuild/netbsd-x64": "0.27.2", + "@esbuild/openbsd-arm64": "0.27.2", + "@esbuild/openbsd-x64": "0.27.2", + "@esbuild/openharmony-arm64": "0.27.2", + "@esbuild/sunos-x64": "0.27.2", + "@esbuild/win32-arm64": "0.27.2", + "@esbuild/win32-ia32": "0.27.2", + "@esbuild/win32-x64": "0.27.2" } }, "node_modules/estree-walker": { @@ -410,6 +1140,34 @@ "dev": true, "license": "MIT" }, + "node_modules/expect-type": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz", + "integrity": "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, "node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", @@ -472,14 +1230,45 @@ "optional": true }, "node_modules/magic-string": { - "version": "0.30.17", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", - "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", "dev": true, + "license": "MIT", "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0" + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/obug": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz", + "integrity": "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT" + }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", @@ -487,17 +1276,23 @@ "dev": true, "license": "MIT" }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true, - "optional": true + "dev": true }, "node_modules/picomatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", - "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", "engines": { @@ -539,6 +1334,35 @@ "node": ">=18" } }, + "node_modules/postcss": { + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, "node_modules/prettier": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz", @@ -577,14 +1401,14 @@ } }, "node_modules/rollup": { - "version": "4.37.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.37.0.tgz", - "integrity": "sha512-iAtQy/L4QFU+rTJ1YUjXqJOJzuwEghqWzCEYD2FEghT7Gsy1VdABntrO4CLopA5IkflTyqNiLNwPcOJ3S7UKLg==", + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.57.1.tgz", + "integrity": "sha512-oQL6lgK3e2QZeQ7gcgIkS2YZPg5slw37hYufJ3edKlfQSGGm8ICoxswK15ntSzF/a8+h7ekRy7k7oWc3BQ7y8A==", "dev": true, "license": "MIT", "peer": true, "dependencies": { - "@types/estree": "1.0.6" + "@types/estree": "1.0.8" }, "bin": { "rollup": "dist/bin/rollup" @@ -594,26 +1418,31 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.37.0", - "@rollup/rollup-android-arm64": "4.37.0", - "@rollup/rollup-darwin-arm64": "4.37.0", - "@rollup/rollup-darwin-x64": "4.37.0", - "@rollup/rollup-freebsd-arm64": "4.37.0", - "@rollup/rollup-freebsd-x64": "4.37.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.37.0", - "@rollup/rollup-linux-arm-musleabihf": "4.37.0", - "@rollup/rollup-linux-arm64-gnu": "4.37.0", - "@rollup/rollup-linux-arm64-musl": "4.37.0", - "@rollup/rollup-linux-loongarch64-gnu": "4.37.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.37.0", - "@rollup/rollup-linux-riscv64-gnu": "4.37.0", - "@rollup/rollup-linux-riscv64-musl": "4.37.0", - "@rollup/rollup-linux-s390x-gnu": "4.37.0", - "@rollup/rollup-linux-x64-gnu": "4.37.0", - "@rollup/rollup-linux-x64-musl": "4.37.0", - "@rollup/rollup-win32-arm64-msvc": "4.37.0", - "@rollup/rollup-win32-ia32-msvc": "4.37.0", - "@rollup/rollup-win32-x64-msvc": "4.37.0", + "@rollup/rollup-android-arm-eabi": "4.57.1", + "@rollup/rollup-android-arm64": "4.57.1", + "@rollup/rollup-darwin-arm64": "4.57.1", + "@rollup/rollup-darwin-x64": "4.57.1", + "@rollup/rollup-freebsd-arm64": "4.57.1", + "@rollup/rollup-freebsd-x64": "4.57.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.57.1", + "@rollup/rollup-linux-arm-musleabihf": "4.57.1", + "@rollup/rollup-linux-arm64-gnu": "4.57.1", + "@rollup/rollup-linux-arm64-musl": "4.57.1", + "@rollup/rollup-linux-loong64-gnu": "4.57.1", + "@rollup/rollup-linux-loong64-musl": "4.57.1", + "@rollup/rollup-linux-ppc64-gnu": "4.57.1", + "@rollup/rollup-linux-ppc64-musl": "4.57.1", + "@rollup/rollup-linux-riscv64-gnu": "4.57.1", + "@rollup/rollup-linux-riscv64-musl": "4.57.1", + "@rollup/rollup-linux-s390x-gnu": "4.57.1", + "@rollup/rollup-linux-x64-gnu": "4.57.1", + "@rollup/rollup-linux-x64-musl": "4.57.1", + "@rollup/rollup-openbsd-x64": "4.57.1", + "@rollup/rollup-openharmony-arm64": "4.57.1", + "@rollup/rollup-win32-arm64-msvc": "4.57.1", + "@rollup/rollup-win32-ia32-msvc": "4.57.1", + "@rollup/rollup-win32-x64-gnu": "4.57.1", + "@rollup/rollup-win32-x64-msvc": "4.57.1", "fsevents": "~2.3.2" } }, @@ -639,6 +1468,37 @@ "typescript": "^4.5 || ^5.0" } }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz", + "integrity": "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==", + "dev": true, + "license": "MIT" + }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -652,6 +1512,50 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", + "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyrainbow": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.0.3.tgz", + "integrity": "sha512-PSkbLUoxOFRzJYjjxHJt9xro7D+iilgMX/C9lawzVuYiIdcihh9DXmVibBe8lmcFrRi/VzlPjBxbN7rH24q8/Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -680,6 +1584,191 @@ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", "dev": true + }, + "node_modules/vite": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz", + "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.27.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite/node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/vitest": { + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.0.18.tgz", + "integrity": "sha512-hOQuK7h0FGKgBAas7v0mSAsnvrIgAvWmRFjmzpJ7SwFHH3g1k2u37JtYwOwmEKhK6ZO3v9ggDBBm0La1LCK4uQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "4.0.18", + "@vitest/mocker": "4.0.18", + "@vitest/pretty-format": "4.0.18", + "@vitest/runner": "4.0.18", + "@vitest/snapshot": "4.0.18", + "@vitest/spy": "4.0.18", + "@vitest/utils": "4.0.18", + "es-module-lexer": "^1.7.0", + "expect-type": "^1.2.2", + "magic-string": "^0.30.21", + "obug": "^2.1.1", + "pathe": "^2.0.3", + "picomatch": "^4.0.3", + "std-env": "^3.10.0", + "tinybench": "^2.9.0", + "tinyexec": "^1.0.2", + "tinyglobby": "^0.2.15", + "tinyrainbow": "^3.0.3", + "vite": "^6.0.0 || ^7.0.0", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "4.0.18", + "@vitest/browser-preview": "4.0.18", + "@vitest/browser-webdriverio": "4.0.18", + "@vitest/ui": "4.0.18", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } } } } diff --git a/package.json b/package.json index da7d5356d..1f3f1871b 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "rollup": "^4.37.0", "rollup-plugin-dts": "^6.2.1", "tslib": "^2.8.1", - "typescript": "^5.8.2" + "typescript": "^5.8.2", + "vitest": "^4.0.18" } } From d4da0e3e7981b8b8db5b7a86d10724e3d7aab58f Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 3 Feb 2026 11:07:28 +0100 Subject: [PATCH 129/252] BridgeJS: Exception checking on protocol wrapper methods BridgeJS: Enforce throws(JSException) on @JS protocol methods --- .../Sources/BridgeJSCore/ExportSwift.swift | 4 +- .../Sources/BridgeJSCore/ImportTS.swift | 32 +-- .../BridgeJSCore/SwiftToSkeleton.swift | 9 + .../Sources/BridgeJSLink/JSGlueGen.swift | 20 +- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 1 + .../Inputs/MacroSwift/Protocol.swift | 24 +- .../BridgeJSCodegenTests/Protocol.json | 24 +- .../BridgeJSCodegenTests/Protocol.swift | 60 ++++- .../Exporting-Swift-Protocols.md | 30 +-- .../BridgeJSRuntimeTests/ExportAPITests.swift | 60 ++--- .../Generated/BridgeJS.swift | 209 +++++++++++++++--- .../Generated/JavaScript/BridgeJS.json | 40 ++-- 12 files changed, 359 insertions(+), 154 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 0c5debeac..85aeee131 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1346,7 +1346,7 @@ struct ProtocolCodegen { let builder = ImportTS.CallJSEmission( moduleName: moduleName, abiName: "_extern_\(method.name)", - context: .exportSwift + context: .exportSwiftProtocol ) try builder.lowerParameter(param: Parameter(label: nil, name: "jsObject", type: .jsObject(nil))) for param in method.parameters { @@ -1359,7 +1359,7 @@ struct ProtocolCodegen { let signature = SwiftSignatureBuilder.buildFunctionSignature( parameters: method.parameters, returnType: method.returnType, - effects: nil + effects: method.effects ) // Build extern declaration using helper function diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 7c391eea0..70dda3848 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -187,8 +187,8 @@ public struct ImportTS { body.append("let ret = \(raw: callExpr)") } - // Add exception check for ImportTS context - if context == .importTS { + // Add exception check for contexts that call INTO JavaScript + if context == .importTS || context == .exportSwiftProtocol { body.append("if let error = _swift_js_take_exception() { throw error }") } } @@ -887,7 +887,7 @@ extension BridgeType { Swift classes can only be used in @JS protocols where Swift owns the instance. """ ) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return LoweringParameterInfo(loweredParameters: [("pointer", .pointer)]) } case .swiftProtocol: @@ -896,14 +896,14 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return LoweringParameterInfo(loweredParameters: [("value", .i32)]) } case .rawValueEnum(_, let rawType): switch context { case .importTS: return LoweringParameterInfo(loweredParameters: [("value", rawType.wasmCoreType ?? .i32)]) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: // For protocol export we return .i32 for String raw value type instead of nil return LoweringParameterInfo(loweredParameters: [("value", rawType.wasmCoreType ?? .i32)]) } @@ -911,7 +911,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return LoweringParameterInfo(loweredParameters: [("caseId", .i32)]) } case .swiftStruct: @@ -919,7 +919,7 @@ extension BridgeType { case .importTS: // Swift structs are bridged as JS objects (object IDs) in imported signatures. return LoweringParameterInfo(loweredParameters: [("objectId", .i32)]) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return LoweringParameterInfo(loweredParameters: []) } case .namespaceEnum: @@ -928,7 +928,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: let wrappedInfo = try wrappedType.loweringParameterInfo(context: context) var params = [("isSome", WasmCoreType.i32)] params.append(contentsOf: wrappedInfo.loweredParameters) @@ -938,7 +938,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Array types are not yet supported in TypeScript imports") - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return LoweringParameterInfo(loweredParameters: []) } } @@ -981,7 +981,7 @@ extension BridgeType { JavaScript cannot create Swift heap objects. """ ) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return LiftingReturnInfo(valueToLift: .pointer) } case .swiftProtocol: @@ -990,14 +990,14 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return LiftingReturnInfo(valueToLift: .i32) } case .rawValueEnum(_, let rawType): switch context { case .importTS: return LiftingReturnInfo(valueToLift: rawType.wasmCoreType ?? .i32) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: // For protocol export we return .i32 for String raw value type instead of nil return LiftingReturnInfo(valueToLift: rawType.wasmCoreType ?? .i32) } @@ -1005,7 +1005,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return LiftingReturnInfo(valueToLift: .i32) } case .swiftStruct: @@ -1013,7 +1013,7 @@ extension BridgeType { case .importTS: // Swift structs are bridged as JS objects (object IDs) in imported signatures. return LiftingReturnInfo(valueToLift: .i32) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return LiftingReturnInfo(valueToLift: nil) } case .namespaceEnum: @@ -1022,7 +1022,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: let wrappedInfo = try wrappedType.liftingReturnInfo(context: context) return LiftingReturnInfo(valueToLift: wrappedInfo.valueToLift) } @@ -1030,7 +1030,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Array types are not yet supported in TypeScript imports") - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return LiftingReturnInfo(valueToLift: nil) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index b780012f0..edcb0a391 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -1608,6 +1608,15 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { return nil } + guard effects.isThrows else { + diagnose( + node: node, + message: "@JS protocol methods must be throws.", + hint: "Declare the method as 'throws(JSException)'." + ) + return nil + } + return ExportedFunction( name: name, abiName: abiName, diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 28f756a43..9a1979491 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -1477,7 +1477,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "swiftHeapObject '\(name)' can only be used in protocol exports, not in \(context)" ) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return .swiftHeapObjectLiftParameter(name) } case .swiftProtocol: return .jsObjectLiftParameter @@ -1491,7 +1491,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Optional types are not supported for imported JS functions: \(wrappedType)" ) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return try .optionalLiftParameter(wrappedType: wrappedType) } case .caseEnum: return .identity @@ -1508,7 +1508,7 @@ struct IntrinsicJSFragment: Sendable { message: "Associated value enums are not supported to be passed as parameters to imported JS functions: \(fullName)" ) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( parameters: ["caseId"], @@ -1526,7 +1526,7 @@ struct IntrinsicJSFragment: Sendable { switch context { case .importTS: return .jsObjectLiftRetainedObjectId - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( parameters: [], @@ -1558,7 +1558,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Arrays are not yet supported to be passed as parameters to imported JS functions" ) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return try arrayLift(elementType: elementType) } } @@ -1578,7 +1578,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "swiftHeapObject '\(name)' can only be used in protocol exports, not in \(context)" ) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return .swiftHeapObjectLowerReturn } case .swiftProtocol: return .jsObjectLowerReturn @@ -1589,7 +1589,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Optional types are not supported for imported JS functions: \(wrappedType)" ) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return try .optionalLowerReturn(wrappedType: wrappedType) } case .caseEnum: return .identity @@ -1606,7 +1606,7 @@ struct IntrinsicJSFragment: Sendable { message: "Associated value enums are not supported to be returned from imported JS functions: \(fullName)" ) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return associatedValueLowerReturn(fullName: fullName) } case .swiftStruct(let fullName): @@ -1614,7 +1614,7 @@ struct IntrinsicJSFragment: Sendable { case .importTS: // ImportTS expects Swift structs to come back as a retained JS object ID. return .jsObjectLowerReturn - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return swiftStructLowerReturn(fullName: fullName) } case .closure: @@ -1640,7 +1640,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Arrays are not yet supported to be returned from imported JS functions" ) - case .exportSwift: + case .exportSwift, .exportSwiftProtocol: return try arrayLower(elementType: elementType) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 5013dda66..01382e642 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -71,6 +71,7 @@ public struct ABINameGenerator { public enum BridgeContext: Sendable { case importTS case exportSwift + case exportSwiftProtocol } public struct ClosureSignature: Codable, Equatable, Hashable, Sendable { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Protocol.swift index fbbad0615..3e8df7405 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Protocol.swift @@ -47,18 +47,18 @@ import JavaScriptKit var directionOptional: Direction? { get set } var priority: Priority { get set } var priorityOptional: Priority? { get set } - func onSomethingHappened() - func onValueChanged(_ value: String) - func onCountUpdated(count: Int) -> Bool - func onLabelUpdated(_ prefix: String, _ suffix: String) - func isCountEven() -> Bool - func onHelperUpdated(_ helper: Helper) - func createHelper() -> Helper - func onOptionalHelperUpdated(_ helper: Helper?) - func createOptionalHelper() -> Helper? - func createEnum() -> ExampleEnum - func handleResult(_ result: Result) - func getResult() -> Result + func onSomethingHappened() throws(JSException) + func onValueChanged(_ value: String) throws(JSException) + func onCountUpdated(count: Int) throws(JSException) -> Bool + func onLabelUpdated(_ prefix: String, _ suffix: String) throws(JSException) + func isCountEven() throws(JSException) -> Bool + func onHelperUpdated(_ helper: Helper) throws(JSException) + func createHelper() throws(JSException) -> Helper + func onOptionalHelperUpdated(_ helper: Helper?) throws(JSException) + func createOptionalHelper() throws(JSException) -> Helper? + func createEnum() throws(JSException) -> ExampleEnum + func handleResult(_ result: Result) throws(JSException) + func getResult() throws(JSException) -> Result } @JS class MyViewController { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json index 5713a2898..2f9c27ace 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json @@ -499,7 +499,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "onSomethingHappened", "parameters" : [ @@ -516,7 +516,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "onValueChanged", "parameters" : [ @@ -541,7 +541,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "onCountUpdated", "parameters" : [ @@ -566,7 +566,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "onLabelUpdated", "parameters" : [ @@ -600,7 +600,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "isCountEven", "parameters" : [ @@ -617,7 +617,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "onHelperUpdated", "parameters" : [ @@ -642,7 +642,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "createHelper", "parameters" : [ @@ -659,7 +659,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "onOptionalHelperUpdated", "parameters" : [ @@ -688,7 +688,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "createOptionalHelper", "parameters" : [ @@ -709,7 +709,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "createEnum", "parameters" : [ @@ -727,7 +727,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "handleResult", "parameters" : [ @@ -752,7 +752,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "getResult", "parameters" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift index 21178521d..91efeda7f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift @@ -1,76 +1,112 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProtocolWrapper { let jsObject: JSObject - func onSomethingHappened() -> Void { + func onSomethingHappened() throws(JSException) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() _extern_onSomethingHappened(jsObjectValue) + if let error = _swift_js_take_exception() { + throw error + } } - func onValueChanged(_ value: String) -> Void { + func onValueChanged(_ value: String) throws(JSException) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let valueValue = value.bridgeJSLowerParameter() _extern_onValueChanged(jsObjectValue, valueValue) + if let error = _swift_js_take_exception() { + throw error + } } - func onCountUpdated(count: Int) -> Bool { + func onCountUpdated(count: Int) throws(JSException) -> Bool { let jsObjectValue = jsObject.bridgeJSLowerParameter() let countValue = count.bridgeJSLowerParameter() let ret = _extern_onCountUpdated(jsObjectValue, countValue) + if let error = _swift_js_take_exception() { + throw error + } return Bool.bridgeJSLiftReturn(ret) } - func onLabelUpdated(_ prefix: String, _ suffix: String) -> Void { + func onLabelUpdated(_ prefix: String, _ suffix: String) throws(JSException) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let prefixValue = prefix.bridgeJSLowerParameter() let suffixValue = suffix.bridgeJSLowerParameter() _extern_onLabelUpdated(jsObjectValue, prefixValue, suffixValue) + if let error = _swift_js_take_exception() { + throw error + } } - func isCountEven() -> Bool { + func isCountEven() throws(JSException) -> Bool { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_isCountEven(jsObjectValue) + if let error = _swift_js_take_exception() { + throw error + } return Bool.bridgeJSLiftReturn(ret) } - func onHelperUpdated(_ helper: Helper) -> Void { + func onHelperUpdated(_ helper: Helper) throws(JSException) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let helperPointer = helper.bridgeJSLowerParameter() _extern_onHelperUpdated(jsObjectValue, helperPointer) + if let error = _swift_js_take_exception() { + throw error + } } - func createHelper() -> Helper { + func createHelper() throws(JSException) -> Helper { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_createHelper(jsObjectValue) + if let error = _swift_js_take_exception() { + throw error + } return Helper.bridgeJSLiftReturn(ret) } - func onOptionalHelperUpdated(_ helper: Optional) -> Void { + func onOptionalHelperUpdated(_ helper: Optional) throws(JSException) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let (helperIsSome, helperPointer) = helper.bridgeJSLowerParameter() _extern_onOptionalHelperUpdated(jsObjectValue, helperIsSome, helperPointer) + if let error = _swift_js_take_exception() { + throw error + } } - func createOptionalHelper() -> Optional { + func createOptionalHelper() throws(JSException) -> Optional { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_createOptionalHelper(jsObjectValue) + if let error = _swift_js_take_exception() { + throw error + } return Optional.bridgeJSLiftReturn(ret) } - func createEnum() -> ExampleEnum { + func createEnum() throws(JSException) -> ExampleEnum { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_createEnum(jsObjectValue) + if let error = _swift_js_take_exception() { + throw error + } return ExampleEnum.bridgeJSLiftReturn(ret) } - func handleResult(_ result: Result) -> Void { + func handleResult(_ result: Result) throws(JSException) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let resultCaseId = result.bridgeJSLowerParameter() _extern_handleResult(jsObjectValue, resultCaseId) + if let error = _swift_js_take_exception() { + throw error + } } - func getResult() -> Result { + func getResult() throws(JSException) -> Result { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_getResult(jsObjectValue) + if let error = _swift_js_take_exception() { + throw error + } return Result.bridgeJSLiftReturn(ret) } diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md index 111b1f052..4b58276ea 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md @@ -15,7 +15,7 @@ When you mark a protocol with `@JS`, BridgeJS generates: ## Example: Counter Protocol -Mark a Swift protocol with `@JS` to expose it: +Mark a Swift protocol with `@JS` to expose it. Protocol methods must declare `throws(JSException)` to align with the import side error handling: ```swift import JavaScriptKit @@ -24,9 +24,9 @@ import JavaScriptKit var count: Int { get set } var name: String { get } var label: String? { get set } - func increment(by amount: Int) - func reset() - func getValue() -> Int + func increment(by amount: Int) throws(JSException) + func reset() throws(JSException) + func getValue() throws(JSException) -> Int } @JS class CounterManager { @@ -122,24 +122,24 @@ You can also implement protocols in Swift and use them from JavaScript: @JS protocol Counter { var count: Int { get set } var name: String { get } - func increment(by amount: Int) - func reset() - func getValue() -> Int + func increment(by amount: Int) throws(JSException) + func reset() throws(JSException) + func getValue() throws(JSException) -> Int } final class SwiftCounter: Counter { var count = 0 let name = "SwiftCounter" - - func increment(by amount: Int) { + + func increment(by amount: Int) throws(JSException) { count += amount } - - func reset() { + + func reset() throws(JSException) { count = 0 } - - func getValue() -> Int { + + func getValue() throws(JSException) -> Int { return count } } @@ -195,7 +195,7 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { } } - func increment(by amount: Int) { + func increment(by amount: Int) throws(JSException) { @_extern(wasm, module: "TestModule", name: "bjs_Counter_increment") func _extern_increment(this: Int32, amount: Int32) _extern_increment( @@ -212,7 +212,7 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { | Swift Feature | Status | |:--------------|:-------| -| Method requirements: `func foo(_ param: String?) -> FooClass?` | ✅ | +| Method requirements: `func foo(_ param: String?) throws(JSException) -> FooClass?` | ✅ | | Property requirements: `var property: Type { get }` / `var property: Type { get set }` | ✅ | | Optional parameters / return values in methods | ✅ | | Optional properties | ✅ | diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 711a42e2d..520fe8298 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -988,17 +988,17 @@ enum GraphOperations { var apiResult: APIResult? { get set } var helper: Greeter { get set } var optionalHelper: Greeter? { get set } - func increment(by amount: Int) - func getValue() -> Int - func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) - func getLabel() -> String - func isEven() -> Bool - func processGreeter(_ greeter: Greeter) -> String - func createGreeter() -> Greeter - func processOptionalGreeter(_ greeter: Greeter?) -> String - func createOptionalGreeter() -> Greeter? - func handleAPIResult(_ result: APIResult?) - func getAPIResult() -> APIResult? + func increment(by amount: Int) throws(JSException) + func getValue() throws(JSException) -> Int + func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) throws(JSException) + func getLabel() throws(JSException) -> String + func isEven() throws(JSException) -> Bool + func processGreeter(_ greeter: Greeter) throws(JSException) -> String + func createGreeter() throws(JSException) -> Greeter + func processOptionalGreeter(_ greeter: Greeter?) throws(JSException) -> String + func createOptionalGreeter() throws(JSException) -> Greeter? + func handleAPIResult(_ result: APIResult?) throws(JSException) + func getAPIResult() throws(JSException) -> APIResult? } @JS class DataProcessorManager { @@ -1011,33 +1011,33 @@ enum GraphOperations { self.backupProcessor = nil } - @JS func incrementByAmount(_ amount: Int) { - processor.increment(by: amount) + @JS func incrementByAmount(_ amount: Int) throws(JSException) { + try processor.increment(by: amount) } - @JS func setProcessorLabel(_ prefix: String, _ suffix: String) { - processor.setLabelElements(prefix, suffix) + @JS func setProcessorLabel(_ prefix: String, _ suffix: String) throws(JSException) { + try processor.setLabelElements(prefix, suffix) } - @JS func isProcessorEven() -> Bool { - return processor.isEven() + @JS func isProcessorEven() throws(JSException) -> Bool { + return try processor.isEven() } - @JS func getProcessorLabel() -> String { - return processor.getLabel() + @JS func getProcessorLabel() throws(JSException) -> String { + return try processor.getLabel() } - @JS func getCurrentValue() -> Int { - return processor.getValue() + @JS func getCurrentValue() throws(JSException) -> Int { + return try processor.getValue() } - @JS func incrementBoth() { - processor.increment(by: 1) - backupProcessor?.increment(by: 1) + @JS func incrementBoth() throws(JSException) { + try processor.increment(by: 1) + try backupProcessor?.increment(by: 1) } - @JS func getBackupValue() -> Int? { - return backupProcessor?.getValue() + @JS func getBackupValue() throws(JSException) -> Int? { + return try backupProcessor?.getValue() } @JS func hasBackup() -> Bool { @@ -1084,12 +1084,12 @@ enum GraphOperations { processor.httpStatus = status } - @JS func getProcessorAPIResult() -> APIResult? { - return processor.getAPIResult() + @JS func getProcessorAPIResult() throws(JSException) -> APIResult? { + return try processor.getAPIResult() } - @JS func setProcessorAPIResult(_ apiResult: APIResult?) { - processor.handleAPIResult(apiResult) + @JS func setProcessorAPIResult(_ apiResult: APIResult?) throws(JSException) { + try processor.handleAPIResult(apiResult) } } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 55a77466e..b9b7dc1dc 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -921,72 +921,105 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_S struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { let jsObject: JSObject - func increment(by amount: Int) -> Void { + func increment(by amount: Int) throws(JSException) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let amountValue = amount.bridgeJSLowerParameter() _extern_increment(jsObjectValue, amountValue) + if let error = _swift_js_take_exception() { + throw error + } } - func getValue() -> Int { + func getValue() throws(JSException) -> Int { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_getValue(jsObjectValue) + if let error = _swift_js_take_exception() { + throw error + } return Int.bridgeJSLiftReturn(ret) } - func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) -> Void { + func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) throws(JSException) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let labelPrefixValue = labelPrefix.bridgeJSLowerParameter() let labelSuffixValue = labelSuffix.bridgeJSLowerParameter() _extern_setLabelElements(jsObjectValue, labelPrefixValue, labelSuffixValue) + if let error = _swift_js_take_exception() { + throw error + } } - func getLabel() -> String { + func getLabel() throws(JSException) -> String { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_getLabel(jsObjectValue) + if let error = _swift_js_take_exception() { + throw error + } return String.bridgeJSLiftReturn(ret) } - func isEven() -> Bool { + func isEven() throws(JSException) -> Bool { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_isEven(jsObjectValue) + if let error = _swift_js_take_exception() { + throw error + } return Bool.bridgeJSLiftReturn(ret) } - func processGreeter(_ greeter: Greeter) -> String { + func processGreeter(_ greeter: Greeter) throws(JSException) -> String { let jsObjectValue = jsObject.bridgeJSLowerParameter() let greeterPointer = greeter.bridgeJSLowerParameter() let ret = _extern_processGreeter(jsObjectValue, greeterPointer) + if let error = _swift_js_take_exception() { + throw error + } return String.bridgeJSLiftReturn(ret) } - func createGreeter() -> Greeter { + func createGreeter() throws(JSException) -> Greeter { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_createGreeter(jsObjectValue) + if let error = _swift_js_take_exception() { + throw error + } return Greeter.bridgeJSLiftReturn(ret) } - func processOptionalGreeter(_ greeter: Optional) -> String { + func processOptionalGreeter(_ greeter: Optional) throws(JSException) -> String { let jsObjectValue = jsObject.bridgeJSLowerParameter() let (greeterIsSome, greeterPointer) = greeter.bridgeJSLowerParameter() let ret = _extern_processOptionalGreeter(jsObjectValue, greeterIsSome, greeterPointer) + if let error = _swift_js_take_exception() { + throw error + } return String.bridgeJSLiftReturn(ret) } - func createOptionalGreeter() -> Optional { + func createOptionalGreeter() throws(JSException) -> Optional { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_createOptionalGreeter(jsObjectValue) + if let error = _swift_js_take_exception() { + throw error + } return Optional.bridgeJSLiftReturn(ret) } - func handleAPIResult(_ result: Optional) -> Void { + func handleAPIResult(_ result: Optional) throws(JSException) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let (resultIsSome, resultCaseId) = result.bridgeJSLowerParameter() _extern_handleAPIResult(jsObjectValue, resultIsSome, resultCaseId) + if let error = _swift_js_take_exception() { + throw error + } } - func getAPIResult() -> Optional { + func getAPIResult() throws(JSException) -> Optional { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_getAPIResult(jsObjectValue) + if let error = _swift_js_take_exception() { + throw error + } return Optional.bridgeJSLiftReturn(ret) } @@ -6559,7 +6592,21 @@ public func _bjs_DataProcessorManager_init(_ processor: Int32) -> UnsafeMutableR @_cdecl("bjs_DataProcessorManager_incrementByAmount") public func _bjs_DataProcessorManager_incrementByAmount(_ _self: UnsafeMutableRawPointer, _ amount: Int32) -> Void { #if arch(wasm32) - DataProcessorManager.bridgeJSLiftParameter(_self).incrementByAmount(_: Int.bridgeJSLiftParameter(amount)) + do { + try DataProcessorManager.bridgeJSLiftParameter(_self).incrementByAmount(_: Int.bridgeJSLiftParameter(amount)) + } 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 @@ -6569,7 +6616,21 @@ public func _bjs_DataProcessorManager_incrementByAmount(_ _self: UnsafeMutableRa @_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)) + do { + try DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorLabel(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength), _: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) + } 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 @@ -6579,8 +6640,22 @@ public func _bjs_DataProcessorManager_setProcessorLabel(_ _self: UnsafeMutableRa @_cdecl("bjs_DataProcessorManager_isProcessorEven") public func _bjs_DataProcessorManager_isProcessorEven(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).isProcessorEven() - return ret.bridgeJSLowerReturn() + do { + let ret = try DataProcessorManager.bridgeJSLiftParameter(_self).isProcessorEven() + 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 @@ -6590,8 +6665,22 @@ public func _bjs_DataProcessorManager_isProcessorEven(_ _self: UnsafeMutableRawP @_cdecl("bjs_DataProcessorManager_getProcessorLabel") public func _bjs_DataProcessorManager_getProcessorLabel(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorLabel() - return ret.bridgeJSLowerReturn() + do { + let ret = try DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorLabel() + 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 @@ -6601,8 +6690,22 @@ public func _bjs_DataProcessorManager_getProcessorLabel(_ _self: UnsafeMutableRa @_cdecl("bjs_DataProcessorManager_getCurrentValue") public func _bjs_DataProcessorManager_getCurrentValue(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getCurrentValue() - return ret.bridgeJSLowerReturn() + do { + let ret = try DataProcessorManager.bridgeJSLiftParameter(_self).getCurrentValue() + 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 @@ -6612,7 +6715,21 @@ public func _bjs_DataProcessorManager_getCurrentValue(_ _self: UnsafeMutableRawP @_cdecl("bjs_DataProcessorManager_incrementBoth") public func _bjs_DataProcessorManager_incrementBoth(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - DataProcessorManager.bridgeJSLiftParameter(_self).incrementBoth() + do { + try DataProcessorManager.bridgeJSLiftParameter(_self).incrementBoth() + } 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 @@ -6622,8 +6739,22 @@ public func _bjs_DataProcessorManager_incrementBoth(_ _self: UnsafeMutableRawPoi @_cdecl("bjs_DataProcessorManager_getBackupValue") public func _bjs_DataProcessorManager_getBackupValue(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getBackupValue() - return ret.bridgeJSLowerReturn() + do { + let ret = try DataProcessorManager.bridgeJSLiftParameter(_self).getBackupValue() + 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 @@ -6749,8 +6880,22 @@ public func _bjs_DataProcessorManager_setProcessorHttpStatus(_ _self: UnsafeMuta @_cdecl("bjs_DataProcessorManager_getProcessorAPIResult") public func _bjs_DataProcessorManager_getProcessorAPIResult(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorAPIResult() - return ret.bridgeJSLowerReturn() + do { + let ret = try DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorAPIResult() + 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 @@ -6760,7 +6905,21 @@ public func _bjs_DataProcessorManager_getProcessorAPIResult(_ _self: UnsafeMutab @_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)) + do { + try DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorAPIResult(_: Optional.bridgeJSLiftParameter(apiResultIsSome, apiResultCaseId)) + } 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 diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index e31c69a51..83845dd45 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -1365,7 +1365,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "incrementByAmount", "parameters" : [ @@ -1390,7 +1390,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "setProcessorLabel", "parameters" : [ @@ -1424,7 +1424,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "isProcessorEven", "parameters" : [ @@ -1441,7 +1441,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "getProcessorLabel", "parameters" : [ @@ -1458,7 +1458,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "getCurrentValue", "parameters" : [ @@ -1475,7 +1475,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "incrementBoth", "parameters" : [ @@ -1492,7 +1492,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "getBackupValue", "parameters" : [ @@ -1784,7 +1784,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "getProcessorAPIResult", "parameters" : [ @@ -1805,7 +1805,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "setProcessorAPIResult", "parameters" : [ @@ -9844,7 +9844,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "increment", "parameters" : [ @@ -9869,7 +9869,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "getValue", "parameters" : [ @@ -9886,7 +9886,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "setLabelElements", "parameters" : [ @@ -9920,7 +9920,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "getLabel", "parameters" : [ @@ -9937,7 +9937,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "isEven", "parameters" : [ @@ -9954,7 +9954,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "processGreeter", "parameters" : [ @@ -9979,7 +9979,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "createGreeter", "parameters" : [ @@ -9996,7 +9996,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "processOptionalGreeter", "parameters" : [ @@ -10025,7 +10025,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "createOptionalGreeter", "parameters" : [ @@ -10046,7 +10046,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "handleAPIResult", "parameters" : [ @@ -10075,7 +10075,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : false + "isThrows" : true }, "name" : "getAPIResult", "parameters" : [ From 1714f28643d04ef6c078675ba61f6efede1f65ff Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 29 Jan 2026 13:58:18 +0400 Subject: [PATCH 130/252] BridgeJS: Add JSObject and @JSClass struct support for arrays and struct --- .../Sources/BridgeJSCore/ExportSwift.swift | 24 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 1 - .../Inputs/MacroSwift/ArrayTypes.swift | 5 +- .../ImportedTypeInExportedInterface.swift | 10 + .../Inputs/MacroSwift/SwiftStruct.swift | 7 + .../BridgeJSCodegenTests/ArrayTypes.json | 133 +++++++-- .../BridgeJSCodegenTests/ArrayTypes.swift | 75 +++-- .../ImportedTypeInExportedInterface.json | 131 +++++++++ .../ImportedTypeInExportedInterface.swift | 111 ++++++++ .../BridgeJSCodegenTests/SwiftStruct.json | 58 ++++ .../BridgeJSCodegenTests/SwiftStruct.swift | 60 ++++ .../BridgeJSLinkTests/ArrayTypes.d.ts | 4 +- .../BridgeJSLinkTests/ArrayTypes.js | 93 +++++- .../ImportedTypeInExportedInterface.d.ts | 7 + .../ImportedTypeInExportedInterface.js | 138 +++++++++ .../BridgeJSLinkTests/SwiftStruct.d.ts | 5 + .../BridgeJSLinkTests/SwiftStruct.js | 85 ++++++ .../Exporting-Swift/Exporting-Swift-Array.md | 2 + .../Exporting-Swift/Exporting-Swift-Struct.md | 2 + .../BridgeJSRuntimeTests/ExportAPITests.swift | 16 ++ .../Generated/BridgeJS.swift | 207 ++++++++++++++ .../Generated/JavaScript/BridgeJS.json | 264 ++++++++++++++++++ Tests/BridgeJSRuntimeTests/StructAPIs.swift | 20 ++ Tests/prelude.mjs | 56 ++++ 24 files changed, 1463 insertions(+), 51 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 85aeee131..33c455642 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -794,8 +794,10 @@ struct StackCodegen { func liftExpression(for type: BridgeType) -> ExprSyntax { switch type { case .string, .int, .uint, .bool, .float, .double, - .jsObject, .swiftStruct, .swiftHeapObject: + .jsObject(nil), .swiftStruct, .swiftHeapObject: return "\(raw: type.swiftType).bridgeJSLiftParameter()" + case .jsObject(let className?): + return "\(raw: className)(unsafelyWrapping: JSObject.bridgeJSLiftParameter())" case .unsafePointer: return "\(raw: type.swiftType).bridgeJSLiftParameter()" case .swiftProtocol(let protocolName): @@ -830,9 +832,11 @@ struct StackCodegen { func liftArrayExpression(elementType: BridgeType) -> ExprSyntax { switch elementType { case .int, .uint, .float, .double, .string, .bool, - .jsObject, .swiftStruct, .caseEnum, .swiftHeapObject, + .jsObject(nil), .swiftStruct, .caseEnum, .swiftHeapObject, .unsafePointer, .rawValueEnum, .associatedValueEnum: return "[\(raw: elementType.swiftType)].bridgeJSLiftParameter()" + case .jsObject(_?): + return liftArrayExpressionInline(elementType: elementType) case .swiftProtocol(let protocolName): return "[Any\(raw: protocolName)].bridgeJSLiftParameter()" case .optional, .array, .closure: @@ -861,9 +865,11 @@ struct StackCodegen { private func liftOptionalExpression(wrappedType: BridgeType) -> ExprSyntax { switch wrappedType { - case .string, .int, .uint, .bool, .float, .double, .jsObject, + case .string, .int, .uint, .bool, .float, .double, .jsObject(nil), .swiftStruct, .swiftHeapObject, .caseEnum, .associatedValueEnum, .rawValueEnum: return "Optional<\(raw: wrappedType.swiftType)>.bridgeJSLiftParameter()" + case .jsObject(let className?): + return "Optional.bridgeJSLiftParameter().map { \(raw: className)(unsafelyWrapping: $0) }" case .array(let elementType): let arrayLift = liftArrayExpression(elementType: elementType) let swiftTypeName = elementType.swiftType @@ -896,8 +902,10 @@ struct StackCodegen { switch type { case .string, .int, .uint, .bool, .float, .double: return ["\(raw: accessor).bridgeJSLowerStackReturn()"] - case .jsObject: + case .jsObject(nil): return ["\(raw: accessor).bridgeJSLowerStackReturn()"] + case .jsObject(_?): + return ["\(raw: accessor).jsObject.bridgeJSLowerStackReturn()"] case .swiftHeapObject, .unsafePointer, .closure: return ["\(raw: accessor).bridgeJSLowerStackReturn()"] case .swiftProtocol(let protocolName): @@ -923,9 +931,11 @@ struct StackCodegen { ) -> [CodeBlockItemSyntax] { switch elementType { case .int, .uint, .float, .double, .string, .bool, - .jsObject, .swiftStruct, .caseEnum, .swiftHeapObject, + .jsObject(nil), .swiftStruct, .caseEnum, .swiftHeapObject, .unsafePointer, .rawValueEnum, .associatedValueEnum: return ["\(raw: accessor).bridgeJSLowerReturn()"] + case .jsObject(_?): + return ["\(raw: accessor).map { $0.jsObject }.bridgeJSLowerReturn()"] case .swiftProtocol(let protocolName): return ["\(raw: accessor).map { $0 as! Any\(raw: protocolName) }.bridgeJSLowerReturn()"] case .optional, .array, .closure: @@ -1003,8 +1013,10 @@ struct StackCodegen { case .associatedValueEnum: // Push payloads via bridgeJSLowerParameter(), then push the returned case ID return ["_swift_js_push_i32(\(raw: unwrappedVar).bridgeJSLowerParameter())"] - case .jsObject: + case .jsObject(nil): return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] + case .jsObject(_?): + return ["\(raw: unwrappedVar).jsObject.bridgeJSLowerStackReturn()"] case .array(let elementType): return lowerArrayStatements(elementType: elementType, accessor: unwrappedVar, varPrefix: varPrefix) default: diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 9a1979491..791bb8a8d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -2474,7 +2474,6 @@ struct IntrinsicJSFragment: Sendable { let idVar = scope.variable("objId") printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") - cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") return [] } ) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ArrayTypes.swift index 678bc3698..c1980cbc2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ArrayTypes.swift @@ -55,6 +55,9 @@ @JS func processItemArray(_ items: [Item]) -> [Item] @JS func processNestedItemArray(_ items: [[Item]]) -> [[Item]] +@JS func processJSObjectArray(_ objects: [JSObject]) -> [JSObject] +@JS func processOptionalJSObjectArray(_ objects: [JSObject?]) -> [JSObject?] +@JS func processNestedJSObjectArray(_ objects: [[JSObject]]) -> [[JSObject]] + @JSFunction func checkArray(_ a: JSObject) throws(JSException) -> Void @JSFunction func checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void -@JSFunction func checkArray(_ a: JSObject) throws(JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ImportedTypeInExportedInterface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ImportedTypeInExportedInterface.swift index 9e3524284..db167c5a9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ImportedTypeInExportedInterface.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ImportedTypeInExportedInterface.swift @@ -5,3 +5,13 @@ @JS func makeFoo() throws(JSException) -> Foo { return try Foo() } + +@JS func processFooArray(_ foos: [Foo]) -> [Foo] +@JS func processOptionalFooArray(_ foos: [Foo?]) -> [Foo?] + +@JS struct FooContainer { + var foo: Foo + var optionalFoo: Foo? +} + +@JS func roundtripFooContainer(_ container: FooContainer) -> FooContainer diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftStruct.swift index ac316a05a..0d84f4736 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftStruct.swift @@ -53,3 +53,10 @@ @JS static var computedSetting: String { "Config: \(defaultConfig)" } @JS static func update(_ timeout: Double) -> Double } + +@JS struct Container { + var object: JSObject + var optionalObject: JSObject? +} + +@JS func roundtripContainer(_ container: Container) -> Container diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json index c90347177..7950cb66a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json @@ -945,6 +945,121 @@ } } } + }, + { + "abiName" : "bjs_processJSObjectArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processJSObjectArray", + "parameters" : [ + { + "label" : "_", + "name" : "objects", + "type" : { + "array" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsObject" : { + + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalJSObjectArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalJSObjectArray", + "parameters" : [ + { + "label" : "_", + "name" : "objects", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_processNestedJSObjectArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processNestedJSObjectArray", + "parameters" : [ + { + "label" : "_", + "name" : "objects", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + } } ], "protocols" : [ @@ -1027,24 +1142,6 @@ "returnType" : { "void" : { - } - } - }, - { - "name" : "checkArray", - "parameters" : [ - { - "name" : "a", - "type" : { - "jsObject" : { - - } - } - } - ], - "returnType" : { - "void" : { - } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift index 4452446b9..c7c80c3b2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift @@ -465,6 +465,64 @@ public func _bjs_processNestedItemArray() -> Void { #endif } +@_expose(wasm, "bjs_processJSObjectArray") +@_cdecl("bjs_processJSObjectArray") +public func _bjs_processJSObjectArray() -> Void { + #if arch(wasm32) + let ret = processJSObjectArray(_: [JSObject].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processOptionalJSObjectArray") +@_cdecl("bjs_processOptionalJSObjectArray") +public func _bjs_processOptionalJSObjectArray() -> Void { + #if arch(wasm32) + let ret = processOptionalJSObjectArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processNestedJSObjectArray") +@_cdecl("bjs_processNestedJSObjectArray") +public func _bjs_processNestedJSObjectArray() -> Void { + #if arch(wasm32) + let ret = processNestedJSObjectArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[JSObject]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([JSObject].bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_Item_deinit") @_cdecl("bjs_Item_deinit") public func _bjs_Item_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { @@ -523,21 +581,4 @@ func _$checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> V if let error = _swift_js_take_exception() { throw error } -} - -#if arch(wasm32) -@_extern(wasm, module: "TestModule", name: "bjs_checkArray") -fileprivate func bjs_checkArray(_ a: Int32) -> Void -#else -fileprivate func bjs_checkArray(_ a: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$checkArray(_ a: JSObject) throws(JSException) -> Void { - let aValue = a.bridgeJSLowerParameter() - bjs_checkArray(aValue) - if let error = _swift_js_take_exception() { - throw error - } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json index 10a18983b..c40f0dc82 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json @@ -24,13 +24,144 @@ "_0" : "Foo" } } + }, + { + "abiName" : "bjs_processFooArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processFooArray", + "parameters" : [ + { + "label" : "_", + "name" : "foos", + "type" : { + "array" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + } + } + } + }, + { + "abiName" : "bjs_processOptionalFooArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalFooArray", + "parameters" : [ + { + "label" : "_", + "name" : "foos", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundtripFooContainer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripFooContainer", + "parameters" : [ + { + "label" : "_", + "name" : "container", + "type" : { + "swiftStruct" : { + "_0" : "FooContainer" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "FooContainer" + } + } } ], "protocols" : [ ], "structs" : [ + { + "methods" : [ + ], + "name" : "FooContainer", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "foo", + "type" : { + "jsObject" : { + "_0" : "Foo" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optionalFoo", + "type" : { + "optional" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + } + } + } + } + ], + "swiftCallName" : "FooContainer" + } ] }, "imported" : { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift index 29b615b0f..6d9bee080 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift @@ -1,3 +1,54 @@ +extension FooContainer: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> FooContainer { + let optionalFoo = Optional.bridgeJSLiftParameter().map { + Foo(unsafelyWrapping: $0) + } + let foo = Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter()) + return FooContainer(foo: foo, optionalFoo: optionalFoo) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + self.foo.jsObject.bridgeJSLowerStackReturn() + let __bjs_isSome_optionalFoo = self.optionalFoo != nil + if let __bjs_unwrapped_optionalFoo = self.optionalFoo { + __bjs_unwrapped_optionalFoo.jsObject.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_optionalFoo ? 1 : 0) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_FooContainer(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + 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(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_FooContainer") +fileprivate func _bjs_struct_lift_FooContainer() -> Int32 +#else +fileprivate func _bjs_struct_lift_FooContainer() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_makeFoo") @_cdecl("bjs_makeFoo") public func _bjs_makeFoo() -> Int32 { @@ -23,6 +74,66 @@ public func _bjs_makeFoo() -> Int32 { #endif } +@_expose(wasm, "bjs_processFooArray") +@_cdecl("bjs_processFooArray") +public func _bjs_processFooArray() -> Void { + #if arch(wasm32) + let ret = processFooArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Foo] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter())) + } + __result.reverse() + return __result + }()) + ret.map { + $0.jsObject + } .bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processOptionalFooArray") +@_cdecl("bjs_processOptionalFooArray") +public func _bjs_processOptionalFooArray() -> Void { + #if arch(wasm32) + let ret = processOptionalFooArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter().map { + Foo(unsafelyWrapping: $0) + }) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.jsObject.bridgeJSLowerStackReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) + #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 +} + #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Foo_init") fileprivate func bjs_Foo_init() -> Int32 diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json index fa5f333f0..1b2dc531f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json @@ -113,6 +113,31 @@ "_0" : "Person" } } + }, + { + "abiName" : "bjs_roundtripContainer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripContainer", + "parameters" : [ + { + "label" : "_", + "name" : "container", + "type" : { + "swiftStruct" : { + "_0" : "Container" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Container" + } + } } ], "protocols" : [ @@ -516,6 +541,39 @@ } ], "swiftCallName" : "ConfigStruct" + }, + { + "methods" : [ + + ], + "name" : "Container", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "object", + "type" : { + "jsObject" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optionalObject", + "type" : { + "optional" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + ], + "swiftCallName" : "Container" } ] }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift index 9b7ddd024..ca2467249 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift @@ -388,6 +388,55 @@ public func _bjs_ConfigStruct_static_update(_ timeout: Float64) -> Float64 { #endif } +extension Container: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Container { + let optionalObject = Optional.bridgeJSLiftParameter() + let object = JSObject.bridgeJSLiftParameter() + return Container(object: object, optionalObject: optionalObject) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + self.object.bridgeJSLowerStackReturn() + let __bjs_isSome_optionalObject = self.optionalObject != nil + if let __bjs_unwrapped_optionalObject = self.optionalObject { + __bjs_unwrapped_optionalObject.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_optionalObject ? 1 : 0) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_Container(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Container())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Container") +fileprivate func _bjs_struct_lower_Container(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Container(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Container") +fileprivate func _bjs_struct_lift_Container() -> Int32 +#else +fileprivate func _bjs_struct_lift_Container() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_roundtrip") @_cdecl("bjs_roundtrip") public func _bjs_roundtrip() -> Void { @@ -399,6 +448,17 @@ public func _bjs_roundtrip() -> Void { #endif } +@_expose(wasm, "bjs_roundtripContainer") +@_cdecl("bjs_roundtripContainer") +public func _bjs_roundtripContainer() -> Void { + #if arch(wasm32) + let ret = roundtripContainer(_: Container.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_Greeter_init") @_cdecl("bjs_Greeter_init") public func _bjs_Greeter_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts index 1bb9ff18c..3316cd7c3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts @@ -62,13 +62,15 @@ export type Exports = { processNestedPointArray(points: Point[][]): Point[][]; processItemArray(items: Item[]): Item[]; processNestedItemArray(items: Item[][]): Item[][]; + processJSObjectArray(objects: any[]): any[]; + processOptionalJSObjectArray(objects: (any | null)[]): (any | null)[]; + processNestedJSObjectArray(objects: any[][]): any[][]; Direction: DirectionObject Status: StatusObject } export type Imports = { checkArray(a: any): void; checkArrayWithLength(a: any, b: number): void; - checkArray(a: any): void; } export function createInstantiator(options: { imports: Imports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 3cb11c794..da5920660 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -263,13 +263,6 @@ export async function createInstantiator(options, swift) { setException(error); } } - TestModule["bjs_checkArray"] = function bjs_checkArray(a) { - try { - imports.checkArray(swift.memory.getObject(a)); - } catch (error) { - setException(error); - } - } }, setInstance: (i) => { instance = i; @@ -850,6 +843,92 @@ export async function createInstantiator(options, swift) { for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, + processJSObjectArray: function bjs_processJSObjectArray(objects) { + const arrayCleanups = []; + for (const elem of objects) { + const objId = swift.memory.retain(elem); + tmpParamInts.push(objId); + } + tmpParamInts.push(objects.length); + instance.exports.bjs_processJSObjectArray(); + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const objId1 = tmpRetInts.pop(); + const obj = swift.memory.getObject(objId1); + swift.memory.release(objId1); + arrayResult.push(obj); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processOptionalJSObjectArray: function bjs_processOptionalJSObjectArray(objects) { + const arrayCleanups = []; + for (const elem of objects) { + const isSome = elem != null ? 1 : 0; + if (isSome) { + const objId = swift.memory.retain(elem); + tmpParamInts.push(objId); + } else { + tmpParamInts.push(0); + } + tmpParamInts.push(isSome); + } + tmpParamInts.push(objects.length); + instance.exports.bjs_processOptionalJSObjectArray(); + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const isSome1 = tmpRetInts.pop(); + let optValue; + if (isSome1 === 0) { + optValue = null; + } else { + const objId1 = tmpRetInts.pop(); + const obj = swift.memory.getObject(objId1); + swift.memory.release(objId1); + optValue = obj; + } + arrayResult.push(optValue); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processNestedJSObjectArray: function bjs_processNestedJSObjectArray(objects) { + const arrayCleanups = []; + for (const elem of objects) { + const arrayCleanups1 = []; + for (const elem1 of elem) { + const objId = swift.memory.retain(elem1); + tmpParamInts.push(objId); + } + tmpParamInts.push(elem.length); + arrayCleanups.push(() => { + for (const cleanup of arrayCleanups1) { cleanup(); } + }); + } + tmpParamInts.push(objects.length); + instance.exports.bjs_processNestedJSObjectArray(); + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const arrayLen1 = tmpRetInts.pop(); + const arrayResult1 = []; + for (let i1 = 0; i1 < arrayLen1; i1++) { + const objId1 = tmpRetInts.pop(); + const obj = swift.memory.getObject(objId1); + swift.memory.release(objId1); + arrayResult1.push(obj); + } + arrayResult1.reverse(); + arrayResult.push(arrayResult1); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, Direction: DirectionValues, Status: StatusValues, }; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts index 654b4bc04..22b4e6a1c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts @@ -4,10 +4,17 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. +export interface FooContainer { + foo: Foo; + optionalFoo: Foo | null; +} export interface Foo { } export type Exports = { makeFoo(): Foo; + processFooArray(foos: Foo[]): Foo[]; + processOptionalFooArray(foos: (Foo | null)[]): (Foo | null)[]; + roundtripFooContainer(container: FooContainer): FooContainer; } export type Imports = { Foo: { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index 094c2241d..e4ce9e8fe 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -34,6 +34,70 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const __bjs_createFooContainerHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + let id; + if (value.foo != null) { + id = swift.memory.retain(value.foo); + } else { + id = undefined; + } + tmpParamInts.push(id !== undefined ? id : 0); + const isSome = value.optionalFoo != null; + let id1; + if (isSome) { + id1 = swift.memory.retain(value.optionalFoo); + tmpParamInts.push(id1); + } else { + id1 = undefined; + tmpParamInts.push(0); + } + tmpParamInts.push(isSome ? 1 : 0); + const cleanup = () => { + if(id !== undefined && id !== 0) { + try { + swift.memory.getObject(id); + swift.memory.release(id); + } catch(e) {} + } + if(id1 !== undefined && id1 !== 0) { + try { + swift.memory.getObject(id1); + swift.memory.release(id1); + } catch(e) {} + } + }; + return { cleanup }; + }, + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const objectId = tmpRetInts.pop(); + let value; + if (objectId !== 0) { + value = swift.memory.getObject(objectId); + swift.memory.release(objectId); + } else { + value = null; + } + optional = value; + } else { + optional = null; + } + const objectId1 = tmpRetInts.pop(); + let value1; + if (objectId1 !== 0) { + value1 = swift.memory.getObject(objectId1); + swift.memory.release(objectId1); + } else { + value1 = null; + } + return { foo: value1, optionalFoo: optional }; + } + }); + }; return { /** @@ -112,6 +176,17 @@ export async function createInstantiator(options, swift) { tmpStructCleanups.pop(); } } + bjs["swift_js_struct_lower_FooContainer"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.FooContainer.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_lift_FooContainer"] = function() { + const value = structHelpers.FooContainer.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; @@ -223,6 +298,9 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { 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(); @@ -236,6 +314,66 @@ export async function createInstantiator(options, swift) { } return ret1; }, + processFooArray: function bjs_processFooArray(foos) { + const arrayCleanups = []; + for (const elem of foos) { + const objId = swift.memory.retain(elem); + tmpParamInts.push(objId); + } + tmpParamInts.push(foos.length); + instance.exports.bjs_processFooArray(); + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const objId1 = tmpRetInts.pop(); + const obj = swift.memory.getObject(objId1); + swift.memory.release(objId1); + arrayResult.push(obj); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + processOptionalFooArray: function bjs_processOptionalFooArray(foos) { + const arrayCleanups = []; + for (const elem of foos) { + const isSome = elem != null ? 1 : 0; + if (isSome) { + const objId = swift.memory.retain(elem); + tmpParamInts.push(objId); + } else { + tmpParamInts.push(0); + } + tmpParamInts.push(isSome); + } + tmpParamInts.push(foos.length); + instance.exports.bjs_processOptionalFooArray(); + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const isSome1 = tmpRetInts.pop(); + let optValue; + if (isSome1 === 0) { + optValue = null; + } else { + const objId1 = tmpRetInts.pop(); + const obj = swift.memory.getObject(objId1); + swift.memory.release(objId1); + optValue = obj; + } + arrayResult.push(optValue); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + roundtripFooContainer: function bjs_roundtripFooContainer(container) { + const { cleanup: cleanup } = structHelpers.FooContainer.lower(container); + instance.exports.bjs_roundtripFooContainer(); + const structValue = structHelpers.FooContainer.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + if (cleanup) { cleanup(); } + return structValue; + }, }; _exports = exports; return exports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts index 7769ebcbe..4a61a26e3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts @@ -39,6 +39,10 @@ export interface Measurement { } export interface ConfigStruct { } +export interface Container { + object: any; + optionalObject: any | null; +} export type PrecisionObject = typeof PrecisionValues; /// Represents a Swift heap object like a class instance or an actor instance. @@ -57,6 +61,7 @@ export type Exports = { new(name: string): Greeter; } roundtrip(session: Person): Person; + roundtripContainer(container: Container): Container; Precision: PrecisionObject DataPoint: { init(x: number, y: number, label: string, optCount: number | null, optFlag: boolean | null): DataPoint; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index a3d60d0bd..dbeb70e69 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -228,6 +228,70 @@ export async function createInstantiator(options, swift) { } }); }; + const __bjs_createContainerHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + let id; + if (value.object != null) { + id = swift.memory.retain(value.object); + } else { + id = undefined; + } + tmpParamInts.push(id !== undefined ? id : 0); + const isSome = value.optionalObject != null; + let id1; + if (isSome) { + id1 = swift.memory.retain(value.optionalObject); + tmpParamInts.push(id1); + } else { + id1 = undefined; + tmpParamInts.push(0); + } + tmpParamInts.push(isSome ? 1 : 0); + const cleanup = () => { + if(id !== undefined && id !== 0) { + try { + swift.memory.getObject(id); + swift.memory.release(id); + } catch(e) {} + } + if(id1 !== undefined && id1 !== 0) { + try { + swift.memory.getObject(id1); + swift.memory.release(id1); + } catch(e) {} + } + }; + return { cleanup }; + }, + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const objectId = tmpRetInts.pop(); + let value; + if (objectId !== 0) { + value = swift.memory.getObject(objectId); + swift.memory.release(objectId); + } else { + value = null; + } + optional = value; + } else { + optional = null; + } + const objectId1 = tmpRetInts.pop(); + let value1; + if (objectId1 !== 0) { + value1 = swift.memory.getObject(objectId1); + swift.memory.release(objectId1); + } else { + value1 = null; + } + return { object: value1, optionalObject: optional }; + } + }); + }; return { /** @@ -371,6 +435,17 @@ export async function createInstantiator(options, swift) { const value = structHelpers.ConfigStruct.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return swift.memory.retain(value); } + bjs["swift_js_struct_lower_Container"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.Container.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_lift_Container"] = function() { + const value = structHelpers.Container.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; @@ -549,6 +624,9 @@ export async function createInstantiator(options, swift) { 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) { @@ -558,6 +636,13 @@ export async function createInstantiator(options, swift) { if (cleanup) { cleanup(); } return structValue; }, + roundtripContainer: function bjs_roundtripContainer(container) { + const { cleanup: cleanup } = structHelpers.Container.lower(container); + instance.exports.bjs_roundtripContainer(); + const structValue = structHelpers.Container.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + if (cleanup) { cleanup(); } + return structValue; + }, Precision: PrecisionValues, DataPoint: { init: function(x, y, label, optCount, optFlag) { diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Array.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Array.md index fed56618f..53d008068 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Array.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Array.md @@ -119,6 +119,8 @@ const result = exports.processNumbers(original); | Struct arrays: `[MyStruct]` | ✅ | | Class arrays: `[MyClass]` | ✅ | | Enum arrays (case, raw value, associated value) | ✅ | +| `JSObject` arrays: `[JSObject]` | ✅ | +| `@JSClass struct` arrays: `[Foo]` | ✅ | | Nested arrays: `[[Int]]` | ✅ | | Optional arrays: `[Int]?` | ✅ | | Arrays of optionals: `[Int?]` | ✅ | diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md index 236b822ab..10babd9b6 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md @@ -160,6 +160,8 @@ This differs from classes, which use reference semantics and share state across | Stored fields with supported types | ✅ | | Optional fields | ✅ | | Nested structs | ✅ | +| `JSObject` fields | ✅ | +| `@JSClass struct` fields | ✅ | | Instance methods | ✅ | | Static methods | ✅ | | Static properties | ✅ | diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 520fe8298..b482fcdb1 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -1443,6 +1443,22 @@ enum GraphOperations { return processors } +@JS func roundTripJSObjectArray(_ objects: [JSObject]) -> [JSObject] { + return objects +} + +@JS func roundTripOptionalJSObjectArray(_ objects: [JSObject?]) -> [JSObject?] { + return objects +} + +@JS func roundTripFooArray(_ foos: [Foo]) -> [Foo] { + return foos +} + +@JS func roundTripOptionalFooArray(_ foos: [Foo?]) -> [Foo?] { + return foos +} + class ExportAPITests: XCTestCase { func testAll() { var hasDeinitGreeter = false diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index b9b7dc1dc..fbd913c75 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -3152,6 +3152,106 @@ public func _bjs_ConfigStruct_static_computedSetting_get() -> Void { #endif } +extension JSObjectContainer: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> JSObjectContainer { + let optionalObject = Optional.bridgeJSLiftParameter() + let object = JSObject.bridgeJSLiftParameter() + return JSObjectContainer(object: object, optionalObject: optionalObject) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + self.object.bridgeJSLowerStackReturn() + let __bjs_isSome_optionalObject = self.optionalObject != nil + if let __bjs_unwrapped_optionalObject = self.optionalObject { + __bjs_unwrapped_optionalObject.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_optionalObject ? 1 : 0) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_JSObjectContainer(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + 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(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_JSObjectContainer(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_JSObjectContainer") +fileprivate func _bjs_struct_lift_JSObjectContainer() -> Int32 +#else +fileprivate func _bjs_struct_lift_JSObjectContainer() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +extension FooContainer: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> FooContainer { + let optionalFoo = Optional.bridgeJSLiftParameter().map { + Foo(unsafelyWrapping: $0) + } + let foo = Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter()) + return FooContainer(foo: foo, optionalFoo: optionalFoo) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + self.foo.jsObject.bridgeJSLowerStackReturn() + let __bjs_isSome_optionalFoo = self.optionalFoo != nil + if let __bjs_unwrapped_optionalFoo = self.optionalFoo { + __bjs_unwrapped_optionalFoo.jsObject.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_optionalFoo ? 1 : 0) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_FooContainer(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + 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(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_FooContainer") +fileprivate func _bjs_struct_lift_FooContainer() -> Int32 +#else +fileprivate func _bjs_struct_lift_FooContainer() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_roundTripVoid") @_cdecl("bjs_roundTripVoid") public func _bjs_roundTripVoid() -> Void { @@ -5113,6 +5213,91 @@ public func _bjs_roundTripDataProcessorArrayType() -> Void { #endif } +@_expose(wasm, "bjs_roundTripJSObjectArray") +@_cdecl("bjs_roundTripJSObjectArray") +public func _bjs_roundTripJSObjectArray() -> Void { + #if arch(wasm32) + let ret = roundTripJSObjectArray(_: [JSObject].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalJSObjectArray") +@_cdecl("bjs_roundTripOptionalJSObjectArray") +public func _bjs_roundTripOptionalJSObjectArray() -> Void { + #if arch(wasm32) + let ret = roundTripOptionalJSObjectArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripFooArray") +@_cdecl("bjs_roundTripFooArray") +public func _bjs_roundTripFooArray() -> Void { + #if arch(wasm32) + let ret = roundTripFooArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Foo] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter())) + } + __result.reverse() + return __result + }()) + ret.map { + $0.jsObject + } .bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalFooArray") +@_cdecl("bjs_roundTripOptionalFooArray") +public func _bjs_roundTripOptionalFooArray() -> Void { + #if arch(wasm32) + let ret = roundTripOptionalFooArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter().map { + Foo(unsafelyWrapping: $0) + }) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.jsObject.bridgeJSLowerStackReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_roundTripPointerFields") @_cdecl("bjs_roundTripPointerFields") public func _bjs_roundTripPointerFields() -> Void { @@ -5258,6 +5443,28 @@ public func _bjs_testContainerWithStruct() -> UnsafeMutableRawPointer { #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_Greeter_init") @_cdecl("bjs_Greeter_init") public func _bjs_Greeter_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 83845dd45..646374778 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -9450,6 +9450,154 @@ } } }, + { + "abiName" : "bjs_roundTripJSObjectArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripJSObjectArray", + "parameters" : [ + { + "label" : "_", + "name" : "objects", + "type" : { + "array" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsObject" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalJSObjectArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalJSObjectArray", + "parameters" : [ + { + "label" : "_", + "name" : "objects", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripFooArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripFooArray", + "parameters" : [ + { + "label" : "_", + "name" : "foos", + "type" : { + "array" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalFooArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalFooArray", + "parameters" : [ + { + "label" : "_", + "name" : "foos", + "type" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "optional" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + } + } + } + } + } + }, { "abiName" : "bjs_roundTripPointerFields", "effects" : { @@ -9834,6 +9982,56 @@ "_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" + } + } } ], "protocols" : [ @@ -11365,6 +11563,72 @@ } ], "swiftCallName" : "ConfigStruct" + }, + { + "methods" : [ + + ], + "name" : "JSObjectContainer", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "object", + "type" : { + "jsObject" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optionalObject", + "type" : { + "optional" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + ], + "swiftCallName" : "JSObjectContainer" + }, + { + "methods" : [ + + ], + "name" : "FooContainer", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "foo", + "type" : { + "jsObject" : { + "_0" : "Foo" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optionalFoo", + "type" : { + "optional" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + } + } + } + } + ], + "swiftCallName" : "FooContainer" } ] }, diff --git a/Tests/BridgeJSRuntimeTests/StructAPIs.swift b/Tests/BridgeJSRuntimeTests/StructAPIs.swift index 5c9fed511..c7de5d137 100644 --- a/Tests/BridgeJSRuntimeTests/StructAPIs.swift +++ b/Tests/BridgeJSRuntimeTests/StructAPIs.swift @@ -214,3 +214,23 @@ @JS func testContainerWithStruct(_ point: DataPoint) -> Container { return Container(location: point, config: nil) } + +// Struct with JSObject fields +@JS struct JSObjectContainer { + var object: JSObject + var optionalObject: JSObject? +} + +@JS func roundTripJSObjectContainer(_ container: JSObjectContainer) -> JSObjectContainer { + return container +} + +// Struct with @JSClass fields (Foo is defined in ExportAPITests.swift) +@JS struct FooContainer { + var foo: Foo + var optionalFoo: Foo? +} + +@JS func roundTripFooContainer(_ container: FooContainer) -> FooContainer { + return container +} diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 684ff02fc..850b31b6e 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -1164,6 +1164,32 @@ function testStructSupport(exports) { optionalRatio: null }; assert.deepEqual(exports.roundTripMeasurementConfig(mc2), mc2); + + // Struct with JSObject field + const containerObj1 = { value: "hello", nested: { x: 1 } }; + const containerObj2 = { items: [1, 2, 3] }; + const container1 = { object: containerObj1, optionalObject: containerObj2 }; + const containerResult1 = exports.roundTripJSObjectContainer(container1); + assert.equal(containerResult1.object, containerObj1); + assert.equal(containerResult1.optionalObject, containerObj2); + + const container2 = { object: containerObj1, optionalObject: null }; + const containerResult2 = exports.roundTripJSObjectContainer(container2); + assert.equal(containerResult2.object, containerObj1); + assert.equal(containerResult2.optionalObject, null); + + // Struct with @JSClass field + const foo1 = new ImportedFoo("first"); + const foo2 = new ImportedFoo("second"); + const fooContainer1 = { foo: foo1, optionalFoo: foo2 }; + const fooContainerResult1 = exports.roundTripFooContainer(fooContainer1); + assert.equal(fooContainerResult1.foo.value, "first"); + assert.equal(fooContainerResult1.optionalFoo.value, "second"); + + const fooContainer2 = { foo: foo1, optionalFoo: null }; + const fooContainerResult2 = exports.roundTripFooContainer(fooContainer2); + assert.equal(fooContainerResult2.foo.value, "first"); + assert.equal(fooContainerResult2.optionalFoo, null); } /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ @@ -1437,6 +1463,36 @@ function testArraySupport(exports) { assert.equal(result[0].count, 1); helper1.release(); + + // JSObject arrays + const jsObj1 = { a: 1, b: "hello" }; + const jsObj2 = { x: [1, 2, 3], y: { nested: true } }; + const jsObjResult = exports.roundTripJSObjectArray([jsObj1, jsObj2]); + assert.equal(jsObjResult.length, 2); + assert.equal(jsObjResult[0], jsObj1); + assert.equal(jsObjResult[1], jsObj2); + assert.deepEqual(exports.roundTripJSObjectArray([]), []); + + const optJsResult = exports.roundTripOptionalJSObjectArray([jsObj1, null, jsObj2]); + assert.equal(optJsResult.length, 3); + assert.equal(optJsResult[0], jsObj1); + assert.equal(optJsResult[1], null); + assert.equal(optJsResult[2], jsObj2); + + // @JSClass struct arrays + const foo1 = new ImportedFoo("first"); + const foo2 = new ImportedFoo("second"); + const fooResult = exports.roundTripFooArray([foo1, foo2]); + assert.equal(fooResult.length, 2); + assert.equal(fooResult[0].value, "first"); + assert.equal(fooResult[1].value, "second"); + assert.deepEqual(exports.roundTripFooArray([]), []); + + const optFooResult = exports.roundTripOptionalFooArray([foo1, null, foo2]); + assert.equal(optFooResult.length, 3); + assert.equal(optFooResult[0].value, "first"); + assert.equal(optFooResult[1], null); + assert.equal(optFooResult[2].value, "second"); } /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ From 0662e3b2405e2f618b01e7de2989dba15afcaa22 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 3 Feb 2026 23:06:32 +0900 Subject: [PATCH 131/252] Revert "BridgeJS: Enforce throws(JSException) on @JS protocol methods" (#565) --- .../Sources/BridgeJSCore/ExportSwift.swift | 4 +- .../Sources/BridgeJSCore/ImportTS.swift | 32 +-- .../BridgeJSCore/SwiftToSkeleton.swift | 9 - .../Sources/BridgeJSLink/JSGlueGen.swift | 20 +- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 1 - .../Inputs/MacroSwift/Protocol.swift | 24 +- .../BridgeJSCodegenTests/Protocol.json | 24 +- .../BridgeJSCodegenTests/Protocol.swift | 60 +---- .../Exporting-Swift-Protocols.md | 30 +-- .../BridgeJSRuntimeTests/ExportAPITests.swift | 60 ++--- .../Generated/BridgeJS.swift | 209 +++--------------- .../Generated/JavaScript/BridgeJS.json | 40 ++-- 12 files changed, 154 insertions(+), 359 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 85aeee131..0c5debeac 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1346,7 +1346,7 @@ struct ProtocolCodegen { let builder = ImportTS.CallJSEmission( moduleName: moduleName, abiName: "_extern_\(method.name)", - context: .exportSwiftProtocol + context: .exportSwift ) try builder.lowerParameter(param: Parameter(label: nil, name: "jsObject", type: .jsObject(nil))) for param in method.parameters { @@ -1359,7 +1359,7 @@ struct ProtocolCodegen { let signature = SwiftSignatureBuilder.buildFunctionSignature( parameters: method.parameters, returnType: method.returnType, - effects: method.effects + effects: nil ) // Build extern declaration using helper function diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 70dda3848..7c391eea0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -187,8 +187,8 @@ public struct ImportTS { body.append("let ret = \(raw: callExpr)") } - // Add exception check for contexts that call INTO JavaScript - if context == .importTS || context == .exportSwiftProtocol { + // Add exception check for ImportTS context + if context == .importTS { body.append("if let error = _swift_js_take_exception() { throw error }") } } @@ -887,7 +887,7 @@ extension BridgeType { Swift classes can only be used in @JS protocols where Swift owns the instance. """ ) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return LoweringParameterInfo(loweredParameters: [("pointer", .pointer)]) } case .swiftProtocol: @@ -896,14 +896,14 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return LoweringParameterInfo(loweredParameters: [("value", .i32)]) } case .rawValueEnum(_, let rawType): switch context { case .importTS: return LoweringParameterInfo(loweredParameters: [("value", rawType.wasmCoreType ?? .i32)]) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: // For protocol export we return .i32 for String raw value type instead of nil return LoweringParameterInfo(loweredParameters: [("value", rawType.wasmCoreType ?? .i32)]) } @@ -911,7 +911,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return LoweringParameterInfo(loweredParameters: [("caseId", .i32)]) } case .swiftStruct: @@ -919,7 +919,7 @@ extension BridgeType { case .importTS: // Swift structs are bridged as JS objects (object IDs) in imported signatures. return LoweringParameterInfo(loweredParameters: [("objectId", .i32)]) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return LoweringParameterInfo(loweredParameters: []) } case .namespaceEnum: @@ -928,7 +928,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: let wrappedInfo = try wrappedType.loweringParameterInfo(context: context) var params = [("isSome", WasmCoreType.i32)] params.append(contentsOf: wrappedInfo.loweredParameters) @@ -938,7 +938,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Array types are not yet supported in TypeScript imports") - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return LoweringParameterInfo(loweredParameters: []) } } @@ -981,7 +981,7 @@ extension BridgeType { JavaScript cannot create Swift heap objects. """ ) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return LiftingReturnInfo(valueToLift: .pointer) } case .swiftProtocol: @@ -990,14 +990,14 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return LiftingReturnInfo(valueToLift: .i32) } case .rawValueEnum(_, let rawType): switch context { case .importTS: return LiftingReturnInfo(valueToLift: rawType.wasmCoreType ?? .i32) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: // For protocol export we return .i32 for String raw value type instead of nil return LiftingReturnInfo(valueToLift: rawType.wasmCoreType ?? .i32) } @@ -1005,7 +1005,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Enum types are not yet supported in TypeScript imports") - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return LiftingReturnInfo(valueToLift: .i32) } case .swiftStruct: @@ -1013,7 +1013,7 @@ extension BridgeType { case .importTS: // Swift structs are bridged as JS objects (object IDs) in imported signatures. return LiftingReturnInfo(valueToLift: .i32) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return LiftingReturnInfo(valueToLift: nil) } case .namespaceEnum: @@ -1022,7 +1022,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: let wrappedInfo = try wrappedType.liftingReturnInfo(context: context) return LiftingReturnInfo(valueToLift: wrappedInfo.valueToLift) } @@ -1030,7 +1030,7 @@ extension BridgeType { switch context { case .importTS: throw BridgeJSCoreError("Array types are not yet supported in TypeScript imports") - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return LiftingReturnInfo(valueToLift: nil) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index edcb0a391..b780012f0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -1608,15 +1608,6 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { return nil } - guard effects.isThrows else { - diagnose( - node: node, - message: "@JS protocol methods must be throws.", - hint: "Declare the method as 'throws(JSException)'." - ) - return nil - } - return ExportedFunction( name: name, abiName: abiName, diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 9a1979491..28f756a43 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -1477,7 +1477,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "swiftHeapObject '\(name)' can only be used in protocol exports, not in \(context)" ) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return .swiftHeapObjectLiftParameter(name) } case .swiftProtocol: return .jsObjectLiftParameter @@ -1491,7 +1491,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Optional types are not supported for imported JS functions: \(wrappedType)" ) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return try .optionalLiftParameter(wrappedType: wrappedType) } case .caseEnum: return .identity @@ -1508,7 +1508,7 @@ struct IntrinsicJSFragment: Sendable { message: "Associated value enums are not supported to be passed as parameters to imported JS functions: \(fullName)" ) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( parameters: ["caseId"], @@ -1526,7 +1526,7 @@ struct IntrinsicJSFragment: Sendable { switch context { case .importTS: return .jsObjectLiftRetainedObjectId - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( parameters: [], @@ -1558,7 +1558,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Arrays are not yet supported to be passed as parameters to imported JS functions" ) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return try arrayLift(elementType: elementType) } } @@ -1578,7 +1578,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "swiftHeapObject '\(name)' can only be used in protocol exports, not in \(context)" ) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return .swiftHeapObjectLowerReturn } case .swiftProtocol: return .jsObjectLowerReturn @@ -1589,7 +1589,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Optional types are not supported for imported JS functions: \(wrappedType)" ) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return try .optionalLowerReturn(wrappedType: wrappedType) } case .caseEnum: return .identity @@ -1606,7 +1606,7 @@ struct IntrinsicJSFragment: Sendable { message: "Associated value enums are not supported to be returned from imported JS functions: \(fullName)" ) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return associatedValueLowerReturn(fullName: fullName) } case .swiftStruct(let fullName): @@ -1614,7 +1614,7 @@ struct IntrinsicJSFragment: Sendable { case .importTS: // ImportTS expects Swift structs to come back as a retained JS object ID. return .jsObjectLowerReturn - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return swiftStructLowerReturn(fullName: fullName) } case .closure: @@ -1640,7 +1640,7 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Arrays are not yet supported to be returned from imported JS functions" ) - case .exportSwift, .exportSwiftProtocol: + case .exportSwift: return try arrayLower(elementType: elementType) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 01382e642..5013dda66 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -71,7 +71,6 @@ public struct ABINameGenerator { public enum BridgeContext: Sendable { case importTS case exportSwift - case exportSwiftProtocol } public struct ClosureSignature: Codable, Equatable, Hashable, Sendable { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Protocol.swift index 3e8df7405..fbbad0615 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Protocol.swift @@ -47,18 +47,18 @@ import JavaScriptKit var directionOptional: Direction? { get set } var priority: Priority { get set } var priorityOptional: Priority? { get set } - func onSomethingHappened() throws(JSException) - func onValueChanged(_ value: String) throws(JSException) - func onCountUpdated(count: Int) throws(JSException) -> Bool - func onLabelUpdated(_ prefix: String, _ suffix: String) throws(JSException) - func isCountEven() throws(JSException) -> Bool - func onHelperUpdated(_ helper: Helper) throws(JSException) - func createHelper() throws(JSException) -> Helper - func onOptionalHelperUpdated(_ helper: Helper?) throws(JSException) - func createOptionalHelper() throws(JSException) -> Helper? - func createEnum() throws(JSException) -> ExampleEnum - func handleResult(_ result: Result) throws(JSException) - func getResult() throws(JSException) -> Result + func onSomethingHappened() + func onValueChanged(_ value: String) + func onCountUpdated(count: Int) -> Bool + func onLabelUpdated(_ prefix: String, _ suffix: String) + func isCountEven() -> Bool + func onHelperUpdated(_ helper: Helper) + func createHelper() -> Helper + func onOptionalHelperUpdated(_ helper: Helper?) + func createOptionalHelper() -> Helper? + func createEnum() -> ExampleEnum + func handleResult(_ result: Result) + func getResult() -> Result } @JS class MyViewController { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json index 2f9c27ace..5713a2898 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json @@ -499,7 +499,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "onSomethingHappened", "parameters" : [ @@ -516,7 +516,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "onValueChanged", "parameters" : [ @@ -541,7 +541,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "onCountUpdated", "parameters" : [ @@ -566,7 +566,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "onLabelUpdated", "parameters" : [ @@ -600,7 +600,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "isCountEven", "parameters" : [ @@ -617,7 +617,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "onHelperUpdated", "parameters" : [ @@ -642,7 +642,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "createHelper", "parameters" : [ @@ -659,7 +659,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "onOptionalHelperUpdated", "parameters" : [ @@ -688,7 +688,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "createOptionalHelper", "parameters" : [ @@ -709,7 +709,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "createEnum", "parameters" : [ @@ -727,7 +727,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "handleResult", "parameters" : [ @@ -752,7 +752,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "getResult", "parameters" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift index 91efeda7f..21178521d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift @@ -1,112 +1,76 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProtocolWrapper { let jsObject: JSObject - func onSomethingHappened() throws(JSException) -> Void { + func onSomethingHappened() -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() _extern_onSomethingHappened(jsObjectValue) - if let error = _swift_js_take_exception() { - throw error - } } - func onValueChanged(_ value: String) throws(JSException) -> Void { + func onValueChanged(_ value: String) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let valueValue = value.bridgeJSLowerParameter() _extern_onValueChanged(jsObjectValue, valueValue) - if let error = _swift_js_take_exception() { - throw error - } } - func onCountUpdated(count: Int) throws(JSException) -> Bool { + func onCountUpdated(count: Int) -> Bool { let jsObjectValue = jsObject.bridgeJSLowerParameter() let countValue = count.bridgeJSLowerParameter() let ret = _extern_onCountUpdated(jsObjectValue, countValue) - if let error = _swift_js_take_exception() { - throw error - } return Bool.bridgeJSLiftReturn(ret) } - func onLabelUpdated(_ prefix: String, _ suffix: String) throws(JSException) -> Void { + func onLabelUpdated(_ prefix: String, _ suffix: String) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let prefixValue = prefix.bridgeJSLowerParameter() let suffixValue = suffix.bridgeJSLowerParameter() _extern_onLabelUpdated(jsObjectValue, prefixValue, suffixValue) - if let error = _swift_js_take_exception() { - throw error - } } - func isCountEven() throws(JSException) -> Bool { + func isCountEven() -> Bool { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_isCountEven(jsObjectValue) - if let error = _swift_js_take_exception() { - throw error - } return Bool.bridgeJSLiftReturn(ret) } - func onHelperUpdated(_ helper: Helper) throws(JSException) -> Void { + func onHelperUpdated(_ helper: Helper) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let helperPointer = helper.bridgeJSLowerParameter() _extern_onHelperUpdated(jsObjectValue, helperPointer) - if let error = _swift_js_take_exception() { - throw error - } } - func createHelper() throws(JSException) -> Helper { + func createHelper() -> Helper { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_createHelper(jsObjectValue) - if let error = _swift_js_take_exception() { - throw error - } return Helper.bridgeJSLiftReturn(ret) } - func onOptionalHelperUpdated(_ helper: Optional) throws(JSException) -> Void { + func onOptionalHelperUpdated(_ helper: Optional) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let (helperIsSome, helperPointer) = helper.bridgeJSLowerParameter() _extern_onOptionalHelperUpdated(jsObjectValue, helperIsSome, helperPointer) - if let error = _swift_js_take_exception() { - throw error - } } - func createOptionalHelper() throws(JSException) -> Optional { + func createOptionalHelper() -> Optional { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_createOptionalHelper(jsObjectValue) - if let error = _swift_js_take_exception() { - throw error - } return Optional.bridgeJSLiftReturn(ret) } - func createEnum() throws(JSException) -> ExampleEnum { + func createEnum() -> ExampleEnum { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_createEnum(jsObjectValue) - if let error = _swift_js_take_exception() { - throw error - } return ExampleEnum.bridgeJSLiftReturn(ret) } - func handleResult(_ result: Result) throws(JSException) -> Void { + func handleResult(_ result: Result) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let resultCaseId = result.bridgeJSLowerParameter() _extern_handleResult(jsObjectValue, resultCaseId) - if let error = _swift_js_take_exception() { - throw error - } } - func getResult() throws(JSException) -> Result { + func getResult() -> Result { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_getResult(jsObjectValue) - if let error = _swift_js_take_exception() { - throw error - } return Result.bridgeJSLiftReturn(ret) } diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md index 4b58276ea..111b1f052 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md @@ -15,7 +15,7 @@ When you mark a protocol with `@JS`, BridgeJS generates: ## Example: Counter Protocol -Mark a Swift protocol with `@JS` to expose it. Protocol methods must declare `throws(JSException)` to align with the import side error handling: +Mark a Swift protocol with `@JS` to expose it: ```swift import JavaScriptKit @@ -24,9 +24,9 @@ import JavaScriptKit var count: Int { get set } var name: String { get } var label: String? { get set } - func increment(by amount: Int) throws(JSException) - func reset() throws(JSException) - func getValue() throws(JSException) -> Int + func increment(by amount: Int) + func reset() + func getValue() -> Int } @JS class CounterManager { @@ -122,24 +122,24 @@ You can also implement protocols in Swift and use them from JavaScript: @JS protocol Counter { var count: Int { get set } var name: String { get } - func increment(by amount: Int) throws(JSException) - func reset() throws(JSException) - func getValue() throws(JSException) -> Int + func increment(by amount: Int) + func reset() + func getValue() -> Int } final class SwiftCounter: Counter { var count = 0 let name = "SwiftCounter" - - func increment(by amount: Int) throws(JSException) { + + func increment(by amount: Int) { count += amount } - - func reset() throws(JSException) { + + func reset() { count = 0 } - - func getValue() throws(JSException) -> Int { + + func getValue() -> Int { return count } } @@ -195,7 +195,7 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { } } - func increment(by amount: Int) throws(JSException) { + func increment(by amount: Int) { @_extern(wasm, module: "TestModule", name: "bjs_Counter_increment") func _extern_increment(this: Int32, amount: Int32) _extern_increment( @@ -212,7 +212,7 @@ struct AnyCounter: Counter, _BridgedSwiftProtocolWrapper { | Swift Feature | Status | |:--------------|:-------| -| Method requirements: `func foo(_ param: String?) throws(JSException) -> FooClass?` | ✅ | +| Method requirements: `func foo(_ param: String?) -> FooClass?` | ✅ | | Property requirements: `var property: Type { get }` / `var property: Type { get set }` | ✅ | | Optional parameters / return values in methods | ✅ | | Optional properties | ✅ | diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 520fe8298..711a42e2d 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -988,17 +988,17 @@ enum GraphOperations { var apiResult: APIResult? { get set } var helper: Greeter { get set } var optionalHelper: Greeter? { get set } - func increment(by amount: Int) throws(JSException) - func getValue() throws(JSException) -> Int - func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) throws(JSException) - func getLabel() throws(JSException) -> String - func isEven() throws(JSException) -> Bool - func processGreeter(_ greeter: Greeter) throws(JSException) -> String - func createGreeter() throws(JSException) -> Greeter - func processOptionalGreeter(_ greeter: Greeter?) throws(JSException) -> String - func createOptionalGreeter() throws(JSException) -> Greeter? - func handleAPIResult(_ result: APIResult?) throws(JSException) - func getAPIResult() throws(JSException) -> APIResult? + func increment(by amount: Int) + func getValue() -> Int + func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) + func getLabel() -> String + func isEven() -> Bool + func processGreeter(_ greeter: Greeter) -> String + func createGreeter() -> Greeter + func processOptionalGreeter(_ greeter: Greeter?) -> String + func createOptionalGreeter() -> Greeter? + func handleAPIResult(_ result: APIResult?) + func getAPIResult() -> APIResult? } @JS class DataProcessorManager { @@ -1011,33 +1011,33 @@ enum GraphOperations { self.backupProcessor = nil } - @JS func incrementByAmount(_ amount: Int) throws(JSException) { - try processor.increment(by: amount) + @JS func incrementByAmount(_ amount: Int) { + processor.increment(by: amount) } - @JS func setProcessorLabel(_ prefix: String, _ suffix: String) throws(JSException) { - try processor.setLabelElements(prefix, suffix) + @JS func setProcessorLabel(_ prefix: String, _ suffix: String) { + processor.setLabelElements(prefix, suffix) } - @JS func isProcessorEven() throws(JSException) -> Bool { - return try processor.isEven() + @JS func isProcessorEven() -> Bool { + return processor.isEven() } - @JS func getProcessorLabel() throws(JSException) -> String { - return try processor.getLabel() + @JS func getProcessorLabel() -> String { + return processor.getLabel() } - @JS func getCurrentValue() throws(JSException) -> Int { - return try processor.getValue() + @JS func getCurrentValue() -> Int { + return processor.getValue() } - @JS func incrementBoth() throws(JSException) { - try processor.increment(by: 1) - try backupProcessor?.increment(by: 1) + @JS func incrementBoth() { + processor.increment(by: 1) + backupProcessor?.increment(by: 1) } - @JS func getBackupValue() throws(JSException) -> Int? { - return try backupProcessor?.getValue() + @JS func getBackupValue() -> Int? { + return backupProcessor?.getValue() } @JS func hasBackup() -> Bool { @@ -1084,12 +1084,12 @@ enum GraphOperations { processor.httpStatus = status } - @JS func getProcessorAPIResult() throws(JSException) -> APIResult? { - return try processor.getAPIResult() + @JS func getProcessorAPIResult() -> APIResult? { + return processor.getAPIResult() } - @JS func setProcessorAPIResult(_ apiResult: APIResult?) throws(JSException) { - try processor.handleAPIResult(apiResult) + @JS func setProcessorAPIResult(_ apiResult: APIResult?) { + processor.handleAPIResult(apiResult) } } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index b9b7dc1dc..55a77466e 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -921,105 +921,72 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_S struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { let jsObject: JSObject - func increment(by amount: Int) throws(JSException) -> Void { + func increment(by amount: Int) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let amountValue = amount.bridgeJSLowerParameter() _extern_increment(jsObjectValue, amountValue) - if let error = _swift_js_take_exception() { - throw error - } } - func getValue() throws(JSException) -> Int { + func getValue() -> Int { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_getValue(jsObjectValue) - if let error = _swift_js_take_exception() { - throw error - } return Int.bridgeJSLiftReturn(ret) } - func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) throws(JSException) -> Void { + func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let labelPrefixValue = labelPrefix.bridgeJSLowerParameter() let labelSuffixValue = labelSuffix.bridgeJSLowerParameter() _extern_setLabelElements(jsObjectValue, labelPrefixValue, labelSuffixValue) - if let error = _swift_js_take_exception() { - throw error - } } - func getLabel() throws(JSException) -> String { + func getLabel() -> String { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_getLabel(jsObjectValue) - if let error = _swift_js_take_exception() { - throw error - } return String.bridgeJSLiftReturn(ret) } - func isEven() throws(JSException) -> Bool { + func isEven() -> Bool { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_isEven(jsObjectValue) - if let error = _swift_js_take_exception() { - throw error - } return Bool.bridgeJSLiftReturn(ret) } - func processGreeter(_ greeter: Greeter) throws(JSException) -> String { + func processGreeter(_ greeter: Greeter) -> String { let jsObjectValue = jsObject.bridgeJSLowerParameter() let greeterPointer = greeter.bridgeJSLowerParameter() let ret = _extern_processGreeter(jsObjectValue, greeterPointer) - if let error = _swift_js_take_exception() { - throw error - } return String.bridgeJSLiftReturn(ret) } - func createGreeter() throws(JSException) -> Greeter { + func createGreeter() -> Greeter { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_createGreeter(jsObjectValue) - if let error = _swift_js_take_exception() { - throw error - } return Greeter.bridgeJSLiftReturn(ret) } - func processOptionalGreeter(_ greeter: Optional) throws(JSException) -> String { + func processOptionalGreeter(_ greeter: Optional) -> String { let jsObjectValue = jsObject.bridgeJSLowerParameter() let (greeterIsSome, greeterPointer) = greeter.bridgeJSLowerParameter() let ret = _extern_processOptionalGreeter(jsObjectValue, greeterIsSome, greeterPointer) - if let error = _swift_js_take_exception() { - throw error - } return String.bridgeJSLiftReturn(ret) } - func createOptionalGreeter() throws(JSException) -> Optional { + func createOptionalGreeter() -> Optional { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_createOptionalGreeter(jsObjectValue) - if let error = _swift_js_take_exception() { - throw error - } return Optional.bridgeJSLiftReturn(ret) } - func handleAPIResult(_ result: Optional) throws(JSException) -> Void { + func handleAPIResult(_ result: Optional) -> Void { let jsObjectValue = jsObject.bridgeJSLowerParameter() let (resultIsSome, resultCaseId) = result.bridgeJSLowerParameter() _extern_handleAPIResult(jsObjectValue, resultIsSome, resultCaseId) - if let error = _swift_js_take_exception() { - throw error - } } - func getAPIResult() throws(JSException) -> Optional { + func getAPIResult() -> Optional { let jsObjectValue = jsObject.bridgeJSLowerParameter() let ret = _extern_getAPIResult(jsObjectValue) - if let error = _swift_js_take_exception() { - throw error - } return Optional.bridgeJSLiftReturn(ret) } @@ -6592,21 +6559,7 @@ public func _bjs_DataProcessorManager_init(_ processor: Int32) -> UnsafeMutableR @_cdecl("bjs_DataProcessorManager_incrementByAmount") public func _bjs_DataProcessorManager_incrementByAmount(_ _self: UnsafeMutableRawPointer, _ amount: Int32) -> Void { #if arch(wasm32) - do { - try DataProcessorManager.bridgeJSLiftParameter(_self).incrementByAmount(_: Int.bridgeJSLiftParameter(amount)) - } 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 - } + DataProcessorManager.bridgeJSLiftParameter(_self).incrementByAmount(_: Int.bridgeJSLiftParameter(amount)) #else fatalError("Only available on WebAssembly") #endif @@ -6616,21 +6569,7 @@ public func _bjs_DataProcessorManager_incrementByAmount(_ _self: UnsafeMutableRa @_cdecl("bjs_DataProcessorManager_setProcessorLabel") public func _bjs_DataProcessorManager_setProcessorLabel(_ _self: UnsafeMutableRawPointer, _ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { #if arch(wasm32) - do { - try DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorLabel(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength), _: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) - } 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 - } + DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorLabel(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength), _: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) #else fatalError("Only available on WebAssembly") #endif @@ -6640,22 +6579,8 @@ public func _bjs_DataProcessorManager_setProcessorLabel(_ _self: UnsafeMutableRa @_cdecl("bjs_DataProcessorManager_isProcessorEven") public func _bjs_DataProcessorManager_isProcessorEven(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) - do { - let ret = try DataProcessorManager.bridgeJSLiftParameter(_self).isProcessorEven() - 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 - } + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).isProcessorEven() + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -6665,22 +6590,8 @@ public func _bjs_DataProcessorManager_isProcessorEven(_ _self: UnsafeMutableRawP @_cdecl("bjs_DataProcessorManager_getProcessorLabel") public func _bjs_DataProcessorManager_getProcessorLabel(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - do { - let ret = try DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorLabel() - 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 - } + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorLabel() + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -6690,22 +6601,8 @@ public func _bjs_DataProcessorManager_getProcessorLabel(_ _self: UnsafeMutableRa @_cdecl("bjs_DataProcessorManager_getCurrentValue") public func _bjs_DataProcessorManager_getCurrentValue(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) - do { - let ret = try DataProcessorManager.bridgeJSLiftParameter(_self).getCurrentValue() - 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 - } + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getCurrentValue() + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -6715,21 +6612,7 @@ public func _bjs_DataProcessorManager_getCurrentValue(_ _self: UnsafeMutableRawP @_cdecl("bjs_DataProcessorManager_incrementBoth") public func _bjs_DataProcessorManager_incrementBoth(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - do { - try DataProcessorManager.bridgeJSLiftParameter(_self).incrementBoth() - } 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 - } + DataProcessorManager.bridgeJSLiftParameter(_self).incrementBoth() #else fatalError("Only available on WebAssembly") #endif @@ -6739,22 +6622,8 @@ public func _bjs_DataProcessorManager_incrementBoth(_ _self: UnsafeMutableRawPoi @_cdecl("bjs_DataProcessorManager_getBackupValue") public func _bjs_DataProcessorManager_getBackupValue(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - do { - let ret = try DataProcessorManager.bridgeJSLiftParameter(_self).getBackupValue() - 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 - } + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getBackupValue() + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -6880,22 +6749,8 @@ public func _bjs_DataProcessorManager_setProcessorHttpStatus(_ _self: UnsafeMuta @_cdecl("bjs_DataProcessorManager_getProcessorAPIResult") public func _bjs_DataProcessorManager_getProcessorAPIResult(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - do { - let ret = try DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorAPIResult() - 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 - } + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorAPIResult() + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -6905,21 +6760,7 @@ public func _bjs_DataProcessorManager_getProcessorAPIResult(_ _self: UnsafeMutab @_cdecl("bjs_DataProcessorManager_setProcessorAPIResult") public func _bjs_DataProcessorManager_setProcessorAPIResult(_ _self: UnsafeMutableRawPointer, _ apiResultIsSome: Int32, _ apiResultCaseId: Int32) -> Void { #if arch(wasm32) - do { - try DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorAPIResult(_: Optional.bridgeJSLiftParameter(apiResultIsSome, apiResultCaseId)) - } 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 - } + DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorAPIResult(_: Optional.bridgeJSLiftParameter(apiResultIsSome, apiResultCaseId)) #else fatalError("Only available on WebAssembly") #endif diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 83845dd45..e31c69a51 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -1365,7 +1365,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "incrementByAmount", "parameters" : [ @@ -1390,7 +1390,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "setProcessorLabel", "parameters" : [ @@ -1424,7 +1424,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "isProcessorEven", "parameters" : [ @@ -1441,7 +1441,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "getProcessorLabel", "parameters" : [ @@ -1458,7 +1458,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "getCurrentValue", "parameters" : [ @@ -1475,7 +1475,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "incrementBoth", "parameters" : [ @@ -1492,7 +1492,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "getBackupValue", "parameters" : [ @@ -1784,7 +1784,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "getProcessorAPIResult", "parameters" : [ @@ -1805,7 +1805,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "setProcessorAPIResult", "parameters" : [ @@ -9844,7 +9844,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "increment", "parameters" : [ @@ -9869,7 +9869,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "getValue", "parameters" : [ @@ -9886,7 +9886,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "setLabelElements", "parameters" : [ @@ -9920,7 +9920,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "getLabel", "parameters" : [ @@ -9937,7 +9937,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "isEven", "parameters" : [ @@ -9954,7 +9954,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "processGreeter", "parameters" : [ @@ -9979,7 +9979,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "createGreeter", "parameters" : [ @@ -9996,7 +9996,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "processOptionalGreeter", "parameters" : [ @@ -10025,7 +10025,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "createOptionalGreeter", "parameters" : [ @@ -10046,7 +10046,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "handleAPIResult", "parameters" : [ @@ -10075,7 +10075,7 @@ "effects" : { "isAsync" : false, "isStatic" : false, - "isThrows" : true + "isThrows" : false }, "name" : "getAPIResult", "parameters" : [ From bc6103856f61bc0fd9b6147d20bce3af8c366679 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 01:36:30 +0900 Subject: [PATCH 132/252] TS2Swift: Skip type checks when translating TS -> Swift (#567) --- .../BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 1d2d0f64f..776477580 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -27,7 +27,11 @@ export class TypeProcessor { static createProgram(filePaths, options) { const host = ts.createCompilerHost(options); const roots = Array.isArray(filePaths) ? filePaths : [filePaths]; - return ts.createProgram(roots, options, host); + return ts.createProgram(roots, { + ...options, + noCheck: true, + skipLibCheck: true, + }, host); } /** From edabb977f4e0e2a62703111dfdc27d537a695a2f Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 02:45:26 +0900 Subject: [PATCH 133/252] BridgeJS: emit typed throws without extra space (#571) --- .../Sources/Generated/BridgeJS.Macros.swift | 6 +- .../Generated/BridgeJS.Macros.swift | 4 +- .../TS2Swift/JavaScript/src/processor.js | 2 +- .../test/__snapshots__/ts2swift.test.js.snap | 122 +++++++++--------- .../Generated/BridgeJS.Macros.swift | 48 +++---- 5 files changed, 91 insertions(+), 91 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.Macros.swift b/Benchmarks/Sources/Generated/BridgeJS.Macros.swift index edf727004..39a46d22c 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.Macros.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.Macros.swift @@ -6,8 +6,8 @@ @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func benchmarkHelperNoop() throws (JSException) -> Void +@JSFunction func benchmarkHelperNoop() throws(JSException) -> Void -@JSFunction func benchmarkHelperNoopWithNumber(_ n: Double) throws (JSException) -> Void +@JSFunction func benchmarkHelperNoopWithNumber(_ n: Double) throws(JSException) -> Void -@JSFunction func benchmarkRunner(_ name: String, _ body: JSObject) throws (JSException) -> Void +@JSFunction func benchmarkRunner(_ name: String, _ body: JSObject) throws(JSException) -> Void diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift index cc62396ea..c619a8883 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift @@ -6,8 +6,8 @@ @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func createTS2Swift() throws (JSException) -> TS2Swift +@JSFunction func createTS2Swift() throws(JSException) -> TS2Swift @JSClass struct TS2Swift { - @JSFunction func convert(_ ts: String) throws (JSException) -> String + @JSFunction func convert(_ ts: String) throws(JSException) -> String } diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 776477580..258334ee8 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -874,7 +874,7 @@ export class TypeProcessor { if (effects?.isAsync) { parts.push("async"); } - parts.push("throws (JSException)"); + parts.push("throws(JSException)"); return parts.join(" "); } diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index 5b5316a40..6add64de4 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -9,11 +9,11 @@ exports[`ts2swift > snapshots Swift output for ArrayParameter.d.ts > ArrayParame @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func checkArray(_ a: JSObject) throws (JSException) -> Void +@JSFunction func checkArray(_ a: JSObject) throws(JSException) -> Void -@JSFunction func checkArrayWithLength(_ a: JSObject, _ b: Double) throws (JSException) -> Void +@JSFunction func checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void -@JSFunction func checkArray(_ a: JSObject) throws (JSException) -> Void +@JSFunction func checkArray(_ a: JSObject) throws(JSException) -> Void " `; @@ -26,19 +26,19 @@ exports[`ts2swift > snapshots Swift output for Async.d.ts > Async 1`] = ` @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func asyncReturnVoid() throws (JSException) -> JSPromise +@JSFunction func asyncReturnVoid() throws(JSException) -> JSPromise -@JSFunction func asyncRoundTripInt(_ v: Double) throws (JSException) -> JSPromise +@JSFunction func asyncRoundTripInt(_ v: Double) throws(JSException) -> JSPromise -@JSFunction func asyncRoundTripString(_ v: String) throws (JSException) -> JSPromise +@JSFunction func asyncRoundTripString(_ v: String) throws(JSException) -> JSPromise -@JSFunction func asyncRoundTripBool(_ v: Bool) throws (JSException) -> JSPromise +@JSFunction func asyncRoundTripBool(_ v: Bool) throws(JSException) -> JSPromise -@JSFunction func asyncRoundTripFloat(_ v: Double) throws (JSException) -> JSPromise +@JSFunction func asyncRoundTripFloat(_ v: Double) throws(JSException) -> JSPromise -@JSFunction func asyncRoundTripDouble(_ v: Double) throws (JSException) -> JSPromise +@JSFunction func asyncRoundTripDouble(_ v: Double) throws(JSException) -> JSPromise -@JSFunction func asyncRoundTripJSObject(_ v: JSObject) throws (JSException) -> JSPromise +@JSFunction func asyncRoundTripJSObject(_ v: JSObject) throws(JSException) -> JSPromise " `; @@ -51,11 +51,11 @@ exports[`ts2swift > snapshots Swift output for Interface.d.ts > Interface 1`] = @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func returnAnimatable() throws (JSException) -> Animatable +@JSFunction func returnAnimatable() throws(JSException) -> Animatable @JSClass struct Animatable { - @JSFunction func animate(_ keyframes: JSObject, _ options: JSObject) throws (JSException) -> JSObject - @JSFunction func getAnimations(_ options: JSObject) throws (JSException) -> JSObject + @JSFunction func animate(_ keyframes: JSObject, _ options: JSObject) throws(JSException) -> JSObject + @JSFunction func getAnimations(_ options: JSObject) throws(JSException) -> JSObject } " `; @@ -69,42 +69,42 @@ exports[`ts2swift > snapshots Swift output for InvalidPropertyNames.d.ts > Inval @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func createArrayBuffer() throws (JSException) -> ArrayBufferLike +@JSFunction func createArrayBuffer() throws(JSException) -> ArrayBufferLike @JSClass struct ArrayBufferLike { @JSGetter var byteLength: Double - @JSFunction func slice(_ begin: Double, _ end: Double) throws (JSException) -> ArrayBufferLike + @JSFunction func slice(_ begin: Double, _ end: Double) throws(JSException) -> ArrayBufferLike } -@JSFunction func createWeirdObject() throws (JSException) -> WeirdNaming +@JSFunction func createWeirdObject() throws(JSException) -> WeirdNaming @JSClass struct WeirdNaming { @JSGetter var normalProperty: String - @JSSetter func setNormalProperty(_ value: String) throws (JSException) + @JSSetter func setNormalProperty(_ value: String) throws(JSException) @JSGetter(jsName: "property-with-dashes") var property_with_dashes: Double - @JSSetter(jsName: "property-with-dashes") func setProperty_with_dashes(_ value: Double) throws (JSException) + @JSSetter(jsName: "property-with-dashes") func setProperty_with_dashes(_ value: Double) throws(JSException) @JSGetter(jsName: "123invalidStart") var _123invalidStart: Bool - @JSSetter(jsName: "123invalidStart") func set_123invalidStart(_ value: Bool) throws (JSException) + @JSSetter(jsName: "123invalidStart") func set_123invalidStart(_ value: Bool) throws(JSException) @JSGetter(jsName: "property with spaces") var property_with_spaces: String - @JSSetter(jsName: "property with spaces") func setProperty_with_spaces(_ value: String) throws (JSException) + @JSSetter(jsName: "property with spaces") func setProperty_with_spaces(_ value: String) throws(JSException) @JSGetter(jsName: "@specialChar") var _specialChar: Double - @JSSetter(jsName: "@specialChar") func set_specialChar(_ value: Double) throws (JSException) + @JSSetter(jsName: "@specialChar") func set_specialChar(_ value: Double) throws(JSException) @JSGetter var constructor: String - @JSSetter func setConstructor(_ value: String) throws (JSException) + @JSSetter func setConstructor(_ value: String) throws(JSException) @JSGetter var \`for\`: String - @JSSetter func setFor(_ value: String) throws (JSException) + @JSSetter func setFor(_ value: String) throws(JSException) @JSGetter var \`Any\`: String - @JSSetter(jsName: "Any") func setAny(_ value: String) throws (JSException) - @JSFunction func \`as\`() throws (JSException) -> Void - @JSFunction func \`try\`() throws (JSException) -> Void + @JSSetter(jsName: "Any") func setAny(_ value: String) throws(JSException) + @JSFunction func \`as\`() throws(JSException) -> Void + @JSFunction func \`try\`() throws(JSException) -> Void } @JSClass(jsName: "$Weird") struct _Weird { - @JSFunction init() throws (JSException) - @JSFunction(jsName: "method-with-dashes") func method_with_dashes() throws (JSException) -> Void + @JSFunction init() throws(JSException) + @JSFunction(jsName: "method-with-dashes") func method_with_dashes() throws(JSException) -> Void } -@JSFunction func createWeirdClass() throws (JSException) -> _Weird +@JSFunction func createWeirdClass() throws(JSException) -> _Weird " `; @@ -117,29 +117,29 @@ exports[`ts2swift > snapshots Swift output for MultipleImportedTypes.d.ts > Mult @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func createDatabaseConnection(_ config: JSObject) throws (JSException) -> DatabaseConnection +@JSFunction func createDatabaseConnection(_ config: JSObject) throws(JSException) -> DatabaseConnection @JSClass struct DatabaseConnection { - @JSFunction func connect(_ url: String) throws (JSException) -> Void - @JSFunction func execute(_ query: String) throws (JSException) -> JSObject + @JSFunction func connect(_ url: String) throws(JSException) -> Void + @JSFunction func execute(_ query: String) throws(JSException) -> JSObject @JSGetter var isConnected: Bool @JSGetter var connectionTimeout: Double - @JSSetter func setConnectionTimeout(_ value: Double) throws (JSException) + @JSSetter func setConnectionTimeout(_ value: Double) throws(JSException) } -@JSFunction func createLogger(_ level: String) throws (JSException) -> Logger +@JSFunction func createLogger(_ level: String) throws(JSException) -> Logger @JSClass struct Logger { - @JSFunction func log(_ message: String) throws (JSException) -> Void - @JSFunction func error(_ message: String, _ error: JSObject) throws (JSException) -> Void + @JSFunction func log(_ message: String) throws(JSException) -> Void + @JSFunction func error(_ message: String, _ error: JSObject) throws(JSException) -> Void @JSGetter var level: String } -@JSFunction func getConfigManager() throws (JSException) -> ConfigManager +@JSFunction func getConfigManager() throws(JSException) -> ConfigManager @JSClass struct ConfigManager { - @JSFunction func get(_ key: String) throws (JSException) -> JSObject - @JSFunction func set(_ key: String, _ value: JSObject) throws (JSException) -> Void + @JSFunction func get(_ key: String) throws(JSException) -> JSObject + @JSFunction func set(_ key: String, _ value: JSObject) throws(JSException) -> Void @JSGetter var configPath: String } " @@ -154,7 +154,7 @@ exports[`ts2swift > snapshots Swift output for PrimitiveParameters.d.ts > Primit @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func check(_ a: Double, _ b: Bool) throws (JSException) -> Void +@JSFunction func check(_ a: Double, _ b: Bool) throws(JSException) -> Void " `; @@ -167,9 +167,9 @@ exports[`ts2swift > snapshots Swift output for PrimitiveReturn.d.ts > PrimitiveR @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func checkNumber() throws (JSException) -> Double +@JSFunction func checkNumber() throws(JSException) -> Double -@JSFunction func checkBoolean() throws (JSException) -> Bool +@JSFunction func checkBoolean() throws(JSException) -> Bool " `; @@ -182,11 +182,11 @@ exports[`ts2swift > snapshots Swift output for ReExportFrom.d.ts > ReExportFrom @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func jsRoundTripNumber(_ v: Double) throws (JSException) -> Double +@JSFunction func jsRoundTripNumber(_ v: Double) throws(JSException) -> Double @JSClass struct JsGreeter { - @JSFunction init(_ name: String) throws (JSException) - @JSFunction func greet() throws (JSException) -> String + @JSFunction init(_ name: String) throws(JSException) + @JSFunction func greet() throws(JSException) -> String } " `; @@ -206,9 +206,9 @@ enum FeatureFlag: String { } extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} -@JSFunction func takesFeatureFlag(_ flag: FeatureFlag) throws (JSException) -> Void +@JSFunction func takesFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> Void -@JSFunction func returnsFeatureFlag() throws (JSException) -> FeatureFlag +@JSFunction func returnsFeatureFlag() throws(JSException) -> FeatureFlag " `; @@ -221,9 +221,9 @@ exports[`ts2swift > snapshots Swift output for StringParameter.d.ts > StringPara @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func checkString(_ a: String) throws (JSException) -> Void +@JSFunction func checkString(_ a: String) throws(JSException) -> Void -@JSFunction func checkStringWithLength(_ a: String, _ b: Double) throws (JSException) -> Void +@JSFunction func checkStringWithLength(_ a: String, _ b: Double) throws(JSException) -> Void " `; @@ -236,7 +236,7 @@ exports[`ts2swift > snapshots Swift output for StringReturn.d.ts > StringReturn @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func checkString() throws (JSException) -> String +@JSFunction func checkString() throws(JSException) -> String " `; @@ -249,18 +249,18 @@ exports[`ts2swift > snapshots Swift output for TS2SkeletonLike.d.ts > TS2Skeleto @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func createTS2Skeleton() throws (JSException) -> TypeScriptProcessor +@JSFunction func createTS2Skeleton() throws(JSException) -> TypeScriptProcessor @JSClass struct TypeScriptProcessor { - @JSFunction func convert(_ ts: String) throws (JSException) -> String - @JSFunction func validate(_ ts: String) throws (JSException) -> Bool + @JSFunction func convert(_ ts: String) throws(JSException) -> String + @JSFunction func validate(_ ts: String) throws(JSException) -> Bool @JSGetter var version: String } -@JSFunction func createCodeGenerator(_ format: String) throws (JSException) -> CodeGenerator +@JSFunction func createCodeGenerator(_ format: String) throws(JSException) -> CodeGenerator @JSClass struct CodeGenerator { - @JSFunction func generate(_ input: JSObject) throws (JSException) -> String + @JSFunction func generate(_ input: JSObject) throws(JSException) -> String @JSGetter var outputFormat: String } " @@ -275,7 +275,7 @@ exports[`ts2swift > snapshots Swift output for TypeAlias.d.ts > TypeAlias 1`] = @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func checkSimple(_ a: Double) throws (JSException) -> Void +@JSFunction func checkSimple(_ a: Double) throws(JSException) -> Void " `; @@ -290,11 +290,11 @@ exports[`ts2swift > snapshots Swift output for TypeScriptClass.d.ts > TypeScript @JSClass struct Greeter { @JSGetter var name: String - @JSSetter func setName(_ value: String) throws (JSException) + @JSSetter func setName(_ value: String) throws(JSException) @JSGetter var age: Double - @JSFunction init(_ name: String) throws (JSException) - @JSFunction func greet() throws (JSException) -> String - @JSFunction func changeName(_ name: String) throws (JSException) -> Void + @JSFunction init(_ name: String) throws(JSException) + @JSFunction func greet() throws(JSException) -> String + @JSFunction func changeName(_ name: String) throws(JSException) -> Void } " `; @@ -308,6 +308,6 @@ exports[`ts2swift > snapshots Swift output for VoidParameterVoidReturn.d.ts > Vo @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func check() throws (JSException) -> Void +@JSFunction func check() throws(JSException) -> Void " `; diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index 6836000c6..e066ad272 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -6,21 +6,21 @@ @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func jsRoundTripVoid() throws (JSException) -> Void +@JSFunction func jsRoundTripVoid() throws(JSException) -> Void -@JSFunction func jsRoundTripNumber(_ v: Double) throws (JSException) -> Double +@JSFunction func jsRoundTripNumber(_ v: Double) throws(JSException) -> Double -@JSFunction func jsRoundTripBool(_ v: Bool) throws (JSException) -> Bool +@JSFunction func jsRoundTripBool(_ v: Bool) throws(JSException) -> Bool -@JSFunction func jsRoundTripString(_ v: String) throws (JSException) -> String +@JSFunction func jsRoundTripString(_ v: String) throws(JSException) -> String -@JSFunction func jsThrowOrVoid(_ shouldThrow: Bool) throws (JSException) -> Void +@JSFunction func jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void -@JSFunction func jsThrowOrNumber(_ shouldThrow: Bool) throws (JSException) -> Double +@JSFunction func jsThrowOrNumber(_ shouldThrow: Bool) throws(JSException) -> Double -@JSFunction func jsThrowOrBool(_ shouldThrow: Bool) throws (JSException) -> Bool +@JSFunction func jsThrowOrBool(_ shouldThrow: Bool) throws(JSException) -> Bool -@JSFunction func jsThrowOrString(_ shouldThrow: Bool) throws (JSException) -> String +@JSFunction func jsThrowOrString(_ shouldThrow: Bool) throws(JSException) -> String enum FeatureFlag: String { case foo = "foo" @@ -28,38 +28,38 @@ enum FeatureFlag: String { } extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} -@JSFunction func jsRoundTripFeatureFlag(_ flag: FeatureFlag) throws (JSException) -> FeatureFlag +@JSFunction func jsRoundTripFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> FeatureFlag @JSClass struct JsGreeter { @JSGetter var name: String - @JSSetter func setName(_ value: String) throws (JSException) + @JSSetter func setName(_ value: String) throws(JSException) @JSGetter var `prefix`: String - @JSFunction init(_ name: String, _ `prefix`: String) throws (JSException) - @JSFunction func greet() throws (JSException) -> String - @JSFunction func changeName(_ name: String) throws (JSException) -> Void + @JSFunction init(_ name: String, _ `prefix`: String) throws(JSException) + @JSFunction func greet() throws(JSException) -> String + @JSFunction func changeName(_ name: String) throws(JSException) -> Void } -@JSFunction func runAsyncWorks() throws (JSException) -> JSPromise +@JSFunction func runAsyncWorks() throws(JSException) -> JSPromise -@JSFunction(jsName: "$jsWeirdFunction") func _jsWeirdFunction() throws (JSException) -> Double +@JSFunction(jsName: "$jsWeirdFunction") func _jsWeirdFunction() throws(JSException) -> Double @JSClass(jsName: "$WeirdClass") struct _WeirdClass { - @JSFunction init() throws (JSException) - @JSFunction(jsName: "method-with-dashes") func method_with_dashes() throws (JSException) -> String + @JSFunction init() throws(JSException) + @JSFunction(jsName: "method-with-dashes") func method_with_dashes() throws(JSException) -> String } -@JSFunction(from: .global) func parseInt(_ string: String) throws (JSException) -> Double +@JSFunction(from: .global) func parseInt(_ string: String) throws(JSException) -> Double @JSClass(from: .global) struct Animal { @JSGetter var name: String - @JSSetter func setName(_ value: String) throws (JSException) + @JSSetter func setName(_ value: String) throws(JSException) @JSGetter var age: Double - @JSSetter func setAge(_ value: Double) throws (JSException) + @JSSetter func setAge(_ value: Double) throws(JSException) @JSGetter var isCat: Bool - @JSSetter func setIsCat(_ value: Bool) throws (JSException) - @JSFunction init(_ name: String, _ age: Double, _ isCat: Bool) throws (JSException) - @JSFunction func bark() throws (JSException) -> String - @JSFunction func getIsCat() throws (JSException) -> Bool + @JSSetter func setIsCat(_ value: Bool) throws(JSException) + @JSFunction init(_ name: String, _ age: Double, _ isCat: Bool) throws(JSException) + @JSFunction func bark() throws(JSException) -> String + @JSFunction func getIsCat() throws(JSException) -> Bool } @JSGetter(from: .global) var globalObject1: JSObject From 89ed56e9cccf5a41d07fba75e6fcb51b1c4ad64b Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 11:34:58 +0900 Subject: [PATCH 134/252] CI: Cancel previous workflow runs on PRs --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2859b7043..06faa39f0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,6 +3,9 @@ on: pull_request: push: branches: [main] +concurrency: + group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }} + cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }} jobs: test: name: Build and Test From 6990143e74bbd28f7e7bc8c99f22efd40e504c2c Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 01:22:49 +0900 Subject: [PATCH 135/252] BridgeJS: Support `@JSFunction static func` --- .../Generated/JavaScript/BridgeJS.json | 3 + .../Sources/BridgeJSCore/ImportTS.swift | 22 ++++ .../BridgeJSCore/SwiftToSkeleton.swift | 51 ++++++++- .../Sources/BridgeJSLink/BridgeJSLink.swift | 42 ++++++- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 11 +- .../TS2Swift/JavaScript/src/processor.js | 6 +- .../MacroSwift/JSClassStaticFunctions.swift | 13 +++ .../BridgeJSCodegenTests/GlobalGetter.json | 3 + .../GlobalThisImports.json | 6 + .../ImportedTypeInExportedInterface.json | 3 + .../InvalidPropertyNames.json | 6 + .../BridgeJSCodegenTests/JSClass.json | 6 + .../JSClassStaticFunctions.json | 108 ++++++++++++++++++ .../JSClassStaticFunctions.swift | 86 ++++++++++++++ .../Generated/BridgeJS.Macros.swift | 9 ++ .../Generated/BridgeJS.swift | 105 +++++++++++++++++ .../Generated/JavaScript/BridgeJS.json | 100 ++++++++++++++++ .../BridgeJSRuntimeTests/ImportAPITests.swift | 13 +++ Tests/BridgeJSRuntimeTests/bridge-js.d.ts | 9 ++ Tests/prelude.mjs | 22 ++++ 20 files changed, 615 insertions(+), 9 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json index 1cf8e64c6..2952e2157 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json @@ -191,6 +191,9 @@ "name" : "TS2Swift", "setters" : [ + ], + "staticMethods" : [ + ] } ] diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 7c391eea0..234bdc66c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -398,6 +398,24 @@ public struct ImportTS { ] } + func renderStaticMethod(method: ImportedFunctionSkeleton) throws -> [DeclSyntax] { + let abiName = method.abiName(context: type, operation: "static") + let builder = CallJSEmission(moduleName: moduleName, abiName: abiName) + for param in method.parameters { + try builder.lowerParameter(param: param) + } + try builder.call(returnType: method.returnType) + try builder.liftReturnValue(returnType: method.returnType) + topLevelDecls.append(builder.renderImportDecl()) + return [ + builder.renderThunkDecl( + name: Self.thunkName(type: type, method: method), + parameters: method.parameters, + returnType: method.returnType + ) + ] + } + func renderConstructorDecl(constructor: ImportedConstructorSkeleton) throws -> [DeclSyntax] { let builder = CallJSEmission(moduleName: moduleName, abiName: constructor.abiName(context: type)) for param in constructor.parameters { @@ -462,6 +480,10 @@ public struct ImportTS { decls.append(contentsOf: try renderConstructorDecl(constructor: constructor)) } + for method in type.staticMethods { + decls.append(contentsOf: try renderStaticMethod(method: method)) + } + for getter in type.getters { decls.append(try renderGetterDecl(getter: getter)) } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index b780012f0..7928a5c1b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -1856,6 +1856,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { private let inputFilePath: String private var jsClassNames: Set private let parent: SwiftToSkeleton + private var staticMethodsByType: [String: [ImportedFunctionSkeleton]] = [:] // MARK: - State Management @@ -1876,6 +1877,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { let from: JSImportFrom? var constructor: ImportedConstructorSkeleton? var methods: [ImportedFunctionSkeleton] + var staticMethods: [ImportedFunctionSkeleton] var getters: [ImportedGetterSkeleton] var setters: [ImportedSetterSkeleton] } @@ -2094,6 +2096,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { from: nil, constructor: nil, methods: [], + staticMethods: [], getters: [], setters: [] ) @@ -2107,6 +2110,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { from: from, constructor: nil, methods: [], + staticMethods: [], getters: [], setters: [] ) @@ -2114,6 +2118,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { private func exitJSClass() { if case .jsClassBody(let typeName) = state, let type = currentType, type.name == typeName { + let externalStaticMethods = staticMethodsByType[type.name] ?? [] importedTypes.append( ImportedTypeSkeleton( name: type.name, @@ -2121,11 +2126,13 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { from: type.from, constructor: type.constructor, methods: type.methods, + staticMethods: type.staticMethods + externalStaticMethods, getters: type.getters, setters: type.setters, documentation: nil ) ) + staticMethodsByType[type.name] = nil currentType = nil } stateStack.removeLast() @@ -2217,8 +2224,14 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { ) -> Bool { if let jsFunction = AttributeChecker.firstJSFunctionAttribute(node.attributes) { if isStaticMember { - parseFunction(jsFunction, node, enclosingTypeName: typeName, isStaticMember: true).map { - importedFunctions.append($0) + parseFunction( + jsFunction, + node, + enclosingTypeName: typeName, + isStaticMember: true, + includeTypeNameForStatic: false + ).map { + type.staticMethods.append($0) } } else { parseFunction(jsFunction, node, enclosingTypeName: typeName, isStaticMember: false).map { @@ -2319,9 +2332,34 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { for member in members { if let function = member.decl.as(FunctionDeclSyntax.self) { if let jsFunction = AttributeChecker.firstJSFunctionAttribute(function.attributes), - let parsed = parseFunction(jsFunction, function, enclosingTypeName: typeName, isStaticMember: true) + let parsed = parseFunction( + jsFunction, + function, + enclosingTypeName: typeName, + isStaticMember: true, + includeTypeNameForStatic: !jsClassNames.contains(typeName) + ) { - importedFunctions.append(parsed) + if jsClassNames.contains(typeName) { + if let index = importedTypes.firstIndex(where: { $0.name == typeName }) { + let existing = importedTypes[index] + importedTypes[index] = ImportedTypeSkeleton( + name: existing.name, + jsName: existing.jsName, + from: existing.from, + constructor: existing.constructor, + methods: existing.methods, + staticMethods: existing.staticMethods + [parsed], + getters: existing.getters, + setters: existing.setters, + documentation: existing.documentation + ) + } else { + staticMethodsByType[typeName, default: []].append(parsed) + } + } else { + importedFunctions.append(parsed) + } } else if AttributeChecker.hasJSSetterAttribute(function.attributes) { errors.append( DiagnosticError( @@ -2366,7 +2404,8 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { _ jsFunction: AttributeSyntax, _ node: FunctionDeclSyntax, enclosingTypeName: String?, - isStaticMember: Bool + isStaticMember: Bool, + includeTypeNameForStatic: Bool = true ) -> ImportedFunctionSkeleton? { guard validateEffects(node.signature.effectSpecifiers, node: node, attributeName: "JSFunction") != nil else { @@ -2377,7 +2416,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { let jsName = AttributeChecker.extractJSName(from: jsFunction) let from = AttributeChecker.extractJSImportFrom(from: jsFunction) let name: String - if isStaticMember, let enclosingTypeName { + if isStaticMember, includeTypeNameForStatic, let enclosingTypeName { name = "\(enclosingTypeName)_\(baseName)" } else { name = baseName diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 60b55cd47..c1b4d2e77 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -2246,6 +2246,14 @@ extension BridgeJSLink { ) } + func callStaticMethod(on objectExpr: String, name: String, returnType: BridgeType) throws -> String? { + let calleeExpr = Self.propertyAccessExpr(objectExpr: objectExpr, propertyName: name) + return try call( + calleeExpr: calleeExpr, + returnType: returnType + ) + } + func callPropertyGetter(name: String, returnType: BridgeType) throws -> String? { let objectExpr = "\(JSGlueVariableScope.reservedSwift).memory.getObject(self)" let accessExpr = Self.propertyAccessExpr(objectExpr: objectExpr, propertyName: name) @@ -2318,7 +2326,7 @@ extension BridgeJSLink { return loweredValues.first } - private static func propertyAccessExpr(objectExpr: String, propertyName: String) -> String { + static func propertyAccessExpr(objectExpr: String, propertyName: String) -> String { if propertyName.range(of: #"^[$A-Z_][0-9A-Z_$]*$"#, options: [.regularExpression, .caseInsensitive]) != nil { return "\(objectExpr).\(propertyName)" @@ -3130,6 +3138,12 @@ extension BridgeJSLink { importObjectBuilder.assignToImportObject(name: setterAbiName, function: js) importObjectBuilder.appendDts(dts) } + for method in type.staticMethods { + let abiName = method.abiName(context: type, operation: "static") + let (js, dts) = try renderImportedStaticMethod(context: type, method: method) + importObjectBuilder.assignToImportObject(name: abiName, function: js) + importObjectBuilder.appendDts(dts) + } for method in type.methods { let (js, dts) = try renderImportedMethod(context: type, method: method) importObjectBuilder.assignToImportObject(name: method.abiName(context: type), function: js) @@ -3207,6 +3221,32 @@ extension BridgeJSLink { return (funcLines, []) } + func renderImportedStaticMethod( + context: ImportedTypeSkeleton, + method: ImportedFunctionSkeleton + ) throws -> (js: [String], dts: [String]) { + let thunkBuilder = ImportedThunkBuilder() + for param in method.parameters { + try thunkBuilder.liftParameter(param: param) + } + let importRootExpr = context.from == .global ? "globalThis" : "imports" + let constructorExpr = ImportedThunkBuilder.propertyAccessExpr( + objectExpr: importRootExpr, + propertyName: context.jsName ?? context.name + ) + let returnExpr = try thunkBuilder.callStaticMethod( + on: constructorExpr, + name: method.jsName ?? method.name, + returnType: method.returnType + ) + let funcLines = thunkBuilder.renderFunction( + name: method.abiName(context: context, operation: "static"), + returnExpr: returnExpr, + returnType: method.returnType + ) + return (funcLines, []) + } + func renderImportedMethod( context: ImportedTypeSkeleton, method: ImportedFunctionSkeleton diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 5013dda66..66dda6cb0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -640,9 +640,14 @@ public struct ImportedFunctionSkeleton: Codable { } public func abiName(context: ImportedTypeSkeleton?) -> String { + return abiName(context: context, operation: nil) + } + + public func abiName(context: ImportedTypeSkeleton?, operation: String?) -> String { return ABINameGenerator.generateImportedABIName( baseName: name, - context: context + context: context, + operation: operation ) } } @@ -752,6 +757,8 @@ public struct ImportedTypeSkeleton: Codable { public let from: JSImportFrom? public let constructor: ImportedConstructorSkeleton? public let methods: [ImportedFunctionSkeleton] + /// Static methods available on the JavaScript constructor. + public var staticMethods: [ImportedFunctionSkeleton] = [] public let getters: [ImportedGetterSkeleton] public let setters: [ImportedSetterSkeleton] public let documentation: String? @@ -762,6 +769,7 @@ public struct ImportedTypeSkeleton: Codable { from: JSImportFrom? = nil, constructor: ImportedConstructorSkeleton? = nil, methods: [ImportedFunctionSkeleton], + staticMethods: [ImportedFunctionSkeleton] = [], getters: [ImportedGetterSkeleton] = [], setters: [ImportedSetterSkeleton] = [], documentation: String? = nil @@ -771,6 +779,7 @@ public struct ImportedTypeSkeleton: Codable { self.from = from self.constructor = constructor self.methods = methods + self.staticMethods = staticMethods self.getters = getters self.setters = setters self.documentation = documentation diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 258334ee8..0bd17422b 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -821,8 +821,12 @@ export class TypeProcessor { const returnType = this.visitType(signature.getReturnType(), node); const effects = this.renderEffects({ isAsync: false }); const swiftMethodName = this.renderIdentifier(swiftName); + const isStatic = node.modifiers?.some( + (modifier) => modifier.kind === ts.SyntaxKind.StaticKeyword + ) ?? false; + const staticKeyword = isStatic ? "static " : ""; - this.swiftLines.push(` ${annotation} func ${swiftMethodName}(${params}) ${effects} -> ${returnType}`); + this.swiftLines.push(` ${annotation} ${staticKeyword}func ${swiftMethodName}(${params}) ${effects} -> ${returnType}`); } /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift new file mode 100644 index 000000000..fdfe02003 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift @@ -0,0 +1,13 @@ +extension StaticBox { + @JSFunction static func makeDefault() throws(JSException) -> StaticBox +} + +@JSClass struct StaticBox { + @JSFunction static func create(_ value: Double) throws(JSException) -> StaticBox + @JSFunction func value() throws(JSException) -> Double + @JSFunction static func value() throws(JSException) -> Double +} + +extension StaticBox { + @JSFunction(jsName: "with-dashes") static func dashed() throws(JSException) -> StaticBox +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.json index c9be60d8a..031870e57 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.json @@ -61,6 +61,9 @@ "name" : "JSConsole", "setters" : [ + ], + "staticMethods" : [ + ] } ] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.json index 5cec23259..c75d9e011 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.json @@ -81,6 +81,9 @@ "name" : "JSConsole", "setters" : [ + ], + "staticMethods" : [ + ] }, { @@ -116,6 +119,9 @@ "name" : "WebSocket", "setters" : [ + ], + "staticMethods" : [ + ] } ] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json index c40f0dc82..659232d56 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json @@ -186,6 +186,9 @@ "name" : "Foo", "setters" : [ + ], + "staticMethods" : [ + ] } ] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.json index 40b97c12b..b983f27a4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.json @@ -219,6 +219,9 @@ } } } + ], + "staticMethods" : [ + ] }, { @@ -248,6 +251,9 @@ "name" : "_Weird", "setters" : [ + ], + "staticMethods" : [ + ] } ] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.json index 07906a404..be1d0f4cd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.json @@ -107,6 +107,9 @@ } } } + ], + "staticMethods" : [ + ] }, { @@ -162,6 +165,9 @@ "name" : "Animatable", "setters" : [ + ], + "staticMethods" : [ + ] } ] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json new file mode 100644 index 000000000..55fdb844c --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json @@ -0,0 +1,108 @@ +{ + "exported" : { + "classes" : [ + + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + { + "name" : "value", + "parameters" : [ + + ], + "returnType" : { + "double" : { + + } + } + } + ], + "name" : "StaticBox", + "setters" : [ + + ], + "staticMethods" : [ + { + "name" : "create", + "parameters" : [ + { + "name" : "value", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + "_0" : "StaticBox" + } + } + }, + { + "name" : "value", + "parameters" : [ + + ], + "returnType" : { + "double" : { + + } + } + }, + { + "name" : "makeDefault", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "StaticBox" + } + } + }, + { + "jsName" : "with-dashes", + "name" : "dashed", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "StaticBox" + } + } + } + ] + } + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift new file mode 100644 index 000000000..ed54edf9d --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift @@ -0,0 +1,86 @@ +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_create_static") +fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 +#else +fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_value_static") +fileprivate func bjs_StaticBox_value_static() -> Float64 +#else +fileprivate func bjs_StaticBox_value_static() -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_makeDefault_static") +fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 +#else +fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_dashed_static") +fileprivate func bjs_StaticBox_dashed_static() -> Int32 +#else +fileprivate func bjs_StaticBox_dashed_static() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_value") +fileprivate func bjs_StaticBox_value(_ self: Int32) -> Float64 +#else +fileprivate func bjs_StaticBox_value(_ self: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +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_dashed() throws(JSException) -> StaticBox { + let ret = bjs_StaticBox_dashed_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) +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index e066ad272..1e8737280 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -48,6 +48,15 @@ extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} @JSFunction(jsName: "method-with-dashes") func method_with_dashes() throws(JSException) -> String } +@JSClass struct StaticBox { + @JSFunction init(_ value: Double) throws(JSException) + @JSFunction func value() throws(JSException) -> Double + @JSFunction static func create(_ value: Double) throws(JSException) -> StaticBox + @JSFunction static func value() throws(JSException) -> Double + @JSFunction static func makeDefault() throws(JSException) -> StaticBox + @JSFunction(jsName: "with-dashes") static func with_dashes() throws(JSException) -> StaticBox +} + @JSFunction(from: .global) func parseInt(_ string: String) throws(JSException) -> Double @JSClass(from: .global) struct Animal { diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 94359a709..556409c07 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -8140,6 +8140,111 @@ func _$_WeirdClass_method_with_dashes(_ self: JSObject) throws(JSException) -> S return String.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_init") +fileprivate func bjs_StaticBox_init(_ value: Float64) -> Int32 +#else +fileprivate func bjs_StaticBox_init(_ value: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_create_static") +fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 +#else +fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_value_static") +fileprivate func bjs_StaticBox_value_static() -> Float64 +#else +fileprivate func bjs_StaticBox_value_static() -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_makeDefault_static") +fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 +#else +fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_with_dashes_static") +fileprivate func bjs_StaticBox_with_dashes_static() -> Int32 +#else +fileprivate func bjs_StaticBox_with_dashes_static() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_value") +fileprivate func bjs_StaticBox_value(_ self: Int32) -> Float64 +#else +fileprivate func bjs_StaticBox_value(_ self: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +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(_ name: Int32, _ age: Float64, _ isCat: Int32) -> Int32 diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 4b8ac7c7b..a2e4310d9 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -11668,6 +11668,9 @@ "name" : "Foo", "setters" : [ + ], + "staticMethods" : [ + ] } ] @@ -11967,6 +11970,9 @@ } } } + ], + "staticMethods" : [ + ] }, { @@ -11996,6 +12002,97 @@ "name" : "_WeirdClass", "setters" : [ + ], + "staticMethods" : [ + + ] + }, + { + "constructor" : { + "parameters" : [ + { + "name" : "value", + "type" : { + "double" : { + + } + } + } + ] + }, + "getters" : [ + + ], + "methods" : [ + { + "name" : "value", + "parameters" : [ + + ], + "returnType" : { + "double" : { + + } + } + } + ], + "name" : "StaticBox", + "setters" : [ + + ], + "staticMethods" : [ + { + "name" : "create", + "parameters" : [ + { + "name" : "value", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + "_0" : "StaticBox" + } + } + }, + { + "name" : "value", + "parameters" : [ + + ], + "returnType" : { + "double" : { + + } + } + }, + { + "name" : "makeDefault", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "StaticBox" + } + } + }, + { + "jsName" : "with-dashes", + "name" : "with_dashes", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "StaticBox" + } + } + } ] }, { @@ -12107,6 +12204,9 @@ } } } + ], + "staticMethods" : [ + ] } ] diff --git a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift index ea9f8c68f..b43a711e2 100644 --- a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift @@ -127,4 +127,17 @@ class ImportAPITests: XCTestCase { let obj = try _WeirdClass() XCTAssertEqual(try obj.method_with_dashes(), "ok") } + + func testJSClassStaticFunctions() throws { + let created = try StaticBox.create(10) + XCTAssertEqual(try created.value(), 10) + + let defaultBox = try StaticBox.makeDefault() + XCTAssertEqual(try defaultBox.value(), 0) + + XCTAssertEqual(try StaticBox.value(), 99) + + let dashed = try StaticBox.with_dashes() + XCTAssertEqual(try dashed.value(), 7) + } } diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts index 983d6052d..e38445805 100644 --- a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts +++ b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts @@ -31,3 +31,12 @@ export class $WeirdClass { constructor(); "method-with-dashes"(): string; } + +export class StaticBox { + constructor(value: number); + value(): number; + static create(value: number): StaticBox; + static value(): number; + static makeDefault(): StaticBox; + static "with-dashes"(): StaticBox; +} diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 850b31b6e..58a85acc2 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -9,6 +9,27 @@ export async function setupOptions(options, context) { Error.stackTraceLimit = 100; setupTestGlobals(globalThis); + class StaticBox { + constructor(value) { + this._value = value; + } + value() { + return this._value; + } + static create(value) { + return new StaticBox(value); + } + static value() { + return 99; + } + static makeDefault() { + return new StaticBox(0); + } + static ["with-dashes"]() { + return new StaticBox(7); + } + } + return { ...options, getImports: (importsContext) => { @@ -78,6 +99,7 @@ export async function setupOptions(options, context) { return "ok"; } }, + StaticBox, Foo: ImportedFoo, runAsyncWorks: async () => { const exports = importsContext.getExports(); From a2aa6e1d07e60f8397bf02fd7b8acc51c9d058c7 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 11:19:11 +0900 Subject: [PATCH 136/252] BridgeJS: Cover static methods in ts2swift tests --- .../JavaScript/test/__snapshots__/ts2swift.test.js.snap | 1 + .../TS2Swift/JavaScript/test/fixtures/TypeScriptClass.d.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index 6add64de4..c7f3b6652 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -295,6 +295,7 @@ exports[`ts2swift > snapshots Swift output for TypeScriptClass.d.ts > TypeScript @JSFunction init(_ name: String) throws(JSException) @JSFunction func greet() throws(JSException) -> String @JSFunction func changeName(_ name: String) throws(JSException) -> Void + @JSFunction static func staticMethod(_ p1: Double, _ p2: String) throws(JSException) -> String } " `; diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TypeScriptClass.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TypeScriptClass.d.ts index 074772f24..0745de1f9 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TypeScriptClass.d.ts +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TypeScriptClass.d.ts @@ -4,4 +4,6 @@ export class Greeter { constructor(name: string); greet(): string; changeName(name: string): void; + + static staticMethod(p1: number, p2: string): string; } From 4e3f02b623375316981153bcaf9280bda115bb99 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 11:33:10 +0900 Subject: [PATCH 137/252] BridgeJS: Fix d.ts rendering of static methods --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 32 +- .../MacroSwift/JSClassStaticFunctions.swift | 5 + .../JSClassStaticFunctions.json | 44 +++ .../JSClassStaticFunctions.swift | 36 +++ .../JSClassStaticFunctions.d.ts | 32 ++ .../JSClassStaticFunctions.js | 286 ++++++++++++++++++ 6 files changed, 422 insertions(+), 13 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index c1b4d2e77..d39b524b5 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -3144,6 +3144,25 @@ extension BridgeJSLink { importObjectBuilder.assignToImportObject(name: abiName, function: js) importObjectBuilder.appendDts(dts) } + if type.from == nil, type.constructor != nil || !type.staticMethods.isEmpty { + let dtsPrinter = CodeFragmentPrinter() + dtsPrinter.write("\(type.name): {") + dtsPrinter.indent { + if let constructor = type.constructor { + let returnType = BridgeType.jsObject(type.name) + dtsPrinter.write( + "new\(renderTSSignature(parameters: constructor.parameters, returnType: returnType, effects: Effects(isAsync: false, isThrows: false)));" + ) + } + for method in type.staticMethods { + let methodName = method.jsName ?? method.name + let signature = "\(renderTSPropertyName(methodName))\(renderTSSignature(parameters: method.parameters, returnType: method.returnType, effects: Effects(isAsync: false, isThrows: false)));" + dtsPrinter.write(signature) + } + } + dtsPrinter.write("}") + importObjectBuilder.appendDts(dtsPrinter.lines) + } for method in type.methods { let (js, dts) = try renderImportedMethod(context: type, method: method) importObjectBuilder.assignToImportObject(name: method.abiName(context: type), function: js) @@ -3174,19 +3193,6 @@ extension BridgeJSLink { returnType: returnType ) importObjectBuilder.assignToImportObject(name: abiName, function: funcLines) - - if type.from == nil { - let dtsPrinter = CodeFragmentPrinter() - dtsPrinter.write("\(type.name): {") - dtsPrinter.indent { - dtsPrinter.write( - "new\(renderTSSignature(parameters: constructor.parameters, returnType: returnType, effects: Effects(isAsync: false, isThrows: false)));" - ) - } - dtsPrinter.write("}") - - importObjectBuilder.appendDts(dtsPrinter.lines) - } } func renderImportedGetter( diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift index fdfe02003..ecf1b2473 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift @@ -11,3 +11,8 @@ extension StaticBox { extension StaticBox { @JSFunction(jsName: "with-dashes") static func dashed() throws(JSException) -> StaticBox } + +@JSClass struct WithCtor { + @JSFunction init(_ value: Double) throws(JSException) + @JSFunction static func create(_ value: Double) throws(JSException) -> WithCtor +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json index 55fdb844c..df3d3829e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json @@ -99,6 +99,50 @@ } } ] + }, + { + "constructor" : { + "parameters" : [ + { + "name" : "value", + "type" : { + "double" : { + + } + } + } + ] + }, + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "WithCtor", + "setters" : [ + + ], + "staticMethods" : [ + { + "name" : "create", + "parameters" : [ + { + "name" : "value", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + "_0" : "WithCtor" + } + } + } + ] } ] } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift index ed54edf9d..5e297f929 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift @@ -83,4 +83,40 @@ func _$StaticBox_value(_ self: JSObject) throws(JSException) -> Double { throw error } return Double.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithCtor_init") +fileprivate func bjs_WithCtor_init(_ value: Float64) -> Int32 +#else +fileprivate func bjs_WithCtor_init(_ value: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithCtor_create_static") +fileprivate func bjs_WithCtor_create_static(_ value: Float64) -> Int32 +#else +fileprivate func bjs_WithCtor_create_static(_ value: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$WithCtor_init(_ value: Double) throws(JSException) -> JSObject { + let valueValue = value.bridgeJSLowerParameter() + let ret = bjs_WithCtor_init(valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$WithCtor_create(_ value: Double) throws(JSException) -> WithCtor { + let valueValue = value.bridgeJSLowerParameter() + let ret = bjs_WithCtor_create_static(valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return WithCtor.bridgeJSLiftReturn(ret) } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts new file mode 100644 index 000000000..3b2b5de99 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts @@ -0,0 +1,32 @@ +// 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 interface StaticBox { + value(): number; +} +export interface WithCtor { +} +export type Exports = { +} +export type Imports = { + StaticBox: { + create(value: number): StaticBox; + value(): number; + makeDefault(): StaticBox; + "with-dashes"(): StaticBox; + } + WithCtor: { + new(value: number): WithCtor; + create(value: number): WithCtor; + } +} +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/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js new file mode 100644 index 000000000..f8f0ba86f --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -0,0 +1,286 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + let tmpStructCleanups = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_i32"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_i32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_pointer"] = function() { + return tmpParamPointers.pop(); + } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_StaticBox_create_static"] = function bjs_StaticBox_create_static(value) { + try { + let ret = imports.StaticBox.create(value); + return swift.memory.retain(ret); + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_StaticBox_value_static"] = function bjs_StaticBox_value_static() { + try { + let ret = imports.StaticBox.value(); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_StaticBox_makeDefault_static"] = function bjs_StaticBox_makeDefault_static() { + try { + let ret = imports.StaticBox.makeDefault(); + return swift.memory.retain(ret); + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_StaticBox_dashed_static"] = function bjs_StaticBox_dashed_static() { + try { + let ret = imports.StaticBox["with-dashes"](); + return swift.memory.retain(ret); + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_StaticBox_value"] = function bjs_StaticBox_value(self) { + try { + let ret = swift.memory.getObject(self).value(); + return ret; + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_WithCtor_init"] = function bjs_WithCtor_init(value) { + try { + return swift.memory.retain(new imports.WithCtor(value)); + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_WithCtor_create_static"] = function bjs_WithCtor_create_static(value) { + try { + let ret = imports.WithCtor.create(value); + return swift.memory.retain(ret); + } catch (error) { + setException(error); + return 0 + } + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + const exports = { + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file From 0c3cb258e028fd10bc1c2bad2255074cd80ed04e Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 11:36:11 +0900 Subject: [PATCH 138/252] ./Utilities/format.swift --- Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift | 3 ++- .../Inputs/MacroSwift/JSClassStaticFunctions.swift | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index d39b524b5..fd5faee24 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -3156,7 +3156,8 @@ extension BridgeJSLink { } for method in type.staticMethods { let methodName = method.jsName ?? method.name - let signature = "\(renderTSPropertyName(methodName))\(renderTSSignature(parameters: method.parameters, returnType: method.returnType, effects: Effects(isAsync: false, isThrows: false)));" + let signature = + "\(renderTSPropertyName(methodName))\(renderTSSignature(parameters: method.parameters, returnType: method.returnType, effects: Effects(isAsync: false, isThrows: false)));" dtsPrinter.write(signature) } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift index ecf1b2473..891eab118 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift @@ -15,4 +15,4 @@ extension StaticBox { @JSClass struct WithCtor { @JSFunction init(_ value: Double) throws(JSException) @JSFunction static func create(_ value: Double) throws(JSException) -> WithCtor -} \ No newline at end of file +} From cf6c745538acdea29e2c30f114f894ec3b2704fa Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 12:22:20 +0900 Subject: [PATCH 139/252] BridgeJS: Simplify static method naming --- .../BridgeJSCore/SwiftToSkeleton.swift | 54 ++++------------- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 4 +- .../JSClassStaticFunctions.json | 60 ++++++++++++------- .../JSClassStaticFunctions.swift | 56 ++++++++--------- .../JSClassStaticFunctions.d.ts | 8 ++- .../JSClassStaticFunctions.js | 20 +++---- 6 files changed, 93 insertions(+), 109 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index 7928a5c1b..d84d30506 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -2198,7 +2198,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { private func handleTopLevelFunction(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { if let jsFunction = AttributeChecker.firstJSFunctionAttribute(node.attributes), - let function = parseFunction(jsFunction, node, enclosingTypeName: nil, isStaticMember: true) + let function = parseFunction(jsFunction, node) { importedFunctions.append(function) return .skipChildren @@ -2223,19 +2223,11 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { type: inout CurrentType ) -> Bool { if let jsFunction = AttributeChecker.firstJSFunctionAttribute(node.attributes) { - if isStaticMember { - parseFunction( - jsFunction, - node, - enclosingTypeName: typeName, - isStaticMember: true, - includeTypeNameForStatic: false - ).map { - type.staticMethods.append($0) - } - } else { - parseFunction(jsFunction, node, enclosingTypeName: typeName, isStaticMember: false).map { - type.methods.append($0) + if let method = parseFunction(jsFunction, node) { + if isStaticMember { + type.staticMethods.append(method) + } else { + type.methods.append(method) } } return true @@ -2332,30 +2324,12 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { for member in members { if let function = member.decl.as(FunctionDeclSyntax.self) { if let jsFunction = AttributeChecker.firstJSFunctionAttribute(function.attributes), - let parsed = parseFunction( - jsFunction, - function, - enclosingTypeName: typeName, - isStaticMember: true, - includeTypeNameForStatic: !jsClassNames.contains(typeName) - ) - { + let parsed = parseFunction(jsFunction, function) { if jsClassNames.contains(typeName) { if let index = importedTypes.firstIndex(where: { $0.name == typeName }) { - let existing = importedTypes[index] - importedTypes[index] = ImportedTypeSkeleton( - name: existing.name, - jsName: existing.jsName, - from: existing.from, - constructor: existing.constructor, - methods: existing.methods, - staticMethods: existing.staticMethods + [parsed], - getters: existing.getters, - setters: existing.setters, - documentation: existing.documentation - ) + importedTypes[index].staticMethods.append(parsed) } else { - staticMethodsByType[typeName, default: []].append(parsed) + importedTypes.append(ImportedTypeSkeleton(name: typeName, staticMethods: [parsed])) } } else { importedFunctions.append(parsed) @@ -2403,9 +2377,6 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { private func parseFunction( _ jsFunction: AttributeSyntax, _ node: FunctionDeclSyntax, - enclosingTypeName: String?, - isStaticMember: Bool, - includeTypeNameForStatic: Bool = true ) -> ImportedFunctionSkeleton? { guard validateEffects(node.signature.effectSpecifiers, node: node, attributeName: "JSFunction") != nil else { @@ -2415,12 +2386,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { let baseName = SwiftToSkeleton.normalizeIdentifier(node.name.text) let jsName = AttributeChecker.extractJSName(from: jsFunction) let from = AttributeChecker.extractJSImportFrom(from: jsFunction) - let name: String - if isStaticMember, includeTypeNameForStatic, let enclosingTypeName { - name = "\(enclosingTypeName)_\(baseName)" - } else { - name = baseName - } + let name = baseName let parameters = parseParameters(from: node.signature.parameterClause) let returnType: BridgeType diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 66dda6cb0..6fe88a6a0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -758,7 +758,7 @@ public struct ImportedTypeSkeleton: Codable { public let constructor: ImportedConstructorSkeleton? public let methods: [ImportedFunctionSkeleton] /// Static methods available on the JavaScript constructor. - public var staticMethods: [ImportedFunctionSkeleton] = [] + public var staticMethods: [ImportedFunctionSkeleton] public let getters: [ImportedGetterSkeleton] public let setters: [ImportedSetterSkeleton] public let documentation: String? @@ -768,7 +768,7 @@ public struct ImportedTypeSkeleton: Codable { jsName: String? = nil, from: JSImportFrom? = nil, constructor: ImportedConstructorSkeleton? = nil, - methods: [ImportedFunctionSkeleton], + methods: [ImportedFunctionSkeleton] = [], staticMethods: [ImportedFunctionSkeleton] = [], getters: [ImportedGetterSkeleton] = [], setters: [ImportedSetterSkeleton] = [], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json index df3d3829e..7bf5db0fd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json @@ -24,6 +24,43 @@ ], "types" : [ + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "StaticBox", + "setters" : [ + + ], + "staticMethods" : [ + { + "name" : "makeDefault", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "StaticBox" + } + } + }, + { + "jsName" : "with-dashes", + "name" : "dashed", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "StaticBox" + } + } + } + ] + }, { "getters" : [ @@ -74,29 +111,6 @@ } } - }, - { - "name" : "makeDefault", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - "_0" : "StaticBox" - } - } - }, - { - "jsName" : "with-dashes", - "name" : "dashed", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - "_0" : "StaticBox" - } - } } ] }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift index 5e297f929..efb83f406 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift @@ -1,35 +1,51 @@ #if arch(wasm32) -@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_create_static") -fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 +@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_makeDefault_static") +fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 #else -fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 { +fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_value_static") -fileprivate func bjs_StaticBox_value_static() -> Float64 +@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_dashed_static") +fileprivate func bjs_StaticBox_dashed_static() -> Int32 #else -fileprivate func bjs_StaticBox_value_static() -> Float64 { +fileprivate func bjs_StaticBox_dashed_static() -> Int32 { fatalError("Only available on WebAssembly") } #endif +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_dashed() throws(JSException) -> StaticBox { + let ret = bjs_StaticBox_dashed_static() + if let error = _swift_js_take_exception() { + throw error + } + return StaticBox.bridgeJSLiftReturn(ret) +} + #if arch(wasm32) -@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_makeDefault_static") -fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 +@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_create_static") +fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 #else -fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 { +fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_dashed_static") -fileprivate func bjs_StaticBox_dashed_static() -> Int32 +@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_value_static") +fileprivate func bjs_StaticBox_value_static() -> Float64 #else -fileprivate func bjs_StaticBox_dashed_static() -> Int32 { +fileprivate func bjs_StaticBox_value_static() -> Float64 { fatalError("Only available on WebAssembly") } #endif @@ -60,22 +76,6 @@ func _$StaticBox_value() throws(JSException) -> Double { 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_dashed() throws(JSException) -> StaticBox { - let ret = bjs_StaticBox_dashed_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) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts index 3b2b5de99..e4c59459a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts @@ -4,6 +4,8 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. +export interface StaticBox { +} export interface StaticBox { value(): number; } @@ -13,11 +15,13 @@ export type Exports = { } export type Imports = { StaticBox: { - create(value: number): StaticBox; - value(): number; makeDefault(): StaticBox; "with-dashes"(): StaticBox; } + StaticBox: { + create(value: number): StaticBox; + value(): number; + } WithCtor: { new(value: number): WithCtor; create(value: number): WithCtor; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index f8f0ba86f..4acf43685 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -203,37 +203,37 @@ export async function createInstantiator(options, swift) { return pointer || 0; } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; - TestModule["bjs_StaticBox_create_static"] = function bjs_StaticBox_create_static(value) { + TestModule["bjs_StaticBox_makeDefault_static"] = function bjs_StaticBox_makeDefault_static() { try { - let ret = imports.StaticBox.create(value); + let ret = imports.StaticBox.makeDefault(); return swift.memory.retain(ret); } catch (error) { setException(error); return 0 } } - TestModule["bjs_StaticBox_value_static"] = function bjs_StaticBox_value_static() { + TestModule["bjs_StaticBox_dashed_static"] = function bjs_StaticBox_dashed_static() { try { - let ret = imports.StaticBox.value(); - return ret; + let ret = imports.StaticBox["with-dashes"](); + return swift.memory.retain(ret); } catch (error) { setException(error); return 0 } } - TestModule["bjs_StaticBox_makeDefault_static"] = function bjs_StaticBox_makeDefault_static() { + TestModule["bjs_StaticBox_create_static"] = function bjs_StaticBox_create_static(value) { try { - let ret = imports.StaticBox.makeDefault(); + let ret = imports.StaticBox.create(value); return swift.memory.retain(ret); } catch (error) { setException(error); return 0 } } - TestModule["bjs_StaticBox_dashed_static"] = function bjs_StaticBox_dashed_static() { + TestModule["bjs_StaticBox_value_static"] = function bjs_StaticBox_value_static() { try { - let ret = imports.StaticBox["with-dashes"](); - return swift.memory.retain(ret); + let ret = imports.StaticBox.value(); + return ret; } catch (error) { setException(error); return 0 From 5161a41903aa660c84ad30f332070c07e2f4fcc5 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 12:54:10 +0900 Subject: [PATCH 140/252] BridgeJS: Remove support for static members in extensions --- .../BridgeJSCore/SwiftToSkeleton.swift | 51 +--------------- .../MacroSwift/JSClassStaticFunctions.swift | 8 +-- .../JSClassStaticFunctions.json | 60 +++++++------------ .../JSClassStaticFunctions.swift | 56 ++++++++--------- .../JSClassStaticFunctions.d.ts | 8 +-- .../JSClassStaticFunctions.js | 20 +++---- 6 files changed, 65 insertions(+), 138 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index d84d30506..9fb8b8ab0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -1856,8 +1856,6 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { private let inputFilePath: String private var jsClassNames: Set private let parent: SwiftToSkeleton - private var staticMethodsByType: [String: [ImportedFunctionSkeleton]] = [:] - // MARK: - State Management enum State { @@ -2118,7 +2116,6 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { private func exitJSClass() { if case .jsClassBody(let typeName) = state, let type = currentType, type.name == typeName { - let externalStaticMethods = staticMethodsByType[type.name] ?? [] importedTypes.append( ImportedTypeSkeleton( name: type.name, @@ -2126,13 +2123,12 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { from: type.from, constructor: type.constructor, methods: type.methods, - staticMethods: type.staticMethods + externalStaticMethods, + staticMethods: type.staticMethods, getters: type.getters, setters: type.setters, documentation: nil ) ) - staticMethodsByType[type.name] = nil currentType = nil } stateStack.removeLast() @@ -2172,12 +2168,6 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { // MARK: - Visitor Methods - override func visit(_ node: ExtensionDeclSyntax) -> SyntaxVisitorContinueKind { - let typeName = node.extendedType.trimmedDescription - collectStaticMembers(in: node.memberBlock.members, typeName: typeName) - return .skipChildren - } - override func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { switch state { case .topLevel: @@ -2318,45 +2308,6 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } } - // MARK: - Member Collection - - private func collectStaticMembers(in members: MemberBlockItemListSyntax, typeName: String) { - for member in members { - if let function = member.decl.as(FunctionDeclSyntax.self) { - if let jsFunction = AttributeChecker.firstJSFunctionAttribute(function.attributes), - let parsed = parseFunction(jsFunction, function) { - if jsClassNames.contains(typeName) { - if let index = importedTypes.firstIndex(where: { $0.name == typeName }) { - importedTypes[index].staticMethods.append(parsed) - } else { - importedTypes.append(ImportedTypeSkeleton(name: typeName, staticMethods: [parsed])) - } - } else { - importedFunctions.append(parsed) - } - } else if AttributeChecker.hasJSSetterAttribute(function.attributes) { - errors.append( - DiagnosticError( - node: function, - message: - "@JSSetter is not supported for static members. Use it only for instance members in @JSClass types." - ) - ) - } - } else if let variable = member.decl.as(VariableDeclSyntax.self), - AttributeChecker.hasJSGetterAttribute(variable.attributes) - { - errors.append( - DiagnosticError( - node: variable, - message: - "@JSGetter is not supported for static members. Use it only for instance members in @JSClass types." - ) - ) - } - } - } - // MARK: - Parsing Methods private func parseConstructor( diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift index 891eab118..c64952565 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSClassStaticFunctions.swift @@ -1,14 +1,8 @@ -extension StaticBox { - @JSFunction static func makeDefault() throws(JSException) -> StaticBox -} - @JSClass struct StaticBox { @JSFunction static func create(_ value: Double) throws(JSException) -> StaticBox @JSFunction func value() throws(JSException) -> Double @JSFunction static func value() throws(JSException) -> Double -} - -extension StaticBox { + @JSFunction static func makeDefault() throws(JSException) -> StaticBox @JSFunction(jsName: "with-dashes") static func dashed() throws(JSException) -> StaticBox } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json index 7bf5db0fd..df3d3829e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json @@ -24,43 +24,6 @@ ], "types" : [ - { - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "StaticBox", - "setters" : [ - - ], - "staticMethods" : [ - { - "name" : "makeDefault", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - "_0" : "StaticBox" - } - } - }, - { - "jsName" : "with-dashes", - "name" : "dashed", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - "_0" : "StaticBox" - } - } - } - ] - }, { "getters" : [ @@ -111,6 +74,29 @@ } } + }, + { + "name" : "makeDefault", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "StaticBox" + } + } + }, + { + "jsName" : "with-dashes", + "name" : "dashed", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "StaticBox" + } + } } ] }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift index efb83f406..5e297f929 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift @@ -1,51 +1,35 @@ #if arch(wasm32) -@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_makeDefault_static") -fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 +@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_create_static") +fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 #else -fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 { +fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_dashed_static") -fileprivate func bjs_StaticBox_dashed_static() -> Int32 +@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_value_static") +fileprivate func bjs_StaticBox_value_static() -> Float64 #else -fileprivate func bjs_StaticBox_dashed_static() -> Int32 { +fileprivate func bjs_StaticBox_value_static() -> Float64 { fatalError("Only available on WebAssembly") } #endif -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_dashed() throws(JSException) -> StaticBox { - let ret = bjs_StaticBox_dashed_static() - if let error = _swift_js_take_exception() { - throw error - } - return StaticBox.bridgeJSLiftReturn(ret) -} - #if arch(wasm32) -@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_create_static") -fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 +@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_makeDefault_static") +fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 #else -fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 { +fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_value_static") -fileprivate func bjs_StaticBox_value_static() -> Float64 +@_extern(wasm, module: "TestModule", name: "bjs_StaticBox_dashed_static") +fileprivate func bjs_StaticBox_dashed_static() -> Int32 #else -fileprivate func bjs_StaticBox_value_static() -> Float64 { +fileprivate func bjs_StaticBox_dashed_static() -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -76,6 +60,22 @@ func _$StaticBox_value() throws(JSException) -> Double { 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_dashed() throws(JSException) -> StaticBox { + let ret = bjs_StaticBox_dashed_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) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts index e4c59459a..3b2b5de99 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts @@ -4,8 +4,6 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -export interface StaticBox { -} export interface StaticBox { value(): number; } @@ -14,13 +12,11 @@ export interface WithCtor { export type Exports = { } export type Imports = { - StaticBox: { - makeDefault(): StaticBox; - "with-dashes"(): StaticBox; - } StaticBox: { create(value: number): StaticBox; value(): number; + makeDefault(): StaticBox; + "with-dashes"(): StaticBox; } WithCtor: { new(value: number): WithCtor; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index 4acf43685..f8f0ba86f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -203,37 +203,37 @@ export async function createInstantiator(options, swift) { return pointer || 0; } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; - TestModule["bjs_StaticBox_makeDefault_static"] = function bjs_StaticBox_makeDefault_static() { + TestModule["bjs_StaticBox_create_static"] = function bjs_StaticBox_create_static(value) { try { - let ret = imports.StaticBox.makeDefault(); + let ret = imports.StaticBox.create(value); return swift.memory.retain(ret); } catch (error) { setException(error); return 0 } } - TestModule["bjs_StaticBox_dashed_static"] = function bjs_StaticBox_dashed_static() { + TestModule["bjs_StaticBox_value_static"] = function bjs_StaticBox_value_static() { try { - let ret = imports.StaticBox["with-dashes"](); - return swift.memory.retain(ret); + let ret = imports.StaticBox.value(); + return ret; } catch (error) { setException(error); return 0 } } - TestModule["bjs_StaticBox_create_static"] = function bjs_StaticBox_create_static(value) { + TestModule["bjs_StaticBox_makeDefault_static"] = function bjs_StaticBox_makeDefault_static() { try { - let ret = imports.StaticBox.create(value); + let ret = imports.StaticBox.makeDefault(); return swift.memory.retain(ret); } catch (error) { setException(error); return 0 } } - TestModule["bjs_StaticBox_value_static"] = function bjs_StaticBox_value_static() { + TestModule["bjs_StaticBox_dashed_static"] = function bjs_StaticBox_dashed_static() { try { - let ret = imports.StaticBox.value(); - return ret; + let ret = imports.StaticBox["with-dashes"](); + return swift.memory.retain(ret); } catch (error) { setException(error); return 0 From fc7e237ae303d0a8b373ae98024083f7efaf91be Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 00:45:00 +0900 Subject: [PATCH 141/252] BridgeJS: Support `T | null` and `T | undefined` --- .../Sources/BridgeJSCore/ExportSwift.swift | 39 +- .../Sources/BridgeJSCore/ImportTS.swift | 30 +- .../BridgeJSCore/SwiftToSkeleton.swift | 24 ++ .../Sources/BridgeJSLink/BridgeJSLink.swift | 2 + .../Sources/BridgeJSLink/JSGlueGen.swift | 228 ++++++++-- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 16 +- .../TS2Swift/JavaScript/src/processor.js | 24 ++ .../JavaScriptKit/BridgeJSIntrinsics.swift | 19 +- Sources/JavaScriptKit/JSUndefinedOr.swift | 408 ++++++++++++++++++ .../BridgeJSRuntimeTests/ExportAPITests.swift | 23 + .../Generated/BridgeJS.Macros.swift | 4 + .../Generated/BridgeJS.swift | 195 +++++++++ .../Generated/JavaScript/BridgeJS.json | 267 ++++++++++++ .../BridgeJSRuntimeTests/ImportAPITests.swift | 20 + Tests/BridgeJSRuntimeTests/bridge-js.d.ts | 2 + Tests/prelude.mjs | 26 ++ tsconfig.json | 6 + 17 files changed, 1250 insertions(+), 83 deletions(-) create mode 100644 Sources/JavaScriptKit/JSUndefinedOr.swift create mode 100644 tsconfig.json diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index dc8b5e048..39281ddfb 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -820,6 +820,8 @@ struct StackCodegen { return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_i32())" case .optional(let wrappedType): return liftOptionalExpression(wrappedType: wrappedType) + case .undefinedOr(let wrappedType): + return liftUndefinedExpression(wrappedType: wrappedType) case .array(let elementType): return liftArrayExpression(elementType: elementType) case .closure: @@ -839,7 +841,7 @@ struct StackCodegen { return liftArrayExpressionInline(elementType: elementType) case .swiftProtocol(let protocolName): return "[Any\(raw: protocolName)].bridgeJSLiftParameter()" - case .optional, .array, .closure: + case .optional, .undefinedOr, .array, .closure: return liftArrayExpressionInline(elementType: elementType) case .void, .namespaceEnum: fatalError("Invalid array element type: \(elementType)") @@ -883,11 +885,34 @@ struct StackCodegen { } }() """ - case .void, .namespaceEnum, .closure, .optional, .unsafePointer, .swiftProtocol: + case .undefinedOr, .void, .namespaceEnum, .closure, .optional, .unsafePointer, .swiftProtocol: fatalError("Invalid optional wrapped type: \(wrappedType)") } } + private func liftUndefinedExpression(wrappedType: BridgeType) -> ExprSyntax { + switch wrappedType { + case .string, .int, .uint, .bool, .float, .double, .jsObject, + .swiftStruct, .swiftHeapObject, .caseEnum, .associatedValueEnum, .rawValueEnum: + return "JSUndefinedOr<\(raw: wrappedType.swiftType)>.bridgeJSLiftParameter()" + case .array(let elementType): + let arrayLift = liftArrayExpression(elementType: elementType) + let swiftTypeName = elementType.swiftType + return """ + { + let __isDefined = _swift_js_pop_i32() + if __isDefined == 0 { + return JSUndefinedOr<\(raw: swiftTypeName)>.undefined + } else { + return JSUndefinedOr<\(raw: swiftTypeName)>(optional: \(arrayLift)) + } + }() + """ + case .void, .namespaceEnum, .closure, .optional, .undefinedOr, .unsafePointer, .swiftProtocol: + fatalError("Invalid undefinedOr wrapped type: \(wrappedType)") + } + } + /// Generates statements to lower/push a value onto the stack. /// - Parameters: /// - type: The BridgeType to lower @@ -917,6 +942,8 @@ struct StackCodegen { return ["\(raw: accessor).bridgeJSLowerReturn()"] case .optional(let wrappedType): return lowerOptionalStatements(wrappedType: wrappedType, accessor: accessor, varPrefix: varPrefix) + case .undefinedOr(let wrappedType): + return lowerOptionalStatements(wrappedType: wrappedType, accessor: accessor, varPrefix: varPrefix) case .void, .namespaceEnum: return [] case .array(let elementType): @@ -938,7 +965,7 @@ struct StackCodegen { return ["\(raw: accessor).map { $0.jsObject }.bridgeJSLowerReturn()"] case .swiftProtocol(let protocolName): return ["\(raw: accessor).map { $0 as! Any\(raw: protocolName) }.bridgeJSLowerReturn()"] - case .optional, .array, .closure: + case .optional, .undefinedOr, .array, .closure: return lowerArrayStatementsInline( elementType: elementType, accessor: accessor, @@ -1597,6 +1624,7 @@ extension BridgeType { case .swiftProtocol(let name): return "Any\(name)" case .void: return "Void" case .optional(let wrappedType): return "Optional<\(wrappedType.swiftType)>" + case .undefinedOr(let wrappedType): return "JSUndefinedOr<\(wrappedType.swiftType)>" case .array(let elementType): return "[\(elementType.swiftType)]" case .caseEnum(let name): return name case .rawValueEnum(let name, _): return name @@ -1644,6 +1672,10 @@ extension BridgeType { var optionalParams: [(name: String, type: WasmCoreType)] = [("isSome", .i32)] optionalParams.append(contentsOf: try wrappedType.liftParameterInfo().parameters) return LiftingIntrinsicInfo(parameters: optionalParams) + case .undefinedOr(let wrappedType): + var params: [(name: String, type: WasmCoreType)] = [("isDefined", .i32)] + params.append(contentsOf: try wrappedType.liftParameterInfo().parameters) + return LiftingIntrinsicInfo(parameters: params) case .caseEnum: return .caseEnum case .rawValueEnum(_, let rawType): return rawType.liftingIntrinsicInfo @@ -1693,6 +1725,7 @@ extension BridgeType { case .swiftProtocol: return .jsObject case .void: return .void case .optional: return .optional + case .undefinedOr: return .optional case .caseEnum: return .caseEnum case .rawValueEnum(_, let rawType): return rawType.loweringIntrinsicInfo diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 7c391eea0..7ac72cffc 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -925,15 +925,15 @@ extension BridgeType { case .namespaceEnum: throw BridgeJSCoreError("Namespace enums cannot be used as parameters") case .optional(let wrappedType): - switch context { - case .importTS: - throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") - case .exportSwift: - let wrappedInfo = try wrappedType.loweringParameterInfo(context: context) - var params = [("isSome", WasmCoreType.i32)] - params.append(contentsOf: wrappedInfo.loweredParameters) - return LoweringParameterInfo(loweredParameters: params) - } + let wrappedInfo = try wrappedType.loweringParameterInfo(context: context) + var params = [("isSome", WasmCoreType.i32)] + params.append(contentsOf: wrappedInfo.loweredParameters) + return LoweringParameterInfo(loweredParameters: params) + case .undefinedOr(let wrappedType): + let wrappedInfo = try wrappedType.loweringParameterInfo(context: context) + var params = [("isDefined", WasmCoreType.i32)] + params.append(contentsOf: wrappedInfo.loweredParameters) + return LoweringParameterInfo(loweredParameters: params) case .array: switch context { case .importTS: @@ -1019,13 +1019,11 @@ extension BridgeType { case .namespaceEnum: throw BridgeJSCoreError("Namespace enums cannot be used as return values") case .optional(let wrappedType): - switch context { - case .importTS: - throw BridgeJSCoreError("Optional types are not yet supported in TypeScript imports") - case .exportSwift: - let wrappedInfo = try wrappedType.liftingReturnInfo(context: context) - return LiftingReturnInfo(valueToLift: wrappedInfo.valueToLift) - } + let wrappedInfo = try wrappedType.liftingReturnInfo(context: context) + return LiftingReturnInfo(valueToLift: wrappedInfo.valueToLift) + case .undefinedOr(let wrappedType): + let wrappedInfo = try wrappedType.liftingReturnInfo(context: context) + return LiftingReturnInfo(valueToLift: wrappedInfo.valueToLift) case .array: switch context { case .importTS: diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index b780012f0..67f1421a2 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -133,6 +133,30 @@ public final class SwiftToSkeleton { return .optional(baseType) } } + // JSUndefinedOr + if let identifierType = type.as(IdentifierTypeSyntax.self), + identifierType.name.text == "JSUndefinedOr", + let genericArgs = identifierType.genericArgumentClause?.arguments, + genericArgs.count == 1, + let argType = TypeSyntax(genericArgs.first?.argument) + { + if let baseType = lookupType(for: argType, errors: &errors) { + return .undefinedOr(baseType) + } + } + // JavaScriptKit.JSUndefinedOr + if let memberType = type.as(MemberTypeSyntax.self), + let baseType = memberType.baseType.as(IdentifierTypeSyntax.self), + baseType.name.text == "JavaScriptKit", + memberType.name.text == "JSUndefinedOr", + let genericArgs = memberType.genericArgumentClause?.arguments, + genericArgs.count == 1, + let argType = TypeSyntax(genericArgs.first?.argument) + { + if let wrappedType = lookupType(for: argType, errors: &errors) { + return .undefinedOr(wrappedType) + } + } // Optional if let identifierType = type.as(IdentifierTypeSyntax.self), identifierType.name.text == "Optional", diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 60b55cd47..0b1be8a10 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -3405,6 +3405,8 @@ extension BridgeType { return "number" case .optional(let wrappedType): return "\(wrappedType.tsType) | null" + case .undefinedOr(let wrappedType): + return "\(wrappedType.tsType) | undefined" case .caseEnum(let name): return "\(name)Tag" case .rawValueEnum(let name, _): diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index c78a92de7..ad27dc6f3 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -296,7 +296,10 @@ struct IntrinsicJSFragment: Sendable { ) } - static func optionalLiftParameter(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + static func optionalLiftParameter( + wrappedType: BridgeType, + absenceLiteral: String = "null" + ) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["isSome", "wrappedValue"], printCode: { arguments, scope, printer, cleanupCode in @@ -306,9 +309,9 @@ struct IntrinsicJSFragment: Sendable { switch wrappedType { case .int, .float, .double, .caseEnum: - resultExpr = "\(isSome) ? \(wrappedValue) : null" + resultExpr = "\(isSome) ? \(wrappedValue) : \(absenceLiteral)" case .bool: - resultExpr = "\(isSome) ? \(wrappedValue) !== 0 : null" + resultExpr = "\(isSome) ? \(wrappedValue) !== 0 : \(absenceLiteral)" case .string: let objectLabel = scope.variable("obj") printer.write("let \(objectLabel);") @@ -320,12 +323,12 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(wrappedValue));") } printer.write("}") - resultExpr = "\(isSome) ? \(objectLabel) : null" + resultExpr = "\(isSome) ? \(objectLabel) : \(absenceLiteral)" case .swiftHeapObject(let name): - resultExpr = "\(isSome) ? \(name).__construct(\(wrappedValue)) : null" + resultExpr = "\(isSome) ? \(name).__construct(\(wrappedValue)) : \(absenceLiteral)" case .jsObject: resultExpr = - "\(isSome) ? \(JSGlueVariableScope.reservedSwift).memory.getObject(\(wrappedValue)) : null" + "\(isSome) ? \(JSGlueVariableScope.reservedSwift).memory.getObject(\(wrappedValue)) : \(absenceLiteral)" case .rawValueEnum(_, let rawType): switch rawType { case .string: @@ -339,11 +342,11 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(wrappedValue));") } printer.write("}") - resultExpr = "\(isSome) ? \(objectLabel) : null" + resultExpr = "\(isSome) ? \(objectLabel) : \(absenceLiteral)" case .bool: - resultExpr = "\(isSome) ? \(wrappedValue) !== 0 : null" + resultExpr = "\(isSome) ? \(wrappedValue) !== 0 : \(absenceLiteral)" default: - resultExpr = "\(isSome) ? \(wrappedValue) : null" + resultExpr = "\(isSome) ? \(wrappedValue) : \(absenceLiteral)" } case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName @@ -356,7 +359,7 @@ struct IntrinsicJSFragment: Sendable { ) } printer.write("}") - resultExpr = "\(isSome) ? \(enumVar) : null" + resultExpr = "\(isSome) ? \(enumVar) : \(absenceLiteral)" case .swiftStruct(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName let structVar = scope.variable("structValue") @@ -369,7 +372,7 @@ struct IntrinsicJSFragment: Sendable { } printer.write("} else {") printer.indent { - printer.write("\(structVar) = null;") + printer.write("\(structVar) = \(absenceLiteral);") } printer.write("}") resultExpr = structVar @@ -387,12 +390,12 @@ struct IntrinsicJSFragment: Sendable { } printer.write("} else {") printer.indent { - printer.write("\(arrayVar) = null;") + printer.write("\(arrayVar) = \(absenceLiteral);") } printer.write("}") resultExpr = arrayVar default: - resultExpr = "\(isSome) ? \(wrappedValue) : null" + resultExpr = "\(isSome) ? \(wrappedValue) : \(absenceLiteral)" } return [resultExpr] @@ -514,7 +517,8 @@ struct IntrinsicJSFragment: Sendable { static func optionalLiftReturn( wrappedType: BridgeType, - context: BridgeContext = .exportSwift + context: BridgeContext = .exportSwift, + absenceLiteral: String = "null" ) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: [], @@ -550,7 +554,7 @@ struct IntrinsicJSFragment: Sendable { ? "\(className).__construct(\(pointerVar))" : "_exports['\(className)'].__construct(\(pointerVar))" printer.write( - "const \(resultVar) = \(pointerVar) === null ? null : \(constructExpr);" + "const \(resultVar) = \(pointerVar) === null ? \(absenceLiteral) : \(constructExpr);" ) case .caseEnum: printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalInt);") @@ -586,7 +590,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("let \(resultVar);") printer.write("if (\(isNullVar)) {") printer.indent { - printer.write("\(resultVar) = null;") + printer.write("\(resultVar) = \(absenceLiteral);") } printer.write("} else {") printer.indent { @@ -608,7 +612,7 @@ struct IntrinsicJSFragment: Sendable { } printer.write("} else {") printer.indent { - printer.write("\(resultVar) = null;") + printer.write("\(resultVar) = \(absenceLiteral);") } printer.write("}") case .array(let elementType): @@ -625,7 +629,7 @@ struct IntrinsicJSFragment: Sendable { } printer.write("} else {") printer.indent { - printer.write("\(resultVar) = null;") + printer.write("\(resultVar) = \(absenceLiteral);") } printer.write("}") default: @@ -637,7 +641,10 @@ struct IntrinsicJSFragment: Sendable { ) } - static func optionalLowerReturn(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + static func optionalLowerReturn( + wrappedType: BridgeType, + presenceCheck: (@Sendable (String) -> String)? = nil + ) throws -> IntrinsicJSFragment { switch wrappedType { case .void, .optional, .namespaceEnum, .closure: throw BridgeJSLinkError(message: "Unsupported optional wrapped type for protocol export: \(wrappedType)") @@ -649,7 +656,8 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanupCode in let value = arguments[0] let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(value) != null;") + let presenceExpr = presenceCheck?(value) ?? "\(value) != null" + printer.write("const \(isSomeVar) = \(presenceExpr);") switch wrappedType { case .bool: @@ -905,7 +913,7 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .optional(let wrappedType): + case .optional(let wrappedType), .undefinedOr(let wrappedType): return try closureOptionalLiftParameter(wrappedType: wrappedType) default: throw BridgeJSLinkError(message: "Unsupported closure parameter type for lifting: \(type)") @@ -1106,7 +1114,7 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .optional(let wrappedType): + case .optional(let wrappedType), .undefinedOr(let wrappedType): return try closureOptionalLowerReturn(wrappedType: wrappedType) default: throw BridgeJSLinkError(message: "Unsupported closure return type for lowering: \(type)") @@ -1303,19 +1311,28 @@ struct IntrinsicJSFragment: Sendable { ) case .optional(let wrappedType): return try closureOptionalLiftReturn(wrappedType: wrappedType) + case .undefinedOr(let wrappedType): + return try closureOptionalLiftReturn(wrappedType: wrappedType, absenceLiteral: "undefined") default: throw BridgeJSLinkError(message: "Unsupported closure return type for lifting: \(type)") } } /// Handles optional return lifting for Swift closure returns - private static func closureOptionalLiftReturn(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + private static func closureOptionalLiftReturn( + wrappedType: BridgeType, + absenceLiteral: String = "null" + ) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["invokeCall"], printCode: { arguments, scope, printer, cleanupCode in let invokeCall = arguments[0] printer.write("\(invokeCall);") - let baseFragment = optionalLiftReturn(wrappedType: wrappedType, context: .importTS) + let baseFragment = optionalLiftReturn( + wrappedType: wrappedType, + context: .importTS, + absenceLiteral: absenceLiteral + ) let lifted = baseFragment.printCode([], scope, printer, cleanupCode) if !lifted.isEmpty { printer.write("return \(lifted[0]);") @@ -1361,6 +1378,8 @@ struct IntrinsicJSFragment: Sendable { default: printer.write("return;") } + case .undefinedOr: + printer.write("return;") default: printer.write("return 0;") } @@ -1384,6 +1403,8 @@ struct IntrinsicJSFragment: Sendable { case .void: return .void case .optional(let wrappedType): return try .optionalLowerParameter(wrappedType: wrappedType) + case .undefinedOr(let wrappedType): + return try .optionalLowerParameter(wrappedType: wrappedType) case .caseEnum: return .identity case .rawValueEnum(_, let rawType): switch rawType { @@ -1428,6 +1449,8 @@ struct IntrinsicJSFragment: Sendable { case .swiftProtocol: return .jsObjectLiftReturn case .void: return .void case .optional(let wrappedType): return .optionalLiftReturn(wrappedType: wrappedType) + case .undefinedOr(let wrappedType): + return .optionalLiftReturn(wrappedType: wrappedType, absenceLiteral: "undefined") case .caseEnum: return .identity case .rawValueEnum(_, let rawType): switch rawType { @@ -1486,14 +1509,9 @@ struct IntrinsicJSFragment: Sendable { message: "Void can't appear in parameters of imported JS functions" ) case .optional(let wrappedType): - switch context { - case .importTS: - throw BridgeJSLinkError( - message: "Optional types are not supported for imported JS functions: \(wrappedType)" - ) - case .exportSwift: - return try .optionalLiftParameter(wrappedType: wrappedType) - } + return try .optionalLiftParameter(wrappedType: wrappedType) + case .undefinedOr(let wrappedType): + return try .optionalLiftParameter(wrappedType: wrappedType, absenceLiteral: "undefined") case .caseEnum: return .identity case .rawValueEnum(_, let rawType): switch rawType { @@ -1584,14 +1602,12 @@ struct IntrinsicJSFragment: Sendable { case .swiftProtocol: return .jsObjectLowerReturn case .void: return .void case .optional(let wrappedType): - switch context { - case .importTS: - throw BridgeJSLinkError( - message: "Optional types are not supported for imported JS functions: \(wrappedType)" - ) - case .exportSwift: - return try .optionalLowerReturn(wrappedType: wrappedType) - } + return try .optionalLowerReturn(wrappedType: wrappedType) + case .undefinedOr(let wrappedType): + return try .optionalLowerReturn( + wrappedType: wrappedType, + presenceCheck: { value in "\(value) !== undefined" } + ) case .caseEnum: return .identity case .rawValueEnum(_, let rawType): switch rawType { @@ -1998,6 +2014,67 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") } + return [] + } + ) + case .undefinedOr(let wrappedType): + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let isSomeVar = scope.variable("isSome") + printer.write("const \(isSomeVar) = \(value) !== undefined;") + + switch wrappedType { + case .string: + let idVar = scope.variable("id") + printer.write("let \(idVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let bytesVar = scope.variable("bytes") + printer.write( + "let \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" + ) + printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + } + printer.write("} else {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + cleanup.write("if(\(idVar)) {") + cleanup.indent { + cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") + } + cleanup.write("}") + case .int, .uint: + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) | 0) : 0);" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + case .bool: + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) ? 1 : 0) : 0);" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + case .float: + printer.write( + "\(JSGlueVariableScope.reservedTmpParamF32s).push(\(isSomeVar) ? Math.fround(\(value)) : 0.0);" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + case .double: + printer.write( + "\(JSGlueVariableScope.reservedTmpParamF64s).push(\(isSomeVar) ? \(value) : 0.0);" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + default: + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + } + return [] } ) @@ -2083,6 +2160,34 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") + return [optVar] + } + ) + case .undefinedOr(let wrappedType): + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let optVar = scope.variable("optional") + let isSomeVar = scope.variable("isSome") + + printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("let \(optVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let wrappedFragment = associatedValuePopPayload(type: wrappedType) + let wrappedResults = wrappedFragment.printCode([], scope, printer, cleanup) + if let wrappedResult = wrappedResults.first { + printer.write("\(optVar) = \(wrappedResult);") + } else { + printer.write("\(optVar) = undefined;") + } + } + printer.write("} else {") + printer.indent { + printer.write("\(optVar) = undefined;") + } + printer.write("}") + return [optVar] } ) @@ -2331,6 +2436,8 @@ struct IntrinsicJSFragment: Sendable { return try! arrayLift(elementType: innerElementType) case .optional(let wrappedType): return try optionalElementRaiseFragment(wrappedType: wrappedType) + case .undefinedOr(let wrappedType): + return try optionalElementRaiseFragment(wrappedType: wrappedType, absenceLiteral: "undefined") case .unsafePointer: return IntrinsicJSFragment( parameters: [], @@ -2458,6 +2565,14 @@ struct IntrinsicJSFragment: Sendable { return [] } ) + case .undefinedOr: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("throw new Error(\"Unsupported array element type for lowering: \(elementType)\");") + return [] + } + ) case .swiftHeapObject: return IntrinsicJSFragment( parameters: ["value"], @@ -2479,6 +2594,8 @@ struct IntrinsicJSFragment: Sendable { ) case .array(let innerElementType): return try! arrayLower(elementType: innerElementType) + case .undefinedOr: + throw BridgeJSLinkError(message: "Unsupported array element type: \(elementType)") case .optional(let wrappedType): return try optionalElementLowerFragment(wrappedType: wrappedType) case .swiftProtocol: @@ -2506,7 +2623,10 @@ struct IntrinsicJSFragment: Sendable { } } - private static func optionalElementRaiseFragment(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + private static func optionalElementRaiseFragment( + wrappedType: BridgeType, + absenceLiteral: String = "null" + ) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: [], printCode: { arguments, scope, printer, cleanup in @@ -2517,7 +2637,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("let \(resultVar);") printer.write("if (\(isSomeVar) === 0) {") printer.indent { - printer.write("\(resultVar) = null;") + printer.write("\(resultVar) = \(absenceLiteral);") } printer.write("} else {") printer.indent { @@ -2536,14 +2656,18 @@ struct IntrinsicJSFragment: Sendable { ) } - private static func optionalElementLowerFragment(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + private static func optionalElementLowerFragment( + wrappedType: BridgeType, + presenceCheck: (@Sendable (String) -> String)? = nil + ) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in let value = arguments[0] let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(value) != null ? 1 : 0;") + let presenceExpr = presenceCheck?(value) ?? "\(value) != null" + printer.write("const \(isSomeVar) = \(presenceExpr) ? 1 : 0;") // Cleanup is written inside the if block so retained id is in scope let localCleanupWriter = CodeFragmentPrinter() printer.write("if (\(isSomeVar)) {") @@ -3095,6 +3219,14 @@ struct IntrinsicJSFragment: Sendable { } } ) + case .undefinedOr: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("throw new Error(\"Unsupported struct field type for lowering: \(field.type)\");") + return [] + } + ) case .swiftStruct(let nestedName): return IntrinsicJSFragment( parameters: ["value"], @@ -3451,6 +3583,14 @@ struct IntrinsicJSFragment: Sendable { return [varName] } ) + case .undefinedOr: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + printer.write("throw new Error(\"Unsupported struct field type: \(field.type)\");") + return [] + } + ) case .void, .swiftProtocol, .namespaceEnum, .closure: // These types should not appear as struct fields return IntrinsicJSFragment( diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 5013dda66..fabff5d3e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -130,6 +130,7 @@ public enum BridgeType: Codable, Equatable, Hashable, Sendable { case int, uint, float, double, string, bool, jsObject(String?), swiftHeapObject(String), void case unsafePointer(UnsafePointerType) indirect case optional(BridgeType) + indirect case undefinedOr(BridgeType) indirect case array(BridgeType) case caseEnum(String) case rawValueEnum(String, SwiftEnumRawType) @@ -895,7 +896,7 @@ extension BridgeType { return .pointer case .unsafePointer: return .pointer - case .optional(_): + case .optional(_), .undefinedOr(_): return nil case .caseEnum: return .i32 @@ -923,6 +924,7 @@ extension BridgeType { /// Returns true if this type is optional public var isOptional: Bool { if case .optional = self { return true } + if case .undefinedOr = self { return true } return false } @@ -961,6 +963,8 @@ extension BridgeType { return kindCode case .optional(let wrapped): return "Sq\(wrapped.mangleTypeName)" + case .undefinedOr(let wrapped): + return "Su\(wrapped.mangleTypeName)" case .caseEnum(let name), .rawValueEnum(let name, _), .associatedValueEnum(let name), @@ -987,7 +991,15 @@ extension BridgeType { /// Side channels are needed when the wrapped type cannot be directly returned via WASM, /// or when we need to distinguish null from absent value for certain primitives. public func usesSideChannelForOptionalReturn() -> Bool { - guard case .optional(let wrappedType) = self else { return false } + let wrappedType: BridgeType + switch self { + case .optional(let wrapped): + wrappedType = wrapped + case .undefinedOr(let wrapped): + wrappedType = wrapped + default: + return false + } switch wrappedType { case .string, .int, .float, .double, .jsObject, .swiftProtocol: diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 258334ee8..fd31967b0 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -676,6 +676,30 @@ export class TypeProcessor { * @returns {string} */ const convert = (type) => { + // Handle nullable/undefined unions (e.g. T | null, T | undefined) + const isUnionType = (type.flags & ts.TypeFlags.Union) !== 0; + if (isUnionType) { + /** @type {ts.UnionType} */ + // @ts-ignore + const unionType = type; + const unionTypes = unionType.types; + const hasNull = unionTypes.some(t => (t.flags & ts.TypeFlags.Null) !== 0); + const hasUndefined = unionTypes.some(t => (t.flags & ts.TypeFlags.Undefined) !== 0); + const nonNullableTypes = unionTypes.filter( + t => (t.flags & ts.TypeFlags.Null) === 0 && (t.flags & ts.TypeFlags.Undefined) === 0 + ); + if (nonNullableTypes.length === 1 && (hasNull || hasUndefined)) { + const wrapped = this.visitType(nonNullableTypes[0], node); + if (hasNull && hasUndefined) { + return `JSUndefinedOr>`; + } + if (hasNull) { + return `Optional<${wrapped}>`; + } + return `JSUndefinedOr<${wrapped}>`; + } + } + /** @type {Record} */ const typeMap = { "number": "Double", diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 7b2d97f06..ac60ca860 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -1015,11 +1015,6 @@ extension UnsafeMutablePointer: _BridgedSwiftStackType { } extension Optional where Wrapped == Bool { - // MARK: ImportTS - - @available(*, unavailable, message: "Optional Bool type is not supported to be passed to imported JS functions") - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Void {} - // MARK: ExportSwift @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( @@ -1071,11 +1066,6 @@ extension Optional where Wrapped == Bool { } extension Optional where Wrapped == Int { - // MARK: ImportTS - - @available(*, unavailable, message: "Optional Int type is not supported to be passed to imported JS functions") - @_spi(BridgeJS) public func bridgeJSLowerParameter() -> Void {} - // MARK: ExportSwift @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( @@ -1123,14 +1113,7 @@ extension Optional where Wrapped == Int { } extension Optional where Wrapped == UInt { - // MARK: ImportTS - - @available(*, unavailable, message: "Optional UInt type is not supported to be passed to imported JS functions") - @_spi(BridgeJS) public func bridgeJSLowerParameter() -> Void {} - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameterWithPresence() -> ( + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( isSome: Int32, value: Int32 ) { switch consume self { diff --git a/Sources/JavaScriptKit/JSUndefinedOr.swift b/Sources/JavaScriptKit/JSUndefinedOr.swift new file mode 100644 index 000000000..f70cfc0df --- /dev/null +++ b/Sources/JavaScriptKit/JSUndefinedOr.swift @@ -0,0 +1,408 @@ +@frozen public enum JSUndefinedOr { + case undefined + case value(Wrapped) + + /// Convenience accessor for the undefined case. + public static var undefinedValue: Self { .undefined } + + @inlinable + init(optional: Wrapped?) { + self = optional.map(Self.value) ?? .undefined + } + + @inlinable + var optionalRepresentation: Wrapped? { + switch self { + case .undefined: + return nil + case .value(let wrapped): + return wrapped + } + } +} + +extension JSUndefinedOr: ConstructibleFromJSValue where Wrapped: ConstructibleFromJSValue { + public static func construct(from value: JSValue) -> Self? { + if value.isUndefined { return .undefined } + guard let wrapped = Wrapped.construct(from: value) else { return nil } + return .value(wrapped) + } +} + +extension JSUndefinedOr: ConvertibleToJSValue where Wrapped: ConvertibleToJSValue { + public var jsValue: JSValue { + switch self { + case .undefined: + return .undefined + case .value(let wrapped): + return wrapped.jsValue + } + } +} + +// MARK: - BridgeJS Optional-style conformances + +extension JSUndefinedOr where Wrapped == Bool { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftReturn(value)) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr where Wrapped == Int { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr where Wrapped == UInt { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr where Wrapped == String { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter( + _ isSome: Int32, + _ bytes: Int32, + _ count: Int32 + ) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, bytes, count)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr where Wrapped == JSObject { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ objectId: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, objectId)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr where Wrapped: _BridgedSwiftProtocolWrapper { + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ objectId: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, objectId)) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr where Wrapped: _BridgedSwiftHeapObject { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, pointer: UnsafeMutableRawPointer) + { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerParameterWithRetain() -> ( + isSome: Int32, pointer: UnsafeMutableRawPointer + ) { + optionalRepresentation.bridgeJSLowerParameterWithRetain() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter( + _ isSome: Int32, + _ pointer: UnsafeMutableRawPointer + ) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, pointer)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } +} + +extension JSUndefinedOr where Wrapped == Float { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr where Wrapped == Double { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float64) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float64) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr where Wrapped: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ caseId: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, caseId)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ caseId: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftReturn(caseId)) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr where Wrapped: _BridgedSwiftTypeLoweredIntoVoidType { + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr +where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == String { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter( + _ isSome: Int32, + _ bytes: Int32, + _ count: Int32 + ) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, bytes, count)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Int { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Bool { + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr +where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Float { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr +where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Double { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float64) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float64) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr where Wrapped: _BridgedSwiftAssociatedValueEnum { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, caseId: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ caseId: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, caseId)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ caseId: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftReturn(caseId)) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension JSUndefinedOr where Wrapped: _BridgedSwiftStruct { + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index a20ea2dd5..007f0b265 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -611,6 +611,29 @@ typealias OptionalAge = Int? @JS func roundTripOptionalClass(value: Greeter?) -> Greeter? { return value } + +@JS func roundTripOptionalGreeter(_ value: Greeter?) -> Greeter? { + value +} + +@JS func applyOptionalGreeter(_ value: Greeter?, _ transform: (Greeter?) -> Greeter?) -> Greeter? { + transform(value) +} + +@JS class OptionalHolder { + @JS var nullableGreeter: Greeter? + @JS var undefinedNumber: JSUndefinedOr + + @JS init(nullableGreeter: Greeter?, undefinedNumber: JSUndefinedOr) { + self.nullableGreeter = nullableGreeter + self.undefinedNumber = undefinedNumber + } +} + +@JS func makeOptionalHolder(nullableGreeter: Greeter?, undefinedNumber: JSUndefinedOr) -> OptionalHolder { + OptionalHolder(nullableGreeter: nullableGreeter, undefinedNumber: undefinedNumber) +} + @JS class OptionalPropertyHolder { @JS var optionalName: String? @JS var optionalAge: Int? = nil diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index e066ad272..ee0455c35 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -14,6 +14,10 @@ @JSFunction func jsRoundTripString(_ v: String) throws(JSException) -> String +@JSFunction func jsRoundTripOptionalNumberNull(_ v: Optional) throws(JSException) -> Optional + +@JSFunction func jsRoundTripOptionalNumberUndefined(_ v: JSUndefinedOr) throws(JSException) -> JSUndefinedOr + @JSFunction func jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void @JSFunction func jsThrowOrNumber(_ shouldThrow: Bool) throws(JSException) -> Double diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 94359a709..a572f4c6f 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -679,6 +679,54 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7 #endif } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif + +private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC: _BridgedSwiftClosureBox { + let closure: (Optional) -> Optional + init(_ closure: @escaping (Optional) -> Optional) { + self.closure = closure + } +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC { + static func bridgeJSLower(_ closure: @escaping (Optional) -> Optional) -> UnsafeMutableRawPointer { + let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(closure) + return Unmanaged.passRetained(box).toOpaque() + } + 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 + } + } +} + +@_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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC>.fromOpaque(boxPtr).takeUnretainedValue() + let result = box.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(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 @@ -4416,6 +4464,39 @@ public func _bjs_roundTripOptionalClass(_ valueIsSome: Int32, _ valueValue: Unsa #endif } +@_expose(wasm, "bjs_roundTripOptionalGreeter") +@_cdecl("bjs_roundTripOptionalGreeter") +public func _bjs_roundTripOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_applyOptionalGreeter") +@_cdecl("bjs_applyOptionalGreeter") +public func _bjs_applyOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer, _ transform: Int32) -> Void { + #if arch(wasm32) + let ret = applyOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue), _: _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC.bridgeJSLift(transform)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeOptionalHolder") +@_cdecl("bjs_makeOptionalHolder") +public func _bjs_makeOptionalHolder(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsDefined: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = makeOptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsDefined, undefinedNumberValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_roundTripOptionalAPIOptionalResult") @_cdecl("bjs_roundTripOptionalAPIOptionalResult") public func _bjs_roundTripOptionalAPIOptionalResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { @@ -5826,6 +5907,84 @@ fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int } #endif +@_expose(wasm, "bjs_OptionalHolder_init") +@_cdecl("bjs_OptionalHolder_init") +public func _bjs_OptionalHolder_init(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsDefined: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = OptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsDefined, 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, _ valueIsDefined: Int32, _ valueValue: Float64) -> Void { + #if arch(wasm32) + OptionalHolder.bridgeJSLiftParameter(_self).undefinedNumber = JSUndefinedOr.bridgeJSLiftParameter(valueIsDefined, 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 { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalHolder_wrap") +fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_OptionalPropertyHolder_init") @_cdecl("bjs_OptionalPropertyHolder_init") public func _bjs_OptionalPropertyHolder_init(_ optionalNameIsSome: Int32, _ optionalNameBytes: Int32, _ optionalNameLength: Int32) -> UnsafeMutableRawPointer { @@ -7855,6 +8014,42 @@ func _$jsRoundTripString(_ v: String) throws(JSException) -> String { return String.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalNumberNull") +fileprivate func bjs_jsRoundTripOptionalNumberNull(_ vIsSome: Int32, _ vValue: Float64) -> Void +#else +fileprivate func bjs_jsRoundTripOptionalNumberNull(_ vIsSome: Int32, _ vValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripOptionalNumberNull(_ v: Optional) throws(JSException) -> Optional { + let (vIsSome, vValue) = v.bridgeJSLowerParameter() + bjs_jsRoundTripOptionalNumberNull(vIsSome, vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturnFromSideChannel() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalNumberUndefined") +fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ vIsDefined: Int32, _ vValue: Float64) -> Void +#else +fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ vIsDefined: Int32, _ vValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripOptionalNumberUndefined(_ v: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { + let (vIsDefined, vValue) = v.bridgeJSLowerParameter() + bjs_jsRoundTripOptionalNumberUndefined(vIsDefined, vValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() +} + #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrVoid") fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 4b8ac7c7b..3c71881a5 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -525,6 +525,79 @@ ], "swiftCallName" : "Internal.TestServer" }, + { + "constructor" : { + "abiName" : "bjs_OptionalHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "nullableGreeter", + "name" : "nullableGreeter", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "label" : "undefinedNumber", + "name" : "undefinedNumber", + "type" : { + "undefinedOr" : { + "_0" : { + "double" : { + + } + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "OptionalHolder", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "nullableGreeter", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "undefinedNumber", + "type" : { + "undefinedOr" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "swiftCallName" : "OptionalHolder" + }, { "constructor" : { "abiName" : "bjs_OptionalPropertyHolder_init", @@ -7444,6 +7517,148 @@ } } }, + { + "abiName" : "bjs_roundTripOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "abiName" : "bjs_applyOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "applyOptionalGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "label" : "_", + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "abiName" : "bjs_makeOptionalHolder", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalHolder", + "parameters" : [ + { + "label" : "nullableGreeter", + "name" : "nullableGreeter", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "label" : "undefinedNumber", + "name" : "undefinedNumber", + "type" : { + "undefinedOr" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "OptionalHolder" + } + } + }, { "abiName" : "bjs_roundTripOptionalAPIOptionalResult", "effects" : { @@ -11739,6 +11954,58 @@ } } }, + { + "name" : "jsRoundTripOptionalNumberNull", + "parameters" : [ + { + "name" : "v", + "type" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "name" : "jsRoundTripOptionalNumberUndefined", + "parameters" : [ + { + "name" : "v", + "type" : { + "undefinedOr" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "undefinedOr" : { + "_0" : { + "double" : { + + } + } + } + } + }, { "name" : "jsThrowOrVoid", "parameters" : [ diff --git a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift index ea9f8c68f..136bd36f8 100644 --- a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift @@ -35,6 +35,26 @@ class ImportAPITests: XCTestCase { } } + func testRoundTripOptionalNumberNull() throws { + try XCTAssertEqual(jsRoundTripOptionalNumberNull(42), 42) + try XCTAssertNil(jsRoundTripOptionalNumberNull(nil)) + } + + func testRoundTripOptionalNumberUndefined() throws { + let some = try jsRoundTripOptionalNumberUndefined(.value(42)) + switch some { + case .value(let value): + XCTAssertEqual(value, 42) + case .undefined: + XCTFail("Expected defined value") + } + + let undefined = try jsRoundTripOptionalNumberUndefined(.undefinedValue) + if case .value = undefined { + XCTFail("Expected undefined") + } + } + func testRoundTripFeatureFlag() throws { for v in [FeatureFlag.foo, .bar] { try XCTAssertEqual(jsRoundTripFeatureFlag(v), v) diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts index 983d6052d..d1140e20f 100644 --- a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts +++ b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts @@ -2,6 +2,8 @@ export function jsRoundTripVoid(): void export function jsRoundTripNumber(v: number): number export function jsRoundTripBool(v: boolean): boolean export function jsRoundTripString(v: string): string +export function jsRoundTripOptionalNumberNull(v: number | null): number | null +export function jsRoundTripOptionalNumberUndefined(v: number | undefined): number | undefined export function jsThrowOrVoid(shouldThrow: boolean): void export function jsThrowOrNumber(shouldThrow: boolean): number export function jsThrowOrBool(shouldThrow: boolean): boolean diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 850b31b6e..29931ba3a 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -25,6 +25,12 @@ export async function setupOptions(options, context) { "jsRoundTripString": (v) => { return v; }, + "jsRoundTripOptionalNumberNull": (v) => { + return v ?? null; + }, + "jsRoundTripOptionalNumberUndefined": (v) => { + return v === undefined ? undefined : v; + }, "jsThrowOrVoid": (shouldThrow) => { if (shouldThrow) { throw new Error("TestError"); @@ -690,6 +696,26 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { testPropertyGreeter.release(); optionalsHolder.release(); + const optGreeter = new exports.Greeter("Optionaly"); + assert.equal(exports.roundTripOptionalGreeter(null), null); + const optGreeterReturned = exports.roundTripOptionalGreeter(optGreeter); + assert.equal(optGreeterReturned.name, "Optionaly"); + assert.equal(optGreeterReturned.greet(), "Hello, Optionaly!"); + + const appliedOptional = exports.applyOptionalGreeter(null, (g) => g ?? optGreeter); + assert.equal(appliedOptional.name, "Optionaly"); + + const holderOpt = exports.makeOptionalHolder(null, undefined); + assert.equal(holderOpt.nullableGreeter, null); + assert.equal(holderOpt.undefinedNumber, undefined); + holderOpt.nullableGreeter = optGreeter; + holderOpt.undefinedNumber = 123.5; + assert.equal(holderOpt.nullableGreeter.name, "Optionaly"); + assert.equal(holderOpt.undefinedNumber, 123.5); + holderOpt.release(); + optGreeterReturned.release(); + optGreeter.release(); + const aor1 = { tag: APIOptionalResultValues.Tag.Success, param0: "hello world" }; const aor2 = { tag: APIOptionalResultValues.Tag.Success, param0: null }; const aor3 = { tag: APIOptionalResultValues.Tag.Failure, param0: 404, param1: true }; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..c13ef64e3 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "strict": true, + "skipLibCheck": true + } +} From 6a230daddf1cb158878b35b63bf6c7cf4568f9ee Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 13:33:30 +0900 Subject: [PATCH 142/252] BridgeJS: Simplify Optional and JSUndefinedOr code paths --- .../Generated/JavaScript/BridgeJS.json | 110 ++- .../Sources/BridgeJSCore/ClosureCodegen.swift | 2 +- .../Sources/BridgeJSCore/ExportSwift.swift | 98 +-- .../Sources/BridgeJSCore/ImportTS.swift | 12 +- .../BridgeJSCore/SwiftToSkeleton.swift | 32 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 21 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 206 +---- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 47 +- .../BridgeJSCodegenTests/ArrayTypes.json | 70 +- .../CrossFileTypeResolution.ReverseOrder.json | 5 +- .../CrossFileTypeResolution.json | 5 +- .../DefaultParameters.json | 50 +- .../EnumAssociatedValue.json | 95 +- .../BridgeJSCodegenTests/EnumCase.json | 20 +- .../BridgeJSCodegenTests/EnumRawType.json | 120 ++- .../ImportedTypeInExportedInterface.json | 15 +- .../BridgeJSCodegenTests/Optionals.json | 190 ++-- .../BridgeJSCodegenTests/Protocol.json | 40 +- .../StaticProperties.Global.json | 5 +- .../StaticProperties.json | 5 +- .../BridgeJSCodegenTests/SwiftClosure.json | 45 +- .../BridgeJSCodegenTests/SwiftStruct.json | 40 +- .../JavaScriptKit/BridgeJSIntrinsics.swift | 381 ++++++++ Sources/JavaScriptKit/JSUndefinedOr.swift | 371 +------- .../Generated/BridgeJS.swift | 20 +- .../Generated/JavaScript/BridgeJS.json | 825 +++++++++++------- 26 files changed, 1522 insertions(+), 1308 deletions(-) diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json index cb081ab39..4dff97132 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json @@ -449,12 +449,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -470,12 +471,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -491,12 +493,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } }, @@ -512,12 +515,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } }, @@ -533,12 +537,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "null" } } }, @@ -554,12 +559,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "null" } } }, @@ -575,12 +581,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -596,12 +603,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -1844,12 +1852,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } @@ -1876,12 +1885,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } @@ -1902,12 +1912,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } @@ -1917,12 +1928,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } @@ -1943,12 +1955,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Point" } - } + }, + "_1" : "null" } } } @@ -1975,12 +1988,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Point" } - } + }, + "_1" : "null" } } } @@ -2001,12 +2015,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Point" } - } + }, + "_1" : "null" } } } @@ -2016,12 +2031,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Point" } - } + }, + "_1" : "null" } } } @@ -2040,7 +2056,7 @@ "label" : "_", "name" : "values", "type" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -2049,7 +2065,8 @@ } } } - } + }, + "_1" : "null" } } } @@ -2072,7 +2089,7 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -2081,7 +2098,8 @@ } } } - } + }, + "_1" : "null" } } }, @@ -2097,7 +2115,7 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -2106,7 +2124,8 @@ } } } - } + }, + "_1" : "null" } } }, @@ -2123,7 +2142,7 @@ "label" : "_", "name" : "values", "type" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -2132,13 +2151,14 @@ } } } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -2147,7 +2167,8 @@ } } } - } + }, + "_1" : "null" } } } @@ -2601,12 +2622,13 @@ "isStatic" : false, "name" : "email", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift index 5d6545668..30cf8b2c2 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift @@ -22,7 +22,7 @@ public struct ClosureCodegen { collectClosureSignatures(from: paramType, into: &signatures) } collectClosureSignatures(from: signature.returnType, into: &signatures) - case .optional(let wrapped): + case .nullable(let wrapped, _): collectClosureSignatures(from: wrapped, into: &signatures) default: break diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 39281ddfb..cb267c210 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -133,17 +133,27 @@ public class ExportSwift { case .array: typeNameForIntrinsic = param.type.swiftType liftingExpr = StackCodegen().liftExpression(for: param.type) - case .optional(let wrappedType): + case .nullable(let wrappedType, let kind): + let optionalSwiftType: String + if case .null = kind { + optionalSwiftType = "Optional" + } else { + optionalSwiftType = "JSUndefinedOr" + } if case .array(let elementType) = wrappedType { let arrayLift = StackCodegen().liftArrayExpression(elementType: elementType) let isSomeParam = argumentsToLift[0] let swiftTypeName = elementType.swiftType - typeNameForIntrinsic = "Optional<[\(swiftTypeName)]>" + typeNameForIntrinsic = "\(optionalSwiftType)<[\(swiftTypeName)]>" + let absentExpr = + kind == .null + ? "\(optionalSwiftType)<[\(swiftTypeName)]>.none" + : "\(optionalSwiftType)<[\(swiftTypeName)]>.undefinedValue" liftingExpr = ExprSyntax( """ { if \(raw: isSomeParam) == 0 { - return Optional<[\(raw: swiftTypeName)]>.none + return \(raw: absentExpr) } else { return \(arrayLift) } @@ -152,12 +162,12 @@ public class ExportSwift { ) } else if case .swiftProtocol(let protocolName) = wrappedType { let wrapperName = "Any\(protocolName)" - typeNameForIntrinsic = "Optional<\(wrapperName)>" + typeNameForIntrinsic = "\(optionalSwiftType)<\(wrapperName)>" liftingExpr = ExprSyntax( "\(raw: typeNameForIntrinsic).bridgeJSLiftParameter(\(raw: argumentsToLift.joined(separator: ", ")))" ) } else { - typeNameForIntrinsic = "Optional<\(wrappedType.swiftType)>" + typeNameForIntrinsic = "\(optionalSwiftType)<\(wrappedType.swiftType)>" liftingExpr = ExprSyntax( "\(raw: typeNameForIntrinsic).bridgeJSLiftParameter(\(raw: argumentsToLift.joined(separator: ", ")))" ) @@ -220,7 +230,7 @@ public class ExportSwift { return CodeBlockItemSyntax( item: .init(DeclSyntax("let ret = \(raw: callExpr) as! \(raw: wrapperName)")) ) - case .optional(let wrappedType): + case .nullable(let wrappedType, _): if case .swiftProtocol(let protocolName) = wrappedType { let wrapperName = "Any\(protocolName)" return CodeBlockItemSyntax( @@ -251,7 +261,7 @@ public class ExportSwift { case .swiftProtocol(let protocolName): let wrapperName = "Any\(protocolName)" append("let ret = \(raw: name) as! \(raw: wrapperName)") - case .optional(let wrappedType): + case .nullable(let wrappedType, _): if case .swiftProtocol(let protocolName) = wrappedType { let wrapperName = "Any\(protocolName)" append("let ret = \(raw: name).flatMap { $0 as? \(raw: wrapperName) }") @@ -278,8 +288,8 @@ public class ExportSwift { private func generateParameterLifting() { let stackParamIndices = parameters.enumerated().compactMap { index, param -> Int? in switch param.type { - case .swiftStruct, .optional(.swiftStruct), - .associatedValueEnum, .optional(.associatedValueEnum), + case .swiftStruct, .nullable(.swiftStruct, _), + .associatedValueEnum, .nullable(.associatedValueEnum, _), .array: return index default: @@ -308,7 +318,7 @@ public class ExportSwift { case .swiftProtocol(let protocolName): let wrapperName = "Any\(protocolName)" append("let ret = \(raw: selfExpr).\(raw: propertyName) as! \(raw: wrapperName)") - case .optional(let wrappedType): + case .nullable(let wrappedType, _): if case .swiftProtocol(let protocolName) = wrappedType { let wrapperName = "Any\(protocolName)" append("let ret = \(raw: selfExpr).\(raw: propertyName).flatMap { $0 as? \(raw: wrapperName) }") @@ -356,7 +366,7 @@ public class ExportSwift { switch returnType { case .closure(let signature): append("return _BJS_Closure_\(raw: signature.mangleName).bridgeJSLower(ret)") - case .array, .optional(.array): + case .array, .nullable(.array, _): let stackCodegen = StackCodegen() for stmt in stackCodegen.lowerStatements(for: returnType, accessor: "ret", varPrefix: "ret") { append(stmt) @@ -818,10 +828,8 @@ struct StackCodegen { } case .associatedValueEnum: return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_i32())" - case .optional(let wrappedType): - return liftOptionalExpression(wrappedType: wrappedType) - case .undefinedOr(let wrappedType): - return liftUndefinedExpression(wrappedType: wrappedType) + case .nullable(let wrappedType, let kind): + return liftNullableExpression(wrappedType: wrappedType, kind: kind) case .array(let elementType): return liftArrayExpression(elementType: elementType) case .closure: @@ -841,7 +849,7 @@ struct StackCodegen { return liftArrayExpressionInline(elementType: elementType) case .swiftProtocol(let protocolName): return "[Any\(raw: protocolName)].bridgeJSLiftParameter()" - case .optional, .undefinedOr, .array, .closure: + case .nullable, .array, .closure: return liftArrayExpressionInline(elementType: elementType) case .void, .namespaceEnum: fatalError("Invalid array element type: \(elementType)") @@ -865,51 +873,32 @@ struct StackCodegen { """ } - private func liftOptionalExpression(wrappedType: BridgeType) -> ExprSyntax { + private func liftNullableExpression(wrappedType: BridgeType, kind: JSOptionalKind) -> ExprSyntax { + let typeName = kind == .null ? "Optional" : "JSUndefinedOr" switch wrappedType { case .string, .int, .uint, .bool, .float, .double, .jsObject(nil), .swiftStruct, .swiftHeapObject, .caseEnum, .associatedValueEnum, .rawValueEnum: - return "Optional<\(raw: wrappedType.swiftType)>.bridgeJSLiftParameter()" + return "\(raw: typeName)<\(raw: wrappedType.swiftType)>.bridgeJSLiftParameter()" case .jsObject(let className?): - return "Optional.bridgeJSLiftParameter().map { \(raw: className)(unsafelyWrapping: $0) }" + return "\(raw: typeName).bridgeJSLiftParameter().map { \(raw: className)(unsafelyWrapping: $0) }" case .array(let elementType): let arrayLift = liftArrayExpression(elementType: elementType) let swiftTypeName = elementType.swiftType + let absentExpr = + kind == .null + ? "\(typeName)<[\(swiftTypeName)]>.none" : "\(typeName)<[\(swiftTypeName)]>.undefinedValue" return """ { let __isSome = _swift_js_pop_i32() if __isSome == 0 { - return Optional<[\(raw: swiftTypeName)]>.none + return \(raw: absentExpr) } else { return \(arrayLift) } }() """ - case .undefinedOr, .void, .namespaceEnum, .closure, .optional, .unsafePointer, .swiftProtocol: - fatalError("Invalid optional wrapped type: \(wrappedType)") - } - } - - private func liftUndefinedExpression(wrappedType: BridgeType) -> ExprSyntax { - switch wrappedType { - case .string, .int, .uint, .bool, .float, .double, .jsObject, - .swiftStruct, .swiftHeapObject, .caseEnum, .associatedValueEnum, .rawValueEnum: - return "JSUndefinedOr<\(raw: wrappedType.swiftType)>.bridgeJSLiftParameter()" - case .array(let elementType): - let arrayLift = liftArrayExpression(elementType: elementType) - let swiftTypeName = elementType.swiftType - return """ - { - let __isDefined = _swift_js_pop_i32() - if __isDefined == 0 { - return JSUndefinedOr<\(raw: swiftTypeName)>.undefined - } else { - return JSUndefinedOr<\(raw: swiftTypeName)>(optional: \(arrayLift)) - } - }() - """ - case .void, .namespaceEnum, .closure, .optional, .undefinedOr, .unsafePointer, .swiftProtocol: - fatalError("Invalid undefinedOr wrapped type: \(wrappedType)") + case .nullable, .void, .namespaceEnum, .closure, .unsafePointer, .swiftProtocol: + fatalError("Invalid nullable wrapped type: \(wrappedType)") } } @@ -940,9 +929,7 @@ struct StackCodegen { return ["\(raw: accessor).bridgeJSLowerStackReturn()"] case .associatedValueEnum, .swiftStruct: return ["\(raw: accessor).bridgeJSLowerReturn()"] - case .optional(let wrappedType): - return lowerOptionalStatements(wrappedType: wrappedType, accessor: accessor, varPrefix: varPrefix) - case .undefinedOr(let wrappedType): + case .nullable(let wrappedType, _): return lowerOptionalStatements(wrappedType: wrappedType, accessor: accessor, varPrefix: varPrefix) case .void, .namespaceEnum: return [] @@ -965,7 +952,7 @@ struct StackCodegen { return ["\(raw: accessor).map { $0.jsObject }.bridgeJSLowerReturn()"] case .swiftProtocol(let protocolName): return ["\(raw: accessor).map { $0 as! Any\(raw: protocolName) }.bridgeJSLowerReturn()"] - case .optional, .undefinedOr, .array, .closure: + case .nullable, .array, .closure: return lowerArrayStatementsInline( elementType: elementType, accessor: accessor, @@ -1623,8 +1610,8 @@ extension BridgeType { case .unsafePointer(let ptr): return ptr.swiftType case .swiftProtocol(let name): return "Any\(name)" case .void: return "Void" - case .optional(let wrappedType): return "Optional<\(wrappedType.swiftType)>" - case .undefinedOr(let wrappedType): return "JSUndefinedOr<\(wrappedType.swiftType)>" + case .nullable(let wrappedType, let kind): + return kind == .null ? "Optional<\(wrappedType.swiftType)>" : "JSUndefinedOr<\(wrappedType.swiftType)>" case .array(let elementType): return "[\(elementType.swiftType)]" case .caseEnum(let name): return name case .rawValueEnum(let name, _): return name @@ -1668,14 +1655,10 @@ extension BridgeType { case .unsafePointer: return .unsafePointer case .swiftProtocol: return .jsObject case .void: return .void - case .optional(let wrappedType): + case .nullable(let wrappedType, _): var optionalParams: [(name: String, type: WasmCoreType)] = [("isSome", .i32)] optionalParams.append(contentsOf: try wrappedType.liftParameterInfo().parameters) return LiftingIntrinsicInfo(parameters: optionalParams) - case .undefinedOr(let wrappedType): - var params: [(name: String, type: WasmCoreType)] = [("isDefined", .i32)] - params.append(contentsOf: try wrappedType.liftParameterInfo().parameters) - return LiftingIntrinsicInfo(parameters: params) case .caseEnum: return .caseEnum case .rawValueEnum(_, let rawType): return rawType.liftingIntrinsicInfo @@ -1724,8 +1707,7 @@ extension BridgeType { case .unsafePointer: return .unsafePointer case .swiftProtocol: return .jsObject case .void: return .void - case .optional: return .optional - case .undefinedOr: return .optional + case .nullable: return .optional case .caseEnum: return .caseEnum case .rawValueEnum(_, let rawType): return rawType.loweringIntrinsicInfo diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 7ac72cffc..cd3f84443 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -924,16 +924,11 @@ extension BridgeType { } case .namespaceEnum: throw BridgeJSCoreError("Namespace enums cannot be used as parameters") - case .optional(let wrappedType): + case .nullable(let wrappedType, _): let wrappedInfo = try wrappedType.loweringParameterInfo(context: context) var params = [("isSome", WasmCoreType.i32)] params.append(contentsOf: wrappedInfo.loweredParameters) return LoweringParameterInfo(loweredParameters: params) - case .undefinedOr(let wrappedType): - let wrappedInfo = try wrappedType.loweringParameterInfo(context: context) - var params = [("isDefined", WasmCoreType.i32)] - params.append(contentsOf: wrappedInfo.loweredParameters) - return LoweringParameterInfo(loweredParameters: params) case .array: switch context { case .importTS: @@ -1018,10 +1013,7 @@ extension BridgeType { } case .namespaceEnum: throw BridgeJSCoreError("Namespace enums cannot be used as return values") - case .optional(let wrappedType): - let wrappedInfo = try wrappedType.liftingReturnInfo(context: context) - return LiftingReturnInfo(valueToLift: wrappedInfo.valueToLift) - case .undefinedOr(let wrappedType): + case .nullable(let wrappedType, _): let wrappedInfo = try wrappedType.liftingReturnInfo(context: context) return LiftingReturnInfo(valueToLift: wrappedInfo.valueToLift) case .array: diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index 67f1421a2..adc49c89b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -130,7 +130,7 @@ public final class SwiftToSkeleton { if let optionalType = type.as(OptionalTypeSyntax.self) { let wrappedType = optionalType.wrappedType if let baseType = lookupType(for: wrappedType, errors: &errors) { - return .optional(baseType) + return .nullable(baseType, .null) } } // JSUndefinedOr @@ -141,7 +141,7 @@ public final class SwiftToSkeleton { let argType = TypeSyntax(genericArgs.first?.argument) { if let baseType = lookupType(for: argType, errors: &errors) { - return .undefinedOr(baseType) + return .nullable(baseType, .undefined) } } // JavaScriptKit.JSUndefinedOr @@ -154,7 +154,7 @@ public final class SwiftToSkeleton { let argType = TypeSyntax(genericArgs.first?.argument) { if let wrappedType = lookupType(for: argType, errors: &errors) { - return .undefinedOr(wrappedType) + return .nullable(wrappedType, .undefined) } } // Optional @@ -165,7 +165,7 @@ public final class SwiftToSkeleton { let argType = TypeSyntax(genericArgs.first?.argument) { if let baseType = lookupType(for: argType, errors: &errors) { - return .optional(baseType) + return .nullable(baseType, .null) } } // Swift.Optional @@ -178,7 +178,7 @@ public final class SwiftToSkeleton { let argType = TypeSyntax(genericArgs.first?.argument) { if let wrappedType = lookupType(for: argType, errors: &errors) { - return .optional(wrappedType) + return .nullable(wrappedType, .null) } } // [T] @@ -559,7 +559,7 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { switch type { case .caseEnum(let name), .rawValueEnum(let name, _), .associatedValueEnum(let name): enumName = name - case .optional(let wrappedType): + case .nullable(let wrappedType, _): switch wrappedType { case .caseEnum(let name), .rawValueEnum(let name, _), .associatedValueEnum(let name): enumName = name @@ -608,7 +608,7 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { let expr = defaultClause.value if expr.is(NilLiteralExprSyntax.self) { - guard case .optional(_) = type else { + guard case .nullable = type else { diagnose( node: expr, message: "nil is only valid for optional parameters", @@ -664,10 +664,10 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { let isStructType: Bool let expectedTypeName: String? switch type { - case .swiftStruct(let name), .optional(.swiftStruct(let name)): + case .swiftStruct(let name), .nullable(.swiftStruct(let name), _): isStructType = true expectedTypeName = name.split(separator: ".").last.map(String.init) - case .swiftHeapObject(let name), .optional(.swiftHeapObject(let name)): + case .swiftHeapObject(let name), .nullable(.swiftHeapObject(let name), _): isStructType = false expectedTypeName = name.split(separator: ".").last.map(String.init) default: @@ -803,7 +803,7 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { switch type { case .array(let element): elementType = element - case .optional(.array(let element)): + case .nullable(.array(let element), _): elementType = element default: diagnose( @@ -858,11 +858,11 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { continue } } - if case .optional(let wrappedType) = type, wrappedType.isOptional { + if case .nullable(let wrappedType, _) = type, wrappedType.isOptional { diagnoseNestedOptional(node: param.type, type: param.type.trimmedDescription) continue } - if case .optional(let wrappedType) = type, wrappedType.isOptional { + if case .nullable(let wrappedType, _) = type, wrappedType.isOptional { diagnoseNestedOptional(node: param.type, type: param.type.trimmedDescription) continue } @@ -984,7 +984,7 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { if let returnClause = node.signature.returnClause { let resolvedType = withLookupErrors { self.parent.lookupType(for: returnClause.type, errors: &$0) } - if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { + if let type = resolvedType, case .nullable(let wrappedType, _) = type, wrappedType.isOptional { diagnoseNestedOptional(node: returnClause.type, type: returnClause.type.trimmedDescription) return nil } @@ -1422,7 +1422,7 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { switch associatedValue.type { case .string, .int, .float, .double, .bool: break - case .optional(let wrappedType): + case .nullable(let wrappedType, _): switch wrappedType { case .string, .int, .float, .double, .bool: break @@ -1611,7 +1611,7 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { if let returnClause = node.signature.returnClause { let resolvedType = withLookupErrors { self.parent.lookupType(for: returnClause.type, errors: &$0) } - if let type = resolvedType, case .optional(let wrappedType) = type, wrappedType.isOptional { + if let type = resolvedType, case .nullable(let wrappedType, _) = type, wrappedType.isOptional { diagnoseNestedOptional(node: returnClause.type, type: returnClause.type.trimmedDescription) return nil } @@ -1836,7 +1836,7 @@ fileprivate extension BridgeType { switch (self, expectedType) { case let (lhs, rhs) where lhs == rhs: return true - case (.optional(let wrapped), expectedType): + case (.nullable(let wrapped, _), expectedType): return wrapped == expectedType default: return false diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 0b1be8a10..97678dc64 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -297,7 +297,7 @@ public struct BridgeJSLink { switch type { case .closure: return true - case .optional(let wrapped): + case .nullable(let wrapped, _): return containsClosureType(in: wrapped) default: return false @@ -746,7 +746,7 @@ public struct BridgeJSLink { collectClosureSignatures(from: paramType, into: &signatures) } collectClosureSignatures(from: signature.returnType, into: &signatures) - case .optional(let wrapped): + case .nullable(let wrapped, _): collectClosureSignatures(from: wrapped, into: &signatures) default: break @@ -764,7 +764,7 @@ public struct BridgeJSLink { // Build parameter list for invoke function var invokeParams: [String] = ["callbackId"] for (index, paramType) in signature.parameters.enumerated() { - if case .optional = paramType { + if case .nullable = paramType { invokeParams.append("param\(index)IsSome") invokeParams.append("param\(index)Value") } else { @@ -782,7 +782,7 @@ public struct BridgeJSLink { for (index, paramType) in signature.parameters.enumerated() { let fragment = try! IntrinsicJSFragment.closureLiftParameter(type: paramType) let args: [String] - if case .optional = paramType { + if case .nullable = paramType { args = ["param\(index)IsSome", "param\(index)Value", "param\(index)"] } else { args = ["param\(index)Id", "param\(index)"] @@ -1428,8 +1428,9 @@ public struct BridgeJSLink { return type.tsType case .swiftStruct(let name): return name.components(separatedBy: ".").last ?? name - case .optional(let wrapped): - return "\(resolveTypeScriptType(wrapped, exportedSkeletons: exportedSkeletons)) | null" + case .nullable(let wrapped, let kind): + let base = resolveTypeScriptType(wrapped, exportedSkeletons: exportedSkeletons) + return "\(base) | \(kind.absenceLiteral)" case .array(let elementType): let elementTypeStr = resolveTypeScriptType(elementType, exportedSkeletons: exportedSkeletons) // Parenthesize compound types so `[]` binds correctly in TypeScript @@ -2250,7 +2251,7 @@ extension BridgeJSLink { let objectExpr = "\(JSGlueVariableScope.reservedSwift).memory.getObject(self)" let accessExpr = Self.propertyAccessExpr(objectExpr: objectExpr, propertyName: name) if context == .exportSwift, returnType.usesSideChannelForOptionalReturn() { - guard case .optional(let wrappedType) = returnType else { + guard case .nullable(let wrappedType, _) = returnType else { fatalError("usesSideChannelForOptionalReturn returned true for non-optional type") } @@ -3403,10 +3404,8 @@ extension BridgeType { return name case .unsafePointer: return "number" - case .optional(let wrappedType): - return "\(wrappedType.tsType) | null" - case .undefinedOr(let wrappedType): - return "\(wrappedType.tsType) | undefined" + case .nullable(let wrappedType, let kind): + return "\(wrappedType.tsType) | \(kind.absenceLiteral)" case .caseEnum(let name): return "\(name)Tag" case .rawValueEnum(let name, _): diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index ad27dc6f3..44e751d3a 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -298,7 +298,7 @@ struct IntrinsicJSFragment: Sendable { static func optionalLiftParameter( wrappedType: BridgeType, - absenceLiteral: String = "null" + kind: JSOptionalKind ) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["isSome", "wrappedValue"], @@ -306,6 +306,7 @@ struct IntrinsicJSFragment: Sendable { let isSome = arguments[0] let wrappedValue = arguments[1] let resultExpr: String + let absenceLiteral = kind.absenceLiteral switch wrappedType { case .int, .float, .double, .caseEnum: @@ -518,8 +519,9 @@ struct IntrinsicJSFragment: Sendable { static func optionalLiftReturn( wrappedType: BridgeType, context: BridgeContext = .exportSwift, - absenceLiteral: String = "null" + kind: JSOptionalKind ) -> IntrinsicJSFragment { + let absenceLiteral = kind.absenceLiteral return IntrinsicJSFragment( parameters: [], printCode: { arguments, scope, printer, cleanupCode in @@ -646,7 +648,7 @@ struct IntrinsicJSFragment: Sendable { presenceCheck: (@Sendable (String) -> String)? = nil ) throws -> IntrinsicJSFragment { switch wrappedType { - case .void, .optional, .namespaceEnum, .closure: + case .void, .nullable, .namespaceEnum, .closure: throw BridgeJSLinkError(message: "Unsupported optional wrapped type for protocol export: \(wrappedType)") default: break } @@ -913,15 +915,19 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .optional(let wrappedType), .undefinedOr(let wrappedType): - return try closureOptionalLiftParameter(wrappedType: wrappedType) + case .nullable(let wrappedType, let kind): + return try closureOptionalLiftParameter(wrappedType: wrappedType, kind: kind) default: throw BridgeJSLinkError(message: "Unsupported closure parameter type for lifting: \(type)") } } - /// Handles optional parameter lifting for closure invocation - private static func closureOptionalLiftParameter(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + /// Handles optional parameter lifting for closure invocation. + private static func closureOptionalLiftParameter( + wrappedType: BridgeType, + kind: JSOptionalKind + ) throws -> IntrinsicJSFragment { + let absenceLiteral = kind.absenceLiteral switch wrappedType { case .string, .rawValueEnum, .int, .bool, .double, .float, .jsObject, .swiftHeapObject, .caseEnum, .associatedValueEnum: @@ -983,7 +989,7 @@ struct IntrinsicJSFragment: Sendable { printer.unindent() printer.write("} else {") printer.indent() - printer.write("\(targetVar) = null;") + printer.write("\(targetVar) = \(absenceLiteral);") printer.unindent() printer.write("}") @@ -1114,7 +1120,7 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .optional(let wrappedType), .undefinedOr(let wrappedType): + case .nullable(let wrappedType, _): return try closureOptionalLowerReturn(wrappedType: wrappedType) default: throw BridgeJSLinkError(message: "Unsupported closure return type for lowering: \(type)") @@ -1309,10 +1315,8 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .optional(let wrappedType): - return try closureOptionalLiftReturn(wrappedType: wrappedType) - case .undefinedOr(let wrappedType): - return try closureOptionalLiftReturn(wrappedType: wrappedType, absenceLiteral: "undefined") + case .nullable(let wrappedType, let kind): + return try closureOptionalLiftReturn(wrappedType: wrappedType, kind: kind) default: throw BridgeJSLinkError(message: "Unsupported closure return type for lifting: \(type)") } @@ -1321,7 +1325,7 @@ struct IntrinsicJSFragment: Sendable { /// Handles optional return lifting for Swift closure returns private static func closureOptionalLiftReturn( wrappedType: BridgeType, - absenceLiteral: String = "null" + kind: JSOptionalKind ) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["invokeCall"], @@ -1331,7 +1335,7 @@ struct IntrinsicJSFragment: Sendable { let baseFragment = optionalLiftReturn( wrappedType: wrappedType, context: .importTS, - absenceLiteral: absenceLiteral + kind: kind ) let lifted = baseFragment.printCode([], scope, printer, cleanupCode) if !lifted.isEmpty { @@ -1371,15 +1375,13 @@ struct IntrinsicJSFragment: Sendable { } case .associatedValueEnum: printer.write("return;") - case .optional(let wrappedType): + case .nullable(let wrappedType, _): switch wrappedType { case .swiftHeapObject: printer.write("return 0;") default: printer.write("return;") } - case .undefinedOr: - printer.write("return;") default: printer.write("return 0;") } @@ -1401,9 +1403,7 @@ struct IntrinsicJSFragment: Sendable { return .swiftHeapObjectLowerParameter case .swiftProtocol: return .jsObjectLowerParameter case .void: return .void - case .optional(let wrappedType): - return try .optionalLowerParameter(wrappedType: wrappedType) - case .undefinedOr(let wrappedType): + case .nullable(let wrappedType, _): return try .optionalLowerParameter(wrappedType: wrappedType) case .caseEnum: return .identity case .rawValueEnum(_, let rawType): @@ -1448,9 +1448,8 @@ struct IntrinsicJSFragment: Sendable { case .unsafePointer: return .identity case .swiftProtocol: return .jsObjectLiftReturn case .void: return .void - case .optional(let wrappedType): return .optionalLiftReturn(wrappedType: wrappedType) - case .undefinedOr(let wrappedType): - return .optionalLiftReturn(wrappedType: wrappedType, absenceLiteral: "undefined") + case .nullable(let wrappedType, let kind): + return .optionalLiftReturn(wrappedType: wrappedType, kind: kind) case .caseEnum: return .identity case .rawValueEnum(_, let rawType): switch rawType { @@ -1508,10 +1507,8 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError( message: "Void can't appear in parameters of imported JS functions" ) - case .optional(let wrappedType): - return try .optionalLiftParameter(wrappedType: wrappedType) - case .undefinedOr(let wrappedType): - return try .optionalLiftParameter(wrappedType: wrappedType, absenceLiteral: "undefined") + case .nullable(let wrappedType, let kind): + return try .optionalLiftParameter(wrappedType: wrappedType, kind: kind) case .caseEnum: return .identity case .rawValueEnum(_, let rawType): switch rawType { @@ -1601,12 +1598,10 @@ struct IntrinsicJSFragment: Sendable { } case .swiftProtocol: return .jsObjectLowerReturn case .void: return .void - case .optional(let wrappedType): - return try .optionalLowerReturn(wrappedType: wrappedType) - case .undefinedOr(let wrappedType): + case .nullable(let wrappedType, let kind): return try .optionalLowerReturn( wrappedType: wrappedType, - presenceCheck: { value in "\(value) !== undefined" } + presenceCheck: { value in kind.presenceCheck(value: value) } ) case .caseEnum: return .identity case .rawValueEnum(_, let rawType): @@ -1956,74 +1951,13 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .optional(let wrappedType): - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - let value = arguments[0] - let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(value) != null;") - - switch wrappedType { - case .string: - let idVar = scope.variable("id") - printer.write("let \(idVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { - let bytesVar = scope.variable("bytes") - printer.write( - "let \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" - ) - printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") - } - printer.write("} else {") - printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") - } - printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") - cleanup.write("if(\(idVar)) {") - cleanup.indent { - cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") - } - cleanup.write("}") - case .int, .uint: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) | 0) : 0);" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") - case .bool: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) ? 1 : 0) : 0);" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") - case .float: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamF32s).push(\(isSomeVar) ? Math.fround(\(value)) : 0.0);" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") - case .double: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamF64s).push(\(isSomeVar) ? \(value) : 0.0);" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") - default: - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") - } - - return [] - } - ) - case .undefinedOr(let wrappedType): + case .nullable(let wrappedType, let kind): return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in let value = arguments[0] let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(value) !== undefined;") + printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") switch wrappedType { case .string: @@ -2135,35 +2069,7 @@ struct IntrinsicJSFragment: Sendable { return [dVar] } ) - case .optional(let wrappedType): - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let optVar = scope.variable("optional") - let isSomeVar = scope.variable("isSome") - - printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") - printer.write("let \(optVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { - let wrappedFragment = associatedValuePopPayload(type: wrappedType) - let wrappedResults = wrappedFragment.printCode([], scope, printer, cleanup) - if let wrappedResult = wrappedResults.first { - printer.write("\(optVar) = \(wrappedResult);") - } else { - printer.write("\(optVar) = undefined;") - } - } - printer.write("} else {") - printer.indent { - printer.write("\(optVar) = null;") - } - printer.write("}") - - return [optVar] - } - ) - case .undefinedOr(let wrappedType): + case .nullable(let wrappedType, let kind): return IntrinsicJSFragment( parameters: [], printCode: { arguments, scope, printer, cleanup in @@ -2184,7 +2090,7 @@ struct IntrinsicJSFragment: Sendable { } printer.write("} else {") printer.indent { - printer.write("\(optVar) = undefined;") + printer.write("\(optVar) = \(kind.absenceLiteral);") } printer.write("}") @@ -2434,10 +2340,8 @@ struct IntrinsicJSFragment: Sendable { ) case .array(let innerElementType): return try! arrayLift(elementType: innerElementType) - case .optional(let wrappedType): - return try optionalElementRaiseFragment(wrappedType: wrappedType) - case .undefinedOr(let wrappedType): - return try optionalElementRaiseFragment(wrappedType: wrappedType, absenceLiteral: "undefined") + case .nullable(let wrappedType, let kind): + return try optionalElementRaiseFragment(wrappedType: wrappedType, kind: kind) case .unsafePointer: return IntrinsicJSFragment( parameters: [], @@ -2565,14 +2469,6 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .undefinedOr: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("throw new Error(\"Unsupported array element type for lowering: \(elementType)\");") - return [] - } - ) case .swiftHeapObject: return IntrinsicJSFragment( parameters: ["value"], @@ -2594,10 +2490,11 @@ struct IntrinsicJSFragment: Sendable { ) case .array(let innerElementType): return try! arrayLower(elementType: innerElementType) - case .undefinedOr: - throw BridgeJSLinkError(message: "Unsupported array element type: \(elementType)") - case .optional(let wrappedType): - return try optionalElementLowerFragment(wrappedType: wrappedType) + case .nullable(let wrappedType, let kind): + return try optionalElementLowerFragment( + wrappedType: wrappedType, + presenceCheck: { kind.presenceCheck(value: $0) } + ) case .swiftProtocol: // Same as jsObject but no cleanup — Swift's AnyProtocol wrapper releases via deinit return IntrinsicJSFragment( @@ -2625,8 +2522,9 @@ struct IntrinsicJSFragment: Sendable { private static func optionalElementRaiseFragment( wrappedType: BridgeType, - absenceLiteral: String = "null" + kind: JSOptionalKind ) throws -> IntrinsicJSFragment { + let absenceLiteral = kind.absenceLiteral return IntrinsicJSFragment( parameters: [], printCode: { arguments, scope, printer, cleanup in @@ -2973,13 +2871,13 @@ struct IntrinsicJSFragment: Sendable { return [idVar] } ) - case .optional(let wrappedType): + case .nullable(let wrappedType, let kind): return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in let value = arguments[0] let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(value) != null;") + printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") if case .caseEnum = wrappedType { printer.write("if (\(isSomeVar)) {") @@ -3219,14 +3117,6 @@ struct IntrinsicJSFragment: Sendable { } } ) - case .undefinedOr: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("throw new Error(\"Unsupported struct field type for lowering: \(field.type)\");") - return [] - } - ) case .swiftStruct(let nestedName): return IntrinsicJSFragment( parameters: ["value"], @@ -3434,7 +3324,7 @@ struct IntrinsicJSFragment: Sendable { return [pVar] } ) - case .optional(let wrappedType): + case .nullable(let wrappedType, let kind): return IntrinsicJSFragment( parameters: [], printCode: { arguments, scope, printer, cleanup in @@ -3472,7 +3362,7 @@ struct IntrinsicJSFragment: Sendable { } printer.write("} else {") printer.indent { - printer.write("\(optVar) = null;") + printer.write("\(optVar) = \(kind.absenceLiteral);") } printer.write("}") return [optVar] @@ -3583,14 +3473,6 @@ struct IntrinsicJSFragment: Sendable { return [varName] } ) - case .undefinedOr: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - printer.write("throw new Error(\"Unsupported struct field type: \(field.type)\");") - return [] - } - ) case .void, .swiftProtocol, .namespaceEnum, .closure: // These types should not appear as struct fields return IntrinsicJSFragment( diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index fabff5d3e..caf725ee5 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -126,11 +126,32 @@ public struct UnsafePointerType: Codable, Equatable, Hashable, Sendable { } } +/// JS semantics for optional/nullable types: which value represents "absent". +public enum JSOptionalKind: String, Codable, Equatable, Hashable, Sendable { + case null + case undefined + + /// The JS literal for absence (e.g. in generated glue). + public var absenceLiteral: String { + switch self { + case .null: return "null" + case .undefined: return "undefined" + } + } + + /// JS expression that is true when the value is present. `value` is the variable name. + public func presenceCheck(value: String) -> String { + switch self { + case .null: return "\(value) != null" + case .undefined: return "\(value) !== undefined" + } + } +} + public enum BridgeType: Codable, Equatable, Hashable, Sendable { case int, uint, float, double, string, bool, jsObject(String?), swiftHeapObject(String), void case unsafePointer(UnsafePointerType) - indirect case optional(BridgeType) - indirect case undefinedOr(BridgeType) + indirect case nullable(BridgeType, JSOptionalKind) indirect case array(BridgeType) case caseEnum(String) case rawValueEnum(String, SwiftEnumRawType) @@ -896,7 +917,7 @@ extension BridgeType { return .pointer case .unsafePointer: return .pointer - case .optional(_), .undefinedOr(_): + case .nullable: return nil case .caseEnum: return .i32 @@ -921,10 +942,9 @@ extension BridgeType { } } - /// Returns true if this type is optional + /// Returns true if this type is optional (nullable with null or undefined). public var isOptional: Bool { - if case .optional = self { return true } - if case .undefinedOr = self { return true } + if case .nullable = self { return true } return false } @@ -961,10 +981,9 @@ extension BridgeType { return "\(kindCode)\(p.count)\(p)" } return kindCode - case .optional(let wrapped): - return "Sq\(wrapped.mangleTypeName)" - case .undefinedOr(let wrapped): - return "Su\(wrapped.mangleTypeName)" + case .nullable(let wrapped, let kind): + let prefix = kind == .null ? "Sq" : "Su" + return "\(prefix)\(wrapped.mangleTypeName)" case .caseEnum(let name), .rawValueEnum(let name, _), .associatedValueEnum(let name), @@ -991,13 +1010,7 @@ extension BridgeType { /// Side channels are needed when the wrapped type cannot be directly returned via WASM, /// or when we need to distinguish null from absent value for certain primitives. public func usesSideChannelForOptionalReturn() -> Bool { - let wrappedType: BridgeType - switch self { - case .optional(let wrapped): - wrappedType = wrapped - case .undefinedOr(let wrapped): - wrappedType = wrapped - default: + guard case .nullable(let wrappedType, _) = self else { return false } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json index 7950cb66a..8dde2cfb7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json @@ -516,12 +516,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } @@ -531,12 +532,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } @@ -557,12 +559,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -572,12 +575,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -596,7 +600,7 @@ "label" : "_", "name" : "values", "type" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -605,13 +609,14 @@ } } } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -620,7 +625,8 @@ } } } - } + }, + "_1" : "null" } } }, @@ -639,12 +645,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Point" } - } + }, + "_1" : "null" } } } @@ -654,12 +661,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Point" } - } + }, + "_1" : "null" } } } @@ -680,12 +688,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } } @@ -695,12 +704,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } } @@ -721,13 +731,14 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Status", "_1" : "Int" } - } + }, + "_1" : "null" } } } @@ -737,13 +748,14 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Status", "_1" : "Int" } - } + }, + "_1" : "null" } } } @@ -994,12 +1006,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "jsObject" : { } - } + }, + "_1" : "null" } } } @@ -1009,12 +1022,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "jsObject" : { } - } + }, + "_1" : "null" } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.json index 7f21c86cf..59fb8484a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.json @@ -12,12 +12,13 @@ "isStatic" : false, "name" : "linkedB", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "ClassB" } - } + }, + "_1" : "null" } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.json index 3f8129109..cc10331a4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.json @@ -33,12 +33,13 @@ "isStatic" : false, "name" : "linkedB", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "ClassB" } - } + }, + "_1" : "null" } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.json index 64cc1a845..8c088a35e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.json @@ -135,12 +135,13 @@ "label" : "tag", "name" : "tag", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -196,12 +197,13 @@ "isStatic" : false, "name" : "tag", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -414,23 +416,25 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -452,23 +456,25 @@ "label" : "greeting", "name" : "greeting", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -646,23 +652,25 @@ "label" : "point", "name" : "point", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Config" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Config" } - } + }, + "_1" : "null" } } }, @@ -710,23 +718,25 @@ "label" : "point", "name" : "point", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Config" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Config" } - } + }, + "_1" : "null" } } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json index ecf045c3c..ba9ee9324 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json @@ -398,12 +398,13 @@ "associatedValues" : [ { "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -414,23 +415,25 @@ "associatedValues" : [ { "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, { "type" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } } @@ -441,34 +444,37 @@ "associatedValues" : [ { "type" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } }, { "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, { "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -570,23 +576,25 @@ "label" : "result", "name" : "result", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } }, @@ -670,23 +678,25 @@ "label" : "result", "name" : "result", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "ComplexResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "ComplexResult" } - } + }, + "_1" : "null" } } }, @@ -703,23 +713,25 @@ "label" : "result", "name" : "result", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "Utilities.Result" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "Utilities.Result" } - } + }, + "_1" : "null" } } }, @@ -736,23 +748,25 @@ "label" : "result", "name" : "result", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "NetworkingResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "NetworkingResult" } - } + }, + "_1" : "null" } } }, @@ -769,23 +783,25 @@ "label" : "result", "name" : "result", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIOptionalResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIOptionalResult" } - } + }, + "_1" : "null" } } }, @@ -802,12 +818,13 @@ "label" : "result1", "name" : "result1", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIOptionalResult" } - } + }, + "_1" : "null" } } }, @@ -815,23 +832,25 @@ "label" : "result2", "name" : "result2", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIOptionalResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIOptionalResult" } - } + }, + "_1" : "null" } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumCase.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumCase.json index 2d5d5f2fa..ea32ad739 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumCase.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumCase.json @@ -216,23 +216,25 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } }, @@ -291,23 +293,25 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "TSDirection" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "TSDirection" } - } + }, + "_1" : "null" } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.json index 20ef1f42f..ba36405ba 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.json @@ -517,25 +517,27 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Theme", "_1" : "String" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Theme", "_1" : "String" } - } + }, + "_1" : "null" } } }, @@ -596,25 +598,27 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "TSTheme", "_1" : "String" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "TSTheme", "_1" : "String" } - } + }, + "_1" : "null" } } }, @@ -675,25 +679,27 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "FeatureFlag", "_1" : "String" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "FeatureFlag", "_1" : "String" } - } + }, + "_1" : "null" } } }, @@ -754,25 +760,27 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "HttpStatus", "_1" : "Int" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "HttpStatus", "_1" : "Int" } - } + }, + "_1" : "null" } } }, @@ -833,25 +841,27 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "TSHttpStatus", "_1" : "Int" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "TSHttpStatus", "_1" : "Int" } - } + }, + "_1" : "null" } } }, @@ -912,25 +922,27 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Priority", "_1" : "Int32" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Priority", "_1" : "Int32" } - } + }, + "_1" : "null" } } }, @@ -991,25 +1003,27 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "FileSize", "_1" : "Int64" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "FileSize", "_1" : "Int64" } - } + }, + "_1" : "null" } } }, @@ -1070,25 +1084,27 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "UserId", "_1" : "UInt" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "UserId", "_1" : "UInt" } - } + }, + "_1" : "null" } } }, @@ -1149,25 +1165,27 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "TokenId", "_1" : "UInt32" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "TokenId", "_1" : "UInt32" } - } + }, + "_1" : "null" } } }, @@ -1228,25 +1246,27 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "SessionId", "_1" : "UInt64" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "SessionId", "_1" : "UInt64" } - } + }, + "_1" : "null" } } }, @@ -1307,25 +1327,27 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Precision", "_1" : "Float" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Precision", "_1" : "Float" } - } + }, + "_1" : "null" } } }, @@ -1386,25 +1408,27 @@ "label" : "_", "name" : "input", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Ratio", "_1" : "Double" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Ratio", "_1" : "Double" } - } + }, + "_1" : "null" } } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json index c40f0dc82..cecf16c9c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.json @@ -73,12 +73,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "jsObject" : { "_0" : "Foo" } - } + }, + "_1" : "null" } } } @@ -88,12 +89,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "jsObject" : { "_0" : "Foo" } - } + }, + "_1" : "null" } } } @@ -150,12 +152,13 @@ "isStatic" : false, "name" : "optionalFoo", "type" : { - "optional" : { + "nullable" : { "_0" : { "jsObject" : { "_0" : "Foo" } - } + }, + "_1" : "null" } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json index 2af32886b..ea5c675f0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json @@ -14,12 +14,13 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -56,12 +57,13 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -80,12 +82,13 @@ "isStatic" : false, "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -114,12 +117,13 @@ "isStatic" : false, "name" : "optionalName", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -128,12 +132,13 @@ "isStatic" : false, "name" : "optionalAge", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -142,12 +147,13 @@ "isStatic" : false, "name" : "optionalGreeter", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } } @@ -173,23 +179,25 @@ "label" : "value", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, @@ -206,23 +214,25 @@ "label" : "_", "name" : "holder", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "OptionalPropertyHolder" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "OptionalPropertyHolder" } - } + }, + "_1" : "null" } } }, @@ -239,23 +249,25 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -272,23 +284,25 @@ "label" : "value", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -305,23 +319,25 @@ "label" : "flag", "name" : "flag", "type" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } }, @@ -338,23 +354,25 @@ "label" : "number", "name" : "number", "type" : { - "optional" : { + "nullable" : { "_0" : { "float" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "float" : { } - } + }, + "_1" : "null" } } }, @@ -371,23 +389,25 @@ "label" : "precision", "name" : "precision", "type" : { - "optional" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "null" } } }, @@ -404,23 +424,25 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -437,23 +459,25 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -470,23 +494,25 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -503,23 +529,25 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -536,23 +564,25 @@ "label" : "value", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "null" } } }, @@ -569,23 +599,25 @@ "label" : "age", "name" : "age", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -602,23 +634,25 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -635,12 +669,13 @@ "label" : "firstName", "name" : "firstName", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -648,12 +683,13 @@ "label" : "lastName", "name" : "lastName", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -661,12 +697,13 @@ "label" : "age", "name" : "age", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -681,12 +718,13 @@ } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json index 5713a2898..e9f5264cd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.json @@ -237,12 +237,13 @@ "isStatic" : false, "name" : "secondDelegate", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftProtocol" : { "_0" : "MyViewControllerDelegate" } - } + }, + "_1" : "null" } } } @@ -667,12 +668,13 @@ "label" : "_", "name" : "helper", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Helper" } - } + }, + "_1" : "null" } } } @@ -695,12 +697,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Helper" } - } + }, + "_1" : "null" } } }, @@ -789,12 +792,13 @@ "isReadonly" : false, "name" : "optionalName", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -802,13 +806,14 @@ "isReadonly" : false, "name" : "optionalRawEnum", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "ExampleEnum", "_1" : "String" } - } + }, + "_1" : "null" } } }, @@ -835,12 +840,13 @@ "isReadonly" : false, "name" : "optionalResult", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "Result" } - } + }, + "_1" : "null" } } }, @@ -857,12 +863,13 @@ "isReadonly" : false, "name" : "directionOptional", "type" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } }, @@ -880,13 +887,14 @@ "isReadonly" : false, "name" : "priorityOptional", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Priority", "_1" : "Int" } - } + }, + "_1" : "null" } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.json index 9b1d0d6b8..bb9e48091 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.json @@ -118,12 +118,13 @@ } }, "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.json index b3ccf7e93..d385e3887 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.json @@ -118,12 +118,13 @@ } }, "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json index 345582e86..d71726828 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json @@ -202,30 +202,33 @@ "moduleName" : "TestModule", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Person" } - } + }, + "_1" : "null" } }, { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } }, { - "optional" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "null" } } ], @@ -325,12 +328,13 @@ "moduleName" : "TestModule", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Person" } - } + }, + "_1" : "null" } } ], @@ -353,12 +357,13 @@ "moduleName" : "TestModule", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Person" } - } + }, + "_1" : "null" } } ], @@ -700,12 +705,13 @@ "moduleName" : "TestModule", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } ], @@ -746,13 +752,14 @@ "moduleName" : "TestModule", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Theme", "_1" : "String" } - } + }, + "_1" : "null" } } ], @@ -793,12 +800,13 @@ "moduleName" : "TestModule", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } ], @@ -838,12 +846,13 @@ "moduleName" : "TestModule", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } ], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json index 1b2dc531f..00c6af5cb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.json @@ -184,12 +184,13 @@ "label" : "optCount", "name" : "optCount", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -197,12 +198,13 @@ "label" : "optFlag", "name" : "optFlag", "type" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } } @@ -248,12 +250,13 @@ "isStatic" : false, "name" : "optCount", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -262,12 +265,13 @@ "isStatic" : false, "name" : "optFlag", "type" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } } @@ -305,12 +309,13 @@ "isStatic" : false, "name" : "zipCode", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } @@ -358,12 +363,13 @@ "isStatic" : false, "name" : "email", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -431,13 +437,14 @@ "isStatic" : false, "name" : "optionalPrecision", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Precision", "_1" : "Float" } - } + }, + "_1" : "null" } } } @@ -563,12 +570,13 @@ "isStatic" : false, "name" : "optionalObject", "type" : { - "optional" : { + "nullable" : { "_0" : { "jsObject" : { } - } + }, + "_1" : "null" } } } diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index ac60ca860..e337124ee 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -105,6 +105,14 @@ public protocol _BridgedSwiftStackType { consuming func bridgeJSLowerStackReturn() } +/// Types that bridge with the same (isSome, value) ABI as Optional. +/// Used by JSUndefinedOr so all bridge methods delegate to Optional. +public protocol _BridgedAsOptional { + associatedtype Wrapped + var optionalRepresentation: Wrapped? { get } + init(optional: Wrapped?) +} + extension Bool: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStackType { // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { @@ -1773,6 +1781,379 @@ extension Optional where Wrapped: _BridgedSwiftStruct { } } +// MARK: - _BridgedAsOptional (JSUndefinedOr) delegating to Optional + +extension _BridgedAsOptional where Wrapped == Bool { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftReturn(value)) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional where Wrapped == Int { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional where Wrapped == UInt { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional where Wrapped == String { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter( + _ isSome: Int32, + _ bytes: Int32, + _ count: Int32 + ) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, bytes, count)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional where Wrapped == JSObject { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ objectId: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, objectId)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional where Wrapped: _BridgedSwiftProtocolWrapper { + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ objectId: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, objectId)) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional where Wrapped: _BridgedSwiftHeapObject { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, pointer: UnsafeMutableRawPointer) + { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerParameterWithRetain() -> ( + isSome: Int32, pointer: UnsafeMutableRawPointer + ) { + optionalRepresentation.bridgeJSLowerParameterWithRetain() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter( + _ isSome: Int32, + _ pointer: UnsafeMutableRawPointer + ) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, pointer)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional where Wrapped == Float { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional where Wrapped == Double { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float64) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float64) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional where Wrapped: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ caseId: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, caseId)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ caseId: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftReturn(caseId)) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional where Wrapped: _BridgedSwiftTypeLoweredIntoVoidType { + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional +where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == String { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter( + _ isSome: Int32, + _ bytes: Int32, + _ count: Int32 + ) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, bytes, count)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional +where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Int { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional +where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Bool { + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional +where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Float { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional +where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Double { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float64) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float64) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { + Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional where Wrapped: _BridgedSwiftAssociatedValueEnum { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, caseId: Int32) { + optionalRepresentation.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ caseId: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome, caseId)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ caseId: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftReturn(caseId)) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + +extension _BridgedAsOptional where Wrapped: _BridgedSwiftStruct { + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftParameter(isSome)) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + Self(optional: Optional.bridgeJSLiftParameter()) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + optionalRepresentation.bridgeJSLowerReturn() + } +} + // MARK: - Array Support extension Array where Element: _BridgedSwiftStackType, Element.StackLiftResult == Element { diff --git a/Sources/JavaScriptKit/JSUndefinedOr.swift b/Sources/JavaScriptKit/JSUndefinedOr.swift index f70cfc0df..82e218105 100644 --- a/Sources/JavaScriptKit/JSUndefinedOr.swift +++ b/Sources/JavaScriptKit/JSUndefinedOr.swift @@ -6,12 +6,12 @@ public static var undefinedValue: Self { .undefined } @inlinable - init(optional: Wrapped?) { + public init(optional: Wrapped?) { self = optional.map(Self.value) ?? .undefined } @inlinable - var optionalRepresentation: Wrapped? { + public var optionalRepresentation: Wrapped? { switch self { case .undefined: return nil @@ -40,369 +40,6 @@ extension JSUndefinedOr: ConvertibleToJSValue where Wrapped: ConvertibleToJSValu } } -// MARK: - BridgeJS Optional-style conformances +// MARK: - BridgeJS (via _BridgedAsOptional in BridgeJSIntrinsics) -extension JSUndefinedOr where Wrapped == Bool { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftReturn(value)) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr where Wrapped == Int { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr where Wrapped == UInt { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr where Wrapped == String { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter( - _ isSome: Int32, - _ bytes: Int32, - _ count: Int32 - ) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, bytes, count)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr where Wrapped == JSObject { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ objectId: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, objectId)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr where Wrapped: _BridgedSwiftProtocolWrapper { - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ objectId: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, objectId)) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr where Wrapped: _BridgedSwiftHeapObject { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, pointer: UnsafeMutableRawPointer) - { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerParameterWithRetain() -> ( - isSome: Int32, pointer: UnsafeMutableRawPointer - ) { - optionalRepresentation.bridgeJSLowerParameterWithRetain() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter( - _ isSome: Int32, - _ pointer: UnsafeMutableRawPointer - ) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, pointer)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) - } -} - -extension JSUndefinedOr where Wrapped == Float { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float32) { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr where Wrapped == Double { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float64) { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float64) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr where Wrapped: _BridgedSwiftCaseEnum { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ caseId: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, caseId)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ caseId: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftReturn(caseId)) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr where Wrapped: _BridgedSwiftTypeLoweredIntoVoidType { - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr -where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == String { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter( - _ isSome: Int32, - _ bytes: Int32, - _ count: Int32 - ) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, bytes, count)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Int { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Bool { - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr -where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Float { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float32) { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr -where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Double { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float64) { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float64) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr where Wrapped: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, caseId: Int32) { - optionalRepresentation.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ caseId: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, caseId)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ caseId: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftReturn(caseId)) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} - -extension JSUndefinedOr where Wrapped: _BridgedSwiftStruct { - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() - } -} +extension JSUndefinedOr: _BridgedAsOptional {} diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index a572f4c6f..72b104683 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -4488,9 +4488,9 @@ public func _bjs_applyOptionalGreeter(_ valueIsSome: Int32, _ valueValue: Unsafe @_expose(wasm, "bjs_makeOptionalHolder") @_cdecl("bjs_makeOptionalHolder") -public func _bjs_makeOptionalHolder(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsDefined: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { +public func _bjs_makeOptionalHolder(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = makeOptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsDefined, undefinedNumberValue)) + let ret = makeOptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsSome, undefinedNumberValue)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5909,9 +5909,9 @@ fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int @_expose(wasm, "bjs_OptionalHolder_init") @_cdecl("bjs_OptionalHolder_init") -public func _bjs_OptionalHolder_init(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsDefined: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { +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(undefinedNumberIsDefined, undefinedNumberValue)) + let ret = OptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsSome, undefinedNumberValue)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5952,9 +5952,9 @@ public func _bjs_OptionalHolder_undefinedNumber_get(_ _self: UnsafeMutableRawPoi @_expose(wasm, "bjs_OptionalHolder_undefinedNumber_set") @_cdecl("bjs_OptionalHolder_undefinedNumber_set") -public func _bjs_OptionalHolder_undefinedNumber_set(_ _self: UnsafeMutableRawPointer, _ valueIsDefined: Int32, _ valueValue: Float64) -> Void { +public func _bjs_OptionalHolder_undefinedNumber_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Float64) -> Void { #if arch(wasm32) - OptionalHolder.bridgeJSLiftParameter(_self).undefinedNumber = JSUndefinedOr.bridgeJSLiftParameter(valueIsDefined, valueValue) + OptionalHolder.bridgeJSLiftParameter(_self).undefinedNumber = JSUndefinedOr.bridgeJSLiftParameter(valueIsSome, valueValue) #else fatalError("Only available on WebAssembly") #endif @@ -8034,16 +8034,16 @@ func _$jsRoundTripOptionalNumberNull(_ v: Optional) throws(JSException) #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalNumberUndefined") -fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ vIsDefined: Int32, _ vValue: Float64) -> Void +fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ vIsSome: Int32, _ vValue: Float64) -> Void #else -fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ vIsDefined: Int32, _ vValue: Float64) -> Void { +fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ vIsSome: Int32, _ vValue: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif func _$jsRoundTripOptionalNumberUndefined(_ v: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { - let (vIsDefined, vValue) = v.bridgeJSLowerParameter() - bjs_jsRoundTripOptionalNumberUndefined(vIsDefined, vValue) + let (vIsSome, vValue) = v.bridgeJSLowerParameter() + bjs_jsRoundTripOptionalNumberUndefined(vIsSome, vValue) if let error = _swift_js_take_exception() { throw error } diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 3c71881a5..f73b25c32 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -538,12 +538,13 @@ "label" : "nullableGreeter", "name" : "nullableGreeter", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, @@ -551,12 +552,13 @@ "label" : "undefinedNumber", "name" : "undefinedNumber", "type" : { - "undefinedOr" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "undefined" } } } @@ -572,12 +574,13 @@ "isStatic" : false, "name" : "nullableGreeter", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, @@ -586,12 +589,13 @@ "isStatic" : false, "name" : "undefinedNumber", "type" : { - "undefinedOr" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "undefined" } } } @@ -611,12 +615,13 @@ "label" : "optionalName", "name" : "optionalName", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -632,12 +637,13 @@ "isStatic" : false, "name" : "optionalName", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -646,12 +652,13 @@ "isStatic" : false, "name" : "optionalAge", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -660,12 +667,13 @@ "isStatic" : false, "name" : "optionalGreeter", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } } @@ -1130,12 +1138,13 @@ "label" : "tag", "name" : "tag", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -1207,12 +1216,13 @@ "isStatic" : false, "name" : "tag", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -1366,12 +1376,13 @@ } }, "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -1385,12 +1396,13 @@ } }, "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -1572,12 +1584,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -1610,12 +1623,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -1632,12 +1646,13 @@ "label" : "_", "name" : "tag", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -1660,12 +1675,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -1682,12 +1698,13 @@ "label" : "_", "name" : "count", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } @@ -1710,12 +1727,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } }, @@ -1732,12 +1750,13 @@ "label" : "_", "name" : "direction", "type" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } } @@ -1760,13 +1779,14 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Theme", "_1" : "String" } - } + }, + "_1" : "null" } } }, @@ -1783,13 +1803,14 @@ "label" : "_", "name" : "theme", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Theme", "_1" : "String" } - } + }, + "_1" : "null" } } } @@ -1812,13 +1833,14 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "HttpStatus", "_1" : "Int" } - } + }, + "_1" : "null" } } }, @@ -1835,13 +1857,14 @@ "label" : "_", "name" : "status", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "HttpStatus", "_1" : "Int" } - } + }, + "_1" : "null" } } } @@ -1864,12 +1887,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } }, @@ -1886,12 +1910,13 @@ "label" : "_", "name" : "apiResult", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } } @@ -1920,12 +1945,13 @@ "isStatic" : false, "name" : "backupProcessor", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftProtocol" : { "_0" : "DataProcessor" } - } + }, + "_1" : "null" } } } @@ -2110,12 +2136,13 @@ "label" : "_", "name" : "greeter", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } } @@ -2138,12 +2165,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, @@ -2160,12 +2188,13 @@ "label" : "_", "name" : "result", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } } @@ -2188,12 +2217,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } } @@ -2225,12 +2255,13 @@ "isStatic" : false, "name" : "optionalTag", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -2239,12 +2270,13 @@ "isStatic" : false, "name" : "optionalCount", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -2253,12 +2285,13 @@ "isStatic" : false, "name" : "direction", "type" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } }, @@ -2267,13 +2300,14 @@ "isStatic" : false, "name" : "optionalTheme", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Theme", "_1" : "String" } - } + }, + "_1" : "null" } } }, @@ -2282,13 +2316,14 @@ "isStatic" : false, "name" : "httpStatus", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "HttpStatus", "_1" : "Int" } - } + }, + "_1" : "null" } } }, @@ -2297,12 +2332,13 @@ "isStatic" : false, "name" : "apiResult", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } }, @@ -2321,12 +2357,13 @@ "isStatic" : false, "name" : "optionalHelper", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } } @@ -2512,12 +2549,13 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } ], @@ -2558,12 +2596,13 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } ], @@ -2604,12 +2643,13 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } ], @@ -2649,12 +2689,13 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } ], @@ -2689,12 +2730,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } } @@ -3030,12 +3072,13 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } ], @@ -3076,13 +3119,14 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Theme", "_1" : "String" } - } + }, + "_1" : "null" } } ], @@ -3123,12 +3167,13 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } ], @@ -3168,12 +3213,13 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } ], @@ -3215,12 +3261,13 @@ "label" : "config", "name" : "config", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Config" } - } + }, + "_1" : "null" } } } @@ -3246,12 +3293,13 @@ "isStatic" : false, "name" : "config", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Config" } - } + }, + "_1" : "null" } } } @@ -4315,12 +4363,13 @@ "associatedValues" : [ { "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -4331,23 +4380,25 @@ "associatedValues" : [ { "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, { "type" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } } @@ -4358,34 +4409,37 @@ "associatedValues" : [ { "type" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } }, { "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, { "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -6855,23 +6909,25 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -6888,23 +6944,25 @@ "label" : "value", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -6921,23 +6979,25 @@ "label" : "flag", "name" : "flag", "type" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } }, @@ -6954,23 +7014,25 @@ "label" : "number", "name" : "number", "type" : { - "optional" : { + "nullable" : { "_0" : { "float" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "float" : { } - } + }, + "_1" : "null" } } }, @@ -6987,23 +7049,25 @@ "label" : "precision", "name" : "precision", "type" : { - "optional" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "null" } } }, @@ -7020,23 +7084,25 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -7053,23 +7119,25 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -7086,23 +7154,25 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -7119,23 +7189,25 @@ "label" : "value", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "null" } } }, @@ -7152,23 +7224,25 @@ "label" : "age", "name" : "age", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -7185,23 +7259,25 @@ "label" : "value", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Status" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Status" } - } + }, + "_1" : "null" } } }, @@ -7218,25 +7294,27 @@ "label" : "value", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Theme", "_1" : "String" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Theme", "_1" : "String" } - } + }, + "_1" : "null" } } }, @@ -7253,25 +7331,27 @@ "label" : "value", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "HttpStatus", "_1" : "Int" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "HttpStatus", "_1" : "Int" } - } + }, + "_1" : "null" } } }, @@ -7288,23 +7368,25 @@ "label" : "value", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "TSDirection" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "TSDirection" } - } + }, + "_1" : "null" } } }, @@ -7321,25 +7403,27 @@ "label" : "value", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "TSTheme", "_1" : "String" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "TSTheme", "_1" : "String" } - } + }, + "_1" : "null" } } }, @@ -7356,23 +7440,25 @@ "label" : "_", "name" : "method", "type" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Networking.API.Method" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Networking.API.Method" } - } + }, + "_1" : "null" } } }, @@ -7389,23 +7475,25 @@ "label" : "value", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } }, @@ -7422,12 +7510,13 @@ "label" : "_", "name" : "r1", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } }, @@ -7435,12 +7524,13 @@ "label" : "_", "name" : "r2", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } } @@ -7464,23 +7554,25 @@ "label" : "_", "name" : "result", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "ComplexResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "ComplexResult" } - } + }, + "_1" : "null" } } }, @@ -7497,23 +7589,25 @@ "label" : "value", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, @@ -7530,23 +7624,25 @@ "label" : "_", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, @@ -7563,12 +7659,13 @@ "label" : "_", "name" : "value", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, @@ -7584,22 +7681,24 @@ "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } } @@ -7608,12 +7707,13 @@ } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, @@ -7630,12 +7730,13 @@ "label" : "nullableGreeter", "name" : "nullableGreeter", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, @@ -7643,12 +7744,13 @@ "label" : "undefinedNumber", "name" : "undefinedNumber", "type" : { - "undefinedOr" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "undefined" } } } @@ -7672,23 +7774,25 @@ "label" : "result", "name" : "result", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIOptionalResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIOptionalResult" } - } + }, + "_1" : "null" } } }, @@ -7929,23 +8033,25 @@ "label" : "name", "name" : "name", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -8237,7 +8343,7 @@ "label" : "_", "name" : "values", "type" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -8246,7 +8352,8 @@ } } } - } + }, + "_1" : "null" } } } @@ -8814,12 +8921,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } @@ -8829,12 +8937,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } @@ -8855,12 +8964,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -8870,12 +8980,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -8896,12 +9007,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "DataPoint" } - } + }, + "_1" : "null" } } } @@ -8911,12 +9023,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "DataPoint" } - } + }, + "_1" : "null" } } } @@ -8937,12 +9050,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } } @@ -8952,12 +9066,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } } @@ -8978,12 +9093,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Status" } - } + }, + "_1" : "null" } } } @@ -8993,12 +9109,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Status" } - } + }, + "_1" : "null" } } } @@ -9017,7 +9134,7 @@ "label" : "_", "name" : "values", "type" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -9026,13 +9143,14 @@ } } } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -9041,7 +9159,8 @@ } } } - } + }, + "_1" : "null" } } }, @@ -9058,7 +9177,7 @@ "label" : "_", "name" : "values", "type" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -9067,13 +9186,14 @@ } } } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -9082,7 +9202,8 @@ } } } - } + }, + "_1" : "null" } } }, @@ -9099,7 +9220,7 @@ "label" : "_", "name" : "greeters", "type" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -9108,13 +9229,14 @@ } } } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "array" : { "_0" : { @@ -9123,7 +9245,8 @@ } } } - } + }, + "_1" : "null" } } }, @@ -9713,12 +9836,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "jsObject" : { } - } + }, + "_1" : "null" } } } @@ -9728,12 +9852,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "jsObject" : { } - } + }, + "_1" : "null" } } } @@ -9787,12 +9912,13 @@ "type" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "jsObject" : { "_0" : "Foo" } - } + }, + "_1" : "null" } } } @@ -9802,12 +9928,13 @@ "returnType" : { "array" : { "_0" : { - "optional" : { + "nullable" : { "_0" : { "jsObject" : { "_0" : "Foo" } - } + }, + "_1" : "null" } } } @@ -10148,12 +10275,13 @@ "label" : "_", "name" : "newResult", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } }, @@ -10417,12 +10545,13 @@ "label" : "_", "name" : "greeter", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } } @@ -10445,12 +10574,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, @@ -10467,12 +10597,13 @@ "label" : "_", "name" : "result", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } } @@ -10495,12 +10626,13 @@ ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } } @@ -10529,12 +10661,13 @@ "isReadonly" : false, "name" : "optionalTag", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -10542,12 +10675,13 @@ "isReadonly" : false, "name" : "optionalCount", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -10555,12 +10689,13 @@ "isReadonly" : false, "name" : "direction", "type" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } }, @@ -10568,13 +10703,14 @@ "isReadonly" : false, "name" : "optionalTheme", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Theme", "_1" : "String" } - } + }, + "_1" : "null" } } }, @@ -10582,13 +10718,14 @@ "isReadonly" : false, "name" : "httpStatus", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "HttpStatus", "_1" : "Int" } - } + }, + "_1" : "null" } } }, @@ -10596,12 +10733,13 @@ "isReadonly" : false, "name" : "apiResult", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } }, @@ -10618,12 +10756,13 @@ "isReadonly" : false, "name" : "optionalHelper", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } } @@ -10838,12 +10977,13 @@ "label" : "optCount", "name" : "optCount", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -10851,12 +10991,13 @@ "label" : "optFlag", "name" : "optFlag", "type" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } } @@ -10902,12 +11043,13 @@ "isStatic" : false, "name" : "optCount", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } }, @@ -10916,12 +11058,13 @@ "isStatic" : false, "name" : "optFlag", "type" : { - "optional" : { + "nullable" : { "_0" : { "bool" : { } - } + }, + "_1" : "null" } } } @@ -10959,12 +11102,13 @@ "isStatic" : false, "name" : "zipCode", "type" : { - "optional" : { + "nullable" : { "_0" : { "int" : { } - } + }, + "_1" : "null" } } } @@ -11012,12 +11156,13 @@ "isStatic" : false, "name" : "email", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } }, @@ -11026,12 +11171,13 @@ "isStatic" : false, "name" : "secondaryAddress", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Address" } - } + }, + "_1" : "null" } } } @@ -11059,13 +11205,14 @@ "isStatic" : false, "name" : "theme", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Theme", "_1" : "String" } - } + }, + "_1" : "null" } } }, @@ -11074,12 +11221,13 @@ "isStatic" : false, "name" : "direction", "type" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Direction" } - } + }, + "_1" : "null" } } }, @@ -11117,12 +11265,13 @@ "isStatic" : false, "name" : "owner", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftHeapObject" : { "_0" : "Greeter" } - } + }, + "_1" : "null" } } } @@ -11160,12 +11309,13 @@ "isStatic" : false, "name" : "status", "type" : { - "optional" : { + "nullable" : { "_0" : { "caseEnum" : { "_0" : "Status" } - } + }, + "_1" : "null" } } }, @@ -11174,12 +11324,13 @@ "isStatic" : false, "name" : "outcome", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } } @@ -11248,12 +11399,13 @@ "isStatic" : false, "name" : "result", "type" : { - "optional" : { + "nullable" : { "_0" : { "associatedValueEnum" : { "_0" : "APIResult" } - } + }, + "_1" : "null" } } }, @@ -11262,12 +11414,13 @@ "isStatic" : false, "name" : "metadata", "type" : { - "optional" : { + "nullable" : { "_0" : { "jsObject" : { } - } + }, + "_1" : "null" } } }, @@ -11276,12 +11429,13 @@ "isStatic" : false, "name" : "location", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "DataPoint" } - } + }, + "_1" : "null" } } }, @@ -11300,12 +11454,13 @@ "isStatic" : false, "name" : "overrideDefaults", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "ConfigStruct" } - } + }, + "_1" : "null" } } } @@ -11345,13 +11500,14 @@ "isStatic" : false, "name" : "optionalPrecision", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Precision", "_1" : "Float" } - } + }, + "_1" : "null" } } }, @@ -11360,13 +11516,14 @@ "isStatic" : false, "name" : "optionalRatio", "type" : { - "optional" : { + "nullable" : { "_0" : { "rawValueEnum" : { "_0" : "Ratio", "_1" : "Double" } - } + }, + "_1" : "null" } } } @@ -11577,12 +11734,13 @@ "isStatic" : false, "name" : "note", "type" : { - "optional" : { + "nullable" : { "_0" : { "string" : { } - } + }, + "_1" : "null" } } } @@ -11678,12 +11836,13 @@ "isStatic" : false, "name" : "shippingAddress", "type" : { - "optional" : { + "nullable" : { "_0" : { "swiftStruct" : { "_0" : "Address" } - } + }, + "_1" : "null" } } } @@ -11800,12 +11959,13 @@ "isStatic" : false, "name" : "optionalObject", "type" : { - "optional" : { + "nullable" : { "_0" : { "jsObject" : { } - } + }, + "_1" : "null" } } } @@ -11833,12 +11993,13 @@ "isStatic" : false, "name" : "optionalFoo", "type" : { - "optional" : { + "nullable" : { "_0" : { "jsObject" : { "_0" : "Foo" } - } + }, + "_1" : "null" } } } @@ -11960,23 +12121,25 @@ { "name" : "v", "type" : { - "optional" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "null" } } } ], "returnType" : { - "optional" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "null" } } }, @@ -11986,23 +12149,25 @@ { "name" : "v", "type" : { - "undefinedOr" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "undefined" } } } ], "returnType" : { - "undefinedOr" : { + "nullable" : { "_0" : { "double" : { } - } + }, + "_1" : "undefined" } } }, From d6551ac8aff85147de52d559c6ee0dff2ce048f0 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 14:02:40 +0900 Subject: [PATCH 143/252] BridgeJS: Add te2swift unit tests --- .../TS2Swift/JavaScript/src/processor.js | 2 +- .../test/__snapshots__/ts2swift.test.js.snap | 41 +++++++++++++++++++ .../test/fixtures/OptionalNullUndefined.d.ts | 20 +++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/OptionalNullUndefined.d.ts diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index fd31967b0..0e458ed43 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -691,7 +691,7 @@ export class TypeProcessor { if (nonNullableTypes.length === 1 && (hasNull || hasUndefined)) { const wrapped = this.visitType(nonNullableTypes[0], node); if (hasNull && hasUndefined) { - return `JSUndefinedOr>`; + return "JSObject"; } if (hasNull) { return `Optional<${wrapped}>`; diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index 6add64de4..c1db3e32e 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -145,6 +145,47 @@ exports[`ts2swift > snapshots Swift output for MultipleImportedTypes.d.ts > Mult " `; +exports[`ts2swift > snapshots Swift output for OptionalNullUndefined.d.ts > OptionalNullUndefined 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func roundTripNumberNull(_ value: Optional) throws(JSException) -> Optional + +@JSFunction func roundTripNumberUndefined(_ value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr + +@JSFunction func roundTripStringNull(_ value: Optional) throws(JSException) -> Optional + +@JSFunction func roundTripStringUndefined(_ value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr + +@JSFunction func roundTripBooleanNull(_ value: JSObject) throws(JSException) -> JSObject + +@JSFunction func roundTripBooleanUndefined(_ value: JSObject) throws(JSException) -> JSObject + +@JSFunction func optionalNumberParamNull(_ x: Double, _ maybe: Optional) throws(JSException) -> Double + +@JSFunction func optionalNumberParamUndefined(_ x: Double, _ maybe: JSUndefinedOr) throws(JSException) -> Double + +@JSFunction func roundTripMyInterfaceNull(_ value: Optional) throws(JSException) -> Optional + +@JSClass struct MyInterface { +} + +@JSFunction func roundTripMyInterfaceUndefined(_ value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr + +@JSClass struct WithOptionalFields { + @JSGetter var valueOrNull: Optional + @JSSetter func setValueOrNull(_ value: Optional) throws(JSException) + @JSGetter var valueOrUndefined: JSUndefinedOr + @JSSetter func setValueOrUndefined(_ value: JSUndefinedOr) throws(JSException) +} +" +`; + exports[`ts2swift > snapshots Swift output for PrimitiveParameters.d.ts > PrimitiveParameters 1`] = ` "// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/OptionalNullUndefined.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/OptionalNullUndefined.d.ts new file mode 100644 index 000000000..8b64528d9 --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/OptionalNullUndefined.d.ts @@ -0,0 +1,20 @@ +export function roundTripNumberNull(value: number | null): number | null; +export function roundTripNumberUndefined(value: number | undefined): number | undefined; + +export function roundTripStringNull(value: string | null): string | null; +export function roundTripStringUndefined(value: string | undefined): string | undefined; + +export function roundTripBooleanNull(value: boolean | null): boolean | null; +export function roundTripBooleanUndefined(value: boolean | undefined): boolean | undefined; + +export function optionalNumberParamNull(x: number, maybe: number | null): number; +export function optionalNumberParamUndefined(x: number, maybe: number | undefined): number; + +export interface MyInterface {} +export function roundTripMyInterfaceNull(value: MyInterface | null): MyInterface | null; +export function roundTripMyInterfaceUndefined(value: MyInterface | undefined): MyInterface | undefined; + +export class WithOptionalFields { + valueOrNull: MyInterface | null; + valueOrUndefined: MyInterface | undefined; +} \ No newline at end of file From ab2c0682d4d188cc89a25f426e150d07411a6137 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 14:10:37 +0900 Subject: [PATCH 144/252] BridgeJS: Simplify optional presence check handling --- .../Sources/BridgeJSLink/JSGlueGen.swift | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 44e751d3a..90ea5ab0c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -643,10 +643,7 @@ struct IntrinsicJSFragment: Sendable { ) } - static func optionalLowerReturn( - wrappedType: BridgeType, - presenceCheck: (@Sendable (String) -> String)? = nil - ) throws -> IntrinsicJSFragment { + static func optionalLowerReturn(wrappedType: BridgeType, kind: JSOptionalKind) throws -> IntrinsicJSFragment { switch wrappedType { case .void, .nullable, .namespaceEnum, .closure: throw BridgeJSLinkError(message: "Unsupported optional wrapped type for protocol export: \(wrappedType)") @@ -658,7 +655,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanupCode in let value = arguments[0] let isSomeVar = scope.variable("isSome") - let presenceExpr = presenceCheck?(value) ?? "\(value) != null" + let presenceExpr = kind.presenceCheck(value: value) printer.write("const \(isSomeVar) = \(presenceExpr);") switch wrappedType { @@ -1599,10 +1596,7 @@ struct IntrinsicJSFragment: Sendable { case .swiftProtocol: return .jsObjectLowerReturn case .void: return .void case .nullable(let wrappedType, let kind): - return try .optionalLowerReturn( - wrappedType: wrappedType, - presenceCheck: { value in kind.presenceCheck(value: value) } - ) + return try .optionalLowerReturn(wrappedType: wrappedType, kind: kind) case .caseEnum: return .identity case .rawValueEnum(_, let rawType): switch rawType { @@ -2493,7 +2487,7 @@ struct IntrinsicJSFragment: Sendable { case .nullable(let wrappedType, let kind): return try optionalElementLowerFragment( wrappedType: wrappedType, - presenceCheck: { kind.presenceCheck(value: $0) } + kind: kind ) case .swiftProtocol: // Same as jsObject but no cleanup — Swift's AnyProtocol wrapper releases via deinit @@ -2556,7 +2550,7 @@ struct IntrinsicJSFragment: Sendable { private static func optionalElementLowerFragment( wrappedType: BridgeType, - presenceCheck: (@Sendable (String) -> String)? = nil + kind: JSOptionalKind ) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["value"], @@ -2564,7 +2558,7 @@ struct IntrinsicJSFragment: Sendable { let value = arguments[0] let isSomeVar = scope.variable("isSome") - let presenceExpr = presenceCheck?(value) ?? "\(value) != null" + let presenceExpr = kind.presenceCheck(value: value) printer.write("const \(isSomeVar) = \(presenceExpr) ? 1 : 0;") // Cleanup is written inside the if block so retained id is in scope let localCleanupWriter = CodeFragmentPrinter() From 667d787dd3371fd887a427337a004b629d7bbe62 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 14:19:38 +0900 Subject: [PATCH 145/252] BridgeJS: Cover Optional/Undefined usage on import side --- .../Inputs/MacroSwift/Optionals.swift | 32 ++ .../BridgeJSCodegenTests/Optionals.json | 490 ++++++++++++++++++ .../BridgeJSCodegenTests/Optionals.swift | 461 +++++++++++++++- .../BridgeJSLinkTests/Optionals.d.ts | 21 + .../BridgeJSLinkTests/Optionals.js | 268 ++++++++++ 5 files changed, 1271 insertions(+), 1 deletion(-) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift index d256a8753..3fabe55c6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift @@ -90,3 +90,35 @@ typealias OptionalNameAlias = Optional func testMixedOptionals(firstName: String?, lastName: String?, age: Int?, active: Bool) -> String? { return nil } + +@JSClass struct WithOptionalJSClass { + @JSFunction init(valueOrNull: String?, valueOrUndefined: JSUndefinedOr) throws(JSException) + + @JSGetter var stringOrNull: String? + @JSSetter func setStringOrNull(_ value: String?) throws(JSException) + @JSGetter var stringOrUndefined: JSUndefinedOr + @JSSetter func setStringOrUndefined(_ value: JSUndefinedOr) throws(JSException) + @JSFunction func roundTripStringOrNull(value: String?) throws(JSException) -> String? + @JSFunction func roundTripStringOrUndefined(value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr + + @JSGetter var doubleOrNull: Double? + @JSSetter func setDoubleOrNull(_ value: Double?) throws(JSException) + @JSGetter var doubleOrUndefined: JSUndefinedOr + @JSSetter func setDoubleOrUndefined(_ value: JSUndefinedOr) throws(JSException) + @JSFunction func roundTripDoubleOrNull(value: Double?) throws(JSException) -> Double? + @JSFunction func roundTripDoubleOrUndefined(value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr + + @JSGetter var boolOrNull: Bool? + @JSSetter func setBoolOrNull(_ value: Bool?) throws(JSException) + @JSGetter var boolOrUndefined: JSUndefinedOr + @JSSetter func setBoolOrUndefined(_ value: JSUndefinedOr) throws(JSException) + @JSFunction func roundTripBoolOrNull(value: Bool?) throws(JSException) -> Bool? + @JSFunction func roundTripBoolOrUndefined(value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr + + @JSGetter var intOrNull: Int? + @JSSetter func setIntOrNull(_ value: Int?) throws(JSException) + @JSGetter var intOrUndefined: JSUndefinedOr + @JSSetter func setIntOrUndefined(_ value: JSUndefinedOr) throws(JSException) + @JSFunction func roundTripIntOrNull(value: Int?) throws(JSException) -> Int? + @JSFunction func roundTripIntOrUndefined(value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json index ea5c675f0..f74b3cdf7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json @@ -736,5 +736,495 @@ ] }, + "imported" : { + "children" : [ + { + "functions" : [ + + ], + "types" : [ + { + "constructor" : { + "parameters" : [ + { + "name" : "valueOrNull", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "name" : "valueOrUndefined", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "undefined" + } + } + } + ] + }, + "getters" : [ + { + "name" : "stringOrNull", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "name" : "stringOrUndefined", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "undefined" + } + } + }, + { + "name" : "doubleOrNull", + "type" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "null" + } + } + }, + { + "name" : "doubleOrUndefined", + "type" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "undefined" + } + } + }, + { + "name" : "boolOrNull", + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + }, + { + "name" : "boolOrUndefined", + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "undefined" + } + } + }, + { + "name" : "intOrNull", + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + } + }, + { + "name" : "intOrUndefined", + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "methods" : [ + { + "name" : "roundTripStringOrNull", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "name" : "roundTripStringOrUndefined", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "undefined" + } + } + }, + { + "name" : "roundTripDoubleOrNull", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "null" + } + } + }, + { + "name" : "roundTripDoubleOrUndefined", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "undefined" + } + } + }, + { + "name" : "roundTripBoolOrNull", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + }, + { + "name" : "roundTripBoolOrUndefined", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "undefined" + } + } + }, + { + "name" : "roundTripIntOrNull", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + } + }, + { + "name" : "roundTripIntOrUndefined", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "name" : "WithOptionalJSClass", + "setters" : [ + { + "functionName" : "stringOrNull_set", + "name" : "stringOrNull", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "functionName" : "stringOrUndefined_set", + "name" : "stringOrUndefined", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "undefined" + } + } + }, + { + "functionName" : "doubleOrNull_set", + "name" : "doubleOrNull", + "type" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "null" + } + } + }, + { + "functionName" : "doubleOrUndefined_set", + "name" : "doubleOrUndefined", + "type" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "undefined" + } + } + }, + { + "functionName" : "boolOrNull_set", + "name" : "boolOrNull", + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + }, + { + "functionName" : "boolOrUndefined_set", + "name" : "boolOrUndefined", + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "undefined" + } + } + }, + { + "functionName" : "intOrNull_set", + "name" : "intOrNull", + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + } + }, + { + "functionName" : "intOrUndefined_set", + "name" : "intOrUndefined", + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "undefined" + } + } + } + ] + } + ] + } + ] + }, "moduleName" : "TestModule" } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift index 88195f37d..471d38a6c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift @@ -338,4 +338,463 @@ fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPoi fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_init") +fileprivate func bjs_WithOptionalJSClass_init(_ valueOrNullIsSome: Int32, _ valueOrNullValue: Int32, _ valueOrUndefinedIsSome: Int32, _ valueOrUndefinedValue: Int32) -> Int32 +#else +fileprivate func bjs_WithOptionalJSClass_init(_ valueOrNullIsSome: Int32, _ valueOrNullValue: Int32, _ valueOrUndefinedIsSome: Int32, _ valueOrUndefinedValue: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_stringOrNull_get") +fileprivate func bjs_WithOptionalJSClass_stringOrNull_get(_ self: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_stringOrNull_get(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_stringOrUndefined_get") +fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_get(_ self: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_get(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_doubleOrNull_get") +fileprivate func bjs_WithOptionalJSClass_doubleOrNull_get(_ self: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_doubleOrNull_get(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_doubleOrUndefined_get") +fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_get(_ self: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_get(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_boolOrNull_get") +fileprivate func bjs_WithOptionalJSClass_boolOrNull_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_WithOptionalJSClass_boolOrNull_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_boolOrUndefined_get") +fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_intOrNull_get") +fileprivate func bjs_WithOptionalJSClass_intOrNull_get(_ self: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_intOrNull_get(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_intOrUndefined_get") +fileprivate func bjs_WithOptionalJSClass_intOrUndefined_get(_ self: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_intOrUndefined_get(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_stringOrNull_set") +fileprivate func bjs_WithOptionalJSClass_stringOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_stringOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_stringOrUndefined_set") +fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_doubleOrNull_set") +fileprivate func bjs_WithOptionalJSClass_doubleOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_doubleOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_doubleOrUndefined_set") +fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_boolOrNull_set") +fileprivate func bjs_WithOptionalJSClass_boolOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_boolOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_boolOrUndefined_set") +fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_intOrNull_set") +fileprivate func bjs_WithOptionalJSClass_intOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_intOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_intOrUndefined_set") +fileprivate func bjs_WithOptionalJSClass_intOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_intOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripStringOrNull") +fileprivate func bjs_WithOptionalJSClass_roundTripStringOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_roundTripStringOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripStringOrUndefined") +fileprivate func bjs_WithOptionalJSClass_roundTripStringOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_roundTripStringOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripDoubleOrNull") +fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripDoubleOrUndefined") +fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripBoolOrNull") +fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 +#else +fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripBoolOrUndefined") +fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 +#else +fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripIntOrNull") +fileprivate func bjs_WithOptionalJSClass_roundTripIntOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_roundTripIntOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripIntOrUndefined") +fileprivate func bjs_WithOptionalJSClass_roundTripIntOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void +#else +fileprivate func bjs_WithOptionalJSClass_roundTripIntOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$WithOptionalJSClass_init(_ valueOrNull: Optional, _ valueOrUndefined: JSUndefinedOr) throws(JSException) -> JSObject { + let (valueOrNullIsSome, valueOrNullValue) = valueOrNull.bridgeJSLowerParameter() + let (valueOrUndefinedIsSome, valueOrUndefinedValue) = valueOrUndefined.bridgeJSLowerParameter() + let ret = bjs_WithOptionalJSClass_init(valueOrNullIsSome, valueOrNullValue, valueOrUndefinedIsSome, valueOrUndefinedValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$WithOptionalJSClass_stringOrNull_get(_ self: JSObject) throws(JSException) -> Optional { + let selfValue = self.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_stringOrNull_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturnFromSideChannel() +} + +func _$WithOptionalJSClass_stringOrUndefined_get(_ self: JSObject) throws(JSException) -> JSUndefinedOr { + let selfValue = self.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_stringOrUndefined_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() +} + +func _$WithOptionalJSClass_doubleOrNull_get(_ self: JSObject) throws(JSException) -> Optional { + let selfValue = self.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_doubleOrNull_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturnFromSideChannel() +} + +func _$WithOptionalJSClass_doubleOrUndefined_get(_ self: JSObject) throws(JSException) -> JSUndefinedOr { + let selfValue = self.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_doubleOrUndefined_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() +} + +func _$WithOptionalJSClass_boolOrNull_get(_ self: JSObject) throws(JSException) -> Optional { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WithOptionalJSClass_boolOrNull_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturn(ret) +} + +func _$WithOptionalJSClass_boolOrUndefined_get(_ self: JSObject) throws(JSException) -> JSUndefinedOr { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WithOptionalJSClass_boolOrUndefined_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturn(ret) +} + +func _$WithOptionalJSClass_intOrNull_get(_ self: JSObject) throws(JSException) -> Optional { + let selfValue = self.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_intOrNull_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturnFromSideChannel() +} + +func _$WithOptionalJSClass_intOrUndefined_get(_ self: JSObject) throws(JSException) -> JSUndefinedOr { + let selfValue = self.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_intOrUndefined_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() +} + +func _$WithOptionalJSClass_stringOrNull_set(_ self: JSObject, _ newValue: Optional) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_stringOrNull_set(selfValue, newValueIsSome, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WithOptionalJSClass_stringOrUndefined_set(_ self: JSObject, _ newValue: JSUndefinedOr) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_stringOrUndefined_set(selfValue, newValueIsSome, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WithOptionalJSClass_doubleOrNull_set(_ self: JSObject, _ newValue: Optional) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_doubleOrNull_set(selfValue, newValueIsSome, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WithOptionalJSClass_doubleOrUndefined_set(_ self: JSObject, _ newValue: JSUndefinedOr) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_doubleOrUndefined_set(selfValue, newValueIsSome, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WithOptionalJSClass_boolOrNull_set(_ self: JSObject, _ newValue: Optional) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_boolOrNull_set(selfValue, newValueIsSome, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WithOptionalJSClass_boolOrUndefined_set(_ self: JSObject, _ newValue: JSUndefinedOr) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_boolOrUndefined_set(selfValue, newValueIsSome, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WithOptionalJSClass_intOrNull_set(_ self: JSObject, _ newValue: Optional) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_intOrNull_set(selfValue, newValueIsSome, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WithOptionalJSClass_intOrUndefined_set(_ self: JSObject, _ newValue: JSUndefinedOr) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_intOrUndefined_set(selfValue, newValueIsSome, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WithOptionalJSClass_roundTripStringOrNull(_ self: JSObject, _ value: Optional) throws(JSException) -> Optional { + let selfValue = self.bridgeJSLowerParameter() + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_roundTripStringOrNull(selfValue, valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturnFromSideChannel() +} + +func _$WithOptionalJSClass_roundTripStringOrUndefined(_ self: JSObject, _ value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { + let selfValue = self.bridgeJSLowerParameter() + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_roundTripStringOrUndefined(selfValue, valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() +} + +func _$WithOptionalJSClass_roundTripDoubleOrNull(_ self: JSObject, _ value: Optional) throws(JSException) -> Optional { + let selfValue = self.bridgeJSLowerParameter() + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_roundTripDoubleOrNull(selfValue, valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturnFromSideChannel() +} + +func _$WithOptionalJSClass_roundTripDoubleOrUndefined(_ self: JSObject, _ value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { + let selfValue = self.bridgeJSLowerParameter() + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_roundTripDoubleOrUndefined(selfValue, valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() +} + +func _$WithOptionalJSClass_roundTripBoolOrNull(_ self: JSObject, _ value: Optional) throws(JSException) -> Optional { + let selfValue = self.bridgeJSLowerParameter() + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + let ret = bjs_WithOptionalJSClass_roundTripBoolOrNull(selfValue, valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturn(ret) +} + +func _$WithOptionalJSClass_roundTripBoolOrUndefined(_ self: JSObject, _ value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { + let selfValue = self.bridgeJSLowerParameter() + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + let ret = bjs_WithOptionalJSClass_roundTripBoolOrUndefined(selfValue, valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturn(ret) +} + +func _$WithOptionalJSClass_roundTripIntOrNull(_ self: JSObject, _ value: Optional) throws(JSException) -> Optional { + let selfValue = self.bridgeJSLowerParameter() + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_roundTripIntOrNull(selfValue, valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturnFromSideChannel() +} + +func _$WithOptionalJSClass_roundTripIntOrUndefined(_ self: JSObject, _ value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { + let selfValue = self.bridgeJSLowerParameter() + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + bjs_WithOptionalJSClass_roundTripIntOrUndefined(selfValue, valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts index 5f63e9db5..b1a67ccde 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts @@ -21,6 +21,24 @@ export interface OptionalPropertyHolder extends SwiftHeapObject { optionalAge: number | null; optionalGreeter: Greeter | null; } +export interface WithOptionalJSClass { + roundTripStringOrNull(value: string | null): string | null; + roundTripStringOrUndefined(value: string | undefined): string | undefined; + roundTripDoubleOrNull(value: number | null): number | null; + roundTripDoubleOrUndefined(value: number | undefined): number | undefined; + roundTripBoolOrNull(value: boolean | null): boolean | null; + roundTripBoolOrUndefined(value: boolean | undefined): boolean | undefined; + roundTripIntOrNull(value: number | null): number | null; + roundTripIntOrUndefined(value: number | undefined): number | undefined; + stringOrNull: string | null; + stringOrUndefined: string | undefined; + doubleOrNull: number | null; + doubleOrUndefined: number | undefined; + boolOrNull: boolean | null; + boolOrUndefined: boolean | undefined; + intOrNull: number | null; + intOrUndefined: number | undefined; +} export type Exports = { Greeter: { new(name: string | null): Greeter; @@ -45,6 +63,9 @@ export type Exports = { testMixedOptionals(firstName: string | null, lastName: string | null, age: number | null, active: boolean): string | null; } export type Imports = { + WithOptionalJSClass: { + new(valueOrNull: string | null, valueOrUndefined: string | undefined): WithOptionalJSClass; + } } export function createInstantiator(options: { imports: Imports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 2c08e3d9f..0ec2f81c9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -42,6 +42,7 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); @@ -213,6 +214,273 @@ export async function createInstantiator(options, swift) { const obj = OptionalPropertyHolder.__construct(pointer); return swift.memory.retain(obj); }; + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_WithOptionalJSClass_init"] = function bjs_WithOptionalJSClass_init(valueOrNullIsSome, valueOrNullWrappedValue, valueOrUndefinedIsSome, valueOrUndefinedWrappedValue) { + try { + let obj; + if (valueOrNullIsSome) { + obj = swift.memory.getObject(valueOrNullWrappedValue); + swift.memory.release(valueOrNullWrappedValue); + } + let obj1; + if (valueOrUndefinedIsSome) { + obj1 = swift.memory.getObject(valueOrUndefinedWrappedValue); + swift.memory.release(valueOrUndefinedWrappedValue); + } + return swift.memory.retain(new imports.WithOptionalJSClass(valueOrNullIsSome ? obj : null, valueOrUndefinedIsSome ? obj1 : undefined)); + } catch (error) { + setException(error); + return 0 + } + } + TestModule["bjs_WithOptionalJSClass_stringOrNull_get"] = function bjs_WithOptionalJSClass_stringOrNull_get(self) { + try { + let ret = swift.memory.getObject(self).stringOrNull; + const isSome = ret != null; + if (isSome) { + const bytes = textEncoder.encode(ret); + bjs["swift_js_return_optional_string"](1, bytes, bytes.length); + return bytes.length; + } else { + bjs["swift_js_return_optional_string"](0, 0, 0); + return -1; + } + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_stringOrUndefined_get"] = function bjs_WithOptionalJSClass_stringOrUndefined_get(self) { + try { + let ret = swift.memory.getObject(self).stringOrUndefined; + const isSome = ret !== undefined; + if (isSome) { + const bytes = textEncoder.encode(ret); + bjs["swift_js_return_optional_string"](1, bytes, bytes.length); + return bytes.length; + } else { + bjs["swift_js_return_optional_string"](0, 0, 0); + return -1; + } + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_doubleOrNull_get"] = function bjs_WithOptionalJSClass_doubleOrNull_get(self) { + try { + let ret = swift.memory.getObject(self).doubleOrNull; + const isSome = ret != null; + bjs["swift_js_return_optional_double"](isSome ? 1 : 0, isSome ? ret : 0.0); + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_doubleOrUndefined_get"] = function bjs_WithOptionalJSClass_doubleOrUndefined_get(self) { + try { + let ret = swift.memory.getObject(self).doubleOrUndefined; + const isSome = ret !== undefined; + bjs["swift_js_return_optional_double"](isSome ? 1 : 0, isSome ? ret : 0.0); + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_boolOrNull_get"] = function bjs_WithOptionalJSClass_boolOrNull_get(self) { + try { + let ret = swift.memory.getObject(self).boolOrNull; + const isSome = ret != null; + bjs["swift_js_return_optional_bool"](isSome ? 1 : 0, isSome ? (ret ? 1 : 0) : 0); + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_boolOrUndefined_get"] = function bjs_WithOptionalJSClass_boolOrUndefined_get(self) { + try { + let ret = swift.memory.getObject(self).boolOrUndefined; + const isSome = ret !== undefined; + bjs["swift_js_return_optional_bool"](isSome ? 1 : 0, isSome ? (ret ? 1 : 0) : 0); + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_intOrNull_get"] = function bjs_WithOptionalJSClass_intOrNull_get(self) { + try { + let ret = swift.memory.getObject(self).intOrNull; + const isSome = ret != null; + bjs["swift_js_return_optional_int"](isSome ? 1 : 0, isSome ? (ret | 0) : 0); + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_intOrUndefined_get"] = function bjs_WithOptionalJSClass_intOrUndefined_get(self) { + try { + let ret = swift.memory.getObject(self).intOrUndefined; + const isSome = ret !== undefined; + bjs["swift_js_return_optional_int"](isSome ? 1 : 0, isSome ? (ret | 0) : 0); + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_stringOrNull_set"] = function bjs_WithOptionalJSClass_stringOrNull_set(self, newValueIsSome, newValueWrappedValue) { + try { + let obj; + if (newValueIsSome) { + obj = swift.memory.getObject(newValueWrappedValue); + swift.memory.release(newValueWrappedValue); + } + swift.memory.getObject(self).stringOrNull = newValueIsSome ? obj : null; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_stringOrUndefined_set"] = function bjs_WithOptionalJSClass_stringOrUndefined_set(self, newValueIsSome, newValueWrappedValue) { + try { + let obj; + if (newValueIsSome) { + obj = swift.memory.getObject(newValueWrappedValue); + swift.memory.release(newValueWrappedValue); + } + swift.memory.getObject(self).stringOrUndefined = newValueIsSome ? obj : undefined; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_doubleOrNull_set"] = function bjs_WithOptionalJSClass_doubleOrNull_set(self, newValueIsSome, newValueWrappedValue) { + try { + swift.memory.getObject(self).doubleOrNull = newValueIsSome ? newValueWrappedValue : null; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_doubleOrUndefined_set"] = function bjs_WithOptionalJSClass_doubleOrUndefined_set(self, newValueIsSome, newValueWrappedValue) { + try { + swift.memory.getObject(self).doubleOrUndefined = newValueIsSome ? newValueWrappedValue : undefined; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_boolOrNull_set"] = function bjs_WithOptionalJSClass_boolOrNull_set(self, newValueIsSome, newValueWrappedValue) { + try { + swift.memory.getObject(self).boolOrNull = newValueIsSome ? newValueWrappedValue !== 0 : null; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_boolOrUndefined_set"] = function bjs_WithOptionalJSClass_boolOrUndefined_set(self, newValueIsSome, newValueWrappedValue) { + try { + swift.memory.getObject(self).boolOrUndefined = newValueIsSome ? newValueWrappedValue !== 0 : undefined; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_intOrNull_set"] = function bjs_WithOptionalJSClass_intOrNull_set(self, newValueIsSome, newValueWrappedValue) { + try { + swift.memory.getObject(self).intOrNull = newValueIsSome ? newValueWrappedValue : null; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_intOrUndefined_set"] = function bjs_WithOptionalJSClass_intOrUndefined_set(self, newValueIsSome, newValueWrappedValue) { + try { + swift.memory.getObject(self).intOrUndefined = newValueIsSome ? newValueWrappedValue : undefined; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_roundTripStringOrNull"] = function bjs_WithOptionalJSClass_roundTripStringOrNull(self, valueIsSome, valueWrappedValue) { + try { + let obj; + if (valueIsSome) { + obj = swift.memory.getObject(valueWrappedValue); + swift.memory.release(valueWrappedValue); + } + let ret = swift.memory.getObject(self).roundTripStringOrNull(valueIsSome ? obj : null); + const isSome = ret != null; + if (isSome) { + const bytes = textEncoder.encode(ret); + bjs["swift_js_return_optional_string"](1, bytes, bytes.length); + return bytes.length; + } else { + bjs["swift_js_return_optional_string"](0, 0, 0); + return -1; + } + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_roundTripStringOrUndefined"] = function bjs_WithOptionalJSClass_roundTripStringOrUndefined(self, valueIsSome, valueWrappedValue) { + try { + let obj; + if (valueIsSome) { + obj = swift.memory.getObject(valueWrappedValue); + swift.memory.release(valueWrappedValue); + } + let ret = swift.memory.getObject(self).roundTripStringOrUndefined(valueIsSome ? obj : undefined); + const isSome = ret !== undefined; + if (isSome) { + const bytes = textEncoder.encode(ret); + bjs["swift_js_return_optional_string"](1, bytes, bytes.length); + return bytes.length; + } else { + bjs["swift_js_return_optional_string"](0, 0, 0); + return -1; + } + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_roundTripDoubleOrNull"] = function bjs_WithOptionalJSClass_roundTripDoubleOrNull(self, valueIsSome, valueWrappedValue) { + try { + let ret = swift.memory.getObject(self).roundTripDoubleOrNull(valueIsSome ? valueWrappedValue : null); + const isSome = ret != null; + bjs["swift_js_return_optional_double"](isSome ? 1 : 0, isSome ? ret : 0.0); + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_roundTripDoubleOrUndefined"] = function bjs_WithOptionalJSClass_roundTripDoubleOrUndefined(self, valueIsSome, valueWrappedValue) { + try { + let ret = swift.memory.getObject(self).roundTripDoubleOrUndefined(valueIsSome ? valueWrappedValue : undefined); + const isSome = ret !== undefined; + bjs["swift_js_return_optional_double"](isSome ? 1 : 0, isSome ? ret : 0.0); + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_roundTripBoolOrNull"] = function bjs_WithOptionalJSClass_roundTripBoolOrNull(self, valueIsSome, valueWrappedValue) { + try { + let ret = swift.memory.getObject(self).roundTripBoolOrNull(valueIsSome ? valueWrappedValue !== 0 : null); + const isSome = ret != null; + bjs["swift_js_return_optional_bool"](isSome ? 1 : 0, isSome ? (ret ? 1 : 0) : 0); + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_roundTripBoolOrUndefined"] = function bjs_WithOptionalJSClass_roundTripBoolOrUndefined(self, valueIsSome, valueWrappedValue) { + try { + let ret = swift.memory.getObject(self).roundTripBoolOrUndefined(valueIsSome ? valueWrappedValue !== 0 : undefined); + const isSome = ret !== undefined; + bjs["swift_js_return_optional_bool"](isSome ? 1 : 0, isSome ? (ret ? 1 : 0) : 0); + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_roundTripIntOrNull"] = function bjs_WithOptionalJSClass_roundTripIntOrNull(self, valueIsSome, valueWrappedValue) { + try { + let ret = swift.memory.getObject(self).roundTripIntOrNull(valueIsSome ? valueWrappedValue : null); + const isSome = ret != null; + bjs["swift_js_return_optional_int"](isSome ? 1 : 0, isSome ? (ret | 0) : 0); + } catch (error) { + setException(error); + } + } + TestModule["bjs_WithOptionalJSClass_roundTripIntOrUndefined"] = function bjs_WithOptionalJSClass_roundTripIntOrUndefined(self, valueIsSome, valueWrappedValue) { + try { + let ret = swift.memory.getObject(self).roundTripIntOrUndefined(valueIsSome ? valueWrappedValue : undefined); + const isSome = ret !== undefined; + bjs["swift_js_return_optional_int"](isSome ? 1 : 0, isSome ? (ret | 0) : 0); + } catch (error) { + setException(error); + } + } }, setInstance: (i) => { instance = i; From 966b2d71b9b9f85d04f66a58cc79ef40a0c55d3f Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 14:21:26 +0900 Subject: [PATCH 146/252] ./Utilities/format.swift --- .../Inputs/MacroSwift/Optionals.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift index 3fabe55c6..57d994519 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Optionals.swift @@ -99,14 +99,18 @@ func testMixedOptionals(firstName: String?, lastName: String?, age: Int?, active @JSGetter var stringOrUndefined: JSUndefinedOr @JSSetter func setStringOrUndefined(_ value: JSUndefinedOr) throws(JSException) @JSFunction func roundTripStringOrNull(value: String?) throws(JSException) -> String? - @JSFunction func roundTripStringOrUndefined(value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr + @JSFunction func roundTripStringOrUndefined( + value: JSUndefinedOr + ) throws(JSException) -> JSUndefinedOr @JSGetter var doubleOrNull: Double? @JSSetter func setDoubleOrNull(_ value: Double?) throws(JSException) @JSGetter var doubleOrUndefined: JSUndefinedOr @JSSetter func setDoubleOrUndefined(_ value: JSUndefinedOr) throws(JSException) @JSFunction func roundTripDoubleOrNull(value: Double?) throws(JSException) -> Double? - @JSFunction func roundTripDoubleOrUndefined(value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr + @JSFunction func roundTripDoubleOrUndefined( + value: JSUndefinedOr + ) throws(JSException) -> JSUndefinedOr @JSGetter var boolOrNull: Bool? @JSSetter func setBoolOrNull(_ value: Bool?) throws(JSException) @@ -121,4 +125,4 @@ func testMixedOptionals(firstName: String?, lastName: String?, age: Int?, active @JSSetter func setIntOrUndefined(_ value: JSUndefinedOr) throws(JSException) @JSFunction func roundTripIntOrNull(value: Int?) throws(JSException) -> Int? @JSFunction func roundTripIntOrUndefined(value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr -} \ No newline at end of file +} From 0bd50f8fd323a66fdfc4ae7e97c9e7cb50259d6c Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 19:02:59 +0900 Subject: [PATCH 147/252] [NFC] BridgeJS: Avoid emitting empty skeletons (#574) --- .../Generated/JavaScript/BridgeJS.json | 8 ----- .../Generated/JavaScript/BridgeJS.json | 8 ----- .../BridgeJSCore/SwiftToSkeleton.swift | 16 ++++++---- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 8 +++++ .../BridgeJSCodegenTests.swift | 18 +++++++++++ .../MacroSwift/Multifile/ExportedOnly.swift | 3 ++ .../Multifile/ImportedFunctions.swift | 1 + .../CrossFileSkipsEmptySkeletons.json | 25 +++++++++++++++ .../CrossFileSkipsEmptySkeletons.swift | 16 ++++++++++ .../BridgeJSCodegenTests/GlobalGetter.json | 18 ----------- .../GlobalThisImports.json | 18 ----------- .../InvalidPropertyNames.json | 18 ----------- .../BridgeJSCodegenTests/JSClass.json | 18 ----------- .../JSClassStaticFunctions.json | 18 ----------- .../BridgeJSCodegenTests/Optionals.json | 3 ++ .../SwiftClosureImports.json | 18 ----------- .../Generated/JavaScript/BridgeJS.json | 32 ------------------- 17 files changed, 83 insertions(+), 163 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/ExportedOnly.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/ImportedFunctions.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.swift diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json index 4dff97132..eacd18cb3 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json @@ -2737,14 +2737,6 @@ }, "imported" : { "children" : [ - { - "functions" : [ - - ], - "types" : [ - - ] - }, { "functions" : [ { diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json index 2952e2157..743925c5f 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json @@ -197,14 +197,6 @@ ] } ] - }, - { - "functions" : [ - - ], - "types" : [ - - ] } ] }, diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index f52aa7008..32b9f6418 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -66,13 +66,14 @@ public final class SwiftToSkeleton { ) } - importedFiles.append( - ImportedFileSkeleton( - functions: importCollector.importedFunctions, - types: importCollector.importedTypes, - globalGetters: importCollector.importedGlobalGetters - ) + let importedFile = ImportedFileSkeleton( + functions: importCollector.importedFunctions, + types: importCollector.importedTypes, + globalGetters: importCollector.importedGlobalGetters ) + if !importedFile.isEmpty { + importedFiles.append(importedFile) + } exportCollector.finalize(&exported) } @@ -90,7 +91,8 @@ public final class SwiftToSkeleton { return module }() - return BridgeJSSkeleton(moduleName: moduleName, exported: exported, imported: importedSkeleton) + let exportedSkeleton: ExportedSkeleton? = exported.isEmpty ? nil : exported + return BridgeJSSkeleton(moduleName: moduleName, exported: exportedSkeleton, imported: importedSkeleton) } func lookupType(for type: TypeSyntax, errors: inout [DiagnosticError]) -> BridgeType? { diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 3e2d51f8f..a9812e2e0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -624,6 +624,10 @@ public struct ExportedSkeleton: Codable { self.protocols.append(contentsOf: other.protocols) assert(self.exposeToGlobal == other.exposeToGlobal) } + + public var isEmpty: Bool { + functions.isEmpty && classes.isEmpty && enums.isEmpty && structs.isEmpty && protocols.isEmpty + } } // MARK: - Imported Skeleton @@ -854,6 +858,10 @@ public struct ImportedFileSkeleton: Codable { try container.encode(globalSetters, forKey: .globalSetters) } } + + public var isEmpty: Bool { + functions.isEmpty && types.isEmpty && globalGetters.isEmpty && globalSetters.isEmpty + } } public struct ImportedModuleSkeleton: Codable { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSCodegenTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSCodegenTests.swift index ed83bc074..9754fbced 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSCodegenTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSCodegenTests.swift @@ -166,4 +166,22 @@ import Testing let skeleton = try swiftAPI.finalize() try snapshotCodegen(skeleton: skeleton, name: "CrossFileFunctionTypes.ReverseOrder") } + + @Test + func codegenSkipsEmptySkeletons() throws { + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + let importedURL = Self.multifileInputsDirectory.appendingPathComponent("ImportedFunctions.swift") + swiftAPI.addSourceFile( + Parser.parse(source: try String(contentsOf: importedURL, encoding: .utf8)), + inputFilePath: "ImportedFunctions.swift" + ) + let exportedOnlyURL = Self.multifileInputsDirectory.appendingPathComponent("ExportedOnly.swift") + swiftAPI.addSourceFile( + Parser.parse(source: try String(contentsOf: exportedOnlyURL, encoding: .utf8)), + inputFilePath: "ExportedOnly.swift" + ) + let skeleton = try swiftAPI.finalize() + #expect(skeleton.exported == nil, "Empty exported skeleton should be omitted") + try snapshotCodegen(skeleton: skeleton, name: "CrossFileSkipsEmptySkeletons") + } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/ExportedOnly.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/ExportedOnly.swift new file mode 100644 index 000000000..d7887d2bd --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/ExportedOnly.swift @@ -0,0 +1,3 @@ +struct ExportedOnly { + let value: Int = 0 +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/ImportedFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/ImportedFunctions.swift new file mode 100644 index 000000000..451424777 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/Multifile/ImportedFunctions.swift @@ -0,0 +1 @@ +@JSFunction func fetchNumber() throws(JSException) -> Int diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.json new file mode 100644 index 000000000..10c079b27 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.json @@ -0,0 +1,25 @@ +{ + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "fetchNumber", + "parameters" : [ + + ], + "returnType" : { + "int" : { + + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.swift new file mode 100644 index 000000000..21e4e939a --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.swift @@ -0,0 +1,16 @@ +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_fetchNumber") +fileprivate func bjs_fetchNumber() -> Int32 +#else +fileprivate func bjs_fetchNumber() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$fetchNumber() throws(JSException) -> Int { + let ret = bjs_fetchNumber() + if let error = _swift_js_take_exception() { + throw error + } + return Int.bridgeJSLiftReturn(ret) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.json index 031870e57..55ac7dd70 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.json @@ -1,22 +1,4 @@ { - "exported" : { - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] - }, "imported" : { "children" : [ { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.json index c75d9e011..5e002e34f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.json @@ -1,22 +1,4 @@ { - "exported" : { - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] - }, "imported" : { "children" : [ { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.json index b983f27a4..935f7a7f2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.json @@ -1,22 +1,4 @@ { - "exported" : { - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] - }, "imported" : { "children" : [ { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.json index be1d0f4cd..689e86150 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.json @@ -1,22 +1,4 @@ { - "exported" : { - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] - }, "imported" : { "children" : [ { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json index df3d3829e..a8b64558f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.json @@ -1,22 +1,4 @@ { - "exported" : { - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] - }, "imported" : { "children" : [ { 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__/BridgeJSCodegenTests/SwiftClosureImports.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json index 12f76a912..9e0e0a491 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json @@ -1,22 +1,4 @@ { - "exported" : { - "classes" : [ - - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "protocols" : [ - - ], - "structs" : [ - - ] - }, "imported" : { "children" : [ { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 476f60e34..0cb32079a 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -12643,22 +12643,6 @@ } ] }, - { - "functions" : [ - - ], - "types" : [ - - ] - }, - { - "functions" : [ - - ], - "types" : [ - - ] - }, { "functions" : [ { @@ -12904,22 +12888,6 @@ ], "types" : [ - ] - }, - { - "functions" : [ - - ], - "types" : [ - - ] - }, - { - "functions" : [ - - ], - "types" : [ - ] } ] From 56aabfae337f0949c992ab500415572030a4875d Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 19:04:00 +0900 Subject: [PATCH 148/252] [NFC] BridgeJS: Omit trailing spaces on empty lines in generated JS code (#575) When generating JavaScript code, avoid adding trailing spaces to empty lines. --- .../BridgeJSLink/CodeFragmentPrinter.swift | 5 ++ .../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 +- 39 files changed, 148 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__/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; From 81885ea1194b3b2f7f2025fe0abba367be3b0b4b Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 20:54:05 +0900 Subject: [PATCH 149/252] BridgeJS: Perf-tune `SwiftToSkeleton` by avoiding unnecessary Syntax node allocation (#577) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `trimmedDescription` allocates two new Syntax nodes just to get the trimmed description of a node. ```swift extension SyntaxProtocol { public var trimmedDescription: String { // TODO: We shouldn't need to create to copies just to get the trimmed // description. return self.trimmed.description } public var trimmed: Self { // TODO: Should only need one new node here return self.with(\.leadingTrivia, []).with(\.trailingTrivia, []) } } ``` ``` $ cat check.d.ts export function getCanvas(x: string): HTMLCanvasElement; $ node Plugins/BridgeJS/Sources/TS2Swift/JavaScript/bin/ts2swift.js check.d.ts -p tsconfig.json -o out.swift $ hyperfine "./Plugins/BridgeJS/.build/debug/BridgeJSToolInternal.before emit-skeleton out.swift" "./Plugins/BridgeJS/.build/debug/BridgeJSToolInternal.after emit-skeleton out.swift" Benchmark 1: ./Plugins/BridgeJS/.build/debug/BridgeJSToolInternal.before emit-skeleton out.swift Time (mean ± σ): 16.531 s ± 0.317 s [User: 16.355 s, System: 0.107 s] Range (min … max): 16.026 s … 17.252 s 10 runs Benchmark 2: ./Plugins/BridgeJS/.build/debug/BridgeJSToolInternal.after emit-skeleton out.swift Time (mean ± σ): 4.068 s ± 0.134 s [User: 3.976 s, System: 0.039 s] Range (min … max): 4.000 s … 4.445 s 10 runs Summary ./Plugins/BridgeJS/.build/debug/BridgeJSToolInternal.after emit-skeleton out.swift ran 4.06 ± 0.15 times faster than ./Plugins/BridgeJS/.build/debug/BridgeJSToolInternal.before emit-skeleton out.swift ``` --- .../BridgeJSCore/SwiftToSkeleton.swift | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index 32b9f6418..d32d85f55 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -394,22 +394,28 @@ private enum ExportSwiftConstants { static let supportedRawTypes = SwiftEnumRawType.allCases.map { $0.rawValue } } +extension AttributeSyntax { + /// The attribute name as text when it is a simple identifier (e.g. "JS", "JSFunction"). + /// Prefer this over `attributeName.trimmedDescription` for name checks to avoid unnecessary string work. + fileprivate var attributeNameText: String? { + attributeName.as(IdentifierTypeSyntax.self)?.name.text + } +} + extension AttributeListSyntax { func hasJSAttribute() -> Bool { firstJSAttribute != nil } var firstJSAttribute: AttributeSyntax? { - first(where: { - $0.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JS" - })?.as(AttributeSyntax.self) + first(where: { $0.as(AttributeSyntax.self)?.attributeNameText == "JS" })?.as(AttributeSyntax.self) } /// Returns true if any attribute has the given name (e.g. "JSClass"). func hasAttribute(name: String) -> Bool { contains { attribute in guard let syntax = attribute.as(AttributeSyntax.self) else { return false } - return syntax.attributeName.trimmedDescription == name + return syntax.attributeNameText == name } } } @@ -1916,9 +1922,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } static func firstJSFunctionAttribute(_ attributes: AttributeListSyntax?) -> AttributeSyntax? { - attributes?.first { attribute in - attribute.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JSFunction" - }?.as(AttributeSyntax.self) + firstAttribute(attributes, named: "JSFunction") } static func hasJSGetterAttribute(_ attributes: AttributeListSyntax?) -> Bool { @@ -1926,9 +1930,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } static func firstJSGetterAttribute(_ attributes: AttributeListSyntax?) -> AttributeSyntax? { - attributes?.first { attribute in - attribute.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JSGetter" - }?.as(AttributeSyntax.self) + firstAttribute(attributes, named: "JSGetter") } static func hasJSSetterAttribute(_ attributes: AttributeListSyntax?) -> Bool { @@ -1936,9 +1938,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } static func firstJSSetterAttribute(_ attributes: AttributeListSyntax?) -> AttributeSyntax? { - attributes?.first { attribute in - attribute.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JSSetter" - }?.as(AttributeSyntax.self) + firstAttribute(attributes, named: "JSSetter") } static func hasJSClassAttribute(_ attributes: AttributeListSyntax?) -> Bool { @@ -1946,16 +1946,18 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } static func firstJSClassAttribute(_ attributes: AttributeListSyntax?) -> AttributeSyntax? { - attributes?.first { attribute in - attribute.as(AttributeSyntax.self)?.attributeName.trimmedDescription == "JSClass" - }?.as(AttributeSyntax.self) + firstAttribute(attributes, named: "JSClass") + } + + static func firstAttribute(_ attributes: AttributeListSyntax?, named name: String) -> AttributeSyntax? { + attributes?.first { $0.as(AttributeSyntax.self)?.attributeNameText == name }?.as(AttributeSyntax.self) } static func hasAttribute(_ attributes: AttributeListSyntax?, name: String) -> Bool { guard let attributes else { return false } return attributes.contains { attribute in guard let syntax = attribute.as(AttributeSyntax.self) else { return false } - return syntax.attributeName.trimmedDescription == name + return syntax.attributeNameText == name } } From 16e3f4467581c7231025c51eb13bfc8a9d87cd46 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 21:29:57 +0900 Subject: [PATCH 150/252] BridgeJS: Add JSValue parameter/return support (#570) * BridgeJS: Add support for `JSValue` * BridgeJS: Fix unused result warnings * BridgeJS: Keep translating object-like types to JSObject * UPDATE_SNAPSHOTS=1 swift test --package-path ./Plugins/BridgeJS * BridgeJS: Update object-like check not to rely on definition location * BridgeJS: Add __bjs_jsValueLower/Lift helper functions * UPDATE_SNAPSHOTS=1 swift test --package-path ./Plugins/BridgeJS --- .../Sources/BridgeJSCore/ExportSwift.swift | 17 +- .../Sources/BridgeJSCore/ImportTS.swift | 24 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 171 +++++-- .../BridgeJSLink/CodeFragmentPrinter.swift | 34 ++ .../Sources/BridgeJSLink/JSGlueGen.swift | 360 +++++++++++++- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 7 +- .../TS2Swift/JavaScript/src/processor.js | 9 +- .../test/__snapshots__/ts2swift.test.js.snap | 31 +- .../test/fixtures/ObjectLikeTypes.d.ts | 1 + .../Inputs/MacroSwift/JSValue.swift | 32 ++ .../BridgeJSCodegenTests/JSValue.json | 273 +++++++++++ .../BridgeJSCodegenTests/JSValue.swift | 149 ++++++ .../BridgeJSLinkTests/JSValue.d.ts | 37 ++ .../BridgeJSLinkTests/JSValue.js | 456 ++++++++++++++++++ .../JavaScriptKit/BridgeJSIntrinsics.swift | 141 ++++++ .../BridgeJSRuntimeTests/ExportAPITests.swift | 8 + .../Generated/BridgeJS.Macros.swift | 4 +- .../Generated/BridgeJS.swift | 50 +- .../Generated/JavaScript/BridgeJS.json | 80 ++- .../GlobalThisImportTests.swift | 6 +- .../BridgeJSRuntimeTests/ImportAPITests.swift | 18 + Tests/BridgeJSRuntimeTests/bridge-js.d.ts | 2 + Tests/prelude.mjs | 20 + 23 files changed, 1841 insertions(+), 89 deletions(-) create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ObjectLikeTypes.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSValue.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index cb267c210..1137343b0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -804,7 +804,7 @@ struct StackCodegen { func liftExpression(for type: BridgeType) -> ExprSyntax { switch type { case .string, .int, .uint, .bool, .float, .double, - .jsObject(nil), .swiftStruct, .swiftHeapObject: + .jsObject(nil), .jsValue, .swiftStruct, .swiftHeapObject: return "\(raw: type.swiftType).bridgeJSLiftParameter()" case .jsObject(let className?): return "\(raw: className)(unsafelyWrapping: JSObject.bridgeJSLiftParameter())" @@ -841,7 +841,7 @@ struct StackCodegen { func liftArrayExpression(elementType: BridgeType) -> ExprSyntax { switch elementType { - case .int, .uint, .float, .double, .string, .bool, + case .int, .uint, .float, .double, .string, .bool, .jsValue, .jsObject(nil), .swiftStruct, .caseEnum, .swiftHeapObject, .unsafePointer, .rawValueEnum, .associatedValueEnum: return "[\(raw: elementType.swiftType)].bridgeJSLiftParameter()" @@ -876,7 +876,7 @@ struct StackCodegen { private func liftNullableExpression(wrappedType: BridgeType, kind: JSOptionalKind) -> ExprSyntax { let typeName = kind == .null ? "Optional" : "JSUndefinedOr" switch wrappedType { - case .string, .int, .uint, .bool, .float, .double, .jsObject(nil), + case .string, .int, .uint, .bool, .float, .double, .jsObject(nil), .jsValue, .swiftStruct, .swiftHeapObject, .caseEnum, .associatedValueEnum, .rawValueEnum: return "\(raw: typeName)<\(raw: wrappedType.swiftType)>.bridgeJSLiftParameter()" case .jsObject(let className?): @@ -914,7 +914,7 @@ struct StackCodegen { varPrefix: String ) -> [CodeBlockItemSyntax] { switch type { - case .string, .int, .uint, .bool, .float, .double: + case .string, .int, .uint, .bool, .float, .double, .jsValue: return ["\(raw: accessor).bridgeJSLowerStackReturn()"] case .jsObject(nil): return ["\(raw: accessor).bridgeJSLowerStackReturn()"] @@ -944,7 +944,7 @@ struct StackCodegen { varPrefix: String ) -> [CodeBlockItemSyntax] { switch elementType { - case .int, .uint, .float, .double, .string, .bool, + case .int, .uint, .float, .double, .string, .bool, .jsValue, .jsObject(nil), .swiftStruct, .caseEnum, .swiftHeapObject, .unsafePointer, .rawValueEnum, .associatedValueEnum: return ["\(raw: accessor).bridgeJSLowerReturn()"] @@ -1015,7 +1015,7 @@ struct StackCodegen { varPrefix: String ) -> [CodeBlockItemSyntax] { switch wrappedType { - case .string, .int, .uint, .bool, .float, .double: + case .string, .int, .uint, .bool, .float, .double, .jsValue: return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] case .caseEnum, .rawValueEnum: // Enums conform to _BridgedSwiftStackType @@ -1604,6 +1604,7 @@ extension BridgeType { case .float: return "Float" case .double: return "Double" case .string: return "String" + case .jsValue: return "JSValue" case .jsObject(nil): return "JSObject" case .jsObject(let name?): return name case .swiftHeapObject(let name): return name @@ -1634,6 +1635,7 @@ extension BridgeType { static let double = LiftingIntrinsicInfo(parameters: [("value", .f64)]) static let string = LiftingIntrinsicInfo(parameters: [("bytes", .i32), ("length", .i32)]) static let jsObject = LiftingIntrinsicInfo(parameters: [("value", .i32)]) + static let jsValue = LiftingIntrinsicInfo(parameters: [("kind", .i32), ("payload1", .i32), ("payload2", .f64)]) static let swiftHeapObject = LiftingIntrinsicInfo(parameters: [("value", .pointer)]) static let unsafePointer = LiftingIntrinsicInfo(parameters: [("pointer", .pointer)]) static let void = LiftingIntrinsicInfo(parameters: []) @@ -1651,6 +1653,7 @@ extension BridgeType { case .double: return .double case .string: return .string case .jsObject: return .jsObject + case .jsValue: return .jsValue case .swiftHeapObject: return .swiftHeapObject case .unsafePointer: return .unsafePointer case .swiftProtocol: return .jsObject @@ -1684,6 +1687,7 @@ extension BridgeType { static let double = LoweringIntrinsicInfo(returnType: .f64) static let string = LoweringIntrinsicInfo(returnType: nil) static let jsObject = LoweringIntrinsicInfo(returnType: .i32) + static let jsValue = LoweringIntrinsicInfo(returnType: nil) static let swiftHeapObject = LoweringIntrinsicInfo(returnType: .pointer) static let unsafePointer = LoweringIntrinsicInfo(returnType: .pointer) static let void = LoweringIntrinsicInfo(returnType: nil) @@ -1703,6 +1707,7 @@ extension BridgeType { case .double: return .double case .string: return .string case .jsObject: return .jsObject + case .jsValue: return .jsValue case .swiftHeapObject: return .swiftHeapObject case .unsafePointer: return .unsafePointer case .swiftProtocol: return .jsObject diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index bcfc344b3..22e0ef162 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -178,13 +178,19 @@ public struct ImportTS { rightParen: .rightParenToken() ) - if returnType == .void { - body.append(CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr))))) - } else if returnType.usesSideChannelForOptionalReturn() { - // Side channel returns don't need "let ret =" - body.append(CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr))))) + let needsRetBinding: Bool + let liftingInfo = try returnType.liftingReturnInfo(context: context) + if liftingInfo.valueToLift == nil || returnType.usesSideChannelForOptionalReturn() { + // Void and side-channel returns don't need "let ret =" + needsRetBinding = false } else { + needsRetBinding = true + } + + if needsRetBinding { body.append("let ret = \(raw: callExpr)") + } else { + body.append(CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr))))) } // Add exception check for ImportTS context @@ -883,6 +889,11 @@ extension BridgeType { static let double = LoweringParameterInfo(loweredParameters: [("value", .f64)]) static let string = LoweringParameterInfo(loweredParameters: [("value", .i32)]) static let jsObject = LoweringParameterInfo(loweredParameters: [("value", .i32)]) + static let jsValue = LoweringParameterInfo(loweredParameters: [ + ("kind", .i32), + ("payload1", .i32), + ("payload2", .f64), + ]) static let void = LoweringParameterInfo(loweredParameters: []) } @@ -894,6 +905,7 @@ extension BridgeType { case .double: return .double case .string: return .string case .jsObject: return .jsObject + case .jsValue: return .jsValue case .void: return .void case .closure: // Swift closure is boxed and passed to JS as a pointer. @@ -970,6 +982,7 @@ extension BridgeType { static let double = LiftingReturnInfo(valueToLift: .f64) static let string = LiftingReturnInfo(valueToLift: .i32) static let jsObject = LiftingReturnInfo(valueToLift: .i32) + static let jsValue = LiftingReturnInfo(valueToLift: nil) static let void = LiftingReturnInfo(valueToLift: nil) } @@ -983,6 +996,7 @@ extension BridgeType { case .double: return .double case .string: return .string case .jsObject: return .jsObject + case .jsValue: return .jsValue case .void: return .void case .closure: // JS returns a callback ID for closures, which Swift lifts to a typed closure. diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 87fbf59aa..4695f3283 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -11,6 +11,7 @@ public struct BridgeJSLink { var skeletons: [BridgeJSSkeleton] = [] let sharedMemory: Bool private let namespaceBuilder = NamespaceBuilder() + private let intrinsicRegistry = JSIntrinsicRegistry() public init( skeletons: [BridgeJSSkeleton] = [], @@ -758,7 +759,7 @@ public struct BridgeJSLink { functionName: String ) -> [String] { let printer = CodeFragmentPrinter() - let scope = JSGlueVariableScope() + let scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) let cleanupCode = CodeFragmentPrinter() // Build parameter list for invoke function @@ -827,7 +828,7 @@ public struct BridgeJSLink { functionName: String ) -> [String] { let printer = CodeFragmentPrinter() - let scope = JSGlueVariableScope() + let scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) let cleanupCode = CodeFragmentPrinter() printer.nextLine() @@ -1036,23 +1037,37 @@ public struct BridgeJSLink { ) printer.write(lines: topLevelNamespaceCode) + let propertyAssignments = try generateNamespacePropertyAssignments( + data: data, + exportedSkeletons: exportedSkeletons, + namespaceBuilder: namespaceBuilder + ) + // Main function declaration printer.write("export async function createInstantiator(options, \(JSGlueVariableScope.reservedSwift)) {") printer.indent { printer.write(lines: generateVariableDeclarations()) + let bodyPrinter = CodeFragmentPrinter() let allStructs = exportedSkeletons.flatMap { $0.structs } for structDef in allStructs { let structPrinter = CodeFragmentPrinter() - let structScope = JSGlueVariableScope() + let structScope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) let structCleanup = CodeFragmentPrinter() let fragment = IntrinsicJSFragment.structHelper(structDefinition: structDef, allStructs: allStructs) _ = fragment.printCode([structDef.name], structScope, structPrinter, structCleanup) - printer.write(lines: structPrinter.lines) + bodyPrinter.write(lines: structPrinter.lines) } - printer.nextLine() - printer.write(contentsOf: generateAddImports(needsImportsObject: data.needsImportsObject)) + bodyPrinter.nextLine() + bodyPrinter.write(contentsOf: generateAddImports(needsImportsObject: data.needsImportsObject)) + + if !intrinsicRegistry.isEmpty { + printer.write(lines: intrinsicRegistry.emitLines()) + printer.nextLine() + } + + printer.write(lines: bodyPrinter.lines) } printer.indent() @@ -1111,11 +1126,6 @@ public struct BridgeJSLink { ) printer.write(lines: namespaceInitCode) - let propertyAssignments = try generateNamespacePropertyAssignments( - data: data, - exportedSkeletons: exportedSkeletons, - namespaceBuilder: namespaceBuilder - ) printer.write(lines: propertyAssignments) } printer.write("},") @@ -1128,6 +1138,7 @@ public struct BridgeJSLink { } public func link() throws -> (outputJs: String, outputDts: String) { + intrinsicRegistry.reset() let data = try collectLinkData() let outputJs = try generateJavaScript(data: data) let outputDts = generateTypeScript(data: data) @@ -1222,6 +1233,7 @@ public struct BridgeJSLink { let hierarchicalLines = try namespaceBuilder.buildHierarchicalExportsObject( exportedSkeletons: exportedSkeletons, + intrinsicRegistry: intrinsicRegistry, renderFunctionImpl: { function in let (js, _) = try self.renderExportedFunction(function: function) return js @@ -1293,9 +1305,9 @@ public struct BridgeJSLink { let effects: Effects let scope: JSGlueVariableScope - init(effects: Effects) { + init(effects: Effects, intrinsicRegistry: JSIntrinsicRegistry) { self.effects = effects - self.scope = JSGlueVariableScope() + self.scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) self.body = CodeFragmentPrinter() self.cleanupCode = CodeFragmentPrinter() } @@ -1516,7 +1528,10 @@ public struct BridgeJSLink { try jsPrinter.indent { // Constructor as 'init' function if let constructor = structDefinition.constructor { - let thunkBuilder = ExportedThunkBuilder(effects: constructor.effects) + let thunkBuilder = ExportedThunkBuilder( + effects: constructor.effects, + intrinsicRegistry: intrinsicRegistry + ) for param in constructor.parameters { try thunkBuilder.lowerParameter(param: param) } @@ -1752,12 +1767,17 @@ public struct BridgeJSLink { extension BridgeJSLink { - func renderExportedFunction(function: ExportedFunction) throws -> (js: [String], dts: [String]) { + func renderExportedFunction( + function: ExportedFunction + ) throws -> (js: [String], dts: [String]) { if function.effects.isStatic, let staticContext = function.staticContext { return try renderStaticFunction(function: function, staticContext: staticContext) } - let thunkBuilder = ExportedThunkBuilder(effects: function.effects) + let thunkBuilder = ExportedThunkBuilder( + effects: function.effects, + intrinsicRegistry: intrinsicRegistry + ) for param in function.parameters { try thunkBuilder.lowerParameter(param: param) } @@ -1790,7 +1810,10 @@ extension BridgeJSLink { return try renderEnumStaticFunction(function: function, enumName: enumName) case .namespaceEnum: if let namespace = function.namespace, !namespace.isEmpty { - return try renderNamespaceFunction(function: function, namespace: namespace.joined(separator: ".")) + return try renderNamespaceFunction( + function: function, + namespace: namespace.joined(separator: ".") + ) } else { return try renderExportedFunction(function: function) } @@ -1801,7 +1824,10 @@ extension BridgeJSLink { function: ExportedFunction, className: String ) throws -> (js: [String], dts: [String]) { - let thunkBuilder = ExportedThunkBuilder(effects: function.effects) + let thunkBuilder = ExportedThunkBuilder( + effects: function.effects, + intrinsicRegistry: intrinsicRegistry + ) for param in function.parameters { try thunkBuilder.lowerParameter(param: param) } @@ -1829,7 +1855,10 @@ extension BridgeJSLink { function: ExportedFunction, enumName: String ) throws -> (js: [String], dts: [String]) { - let thunkBuilder = ExportedThunkBuilder(effects: function.effects) + let thunkBuilder = ExportedThunkBuilder( + effects: function.effects, + intrinsicRegistry: intrinsicRegistry + ) for param in function.parameters { try thunkBuilder.lowerParameter(param: param) } @@ -1857,7 +1886,10 @@ extension BridgeJSLink { function: ExportedFunction, namespace: String ) throws -> (js: [String], dts: [String]) { - let thunkBuilder = ExportedThunkBuilder(effects: function.effects) + let thunkBuilder = ExportedThunkBuilder( + effects: function.effects, + intrinsicRegistry: intrinsicRegistry + ) for param in function.parameters { try thunkBuilder.lowerParameter(param: param) } @@ -1879,7 +1911,10 @@ extension BridgeJSLink { private func renderStaticMethodForExportObject( method: ExportedFunction ) throws -> [String] { - let thunkBuilder = ExportedThunkBuilder(effects: method.effects) + let thunkBuilder = ExportedThunkBuilder( + effects: method.effects, + intrinsicRegistry: intrinsicRegistry + ) for param in method.parameters { try thunkBuilder.lowerParameter(param: param) } @@ -1904,7 +1939,10 @@ extension BridgeJSLink { let propertyPrinter = CodeFragmentPrinter() // Generate getter - let getterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) + let getterThunkBuilder = ExportedThunkBuilder( + effects: Effects(isAsync: false, isThrows: false), + intrinsicRegistry: intrinsicRegistry + ) let getterReturnExpr = try getterThunkBuilder.call( abiName: className != nil ? property.getterAbiName(className: className!) @@ -1921,7 +1959,8 @@ extension BridgeJSLink { // Generate setter if not readonly if !property.isReadonly { let setterThunkBuilder = ExportedThunkBuilder( - effects: Effects(isAsync: false, isThrows: false) + effects: Effects(isAsync: false, isThrows: false), + intrinsicRegistry: intrinsicRegistry ) try setterThunkBuilder.lowerParameter( param: Parameter(label: "value", name: "value", type: property.type) @@ -1967,7 +2006,10 @@ extension BridgeJSLink { } if let constructor: ExportedConstructor = klass.constructor { - let thunkBuilder = ExportedThunkBuilder(effects: constructor.effects) + let thunkBuilder = ExportedThunkBuilder( + effects: constructor.effects, + intrinsicRegistry: intrinsicRegistry + ) for param in constructor.parameters { try thunkBuilder.lowerParameter(param: param) } @@ -1999,7 +2041,10 @@ extension BridgeJSLink { for method in klass.methods { if method.effects.isStatic { - let thunkBuilder = ExportedThunkBuilder(effects: method.effects) + let thunkBuilder = ExportedThunkBuilder( + effects: method.effects, + intrinsicRegistry: intrinsicRegistry + ) for param in method.parameters { try thunkBuilder.lowerParameter(param: param) } @@ -2022,7 +2067,10 @@ extension BridgeJSLink { ) } } else { - let thunkBuilder = ExportedThunkBuilder(effects: method.effects) + let thunkBuilder = ExportedThunkBuilder( + effects: method.effects, + intrinsicRegistry: intrinsicRegistry + ) thunkBuilder.lowerSelf() for param in method.parameters { try thunkBuilder.lowerParameter(param: param) @@ -2073,7 +2121,10 @@ extension BridgeJSLink { jsPrinter: CodeFragmentPrinter, dtsPrinter: CodeFragmentPrinter ) throws { - let getterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) + let getterThunkBuilder = ExportedThunkBuilder( + effects: Effects(isAsync: false, isThrows: false), + intrinsicRegistry: intrinsicRegistry + ) if !isStatic { getterThunkBuilder.lowerSelf() } @@ -2095,7 +2146,10 @@ extension BridgeJSLink { // Generate setter if not readonly if !property.isReadonly { - let setterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) + let setterThunkBuilder = ExportedThunkBuilder( + effects: Effects(isAsync: false, isThrows: false), + intrinsicRegistry: intrinsicRegistry + ) if !isStatic { setterThunkBuilder.lowerSelf() } @@ -2134,9 +2188,9 @@ extension BridgeJSLink { var parameterNames: [String] = [] var parameterForwardings: [String] = [] - init(context: BridgeContext = .importTS) { + init(context: BridgeContext = .importTS, intrinsicRegistry: JSIntrinsicRegistry) { self.body = CodeFragmentPrinter() - self.scope = JSGlueVariableScope() + self.scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) self.cleanupCode = CodeFragmentPrinter() self.context = context } @@ -2622,6 +2676,7 @@ extension BridgeJSLink { fileprivate func buildHierarchicalExportsObject( exportedSkeletons: [ExportedSkeleton], + intrinsicRegistry: JSIntrinsicRegistry, renderFunctionImpl: (ExportedFunction) throws -> [String] ) throws -> [String] { let printer = CodeFragmentPrinter() @@ -2631,7 +2686,10 @@ extension BridgeJSLink { try populateJavaScriptExportLines(node: rootNode, renderFunctionImpl: renderFunctionImpl) - try populatePropertyImplementations(node: rootNode) + try populatePropertyImplementations( + node: rootNode, + intrinsicRegistry: intrinsicRegistry + ) printExportsObjectHierarchy(node: rootNode, printer: printer, currentPath: []) @@ -2652,10 +2710,16 @@ extension BridgeJSLink { } } - private func populatePropertyImplementations(node: NamespaceNode) throws { + private func populatePropertyImplementations( + node: NamespaceNode, + intrinsicRegistry: JSIntrinsicRegistry + ) throws { for property in node.content.staticProperties { // Generate getter - let getterThunkBuilder = ExportedThunkBuilder(effects: Effects(isAsync: false, isThrows: false)) + let getterThunkBuilder = ExportedThunkBuilder( + effects: Effects(isAsync: false, isThrows: false), + intrinsicRegistry: intrinsicRegistry + ) let getterReturnExpr = try getterThunkBuilder.call( abiName: property.getterAbiName(), returnType: property.type @@ -2678,14 +2742,15 @@ extension BridgeJSLink { // Generate setter if not readonly if !property.isReadonly { let setterThunkBuilder = ExportedThunkBuilder( - effects: Effects(isAsync: false, isThrows: false) + effects: Effects(isAsync: false, isThrows: false), + intrinsicRegistry: intrinsicRegistry ) try setterThunkBuilder.lowerParameter( param: Parameter(label: "value", name: "value", type: property.type) ) _ = try setterThunkBuilder.call( abiName: property.setterAbiName(), - returnType: .void + returnType: BridgeType.void ) let setterPrinter = CodeFragmentPrinter() @@ -2705,7 +2770,10 @@ extension BridgeJSLink { // Recursively process child nodes for (_, childNode) in node.children { - try populatePropertyImplementations(node: childNode) + try populatePropertyImplementations( + node: childNode, + intrinsicRegistry: intrinsicRegistry + ) } } @@ -3045,7 +3113,7 @@ extension BridgeJSLink { importObjectBuilder: ImportObjectBuilder, function: ImportedFunctionSkeleton ) throws { - let thunkBuilder = ImportedThunkBuilder() + let thunkBuilder = ImportedThunkBuilder(intrinsicRegistry: intrinsicRegistry) for param in function.parameters { try thunkBuilder.liftParameter(param: param) } @@ -3076,7 +3144,7 @@ extension BridgeJSLink { importObjectBuilder: ImportObjectBuilder, getter: ImportedGetterSkeleton ) throws { - let thunkBuilder = ImportedThunkBuilder() + let thunkBuilder = ImportedThunkBuilder(intrinsicRegistry: intrinsicRegistry) let jsName = getter.jsName ?? getter.name let importRootExpr = getter.from == .global ? "globalThis" : "imports" let returnExpr = try thunkBuilder.getImportProperty( @@ -3177,7 +3245,7 @@ extension BridgeJSLink { type: ImportedTypeSkeleton, constructor: ImportedConstructorSkeleton ) throws { - let thunkBuilder = ImportedThunkBuilder() + let thunkBuilder = ImportedThunkBuilder(intrinsicRegistry: intrinsicRegistry) for param in constructor.parameters { try thunkBuilder.liftParameter(param: param) } @@ -3202,7 +3270,7 @@ extension BridgeJSLink { abiName: String, emitCall: (ImportedThunkBuilder) throws -> String? ) throws -> (js: [String], dts: [String]) { - let thunkBuilder = ImportedThunkBuilder() + let thunkBuilder = ImportedThunkBuilder(intrinsicRegistry: intrinsicRegistry) thunkBuilder.liftSelf() let returnExpr = try emitCall(thunkBuilder) let funcLines = thunkBuilder.renderFunction( @@ -3218,7 +3286,7 @@ extension BridgeJSLink { abiName: String, emitCall: (ImportedThunkBuilder) throws -> String? ) throws -> (js: [String], dts: [String]) { - let thunkBuilder = ImportedThunkBuilder() + let thunkBuilder = ImportedThunkBuilder(intrinsicRegistry: intrinsicRegistry) thunkBuilder.liftSelf() let returnExpr = try emitCall(thunkBuilder) let funcLines = thunkBuilder.renderFunction( @@ -3233,7 +3301,7 @@ extension BridgeJSLink { context: ImportedTypeSkeleton, method: ImportedFunctionSkeleton ) throws -> (js: [String], dts: [String]) { - let thunkBuilder = ImportedThunkBuilder() + let thunkBuilder = ImportedThunkBuilder(intrinsicRegistry: intrinsicRegistry) for param in method.parameters { try thunkBuilder.liftParameter(param: param) } @@ -3259,7 +3327,7 @@ extension BridgeJSLink { context: ImportedTypeSkeleton, method: ImportedFunctionSkeleton ) throws -> (js: [String], dts: [String]) { - let thunkBuilder = ImportedThunkBuilder() + let thunkBuilder = ImportedThunkBuilder(intrinsicRegistry: intrinsicRegistry) thunkBuilder.liftSelf() for param in method.parameters { try thunkBuilder.liftParameter(param: param) @@ -3286,7 +3354,10 @@ extension BridgeJSLink { className: `protocol`.name ) - let getterThunkBuilder = ImportedThunkBuilder(context: .exportSwift) + let getterThunkBuilder = ImportedThunkBuilder( + context: .exportSwift, + intrinsicRegistry: intrinsicRegistry + ) getterThunkBuilder.liftSelf() let returnExpr = try getterThunkBuilder.callPropertyGetter(name: property.name, returnType: property.type) let getterLines = getterThunkBuilder.renderFunction( @@ -3304,7 +3375,10 @@ extension BridgeJSLink { operation: "set", className: `protocol`.name ) - let setterThunkBuilder = ImportedThunkBuilder(context: .exportSwift) + let setterThunkBuilder = ImportedThunkBuilder( + context: .exportSwift, + intrinsicRegistry: intrinsicRegistry + ) setterThunkBuilder.liftSelf() try setterThunkBuilder.liftParameter( param: Parameter(label: nil, name: "value", type: property.type) @@ -3324,7 +3398,10 @@ extension BridgeJSLink { protocol: ExportedProtocol, method: ExportedFunction ) throws { - let thunkBuilder = ImportedThunkBuilder(context: .exportSwift) + let thunkBuilder = ImportedThunkBuilder( + context: .exportSwift, + intrinsicRegistry: intrinsicRegistry + ) thunkBuilder.liftSelf() for param in method.parameters { try thunkBuilder.liftParameter(param: param) @@ -3447,6 +3524,8 @@ extension BridgeType { return "boolean" case .jsObject(let name): return name ?? "any" + case .jsValue: + return "any" case .swiftHeapObject(let name): return name case .unsafePointer: diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift index 258a0ad18..8c5a47b23 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift @@ -1,3 +1,37 @@ +/// Registry for JS helper intrinsics used during code generation. +final class JSIntrinsicRegistry { + private var entries: [String: [String]] = [:] + + var isEmpty: Bool { + entries.isEmpty + } + + func register(name: String, build: (CodeFragmentPrinter) -> Void) { + guard entries[name] == nil else { return } + let printer = CodeFragmentPrinter() + build(printer) + entries[name] = printer.lines + } + + func reset() { + entries.removeAll() + } + + func emitLines() -> [String] { + var emitted: [String] = [] + for key in entries.keys.sorted() { + if let lines = entries[key] { + emitted.append(contentsOf: lines) + emitted.append("") + } + } + if emitted.last == "" { + emitted.removeLast() + } + return emitted + } +} + /// A printer for code fragments. final class CodeFragmentPrinter { private(set) var lines: [String] = [] diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 90ea5ab0c..ef72cf6f6 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -34,6 +34,8 @@ final class JSGlueVariableScope { static let reservedEnumHelpers = "enumHelpers" static let reservedStructHelpers = "structHelpers" + private let intrinsicRegistry: JSIntrinsicRegistry? + private var variables: Set = [ reservedSwift, reservedInstance, @@ -64,6 +66,10 @@ final class JSGlueVariableScope { reservedStructHelpers, ] + init(intrinsicRegistry: JSIntrinsicRegistry? = nil) { + self.intrinsicRegistry = intrinsicRegistry + } + /// Returns a unique variable name in the scope based on the given name hint. /// /// - Parameter hint: A hint for the variable name. @@ -80,6 +86,14 @@ final class JSGlueVariableScope { } while !variables.insert(suffixedName).inserted return suffixedName } + + func registerIntrinsic(_ name: String, build: (CodeFragmentPrinter) -> Void) { + intrinsicRegistry?.register(name: name, build: build) + } + + func makeChildScope() -> JSGlueVariableScope { + JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) + } } /// A fragment of JS code used to convert a value between Swift and JS. @@ -238,6 +252,274 @@ struct IntrinsicJSFragment: Sendable { } ) + private static let jsValueLowerHelperName = "__bjs_jsValueLower" + private static let jsValueLiftHelperName = "__bjs_jsValueLift" + + private static func registerJSValueHelpers(scope: JSGlueVariableScope) { + scope.registerIntrinsic("jsValueHelpers") { helperPrinter in + helperPrinter.write("function \(jsValueLowerHelperName)(value) {") + helperPrinter.indent { + emitJSValueLowerBody( + value: "value", + kindVar: "kind", + payload1Var: "payload1", + payload2Var: "payload2", + printer: helperPrinter + ) + helperPrinter.write("return [kind, payload1, payload2];") + } + helperPrinter.write("}") + helperPrinter.write("function \(jsValueLiftHelperName)(kind, payload1, payload2) {") + helperPrinter.indent { + let helperScope = JSGlueVariableScope() + let resultVar = emitJSValueConstruction( + kind: "kind", + payload1: "payload1", + payload2: "payload2", + scope: helperScope, + printer: helperPrinter + ) + helperPrinter.write("return \(resultVar);") + } + helperPrinter.write("}") + } + } + + private static func emitJSValueLowerBody( + value: String, + kindVar: String, + payload1Var: String, + payload2Var: String, + printer: CodeFragmentPrinter + ) { + printer.write("let \(kindVar);") + printer.write("let \(payload1Var);") + printer.write("let \(payload2Var);") + printer.write("if (\(value) === null) {") + printer.indent { + printer.write("\(kindVar) = 4;") + printer.write("\(payload1Var) = 0;") + printer.write("\(payload2Var) = 0;") + } + printer.write("} else {") + printer.indent { + printer.write("switch (typeof \(value)) {") + printer.indent { + printer.write("case \"boolean\":") + printer.indent { + printer.write("\(kindVar) = 0;") + printer.write("\(payload1Var) = \(value) ? 1 : 0;") + printer.write("\(payload2Var) = 0;") + printer.write("break;") + } + printer.write("case \"number\":") + printer.indent { + printer.write("\(kindVar) = 2;") + printer.write("\(payload1Var) = 0;") + printer.write("\(payload2Var) = \(value);") + printer.write("break;") + } + printer.write("case \"string\":") + printer.indent { + printer.write("\(kindVar) = 1;") + printer.write("\(payload1Var) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + printer.write("\(payload2Var) = 0;") + printer.write("break;") + } + printer.write("case \"undefined\":") + printer.indent { + printer.write("\(kindVar) = 5;") + printer.write("\(payload1Var) = 0;") + printer.write("\(payload2Var) = 0;") + printer.write("break;") + } + printer.write("case \"object\":") + printer.indent { + printer.write("\(kindVar) = 3;") + printer.write("\(payload1Var) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + printer.write("\(payload2Var) = 0;") + printer.write("break;") + } + printer.write("case \"function\":") + printer.indent { + printer.write("\(kindVar) = 3;") + printer.write("\(payload1Var) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + printer.write("\(payload2Var) = 0;") + printer.write("break;") + } + printer.write("case \"symbol\":") + printer.indent { + printer.write("\(kindVar) = 7;") + printer.write("\(payload1Var) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + printer.write("\(payload2Var) = 0;") + printer.write("break;") + } + printer.write("case \"bigint\":") + printer.indent { + printer.write("\(kindVar) = 8;") + printer.write("\(payload1Var) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + printer.write("\(payload2Var) = 0;") + printer.write("break;") + } + printer.write("default:") + printer.indent { + printer.write("throw new TypeError(\"Unsupported JSValue type\");") + } + } + printer.write("}") + } + printer.write("}") + } + + static let jsValueLower = IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanupCode in + let value = arguments[0] + let kindVar = scope.variable("\(value)Kind") + let payload1Var = scope.variable("\(value)Payload1") + let payload2Var = scope.variable("\(value)Payload2") + registerJSValueHelpers(scope: scope) + printer.write( + "const [\(kindVar), \(payload1Var), \(payload2Var)] = \(jsValueLowerHelperName)(\(value));" + ) + return [kindVar, payload1Var, payload2Var] + } + ) + + private static func emitJSValueConstruction( + kind: String, + payload1: String, + payload2: String, + scope: JSGlueVariableScope, + printer: CodeFragmentPrinter + ) -> String { + let resultVar = scope.variable("jsValue") + printer.write("let \(resultVar);") + printer.write("switch (\(kind)) {") + printer.indent { + printer.write("case 0:") + printer.indent { + printer.write("\(resultVar) = \(payload1) !== 0;") + printer.write("break;") + } + printer.write("case 1:") + printer.indent { + printer.write( + "\(resultVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(payload1));" + ) + printer.write("break;") + } + printer.write("case 2:") + printer.indent { + printer.write("\(resultVar) = \(payload2);") + printer.write("break;") + } + printer.write("case 3:") + printer.indent { + printer.write( + "\(resultVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(payload1));" + ) + printer.write("break;") + } + printer.write("case 4:") + printer.indent { + printer.write("\(resultVar) = null;") + printer.write("break;") + } + printer.write("case 5:") + printer.indent { + printer.write("\(resultVar) = undefined;") + printer.write("break;") + } + printer.write("case 7:") + printer.indent { + printer.write( + "\(resultVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(payload1));" + ) + printer.write("break;") + } + printer.write("case 8:") + printer.indent { + printer.write( + "\(resultVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(payload1));" + ) + printer.write("break;") + } + printer.write("default:") + printer.indent { + printer.write("throw new TypeError(\"Unsupported JSValue kind \" + \(kind));") + } + } + printer.write("}") + return resultVar + } + + static func jsValueLowerReturn(context: BridgeContext) -> IntrinsicJSFragment { + switch context { + case .importTS: + // Return values from imported JS functions should be delivered to the Swift side + // via the parameter stacks that `_swift_js_pop_*` read from. + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanupCode in + let lowered = jsValueLower.printCode(arguments, scope, printer, cleanupCode) + let kindVar = lowered[0] + let payload1Var = lowered[1] + let payload2Var = lowered[2] + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(kindVar));") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(payload1Var));") + printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(payload2Var));") + return [] + } + ) + case .exportSwift: + // Kept for symmetry, though JSValue return for export currently relies on Swift pushing + // to tmpRet stacks directly. + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanupCode in + let lowered = jsValueLower.printCode(arguments, scope, printer, cleanupCode) + let kindVar = lowered[0] + let payload1Var = lowered[1] + let payload2Var = lowered[2] + printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(\(kindVar));") + printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(\(payload1Var));") + printer.write("\(JSGlueVariableScope.reservedTmpRetF64s).push(\(payload2Var));") + return [] + } + ) + } + } + + static let jsValueLift = IntrinsicJSFragment( + parameters: [], + printCode: { _, scope, printer, cleanupCode in + let payload2 = scope.variable("jsValuePayload2") + let payload1 = scope.variable("jsValuePayload1") + let kind = scope.variable("jsValueKind") + printer.write("const \(payload2) = \(JSGlueVariableScope.reservedTmpRetF64s).pop();") + printer.write("const \(payload1) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(kind) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + let resultVar = scope.variable("jsValue") + registerJSValueHelpers(scope: scope) + printer.write( + "const \(resultVar) = \(jsValueLiftHelperName)(\(kind), \(payload1), \(payload2));" + ) + return [resultVar] + } + ) + static let jsValueLiftParameter = IntrinsicJSFragment( + parameters: ["kind", "payload1", "payload2"], + printCode: { arguments, scope, printer, cleanupCode in + let resultVar = scope.variable("jsValue") + registerJSValueHelpers(scope: scope) + printer.write( + "const \(resultVar) = \(jsValueLiftHelperName)(\(arguments[0]), \(arguments[1]), \(arguments[2]));" + ) + return [resultVar] + } + ) + static let swiftHeapObjectLowerParameter = IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanupCode in @@ -296,10 +578,24 @@ struct IntrinsicJSFragment: Sendable { ) } - static func optionalLiftParameter( - wrappedType: BridgeType, - kind: JSOptionalKind - ) throws -> IntrinsicJSFragment { + static func optionalLiftParameter(wrappedType: BridgeType, kind: JSOptionalKind) throws -> IntrinsicJSFragment { + if case .jsValue = wrappedType { + return IntrinsicJSFragment( + parameters: ["isSome", "kind", "payload1", "payload2"], + printCode: { arguments, scope, printer, cleanupCode in + let isSome = arguments[0] + let lifted = jsValueLiftParameter.printCode( + [arguments[1], arguments[2], arguments[3]], + scope, + printer, + cleanupCode + ) + let valueExpr = lifted.first ?? "undefined" + return ["\(isSome) ? \(valueExpr) : null"] + } + ) + } + return IntrinsicJSFragment( parameters: ["isSome", "wrappedValue"], printCode: { arguments, scope, printer, cleanupCode in @@ -446,6 +742,9 @@ struct IntrinsicJSFragment: Sendable { cleanupCode.write("}") return ["+\(isSomeVar)", "\(isSomeVar) ? \(idVar) : 0", "\(isSomeVar) ? \(bytesVar).length : 0"] + case .jsValue: + let lowered = jsValueLower.printCode([value], scope, printer, cleanupCode) + return ["+\(isSomeVar)"] + lowered case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName let caseIdVar = scope.variable("\(value)CaseId") @@ -634,6 +933,22 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(resultVar) = \(absenceLiteral);") } printer.write("}") + case .jsValue: + let isSomeVar = scope.variable("isSome") + printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("let \(resultVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let lifted = jsValueLift.printCode([], scope, printer, cleanupCode) + if let liftedValue = lifted.first { + printer.write("\(resultVar) = \(liftedValue);") + } + } + printer.write("} else {") + printer.indent { + printer.write("\(resultVar) = null;") + } + printer.write("}") default: printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnString);") printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = undefined;") @@ -702,6 +1017,17 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") printer.write("bjs[\"swift_js_return_optional_object\"](\(isSomeVar) ? 1 : 0, \(idVar));") + case .jsValue: + if value != "undefined" { + let lowered = jsValueLower.printCode([value], scope, printer, cleanupCode) + let kindVar = lowered[0] + let payload1Var = lowered[1] + let payload2Var = lowered[2] + printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(\(kindVar));") + printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(\(payload1Var));") + printer.write("\(JSGlueVariableScope.reservedTmpRetF64s).push(\(payload2Var));") + } + printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(\(isSomeVar) ? 1 : 0);") case .rawValueEnum(_, let rawType): switch rawType { case .string: @@ -1396,6 +1722,7 @@ struct IntrinsicJSFragment: Sendable { case .int, .uint, .float, .double, .bool, .unsafePointer: return .identity case .string: return .stringLowerParameter case .jsObject: return .jsObjectLowerParameter + case .jsValue: return .jsValueLower case .swiftHeapObject: return .swiftHeapObjectLowerParameter case .swiftProtocol: return .jsObjectLowerParameter @@ -1441,6 +1768,7 @@ struct IntrinsicJSFragment: Sendable { case .bool: return .boolLiftReturn case .string: return .stringLiftReturn case .jsObject: return .jsObjectLiftReturn + case .jsValue: return .jsValueLift case .swiftHeapObject(let name): return .swiftHeapObjectLiftReturn(name) case .unsafePointer: return .identity case .swiftProtocol: return .jsObjectLiftReturn @@ -1489,6 +1817,7 @@ struct IntrinsicJSFragment: Sendable { case .bool: return .boolLiftParameter case .string: return .stringLiftParameter case .jsObject: return .jsObjectLiftParameter + case .jsValue: return .jsValueLiftParameter case .unsafePointer: return .identity case .swiftHeapObject(let name): switch context { @@ -1583,6 +1912,7 @@ struct IntrinsicJSFragment: Sendable { case .bool: return .boolLowerReturn case .string: return .stringLowerReturn case .jsObject: return .jsObjectLowerReturn + case .jsValue: return .jsValueLowerReturn(context: context) case .unsafePointer: return .identity case .swiftHeapObject(let name): switch context { @@ -1709,7 +2039,7 @@ struct IntrinsicJSFragment: Sendable { let lowerPrinter = CodeFragmentPrinter() for enumCase in enumDefinition.cases { let caseName = enumCase.name.capitalizedFirstLetter - let caseScope = JSGlueVariableScope() + let caseScope = scope.makeChildScope() let caseCleanup = CodeFragmentPrinter() caseCleanup.indent() let fragment = IntrinsicJSFragment.associatedValuePushPayload(enumCase: enumCase) @@ -1737,7 +2067,7 @@ struct IntrinsicJSFragment: Sendable { let liftPrinter = CodeFragmentPrinter() for enumCase in enumDefinition.cases { let caseName = enumCase.name.capitalizedFirstLetter - let caseScope = JSGlueVariableScope() + let caseScope = scope.makeChildScope() let caseCleanup = CodeFragmentPrinter() let fragment = IntrinsicJSFragment.associatedValuePopPayload(enumCase: enumCase) @@ -2208,6 +2538,8 @@ struct IntrinsicJSFragment: Sendable { private static func arrayElementRaiseFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { switch elementType { + case .jsValue: + throw BridgeJSLinkError(message: "Array of JSValue is not supported yet") case .string: return IntrinsicJSFragment( parameters: [], @@ -2352,6 +2684,8 @@ struct IntrinsicJSFragment: Sendable { private static func arrayElementLowerFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { switch elementType { + case .jsValue: + throw BridgeJSLinkError(message: "Array of JSValue is not supported yet") case .string: return IntrinsicJSFragment( parameters: ["value"], @@ -2622,6 +2956,7 @@ struct IntrinsicJSFragment: Sendable { generateStructLowerCode( structDef: capturedStructDef, allStructs: capturedAllStructs, + scope: scope, printer: printer ) } @@ -2634,6 +2969,7 @@ struct IntrinsicJSFragment: Sendable { generateStructLiftCode( structDef: capturedStructDef, allStructs: capturedAllStructs, + scope: scope, printer: printer, attachMethods: true ) @@ -2656,10 +2992,11 @@ struct IntrinsicJSFragment: Sendable { private static func generateStructLowerCode( structDef: ExportedStruct, allStructs: [ExportedStruct], + scope: JSGlueVariableScope, printer: CodeFragmentPrinter ) { let lowerPrinter = CodeFragmentPrinter() - let lowerScope = JSGlueVariableScope() + let lowerScope = scope.makeChildScope() let lowerCleanup = CodeFragmentPrinter() lowerCleanup.indent() @@ -2687,10 +3024,11 @@ struct IntrinsicJSFragment: Sendable { private static func generateStructLiftCode( structDef: ExportedStruct, allStructs: [ExportedStruct], + scope: JSGlueVariableScope, printer: CodeFragmentPrinter, attachMethods: Bool = false ) { - let liftScope = JSGlueVariableScope() + let liftScope = scope.makeChildScope() let liftCleanup = CodeFragmentPrinter() var fieldExpressions: [(name: String, expression: String)] = [] @@ -2724,7 +3062,7 @@ struct IntrinsicJSFragment: Sendable { "\(instanceVar).\(method.name) = function(\(paramList)) {" ) printer.indent { - let methodScope = JSGlueVariableScope() + let methodScope = scope.makeChildScope() let methodCleanup = CodeFragmentPrinter() // Lower the struct instance (this) using the helper's lower function @@ -2778,6 +3116,8 @@ struct IntrinsicJSFragment: Sendable { allStructs: [ExportedStruct] ) -> IntrinsicJSFragment { switch field.type { + case .jsValue: + preconditionFailure("Struct field of JSValue is not supported yet") case .string: return IntrinsicJSFragment( parameters: ["value"], @@ -3264,6 +3604,8 @@ struct IntrinsicJSFragment: Sendable { allStructs: [ExportedStruct] ) -> IntrinsicJSFragment { switch field.type { + case .jsValue: + preconditionFailure("Struct field of JSValue is not supported yet") case .string: return IntrinsicJSFragment( parameters: [], diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index a9812e2e0..0d4a78d3e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -149,7 +149,7 @@ public enum JSOptionalKind: String, Codable, Equatable, Hashable, Sendable { } public enum BridgeType: Codable, Equatable, Hashable, Sendable { - case int, uint, float, double, string, bool, jsObject(String?), swiftHeapObject(String), void + case int, uint, float, double, string, bool, jsObject(String?), jsValue, swiftHeapObject(String), void case unsafePointer(UnsafePointerType) indirect case nullable(BridgeType, JSOptionalKind) indirect case array(BridgeType) @@ -905,6 +905,8 @@ extension BridgeType { self = .string case "Bool": self = .bool + case "JSValue": + self = .jsValue case "Void": self = .void case "JSObject": @@ -929,6 +931,7 @@ extension BridgeType { case .double: return .f64 case .string: return nil case .jsObject: return .i32 + case .jsValue: return nil case .swiftHeapObject: // UnsafeMutableRawPointer is returned as an i32 pointer return .pointer @@ -979,6 +982,8 @@ extension BridgeType { case .jsObject(let name): let typeName = name ?? "JSObject" return "\(typeName.count)\(typeName)C" + case .jsValue: + return "7JSValueV" case .swiftHeapObject(let name): return "\(name.count)\(name)C" case .unsafePointer(let ptr): diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index e2c7d00f0..c06ba94aa 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -706,8 +706,8 @@ export class TypeProcessor { "string": "String", "boolean": "Bool", "void": "Void", - "any": "JSObject", - "unknown": "JSObject", + "any": "JSValue", + "unknown": "JSValue", "null": "Void", "undefined": "Void", "bigint": "Int", @@ -716,12 +716,11 @@ export class TypeProcessor { "never": "Void", "Promise": "JSPromise", }; - const typeString = type.getSymbol()?.name ?? this.checker.typeToString(type); + const symbol = type.getSymbol() ?? type.aliasSymbol; + const typeString = symbol?.name ?? this.checker.typeToString(type); if (typeMap[typeString]) { return typeMap[typeString]; } - - const symbol = type.getSymbol() ?? type.aliasSymbol; if (symbol && (symbol.flags & ts.SymbolFlags.Enum) !== 0) { const typeName = symbol.name; this.seenTypes.set(type, node); diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index 2413c56af..f81a2ce07 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -38,7 +38,7 @@ exports[`ts2swift > snapshots Swift output for Async.d.ts > Async 1`] = ` @JSFunction func asyncRoundTripDouble(_ v: Double) throws(JSException) -> JSPromise -@JSFunction func asyncRoundTripJSObject(_ v: JSObject) throws(JSException) -> JSPromise +@JSFunction func asyncRoundTripJSObject(_ v: JSValue) throws(JSException) -> JSPromise " `; @@ -54,8 +54,8 @@ exports[`ts2swift > snapshots Swift output for Interface.d.ts > Interface 1`] = @JSFunction func returnAnimatable() throws(JSException) -> Animatable @JSClass struct Animatable { - @JSFunction func animate(_ keyframes: JSObject, _ options: JSObject) throws(JSException) -> JSObject - @JSFunction func getAnimations(_ options: JSObject) throws(JSException) -> JSObject + @JSFunction func animate(_ keyframes: JSValue, _ options: JSValue) throws(JSException) -> JSValue + @JSFunction func getAnimations(_ options: JSValue) throws(JSException) -> JSValue } " `; @@ -117,11 +117,11 @@ exports[`ts2swift > snapshots Swift output for MultipleImportedTypes.d.ts > Mult @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func createDatabaseConnection(_ config: JSObject) throws(JSException) -> DatabaseConnection +@JSFunction func createDatabaseConnection(_ config: JSValue) throws(JSException) -> DatabaseConnection @JSClass struct DatabaseConnection { @JSFunction func connect(_ url: String) throws(JSException) -> Void - @JSFunction func execute(_ query: String) throws(JSException) -> JSObject + @JSFunction func execute(_ query: String) throws(JSException) -> JSValue @JSGetter var isConnected: Bool @JSGetter var connectionTimeout: Double @JSSetter func setConnectionTimeout(_ value: Double) throws(JSException) @@ -131,20 +131,33 @@ exports[`ts2swift > snapshots Swift output for MultipleImportedTypes.d.ts > Mult @JSClass struct Logger { @JSFunction func log(_ message: String) throws(JSException) -> Void - @JSFunction func error(_ message: String, _ error: JSObject) throws(JSException) -> Void + @JSFunction func error(_ message: String, _ error: JSValue) throws(JSException) -> Void @JSGetter var level: String } @JSFunction func getConfigManager() throws(JSException) -> ConfigManager @JSClass struct ConfigManager { - @JSFunction func get(_ key: String) throws(JSException) -> JSObject - @JSFunction func set(_ key: String, _ value: JSObject) throws(JSException) -> Void + @JSFunction func get(_ key: String) throws(JSException) -> JSValue + @JSFunction func set(_ key: String, _ value: JSValue) throws(JSException) -> Void @JSGetter var configPath: String } " `; +exports[`ts2swift > snapshots Swift output for ObjectLikeTypes.d.ts > ObjectLikeTypes 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func acceptObject(_ v: JSObject) throws(JSException) -> Void +" +`; + exports[`ts2swift > snapshots Swift output for OptionalNullUndefined.d.ts > OptionalNullUndefined 1`] = ` "// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. @@ -301,7 +314,7 @@ exports[`ts2swift > snapshots Swift output for TS2SkeletonLike.d.ts > TS2Skeleto @JSFunction func createCodeGenerator(_ format: String) throws(JSException) -> CodeGenerator @JSClass struct CodeGenerator { - @JSFunction func generate(_ input: JSObject) throws(JSException) -> String + @JSFunction func generate(_ input: JSValue) throws(JSException) -> String @JSGetter var outputFormat: String } " diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ObjectLikeTypes.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ObjectLikeTypes.d.ts new file mode 100644 index 000000000..d605048cd --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ObjectLikeTypes.d.ts @@ -0,0 +1 @@ +export function acceptObject(v: object): void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSValue.swift new file mode 100644 index 000000000..84251f6b3 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSValue.swift @@ -0,0 +1,32 @@ +@JS func roundTripJSValue(_ value: JSValue) -> JSValue { + return value +} + +@JS func roundTripOptionalJSValue(_ value: JSValue?) -> JSValue? { + return value +} + +@JS class JSValueHolder { + @JS var value: JSValue + @JS var optionalValue: JSValue? + + @JS init(value: JSValue, optionalValue: JSValue?) { + self.value = value + self.optionalValue = optionalValue + } + + @JS func update(value: JSValue, optionalValue: JSValue?) { + self.value = value + self.optionalValue = optionalValue + } + + @JS func echo(value: JSValue) -> JSValue { + return value + } + + @JS func echoOptional(_ value: JSValue?) -> JSValue? { + return value + } +} + +@JSFunction func jsEchoJSValue(_ value: JSValue) throws(JSException) -> JSValue diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.json new file mode 100644 index 000000000..d10d673d4 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.json @@ -0,0 +1,273 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_JSValueHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "jsValue" : { + + } + } + }, + { + "label" : "optionalValue", + "name" : "optionalValue", + "type" : { + "nullable" : { + "_0" : { + "jsValue" : { + + } + }, + "_1" : "null" + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_JSValueHolder_update", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "update", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "jsValue" : { + + } + } + }, + { + "label" : "optionalValue", + "name" : "optionalValue", + "type" : { + "nullable" : { + "_0" : { + "jsValue" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_JSValueHolder_echo", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "echo", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "jsValue" : { + + } + } + } + ], + "returnType" : { + "jsValue" : { + + } + } + }, + { + "abiName" : "bjs_JSValueHolder_echoOptional", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "echoOptional", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "jsValue" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "jsValue" : { + + } + }, + "_1" : "null" + } + } + } + ], + "name" : "JSValueHolder", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "jsValue" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalValue", + "type" : { + "nullable" : { + "_0" : { + "jsValue" : { + + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "JSValueHolder" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_roundTripJSValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripJSValue", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "jsValue" : { + + } + } + } + ], + "returnType" : { + "jsValue" : { + + } + } + }, + { + "abiName" : "bjs_roundTripOptionalJSValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalJSValue", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "jsValue" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "jsValue" : { + + } + }, + "_1" : "null" + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "jsEchoJSValue", + "parameters" : [ + { + "name" : "value", + "type" : { + "jsValue" : { + + } + } + } + ], + "returnType" : { + "jsValue" : { + + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift new file mode 100644 index 000000000..3a3be5079 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift @@ -0,0 +1,149 @@ +@_expose(wasm, "bjs_roundTripJSValue") +@_cdecl("bjs_roundTripJSValue") +public func _bjs_roundTripJSValue(_ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64) -> Void { + #if arch(wasm32) + let ret = roundTripJSValue(_: JSValue.bridgeJSLiftParameter(valueKind, valuePayload1, valuePayload2)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalJSValue") +@_cdecl("bjs_roundTripOptionalJSValue") +public func _bjs_roundTripOptionalJSValue(_ valueIsSome: Int32, _ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalJSValue(_: Optional.bridgeJSLiftParameter(valueIsSome, valueKind, valuePayload1, valuePayload2)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_JSValueHolder_init") +@_cdecl("bjs_JSValueHolder_init") +public func _bjs_JSValueHolder_init(_ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64, _ optionalValueIsSome: Int32, _ optionalValueKind: Int32, _ optionalValuePayload1: Int32, _ optionalValuePayload2: Float64) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = JSValueHolder(value: JSValue.bridgeJSLiftParameter(valueKind, valuePayload1, valuePayload2), optionalValue: Optional.bridgeJSLiftParameter(optionalValueIsSome, optionalValueKind, optionalValuePayload1, optionalValuePayload2)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_JSValueHolder_update") +@_cdecl("bjs_JSValueHolder_update") +public func _bjs_JSValueHolder_update(_ _self: UnsafeMutableRawPointer, _ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64, _ optionalValueIsSome: Int32, _ optionalValueKind: Int32, _ optionalValuePayload1: Int32, _ optionalValuePayload2: Float64) -> Void { + #if arch(wasm32) + JSValueHolder.bridgeJSLiftParameter(_self).update(value: JSValue.bridgeJSLiftParameter(valueKind, valuePayload1, valuePayload2), optionalValue: Optional.bridgeJSLiftParameter(optionalValueIsSome, optionalValueKind, optionalValuePayload1, optionalValuePayload2)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_JSValueHolder_echo") +@_cdecl("bjs_JSValueHolder_echo") +public func _bjs_JSValueHolder_echo(_ _self: UnsafeMutableRawPointer, _ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64) -> Void { + #if arch(wasm32) + let ret = JSValueHolder.bridgeJSLiftParameter(_self).echo(value: JSValue.bridgeJSLiftParameter(valueKind, valuePayload1, valuePayload2)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_JSValueHolder_echoOptional") +@_cdecl("bjs_JSValueHolder_echoOptional") +public func _bjs_JSValueHolder_echoOptional(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64) -> Void { + #if arch(wasm32) + let ret = JSValueHolder.bridgeJSLiftParameter(_self).echoOptional(_: Optional.bridgeJSLiftParameter(valueIsSome, valueKind, valuePayload1, valuePayload2)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_JSValueHolder_value_get") +@_cdecl("bjs_JSValueHolder_value_get") +public func _bjs_JSValueHolder_value_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = JSValueHolder.bridgeJSLiftParameter(_self).value + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_JSValueHolder_value_set") +@_cdecl("bjs_JSValueHolder_value_set") +public func _bjs_JSValueHolder_value_set(_ _self: UnsafeMutableRawPointer, _ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64) -> Void { + #if arch(wasm32) + JSValueHolder.bridgeJSLiftParameter(_self).value = JSValue.bridgeJSLiftParameter(valueKind, valuePayload1, valuePayload2) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_JSValueHolder_optionalValue_get") +@_cdecl("bjs_JSValueHolder_optionalValue_get") +public func _bjs_JSValueHolder_optionalValue_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = JSValueHolder.bridgeJSLiftParameter(_self).optionalValue + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_JSValueHolder_optionalValue_set") +@_cdecl("bjs_JSValueHolder_optionalValue_set") +public func _bjs_JSValueHolder_optionalValue_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64) -> Void { + #if arch(wasm32) + JSValueHolder.bridgeJSLiftParameter(_self).optionalValue = Optional.bridgeJSLiftParameter(valueIsSome, valueKind, valuePayload1, valuePayload2) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_JSValueHolder_deinit") +@_cdecl("bjs_JSValueHolder_deinit") +public func _bjs_JSValueHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension JSValueHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_JSValueHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_JSValueHolder_wrap") +fileprivate func _bjs_JSValueHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_JSValueHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_jsEchoJSValue") +fileprivate func bjs_jsEchoJSValue(_ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64) -> Void +#else +fileprivate func bjs_jsEchoJSValue(_ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsEchoJSValue(_ value: JSValue) throws(JSException) -> JSValue { + let (valueKind, valuePayload1, valuePayload2) = value.bridgeJSLowerParameter() + bjs_jsEchoJSValue(valueKind, valuePayload1, valuePayload2) + if let error = _swift_js_take_exception() { + throw error + } + return JSValue.bridgeJSLiftReturn() +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts new file mode 100644 index 000000000..9e2a85ac7 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts @@ -0,0 +1,37 @@ +// 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 JSValueHolder extends SwiftHeapObject { + update(value: any, optionalValue: any | null): void; + echo(value: any): any; + echoOptional(value: any | null): any | null; + value: any; + optionalValue: any | null; +} +export type Exports = { + JSValueHolder: { + new(value: any, optionalValue: any | null): JSValueHolder; + } + roundTripJSValue(value: any): any; + roundTripOptionalJSValue(value: any | null): any | null; +} +export type Imports = { + jsEchoJSValue(value: any): any; +} +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/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js new file mode 100644 index 000000000..f272b0ff0 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -0,0 +1,456 @@ +// 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; + 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 tmpRetTag; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + let tmpStructCleanups = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + function __bjs_jsValueLower(value) { + let kind; + let payload1; + let payload2; + if (value === null) { + kind = 4; + payload1 = 0; + payload2 = 0; + } else { + switch (typeof value) { + case "boolean": + kind = 0; + payload1 = value ? 1 : 0; + payload2 = 0; + break; + case "number": + kind = 2; + payload1 = 0; + payload2 = value; + break; + case "string": + kind = 1; + payload1 = swift.memory.retain(value); + payload2 = 0; + break; + case "undefined": + kind = 5; + payload1 = 0; + payload2 = 0; + break; + case "object": + kind = 3; + payload1 = swift.memory.retain(value); + payload2 = 0; + break; + case "function": + kind = 3; + payload1 = swift.memory.retain(value); + payload2 = 0; + break; + case "symbol": + kind = 7; + payload1 = swift.memory.retain(value); + payload2 = 0; + break; + case "bigint": + kind = 8; + payload1 = swift.memory.retain(value); + payload2 = 0; + break; + default: + throw new TypeError("Unsupported JSValue type"); + } + } + return [kind, payload1, payload2]; + } + function __bjs_jsValueLift(kind, payload1, payload2) { + let jsValue; + switch (kind) { + case 0: + jsValue = payload1 !== 0; + break; + case 1: + jsValue = swift.memory.getObject(payload1); + break; + case 2: + jsValue = payload2; + break; + case 3: + jsValue = swift.memory.getObject(payload1); + break; + case 4: + jsValue = null; + break; + case 5: + jsValue = undefined; + break; + case 7: + jsValue = swift.memory.getObject(payload1); + break; + case 8: + jsValue = swift.memory.getObject(payload1); + break; + default: + throw new TypeError("Unsupported JSValue kind " + kind); + } + return jsValue; + } + + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag = tag; + } + bjs["swift_js_push_i32"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_i32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_pointer"] = function() { + return tmpParamPointers.pop(); + } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_JSValueHolder_wrap"] = function(pointer) { + const obj = JSValueHolder.__construct(pointer); + return swift.memory.retain(obj); + }; + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_jsEchoJSValue"] = function bjs_jsEchoJSValue(valueKind, valuePayload1, valuePayload2) { + try { + const jsValue = __bjs_jsValueLift(valueKind, valuePayload1, valuePayload2); + let ret = imports.jsEchoJSValue(jsValue); + const [retKind, retPayload1, retPayload2] = __bjs_jsValueLower(ret); + tmpParamInts.push(retKind); + tmpParamInts.push(retPayload1); + tmpParamF64s.push(retPayload2); + } catch (error) { + setException(error); + } + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class JSValueHolder extends SwiftHeapObject { + static __construct(ptr) { + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_JSValueHolder_deinit, JSValueHolder.prototype); + } + + constructor(value, optionalValue) { + const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); + const isSome = optionalValue != null; + const [optionalValueKind, optionalValuePayload1, optionalValuePayload2] = __bjs_jsValueLower(optionalValue); + const ret = instance.exports.bjs_JSValueHolder_init(valueKind, valuePayload1, valuePayload2, +isSome, optionalValueKind, optionalValuePayload1, optionalValuePayload2); + return JSValueHolder.__construct(ret); + } + update(value, optionalValue) { + const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); + const isSome = optionalValue != null; + const [optionalValueKind, optionalValuePayload1, optionalValuePayload2] = __bjs_jsValueLower(optionalValue); + instance.exports.bjs_JSValueHolder_update(this.pointer, valueKind, valuePayload1, valuePayload2, +isSome, optionalValueKind, optionalValuePayload1, optionalValuePayload2); + } + echo(value) { + const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); + instance.exports.bjs_JSValueHolder_echo(this.pointer, valueKind, valuePayload1, valuePayload2); + const jsValuePayload2 = tmpRetF64s.pop(); + const jsValuePayload1 = tmpRetInts.pop(); + const jsValueKind = tmpRetInts.pop(); + const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); + return jsValue; + } + echoOptional(value) { + const isSome = value != null; + const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); + instance.exports.bjs_JSValueHolder_echoOptional(this.pointer, +isSome, valueKind, valuePayload1, valuePayload2); + const isSome1 = tmpRetInts.pop(); + let optResult; + if (isSome1) { + const jsValuePayload2 = tmpRetF64s.pop(); + const jsValuePayload1 = tmpRetInts.pop(); + const jsValueKind = tmpRetInts.pop(); + const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); + optResult = jsValue; + } else { + optResult = null; + } + return optResult; + } + get value() { + instance.exports.bjs_JSValueHolder_value_get(this.pointer); + const jsValuePayload2 = tmpRetF64s.pop(); + const jsValuePayload1 = tmpRetInts.pop(); + const jsValueKind = tmpRetInts.pop(); + const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); + return jsValue; + } + set value(value) { + const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); + instance.exports.bjs_JSValueHolder_value_set(this.pointer, valueKind, valuePayload1, valuePayload2); + } + get optionalValue() { + instance.exports.bjs_JSValueHolder_optionalValue_get(this.pointer); + const isSome = tmpRetInts.pop(); + let optResult; + if (isSome) { + const jsValuePayload2 = tmpRetF64s.pop(); + const jsValuePayload1 = tmpRetInts.pop(); + const jsValueKind = tmpRetInts.pop(); + const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); + optResult = jsValue; + } else { + optResult = null; + } + return optResult; + } + set optionalValue(value) { + const isSome = value != null; + const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); + instance.exports.bjs_JSValueHolder_optionalValue_set(this.pointer, +isSome, valueKind, valuePayload1, valuePayload2); + } + } + const exports = { + JSValueHolder, + roundTripJSValue: function bjs_roundTripJSValue(value) { + const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); + instance.exports.bjs_roundTripJSValue(valueKind, valuePayload1, valuePayload2); + const jsValuePayload2 = tmpRetF64s.pop(); + const jsValuePayload1 = tmpRetInts.pop(); + const jsValueKind = tmpRetInts.pop(); + const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); + return jsValue; + }, + roundTripOptionalJSValue: function bjs_roundTripOptionalJSValue(value) { + const isSome = value != null; + const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); + instance.exports.bjs_roundTripOptionalJSValue(+isSome, valueKind, valuePayload1, valuePayload2); + const isSome1 = tmpRetInts.pop(); + let optResult; + if (isSome1) { + const jsValuePayload2 = tmpRetF64s.pop(); + const jsValuePayload1 = tmpRetInts.pop(); + const jsValueKind = tmpRetInts.pop(); + const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); + optResult = jsValue; + } else { + optResult = null; + } + return optResult; + }, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index e337124ee..e385a3c60 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -349,6 +349,92 @@ extension JSObject: _BridgedSwiftStackType { } } +extension JSValue: _BridgedSwiftStackType { + public typealias StackLiftResult = JSValue + + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (kind: Int32, payload1: Int32, payload2: Double) { + return withRawJSValue { raw in + ( + kind: Int32(raw.kind.rawValue), + payload1: Int32(bitPattern: raw.payload1), + payload2: raw.payload2 + ) + } + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturn( + _ kind: Int32, + _ payload1: Int32, + _ payload2: Double + ) -> JSValue { + return bridgeJSLiftParameter(kind, payload1, payload2) + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter( + _ kind: Int32, + _ payload1: Int32, + _ payload2: Double + ) -> JSValue { + let retainedPayload1: Int32 + if let kindEnum = JavaScriptValueKind(rawValue: UInt32(kind)) { + switch kindEnum { + case .string, .object, .symbol, .bigInt: + retainedPayload1 = _swift_js_retain(payload1) + default: + retainedPayload1 = payload1 + } + } else { + retainedPayload1 = payload1 + } + + guard let kindEnum = JavaScriptValueKind(rawValue: UInt32(kind)) else { + fatalError("Invalid JSValue kind: \(kind)") + } + let rawValue = RawJSValue( + kind: kindEnum, + payload1: JavaScriptPayload1(UInt32(bitPattern: retainedPayload1)), + payload2: payload2 + ) + return rawValue.jsValue + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> JSValue { + let payload2 = _swift_js_pop_f64() + let payload1 = _swift_js_pop_i32() + let kind = _swift_js_pop_i32() + return bridgeJSLiftParameter(kind, payload1, payload2) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> JSValue { + let payload2 = _swift_js_pop_f64() + let payload1 = _swift_js_pop_i32() + let kind = _swift_js_pop_i32() + return bridgeJSLiftParameter(kind, payload1, payload2) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + let lowered = bridgeJSLowerParameter() + let retainedPayload1: Int32 + if let kind = JavaScriptValueKind(rawValue: UInt32(lowered.kind)) { + switch kind { + case .string, .object, .symbol, .bigInt: + retainedPayload1 = _swift_js_retain(lowered.payload1) + default: + retainedPayload1 = lowered.payload1 + } + } else { + retainedPayload1 = lowered.payload1 + } + _swift_js_push_i32(lowered.kind) + _swift_js_push_i32(retainedPayload1) + _swift_js_push_f64(lowered.payload2) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + bridgeJSLowerReturn() + } +} + /// A protocol that Swift heap objects exposed to JavaScript via `@JS class` must conform to. /// /// The conformance is automatically synthesized by the BridgeJS code generator. @@ -1253,6 +1339,61 @@ extension Optional where Wrapped == JSObject { } } +extension Optional where Wrapped == JSValue { + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( + isSome: Int32, kind: Int32, payload1: Int32, payload2: Double + ) { + switch consume self { + case .none: + return (isSome: 0, kind: 0, payload1: 0, payload2: 0) + case .some(let wrapped): + let lowered = wrapped.bridgeJSLowerParameter() + return ( + isSome: 1, + kind: lowered.kind, + payload1: lowered.payload1, + payload2: lowered.payload2 + ) + } + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter( + _ isSome: Int32, + _ kind: Int32, + _ payload1: Int32, + _ payload2: Double + ) -> JSValue? { + if isSome == 0 { + return nil + } else { + return JSValue.bridgeJSLiftParameter(kind, payload1, payload2) + } + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> JSValue? { + let isSome = _swift_js_pop_i32() + if isSome == 0 { + return nil + } + let payload2 = _swift_js_pop_f64() + let payload1 = _swift_js_pop_i32() + let kind = _swift_js_pop_i32() + return JSValue.bridgeJSLiftParameter(kind, payload1, payload2) + } + + @_spi(BridgeJS) public func bridgeJSLowerReturn() -> Void { + switch self { + case .none: + _swift_js_push_i32(0) + case .some(let value): + value.bridgeJSLowerReturn() + _swift_js_push_i32(1) + } + } +} + extension Optional where Wrapped: _BridgedSwiftProtocolWrapper { // MARK: ExportSwift diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 007f0b265..345f5dbcf 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -52,6 +52,14 @@ func runJsWorks() -> Void return v } +@JS func roundTripJSValue(v: JSValue) -> JSValue { + return v +} + +@JS func roundTripOptionalJSValue(v: JSValue?) -> JSValue? { + return v +} + @JSClass struct Foo { @JSGetter var value: String @JSFunction init(_ value: String) throws(JSException) diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index eaddcea1c..358f0501d 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -18,6 +18,8 @@ @JSFunction func jsRoundTripOptionalNumberUndefined(_ v: JSUndefinedOr) throws(JSException) -> JSUndefinedOr +@JSFunction func jsRoundTripJSValue(_ v: JSValue) throws(JSException) -> JSValue + @JSFunction func jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void @JSFunction func jsThrowOrNumber(_ shouldThrow: Bool) throws(JSException) -> Double @@ -75,4 +77,4 @@ extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} @JSFunction func getIsCat() throws(JSException) -> Bool } -@JSGetter(from: .global) var globalObject1: JSObject +@JSGetter(from: .global) var globalObject1: JSValue diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index c8f428934..ee9f97508 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -3420,6 +3420,28 @@ public func _bjs_roundTripJSObject(_ v: Int32) -> Int32 { #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_makeImportedFoo") @_cdecl("bjs_makeImportedFoo") public func _bjs_makeImportedFoo(_ valueBytes: Int32, _ valueLength: Int32) -> Int32 { @@ -7929,19 +7951,19 @@ func _$Foo_value_get(_ self: JSObject) throws(JSException) -> String { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_globalObject1_get") -fileprivate func bjs_globalObject1_get() -> Int32 +fileprivate func bjs_globalObject1_get() -> Void #else -fileprivate func bjs_globalObject1_get() -> Int32 { +fileprivate func bjs_globalObject1_get() -> Void { fatalError("Only available on WebAssembly") } #endif -func _$globalObject1_get() throws(JSException) -> JSObject { - let ret = bjs_globalObject1_get() +func _$globalObject1_get() throws(JSException) -> JSValue { + bjs_globalObject1_get() if let error = _swift_js_take_exception() { throw error } - return JSObject.bridgeJSLiftReturn(ret) + return JSValue.bridgeJSLiftReturn() } #if arch(wasm32) @@ -8050,6 +8072,24 @@ func _$jsRoundTripOptionalNumberUndefined(_ v: JSUndefinedOr) throws(JSE return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripJSValue") +fileprivate func bjs_jsRoundTripJSValue(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void +#else +fileprivate func bjs_jsRoundTripJSValue(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +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(_ shouldThrow: Int32) -> Void diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 0cb32079a..e2877ee76 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -5275,6 +5275,66 @@ } } }, + { + "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_makeImportedFoo", "effects" : { @@ -12174,6 +12234,24 @@ } } }, + { + "name" : "jsRoundTripJSValue", + "parameters" : [ + { + "name" : "v", + "type" : { + "jsValue" : { + + } + } + } + ], + "returnType" : { + "jsValue" : { + + } + } + }, { "name" : "jsThrowOrVoid", "parameters" : [ @@ -12314,7 +12392,7 @@ "from" : "global", "name" : "globalObject1", "type" : { - "jsObject" : { + "jsValue" : { } } diff --git a/Tests/BridgeJSRuntimeTests/GlobalThisImportTests.swift b/Tests/BridgeJSRuntimeTests/GlobalThisImportTests.swift index 2f6251341..fdd22401d 100644 --- a/Tests/BridgeJSRuntimeTests/GlobalThisImportTests.swift +++ b/Tests/BridgeJSRuntimeTests/GlobalThisImportTests.swift @@ -13,7 +13,11 @@ final class GlobalThisImportTests: XCTestCase { } func testGlobalGetterImport() throws { - let value = try globalObject1["prop_2"].number + guard let object = try globalObject1.object else { + XCTFail("globalObject1 was not an object") + return + } + let value = object[dynamicMember: "prop_2"].number XCTAssertEqual(value, 2) } } diff --git a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift index c4ab0c2e0..460297133 100644 --- a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift @@ -55,6 +55,24 @@ class ImportAPITests: XCTestCase { } } + func testRoundTripJSValue() throws { + let symbol = JSSymbol("roundTrip") + let bigInt = JSBigInt(_slowBridge: Int64(123456789)) + let values: [JSValue] = [ + .boolean(true), + .number(42), + .string(JSString("hello")), + .object(JSObject.global), + .null, + .undefined, + .symbol(symbol), + .bigInt(bigInt), + ] + for value in values { + try XCTAssertEqual(jsRoundTripJSValue(value), value) + } + } + func testRoundTripFeatureFlag() throws { for v in [FeatureFlag.foo, .bar] { try XCTAssertEqual(jsRoundTripFeatureFlag(v), v) diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts index 42bca7401..03ecb5b39 100644 --- a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts +++ b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts @@ -4,6 +4,8 @@ export function jsRoundTripBool(v: boolean): boolean export function jsRoundTripString(v: string): string export function jsRoundTripOptionalNumberNull(v: number | null): number | null export function jsRoundTripOptionalNumberUndefined(v: number | undefined): number | undefined +export type JSValue = any +export function jsRoundTripJSValue(v: JSValue): JSValue export function jsThrowOrVoid(shouldThrow: boolean): void export function jsThrowOrNumber(shouldThrow: boolean): number export function jsThrowOrBool(shouldThrow: boolean): boolean diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index dc904579d..6a8dd58a2 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -52,6 +52,9 @@ export async function setupOptions(options, context) { "jsRoundTripOptionalNumberUndefined": (v) => { return v === undefined ? undefined : v; }, + "jsRoundTripJSValue": (v) => { + return v; + }, "jsThrowOrVoid": (shouldThrow) => { if (shouldThrow) { throw new Error("TestError"); @@ -78,6 +81,9 @@ export async function setupOptions(options, context) { "jsRoundTripFeatureFlag": (flag) => { return flag; }, + "jsEchoJSValue": (v) => { + return v; + }, "$jsWeirdFunction": () => { return 42; }, @@ -464,6 +470,20 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { const anyObject = {}; assert.equal(exports.roundTripJSObject(anyObject), anyObject); + const symbolValue = Symbol("roundTrip"); + const bigIntValue = 12345678901234567890n; + const objectValue = { nested: true }; + const jsValues = [true, 42, "hello", objectValue, null, undefined, symbolValue, bigIntValue]; + for (const value of jsValues) { + const result = exports.roundTripJSValue(value); + assert.strictEqual(result, value); + } + + assert.strictEqual(exports.roundTripOptionalJSValue(null), null); + assert.strictEqual(exports.roundTripOptionalJSValue(undefined), null); + assert.strictEqual(exports.roundTripOptionalJSValue(objectValue), objectValue); + assert.strictEqual(exports.roundTripOptionalJSValue(symbolValue), symbolValue); + try { exports.throwsSwiftError(true); assert.fail("Expected error"); From dcc148fd307c7619fa9857b50e0bdfba1487a517 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 27 Jan 2026 21:09:33 +0700 Subject: [PATCH 151/252] BridgeJS: Support all missing types as associated values in exported enums --- Benchmarks/Sources/Generated/BridgeJS.swift | 22 +- .../Sources/BridgeJSCore/ExportSwift.swift | 4 +- .../BridgeJSCore/SwiftToSkeleton.swift | 10 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 29 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 770 ++++----- .../MacroSwift/EnumAssociatedValue.swift | 63 + .../EnumAssociatedValue.json | 557 +++++++ .../EnumAssociatedValue.swift | 506 +++++- .../BridgeJSCodegenTests/Protocol.swift | 4 +- .../StaticFunctions.Global.swift | 4 +- .../StaticFunctions.swift | 4 +- .../BridgeJSCodegenTests/SwiftClosure.swift | 10 +- .../BridgeJSLinkTests/ArrayTypes.js | 24 +- .../__Snapshots__/BridgeJSLinkTests/Async.js | 4 +- .../BridgeJSLinkTests/DefaultParameters.js | 4 +- .../EnumAssociatedValue.d.ts | 91 ++ .../BridgeJSLinkTests/EnumAssociatedValue.js | 1446 +++++++++++------ .../BridgeJSLinkTests/EnumCase.js | 4 +- .../BridgeJSLinkTests/EnumNamespace.Global.js | 4 +- .../BridgeJSLinkTests/EnumNamespace.js | 4 +- .../BridgeJSLinkTests/EnumRawType.js | 4 +- .../BridgeJSLinkTests/GlobalGetter.js | 4 +- .../BridgeJSLinkTests/GlobalThisImports.js | 4 +- .../ImportedTypeInExportedInterface.js | 4 +- .../BridgeJSLinkTests/InvalidPropertyNames.js | 4 +- .../BridgeJSLinkTests/JSClass.js | 4 +- .../JSClassStaticFunctions.js | 4 +- .../BridgeJSLinkTests/JSValue.js | 4 +- .../BridgeJSLinkTests/MixedGlobal.js | 4 +- .../BridgeJSLinkTests/MixedModules.js | 4 +- .../BridgeJSLinkTests/MixedPrivate.js | 4 +- .../BridgeJSLinkTests/Namespaces.Global.js | 4 +- .../BridgeJSLinkTests/Namespaces.js | 4 +- .../BridgeJSLinkTests/Optionals.js | 4 +- .../BridgeJSLinkTests/PrimitiveParameters.js | 4 +- .../BridgeJSLinkTests/PrimitiveReturn.js | 4 +- .../BridgeJSLinkTests/PropertyTypes.js | 4 +- .../BridgeJSLinkTests/Protocol.js | 95 +- .../StaticFunctions.Global.js | 91 +- .../BridgeJSLinkTests/StaticFunctions.js | 91 +- .../StaticProperties.Global.js | 4 +- .../BridgeJSLinkTests/StaticProperties.js | 4 +- .../BridgeJSLinkTests/StringParameter.js | 4 +- .../BridgeJSLinkTests/StringReturn.js | 4 +- .../BridgeJSLinkTests/SwiftClass.js | 4 +- .../BridgeJSLinkTests/SwiftClosure.js | 157 +- .../BridgeJSLinkTests/SwiftClosureImports.js | 4 +- .../BridgeJSLinkTests/SwiftStruct.js | 16 +- .../BridgeJSLinkTests/SwiftStructImports.js | 4 +- .../__Snapshots__/BridgeJSLinkTests/Throws.js | 4 +- .../BridgeJSLinkTests/UnsafePointer.js | 4 +- .../VoidParameterVoidReturn.js | 4 +- .../Exporting-Swift/Exporting-Swift-Enum.md | 9 +- .../BridgeJSRuntimeTests/ExportAPITests.swift | 54 + .../Generated/BridgeJS.swift | 416 ++++- .../Generated/JavaScript/BridgeJS.json | 482 ++++++ Tests/prelude.mjs | 125 +- 57 files changed, 3911 insertions(+), 1297 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 1a413268d..5a480694c 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -64,20 +64,20 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .failure(let param0): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) case .flag(let param0): - _swift_js_push_tag(Int32(2)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(2)) case .rate(let param0): - _swift_js_push_tag(Int32(3)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(3)) case .precise(let param0): - _swift_js_push_tag(Int32(4)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(4)) case .info: _swift_js_push_tag(Int32(5)) } @@ -161,29 +161,28 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .error(let param0, let param1): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) case .location(let param0, let param1, let param2): - _swift_js_push_tag(Int32(2)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(2)) case .status(let param0, let param1, let param2): - _swift_js_push_tag(Int32(3)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(3)) case .coordinates(let param0, let param1, let param2): - _swift_js_push_tag(Int32(4)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(4)) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - _swift_js_push_tag(Int32(5)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() @@ -193,6 +192,7 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { param6.bridgeJSLowerStackReturn() param7.bridgeJSLowerStackReturn() param8.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(5)) case .info: _swift_js_push_tag(Int32(6)) } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 1137343b0..51ff91695 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1221,9 +1221,11 @@ struct EnumCodegen { .map { index, associatedValue in "let \(associatedValue.label ?? "param\(index)")" } .joined(separator: ", ") cases.append("case .\(enumCase.name)(\(pattern)):") - cases.append("_swift_js_push_tag(Int32(\(caseIndex)))") let payloadCode = generatePayloadPushingCode(associatedValues: enumCase.associatedValues) cases.append(contentsOf: payloadCode) + // Push tag AFTER payloads so it's popped first (LIFO) by the JS lift function. + // This ensures nested enum tags don't overwrite the outer tag. + cases.append("_swift_js_push_tag(Int32(\(caseIndex)))") } } return cases diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index d32d85f55..39e3090cd 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -1428,18 +1428,20 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { for enumCase in exportedEnum.cases { for associatedValue in enumCase.associatedValues { switch associatedValue.type { - case .string, .int, .float, .double, .bool: + case .string, .int, .float, .double, .bool, .caseEnum, .rawValueEnum, + .swiftStruct, .swiftHeapObject, .jsObject, .associatedValueEnum, .array: break case .nullable(let wrappedType, _): switch wrappedType { - case .string, .int, .float, .double, .bool: + case .string, .int, .float, .double, .bool, .caseEnum, .rawValueEnum, + .swiftStruct, .swiftHeapObject, .jsObject, .associatedValueEnum, .array: break default: diagnose( node: node, message: "Unsupported associated value type: \(associatedValue.type.swiftType)", hint: - "Only primitive types and optional primitives (String?, Int?, Float?, Double?, Bool?) are supported in associated-value enums" + "Only primitive types, enums, structs, classes, JSObject, arrays, and their optionals are supported in associated-value enums" ) } default: @@ -1447,7 +1449,7 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { node: node, message: "Unsupported associated value type: \(associatedValue.type.swiftType)", hint: - "Only primitive types and optional primitives (String?, Int?, Float?, Double?, Bool?) are supported in associated-value enums" + "Only primitive types, enums, structs, classes, JSObject, arrays, and their optionals are supported in associated-value enums" ) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 4695f3283..27ef60760 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -246,7 +246,7 @@ public struct BridgeJSLink { "let \(JSGlueVariableScope.reservedStorageToReturnOptionalFloat);", "let \(JSGlueVariableScope.reservedStorageToReturnOptionalDouble);", "let \(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject);", - "let \(JSGlueVariableScope.reservedTmpRetTag);", + "let \(JSGlueVariableScope.reservedTmpRetTag) = [];", "let \(JSGlueVariableScope.reservedTmpRetStrings) = [];", "let \(JSGlueVariableScope.reservedTmpRetInts) = [];", "let \(JSGlueVariableScope.reservedTmpRetF32s) = [];", @@ -388,7 +388,7 @@ public struct BridgeJSLink { printer.write("}") printer.write("bjs[\"swift_js_push_tag\"] = function(tag) {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpRetTag) = tag;") + printer.write("\(JSGlueVariableScope.reservedTmpRetTag).push(tag);") } printer.write("}") printer.write("bjs[\"swift_js_push_i32\"] = function(v) {") @@ -1059,6 +1059,18 @@ public struct BridgeJSLink { _ = fragment.printCode([structDef.name], structScope, structPrinter, structCleanup) bodyPrinter.write(lines: structPrinter.lines) } + + let allAssocEnums = exportedSkeletons.flatMap { + $0.enums.filter { $0.enumType == .associatedValue } + } + for enumDef in allAssocEnums { + let enumPrinter = CodeFragmentPrinter() + let enumScope = JSGlueVariableScope() + let enumCleanup = CodeFragmentPrinter() + let fragment = IntrinsicJSFragment.associatedValueEnumHelperFactory(enumDefinition: enumDef) + _ = fragment.printCode([enumDef.valuesName], enumScope, enumPrinter, enumCleanup) + bodyPrinter.write(lines: enumPrinter.lines) + } bodyPrinter.nextLine() bodyPrinter.write(contentsOf: generateAddImports(needsImportsObject: data.needsImportsObject)) @@ -1094,8 +1106,6 @@ public struct BridgeJSLink { "\(JSGlueVariableScope.reservedMemory) = \(JSGlueVariableScope.reservedInstance).exports.memory;", ]) printer.nextLine() - // Enum helpers section - printer.write(contentsOf: enumHelperAssignments()) // Error handling printer.write("\(JSGlueVariableScope.reservedSetException) = (error) => {") printer.indent { @@ -1109,18 +1119,19 @@ public struct BridgeJSLink { } // createExports method - try printer.indent { + printer.indent { printer.write(lines: [ "/** @param {WebAssembly.Instance} instance */", "createExports: (instance) => {", ]) - try printer.indent { + printer.indent { printer.write("const js = \(JSGlueVariableScope.reservedSwift).memory.heap;") printer.write(lines: data.classLines) - // Struct helpers must be initialized AFTER classes are defined (to allow _exports access) + // Struct and enum helpers must be initialized AFTER classes are defined (to allow _exports access) printer.write(contentsOf: structHelperAssignments()) + printer.write(contentsOf: enumHelperAssignments()) let namespaceInitCode = namespaceBuilder.buildNamespaceInitialization( exportedSkeletons: exportedSkeletons ) @@ -1151,7 +1162,7 @@ public struct BridgeJSLink { for skeleton in skeletons.compactMap(\.exported) { for enumDef in skeleton.enums where enumDef.enumType == .associatedValue { printer.write( - "const \(enumDef.name)Helpers = __bjs_create\(enumDef.valuesName)Helpers()(\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTextEncoder), \(JSGlueVariableScope.reservedSwift));" + "const \(enumDef.name)Helpers = __bjs_create\(enumDef.valuesName)Helpers()(\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTmpParamPointers), \(JSGlueVariableScope.reservedTmpRetPointers), \(JSGlueVariableScope.reservedTextEncoder), \(JSGlueVariableScope.reservedSwift), \(JSGlueVariableScope.reservedStructHelpers), \(JSGlueVariableScope.reservedEnumHelpers));" ) printer.write("\(JSGlueVariableScope.reservedEnumHelpers).\(enumDef.name) = \(enumDef.name)Helpers;") printer.nextLine() @@ -1616,7 +1627,7 @@ public struct BridgeJSLink { _ = fragment.printCode([enumValuesName], scope, printer, cleanup) jsTopLevelLines.append(contentsOf: printer.lines) case .associatedValue: - let fragment = IntrinsicJSFragment.associatedValueEnumHelper(enumDefinition: enumDefinition) + let fragment = IntrinsicJSFragment.associatedValueEnumValues(enumDefinition: enumDefinition) _ = fragment.printCode([enumValuesName], scope, printer, cleanup) jsTopLevelLines.append(contentsOf: printer.lines) case .namespace: diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index ef72cf6f6..1547d63a4 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -571,7 +571,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { _, scope, printer, _ in let retName = scope.variable("ret") printer.write( - "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lift(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lift(\(JSGlueVariableScope.reservedTmpRetTag).pop(), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) return [retName] } @@ -652,7 +652,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSome)) {") printer.indent { printer.write( - "\(enumVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(wrappedValue), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "\(enumVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(wrappedValue), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) } printer.write("}") @@ -678,7 +678,6 @@ struct IntrinsicJSFragment: Sendable { printer.write("let \(arrayVar);") printer.write("if (\(isSome)) {") printer.indent { - // Lift array from stacks - reuse array lift return logic let arrayLiftFragment = try! arrayLift(elementType: elementType) let liftResults = arrayLiftFragment.printCode([], scope, printer, cleanupCode) if let liftResult = liftResults.first { @@ -886,8 +885,10 @@ struct IntrinsicJSFragment: Sendable { } case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName + let tagVar = scope.variable("tag") + printer.write("const \(tagVar) = \(JSGlueVariableScope.reservedTmpRetTag).pop();") let isNullVar = scope.variable("isNull") - printer.write("const \(isNullVar) = (\(JSGlueVariableScope.reservedTmpRetTag) === -1);") + printer.write("const \(isNullVar) = (\(tagVar) === -1);") printer.write("let \(resultVar);") printer.write("if (\(isNullVar)) {") printer.indent { @@ -896,7 +897,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("} else {") printer.indent { printer.write( - "\(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "\(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(tagVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) } printer.write("}") @@ -1233,7 +1234,7 @@ struct IntrinsicJSFragment: Sendable { let targetVar = arguments[1] let base = fullName.components(separatedBy: ".").last ?? fullName printer.write( - "let \(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "let \(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) return [] } @@ -1304,7 +1305,7 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName printer.write( - "\(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(value), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "\(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(value), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) default: fatalError("Unsupported optional wrapped type in closure parameter lifting: \(wrappedType)") @@ -1632,7 +1633,7 @@ struct IntrinsicJSFragment: Sendable { let base = fullName.components(separatedBy: ".").last ?? fullName let resultVar = scope.variable("result") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetTag).pop(), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) printer.write("return \(resultVar);") return [] @@ -1857,7 +1858,7 @@ struct IntrinsicJSFragment: Sendable { let caseId = arguments[0] let resultVar = scope.variable("enumValue") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) return [resultVar] } @@ -2001,13 +2002,14 @@ struct IntrinsicJSFragment: Sendable { ) } /// Fragment for generating an entire associated value enum helper - static func associatedValueEnumHelper(enumDefinition: ExportedEnum) -> IntrinsicJSFragment { + /// Generates the enum tag constants (e.g. `const XValues = { Tag: { ... } }`) + /// This is placed at module level for exports/imports. + static func associatedValueEnumValues(enumDefinition: ExportedEnum) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["enumName"], printCode: { arguments, scope, printer, cleanup in let enumName = arguments[0] - // Generate the enum tag object printer.write("const \(enumName) = {") printer.indent { printer.write("Tag: {") @@ -2020,13 +2022,25 @@ struct IntrinsicJSFragment: Sendable { printer.write("},") } printer.write("};") - printer.nextLine() - // Generate the helper function + return [] + } + ) + } + + /// Generates the enum helper factory function (lower/lift closures). + /// This is placed inside `createInstantiator` alongside struct helpers, + /// so it has access to `_exports` for class references. + static func associatedValueEnumHelperFactory(enumDefinition: ExportedEnum) -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: ["enumName"], + printCode: { arguments, scope, printer, cleanup in + let enumName = arguments[0] + printer.write("const __bjs_create\(enumName)Helpers = () => {") printer.indent() printer.write( - "return (\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), textEncoder, \(JSGlueVariableScope.reservedSwift)) => ({" + "return (\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTmpParamPointers), \(JSGlueVariableScope.reservedTmpRetPointers), textEncoder, \(JSGlueVariableScope.reservedSwift), \(JSGlueVariableScope.reservedStructHelpers), \(JSGlueVariableScope.reservedEnumHelpers)) => ({" ) printer.indent() @@ -2058,10 +2072,10 @@ struct IntrinsicJSFragment: Sendable { // Generate lift function printer.write( - "lift: (\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s)) => {" + "lift: (tag, \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers)) => {" ) printer.indent { - printer.write("const tag = tmpRetTag | 0;") + printer.write("tag = tag | 0;") printer.write("switch (tag) {") printer.indent { let liftPrinter = CodeFragmentPrinter() @@ -2228,62 +2242,77 @@ struct IntrinsicJSFragment: Sendable { private static func associatedValuePushPayload(type: BridgeType) -> IntrinsicJSFragment { switch type { - case .string: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - let value = arguments[0] - let bytesVar = scope.variable("bytes") - let idVar = scope.variable("id") - printer.write("const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));") - printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") - cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") - return [] - } - ) - case .bool: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(arguments[0]) ? 1 : 0);") - return [] - } - ) - case .int, .uint: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(arguments[0]) | 0));") - return [] - } - ) - case .float: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(Math.fround(\(arguments[0])));") - return [] - } - ) - case .double: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(arguments[0]));") - return [] - } - ) case .nullable(let wrappedType, let kind): - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - let value = arguments[0] - let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") + return associatedValueOptionalPushPayload(wrappedType: wrappedType, kind: kind) + default: + return try! stackLowerFragment(elementType: type) + } + } - switch wrappedType { + private static func associatedValueOptionalPushPayload( + wrappedType: BridgeType, + kind: JSOptionalKind + ) -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + let value = arguments[0] + let isSomeVar = scope.variable("isSome") + printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") + + switch wrappedType { + case .string: + let idVar = scope.variable("id") + printer.write("let \(idVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let bytesVar = scope.variable("bytes") + printer.write( + "let \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" + ) + printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + } + printer.write("} else {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + cleanup.write("if(\(idVar)) {") + cleanup.indent { + cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") + } + cleanup.write("}") + case .int, .uint: + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) | 0) : 0);" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + case .bool: + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) ? 1 : 0) : 0);" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + case .float: + printer.write( + "\(JSGlueVariableScope.reservedTmpParamF32s).push(\(isSomeVar) ? Math.fround(\(value)) : 0.0);" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + case .double: + printer.write( + "\(JSGlueVariableScope.reservedTmpParamF64s).push(\(isSomeVar) ? \(value) : 0.0);" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + case .caseEnum: + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) | 0) : 0);" + ) + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + case .rawValueEnum(_, let rawType): + switch rawType { case .string: let idVar = scope.variable("id") printer.write("let \(idVar);") @@ -2293,8 +2322,12 @@ struct IntrinsicJSFragment: Sendable { printer.write( "let \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" ) - printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") + printer.write( + "\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" + ) + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);" + ) printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") } printer.write("} else {") @@ -2303,107 +2336,169 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);" + ) cleanup.write("if(\(idVar)) {") cleanup.indent { - cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") + cleanup.write( + "\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));" + ) } cleanup.write("}") - case .int, .uint: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) | 0) : 0);" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") - case .bool: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) ? 1 : 0) : 0);" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") case .float: printer.write( "\(JSGlueVariableScope.reservedTmpParamF32s).push(\(isSomeVar) ? Math.fround(\(value)) : 0.0);" ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);" + ) case .double: printer.write( "\(JSGlueVariableScope.reservedTmpParamF64s).push(\(isSomeVar) ? \(value) : 0.0);" ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);" + ) default: - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) | 0) : 0);" + ) + printer.write( + "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);" + ) } - - return [] - } - ) - default: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - return [] + case .swiftStruct(let structName): + let structBase = structName.components(separatedBy: ".").last ?? structName + let nestedCleanupVar = scope.variable("nestedCleanup") + printer.write("let \(nestedCleanupVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let structResultVar = scope.variable("structResult") + printer.write( + "const \(structResultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lower(\(value));" + ) + printer.write("\(nestedCleanupVar) = \(structResultVar).cleanup;") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + cleanup.write("if (\(nestedCleanupVar)) { \(nestedCleanupVar)(); }") + case .swiftHeapObject: + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(\(value).pointer);") + } + printer.write("} else {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + case .jsObject: + let idVar = scope.variable("id") + printer.write("let \(idVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + } + printer.write("} else {") + printer.indent { + printer.write("\(idVar) = undefined;") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + case .associatedValueEnum(let enumName): + let base = enumName.components(separatedBy: ".").last ?? enumName + let caseIdVar = scope.variable("enumCaseId") + let enumCleanupVar = scope.variable("enumCleanup") + printer.write("let \(caseIdVar), \(enumCleanupVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let enumResultVar = scope.variable("enumResult") + printer.write( + "const \(enumResultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" + ) + printer.write("\(caseIdVar) = \(enumResultVar).caseId;") + printer.write("\(enumCleanupVar) = \(enumResultVar).cleanup;") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(caseIdVar));") + } + printer.write("} else {") + printer.indent { + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + cleanup.write("if (\(enumCleanupVar)) { \(enumCleanupVar)(); }") + case .array(let elementType): + // Array cleanup references variables declared inside the if block, + // so capture cleanup into a variable declared at the outer scope. + let arrCleanupVar = scope.variable("arrCleanup") + printer.write("let \(arrCleanupVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let localCleanup = CodeFragmentPrinter() + let arrFragment = try! arrayLower(elementType: elementType) + _ = arrFragment.printCode([value], scope, printer, localCleanup) + let cleanupLines = localCleanup.lines.filter { + !$0.trimmingCharacters(in: .whitespaces).isEmpty + } + if !cleanupLines.isEmpty { + printer.write("\(arrCleanupVar) = () => {") + printer.indent { + for line in cleanupLines { + printer.write(line) + } + } + printer.write("};") + } + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + cleanup.write("if (\(arrCleanupVar)) { \(arrCleanupVar)(); }") + default: + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") } - ) - } + + return [] + } + ) } private static func associatedValuePopPayload(type: BridgeType) -> IntrinsicJSFragment { switch type { - case .string: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let strVar = scope.variable("string") - printer.write("const \(strVar) = \(JSGlueVariableScope.reservedTmpRetStrings).pop();") - return [strVar] - } - ) - case .bool: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let bVar = scope.variable("bool") - printer.write("const \(bVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") - return [bVar] - } - ) - case .int, .uint: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let iVar = scope.variable("int") - printer.write("const \(iVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") - return [iVar] - } - ) - case .float: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let fVar = scope.variable("f32") - printer.write("const \(fVar) = \(JSGlueVariableScope.reservedTmpRetF32s).pop();") - return [fVar] - } - ) - case .double: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let dVar = scope.variable("f64") - printer.write("const \(dVar) = \(JSGlueVariableScope.reservedTmpRetF64s).pop();") - return [dVar] - } - ) case .nullable(let wrappedType, let kind): - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let optVar = scope.variable("optional") - let isSomeVar = scope.variable("isSome") + return associatedValueOptionalPopPayload(wrappedType: wrappedType, kind: kind) + default: + return try! stackLiftFragment(elementType: type) + } + } - printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") - printer.write("let \(optVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { + private static func associatedValueOptionalPopPayload( + wrappedType: BridgeType, + kind: JSOptionalKind + ) -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let optVar = scope.variable("optional") + let isSomeVar = scope.variable("isSome") + + printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("let \(optVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + // For optional associated value enums, Swift uses bridgeJSLowerParameter() + // which pushes caseId to tmpRetInts (not tmpRetTag like bridgeJSLowerReturn()). + if case .associatedValueEnum(let fullName) = wrappedType { + let base = fullName.components(separatedBy: ".").last ?? fullName + let caseIdVar = scope.variable("caseId") + printer.write("const \(caseIdVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write( + "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + ) + } else { let wrappedFragment = associatedValuePopPayload(type: wrappedType) let wrappedResults = wrappedFragment.printCode([], scope, printer, cleanup) if let wrappedResult = wrappedResults.first { @@ -2412,23 +2507,16 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(optVar) = undefined;") } } - printer.write("} else {") - printer.indent { - printer.write("\(optVar) = \(kind.absenceLiteral);") - } - printer.write("}") - - return [optVar] } - ) - default: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - return ["undefined"] + printer.write("} else {") + printer.indent { + printer.write("\(optVar) = \(kind.absenceLiteral);") } - ) - } + printer.write("}") + + return [optVar] + } + ) } static func swiftStructLowerReturn(fullName: String) -> IntrinsicJSFragment { @@ -2489,7 +2577,7 @@ struct IntrinsicJSFragment: Sendable { let elemVar = scope.variable("elem") printer.write("for (const \(elemVar) of \(arr)) {") printer.indent { - let elementFragment = try! arrayElementLowerFragment(elementType: elementType) + let elementFragment = try! stackLowerFragment(elementType: elementType) let elementCleanup = CodeFragmentPrinter() let _ = elementFragment.printCode([elemVar], scope, printer, elementCleanup) if !elementCleanup.lines.isEmpty { @@ -2523,7 +2611,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("const \(resultVar) = [];") printer.write("for (let \(iVar) = 0; \(iVar) < \(lenVar); \(iVar)++) {") printer.indent { - let elementFragment = try! arrayElementRaiseFragment(elementType: elementType) + let elementFragment = try! stackLiftFragment(elementType: elementType) let elementResults = elementFragment.printCode([], scope, printer, cleanupCode) if let elementExpr = elementResults.first { printer.write("\(resultVar).push(\(elementExpr));") @@ -2536,7 +2624,7 @@ struct IntrinsicJSFragment: Sendable { ) } - private static func arrayElementRaiseFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { + private static func stackLiftFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { switch elementType { case .jsValue: throw BridgeJSLinkError(message: "Array of JSValue is not supported yet") @@ -2592,7 +2680,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let resultVar = scope.variable("struct") printer.write( - "const \(resultVar) = structHelpers.\(structBase).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) return [resultVar] } @@ -2617,6 +2705,24 @@ struct IntrinsicJSFragment: Sendable { return [varName] } ) + case .float: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let varName = scope.variable("rawValue") + printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetF32s).pop();") + return [varName] + } + ) + case .double: + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanup in + let varName = scope.variable("rawValue") + printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetF64s).pop();") + return [varName] + } + ) default: return IntrinsicJSFragment( parameters: [], @@ -2632,11 +2738,9 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: [], printCode: { arguments, scope, printer, cleanup in - let caseIdVar = scope.variable("caseId") let resultVar = scope.variable("enumValue") - printer.write("const \(caseIdVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") printer.write( - "const \(resultVar) = enumHelpers.\(base).lift(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetTag).pop(), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) return [resultVar] } @@ -2648,7 +2752,7 @@ struct IntrinsicJSFragment: Sendable { let ptrVar = scope.variable("ptr") let objVar = scope.variable("obj") printer.write("const \(ptrVar) = \(JSGlueVariableScope.reservedTmpRetPointers).pop();") - printer.write("const \(objVar) = \(className).__construct(\(ptrVar));") + printer.write("const \(objVar) = _exports['\(className)'].__construct(\(ptrVar));") return [objVar] } ) @@ -2682,7 +2786,7 @@ struct IntrinsicJSFragment: Sendable { } } - private static func arrayElementLowerFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { + private static func stackLowerFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { switch elementType { case .jsValue: throw BridgeJSLinkError(message: "Array of JSValue is not supported yet") @@ -2693,7 +2797,7 @@ struct IntrinsicJSFragment: Sendable { let value = arguments[0] let bytesVar = scope.variable("bytes") let idVar = scope.variable("id") - printer.write("const \(bytesVar) = textEncoder.encode(\(value));") + printer.write("const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));") printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") @@ -2739,8 +2843,10 @@ struct IntrinsicJSFragment: Sendable { parameters: ["value"], printCode: { arguments, scope, printer, cleanup in let value = arguments[0] - let cleanupVar = scope.variable("cleanup") - printer.write("const { cleanup: \(cleanupVar) } = structHelpers.\(structBase).lower(\(value));") + let cleanupVar = scope.variable("structCleanup") + printer.write( + "const { cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lower(\(value));" + ) cleanup.write("if (\(cleanupVar)) { \(cleanupVar)(); }") return [] } @@ -2762,7 +2868,9 @@ struct IntrinsicJSFragment: Sendable { let value = arguments[0] let bytesVar = scope.variable("bytes") let idVar = scope.variable("id") - printer.write("const \(bytesVar) = textEncoder.encode(\(value));") + printer.write( + "const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" + ) printer.write( "const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" ) @@ -2772,6 +2880,22 @@ struct IntrinsicJSFragment: Sendable { return [] } ) + case .float: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(Math.fround(\(arguments[0])));") + return [] + } + ) + case .double: + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(arguments[0]));") + return [] + } + ) default: return IntrinsicJSFragment( parameters: ["value"], @@ -2790,7 +2914,7 @@ struct IntrinsicJSFragment: Sendable { let caseIdVar = scope.variable("caseId") let cleanupVar = scope.variable("enumCleanup") printer.write( - "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = enumHelpers.\(base).lower(\(value));" + "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" ) printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(caseIdVar));") cleanup.write("if (\(cleanupVar)) { \(cleanupVar)(); }") @@ -2867,7 +2991,7 @@ struct IntrinsicJSFragment: Sendable { } printer.write("} else {") printer.indent { - let innerFragment = try! arrayElementRaiseFragment(elementType: wrappedType) + let innerFragment = try! stackLiftFragment(elementType: wrappedType) let innerResults = innerFragment.printCode([], scope, printer, cleanup) if let innerResult = innerResults.first { printer.write("\(resultVar) = \(innerResult);") @@ -2898,7 +3022,7 @@ struct IntrinsicJSFragment: Sendable { let localCleanupWriter = CodeFragmentPrinter() printer.write("if (\(isSomeVar)) {") printer.indent { - let innerFragment = try! arrayElementLowerFragment(elementType: wrappedType) + let innerFragment = try! stackLowerFragment(elementType: wrappedType) let _ = innerFragment.printCode([value], scope, printer, localCleanupWriter) let localCleanupLines = localCleanupWriter.lines.filter { !$0.trimmingCharacters(in: .whitespaces).isEmpty @@ -3065,13 +3189,11 @@ struct IntrinsicJSFragment: Sendable { let methodScope = scope.makeChildScope() let methodCleanup = CodeFragmentPrinter() - // Lower the struct instance (this) using the helper's lower function let structCleanupVar = methodScope.variable("structCleanup") printer.write( "const { cleanup: \(structCleanupVar) } = \(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).lower(this);" ) - // Lower each parameter and collect forwarding expressions var paramForwardings: [String] = [] for param in method.parameters { let fragment = try! IntrinsicJSFragment.lowerParameter(type: param.type) @@ -3079,7 +3201,6 @@ struct IntrinsicJSFragment: Sendable { paramForwardings.append(contentsOf: loweredValues) } - // Call the Swift function with all lowered parameters let callExpr = "instance.exports.\(method.abiName)(\(paramForwardings.joined(separator: ", ")))" if method.returnType == .void { printer.write("\(callExpr);") @@ -3118,61 +3239,6 @@ struct IntrinsicJSFragment: Sendable { switch field.type { case .jsValue: preconditionFailure("Struct field of JSValue is not supported yet") - case .string: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - let value = arguments[0] - let bytesVar = scope.variable("bytes") - let idVar = scope.variable("id") - printer.write("const \(bytesVar) = textEncoder.encode(\(value));") - printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") - cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") - return [idVar] - } - ) - case .bool: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(arguments[0]) ? 1 : 0);") - return [] - } - ) - case .int, .uint: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(arguments[0]) | 0));") - return [] - } - ) - case .float: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(Math.fround(\(arguments[0])));") - return [] - } - ) - case .double: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(arguments[0]));") - return [] - } - ) - case .unsafePointer: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push((\(arguments[0]) | 0));") - return [] - } - ) case .jsObject: return IntrinsicJSFragment( parameters: ["value"], @@ -3233,7 +3299,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") printer.indent { let bytesVar = scope.variable("bytes") - printer.write("const \(bytesVar) = textEncoder.encode(\(value));") + printer.write( + "const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" + ) printer.write( "\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" ) @@ -3326,7 +3394,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") printer.indent { let bytesVar = scope.variable("bytes") - printer.write("const \(bytesVar) = textEncoder.encode(\(value));") + printer.write( + "const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" + ) printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") @@ -3369,7 +3439,6 @@ struct IntrinsicJSFragment: Sendable { cleanup.write("}") return [idVar] } else { - // Handle optional primitive types using helper switch wrappedType { case .int, .uint: pushOptionalPrimitive( @@ -3430,7 +3499,6 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") cleanup.write("if (\(enumCleanupVar)) { \(enumCleanupVar)(); }") default: - // For other types (nested structs, etc.), original logic applies let wrappedFragment = structFieldLowerFragment( field: ExportedProperty( name: field.name, @@ -3464,83 +3532,6 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .swiftHeapObject: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - let value = arguments[0] - printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(\(value).pointer);") - return [] - } - ) - case .associatedValueEnum(let fullName): - let base = fullName.components(separatedBy: ".").last ?? fullName - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - let value = arguments[0] - let caseIdVar = scope.variable("caseId") - let cleanupVar = scope.variable("enumCleanup") - printer.write( - "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(caseIdVar));") - cleanup.write("if (\(cleanupVar)) { \(cleanupVar)(); }") - return [cleanupVar] - } - ) - case .caseEnum: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(arguments[0]) | 0));") - return [] - } - ) - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - let value = arguments[0] - let bytesVar = scope.variable("bytes") - let idVar = scope.variable("id") - printer.write("const \(bytesVar) = textEncoder.encode(\(value));") - printer.write( - "const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") - cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") - return [idVar] - } - ) - case .float: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(Math.fround(\(arguments[0])));") - return [] - } - ) - case .double: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(arguments[0]));") - return [] - } - ) - default: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(arguments[0]) | 0));") - return [] - } - ) - } case .void, .swiftProtocol, .namespaceEnum, .closure: // These types should not appear as struct fields - return error fragment return IntrinsicJSFragment( @@ -3550,8 +3541,8 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .array(let elementType): - return try! arrayLower(elementType: elementType) + default: + return try! stackLowerFragment(elementType: field.type) } } @@ -3606,60 +3597,6 @@ struct IntrinsicJSFragment: Sendable { switch field.type { case .jsValue: preconditionFailure("Struct field of JSValue is not supported yet") - case .string: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let strVar = scope.variable("string") - printer.write("const \(strVar) = \(JSGlueVariableScope.reservedTmpRetStrings).pop();") - return [strVar] - } - ) - case .bool: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let bVar = scope.variable("bool") - printer.write("const \(bVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop() !== 0;") - return [bVar] - } - ) - case .int, .uint: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let iVar = scope.variable("int") - printer.write("const \(iVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") - return [iVar] - } - ) - case .float: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let fVar = scope.variable("f32") - printer.write("const \(fVar) = \(JSGlueVariableScope.reservedTmpRetF32s).pop();") - return [fVar] - } - ) - case .double: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let dVar = scope.variable("f64") - printer.write("const \(dVar) = \(JSGlueVariableScope.reservedTmpRetF64s).pop();") - return [dVar] - } - ) - case .unsafePointer: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let pVar = scope.variable("pointer") - printer.write("const \(pVar) = \(JSGlueVariableScope.reservedTmpRetPointers).pop();") - return [pVar] - } - ) case .nullable(let wrappedType, let kind): return IntrinsicJSFragment( parameters: [], @@ -3676,7 +3613,7 @@ struct IntrinsicJSFragment: Sendable { let caseIdVar = scope.variable("enumCaseId") printer.write("const \(caseIdVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") printer.write( - "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" + "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) } else { let wrappedFragment = structFieldLiftFragment( @@ -3715,65 +3652,6 @@ struct IntrinsicJSFragment: Sendable { return [structVar] } ) - case .caseEnum: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let varName = scope.variable("value") - printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") - return [varName] - } - ) - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let varName = scope.variable("value") - printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetStrings).pop();") - return [varName] - } - ) - case .float: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let varName = scope.variable("value") - printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetF32s).pop();") - return [varName] - } - ) - case .double: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let varName = scope.variable("value") - printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetF64s).pop();") - return [varName] - } - ) - default: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let varName = scope.variable("value") - printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") - return [varName] - } - ) - } - case .swiftHeapObject(let className): - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let ptrVar = scope.variable("ptr") - let varName = scope.variable("value") - printer.write("const \(ptrVar) = \(JSGlueVariableScope.reservedTmpRetPointers).pop();") - printer.write("const \(varName) = _exports['\(className)'].__construct(\(ptrVar));") - return [varName] - } - ) case .jsObject: return IntrinsicJSFragment( parameters: [], @@ -3797,18 +3675,6 @@ struct IntrinsicJSFragment: Sendable { return [varName] } ) - case .associatedValueEnum(let fullName): - let base = fullName.components(separatedBy: ".").last ?? fullName - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, scope, printer, cleanup in - let varName = scope.variable("value") - printer.write( - "const \(varName) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetTag), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s));" - ) - return [varName] - } - ) case .void, .swiftProtocol, .namespaceEnum, .closure: // These types should not appear as struct fields return IntrinsicJSFragment( @@ -3818,8 +3684,8 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .array(let elementType): - return try! arrayLift(elementType: elementType) + default: + return try! stackLiftFragment(elementType: field.type) } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/EnumAssociatedValue.swift index efb6cd1b1..a0e6cbfeb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/EnumAssociatedValue.swift @@ -55,3 +55,66 @@ enum APIOptionalResult { } @JS func roundTripOptionalAPIOptionalResult(result: APIOptionalResult?) -> APIOptionalResult? @JS func compareAPIResults(result1: APIOptionalResult?, result2: APIOptionalResult?) -> APIOptionalResult? + +@JS enum Precision: Float { + case rough = 0.1 + case fine = 0.001 +} + +@JS enum CardinalDirection { + case north + case south + case east + case west +} + +@JS +enum TypedPayloadResult { + case precision(Precision) + case direction(CardinalDirection) + case optPrecision(Precision?) + case optDirection(CardinalDirection?) + case empty +} + +@JS func roundTripTypedPayloadResult(_ result: TypedPayloadResult) -> TypedPayloadResult +@JS func roundTripOptionalTypedPayloadResult(_ result: TypedPayloadResult?) -> TypedPayloadResult? + +@JS struct Point { + var x: Double + var y: Double +} + +@JS class User { + var name: String + + init(name: String) { + self.name = name + } +} + +@JS +enum AllTypesResult { + case structPayload(Point) + case classPayload(User) + case jsObjectPayload(JSObject) + case nestedEnum(APIResult) + case arrayPayload([Int]) + case empty +} + +@JS func roundTripAllTypesResult(_ result: AllTypesResult) -> AllTypesResult +@JS func roundTripOptionalAllTypesResult(_ result: AllTypesResult?) -> AllTypesResult? + +@JS +enum OptionalAllTypesResult { + case optStruct(Point?) + case optClass(User?) + case optJSObject(JSObject?) + case optNestedEnum(APIResult?) + case optArray([Int]?) + case empty +} + +@JS func roundTripOptionalPayloadResult(_ result: OptionalAllTypesResult) -> OptionalAllTypesResult +@JS func roundTripOptionalPayloadResultOpt(_ result: OptionalAllTypesResult?) -> OptionalAllTypesResult? diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json index ba9ee9324..3c624fa12 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.json @@ -1,7 +1,16 @@ { "exported" : { "classes" : [ + { + "methods" : [ + + ], + "name" : "User", + "properties" : [ + ], + "swiftCallName" : "User" + } ], "enums" : [ { @@ -492,6 +501,346 @@ ], "swiftCallName" : "APIOptionalResult", "tsFullPath" : "APIOptionalResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "rough", + "rawValue" : "0.1" + }, + { + "associatedValues" : [ + + ], + "name" : "fine", + "rawValue" : "0.001" + } + ], + "emitStyle" : "const", + "name" : "Precision", + "rawType" : "Float", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Precision", + "tsFullPath" : "Precision" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "north" + }, + { + "associatedValues" : [ + + ], + "name" : "south" + }, + { + "associatedValues" : [ + + ], + "name" : "east" + }, + { + "associatedValues" : [ + + ], + "name" : "west" + } + ], + "emitStyle" : "const", + "name" : "CardinalDirection", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "CardinalDirection", + "tsFullPath" : "CardinalDirection" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + } + } + ], + "name" : "precision" + }, + { + "associatedValues" : [ + { + "type" : { + "caseEnum" : { + "_0" : "CardinalDirection" + } + } + } + ], + "name" : "direction" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optPrecision" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "CardinalDirection" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optDirection" + }, + { + "associatedValues" : [ + + ], + "name" : "empty" + } + ], + "emitStyle" : "const", + "name" : "TypedPayloadResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "TypedPayloadResult", + "tsFullPath" : "TypedPayloadResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + ], + "name" : "structPayload" + }, + { + "associatedValues" : [ + { + "type" : { + "swiftHeapObject" : { + "_0" : "User" + } + } + } + ], + "name" : "classPayload" + }, + { + "associatedValues" : [ + { + "type" : { + "jsObject" : { + + } + } + } + ], + "name" : "jsObjectPayload" + }, + { + "associatedValues" : [ + { + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "name" : "nestedEnum" + }, + { + "associatedValues" : [ + { + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "name" : "arrayPayload" + }, + { + "associatedValues" : [ + + ], + "name" : "empty" + } + ], + "emitStyle" : "const", + "name" : "AllTypesResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "AllTypesResult", + "tsFullPath" : "AllTypesResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "Point" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optStruct" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "User" + } + }, + "_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" : { + "int" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optArray" + }, + { + "associatedValues" : [ + + ], + "name" : "empty" + } + ], + "emitStyle" : "const", + "name" : "OptionalAllTypesResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "OptionalAllTypesResult", + "tsFullPath" : "OptionalAllTypesResult" } ], "exposeToGlobal" : false, @@ -853,13 +1202,221 @@ "_1" : "null" } } + }, + { + "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_roundTripOptionalTypedPayloadResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTypedPayloadResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" + } + }, + "_1" : "null" + } + } + }, + { + "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_roundTripOptionalAllTypesResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalAllTypesResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "AllTypesResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "AllTypesResult" + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalPayloadResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalPayloadResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalPayloadResultOpt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalPayloadResultOpt", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + }, + "_1" : "null" + } + } } ], "protocols" : [ ], "structs" : [ + { + "methods" : [ + ], + "name" : "Point", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "x", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "y", + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "Point" + } ] }, "moduleName" : "TestModule" diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift index 0854cba74..26454a2a7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift @@ -55,20 +55,20 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .failure(let param0): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) case .flag(let param0): - _swift_js_push_tag(Int32(2)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(2)) case .rate(let param0): - _swift_js_push_tag(Int32(3)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(3)) case .precise(let param0): - _swift_js_push_tag(Int32(4)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(4)) case .info: _swift_js_push_tag(Int32(5)) } @@ -145,24 +145,23 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .error(let param0, let param1): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) case .status(let param0, let param1, let param2): - _swift_js_push_tag(Int32(2)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(2)) case .coordinates(let param0, let param1, let param2): - _swift_js_push_tag(Int32(3)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(3)) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - _swift_js_push_tag(Int32(4)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() @@ -172,6 +171,7 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { param6.bridgeJSLowerStackReturn() param7.bridgeJSLowerStackReturn() param8.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(4)) case .info: _swift_js_push_tag(Int32(5)) } @@ -224,17 +224,17 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .failure(let param0, let param1): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) case .status(let param0, let param1, let param2): - _swift_js_push_tag(Int32(2)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(2)) } } } @@ -278,12 +278,12 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .failure(let param0, let param1): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) } } } @@ -358,14 +358,13 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(0)) case .failure(let param0, let param1): - _swift_js_push_tag(Int32(1)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() @@ -376,8 +375,8 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) + _swift_js_push_tag(Int32(1)) case .status(let param0, let param1, let param2): - _swift_js_push_tag(Int32(2)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() @@ -393,10 +392,388 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { __bjs_unwrapped_param2.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) + _swift_js_push_tag(Int32(2)) + } + } +} + +extension Precision: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { +} + +extension CardinalDirection: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> CardinalDirection { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> CardinalDirection { + return CardinalDirection(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 TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> TypedPayloadResult { + switch caseId { + case 0: + return .precision(Precision.bridgeJSLiftParameter(_swift_js_pop_f32())) + case 1: + return .direction(CardinalDirection.bridgeJSLiftParameter(_swift_js_pop_i32())) + case 2: + return .optPrecision(Optional.bridgeJSLiftParameter()) + case 3: + return .optDirection(Optional.bridgeJSLiftParameter()) + case 4: + return .empty + default: + fatalError("Unknown TypedPayloadResult case ID: \(caseId)") + } + } + + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .precision(let param0): + param0.bridgeJSLowerStackReturn() + return Int32(0) + case .direction(let param0): + param0.bridgeJSLowerStackReturn() + return Int32(1) + case .optPrecision(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(2) + case .optDirection(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(3) + case .empty: + return Int32(4) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> TypedPayloadResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> TypedPayloadResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + switch self { + case .precision(let param0): + param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) + case .direction(let param0): + param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) + case .optPrecision(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(2)) + case .optDirection(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(3)) + case .empty: + _swift_js_push_tag(Int32(4)) + } + } +} + +extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> AllTypesResult { + switch caseId { + case 0: + return .structPayload(Point.bridgeJSLiftParameter()) + case 1: + return .classPayload(User.bridgeJSLiftParameter()) + case 2: + return .jsObjectPayload(JSObject.bridgeJSLiftParameter()) + case 3: + return .nestedEnum(APIResult.bridgeJSLiftParameter(_swift_js_pop_i32())) + case 4: + return .arrayPayload([Int].bridgeJSLiftParameter()) + case 5: + return .empty + default: + fatalError("Unknown AllTypesResult case ID: \(caseId)") + } + } + + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .structPayload(let param0): + param0.bridgeJSLowerReturn() + return Int32(0) + case .classPayload(let param0): + param0.bridgeJSLowerStackReturn() + return Int32(1) + case .jsObjectPayload(let param0): + param0.bridgeJSLowerStackReturn() + return Int32(2) + case .nestedEnum(let param0): + param0.bridgeJSLowerReturn() + return Int32(3) + case .arrayPayload(let param0): + param0.bridgeJSLowerReturn() + return Int32(4) + case .empty: + return Int32(5) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> AllTypesResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> AllTypesResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + switch self { + case .structPayload(let param0): + param0.bridgeJSLowerReturn() + _swift_js_push_tag(Int32(0)) + case .classPayload(let param0): + param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) + case .jsObjectPayload(let param0): + param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(2)) + case .nestedEnum(let param0): + param0.bridgeJSLowerReturn() + _swift_js_push_tag(Int32(3)) + case .arrayPayload(let param0): + param0.bridgeJSLowerReturn() + _swift_js_push_tag(Int32(4)) + case .empty: + _swift_js_push_tag(Int32(5)) } } } +extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> OptionalAllTypesResult { + switch caseId { + case 0: + return .optStruct(Optional.bridgeJSLiftParameter()) + case 1: + return .optClass(Optional.bridgeJSLiftParameter()) + case 2: + return .optJSObject(Optional.bridgeJSLiftParameter()) + case 3: + return .optNestedEnum(Optional.bridgeJSLiftParameter()) + case 4: + return .optArray({ + let __isSome = _swift_js_pop_i32() + if __isSome == 0 { + return Optional<[Int]>.none + } else { + return [Int].bridgeJSLiftParameter() + } + }()) + case 5: + return .empty + default: + fatalError("Unknown OptionalAllTypesResult case ID: \(caseId)") + } + } + + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .optStruct(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(0) + case .optClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(1) + case .optJSObject(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(2) + case .optNestedEnum(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(3) + case .optArray(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(4) + case .empty: + return Int32(5) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> OptionalAllTypesResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> OptionalAllTypesResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + switch self { + case .optStruct(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(0)) + case .optClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(1)) + case .optJSObject(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(2)) + case .optNestedEnum(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(3)) + case .optArray(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(4)) + case .empty: + _swift_js_push_tag(Int32(5)) + } + } +} + +extension Point: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { + let y = Double.bridgeJSLiftParameter() + let x = Double.bridgeJSLiftParameter() + return Point(x: x, y: y) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + self.x.bridgeJSLowerStackReturn() + self.y.bridgeJSLowerStackReturn() + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + 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(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Point") +fileprivate func _bjs_struct_lift_Point() -> Int32 +#else +fileprivate func _bjs_struct_lift_Point() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_handle") @_cdecl("bjs_handle") public func _bjs_handle(_ result: Int32) -> Void { @@ -527,4 +904,95 @@ public func _bjs_compareAPIResults(_ result1IsSome: Int32, _ result1CaseId: Int3 #else fatalError("Only available on WebAssembly") #endif -} \ No newline at end of file +} + +@_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_roundTripOptionalTypedPayloadResult") +@_cdecl("bjs_roundTripOptionalTypedPayloadResult") +public func _bjs_roundTripOptionalTypedPayloadResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalTypedPayloadResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + 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_roundTripOptionalAllTypesResult") +@_cdecl("bjs_roundTripOptionalAllTypesResult") +public func _bjs_roundTripOptionalAllTypesResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalAllTypesResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalPayloadResult") +@_cdecl("bjs_roundTripOptionalPayloadResult") +public func _bjs_roundTripOptionalPayloadResult(_ result: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalPayloadResult(_: OptionalAllTypesResult.bridgeJSLiftParameter(result)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalPayloadResultOpt") +@_cdecl("bjs_roundTripOptionalPayloadResultOpt") +public func _bjs_roundTripOptionalPayloadResultOpt(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalPayloadResultOpt(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_User_deinit") +@_cdecl("bjs_User_deinit") +public func _bjs_User_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension User: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_User_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_User_wrap") +fileprivate func _bjs_User_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_User_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift index 21178521d..3536b53cb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift @@ -400,11 +400,11 @@ extension Result: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .failure(let param0): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift index ed6cb98c0..3e5b40def 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift @@ -82,11 +82,11 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .failure(let param0): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift index ed6cb98c0..3e5b40def 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift @@ -82,11 +82,11 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .failure(let param0): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift index df6046693..94351dbdf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift @@ -730,20 +730,20 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .failure(let param0): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) case .flag(let param0): - _swift_js_push_tag(Int32(2)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(2)) case .rate(let param0): - _swift_js_push_tag(Int32(3)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(3)) case .precise(let param0): - _swift_js_push_tag(Int32(4)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(4)) case .info: _swift_js_push_tag(Int32(5)) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 491fc610e..4610d03ba 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -98,7 +98,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); @@ -382,9 +382,9 @@ export async function createInstantiator(options, swift) { processPointArray: function bjs_processPointArray(points) { const arrayCleanups = []; for (const elem of points) { - const { cleanup: cleanup } = structHelpers.Point.lower(elem); + const { cleanup: structCleanup } = structHelpers.Point.lower(elem); arrayCleanups.push(() => { - if (cleanup) { cleanup(); } + if (structCleanup) { structCleanup(); } }); } tmpParamInts.push(points.length); @@ -446,9 +446,9 @@ export async function createInstantiator(options, swift) { findFirstPoint: function bjs_findFirstPoint(points, matching) { const arrayCleanups = []; for (const elem of points) { - const { cleanup: cleanup } = structHelpers.Point.lower(elem); + const { cleanup: structCleanup } = structHelpers.Point.lower(elem); arrayCleanups.push(() => { - if (cleanup) { cleanup(); } + if (structCleanup) { structCleanup(); } }); } tmpParamInts.push(points.length); @@ -610,8 +610,8 @@ export async function createInstantiator(options, swift) { for (const elem of points) { const isSome = elem != null ? 1 : 0; if (isSome) { - const { cleanup: cleanup } = structHelpers.Point.lower(elem); - arrayCleanups.push(() => { if (cleanup) { cleanup(); } }); + const { cleanup: structCleanup } = structHelpers.Point.lower(elem); + arrayCleanups.push(() => { if (structCleanup) { structCleanup(); } }); } else { } tmpParamInts.push(isSome); @@ -766,9 +766,9 @@ export async function createInstantiator(options, swift) { for (const elem of points) { const arrayCleanups1 = []; for (const elem1 of elem) { - const { cleanup: cleanup } = structHelpers.Point.lower(elem1); + const { cleanup: structCleanup } = structHelpers.Point.lower(elem1); arrayCleanups1.push(() => { - if (cleanup) { cleanup(); } + if (structCleanup) { structCleanup(); } }); } tmpParamInts.push(elem.length); @@ -805,7 +805,7 @@ export async function createInstantiator(options, swift) { const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const ptr = tmpRetPointers.pop(); - const obj = Item.__construct(ptr); + const obj = _exports['Item'].__construct(ptr); arrayResult.push(obj); } arrayResult.reverse(); @@ -833,7 +833,7 @@ export async function createInstantiator(options, swift) { const arrayResult1 = []; for (let i1 = 0; i1 < arrayLen1; i1++) { const ptr = tmpRetPointers.pop(); - const obj = Item.__construct(ptr); + const obj = _exports['Item'].__construct(ptr); arrayResult1.push(obj); } arrayResult1.reverse(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js index d5a195430..0aa9148c1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -70,7 +70,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index bc669993b..754c47b0a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -24,7 +24,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -123,7 +123,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts index 20962c388..9ab117011 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts @@ -43,6 +43,65 @@ export const APIOptionalResultValues: { export type APIOptionalResultTag = { tag: typeof APIOptionalResultValues.Tag.Success; param0: string | null } | { tag: typeof APIOptionalResultValues.Tag.Failure; param0: number | null; param1: boolean | null } | { tag: typeof APIOptionalResultValues.Tag.Status; param0: boolean | null; param1: number | null; param2: string | null } +export const PrecisionValues: { + readonly Rough: 0.1; + readonly Fine: 0.001; +}; +export type PrecisionTag = typeof PrecisionValues[keyof typeof PrecisionValues]; + +export const CardinalDirectionValues: { + readonly North: 0; + readonly South: 1; + readonly East: 2; + readonly West: 3; +}; +export type CardinalDirectionTag = typeof CardinalDirectionValues[keyof typeof CardinalDirectionValues]; + +export const TypedPayloadResultValues: { + readonly Tag: { + readonly Precision: 0; + readonly Direction: 1; + readonly OptPrecision: 2; + readonly OptDirection: 3; + readonly Empty: 4; + }; +}; + +export type TypedPayloadResultTag = + { tag: typeof TypedPayloadResultValues.Tag.Precision; param0: PrecisionTag } | { tag: typeof TypedPayloadResultValues.Tag.Direction; param0: CardinalDirectionTag } | { tag: typeof TypedPayloadResultValues.Tag.OptPrecision; param0: PrecisionTag | null } | { tag: typeof TypedPayloadResultValues.Tag.OptDirection; param0: CardinalDirectionTag | null } | { tag: typeof TypedPayloadResultValues.Tag.Empty } + +export const AllTypesResultValues: { + readonly Tag: { + readonly StructPayload: 0; + readonly ClassPayload: 1; + readonly JsObjectPayload: 2; + readonly NestedEnum: 3; + readonly ArrayPayload: 4; + readonly Empty: 5; + }; +}; + +export type AllTypesResultTag = + { tag: typeof AllTypesResultValues.Tag.StructPayload; param0: PointTag } | { tag: typeof AllTypesResultValues.Tag.ClassPayload; param0: User } | { tag: typeof AllTypesResultValues.Tag.JsObjectPayload; param0: any } | { tag: typeof AllTypesResultValues.Tag.NestedEnum; param0: APIResultTag } | { tag: typeof AllTypesResultValues.Tag.ArrayPayload; param0: number[] } | { tag: typeof AllTypesResultValues.Tag.Empty } + +export const OptionalAllTypesResultValues: { + readonly Tag: { + readonly OptStruct: 0; + readonly OptClass: 1; + readonly OptJSObject: 2; + readonly OptNestedEnum: 3; + readonly OptArray: 4; + readonly Empty: 5; + }; +}; + +export type OptionalAllTypesResultTag = + { tag: typeof OptionalAllTypesResultValues.Tag.OptStruct; param0: PointTag | null } | { tag: typeof OptionalAllTypesResultValues.Tag.OptClass; param0: User | null } | { tag: typeof OptionalAllTypesResultValues.Tag.OptJSObject; param0: any | null } | { tag: typeof OptionalAllTypesResultValues.Tag.OptNestedEnum; param0: APIResultTag | null } | { tag: typeof OptionalAllTypesResultValues.Tag.OptArray; param0: number[] | null } | { tag: typeof OptionalAllTypesResultValues.Tag.Empty } + +export interface Point { + x: number; + y: number; +} export type APIResultObject = typeof APIResultValues; export type ComplexResultObject = typeof ComplexResultValues; @@ -53,6 +112,16 @@ export type NetworkingResultObject = typeof API.NetworkingResultValues; export type APIOptionalResultObject = typeof APIOptionalResultValues; +export type PrecisionObject = typeof PrecisionValues; + +export type CardinalDirectionObject = typeof CardinalDirectionValues; + +export type TypedPayloadResultObject = typeof TypedPayloadResultValues; + +export type AllTypesResultObject = typeof AllTypesResultValues; + +export type OptionalAllTypesResultObject = typeof OptionalAllTypesResultValues; + export namespace API { const NetworkingResultValues: { readonly Tag: { @@ -74,7 +143,18 @@ export namespace Utilities { type ResultTag = { tag: typeof ResultValues.Tag.Success; param0: string } | { tag: typeof ResultValues.Tag.Failure; param0: string; param1: number } | { tag: typeof ResultValues.Tag.Status; param0: boolean; param1: number; param2: string } } +/// 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 User extends SwiftHeapObject { +} export type Exports = { + User: { + } handle(result: APIResultTag): void; getResult(): APIResultTag; roundtripAPIResult(result: APIResultTag): APIResultTag; @@ -87,9 +167,20 @@ export type Exports = { roundTripOptionalNetworkingResult(result: API.NetworkingResultTag | null): API.NetworkingResultTag | null; roundTripOptionalAPIOptionalResult(result: APIOptionalResultTag | null): APIOptionalResultTag | null; compareAPIResults(result1: APIOptionalResultTag | null, result2: APIOptionalResultTag | null): APIOptionalResultTag | null; + roundTripTypedPayloadResult(result: TypedPayloadResultTag): TypedPayloadResultTag; + roundTripOptionalTypedPayloadResult(result: TypedPayloadResultTag | null): TypedPayloadResultTag | null; + roundTripAllTypesResult(result: AllTypesResultTag): AllTypesResultTag; + roundTripOptionalAllTypesResult(result: AllTypesResultTag | null): AllTypesResultTag | null; + roundTripOptionalPayloadResult(result: OptionalAllTypesResultTag): OptionalAllTypesResultTag; + roundTripOptionalPayloadResultOpt(result: OptionalAllTypesResultTag | null): OptionalAllTypesResultTag | null; APIResult: APIResultObject ComplexResult: ComplexResultObject APIOptionalResult: APIOptionalResultObject + Precision: PrecisionObject + CardinalDirection: CardinalDirectionObject + TypedPayloadResult: TypedPayloadResultObject + AllTypesResult: AllTypesResultObject + OptionalAllTypesResult: OptionalAllTypesResultObject API: { NetworkingResult: NetworkingResultObject }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 6eb4b3985..123ba56fa 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -14,78 +14,6 @@ export const APIResultValues = { Info: 5, }, }; - -const __bjs_createAPIResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift) => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case APIResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - const cleanup = () => { - swift.memory.release(id); - }; - return { caseId: APIResultValues.Tag.Success, cleanup }; - } - case APIResultValues.Tag.Failure: { - tmpParamInts.push((value.param0 | 0)); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Failure, cleanup }; - } - case APIResultValues.Tag.Flag: { - tmpParamInts.push(value.param0 ? 1 : 0); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Flag, cleanup }; - } - case APIResultValues.Tag.Rate: { - tmpParamF32s.push(Math.fround(value.param0)); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Rate, cleanup }; - } - case APIResultValues.Tag.Precise: { - tmpParamF64s.push(value.param0); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Precise, cleanup }; - } - case APIResultValues.Tag.Info: { - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Info, cleanup }; - } - default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); - } - }, - lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { - const tag = tmpRetTag | 0; - switch (tag) { - case APIResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); - return { tag: APIResultValues.Tag.Success, param0: string }; - } - case APIResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); - return { tag: APIResultValues.Tag.Failure, param0: int }; - } - case APIResultValues.Tag.Flag: { - const bool = tmpRetInts.pop(); - return { tag: APIResultValues.Tag.Flag, param0: bool }; - } - case APIResultValues.Tag.Rate: { - const f32 = tmpRetF32s.pop(); - return { tag: APIResultValues.Tag.Rate, param0: f32 }; - } - case APIResultValues.Tag.Precise: { - const f64 = tmpRetF64s.pop(); - return { tag: APIResultValues.Tag.Precise, param0: f64 }; - } - case APIResultValues.Tag.Info: return { tag: APIResultValues.Tag.Info }; - default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); - } - } - }); -}; export const ComplexResultValues = { Tag: { Success: 0, @@ -96,127 +24,6 @@ export const ComplexResultValues = { Info: 5, }, }; - -const __bjs_createComplexResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift) => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case ComplexResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - const cleanup = () => { - swift.memory.release(id); - }; - return { caseId: ComplexResultValues.Tag.Success, cleanup }; - } - case ComplexResultValues.Tag.Error: { - tmpParamInts.push((value.param1 | 0)); - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - const cleanup = () => { - swift.memory.release(id); - }; - return { caseId: ComplexResultValues.Tag.Error, cleanup }; - } - case ComplexResultValues.Tag.Status: { - const bytes = textEncoder.encode(value.param2); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - tmpParamInts.push((value.param1 | 0)); - tmpParamInts.push(value.param0 ? 1 : 0); - const cleanup = () => { - swift.memory.release(id); - }; - return { caseId: ComplexResultValues.Tag.Status, cleanup }; - } - case ComplexResultValues.Tag.Coordinates: { - tmpParamF64s.push(value.param2); - tmpParamF64s.push(value.param1); - tmpParamF64s.push(value.param0); - const cleanup = undefined; - return { caseId: ComplexResultValues.Tag.Coordinates, cleanup }; - } - case ComplexResultValues.Tag.Comprehensive: { - const bytes = textEncoder.encode(value.param8); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - const bytes1 = textEncoder.encode(value.param7); - const id1 = swift.memory.retain(bytes1); - tmpParamInts.push(bytes1.length); - tmpParamInts.push(id1); - const bytes2 = textEncoder.encode(value.param6); - const id2 = swift.memory.retain(bytes2); - tmpParamInts.push(bytes2.length); - tmpParamInts.push(id2); - tmpParamF64s.push(value.param5); - tmpParamF64s.push(value.param4); - tmpParamInts.push((value.param3 | 0)); - tmpParamInts.push((value.param2 | 0)); - tmpParamInts.push(value.param1 ? 1 : 0); - tmpParamInts.push(value.param0 ? 1 : 0); - const cleanup = () => { - swift.memory.release(id); - swift.memory.release(id1); - swift.memory.release(id2); - }; - return { caseId: ComplexResultValues.Tag.Comprehensive, cleanup }; - } - case ComplexResultValues.Tag.Info: { - const cleanup = undefined; - return { caseId: ComplexResultValues.Tag.Info, cleanup }; - } - default: throw new Error("Unknown ComplexResultValues tag: " + String(enumTag)); - } - }, - lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { - const tag = tmpRetTag | 0; - switch (tag) { - case ComplexResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); - return { tag: ComplexResultValues.Tag.Success, param0: string }; - } - case ComplexResultValues.Tag.Error: { - const int = tmpRetInts.pop(); - const string = tmpRetStrings.pop(); - return { tag: ComplexResultValues.Tag.Error, param0: string, param1: int }; - } - case ComplexResultValues.Tag.Status: { - const string = tmpRetStrings.pop(); - const int = tmpRetInts.pop(); - const bool = tmpRetInts.pop(); - return { tag: ComplexResultValues.Tag.Status, param0: bool, param1: int, param2: string }; - } - case ComplexResultValues.Tag.Coordinates: { - const f64 = tmpRetF64s.pop(); - const f641 = tmpRetF64s.pop(); - const f642 = tmpRetF64s.pop(); - return { tag: ComplexResultValues.Tag.Coordinates, param0: f642, param1: f641, param2: f64 }; - } - case ComplexResultValues.Tag.Comprehensive: { - const string = tmpRetStrings.pop(); - const string1 = tmpRetStrings.pop(); - const string2 = tmpRetStrings.pop(); - const f64 = tmpRetF64s.pop(); - const f641 = tmpRetF64s.pop(); - const int = tmpRetInts.pop(); - const int1 = tmpRetInts.pop(); - const bool = tmpRetInts.pop(); - const bool1 = tmpRetInts.pop(); - return { tag: ComplexResultValues.Tag.Comprehensive, param0: bool1, param1: bool, param2: int1, param3: int, param4: f641, param5: f64, param6: string2, param7: string1, param8: string }; - } - case ComplexResultValues.Tag.Info: return { tag: ComplexResultValues.Tag.Info }; - default: throw new Error("Unknown ComplexResultValues tag returned from Swift: " + String(tag)); - } - } - }); -}; export const ResultValues = { Tag: { Success: 0, @@ -224,124 +31,12 @@ export const ResultValues = { Status: 2, }, }; - -const __bjs_createResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift) => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case ResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - const cleanup = () => { - swift.memory.release(id); - }; - return { caseId: ResultValues.Tag.Success, cleanup }; - } - case ResultValues.Tag.Failure: { - tmpParamInts.push((value.param1 | 0)); - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - const cleanup = () => { - swift.memory.release(id); - }; - return { caseId: ResultValues.Tag.Failure, cleanup }; - } - case ResultValues.Tag.Status: { - const bytes = textEncoder.encode(value.param2); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - tmpParamInts.push((value.param1 | 0)); - tmpParamInts.push(value.param0 ? 1 : 0); - const cleanup = () => { - swift.memory.release(id); - }; - return { caseId: ResultValues.Tag.Status, cleanup }; - } - default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); - } - }, - lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { - const tag = tmpRetTag | 0; - switch (tag) { - case ResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); - return { tag: ResultValues.Tag.Success, param0: string }; - } - case ResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); - const string = tmpRetStrings.pop(); - return { tag: ResultValues.Tag.Failure, param0: string, param1: int }; - } - case ResultValues.Tag.Status: { - const string = tmpRetStrings.pop(); - const int = tmpRetInts.pop(); - const bool = tmpRetInts.pop(); - return { tag: ResultValues.Tag.Status, param0: bool, param1: int, param2: string }; - } - default: throw new Error("Unknown ResultValues tag returned from Swift: " + String(tag)); - } - } - }); -}; export const NetworkingResultValues = { Tag: { Success: 0, Failure: 1, }, }; - -const __bjs_createNetworkingResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift) => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case NetworkingResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - const cleanup = () => { - swift.memory.release(id); - }; - return { caseId: NetworkingResultValues.Tag.Success, cleanup }; - } - case NetworkingResultValues.Tag.Failure: { - tmpParamInts.push((value.param1 | 0)); - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - const cleanup = () => { - swift.memory.release(id); - }; - return { caseId: NetworkingResultValues.Tag.Failure, cleanup }; - } - default: throw new Error("Unknown NetworkingResultValues tag: " + String(enumTag)); - } - }, - lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { - const tag = tmpRetTag | 0; - switch (tag) { - case NetworkingResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); - return { tag: NetworkingResultValues.Tag.Success, param0: string }; - } - case NetworkingResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); - const string = tmpRetStrings.pop(); - return { tag: NetworkingResultValues.Tag.Failure, param0: string, param1: int }; - } - default: throw new Error("Unknown NetworkingResultValues tag returned from Swift: " + String(tag)); - } - } - }); -}; export const APIOptionalResultValues = { Tag: { Success: 0, @@ -349,135 +44,46 @@ export const APIOptionalResultValues = { Status: 2, }, }; +export const PrecisionValues = { + Rough: 0.1, + Fine: 0.001, +}; -const __bjs_createAPIOptionalResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift) => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case APIOptionalResultValues.Tag.Success: { - const isSome = value.param0 != null; - let id; - if (isSome) { - let bytes = textEncoder.encode(value.param0); - id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - } else { - tmpParamInts.push(0); - tmpParamInts.push(0); - } - tmpParamInts.push(isSome ? 1 : 0); - const cleanup = () => { - if(id) { - swift.memory.release(id); - } - }; - return { caseId: APIOptionalResultValues.Tag.Success, cleanup }; - } - case APIOptionalResultValues.Tag.Failure: { - const isSome = value.param1 != null; - tmpParamInts.push(isSome ? (value.param1 ? 1 : 0) : 0); - tmpParamInts.push(isSome ? 1 : 0); - const isSome1 = value.param0 != null; - tmpParamInts.push(isSome1 ? (value.param0 | 0) : 0); - tmpParamInts.push(isSome1 ? 1 : 0); - const cleanup = undefined; - return { caseId: APIOptionalResultValues.Tag.Failure, cleanup }; - } - case APIOptionalResultValues.Tag.Status: { - const isSome = value.param2 != null; - let id; - if (isSome) { - let bytes = textEncoder.encode(value.param2); - id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - } else { - tmpParamInts.push(0); - tmpParamInts.push(0); - } - tmpParamInts.push(isSome ? 1 : 0); - const isSome1 = value.param1 != null; - tmpParamInts.push(isSome1 ? (value.param1 | 0) : 0); - tmpParamInts.push(isSome1 ? 1 : 0); - const isSome2 = value.param0 != null; - tmpParamInts.push(isSome2 ? (value.param0 ? 1 : 0) : 0); - tmpParamInts.push(isSome2 ? 1 : 0); - const cleanup = () => { - if(id) { - swift.memory.release(id); - } - }; - return { caseId: APIOptionalResultValues.Tag.Status, cleanup }; - } - default: throw new Error("Unknown APIOptionalResultValues tag: " + String(enumTag)); - } - }, - lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { - const tag = tmpRetTag | 0; - switch (tag) { - case APIOptionalResultValues.Tag.Success: { - const isSome = tmpRetInts.pop(); - let optional; - if (isSome) { - const string = tmpRetStrings.pop(); - optional = string; - } else { - optional = null; - } - return { tag: APIOptionalResultValues.Tag.Success, param0: optional }; - } - case APIOptionalResultValues.Tag.Failure: { - const isSome = tmpRetInts.pop(); - let optional; - if (isSome) { - const bool = tmpRetInts.pop(); - optional = bool; - } else { - optional = null; - } - const isSome1 = tmpRetInts.pop(); - let optional1; - if (isSome1) { - const int = tmpRetInts.pop(); - optional1 = int; - } else { - optional1 = null; - } - return { tag: APIOptionalResultValues.Tag.Failure, param0: optional1, param1: optional }; - } - case APIOptionalResultValues.Tag.Status: { - const isSome = tmpRetInts.pop(); - let optional; - if (isSome) { - const string = tmpRetStrings.pop(); - optional = string; - } else { - optional = null; - } - const isSome1 = tmpRetInts.pop(); - let optional1; - if (isSome1) { - const int = tmpRetInts.pop(); - optional1 = int; - } else { - optional1 = null; - } - const isSome2 = tmpRetInts.pop(); - let optional2; - if (isSome2) { - const bool = tmpRetInts.pop(); - optional2 = bool; - } else { - optional2 = null; - } - return { tag: APIOptionalResultValues.Tag.Status, param0: optional2, param1: optional1, param2: optional }; - } - default: throw new Error("Unknown APIOptionalResultValues tag returned from Swift: " + String(tag)); - } - } - }); +export const CardinalDirectionValues = { + North: 0, + South: 1, + East: 2, + West: 3, +}; + +export const TypedPayloadResultValues = { + Tag: { + Precision: 0, + Direction: 1, + OptPrecision: 2, + OptDirection: 3, + Empty: 4, + }, +}; +export const AllTypesResultValues = { + Tag: { + StructPayload: 0, + ClassPayload: 1, + JsObjectPayload: 2, + NestedEnum: 3, + ArrayPayload: 4, + Empty: 5, + }, +}; +export const OptionalAllTypesResultValues = { + Tag: { + OptStruct: 0, + OptClass: 1, + OptJSObject: 2, + OptNestedEnum: 3, + OptArray: 4, + Empty: 5, + }, }; export async function createInstantiator(options, swift) { let instance; @@ -493,7 +99,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -509,6 +115,771 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const __bjs_createPointHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + lower: (value) => { + tmpParamF64s.push(value.x); + tmpParamF64s.push(value.y); + return { cleanup: undefined }; + }, + lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + const f64 = tmpRetF64s.pop(); + const f641 = tmpRetF64s.pop(); + return { x: f641, y: f64 }; + } + }); + }; + const __bjs_createAPIResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case APIResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: APIResultValues.Tag.Success, cleanup }; + } + case APIResultValues.Tag.Failure: { + tmpParamInts.push((value.param0 | 0)); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Failure, cleanup }; + } + case APIResultValues.Tag.Flag: { + tmpParamInts.push(value.param0 ? 1 : 0); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Flag, cleanup }; + } + case APIResultValues.Tag.Rate: { + tmpParamF32s.push(Math.fround(value.param0)); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Rate, cleanup }; + } + case APIResultValues.Tag.Precise: { + tmpParamF64s.push(value.param0); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Precise, cleanup }; + } + case APIResultValues.Tag.Info: { + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Info, cleanup }; + } + default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); + } + }, + lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + tag = tag | 0; + switch (tag) { + case APIResultValues.Tag.Success: { + const string = tmpRetStrings.pop(); + return { tag: APIResultValues.Tag.Success, param0: string }; + } + case APIResultValues.Tag.Failure: { + const int = tmpRetInts.pop(); + return { tag: APIResultValues.Tag.Failure, param0: int }; + } + case APIResultValues.Tag.Flag: { + const bool = tmpRetInts.pop() !== 0; + return { tag: APIResultValues.Tag.Flag, param0: bool }; + } + case APIResultValues.Tag.Rate: { + const f32 = tmpRetF32s.pop(); + return { tag: APIResultValues.Tag.Rate, param0: f32 }; + } + case APIResultValues.Tag.Precise: { + const f64 = tmpRetF64s.pop(); + return { tag: APIResultValues.Tag.Precise, param0: f64 }; + } + case APIResultValues.Tag.Info: return { tag: APIResultValues.Tag.Info }; + default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); + } + } + }); + }; + const __bjs_createComplexResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case ComplexResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: ComplexResultValues.Tag.Success, cleanup }; + } + case ComplexResultValues.Tag.Error: { + tmpParamInts.push((value.param1 | 0)); + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: ComplexResultValues.Tag.Error, cleanup }; + } + case ComplexResultValues.Tag.Status: { + const bytes = textEncoder.encode(value.param2); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + tmpParamInts.push((value.param1 | 0)); + tmpParamInts.push(value.param0 ? 1 : 0); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: ComplexResultValues.Tag.Status, cleanup }; + } + case ComplexResultValues.Tag.Coordinates: { + tmpParamF64s.push(value.param2); + tmpParamF64s.push(value.param1); + tmpParamF64s.push(value.param0); + const cleanup = undefined; + return { caseId: ComplexResultValues.Tag.Coordinates, cleanup }; + } + case ComplexResultValues.Tag.Comprehensive: { + const bytes = textEncoder.encode(value.param8); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const bytes1 = textEncoder.encode(value.param7); + const id1 = swift.memory.retain(bytes1); + tmpParamInts.push(bytes1.length); + tmpParamInts.push(id1); + const bytes2 = textEncoder.encode(value.param6); + const id2 = swift.memory.retain(bytes2); + tmpParamInts.push(bytes2.length); + tmpParamInts.push(id2); + tmpParamF64s.push(value.param5); + tmpParamF64s.push(value.param4); + tmpParamInts.push((value.param3 | 0)); + tmpParamInts.push((value.param2 | 0)); + tmpParamInts.push(value.param1 ? 1 : 0); + tmpParamInts.push(value.param0 ? 1 : 0); + const cleanup = () => { + swift.memory.release(id); + swift.memory.release(id1); + swift.memory.release(id2); + }; + return { caseId: ComplexResultValues.Tag.Comprehensive, cleanup }; + } + case ComplexResultValues.Tag.Info: { + const cleanup = undefined; + return { caseId: ComplexResultValues.Tag.Info, cleanup }; + } + default: throw new Error("Unknown ComplexResultValues tag: " + String(enumTag)); + } + }, + lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + tag = tag | 0; + switch (tag) { + case ComplexResultValues.Tag.Success: { + const string = tmpRetStrings.pop(); + return { tag: ComplexResultValues.Tag.Success, param0: string }; + } + case ComplexResultValues.Tag.Error: { + const int = tmpRetInts.pop(); + const string = tmpRetStrings.pop(); + return { tag: ComplexResultValues.Tag.Error, param0: string, param1: int }; + } + case ComplexResultValues.Tag.Status: { + const string = tmpRetStrings.pop(); + const int = tmpRetInts.pop(); + const bool = tmpRetInts.pop() !== 0; + return { tag: ComplexResultValues.Tag.Status, param0: bool, param1: int, param2: string }; + } + case ComplexResultValues.Tag.Coordinates: { + const f64 = tmpRetF64s.pop(); + const f641 = tmpRetF64s.pop(); + const f642 = tmpRetF64s.pop(); + return { tag: ComplexResultValues.Tag.Coordinates, param0: f642, param1: f641, param2: f64 }; + } + case ComplexResultValues.Tag.Comprehensive: { + const string = tmpRetStrings.pop(); + const string1 = tmpRetStrings.pop(); + const string2 = tmpRetStrings.pop(); + const f64 = tmpRetF64s.pop(); + const f641 = tmpRetF64s.pop(); + const int = tmpRetInts.pop(); + const int1 = tmpRetInts.pop(); + const bool = tmpRetInts.pop() !== 0; + const bool1 = tmpRetInts.pop() !== 0; + return { tag: ComplexResultValues.Tag.Comprehensive, param0: bool1, param1: bool, param2: int1, param3: int, param4: f641, param5: f64, param6: string2, param7: string1, param8: string }; + } + case ComplexResultValues.Tag.Info: return { tag: ComplexResultValues.Tag.Info }; + default: throw new Error("Unknown ComplexResultValues tag returned from Swift: " + String(tag)); + } + } + }); + }; + const __bjs_createResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case ResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: ResultValues.Tag.Success, cleanup }; + } + case ResultValues.Tag.Failure: { + tmpParamInts.push((value.param1 | 0)); + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: ResultValues.Tag.Failure, cleanup }; + } + case ResultValues.Tag.Status: { + const bytes = textEncoder.encode(value.param2); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + tmpParamInts.push((value.param1 | 0)); + tmpParamInts.push(value.param0 ? 1 : 0); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: ResultValues.Tag.Status, cleanup }; + } + default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); + } + }, + lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + tag = tag | 0; + switch (tag) { + case ResultValues.Tag.Success: { + const string = tmpRetStrings.pop(); + return { tag: ResultValues.Tag.Success, param0: string }; + } + case ResultValues.Tag.Failure: { + const int = tmpRetInts.pop(); + const string = tmpRetStrings.pop(); + return { tag: ResultValues.Tag.Failure, param0: string, param1: int }; + } + case ResultValues.Tag.Status: { + const string = tmpRetStrings.pop(); + const int = tmpRetInts.pop(); + const bool = tmpRetInts.pop() !== 0; + return { tag: ResultValues.Tag.Status, param0: bool, param1: int, param2: string }; + } + default: throw new Error("Unknown ResultValues tag returned from Swift: " + String(tag)); + } + } + }); + }; + const __bjs_createNetworkingResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case NetworkingResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: NetworkingResultValues.Tag.Success, cleanup }; + } + case NetworkingResultValues.Tag.Failure: { + tmpParamInts.push((value.param1 | 0)); + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: NetworkingResultValues.Tag.Failure, cleanup }; + } + default: throw new Error("Unknown NetworkingResultValues tag: " + String(enumTag)); + } + }, + lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + tag = tag | 0; + switch (tag) { + case NetworkingResultValues.Tag.Success: { + const string = tmpRetStrings.pop(); + return { tag: NetworkingResultValues.Tag.Success, param0: string }; + } + case NetworkingResultValues.Tag.Failure: { + const int = tmpRetInts.pop(); + const string = tmpRetStrings.pop(); + return { tag: NetworkingResultValues.Tag.Failure, param0: string, param1: int }; + } + default: throw new Error("Unknown NetworkingResultValues tag returned from Swift: " + String(tag)); + } + } + }); + }; + const __bjs_createAPIOptionalResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case APIOptionalResultValues.Tag.Success: { + const isSome = value.param0 != null; + let id; + if (isSome) { + let bytes = textEncoder.encode(value.param0); + id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + } else { + tmpParamInts.push(0); + tmpParamInts.push(0); + } + tmpParamInts.push(isSome ? 1 : 0); + const cleanup = () => { + if(id) { + swift.memory.release(id); + } + }; + return { caseId: APIOptionalResultValues.Tag.Success, cleanup }; + } + case APIOptionalResultValues.Tag.Failure: { + const isSome = value.param1 != null; + tmpParamInts.push(isSome ? (value.param1 ? 1 : 0) : 0); + tmpParamInts.push(isSome ? 1 : 0); + const isSome1 = value.param0 != null; + tmpParamInts.push(isSome1 ? (value.param0 | 0) : 0); + tmpParamInts.push(isSome1 ? 1 : 0); + const cleanup = undefined; + return { caseId: APIOptionalResultValues.Tag.Failure, cleanup }; + } + case APIOptionalResultValues.Tag.Status: { + const isSome = value.param2 != null; + let id; + if (isSome) { + let bytes = textEncoder.encode(value.param2); + id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + } else { + tmpParamInts.push(0); + tmpParamInts.push(0); + } + tmpParamInts.push(isSome ? 1 : 0); + const isSome1 = value.param1 != null; + tmpParamInts.push(isSome1 ? (value.param1 | 0) : 0); + tmpParamInts.push(isSome1 ? 1 : 0); + const isSome2 = value.param0 != null; + tmpParamInts.push(isSome2 ? (value.param0 ? 1 : 0) : 0); + tmpParamInts.push(isSome2 ? 1 : 0); + const cleanup = () => { + if(id) { + swift.memory.release(id); + } + }; + return { caseId: APIOptionalResultValues.Tag.Status, cleanup }; + } + default: throw new Error("Unknown APIOptionalResultValues tag: " + String(enumTag)); + } + }, + lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + tag = tag | 0; + switch (tag) { + case APIOptionalResultValues.Tag.Success: { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const string = tmpRetStrings.pop(); + optional = string; + } else { + optional = null; + } + return { tag: APIOptionalResultValues.Tag.Success, param0: optional }; + } + case APIOptionalResultValues.Tag.Failure: { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const bool = tmpRetInts.pop() !== 0; + optional = bool; + } else { + optional = null; + } + const isSome1 = tmpRetInts.pop(); + let optional1; + if (isSome1) { + const int = tmpRetInts.pop(); + optional1 = int; + } else { + optional1 = null; + } + return { tag: APIOptionalResultValues.Tag.Failure, param0: optional1, param1: optional }; + } + case APIOptionalResultValues.Tag.Status: { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const string = tmpRetStrings.pop(); + optional = string; + } else { + optional = null; + } + const isSome1 = tmpRetInts.pop(); + let optional1; + if (isSome1) { + const int = tmpRetInts.pop(); + optional1 = int; + } else { + optional1 = null; + } + const isSome2 = tmpRetInts.pop(); + let optional2; + if (isSome2) { + const bool = tmpRetInts.pop() !== 0; + optional2 = bool; + } else { + optional2 = null; + } + return { tag: APIOptionalResultValues.Tag.Status, param0: optional2, param1: optional1, param2: optional }; + } + default: throw new Error("Unknown APIOptionalResultValues tag returned from Swift: " + String(tag)); + } + } + }); + }; + const __bjs_createTypedPayloadResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case TypedPayloadResultValues.Tag.Precision: { + tmpParamF32s.push(Math.fround(value.param0)); + const cleanup = undefined; + return { caseId: TypedPayloadResultValues.Tag.Precision, cleanup }; + } + case TypedPayloadResultValues.Tag.Direction: { + tmpParamInts.push((value.param0 | 0)); + const cleanup = undefined; + return { caseId: TypedPayloadResultValues.Tag.Direction, cleanup }; + } + case TypedPayloadResultValues.Tag.OptPrecision: { + const isSome = value.param0 != null; + tmpParamF32s.push(isSome ? Math.fround(value.param0) : 0.0); + tmpParamInts.push(isSome ? 1 : 0); + const cleanup = undefined; + return { caseId: TypedPayloadResultValues.Tag.OptPrecision, cleanup }; + } + case TypedPayloadResultValues.Tag.OptDirection: { + const isSome = value.param0 != null; + tmpParamInts.push(isSome ? (value.param0 | 0) : 0); + tmpParamInts.push(isSome ? 1 : 0); + const cleanup = undefined; + return { caseId: TypedPayloadResultValues.Tag.OptDirection, cleanup }; + } + case TypedPayloadResultValues.Tag.Empty: { + const cleanup = undefined; + return { caseId: TypedPayloadResultValues.Tag.Empty, cleanup }; + } + default: throw new Error("Unknown TypedPayloadResultValues tag: " + String(enumTag)); + } + }, + lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + tag = tag | 0; + switch (tag) { + case TypedPayloadResultValues.Tag.Precision: { + const rawValue = tmpRetF32s.pop(); + return { tag: TypedPayloadResultValues.Tag.Precision, param0: rawValue }; + } + case TypedPayloadResultValues.Tag.Direction: { + const caseId = tmpRetInts.pop(); + return { tag: TypedPayloadResultValues.Tag.Direction, param0: caseId }; + } + case TypedPayloadResultValues.Tag.OptPrecision: { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const rawValue = tmpRetF32s.pop(); + optional = rawValue; + } else { + optional = null; + } + return { tag: TypedPayloadResultValues.Tag.OptPrecision, param0: optional }; + } + case TypedPayloadResultValues.Tag.OptDirection: { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const caseId = tmpRetInts.pop(); + optional = caseId; + } else { + optional = null; + } + return { tag: TypedPayloadResultValues.Tag.OptDirection, param0: optional }; + } + case TypedPayloadResultValues.Tag.Empty: return { tag: TypedPayloadResultValues.Tag.Empty }; + default: throw new Error("Unknown TypedPayloadResultValues tag returned from Swift: " + String(tag)); + } + } + }); + }; + const __bjs_createAllTypesResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case AllTypesResultValues.Tag.StructPayload: { + const { cleanup: structCleanup } = structHelpers.Point.lower(value.param0); + const cleanup = () => { + if (structCleanup) { structCleanup(); } + }; + return { caseId: AllTypesResultValues.Tag.StructPayload, cleanup }; + } + case AllTypesResultValues.Tag.ClassPayload: { + tmpParamPointers.push(value.param0.pointer); + const cleanup = undefined; + return { caseId: AllTypesResultValues.Tag.ClassPayload, cleanup }; + } + case AllTypesResultValues.Tag.JsObjectPayload: { + const objId = swift.memory.retain(value.param0); + tmpParamInts.push(objId); + const cleanup = undefined; + return { caseId: AllTypesResultValues.Tag.JsObjectPayload, cleanup }; + } + case AllTypesResultValues.Tag.NestedEnum: { + const { caseId: caseId, cleanup: enumCleanup } = enumHelpers.APIResult.lower(value.param0); + tmpParamInts.push(caseId); + const cleanup = () => { + if (enumCleanup) { enumCleanup(); } + }; + return { caseId: AllTypesResultValues.Tag.NestedEnum, cleanup }; + } + case AllTypesResultValues.Tag.ArrayPayload: { + const arrayCleanups = []; + for (const elem of value.param0) { + tmpParamInts.push((elem | 0)); + } + tmpParamInts.push(value.param0.length); + const cleanup = () => { + for (const cleanup of arrayCleanups) { cleanup(); } + }; + return { caseId: AllTypesResultValues.Tag.ArrayPayload, cleanup }; + } + case AllTypesResultValues.Tag.Empty: { + const cleanup = undefined; + return { caseId: AllTypesResultValues.Tag.Empty, cleanup }; + } + default: throw new Error("Unknown AllTypesResultValues tag: " + String(enumTag)); + } + }, + lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + tag = tag | 0; + switch (tag) { + case AllTypesResultValues.Tag.StructPayload: { + const struct = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return { tag: AllTypesResultValues.Tag.StructPayload, param0: struct }; + } + case AllTypesResultValues.Tag.ClassPayload: { + const ptr = tmpRetPointers.pop(); + const obj = _exports['User'].__construct(ptr); + return { tag: AllTypesResultValues.Tag.ClassPayload, param0: obj }; + } + case AllTypesResultValues.Tag.JsObjectPayload: { + const objId = tmpRetInts.pop(); + const obj = swift.memory.getObject(objId); + swift.memory.release(objId); + return { tag: AllTypesResultValues.Tag.JsObjectPayload, param0: obj }; + } + case AllTypesResultValues.Tag.NestedEnum: { + const enumValue = enumHelpers.APIResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return { tag: AllTypesResultValues.Tag.NestedEnum, param0: enumValue }; + } + case AllTypesResultValues.Tag.ArrayPayload: { + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const int = tmpRetInts.pop(); + arrayResult.push(int); + } + arrayResult.reverse(); + return { tag: AllTypesResultValues.Tag.ArrayPayload, param0: arrayResult }; + } + case AllTypesResultValues.Tag.Empty: return { tag: AllTypesResultValues.Tag.Empty }; + default: throw new Error("Unknown AllTypesResultValues tag returned from Swift: " + String(tag)); + } + } + }); + }; + const __bjs_createOptionalAllTypesResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case OptionalAllTypesResultValues.Tag.OptStruct: { + const isSome = value.param0 != null; + let nestedCleanup; + if (isSome) { + const structResult = structHelpers.Point.lower(value.param0); + nestedCleanup = structResult.cleanup; + } + tmpParamInts.push(isSome ? 1 : 0); + const cleanup = () => { + if (nestedCleanup) { nestedCleanup(); } + }; + return { caseId: OptionalAllTypesResultValues.Tag.OptStruct, cleanup }; + } + case OptionalAllTypesResultValues.Tag.OptClass: { + const isSome = value.param0 != null; + if (isSome) { + tmpParamPointers.push(value.param0.pointer); + } else { + tmpParamPointers.push(0); + } + tmpParamInts.push(isSome ? 1 : 0); + const cleanup = undefined; + return { caseId: OptionalAllTypesResultValues.Tag.OptClass, cleanup }; + } + case OptionalAllTypesResultValues.Tag.OptJSObject: { + const isSome = value.param0 != null; + let id; + if (isSome) { + id = swift.memory.retain(value.param0); + tmpParamInts.push(id); + } else { + id = undefined; + tmpParamInts.push(0); + } + tmpParamInts.push(isSome ? 1 : 0); + const cleanup = undefined; + return { caseId: OptionalAllTypesResultValues.Tag.OptJSObject, cleanup }; + } + case OptionalAllTypesResultValues.Tag.OptNestedEnum: { + const isSome = value.param0 != null; + let enumCaseId, enumCleanup; + if (isSome) { + const enumResult = enumHelpers.APIResult.lower(value.param0); + enumCaseId = enumResult.caseId; + enumCleanup = enumResult.cleanup; + tmpParamInts.push(enumCaseId); + } else { + tmpParamInts.push(0); + } + tmpParamInts.push(isSome ? 1 : 0); + const cleanup = () => { + if (enumCleanup) { enumCleanup(); } + }; + return { caseId: OptionalAllTypesResultValues.Tag.OptNestedEnum, cleanup }; + } + case OptionalAllTypesResultValues.Tag.OptArray: { + const isSome = value.param0 != null; + let arrCleanup; + if (isSome) { + const arrayCleanups = []; + for (const elem of value.param0) { + tmpParamInts.push((elem | 0)); + } + tmpParamInts.push(value.param0.length); + arrCleanup = () => { + for (const cleanup of arrayCleanups) { cleanup(); } + }; + } + tmpParamInts.push(isSome ? 1 : 0); + const cleanup = () => { + if (arrCleanup) { arrCleanup(); } + }; + return { caseId: OptionalAllTypesResultValues.Tag.OptArray, cleanup }; + } + case OptionalAllTypesResultValues.Tag.Empty: { + const cleanup = undefined; + return { caseId: OptionalAllTypesResultValues.Tag.Empty, cleanup }; + } + default: throw new Error("Unknown OptionalAllTypesResultValues tag: " + String(enumTag)); + } + }, + lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + tag = tag | 0; + switch (tag) { + case OptionalAllTypesResultValues.Tag.OptStruct: { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const struct = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optional = struct; + } else { + optional = null; + } + return { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: optional }; + } + case OptionalAllTypesResultValues.Tag.OptClass: { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const ptr = tmpRetPointers.pop(); + const obj = _exports['User'].__construct(ptr); + optional = obj; + } else { + optional = null; + } + return { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: optional }; + } + case OptionalAllTypesResultValues.Tag.OptJSObject: { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const objId = tmpRetInts.pop(); + const obj = swift.memory.getObject(objId); + swift.memory.release(objId); + optional = obj; + } else { + optional = null; + } + return { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: optional }; + } + case OptionalAllTypesResultValues.Tag.OptNestedEnum: { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const caseId = tmpRetInts.pop(); + optional = enumHelpers.APIResult.lift(caseId, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + } else { + optional = null; + } + return { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: optional }; + } + case OptionalAllTypesResultValues.Tag.OptArray: { + const isSome = tmpRetInts.pop(); + let optional; + if (isSome) { + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const int = tmpRetInts.pop(); + arrayResult.push(int); + } + arrayResult.reverse(); + optional = arrayResult; + } else { + optional = null; + } + return { tag: OptionalAllTypesResultValues.Tag.OptArray, param0: optional }; + } + case OptionalAllTypesResultValues.Tag.Empty: return { tag: OptionalAllTypesResultValues.Tag.Empty }; + default: throw new Error("Unknown OptionalAllTypesResultValues tag returned from Swift: " + String(tag)); + } + } + }); + }; return { /** @@ -545,7 +916,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); @@ -586,6 +957,17 @@ export async function createInstantiator(options, swift) { tmpStructCleanups.pop(); } } + bjs["swift_js_struct_lower_Point"] = function(objectId) { + const { cleanup: cleanup } = structHelpers.Point.lower(swift.memory.getObject(objectId)); + if (cleanup) { + return tmpStructCleanups.push(cleanup); + } + return 0; + } + bjs["swift_js_struct_lift_Point"] = function() { + const value = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + return swift.memory.retain(value); + } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; @@ -676,34 +1058,80 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_User_wrap"] = function(pointer) { + const obj = User.__construct(pointer); + return swift.memory.retain(obj); + }; }, setInstance: (i) => { instance = i; memory = instance.exports.memory; - const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class User extends SwiftHeapObject { + static __construct(ptr) { + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_User_deinit, User.prototype); + } + + } + const PointHelpers = __bjs_createPointHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + structHelpers.Point = PointHelpers; + + const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); enumHelpers.APIResult = APIResultHelpers; - const ComplexResultHelpers = __bjs_createComplexResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); + const ComplexResultHelpers = __bjs_createComplexResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); enumHelpers.ComplexResult = ComplexResultHelpers; - const ResultHelpers = __bjs_createResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); + const ResultHelpers = __bjs_createResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); enumHelpers.Result = ResultHelpers; - const NetworkingResultHelpers = __bjs_createNetworkingResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); + const NetworkingResultHelpers = __bjs_createNetworkingResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); enumHelpers.NetworkingResult = NetworkingResultHelpers; - const APIOptionalResultHelpers = __bjs_createAPIOptionalResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); + const APIOptionalResultHelpers = __bjs_createAPIOptionalResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); enumHelpers.APIOptionalResult = APIOptionalResultHelpers; - setException = (error) => { - instance.exports._swift_js_exception.value = swift.memory.retain(error) - } - }, - /** @param {WebAssembly.Instance} instance */ - createExports: (instance) => { - const js = swift.memory.heap; + const TypedPayloadResultHelpers = __bjs_createTypedPayloadResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + enumHelpers.TypedPayloadResult = TypedPayloadResultHelpers; + + const AllTypesResultHelpers = __bjs_createAllTypesResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + enumHelpers.AllTypesResult = AllTypesResultHelpers; + + const OptionalAllTypesResultHelpers = __bjs_createOptionalAllTypesResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + enumHelpers.OptionalAllTypesResult = OptionalAllTypesResultHelpers; + const exports = { + User, handle: function bjs_handle(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.APIResult.lower(result); instance.exports.bjs_handle(resultCaseId); @@ -711,13 +1139,13 @@ export async function createInstantiator(options, swift) { }, getResult: function bjs_getResult() { instance.exports.bjs_getResult(); - const ret = enumHelpers.APIResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const ret = enumHelpers.APIResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return ret; }, roundtripAPIResult: function bjs_roundtripAPIResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.APIResult.lower(result); instance.exports.bjs_roundtripAPIResult(resultCaseId); - const ret = enumHelpers.APIResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const ret = enumHelpers.APIResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -730,12 +1158,13 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalAPIResult(+isSome, isSome ? resultCaseId : 0); - const isNull = (tmpRetTag === -1); + const tag = tmpRetTag.pop(); + const isNull = (tag === -1); let optResult; if (isNull) { optResult = null; } else { - optResult = enumHelpers.APIResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + optResult = enumHelpers.APIResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -747,13 +1176,13 @@ export async function createInstantiator(options, swift) { }, getComplexResult: function bjs_getComplexResult() { instance.exports.bjs_getComplexResult(); - const ret = enumHelpers.ComplexResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const ret = enumHelpers.ComplexResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); return ret; }, roundtripComplexResult: function bjs_roundtripComplexResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.ComplexResult.lower(result); instance.exports.bjs_roundtripComplexResult(resultCaseId); - const ret = enumHelpers.ComplexResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const ret = enumHelpers.ComplexResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -766,12 +1195,13 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalComplexResult(+isSome, isSome ? resultCaseId : 0); - const isNull = (tmpRetTag === -1); + const tag = tmpRetTag.pop(); + const isNull = (tag === -1); let optResult; if (isNull) { optResult = null; } else { - optResult = enumHelpers.ComplexResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + optResult = enumHelpers.ComplexResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -785,12 +1215,13 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalUtilitiesResult(+isSome, isSome ? resultCaseId : 0); - const isNull = (tmpRetTag === -1); + const tag = tmpRetTag.pop(); + const isNull = (tag === -1); let optResult; if (isNull) { optResult = null; } else { - optResult = enumHelpers.Result.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + optResult = enumHelpers.Result.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -804,12 +1235,13 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalNetworkingResult(+isSome, isSome ? resultCaseId : 0); - const isNull = (tmpRetTag === -1); + const tag = tmpRetTag.pop(); + const isNull = (tag === -1); let optResult; if (isNull) { optResult = null; } else { - optResult = enumHelpers.NetworkingResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + optResult = enumHelpers.NetworkingResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -823,12 +1255,13 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalAPIOptionalResult(+isSome, isSome ? resultCaseId : 0); - const isNull = (tmpRetTag === -1); + const tag = tmpRetTag.pop(); + const isNull = (tag === -1); let optResult; if (isNull) { optResult = null; } else { - optResult = enumHelpers.APIOptionalResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + optResult = enumHelpers.APIOptionalResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -849,20 +1282,107 @@ export async function createInstantiator(options, swift) { result2Cleanup = enumResult1.cleanup; } instance.exports.bjs_compareAPIResults(+isSome, isSome ? result1CaseId : 0, +isSome1, isSome1 ? result2CaseId : 0); - const isNull = (tmpRetTag === -1); + const tag = tmpRetTag.pop(); + const isNull = (tag === -1); let optResult; if (isNull) { optResult = null; } else { - optResult = enumHelpers.APIOptionalResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + optResult = enumHelpers.APIOptionalResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); } if (result1Cleanup) { result1Cleanup(); } if (result2Cleanup) { result2Cleanup(); } return optResult; }, + roundTripTypedPayloadResult: function bjs_roundTripTypedPayloadResult(result) { + const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.TypedPayloadResult.lower(result); + instance.exports.bjs_roundTripTypedPayloadResult(resultCaseId); + const ret = enumHelpers.TypedPayloadResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + if (resultCleanup) { resultCleanup(); } + return ret; + }, + roundTripOptionalTypedPayloadResult: function bjs_roundTripOptionalTypedPayloadResult(result) { + const isSome = result != null; + let resultCaseId, resultCleanup; + if (isSome) { + const enumResult = enumHelpers.TypedPayloadResult.lower(result); + resultCaseId = enumResult.caseId; + resultCleanup = enumResult.cleanup; + } + instance.exports.bjs_roundTripOptionalTypedPayloadResult(+isSome, isSome ? resultCaseId : 0); + const tag = tmpRetTag.pop(); + const isNull = (tag === -1); + let optResult; + if (isNull) { + optResult = null; + } else { + optResult = enumHelpers.TypedPayloadResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + } + if (resultCleanup) { resultCleanup(); } + return optResult; + }, + roundTripAllTypesResult: function bjs_roundTripAllTypesResult(result) { + const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.AllTypesResult.lower(result); + instance.exports.bjs_roundTripAllTypesResult(resultCaseId); + const ret = enumHelpers.AllTypesResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + if (resultCleanup) { resultCleanup(); } + return ret; + }, + roundTripOptionalAllTypesResult: function bjs_roundTripOptionalAllTypesResult(result) { + const isSome = result != null; + let resultCaseId, resultCleanup; + if (isSome) { + const enumResult = enumHelpers.AllTypesResult.lower(result); + resultCaseId = enumResult.caseId; + resultCleanup = enumResult.cleanup; + } + instance.exports.bjs_roundTripOptionalAllTypesResult(+isSome, isSome ? resultCaseId : 0); + const tag = tmpRetTag.pop(); + const isNull = (tag === -1); + let optResult; + if (isNull) { + optResult = null; + } else { + optResult = enumHelpers.AllTypesResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + } + if (resultCleanup) { resultCleanup(); } + return optResult; + }, + roundTripOptionalPayloadResult: function bjs_roundTripOptionalPayloadResult(result) { + const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.OptionalAllTypesResult.lower(result); + instance.exports.bjs_roundTripOptionalPayloadResult(resultCaseId); + const ret = enumHelpers.OptionalAllTypesResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + if (resultCleanup) { resultCleanup(); } + return ret; + }, + roundTripOptionalPayloadResultOpt: function bjs_roundTripOptionalPayloadResultOpt(result) { + const isSome = result != null; + let resultCaseId, resultCleanup; + if (isSome) { + const enumResult = enumHelpers.OptionalAllTypesResult.lower(result); + resultCaseId = enumResult.caseId; + resultCleanup = enumResult.cleanup; + } + instance.exports.bjs_roundTripOptionalPayloadResultOpt(+isSome, isSome ? resultCaseId : 0); + const tag = tmpRetTag.pop(); + const isNull = (tag === -1); + let optResult; + if (isNull) { + optResult = null; + } else { + optResult = enumHelpers.OptionalAllTypesResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + } + if (resultCleanup) { resultCleanup(); } + return optResult; + }, APIResult: APIResultValues, ComplexResult: ComplexResultValues, APIOptionalResult: APIOptionalResultValues, + Precision: PrecisionValues, + CardinalDirection: CardinalDirectionValues, + TypedPayloadResult: TypedPayloadResultValues, + AllTypesResult: AllTypesResultValues, + OptionalAllTypesResult: OptionalAllTypesResultValues, API: { NetworkingResult: NetworkingResultValues, }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js index 874b4c4c0..9ca596a6e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js @@ -42,7 +42,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -94,7 +94,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index 78f08ffb5..a7a2c4b98 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -62,7 +62,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -114,7 +114,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index cddeac767..b195b6945 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -43,7 +43,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -95,7 +95,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index 315b74262..c906f27ff 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -93,7 +93,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -146,7 +146,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js index b5053b266..ac6170b08 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -71,7 +71,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js index 0d9eb79c3..dc2220715 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -70,7 +70,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index 11aa2b3d8..efcbbe2d6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -135,7 +135,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js index 6a11003b3..d64ff7e96 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -71,7 +71,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js index b60a698b4..096e3a345 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -71,7 +71,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index 214a32294..cacaa87a3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -71,7 +71,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index f272b0ff0..2bd696c3d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -160,7 +160,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index e1345f94b..4ac3b11b7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -70,7 +70,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index 0703be789..9eb55f30b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -70,7 +70,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index 0cc377f4c..e81a95669 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -70,7 +70,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index 630651aea..c8d0b935e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -70,7 +70,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index b3073da70..bb2c93649 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -70,7 +70,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 27e9c3c6b..341fcd966 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -71,7 +71,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js index 98f50e850..2d754a5c3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -71,7 +71,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js index e68e4e6a2..f348869b2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -71,7 +71,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index 7bf565105..7be6cd924 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -70,7 +70,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index ce9065ac4..7c20130b3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -22,46 +22,6 @@ export const ResultValues = { Failure: 1, }, }; - -const __bjs_createResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift) => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case ResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - const cleanup = () => { - swift.memory.release(id); - }; - return { caseId: ResultValues.Tag.Success, cleanup }; - } - case ResultValues.Tag.Failure: { - tmpParamInts.push((value.param0 | 0)); - const cleanup = undefined; - return { caseId: ResultValues.Tag.Failure, cleanup }; - } - default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); - } - }, - lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { - const tag = tmpRetTag | 0; - switch (tag) { - case ResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); - return { tag: ResultValues.Tag.Success, param0: string }; - } - case ResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); - return { tag: ResultValues.Tag.Failure, param0: int }; - } - default: throw new Error("Unknown ResultValues tag returned from Swift: " + String(tag)); - } - } - }); -}; export const PriorityValues = { Low: -1, Medium: 0, @@ -82,7 +42,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -98,6 +58,45 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const __bjs_createResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case ResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: ResultValues.Tag.Success, cleanup }; + } + case ResultValues.Tag.Failure: { + tmpParamInts.push((value.param0 | 0)); + const cleanup = undefined; + return { caseId: ResultValues.Tag.Failure, cleanup }; + } + default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); + } + }, + lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + tag = tag | 0; + switch (tag) { + case ResultValues.Tag.Success: { + const string = tmpRetStrings.pop(); + return { tag: ResultValues.Tag.Success, param0: string }; + } + case ResultValues.Tag.Failure: { + const int = tmpRetInts.pop(); + return { tag: ResultValues.Tag.Failure, param0: int }; + } + default: throw new Error("Unknown ResultValues tag returned from Swift: " + String(tag)); + } + } + }); + }; return { /** @@ -134,7 +133,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); @@ -376,7 +375,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_result_set"] = function bjs_MyViewControllerDelegate_result_set(self, value) { try { - const enumValue = enumHelpers.Result.lift(value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const enumValue = enumHelpers.Result.lift(value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); swift.memory.getObject(self).result = enumValue; } catch (error) { setException(error); @@ -400,7 +399,7 @@ export async function createInstantiator(options, swift) { try { let enumValue; if (valueIsSome) { - enumValue = enumHelpers.Result.lift(valueWrappedValue, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + enumValue = enumHelpers.Result.lift(valueWrappedValue, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); } swift.memory.getObject(self).optionalResult = valueIsSome ? enumValue : null; } catch (error) { @@ -557,7 +556,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_handleResult"] = function bjs_MyViewControllerDelegate_handleResult(self, result) { try { - const enumValue = enumHelpers.Result.lift(result, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const enumValue = enumHelpers.Result.lift(result, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); swift.memory.getObject(self).handleResult(enumValue); } catch (error) { setException(error); @@ -577,9 +576,6 @@ export async function createInstantiator(options, swift) { instance = i; memory = instance.exports.memory; - const ResultHelpers = __bjs_createResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); - enumHelpers.Result = ResultHelpers; - setException = (error) => { instance.exports._swift_js_exception.value = swift.memory.retain(error) } @@ -727,6 +723,9 @@ export async function createInstantiator(options, swift) { for (const cleanup of arrayCleanups) { cleanup(); } } } + const ResultHelpers = __bjs_createResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + enumHelpers.Result = ResultHelpers; + const exports = { Helper, MyViewController, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index b79c6ebf4..391c7167e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -15,46 +15,6 @@ export const APIResultValues = { Failure: 1, }, }; - -const __bjs_createAPIResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift) => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case APIResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - const cleanup = () => { - swift.memory.release(id); - }; - return { caseId: APIResultValues.Tag.Success, cleanup }; - } - case APIResultValues.Tag.Failure: { - tmpParamInts.push((value.param0 | 0)); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Failure, cleanup }; - } - default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); - } - }, - lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { - const tag = tmpRetTag | 0; - switch (tag) { - case APIResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); - return { tag: APIResultValues.Tag.Success, param0: string }; - } - case APIResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); - return { tag: APIResultValues.Tag.Failure, param0: int }; - } - default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); - } - } - }); -}; export async function createInstantiator(options, swift) { let instance; let memory; @@ -69,7 +29,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -85,6 +45,45 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const __bjs_createAPIResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case APIResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: APIResultValues.Tag.Success, cleanup }; + } + case APIResultValues.Tag.Failure: { + tmpParamInts.push((value.param0 | 0)); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Failure, cleanup }; + } + default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); + } + }, + lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + tag = tag | 0; + switch (tag) { + case APIResultValues.Tag.Success: { + const string = tmpRetStrings.pop(); + return { tag: APIResultValues.Tag.Success, param0: string }; + } + case APIResultValues.Tag.Failure: { + const int = tmpRetInts.pop(); + return { tag: APIResultValues.Tag.Failure, param0: int }; + } + default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); + } + } + }); + }; return { /** @@ -121,7 +120,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); @@ -265,9 +264,6 @@ export async function createInstantiator(options, swift) { instance = i; memory = instance.exports.memory; - const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); - enumHelpers.APIResult = APIResultHelpers; - setException = (error) => { instance.exports._swift_js_exception.value = swift.memory.retain(error) } @@ -316,6 +312,9 @@ export async function createInstantiator(options, swift) { return ret; } } + const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + enumHelpers.APIResult = APIResultHelpers; + if (typeof globalThis.Utils === 'undefined') { globalThis.Utils = {}; } @@ -336,7 +335,7 @@ export async function createInstantiator(options, swift) { roundtrip: function(value) { const { caseId: valueCaseId, cleanup: valueCleanup } = enumHelpers.APIResult.lower(value); instance.exports.bjs_APIResult_static_roundtrip(valueCaseId); - const ret = enumHelpers.APIResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const ret = enumHelpers.APIResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); if (valueCleanup) { valueCleanup(); } return ret; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index 2f240c428..b38668c57 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -15,46 +15,6 @@ export const APIResultValues = { Failure: 1, }, }; - -const __bjs_createAPIResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift) => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case APIResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - const cleanup = () => { - swift.memory.release(id); - }; - return { caseId: APIResultValues.Tag.Success, cleanup }; - } - case APIResultValues.Tag.Failure: { - tmpParamInts.push((value.param0 | 0)); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Failure, cleanup }; - } - default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); - } - }, - lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { - const tag = tmpRetTag | 0; - switch (tag) { - case APIResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); - return { tag: APIResultValues.Tag.Success, param0: string }; - } - case APIResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); - return { tag: APIResultValues.Tag.Failure, param0: int }; - } - default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); - } - } - }); -}; export async function createInstantiator(options, swift) { let instance; let memory; @@ -69,7 +29,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -85,6 +45,45 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const __bjs_createAPIResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case APIResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: APIResultValues.Tag.Success, cleanup }; + } + case APIResultValues.Tag.Failure: { + tmpParamInts.push((value.param0 | 0)); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Failure, cleanup }; + } + default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); + } + }, + lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + tag = tag | 0; + switch (tag) { + case APIResultValues.Tag.Success: { + const string = tmpRetStrings.pop(); + return { tag: APIResultValues.Tag.Success, param0: string }; + } + case APIResultValues.Tag.Failure: { + const int = tmpRetInts.pop(); + return { tag: APIResultValues.Tag.Failure, param0: int }; + } + default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); + } + } + }); + }; return { /** @@ -121,7 +120,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); @@ -265,9 +264,6 @@ export async function createInstantiator(options, swift) { instance = i; memory = instance.exports.memory; - const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); - enumHelpers.APIResult = APIResultHelpers; - setException = (error) => { instance.exports._swift_js_exception.value = swift.memory.retain(error) } @@ -316,6 +312,9 @@ export async function createInstantiator(options, swift) { return ret; } } + const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + enumHelpers.APIResult = APIResultHelpers; + const exports = { MathUtils, Calculator: { @@ -330,7 +329,7 @@ export async function createInstantiator(options, swift) { roundtrip: function(value) { const { caseId: valueCaseId, cleanup: valueCleanup } = enumHelpers.APIResult.lower(value); instance.exports.bjs_APIResult_static_roundtrip(valueCaseId); - const ret = enumHelpers.APIResult.lift(tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + const ret = enumHelpers.APIResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); if (valueCleanup) { valueCleanup(); } return ret; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index 15edf8c60..293ae4f7d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -23,7 +23,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -75,7 +75,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index d90e96f0e..27e3df464 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -23,7 +23,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -75,7 +75,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js index fc67c0027..e57c5153d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -71,7 +71,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js index 50edf3b06..74d140236 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -71,7 +71,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index f3d5cafcb..27398d2a4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -70,7 +70,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 59512a7eb..ff5af72f9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -34,78 +34,6 @@ export const APIResultValues = { Info: 5, }, }; - -const __bjs_createAPIResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift) => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case APIResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - const cleanup = () => { - swift.memory.release(id); - }; - return { caseId: APIResultValues.Tag.Success, cleanup }; - } - case APIResultValues.Tag.Failure: { - tmpParamInts.push((value.param0 | 0)); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Failure, cleanup }; - } - case APIResultValues.Tag.Flag: { - tmpParamInts.push(value.param0 ? 1 : 0); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Flag, cleanup }; - } - case APIResultValues.Tag.Rate: { - tmpParamF32s.push(Math.fround(value.param0)); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Rate, cleanup }; - } - case APIResultValues.Tag.Precise: { - tmpParamF64s.push(value.param0); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Precise, cleanup }; - } - case APIResultValues.Tag.Info: { - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Info, cleanup }; - } - default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); - } - }, - lift: (tmpRetTag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s) => { - const tag = tmpRetTag | 0; - switch (tag) { - case APIResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); - return { tag: APIResultValues.Tag.Success, param0: string }; - } - case APIResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); - return { tag: APIResultValues.Tag.Failure, param0: int }; - } - case APIResultValues.Tag.Flag: { - const bool = tmpRetInts.pop(); - return { tag: APIResultValues.Tag.Flag, param0: bool }; - } - case APIResultValues.Tag.Rate: { - const f32 = tmpRetF32s.pop(); - return { tag: APIResultValues.Tag.Rate, param0: f32 }; - } - case APIResultValues.Tag.Precise: { - const f64 = tmpRetF64s.pop(); - return { tag: APIResultValues.Tag.Precise, param0: f64 }; - } - case APIResultValues.Tag.Info: return { tag: APIResultValues.Tag.Info }; - default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); - } - } - }); -}; export async function createInstantiator(options, swift) { let instance; let memory; @@ -120,7 +48,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -136,6 +64,77 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const __bjs_createAPIResultValuesHelpers = () => { + return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case APIResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + const cleanup = () => { + swift.memory.release(id); + }; + return { caseId: APIResultValues.Tag.Success, cleanup }; + } + case APIResultValues.Tag.Failure: { + tmpParamInts.push((value.param0 | 0)); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Failure, cleanup }; + } + case APIResultValues.Tag.Flag: { + tmpParamInts.push(value.param0 ? 1 : 0); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Flag, cleanup }; + } + case APIResultValues.Tag.Rate: { + tmpParamF32s.push(Math.fround(value.param0)); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Rate, cleanup }; + } + case APIResultValues.Tag.Precise: { + tmpParamF64s.push(value.param0); + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Precise, cleanup }; + } + case APIResultValues.Tag.Info: { + const cleanup = undefined; + return { caseId: APIResultValues.Tag.Info, cleanup }; + } + default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); + } + }, + lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + tag = tag | 0; + switch (tag) { + case APIResultValues.Tag.Success: { + const string = tmpRetStrings.pop(); + return { tag: APIResultValues.Tag.Success, param0: string }; + } + case APIResultValues.Tag.Failure: { + const int = tmpRetInts.pop(); + return { tag: APIResultValues.Tag.Failure, param0: int }; + } + case APIResultValues.Tag.Flag: { + const bool = tmpRetInts.pop() !== 0; + return { tag: APIResultValues.Tag.Flag, param0: bool }; + } + case APIResultValues.Tag.Rate: { + const f32 = tmpRetF32s.pop(); + return { tag: APIResultValues.Tag.Rate, param0: f32 }; + } + case APIResultValues.Tag.Precise: { + const f64 = tmpRetF64s.pop(); + return { tag: APIResultValues.Tag.Precise, param0: f64 }; + } + case APIResultValues.Tag.Info: return { tag: APIResultValues.Tag.Info }; + default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); + } + } + }); + }; return { /** @@ -172,7 +171,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); @@ -423,7 +422,7 @@ export async function createInstantiator(options, swift) { bjs["invoke_js_callback_TestModule_10TestModule9APIResultO_SS"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - let param0 = enumHelpers.APIResult.lift(param0Id, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + let param0 = enumHelpers.APIResult.lift(param0Id, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); const result = callback(param0); if (typeof result !== "string") { throw new TypeError("Callback must return a string"); @@ -685,7 +684,7 @@ export async function createInstantiator(options, swift) { const callback = swift.memory.getObject(callbackId); let param0; if (param0IsSome) { - param0 = enumHelpers.APIResult.lift(param0Value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s); + param0 = enumHelpers.APIResult.lift(param0Value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); } else { param0 = null; } @@ -776,9 +775,6 @@ export async function createInstantiator(options, swift) { instance = i; memory = instance.exports.memory; - const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); - enumHelpers.APIResult = APIResultHelpers; - setException = (error) => { instance.exports._swift_js_exception.value = swift.memory.retain(error) } @@ -930,6 +926,9 @@ export async function createInstantiator(options, swift) { return bjs["lower_closure_TestModule_10TestModuleSq9DirectionO_SS"](ret); } } + const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + enumHelpers.APIResult = APIResultHelpers; + const exports = { Person, TestProcessor, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index 145eeb756..52e12ef7c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -71,7 +71,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index f389900dc..adbe18856 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -23,7 +23,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -183,9 +183,9 @@ export async function createInstantiator(options, swift) { }, lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { const ptr = tmpRetPointers.pop(); - const value = _exports['Greeter'].__construct(ptr); + const obj = _exports['Greeter'].__construct(ptr); const int = tmpRetInts.pop(); - return { id: int, owner: value }; + return { id: int, owner: obj }; } }); }; @@ -207,14 +207,14 @@ export async function createInstantiator(options, swift) { const isSome = tmpRetInts.pop(); let optional; if (isSome) { - const value = tmpRetF32s.pop(); - optional = value; + const rawValue = tmpRetF32s.pop(); + optional = rawValue; } else { optional = null; } - const value1 = tmpRetF32s.pop(); + const rawValue1 = tmpRetF32s.pop(); const f64 = tmpRetF64s.pop(); - return { value: f64, precision: value1, optionalPrecision: optional }; + return { value: f64, precision: rawValue1, optionalPrecision: optional }; } }); }; @@ -328,7 +328,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index afed321ce..8f90491df 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -85,7 +85,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js index 8a1c49647..2e2f8bf6a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -70,7 +70,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index 61f6c6cf3..bbeeffa0d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -90,7 +90,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js index 053c55672..45374093b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js @@ -18,7 +18,7 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag; + let tmpRetTag = []; let tmpRetStrings = []; let tmpRetInts = []; let tmpRetF32s = []; @@ -71,7 +71,7 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag = tag; + tmpRetTag.push(tag); } bjs["swift_js_push_i32"] = function(v) { tmpRetInts.push(v | 0); diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Enum.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Enum.md index 3dda2b9c5..6fb3afeda 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Enum.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Enum.md @@ -509,8 +509,9 @@ This differs from classes, which use reference semantics and share state across | Static functions | ✅ | | Static properties | ✅ | | Associated values: `String`, `Int`, `Bool`, `Float`, `Double` | ✅ | -| Associated values: Custom classes/structs | ❌ | -| Associated values: Other enums | ❌ | -| Associated values: Arrays/Collections | ❌ | -| Associated values: Optionals | ❌ | +| Associated values: Custom classes/structs | ✅ | +| Associated values: Other enums (case, raw value, and associated value) | ✅ | +| Associated values: `JSObject` | ✅ | +| Associated values: Arrays | ✅ | +| Associated values: Optionals of all supported types | ✅ | | Generics | ❌ | diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 345f5dbcf..fe73ea6fb 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -586,6 +586,22 @@ typealias OptionalAge = Int? return value } +@JS enum TypedPayloadResult { + case precision(Precision) + case direction(Direction) + case optPrecision(Precision?) + case optDirection(Direction?) + case empty +} + +@JS func roundTripTypedPayloadResult(_ result: TypedPayloadResult) -> TypedPayloadResult { + return result +} + +@JS func roundTripOptionalTypedPayloadResult(_ result: TypedPayloadResult?) -> TypedPayloadResult? { + return result +} + @JS func compareAPIResults(_ r1: APIResult?, _ r2: APIResult?) -> String { let r1Str: String switch r1 { @@ -616,6 +632,44 @@ typealias OptionalAge = Int? return result } +@JS +enum AllTypesResult { + case structPayload(Address) + case classPayload(Greeter) + case jsObjectPayload(JSObject) + case nestedEnum(APIResult) + case arrayPayload([Int]) + case jsClassPayload(Foo) + case empty +} + +@JS func roundTripAllTypesResult(_ result: AllTypesResult) -> AllTypesResult { + return result +} + +@JS func roundTripOptionalAllTypesResult(_ result: AllTypesResult?) -> AllTypesResult? { + return result +} + +@JS +enum OptionalAllTypesResult { + case optStruct(Address?) + case optClass(Greeter?) + case optJSObject(JSObject?) + case optNestedEnum(APIResult?) + case optArray([Int]?) + case optJsClass(Foo?) + case empty +} + +@JS func roundTripOptionalPayloadResult(_ result: OptionalAllTypesResult) -> OptionalAllTypesResult { + return result +} + +@JS func roundTripOptionalPayloadResultOpt(_ result: OptionalAllTypesResult?) -> OptionalAllTypesResult? { + return result +} + @JS func roundTripOptionalClass(value: Greeter?) -> Greeter? { return value } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index ee9f97508..0e06c7edc 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -1561,20 +1561,20 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .failure(let param0): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) case .flag(let param0): - _swift_js_push_tag(Int32(2)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(2)) case .rate(let param0): - _swift_js_push_tag(Int32(3)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(3)) case .precise(let param0): - _swift_js_push_tag(Int32(4)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(4)) case .info: _swift_js_push_tag(Int32(5)) } @@ -1658,29 +1658,28 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .error(let param0, let param1): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) case .location(let param0, let param1, let param2): - _swift_js_push_tag(Int32(2)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(2)) case .status(let param0, let param1, let param2): - _swift_js_push_tag(Int32(3)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(3)) case .coordinates(let param0, let param1, let param2): - _swift_js_push_tag(Int32(4)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(4)) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - _swift_js_push_tag(Int32(5)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() @@ -1690,6 +1689,7 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { param6.bridgeJSLowerStackReturn() param7.bridgeJSLowerStackReturn() param8.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(5)) case .info: _swift_js_push_tag(Int32(6)) } @@ -1742,17 +1742,17 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .failure(let param0, let param1): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) case .status(let param0, let param1, let param2): - _swift_js_push_tag(Int32(2)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(2)) } } } @@ -1796,12 +1796,324 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) case .failure(let param0, let param1): - _swift_js_push_tag(Int32(1)) param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) + } + } +} + +extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> TypedPayloadResult { + switch caseId { + case 0: + return .precision(Precision.bridgeJSLiftParameter(_swift_js_pop_f32())) + case 1: + return .direction(Direction.bridgeJSLiftParameter(_swift_js_pop_i32())) + case 2: + return .optPrecision(Optional.bridgeJSLiftParameter()) + case 3: + return .optDirection(Optional.bridgeJSLiftParameter()) + case 4: + return .empty + default: + fatalError("Unknown TypedPayloadResult case ID: \(caseId)") + } + } + + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .precision(let param0): + param0.bridgeJSLowerStackReturn() + return Int32(0) + case .direction(let param0): + param0.bridgeJSLowerStackReturn() + return Int32(1) + case .optPrecision(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(2) + case .optDirection(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(3) + case .empty: + return Int32(4) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> TypedPayloadResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> TypedPayloadResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + switch self { + case .precision(let param0): + param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(0)) + case .direction(let param0): + param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) + case .optPrecision(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(2)) + case .optDirection(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(3)) + case .empty: + _swift_js_push_tag(Int32(4)) + } + } +} + +extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> AllTypesResult { + switch caseId { + case 0: + return .structPayload(Address.bridgeJSLiftParameter()) + case 1: + return .classPayload(Greeter.bridgeJSLiftParameter()) + case 2: + return .jsObjectPayload(JSObject.bridgeJSLiftParameter()) + case 3: + return .nestedEnum(APIResult.bridgeJSLiftParameter(_swift_js_pop_i32())) + case 4: + return .arrayPayload([Int].bridgeJSLiftParameter()) + case 5: + return .jsClassPayload(Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter())) + case 6: + return .empty + default: + fatalError("Unknown AllTypesResult case ID: \(caseId)") + } + } + + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .structPayload(let param0): + param0.bridgeJSLowerReturn() + return Int32(0) + case .classPayload(let param0): + param0.bridgeJSLowerStackReturn() + return Int32(1) + case .jsObjectPayload(let param0): + param0.bridgeJSLowerStackReturn() + return Int32(2) + case .nestedEnum(let param0): + param0.bridgeJSLowerReturn() + return Int32(3) + case .arrayPayload(let param0): + param0.bridgeJSLowerReturn() + return Int32(4) + case .jsClassPayload(let param0): + param0.jsObject.bridgeJSLowerStackReturn() + return Int32(5) + case .empty: + return Int32(6) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> AllTypesResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> AllTypesResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + switch self { + case .structPayload(let param0): + param0.bridgeJSLowerReturn() + _swift_js_push_tag(Int32(0)) + case .classPayload(let param0): + param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(1)) + case .jsObjectPayload(let param0): + param0.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(2)) + case .nestedEnum(let param0): + param0.bridgeJSLowerReturn() + _swift_js_push_tag(Int32(3)) + case .arrayPayload(let param0): + param0.bridgeJSLowerReturn() + _swift_js_push_tag(Int32(4)) + case .jsClassPayload(let param0): + param0.jsObject.bridgeJSLowerStackReturn() + _swift_js_push_tag(Int32(5)) + case .empty: + _swift_js_push_tag(Int32(6)) + } + } +} + +extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> OptionalAllTypesResult { + switch caseId { + case 0: + return .optStruct(Optional
        .bridgeJSLiftParameter()) + case 1: + return .optClass(Optional.bridgeJSLiftParameter()) + case 2: + return .optJSObject(Optional.bridgeJSLiftParameter()) + case 3: + return .optNestedEnum(Optional.bridgeJSLiftParameter()) + case 4: + return .optArray({ + let __isSome = _swift_js_pop_i32() + if __isSome == 0 { + return Optional<[Int]>.none + } else { + return [Int].bridgeJSLiftParameter() + } + }()) + case 5: + return .optJsClass(Optional.bridgeJSLiftParameter().map { + Foo(unsafelyWrapping: $0) + }) + case 6: + return .empty + default: + fatalError("Unknown OptionalAllTypesResult case ID: \(caseId)") + } + } + + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .optStruct(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(0) + case .optClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(1) + case .optJSObject(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(2) + case .optNestedEnum(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(3) + case .optArray(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(4) + case .optJsClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(5) + case .empty: + return Int32(6) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> OptionalAllTypesResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> OptionalAllTypesResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + switch self { + case .optStruct(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(0)) + case .optClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(1)) + case .optJSObject(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(2)) + case .optNestedEnum(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(3)) + case .optArray(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(4)) + case .optJsClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(5)) + case .empty: + _swift_js_push_tag(Int32(6)) } } } @@ -1876,14 +2188,13 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .success(let param0): - _swift_js_push_tag(Int32(0)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(0)) case .failure(let param0, let param1): - _swift_js_push_tag(Int32(1)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() @@ -1894,8 +2205,8 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) + _swift_js_push_tag(Int32(1)) case .status(let param0, let param1, let param2): - _swift_js_push_tag(Int32(2)) let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() @@ -1911,6 +2222,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { __bjs_unwrapped_param2.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) + _swift_js_push_tag(Int32(2)) } } } @@ -4451,6 +4763,28 @@ public func _bjs_roundTripOptionalAPIResult(_ valueIsSome: Int32, _ valueCaseId: #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_roundTripOptionalTypedPayloadResult") +@_cdecl("bjs_roundTripOptionalTypedPayloadResult") +public func _bjs_roundTripOptionalTypedPayloadResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalTypedPayloadResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_compareAPIResults") @_cdecl("bjs_compareAPIResults") public func _bjs_compareAPIResults(_ r1IsSome: Int32, _ r1CaseId: Int32, _ r2IsSome: Int32, _ r2CaseId: Int32) -> Void { @@ -4475,6 +4809,50 @@ public func _bjs_roundTripOptionalComplexResult(_ resultIsSome: Int32, _ resultC #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_roundTripOptionalAllTypesResult") +@_cdecl("bjs_roundTripOptionalAllTypesResult") +public func _bjs_roundTripOptionalAllTypesResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalAllTypesResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalPayloadResult") +@_cdecl("bjs_roundTripOptionalPayloadResult") +public func _bjs_roundTripOptionalPayloadResult(_ result: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalPayloadResult(_: OptionalAllTypesResult.bridgeJSLiftParameter(result)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalPayloadResultOpt") +@_cdecl("bjs_roundTripOptionalPayloadResultOpt") +public func _bjs_roundTripOptionalPayloadResultOpt(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalPayloadResultOpt(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_roundTripOptionalClass") @_cdecl("bjs_roundTripOptionalClass") public func _bjs_roundTripOptionalClass(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index e2877ee76..41d2ccf89 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -4357,6 +4357,308 @@ "swiftCallName" : "API.NetworkingResult", "tsFullPath" : "API.NetworkingResult" }, + { + "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" : [ + { + "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" : { + "int" : { + + } + } + } + } + } + ], + "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" : { + "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" : { + "int" : { + + } + } + } + }, + "_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" : [ { @@ -7557,6 +7859,66 @@ } } }, + { + "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_roundTripOptionalTypedPayloadResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTypedPayloadResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" + } + }, + "_1" : "null" + } + } + }, { "abiName" : "bjs_compareAPIResults", "effects" : { @@ -7636,6 +7998,126 @@ } } }, + { + "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_roundTripOptionalAllTypesResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalAllTypesResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "AllTypesResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "AllTypesResult" + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalPayloadResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalPayloadResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalPayloadResultOpt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalPayloadResultOpt", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + }, + "_1" : "null" + } + } + }, { "abiName" : "bjs_roundTripOptionalClass", "effects" : { diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 6a8dd58a2..cc21a864a 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -1,7 +1,7 @@ // @ts-check import { - DirectionValues, StatusValues, ThemeValues, HttpStatusValues, TSDirection, TSTheme, APIResultValues, ComplexResultValues, APIOptionalResultValues, StaticCalculatorValues, StaticPropertyEnumValues + DirectionValues, StatusValues, ThemeValues, HttpStatusValues, TSDirection, TSTheme, APIResultValues, ComplexResultValues, APIOptionalResultValues, StaticCalculatorValues, StaticPropertyEnumValues, PrecisionValues, TypedPayloadResultValues, AllTypesResultValues, OptionalAllTypesResultValues } from '../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.js'; /** @type {import('../.build/plugins/PackageToJS/outputs/PackageTests/test.d.ts').SetupOptionsFn} */ @@ -781,6 +781,129 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor10), aor10); assert.equal(exports.roundTripOptionalAPIOptionalResult(null), null); + // TypedPayloadResult — rawValueEnum and caseEnum as associated value payloads + assert.equal(exports.Precision.Rough, 0.1); + assert.equal(exports.Precision.Fine, 0.001); + + const tpr_precision = { tag: exports.TypedPayloadResult.Tag.Precision, param0: Math.fround(0.1) }; + assert.deepEqual(exports.roundTripTypedPayloadResult(tpr_precision), tpr_precision); + + const tpr_direction = { tag: exports.TypedPayloadResult.Tag.Direction, param0: exports.Direction.North }; + assert.deepEqual(exports.roundTripTypedPayloadResult(tpr_direction), tpr_direction); + + const tpr_dirSouth = { tag: exports.TypedPayloadResult.Tag.Direction, param0: exports.Direction.South }; + assert.deepEqual(exports.roundTripTypedPayloadResult(tpr_dirSouth), tpr_dirSouth); + + const tpr_optPrecisionSome = { tag: exports.TypedPayloadResult.Tag.OptPrecision, param0: Math.fround(0.001) }; + assert.deepEqual(exports.roundTripTypedPayloadResult(tpr_optPrecisionSome), tpr_optPrecisionSome); + + const tpr_optPrecisionNull = { tag: exports.TypedPayloadResult.Tag.OptPrecision, param0: null }; + assert.deepEqual(exports.roundTripTypedPayloadResult(tpr_optPrecisionNull), tpr_optPrecisionNull); + + const tpr_optDirectionSome = { tag: exports.TypedPayloadResult.Tag.OptDirection, param0: exports.Direction.East }; + assert.deepEqual(exports.roundTripTypedPayloadResult(tpr_optDirectionSome), tpr_optDirectionSome); + + const tpr_optDirectionNull = { tag: exports.TypedPayloadResult.Tag.OptDirection, param0: null }; + assert.deepEqual(exports.roundTripTypedPayloadResult(tpr_optDirectionNull), tpr_optDirectionNull); + + const tpr_empty = { tag: exports.TypedPayloadResult.Tag.Empty }; + assert.deepEqual(exports.roundTripTypedPayloadResult(tpr_empty), tpr_empty); + + // Optional TypedPayloadResult roundtrip + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_precision), tpr_precision); + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_direction), tpr_direction); + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_optPrecisionSome), tpr_optPrecisionSome); + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_optPrecisionNull), tpr_optPrecisionNull); + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_empty), tpr_empty); + assert.equal(exports.roundTripOptionalTypedPayloadResult(null), null); + + // AllTypesResult — struct, class, JSObject, nested enum, array as associated value payloads + const atr_struct = { tag: AllTypesResultValues.Tag.StructPayload, param0: { street: "100 Main St", city: "Boston", zipCode: 2101 } }; + assert.deepEqual(exports.roundTripAllTypesResult(atr_struct), atr_struct); + + const atr_class = { tag: AllTypesResultValues.Tag.ClassPayload, param0: new exports.Greeter("EnumUser") }; + const atr_class_result = exports.roundTripAllTypesResult(atr_class); + assert.equal(atr_class_result.tag, AllTypesResultValues.Tag.ClassPayload); + assert.equal(atr_class_result.param0.name, "EnumUser"); + + const atr_jsObject = { tag: AllTypesResultValues.Tag.JsObjectPayload, param0: { custom: "data", value: 42 } }; + const atr_jsObject_result = exports.roundTripAllTypesResult(atr_jsObject); + assert.equal(atr_jsObject_result.tag, AllTypesResultValues.Tag.JsObjectPayload); + assert.equal(atr_jsObject_result.param0.custom, "data"); + assert.equal(atr_jsObject_result.param0.value, 42); + + const atr_nestedEnum = { tag: AllTypesResultValues.Tag.NestedEnum, param0: { tag: APIResultValues.Tag.Success, param0: "nested!" } }; + assert.deepEqual(exports.roundTripAllTypesResult(atr_nestedEnum), atr_nestedEnum); + + const atr_array = { tag: AllTypesResultValues.Tag.ArrayPayload, param0: [10, 20, 30] }; + assert.deepEqual(exports.roundTripAllTypesResult(atr_array), atr_array); + + const atr_jsClass = { tag: AllTypesResultValues.Tag.JsClassPayload, param0: new ImportedFoo("enumFoo") }; + const atr_jsClass_result = exports.roundTripAllTypesResult(atr_jsClass); + assert.equal(atr_jsClass_result.tag, AllTypesResultValues.Tag.JsClassPayload); + assert.equal(atr_jsClass_result.param0.value, "enumFoo"); + + const atr_empty = { tag: AllTypesResultValues.Tag.Empty }; + assert.deepEqual(exports.roundTripAllTypesResult(atr_empty), atr_empty); + + // Optional AllTypesResult roundtrip + assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_struct), atr_struct); + assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_array), atr_array); + assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_empty), atr_empty); + assert.equal(exports.roundTripOptionalAllTypesResult(null), null); + + // OptionalAllTypesResult — optional struct, class, JSObject, nested enum, array as associated value payloads + const oatr_structSome = { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: { street: "200 Oak St", city: "Denver", zipCode: null } }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_structSome), oatr_structSome); + + const oatr_structNone = { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_structNone), oatr_structNone); + + const oatr_classSome = { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: new exports.Greeter("OptEnumUser") }; + const oatr_classSome_result = exports.roundTripOptionalPayloadResult(oatr_classSome); + assert.equal(oatr_classSome_result.tag, OptionalAllTypesResultValues.Tag.OptClass); + assert.equal(oatr_classSome_result.param0.name, "OptEnumUser"); + + const oatr_classNone = { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_classNone), oatr_classNone); + + const oatr_jsObjectSome = { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: { key: "value" } }; + const oatr_jsObjectSome_result = exports.roundTripOptionalPayloadResult(oatr_jsObjectSome); + assert.equal(oatr_jsObjectSome_result.tag, OptionalAllTypesResultValues.Tag.OptJSObject); + assert.equal(oatr_jsObjectSome_result.param0.key, "value"); + + const oatr_jsObjectNone = { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_jsObjectNone), oatr_jsObjectNone); + + const oatr_nestedEnumSome = { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: { tag: APIResultValues.Tag.Failure, param0: 404 } }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_nestedEnumSome), oatr_nestedEnumSome); + + const oatr_nestedEnumNone = { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_nestedEnumNone), oatr_nestedEnumNone); + + const oatr_arraySome = { tag: OptionalAllTypesResultValues.Tag.OptArray, param0: [1, 2, 3] }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_arraySome), oatr_arraySome); + + const oatr_arrayNone = { tag: OptionalAllTypesResultValues.Tag.OptArray, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_arrayNone), oatr_arrayNone); + + const oatr_jsClassSome = { tag: OptionalAllTypesResultValues.Tag.OptJsClass, param0: new ImportedFoo("optEnumFoo") }; + const oatr_jsClassSome_result = exports.roundTripOptionalPayloadResult(oatr_jsClassSome); + assert.equal(oatr_jsClassSome_result.tag, OptionalAllTypesResultValues.Tag.OptJsClass); + assert.equal(oatr_jsClassSome_result.param0.value, "optEnumFoo"); + + const oatr_jsClassNone = { tag: OptionalAllTypesResultValues.Tag.OptJsClass, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_jsClassNone), oatr_jsClassNone); + + const oatr_empty = { tag: OptionalAllTypesResultValues.Tag.Empty }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_empty), oatr_empty); + + // Optional OptionalAllTypesResult roundtrip + assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_structSome), oatr_structSome); + assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_structNone), oatr_structNone); + assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_empty), oatr_empty); + assert.equal(exports.roundTripOptionalPayloadResultOpt(null), null); + assert.equal(exports.MathUtils.add(2147483647, 0), 2147483647); assert.equal(exports.StaticCalculator.roundtrip(42), 42); assert.equal(StaticCalculatorValues.Scientific, 0); From 43a05d9ad7e77801f6dc1f4a163bb126edcc8460 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 4 Feb 2026 09:50:08 +0100 Subject: [PATCH 152/252] BridgeJS: Few more array import tests BridgeJS: Array import --- .../Sources/BridgeJSCore/ImportTS.swift | 88 +-- .../Sources/BridgeJSLink/BridgeJSLink.swift | 8 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 56 +- .../TS2Swift/JavaScript/src/processor.js | 11 +- .../test/__snapshots__/ts2swift.test.js.snap | 12 +- .../test/fixtures/ArrayParameter.d.ts | 20 +- .../Inputs/MacroSwift/ArrayTypes.swift | 6 + .../Inputs/MacroSwift/ImportArray.swift | 2 + .../BridgeJSCodegenTests/ArrayTypes.json | 115 +++ .../BridgeJSCodegenTests/ArrayTypes.swift | 88 +++ .../BridgeJSCodegenTests/ImportArray.json | 62 ++ .../BridgeJSCodegenTests/ImportArray.swift | 34 + .../BridgeJSLinkTests/ArrayTypes.d.ts | 5 + .../BridgeJSLinkTests/ArrayTypes.js | 89 +++ .../BridgeJSLinkTests/ImportArray.d.ts | 19 + .../BridgeJSLinkTests/ImportArray.js | 257 +++++++ .../JavaScriptKit/BridgeJSIntrinsics.swift | 23 +- .../Articles/BridgeJS/Supported-Types.md | 2 +- .../Generated/BridgeJS.Macros.swift | 10 + .../Generated/BridgeJS.swift | 407 +++++++++++ .../Generated/JavaScript/BridgeJS.json | 663 ++++++++++++++++-- .../BridgeJSRuntimeTests/ImportAPITests.swift | 61 ++ .../ImportArrayAPIs.swift | 17 + Tests/BridgeJSRuntimeTests/StructAPIs.swift | 25 + Tests/BridgeJSRuntimeTests/bridge-js.d.ts | 6 + Tests/prelude.mjs | 50 ++ 26 files changed, 2011 insertions(+), 125 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ImportArray.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js create mode 100644 Tests/BridgeJSRuntimeTests/ImportArrayAPIs.swift diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 22e0ef162..8db872c6e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -83,6 +83,8 @@ public struct ImportTS { var abiReturnType: WasmCoreType? // Track destructured variable names for multiple lowered parameters var destructuredVarNames: [String] = [] + // Stack-lowered parameters should be evaluated in reverse order to match LIFO stacks + var stackLoweringStmts: [CodeBlockItemSyntax] = [] init(moduleName: String, abiName: String, context: BridgeContext = .importTS) { self.moduleName = moduleName @@ -93,11 +95,6 @@ public struct ImportTS { func lowerParameter(param: Parameter) throws { let loweringInfo = try param.type.loweringParameterInfo(context: context) - // Generate destructured variable names for all lowered parameters - let destructuredNames = loweringInfo.loweredParameters.map { - "\(param.name)\($0.name.capitalizedFirstLetter)" - } - let initializerExpr: ExprSyntax switch param.type { case .closure(let signature): @@ -108,6 +105,33 @@ public struct ImportTS { initializerExpr = ExprSyntax("\(raw: param.name).bridgeJSLowerParameter()") } + if loweringInfo.loweredParameters.isEmpty { + let stmt = CodeBlockItemSyntax( + item: .decl( + DeclSyntax( + VariableDeclSyntax( + bindingSpecifier: .keyword(.let), + bindings: PatternBindingListSyntax { + PatternBindingSyntax( + pattern: PatternSyntax( + IdentifierPatternSyntax(identifier: .wildcardToken()) + ), + initializer: InitializerClauseSyntax(value: initializerExpr) + ) + } + ) + ) + ) + ) + stackLoweringStmts.insert(stmt, at: 0) + return + } + + // Generate destructured variable names for all lowered parameters + let destructuredNames = loweringInfo.loweredParameters.map { + "\(param.name)\($0.name.capitalizedFirstLetter)" + } + // Always add destructuring statement to body (unified for single and multiple) let pattern: PatternSyntax if destructuredNames.count == 1 { @@ -166,7 +190,9 @@ public struct ImportTS { } func call(returnType: BridgeType) throws { - // Build function call expression + let liftingInfo = try returnType.liftingReturnInfo(context: context) + body.append(contentsOf: stackLoweringStmts) + let callExpr = FunctionCallExprSyntax( calledExpression: ExprSyntax("\(raw: abiName)"), leftParen: .leftParenToken(), @@ -178,19 +204,15 @@ public struct ImportTS { rightParen: .rightParenToken() ) - let needsRetBinding: Bool - let liftingInfo = try returnType.liftingReturnInfo(context: context) - if liftingInfo.valueToLift == nil || returnType.usesSideChannelForOptionalReturn() { - // Void and side-channel returns don't need "let ret =" - needsRetBinding = false + if returnType == .void { + body.append(CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr))))) + } else if returnType.usesSideChannelForOptionalReturn() { + // Side channel returns don't need "let ret =" + body.append(CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr))))) + } else if liftingInfo.valueToLift == nil { + body.append(CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr))))) } else { - needsRetBinding = true - } - - if needsRetBinding { body.append("let ret = \(raw: callExpr)") - } else { - body.append(CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr))))) } // Add exception check for ImportTS context @@ -934,13 +956,8 @@ extension BridgeType { return LoweringParameterInfo(loweredParameters: [("value", .i32)]) } case .rawValueEnum(_, let rawType): - switch context { - case .importTS: - return LoweringParameterInfo(loweredParameters: [("value", rawType.wasmCoreType ?? .i32)]) - case .exportSwift: - // For protocol export we return .i32 for String raw value type instead of nil - return LoweringParameterInfo(loweredParameters: [("value", rawType.wasmCoreType ?? .i32)]) - } + let wasmType = rawType.wasmCoreType ?? .i32 + return LoweringParameterInfo(loweredParameters: [("value", wasmType)]) case .associatedValueEnum: switch context { case .importTS: @@ -964,12 +981,7 @@ extension BridgeType { params.append(contentsOf: wrappedInfo.loweredParameters) return LoweringParameterInfo(loweredParameters: params) case .array: - switch context { - case .importTS: - throw BridgeJSCoreError("Array types are not yet supported in TypeScript imports") - case .exportSwift: - return LoweringParameterInfo(loweredParameters: []) - } + return LoweringParameterInfo(loweredParameters: []) } } @@ -1025,13 +1037,8 @@ extension BridgeType { return LiftingReturnInfo(valueToLift: .i32) } case .rawValueEnum(_, let rawType): - switch context { - case .importTS: - return LiftingReturnInfo(valueToLift: rawType.wasmCoreType ?? .i32) - case .exportSwift: - // For protocol export we return .i32 for String raw value type instead of nil - return LiftingReturnInfo(valueToLift: rawType.wasmCoreType ?? .i32) - } + let wasmType = rawType.wasmCoreType ?? .i32 + return LiftingReturnInfo(valueToLift: wasmType) case .associatedValueEnum: switch context { case .importTS: @@ -1053,12 +1060,7 @@ extension BridgeType { let wrappedInfo = try wrappedType.liftingReturnInfo(context: context) return LiftingReturnInfo(valueToLift: wrappedInfo.valueToLift) case .array: - switch context { - case .importTS: - throw BridgeJSCoreError("Array types are not yet supported in TypeScript imports") - case .exportSwift: - return LiftingReturnInfo(valueToLift: nil) - } + return LiftingReturnInfo(valueToLift: nil) } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 27ef60760..7a5e02f2d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -2212,12 +2212,10 @@ extension BridgeJSLink { func liftParameter(param: Parameter) throws { let liftingFragment = try IntrinsicJSFragment.liftParameter(type: param.type, context: context) - assert( - liftingFragment.parameters.count >= 1, - "Lifting fragment should have at least one parameter to lift" - ) let valuesToLift: [String] - if liftingFragment.parameters.count == 1 { + if liftingFragment.parameters.count == 0 { + valuesToLift = [] + } else if liftingFragment.parameters.count == 1 { parameterNames.append(param.name) valuesToLift = [scope.variable(param.name)] } else { diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 1547d63a4..410bce672 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -1895,14 +1895,7 @@ struct IntrinsicJSFragment: Sendable { "Namespace enums are not supported to be passed as parameters to imported JS functions: \(string)" ) case .array(let elementType): - switch context { - case .importTS: - throw BridgeJSLinkError( - message: "Arrays are not yet supported to be passed as parameters to imported JS functions" - ) - case .exportSwift: - return try arrayLift(elementType: elementType) - } + return try arrayLift(elementType: elementType) } } @@ -1971,14 +1964,7 @@ struct IntrinsicJSFragment: Sendable { message: "Namespace enums are not supported to be returned from imported JS functions: \(string)" ) case .array(let elementType): - switch context { - case .importTS: - throw BridgeJSLinkError( - message: "Arrays are not yet supported to be returned from imported JS functions" - ) - case .exportSwift: - return try arrayLower(elementType: elementType) - } + return try arrayLower(elementType: elementType) } } @@ -3215,11 +3201,10 @@ struct IntrinsicJSFragment: Sendable { // Lift return value if needed if method.returnType != .void { let liftFragment = try! IntrinsicJSFragment.liftReturn(type: method.returnType) - if !liftFragment.parameters.isEmpty { - let lifted = liftFragment.printCode(["ret"], methodScope, printer, methodCleanup) - if let liftedValue = lifted.first { - printer.write("return \(liftedValue);") - } + let liftArgs = liftFragment.parameters.isEmpty ? [] : ["ret"] + let lifted = liftFragment.printCode(liftArgs, methodScope, printer, methodCleanup) + if let liftedValue = lifted.first { + printer.write("return \(liftedValue);") } } } @@ -3508,9 +3493,36 @@ struct IntrinsicJSFragment: Sendable { ), allStructs: allStructs ) + let guardedPrinter = CodeFragmentPrinter() + let guardedCleanup = CodeFragmentPrinter() + _ = wrappedFragment.printCode([value], scope, guardedPrinter, guardedCleanup) + var loweredLines = guardedPrinter.lines + var hoistedCleanupVar: String? + if let first = loweredLines.first { + let trimmed = first.trimmingCharacters(in: .whitespaces) + if trimmed.hasPrefix("const "), + let namePart = trimmed.split(separator: " ").dropFirst().first, + trimmed.contains("= []") + { + hoistedCleanupVar = String(namePart) + loweredLines[0] = "\(hoistedCleanupVar!) = [];" + } + } + if let hoistedName = hoistedCleanupVar { + printer.write("let \(hoistedName);") + } printer.write("if (\(isSomeVar)) {") printer.indent { - _ = wrappedFragment.printCode([value], scope, printer, cleanup) + for line in loweredLines { + printer.write(line) + } + if !guardedCleanup.lines.isEmpty { + cleanup.write("if (\(isSomeVar)) {") + cleanup.indent { + cleanup.write(contentsOf: guardedCleanup) + } + cleanup.write("}") + } } printer.write("}") printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index c06ba94aa..ef446af0f 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -663,6 +663,15 @@ export class TypeProcessor { * @private */ visitType(type, node) { + if (this.checker.isArrayType(type)) { + const typeArgs = this.checker.getTypeArguments(type); + if (typeArgs && typeArgs.length > 0) { + const elementType = this.visitType(typeArgs[0], node); + return `[${elementType}]`; + } + return "[JSObject]"; + } + // Treat A and A as the same type if (isTypeReference(type)) { type = type.target; @@ -727,7 +736,7 @@ export class TypeProcessor { return this.renderTypeIdentifier(typeName); } - if (this.checker.isArrayType(type) || this.checker.isTupleType(type) || type.getCallSignatures().length > 0) { + if (this.checker.isTupleType(type) || type.getCallSignatures().length > 0) { return "JSObject"; } // "a" | "b" -> string diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index f81a2ce07..6fdb79f78 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -9,11 +9,17 @@ exports[`ts2swift > snapshots Swift output for ArrayParameter.d.ts > ArrayParame @_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit -@JSFunction func checkArray(_ a: JSObject) throws(JSException) -> Void +@JSFunction func processNumbers(_ values: [Double]) throws(JSException) -> Void -@JSFunction func checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void +@JSFunction func getNumbers() throws(JSException) -> [Double] -@JSFunction func checkArray(_ a: JSObject) throws(JSException) -> Void +@JSFunction func transformNumbers(_ values: [Double]) throws(JSException) -> [Double] + +@JSFunction func processStrings(_ values: [String]) throws(JSException) -> [String] + +@JSFunction func processBooleans(_ values: [Bool]) throws(JSException) -> [Bool] + +@JSFunction func processArraySyntax(_ values: [Double]) throws(JSException) -> [Double] " `; diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ArrayParameter.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ArrayParameter.d.ts index 59674e071..b5a099388 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ArrayParameter.d.ts +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ArrayParameter.d.ts @@ -1,3 +1,17 @@ -export function checkArray(a: number[]): void; -export function checkArrayWithLength(a: number[], b: number): void; -export function checkArray(a: Array): void; +// Array as parameter +export function processNumbers(values: number[]): void; + +// Array as return value +export function getNumbers(): number[]; + +// Array as both parameter and return value +export function transformNumbers(values: number[]): number[]; + +// String arrays +export function processStrings(values: string[]): string[]; + +// Boolean arrays +export function processBooleans(values: boolean[]): boolean[]; + +// Using Array syntax +export function processArraySyntax(values: Array): Array; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ArrayTypes.swift index c1980cbc2..0cea90512 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ArrayTypes.swift @@ -61,3 +61,9 @@ @JSFunction func checkArray(_ a: JSObject) throws(JSException) -> Void @JSFunction func checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void + +@JSFunction func importProcessNumbers(_ values: [Double]) throws(JSException) -> Void +@JSFunction func importGetNumbers() throws(JSException) -> [Double] +@JSFunction func importTransformNumbers(_ values: [Double]) throws(JSException) -> [Double] +@JSFunction func importProcessStrings(_ values: [String]) throws(JSException) -> [String] +@JSFunction func importProcessBooleans(_ values: [Bool]) throws(JSException) -> [Bool] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ImportArray.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ImportArray.swift new file mode 100644 index 000000000..cd9142a26 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/ImportArray.swift @@ -0,0 +1,2 @@ +@JSFunction func roundtrip(_ items: [Int]) throws(JSException) -> [Int] +@JSFunction func logStrings(_ items: [String]) throws(JSException) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json index 8dde2cfb7..8eab0c059 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.json @@ -1158,6 +1158,121 @@ } } + }, + { + "name" : "importProcessNumbers", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "importGetNumbers", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "name" : "importTransformNumbers", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "name" : "importProcessStrings", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "name" : "importProcessBooleans", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } } ], "types" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift index c7c80c3b2..023caf21f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift @@ -581,4 +581,92 @@ func _$checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> V if let error = _swift_js_take_exception() { throw error } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_importProcessNumbers") +fileprivate func bjs_importProcessNumbers() -> Void +#else +fileprivate func bjs_importProcessNumbers() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$importProcessNumbers(_ values: [Double]) throws(JSException) -> Void { + let _ = values.bridgeJSLowerParameter() + bjs_importProcessNumbers() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_importGetNumbers") +fileprivate func bjs_importGetNumbers() -> Void +#else +fileprivate func bjs_importGetNumbers() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$importGetNumbers() throws(JSException) -> [Double] { + bjs_importGetNumbers() + if let error = _swift_js_take_exception() { + throw error + } + return [Double].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_importTransformNumbers") +fileprivate func bjs_importTransformNumbers() -> Void +#else +fileprivate func bjs_importTransformNumbers() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$importTransformNumbers(_ values: [Double]) throws(JSException) -> [Double] { + let _ = values.bridgeJSLowerParameter() + bjs_importTransformNumbers() + if let error = _swift_js_take_exception() { + throw error + } + return [Double].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_importProcessStrings") +fileprivate func bjs_importProcessStrings() -> Void +#else +fileprivate func bjs_importProcessStrings() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$importProcessStrings(_ values: [String]) throws(JSException) -> [String] { + let _ = values.bridgeJSLowerParameter() + bjs_importProcessStrings() + if let error = _swift_js_take_exception() { + throw error + } + return [String].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_importProcessBooleans") +fileprivate func bjs_importProcessBooleans() -> Void +#else +fileprivate func bjs_importProcessBooleans() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$importProcessBooleans(_ values: [Bool]) throws(JSException) -> [Bool] { + let _ = values.bridgeJSLowerParameter() + bjs_importProcessBooleans() + if let error = _swift_js_take_exception() { + throw error + } + return [Bool].bridgeJSLiftReturn() } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.json new file mode 100644 index 000000000..b884e0cb9 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.json @@ -0,0 +1,62 @@ +{ + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "roundtrip", + "parameters" : [ + { + "name" : "items", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "name" : "logStrings", + "parameters" : [ + { + "name" : "items", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.swift new file mode 100644 index 000000000..33b987c76 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.swift @@ -0,0 +1,34 @@ +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_roundtrip") +fileprivate func bjs_roundtrip() -> Void +#else +fileprivate func bjs_roundtrip() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$roundtrip(_ items: [Int]) throws(JSException) -> [Int] { + let _ = items.bridgeJSLowerParameter() + bjs_roundtrip() + if let error = _swift_js_take_exception() { + throw error + } + return [Int].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_logStrings") +fileprivate func bjs_logStrings() -> Void +#else +fileprivate func bjs_logStrings() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$logStrings(_ items: [String]) throws(JSException) -> Void { + let _ = items.bridgeJSLowerParameter() + bjs_logStrings() + if let error = _swift_js_take_exception() { + throw error + } +} \ 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 3316cd7c3..8dc76156b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts @@ -71,6 +71,11 @@ export type Exports = { export type Imports = { checkArray(a: any): void; checkArrayWithLength(a: any, b: number): void; + importProcessNumbers(values: number[]): void; + importGetNumbers(): number[]; + importTransformNumbers(values: number[]): number[]; + importProcessStrings(values: string[]): string[]; + importProcessBooleans(values: boolean[]): boolean[]; } export function createInstantiator(options: { imports: Imports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 4610d03ba..6cca17cf6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -263,6 +263,95 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_importProcessNumbers"] = function bjs_importProcessNumbers() { + try { + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const f64 = tmpRetF64s.pop(); + arrayResult.push(f64); + } + arrayResult.reverse(); + imports.importProcessNumbers(arrayResult); + } catch (error) { + setException(error); + } + } + TestModule["bjs_importGetNumbers"] = function bjs_importGetNumbers() { + try { + let ret = imports.importGetNumbers(); + const arrayCleanups = []; + for (const elem of ret) { + tmpParamF64s.push(elem); + } + tmpParamInts.push(ret.length); + } catch (error) { + setException(error); + } + } + TestModule["bjs_importTransformNumbers"] = function bjs_importTransformNumbers() { + try { + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const f64 = tmpRetF64s.pop(); + arrayResult.push(f64); + } + arrayResult.reverse(); + let ret = imports.importTransformNumbers(arrayResult); + const arrayCleanups = []; + for (const elem of ret) { + tmpParamF64s.push(elem); + } + tmpParamInts.push(ret.length); + } catch (error) { + setException(error); + } + } + TestModule["bjs_importProcessStrings"] = function bjs_importProcessStrings() { + try { + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const string = tmpRetStrings.pop(); + arrayResult.push(string); + } + arrayResult.reverse(); + let ret = imports.importProcessStrings(arrayResult); + const arrayCleanups = []; + for (const elem of ret) { + const bytes = textEncoder.encode(elem); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + arrayCleanups.push(() => { + swift.memory.release(id); + }); + } + tmpParamInts.push(ret.length); + } catch (error) { + setException(error); + } + } + TestModule["bjs_importProcessBooleans"] = function bjs_importProcessBooleans() { + try { + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const bool = tmpRetInts.pop() !== 0; + arrayResult.push(bool); + } + arrayResult.reverse(); + let ret = imports.importProcessBooleans(arrayResult); + const arrayCleanups = []; + for (const elem of ret) { + tmpParamInts.push(elem ? 1 : 0); + } + tmpParamInts.push(ret.length); + } catch (error) { + setException(error); + } + } }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.d.ts new file mode 100644 index 000000000..5d1e2c4dc --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.d.ts @@ -0,0 +1,19 @@ +// 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 type Exports = { +} +export type Imports = { + roundtrip(items: number[]): number[]; + logStrings(items: string[]): void; +} +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/ImportArray.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js new file mode 100644 index 000000000..daa601aed --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js @@ -0,0 +1,257 @@ +// 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; + 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 tmpRetTag = []; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + let tmpStructCleanups = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag.push(tag); + } + bjs["swift_js_push_i32"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_i32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_pointer"] = function() { + return tmpParamPointers.pop(); + } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_roundtrip"] = function bjs_roundtrip() { + try { + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const int = tmpRetInts.pop(); + arrayResult.push(int); + } + arrayResult.reverse(); + let ret = imports.roundtrip(arrayResult); + const arrayCleanups = []; + for (const elem of ret) { + tmpParamInts.push((elem | 0)); + } + tmpParamInts.push(ret.length); + } catch (error) { + setException(error); + } + } + TestModule["bjs_logStrings"] = function bjs_logStrings() { + try { + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const string = tmpRetStrings.pop(); + arrayResult.push(string); + } + arrayResult.reverse(); + imports.logStrings(arrayResult); + } catch (error) { + setException(error); + } + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + const exports = { + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index e385a3c60..349cecb91 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -2297,7 +2297,9 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftStruct { // MARK: - Array Support -extension Array where Element: _BridgedSwiftStackType, Element.StackLiftResult == Element { +extension Array: _BridgedSwiftStackType where Element: _BridgedSwiftStackType, Element.StackLiftResult == Element { + public typealias StackLiftResult = [Element] + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> [Element] { let count = Int(_swift_js_pop_i32()) var result: [Element] = [] @@ -2309,10 +2311,23 @@ extension Array where Element: _BridgedSwiftStackType, Element.StackLiftResult = return result } - @_spi(BridgeJS) public func bridgeJSLowerReturn() { - for elem in self { + @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> [Element] { + bridgeJSLiftParameter() + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + bridgeJSLowerReturn() + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { + let array = self + for elem in array { elem.bridgeJSLowerStackReturn() } - _swift_js_push_i32(Int32(self.count)) + _swift_js_push_i32(Int32(array.count)) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() { + bridgeJSLowerReturn() } } diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Supported-Types.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Supported-Types.md index 668fe21b5..c872c0dda 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Supported-Types.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Supported-Types.md @@ -9,7 +9,7 @@ Use this page as a quick reference for how common TypeScript types appear in Swi | `number` | `Double` | | `string` | `String` | | `boolean` | `Bool` | -| TODO | `Array` | +| `T[]` | `[T]` | | TODO | `Dictionary` | | `T \| undefined` | TODO | | `T \| null` | `Optional` | diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index 358f0501d..9e05b3ae8 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -63,6 +63,16 @@ extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} @JSFunction(jsName: "with-dashes") static func with_dashes() throws(JSException) -> StaticBox } +@JSFunction func jsRoundTripNumberArray(_ values: [Double]) throws(JSException) -> [Double] + +@JSFunction func jsRoundTripStringArray(_ values: [String]) throws(JSException) -> [String] + +@JSFunction func jsRoundTripBoolArray(_ values: [Bool]) throws(JSException) -> [Bool] + +@JSFunction func jsSumNumberArray(_ values: [Double]) throws(JSException) -> Double + +@JSFunction func jsCreateNumberArray() throws(JSException) -> [Double] + @JSFunction(from: .global) func parseInt(_ string: String) throws(JSException) -> Double @JSClass(from: .global) struct Animal { diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 0e06c7edc..5638d0442 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -3579,6 +3579,84 @@ fileprivate func _bjs_struct_lift_FooContainer() -> Int32 { } #endif +extension ArrayMembers: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ArrayMembers { + let optStrings = { + let __isSome = _swift_js_pop_i32() + if __isSome == 0 { + return Optional<[String]>.none + } else { + return [String].bridgeJSLiftParameter() + } + }() + let ints = [Int].bridgeJSLiftParameter() + return ArrayMembers(ints: ints, optStrings: optStrings) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + self.ints.bridgeJSLowerReturn() + let __bjs_isSome_optStrings = self.optStrings != nil + if let __bjs_unwrapped_optStrings = self.optStrings { + __bjs_unwrapped_optStrings.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_optStrings ? 1 : 0) + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_ArrayMembers(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + 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(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_ArrayMembers(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_ArrayMembers") +fileprivate func _bjs_struct_lift_ArrayMembers() -> Int32 +#else +fileprivate func _bjs_struct_lift_ArrayMembers() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_ArrayMembers_sumValues") +@_cdecl("bjs_ArrayMembers_sumValues") +public func _bjs_ArrayMembers_sumValues() -> Int32 { + #if arch(wasm32) + let ret = ArrayMembers.bridgeJSLiftParameter().sumValues(_: [Int].bridgeJSLiftParameter()) + 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].bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_roundTripVoid") @_cdecl("bjs_roundTripVoid") public func _bjs_roundTripVoid() -> Void { @@ -5913,6 +5991,43 @@ public func _bjs_roundTripFooContainer() -> Void { #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].bridgeJSLiftParameter() + 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].bridgeJSLiftParameter() + 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_Greeter_init") @_cdecl("bjs_Greeter_init") public func _bjs_Greeter_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { @@ -8591,6 +8706,95 @@ func _$_jsWeirdFunction() throws(JSException) -> Double { return Double.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripNumberArray") +fileprivate func bjs_jsRoundTripNumberArray() -> Void +#else +fileprivate func bjs_jsRoundTripNumberArray() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripNumberArray(_ values: [Double]) throws(JSException) -> [Double] { + let _ = values.bridgeJSLowerParameter() + bjs_jsRoundTripNumberArray() + if let error = _swift_js_take_exception() { + throw error + } + return [Double].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripStringArray") +fileprivate func bjs_jsRoundTripStringArray() -> Void +#else +fileprivate func bjs_jsRoundTripStringArray() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripStringArray(_ values: [String]) throws(JSException) -> [String] { + let _ = values.bridgeJSLowerParameter() + bjs_jsRoundTripStringArray() + if let error = _swift_js_take_exception() { + throw error + } + return [String].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripBoolArray") +fileprivate func bjs_jsRoundTripBoolArray() -> Void +#else +fileprivate func bjs_jsRoundTripBoolArray() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripBoolArray(_ values: [Bool]) throws(JSException) -> [Bool] { + let _ = values.bridgeJSLowerParameter() + bjs_jsRoundTripBoolArray() + if let error = _swift_js_take_exception() { + throw error + } + return [Bool].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsSumNumberArray") +fileprivate func bjs_jsSumNumberArray() -> Float64 +#else +fileprivate func bjs_jsSumNumberArray() -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsSumNumberArray(_ values: [Double]) throws(JSException) -> Double { + let _ = values.bridgeJSLowerParameter() + let ret = bjs_jsSumNumberArray() + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsCreateNumberArray") +fileprivate func bjs_jsCreateNumberArray() -> Void +#else +fileprivate func bjs_jsCreateNumberArray() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsCreateNumberArray() throws(JSException) -> [Double] { + bjs_jsCreateNumberArray() + if let error = _swift_js_take_exception() { + throw error + } + return [Double].bridgeJSLiftReturn() +} + #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_parseInt") fileprivate func bjs_parseInt(_ string: Int32) -> Float64 @@ -9022,6 +9226,209 @@ func _$Animal_getIsCat(_ self: JSObject) throws(JSException) -> Bool { return Bool.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripIntArray") +fileprivate func bjs_jsRoundTripIntArray() -> Void +#else +fileprivate func bjs_jsRoundTripIntArray() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripIntArray(_ items: [Int]) throws(JSException) -> [Int] { + let _ = items.bridgeJSLowerParameter() + bjs_jsRoundTripIntArray() + if let error = _swift_js_take_exception() { + throw error + } + return [Int].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsArrayLength") +fileprivate func bjs_jsArrayLength() -> Int32 +#else +fileprivate func bjs_jsArrayLength() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsArrayLength(_ items: [Int]) throws(JSException) -> Int { + let _ = items.bridgeJSLowerParameter() + let ret = bjs_jsArrayLength() + if let error = _swift_js_take_exception() { + throw error + } + return Int.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_makeArrayHost") +fileprivate func bjs_makeArrayHost() -> Int32 +#else +fileprivate func bjs_makeArrayHost() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$makeArrayHost(_ numbers: [Int], _ labels: [String]) throws(JSException) -> ArrayHost { + let _ = labels.bridgeJSLowerParameter() + let _ = numbers.bridgeJSLowerParameter() + let ret = bjs_makeArrayHost() + if let error = _swift_js_take_exception() { + throw error + } + return ArrayHost.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_init") +fileprivate func bjs_ArrayHost_init() -> Int32 +#else +fileprivate func bjs_ArrayHost_init() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_numbers_get") +fileprivate func bjs_ArrayHost_numbers_get(_ self: Int32) -> Void +#else +fileprivate func bjs_ArrayHost_numbers_get(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_labels_get") +fileprivate func bjs_ArrayHost_labels_get(_ self: Int32) -> Void +#else +fileprivate func bjs_ArrayHost_labels_get(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_numbers_set") +fileprivate func bjs_ArrayHost_numbers_set(_ self: Int32) -> Void +#else +fileprivate func bjs_ArrayHost_numbers_set(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_labels_set") +fileprivate func bjs_ArrayHost_labels_set(_ self: Int32) -> Void +#else +fileprivate func bjs_ArrayHost_labels_set(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_concatNumbers") +fileprivate func bjs_ArrayHost_concatNumbers(_ self: Int32) -> Void +#else +fileprivate func bjs_ArrayHost_concatNumbers(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_concatLabels") +fileprivate func bjs_ArrayHost_concatLabels(_ self: Int32) -> Void +#else +fileprivate func bjs_ArrayHost_concatLabels(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_firstLabel") +fileprivate func bjs_ArrayHost_firstLabel(_ self: Int32) -> Int32 +#else +fileprivate func bjs_ArrayHost_firstLabel(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$ArrayHost_init(_ numbers: [Int], _ labels: [String]) throws(JSException) -> JSObject { + let _ = labels.bridgeJSLowerParameter() + let _ = numbers.bridgeJSLowerParameter() + let ret = bjs_ArrayHost_init() + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$ArrayHost_numbers_get(_ self: JSObject) throws(JSException) -> [Int] { + let selfValue = self.bridgeJSLowerParameter() + bjs_ArrayHost_numbers_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return [Int].bridgeJSLiftReturn() +} + +func _$ArrayHost_labels_get(_ self: JSObject) throws(JSException) -> [String] { + let selfValue = self.bridgeJSLowerParameter() + bjs_ArrayHost_labels_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return [String].bridgeJSLiftReturn() +} + +func _$ArrayHost_numbers_set(_ self: JSObject, _ newValue: [Int]) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let _ = newValue.bridgeJSLowerParameter() + bjs_ArrayHost_numbers_set(selfValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$ArrayHost_labels_set(_ self: JSObject, _ newValue: [String]) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let _ = newValue.bridgeJSLowerParameter() + bjs_ArrayHost_labels_set(selfValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$ArrayHost_concatNumbers(_ self: JSObject, _ values: [Int]) throws(JSException) -> [Int] { + let selfValue = self.bridgeJSLowerParameter() + let _ = values.bridgeJSLowerParameter() + bjs_ArrayHost_concatNumbers(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return [Int].bridgeJSLiftReturn() +} + +func _$ArrayHost_concatLabels(_ self: JSObject, _ values: [String]) throws(JSException) -> [String] { + let selfValue = self.bridgeJSLowerParameter() + let _ = values.bridgeJSLowerParameter() + bjs_ArrayHost_concatLabels(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return [String].bridgeJSLiftReturn() +} + +func _$ArrayHost_firstLabel(_ self: JSObject, _ values: [String]) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let _ = values.bridgeJSLowerParameter() + let ret = bjs_ArrayHost_firstLabel(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsApplyInt") fileprivate func bjs_jsApplyInt(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 41d2ccf89..366115792 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -10917,6 +10917,112 @@ "_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" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "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" : [ @@ -12547,6 +12653,110 @@ } ], "swiftCallName" : "FooContainer" + }, + { + "methods" : [ + { + "abiName" : "bjs_ArrayMembers_sumValues", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "sumValues", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "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" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optStrings", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "ArrayMembers" } ] }, @@ -12850,70 +13060,185 @@ } }, { - "from" : "global", - "name" : "parseInt", + "name" : "jsRoundTripNumberArray", "parameters" : [ { - "name" : "string", + "name" : "values", "type" : { - "string" : { + "array" : { + "_0" : { + "double" : { + } + } } } } ], "returnType" : { - "double" : { - - } - } - } - ], - "globalGetters" : [ - { - "from" : "global", - "name" : "globalObject1", - "type" : { - "jsValue" : { + "array" : { + "_0" : { + "double" : { + } + } } } - } - ], - "types" : [ + }, { - "constructor" : { - "parameters" : [ - { - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "name" : "prefix", - "type" : { - "string" : { + "name" : "jsRoundTripStringArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + } } } } - ] - }, - "getters" : [ - { - "name" : "name", - "type" : { + } + ], + "returnType" : { + "array" : { + "_0" : { "string" : { } } - }, - { - "name" : "prefix", - "type" : { + } + } + }, + { + "name" : "jsRoundTripBoolArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "name" : "jsSumNumberArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "name" : "jsCreateNumberArray", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "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" : { } @@ -13203,6 +13528,258 @@ } ] }, + { + "functions" : [ + { + "name" : "jsRoundTripIntArray", + "parameters" : [ + { + "name" : "items", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "name" : "jsArrayLength", + "parameters" : [ + { + "name" : "items", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "name" : "makeArrayHost", + "parameters" : [ + { + "name" : "numbers", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "name" : "labels", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "jsObject" : { + "_0" : "ArrayHost" + } + } + } + ], + "types" : [ + { + "constructor" : { + "parameters" : [ + { + "name" : "numbers", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "name" : "labels", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ] + }, + "getters" : [ + { + "name" : "numbers", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "name" : "labels", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "methods" : [ + { + "name" : "concatNumbers", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "name" : "concatLabels", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "name" : "firstLabel", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "ArrayHost", + "setters" : [ + { + "functionName" : "numbers_set", + "name" : "numbers", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "functionName" : "labels_set", + "name" : "labels", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "staticMethods" : [ + + ] + } + ] + }, { "functions" : [ { diff --git a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift index 460297133..a465c57b4 100644 --- a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift @@ -152,6 +152,33 @@ class ImportAPITests: XCTestCase { XCTAssertEqual(prefixer("world!"), "Hello, world!") } + func testRoundTripIntArray() throws { + let values = [1, 2, 3, 4, 5] + let result = try jsRoundTripIntArray(values) + XCTAssertEqual(result, values) + XCTAssertEqual(try jsArrayLength(values), values.count) + XCTAssertEqual(try jsRoundTripIntArray([]), []) + } + + func testJSClassArrayMembers() throws { + let numbers = [1, 2, 3] + let labels = ["alpha", "beta"] + let host = try makeArrayHost(numbers, labels) + + XCTAssertEqual(try host.numbers, numbers) + XCTAssertEqual(try host.labels, labels) + + try host.setNumbers([10, 20]) + try host.setLabels(["gamma"]) + XCTAssertEqual(try host.numbers, [10, 20]) + XCTAssertEqual(try host.labels, ["gamma"]) + + XCTAssertEqual(try host.concatNumbers([30, 40]), [10, 20, 30, 40]) + XCTAssertEqual(try host.concatLabels(["delta", "epsilon"]), ["gamma", "delta", "epsilon"]) + XCTAssertEqual(try host.firstLabel([]), "gamma") + XCTAssertEqual(try host.firstLabel(["zeta"]), "zeta") + } + func testClosureParameterIntToVoid() throws { var total = 0 let ret = try jsCallTwice(5) { total += $0 } @@ -178,4 +205,38 @@ class ImportAPITests: XCTestCase { let dashed = try StaticBox.with_dashes() XCTAssertEqual(try dashed.value(), 7) } + + func testRoundTripNumberArray() throws { + let input: [Double] = [1.0, 2.5, 3.0, -4.5] + let result = try jsRoundTripNumberArray(input) + XCTAssertEqual(result, input) + XCTAssertEqual(try jsRoundTripNumberArray([]), []) + XCTAssertEqual(try jsRoundTripNumberArray([42.0]), [42.0]) + } + + func testRoundTripStringArray() throws { + let input = ["Hello", "World", "🎉"] + let result = try jsRoundTripStringArray(input) + XCTAssertEqual(result, input) + XCTAssertEqual(try jsRoundTripStringArray([]), []) + XCTAssertEqual(try jsRoundTripStringArray(["", "a", ""]), ["", "a", ""]) + } + + func testRoundTripBoolArray() throws { + let input = [true, false, true, false] + let result = try jsRoundTripBoolArray(input) + XCTAssertEqual(result, input) + XCTAssertEqual(try jsRoundTripBoolArray([]), []) + } + + func testSumNumberArray() throws { + XCTAssertEqual(try jsSumNumberArray([1.0, 2.0, 3.0, 4.0]), 10.0) + XCTAssertEqual(try jsSumNumberArray([]), 0.0) + XCTAssertEqual(try jsSumNumberArray([42.0]), 42.0) + } + + func testCreateNumberArray() throws { + let result = try jsCreateNumberArray() + XCTAssertEqual(result, [1.0, 2.0, 3.0, 4.0, 5.0]) + } } diff --git a/Tests/BridgeJSRuntimeTests/ImportArrayAPIs.swift b/Tests/BridgeJSRuntimeTests/ImportArrayAPIs.swift new file mode 100644 index 000000000..3f33de86a --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/ImportArrayAPIs.swift @@ -0,0 +1,17 @@ +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func jsRoundTripIntArray(_ items: [Int]) throws(JSException) -> [Int] +@JSFunction func jsArrayLength(_ items: [Int]) throws(JSException) -> Int + +@JSClass struct ArrayHost { + @JSGetter var numbers: [Int] + @JSGetter var labels: [String] + @JSSetter func setNumbers(_ value: [Int]) throws(JSException) + @JSSetter func setLabels(_ value: [String]) throws(JSException) + @JSFunction init(_ numbers: [Int], _ labels: [String]) throws(JSException) + @JSFunction func concatNumbers(_ values: [Int]) throws(JSException) -> [Int] + @JSFunction func concatLabels(_ values: [String]) throws(JSException) -> [String] + @JSFunction func firstLabel(_ values: [String]) throws(JSException) -> String +} + +@JSFunction func makeArrayHost(_ numbers: [Int], _ labels: [String]) throws(JSException) -> ArrayHost diff --git a/Tests/BridgeJSRuntimeTests/StructAPIs.swift b/Tests/BridgeJSRuntimeTests/StructAPIs.swift index c7de5d137..49869e0f5 100644 --- a/Tests/BridgeJSRuntimeTests/StructAPIs.swift +++ b/Tests/BridgeJSRuntimeTests/StructAPIs.swift @@ -234,3 +234,28 @@ @JS func roundTripFooContainer(_ container: FooContainer) -> FooContainer { return container } + +@JS struct ArrayMembers { + var ints: [Int] + var optStrings: [String]? + + @JS func sumValues(_ values: [Int]) -> Int { + values.reduce(0, +) + } + + @JS func firstString(_ values: [String]) -> String? { + values.first + } +} + +@JS func roundTripArrayMembers(_ value: ArrayMembers) -> ArrayMembers { + value +} + +@JS func arrayMembersSum(_ value: ArrayMembers, _ values: [Int]) -> Int { + value.sumValues(values) +} + +@JS func arrayMembersFirst(_ value: ArrayMembers, _ values: [String]) -> String? { + value.firstString(values) +} diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts index 03ecb5b39..b7dc6c48d 100644 --- a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts +++ b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts @@ -44,3 +44,9 @@ export class StaticBox { static makeDefault(): StaticBox; static "with-dashes"(): StaticBox; } + +export function jsRoundTripNumberArray(values: number[]): number[]; +export function jsRoundTripStringArray(values: string[]): string[]; +export function jsRoundTripBoolArray(values: boolean[]): boolean[]; +export function jsSumNumberArray(values: number[]): number; +export function jsCreateNumberArray(): number[]; diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index cc21a864a..e8f0b081c 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -33,6 +33,22 @@ export async function setupOptions(options, context) { return { ...options, getImports: (importsContext) => { + const ArrayHost = class { + constructor(numbers, labels) { + this.numbers = numbers; + this.labels = labels; + } + concatNumbers(values) { + return [...this.numbers, ...values]; + } + concatLabels(values) { + return [...this.labels, ...values]; + } + firstLabel(values) { + const merged = [...values, ...this.labels]; + return merged.length > 0 ? merged[0] : ""; + } + }; return { "jsRoundTripVoid": () => { return; @@ -55,6 +71,12 @@ export async function setupOptions(options, context) { "jsRoundTripJSValue": (v) => { return v; }, + "jsRoundTripIntArray": (items) => { + return items; + }, + "jsArrayLength": (items) => { + return items.length; + }, "jsThrowOrVoid": (shouldThrow) => { if (shouldThrow) { throw new Error("TestError"); @@ -87,6 +109,10 @@ export async function setupOptions(options, context) { "$jsWeirdFunction": () => { return 42; }, + ArrayHost, + makeArrayHost: (numbers, labels) => { + return new ArrayHost(numbers, labels); + }, JsGreeter: class { /** * @param {string} name @@ -140,6 +166,24 @@ export async function setupOptions(options, context) { }, jsTranslatePoint: (point, dx, dy) => { return { x: (point.x | 0) + (dx | 0), y: (point.y | 0) + (dy | 0) }; + }, + jsRoundTripNumberArray: (values) => { + return values; + }, + jsRoundTripStringArray: (values) => { + return values; + }, + jsRoundTripBoolArray: (values) => { + return values; + }, + jsSumNumberArray: (values) => { + return values.reduce((a, b) => a + b, 0); + }, + jsCreateNumberArray: () => { + return [1, 2, 3, 4, 5]; + }, + roundTripArrayMembers: (value) => { + return value; } }; }, @@ -223,6 +267,12 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { ]) { assert.equal(exports.roundTripString(v), v); } + const arrayStruct = { ints: [1, 2, 3], optStrings: ["a", "b"] }; + const arrayStructRoundTrip = exports.roundTripArrayMembers(arrayStruct); + assert.deepEqual(arrayStructRoundTrip.ints, [1, 2, 3]); + assert.deepEqual(arrayStructRoundTrip.optStrings, ["a", "b"]); + assert.equal(exports.arrayMembersSum(arrayStruct, [10, 20]), 30); + assert.equal(exports.arrayMembersFirst(arrayStruct, ["x", "y"]), "x"); for (const p of [1, 4, 1024, 65536, 2147483647]) { assert.equal(exports.roundTripUnsafeRawPointer(p), p); From 66f0d1270f202839bc8d961b171bf14474755e5d Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Wed, 4 Feb 2026 17:47:17 +0000 Subject: [PATCH 153/252] build-examples.sh: re-enable Embedded example package (#490) The compiler crash should be fixed in `swift-DEVELOPMENT-SNAPSHOT-2026-01-07-a`. Resolves https://github.com/swiftwasm/JavaScriptKit/issues/449. --- .github/workflows/test.yml | 2 +- Examples/Embedded/build.sh | 2 +- Utilities/build-examples.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 06faa39f0..7b5a808bc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -153,7 +153,7 @@ jobs: - uses: actions/checkout@v6 - uses: ./.github/actions/install-swift with: - download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a/swift-DEVELOPMENT-SNAPSHOT-2025-09-14-a-ubuntu22.04.tar.gz + download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2026-02-02-a/swift-DEVELOPMENT-SNAPSHOT-2026-02-02-a-ubuntu22.04.tar.gz - uses: swiftwasm/setup-swiftwasm@v2 id: setup-wasm32-unknown-wasip1 with: { target: wasm32-unknown-wasip1 } diff --git a/Examples/Embedded/build.sh b/Examples/Embedded/build.sh index 7b33e4b74..2d035493a 100755 --- a/Examples/Embedded/build.sh +++ b/Examples/Embedded/build.sh @@ -2,4 +2,4 @@ set -euxo pipefail package_dir="$(cd "$(dirname "$0")" && pwd)" swift package --package-path "$package_dir" \ - -c release --swift-sdk "$(swiftc -print-target-info | jq -r '.swiftCompilerTag')_wasm-embedded" js + -c release --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1}}-embedded" js diff --git a/Utilities/build-examples.sh b/Utilities/build-examples.sh index 4d99c8627..bc84e6943 100755 --- a/Utilities/build-examples.sh +++ b/Utilities/build-examples.sh @@ -2,7 +2,7 @@ set -euo pipefail -EXCLUDED_EXAMPLES=("Embedded") +EXCLUDED_EXAMPLES=() for example in Examples/*; do skip_example=false From ffa6c066fb561011b2d0f362f75170b2caf00f20 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 5 Feb 2026 10:12:33 +0900 Subject: [PATCH 154/252] - Added JSValue-aware stack lift/lower fragments so arrays push/pop JSValue payloads using the shared helpers, enabling `[JSValue]` round-trips in both directions (`Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift`). - Extended JSValue test inputs with array and optional-array cases plus a JS-imported array echo to exercise the new path (`Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSValue.swift`). - Updated codegen/link snapshots to reflect the new JSValue array glue (`Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift`, `Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.json`, `Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js`, `Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts`). Tests: `UPDATE_SNAPSHOTS=1 swift test --package-path ./Plugins/BridgeJS`. Next step: run `make unittest SWIFT_SDK_ID=DEVELOPMENT-SNAPSHOT-2025-11-03-a-wasm32-unknown-wasip1` for the full runtime suite if you want end-to-end validation. --- .../Sources/BridgeJSLink/JSGlueGen.swift | 33 +++++- .../Inputs/MacroSwift/JSValue.swift | 9 ++ .../BridgeJSCodegenTests/JSValue.json | 102 ++++++++++++++++++ .../BridgeJSCodegenTests/JSValue.swift | 49 +++++++++ .../BridgeJSLinkTests/JSValue.d.ts | 3 + .../BridgeJSLinkTests/JSValue.js | 83 ++++++++++++++ 6 files changed, 277 insertions(+), 2 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 410bce672..cdb23f606 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -2613,7 +2613,23 @@ struct IntrinsicJSFragment: Sendable { private static func stackLiftFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { switch elementType { case .jsValue: - throw BridgeJSLinkError(message: "Array of JSValue is not supported yet") + return IntrinsicJSFragment( + parameters: [], + printCode: { _, scope, printer, cleanup in + registerJSValueHelpers(scope: scope) + let payload2Var = scope.variable("jsValuePayload2") + let payload1Var = scope.variable("jsValuePayload1") + let kindVar = scope.variable("jsValueKind") + printer.write("const \(payload2Var) = \(JSGlueVariableScope.reservedTmpRetF64s).pop();") + printer.write("const \(payload1Var) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(kindVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + let resultVar = scope.variable("jsValue") + printer.write( + "const \(resultVar) = \(jsValueLiftHelperName)(\(kindVar), \(payload1Var), \(payload2Var));" + ) + return [resultVar] + } + ) case .string: return IntrinsicJSFragment( parameters: [], @@ -2775,7 +2791,20 @@ struct IntrinsicJSFragment: Sendable { private static func stackLowerFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { switch elementType { case .jsValue: - throw BridgeJSLinkError(message: "Array of JSValue is not supported yet") + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, scope, printer, cleanup in + registerJSValueHelpers(scope: scope) + let lowered = jsValueLower.printCode([arguments[0]], scope, printer, cleanup) + let kindVar = lowered[0] + let payload1Var = lowered[1] + let payload2Var = lowered[2] + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(kindVar));") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(payload1Var));") + printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(payload2Var));") + return [] + } + ) case .string: return IntrinsicJSFragment( parameters: ["value"], diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSValue.swift index 84251f6b3..2a34f5f2b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/JSValue.swift @@ -6,6 +6,14 @@ return value } +@JS func roundTripJSValueArray(_ values: [JSValue]) -> [JSValue] { + return values +} + +@JS func roundTripOptionalJSValueArray(_ values: [JSValue]?) -> [JSValue]? { + return values +} + @JS class JSValueHolder { @JS var value: JSValue @JS var optionalValue: JSValue? @@ -30,3 +38,4 @@ } @JSFunction func jsEchoJSValue(_ value: JSValue) throws(JSException) -> JSValue +@JSFunction func jsEchoJSValueArray(_ values: [JSValue]) throws(JSException) -> [JSValue] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.json index d10d673d4..5bd83be27 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.json @@ -231,6 +231,82 @@ "_1" : "null" } } + }, + { + "abiName" : "bjs_roundTripJSValueArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripJSValueArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalJSValueArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalJSValueArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + }, + "_1" : "null" + } + } } ], "protocols" : [ @@ -261,6 +337,32 @@ } } + }, + { + "name" : "jsEchoJSValueArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + } } ], "types" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift index 3a3be5079..f3550129c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift @@ -20,6 +20,37 @@ public func _bjs_roundTripOptionalJSValue(_ valueIsSome: Int32, _ valueKind: Int #endif } +@_expose(wasm, "bjs_roundTripJSValueArray") +@_cdecl("bjs_roundTripJSValueArray") +public func _bjs_roundTripJSValueArray() -> Void { + #if arch(wasm32) + let ret = roundTripJSValueArray(_: [JSValue].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalJSValueArray") +@_cdecl("bjs_roundTripOptionalJSValueArray") +public func _bjs_roundTripOptionalJSValueArray(_ values: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalJSValueArray(_: { + if values == 0 { + return Optional<[JSValue]>.none + } else { + return [JSValue].bridgeJSLiftParameter() + } + }()) + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + __bjs_unwrapped_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_JSValueHolder_init") @_cdecl("bjs_JSValueHolder_init") public func _bjs_JSValueHolder_init(_ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64, _ optionalValueIsSome: Int32, _ optionalValueKind: Int32, _ optionalValuePayload1: Int32, _ optionalValuePayload2: Float64) -> UnsafeMutableRawPointer { @@ -146,4 +177,22 @@ func _$jsEchoJSValue(_ value: JSValue) throws(JSException) -> JSValue { throw error } return JSValue.bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_jsEchoJSValueArray") +fileprivate func bjs_jsEchoJSValueArray() -> Void +#else +fileprivate func bjs_jsEchoJSValueArray() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsEchoJSValueArray(_ values: [JSValue]) throws(JSException) -> [JSValue] { + let _ = values.bridgeJSLowerParameter() + bjs_jsEchoJSValueArray() + if let error = _swift_js_take_exception() { + throw error + } + return [JSValue].bridgeJSLiftReturn() } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts index 9e2a85ac7..f4c13c610 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts @@ -24,9 +24,12 @@ export type Exports = { } roundTripJSValue(value: any): any; roundTripOptionalJSValue(value: any | null): any | null; + roundTripJSValueArray(values: any[]): any[]; + roundTripOptionalJSValueArray(values: any[] | null): any[] | null; } export type Imports = { jsEchoJSValue(value: any): any; + jsEchoJSValueArray(values: any[]): any[]; } export function createInstantiator(options: { imports: Imports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index 2bd696c3d..f5c360bb0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -312,6 +312,31 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_jsEchoJSValueArray"] = function bjs_jsEchoJSValueArray() { + try { + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const jsValuePayload2 = tmpRetF64s.pop(); + const jsValuePayload1 = tmpRetInts.pop(); + const jsValueKind = tmpRetInts.pop(); + const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); + arrayResult.push(jsValue); + } + arrayResult.reverse(); + let ret = imports.jsEchoJSValueArray(arrayResult); + const arrayCleanups = []; + for (const elem of ret) { + const [elemKind, elemPayload1, elemPayload2] = __bjs_jsValueLower(elem); + tmpParamInts.push(elemKind); + tmpParamInts.push(elemPayload1); + tmpParamF64s.push(elemPayload2); + } + tmpParamInts.push(ret.length); + } catch (error) { + setException(error); + } + } }, setInstance: (i) => { instance = i; @@ -448,6 +473,64 @@ export async function createInstantiator(options, swift) { } return optResult; }, + roundTripJSValueArray: function bjs_roundTripJSValueArray(values) { + const arrayCleanups = []; + for (const elem of values) { + const [elemKind, elemPayload1, elemPayload2] = __bjs_jsValueLower(elem); + tmpParamInts.push(elemKind); + tmpParamInts.push(elemPayload1); + tmpParamF64s.push(elemPayload2); + } + tmpParamInts.push(values.length); + instance.exports.bjs_roundTripJSValueArray(); + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const jsValuePayload2 = tmpRetF64s.pop(); + const jsValuePayload1 = tmpRetInts.pop(); + const jsValueKind = tmpRetInts.pop(); + const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); + arrayResult.push(jsValue); + } + arrayResult.reverse(); + for (const cleanup of arrayCleanups) { cleanup(); } + return arrayResult; + }, + roundTripOptionalJSValueArray: function bjs_roundTripOptionalJSValueArray(values) { + const isSome = values != null; + const valuesCleanups = []; + if (isSome) { + const arrayCleanups = []; + for (const elem of values) { + const [elemKind, elemPayload1, elemPayload2] = __bjs_jsValueLower(elem); + tmpParamInts.push(elemKind); + tmpParamInts.push(elemPayload1); + tmpParamF64s.push(elemPayload2); + } + tmpParamInts.push(values.length); + valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); + } + instance.exports.bjs_roundTripOptionalJSValueArray(+isSome); + const isSome1 = tmpRetInts.pop(); + let optResult; + if (isSome1) { + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const jsValuePayload2 = tmpRetF64s.pop(); + const jsValuePayload1 = tmpRetInts.pop(); + const jsValueKind = tmpRetInts.pop(); + const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); + arrayResult.push(jsValue); + } + arrayResult.reverse(); + optResult = arrayResult; + } else { + optResult = null; + } + for (const cleanup of valuesCleanups) { cleanup(); } + return optResult; + }, }; _exports = exports; return exports; From 3dba5dfe81e9d17f64b62c4f6f1cebfd9dea5254 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 5 Feb 2026 10:27:11 +0900 Subject: [PATCH 155/252] - Added JSValue array support end-to-end: JS glue now lowers/lifts optional JSValue arrays, using tmp stacks and JSValue helpers, and Swift intrinsics gained Optional<[JSValue]> bridging (`Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift`, `Sources/JavaScriptKit/BridgeJSIntrinsics.swift`). - Expanded runtime coverage with JSValue array round-trips (including optionals) on both import and export paths plus JS prelude wiring and d.ts definitions (`Tests/BridgeJSRuntimeTests/ExportAPITests.swift`, `Tests/BridgeJSRuntimeTests/ImportAPITests.swift`, `Tests/BridgeJSRuntimeTests/bridge-js.d.ts`, `Tests/prelude.mjs`), and regenerated BridgeJS outputs (`Tests/BridgeJSRuntimeTests/Generated/*`, `Tests/BridgeJSGlobalTests/Generated/*`, plugin outputs). - Runtime tests now include JSValue array cases and all suites pass with the prescribed SDK. Tests: `make unittest SWIFT_SDK_ID=DEVELOPMENT-SNAPSHOT-2025-11-03-a-wasm32-unknown-wasip1`. --- .../Sources/BridgeJSLink/JSGlueGen.swift | 14 ++ .../JavaScriptKit/BridgeJSIntrinsics.swift | 44 ++++++ .../BridgeJSRuntimeTests/ExportAPITests.swift | 8 + .../Generated/BridgeJS.Macros.swift | 4 + .../Generated/BridgeJS.swift | 67 +++++++++ .../Generated/JavaScript/BridgeJS.json | 138 ++++++++++++++++++ .../BridgeJSRuntimeTests/ImportAPITests.swift | 26 ++++ Tests/BridgeJSRuntimeTests/bridge-js.d.ts | 2 + Tests/prelude.mjs | 10 ++ 9 files changed, 313 insertions(+) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index cdb23f606..60a6bd338 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -1029,6 +1029,20 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(JSGlueVariableScope.reservedTmpRetF64s).push(\(payload2Var));") } printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(\(isSomeVar) ? 1 : 0);") + case .array(let elementType): + printer.write("if (\(isSomeVar)) {") + printer.indent { + let arrayLowerFragment = try! arrayLower(elementType: elementType) + let arrayCleanup = CodeFragmentPrinter() + let _ = arrayLowerFragment.printCode([value], scope, printer, arrayCleanup) + if !arrayCleanup.lines.isEmpty { + for line in arrayCleanup.lines { + printer.write(line) + } + } + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") case .rawValueEnum(_, let rawType): switch rawType { case .string: diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 349cecb91..1c8592724 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -1394,6 +1394,50 @@ extension Optional where Wrapped == JSValue { } } +extension Optional where Wrapped == [JSValue] { + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch consume self { + case .none: + return 0 + case .some(let array): + array.bridgeJSLowerReturn() + return 1 + } + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32) -> [JSValue]? { + if isSome == 0 { + return nil + } + return [JSValue].bridgeJSLiftParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> [JSValue]? { + let isSome = _swift_js_pop_i32() + return bridgeJSLiftParameter(isSome) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> [JSValue]? { + let isSome = _swift_js_pop_i32() + if isSome == 0 { + return nil + } + return [JSValue].bridgeJSLiftReturn() + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + switch consume self { + case .none: + _swift_js_push_i32(0) + case .some(let array): + array.bridgeJSLowerReturn() + _swift_js_push_i32(1) + } + } +} + extension Optional where Wrapped: _BridgedSwiftProtocolWrapper { // MARK: ExportSwift diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index fe73ea6fb..05fcf146a 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -60,6 +60,14 @@ func runJsWorks() -> Void return v } +@JS func roundTripJSValueArray(v: [JSValue]) -> [JSValue] { + return v +} + +@JS func roundTripOptionalJSValueArray(v: [JSValue]?) -> [JSValue]? { + return v +} + @JSClass struct Foo { @JSGetter var value: String @JSFunction init(_ value: String) throws(JSException) diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index 9e05b3ae8..675bf9dfb 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -20,6 +20,10 @@ @JSFunction func jsRoundTripJSValue(_ v: JSValue) throws(JSException) -> JSValue +@JSFunction func jsRoundTripJSValueArray(_ v: [JSValue]) throws(JSException) -> [JSValue] + +@JSFunction func jsRoundTripOptionalJSValueArray(_ v: Optional<[JSValue]>) throws(JSException) -> Optional<[JSValue]> + @JSFunction func jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void @JSFunction func jsThrowOrNumber(_ shouldThrow: Bool) throws(JSException) -> Double diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 5638d0442..40f1a5690 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -3832,6 +3832,37 @@ public func _bjs_roundTripOptionalJSValue(_ vIsSome: Int32, _ vKind: Int32, _ vP #endif } +@_expose(wasm, "bjs_roundTripJSValueArray") +@_cdecl("bjs_roundTripJSValueArray") +public func _bjs_roundTripJSValueArray() -> Void { + #if arch(wasm32) + let ret = roundTripJSValueArray(v: [JSValue].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalJSValueArray") +@_cdecl("bjs_roundTripOptionalJSValueArray") +public func _bjs_roundTripOptionalJSValueArray(_ v: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalJSValueArray(v: { + if v == 0 { + return Optional<[JSValue]>.none + } else { + return [JSValue].bridgeJSLiftParameter() + } + }()) + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + __bjs_unwrapped_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_makeImportedFoo") @_cdecl("bjs_makeImportedFoo") public func _bjs_makeImportedFoo(_ valueBytes: Int32, _ valueLength: Int32) -> Int32 { @@ -8583,6 +8614,42 @@ func _$jsRoundTripJSValue(_ v: JSValue) throws(JSException) -> JSValue { return JSValue.bridgeJSLiftReturn() } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripJSValueArray") +fileprivate func bjs_jsRoundTripJSValueArray() -> Void +#else +fileprivate func bjs_jsRoundTripJSValueArray() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripJSValueArray(_ v: [JSValue]) throws(JSException) -> [JSValue] { + let _ = v.bridgeJSLowerParameter() + bjs_jsRoundTripJSValueArray() + if let error = _swift_js_take_exception() { + throw error + } + return [JSValue].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalJSValueArray") +fileprivate func bjs_jsRoundTripOptionalJSValueArray(_ v: Int32) -> Void +#else +fileprivate func bjs_jsRoundTripOptionalJSValueArray(_ v: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripOptionalJSValueArray(_ v: Optional<[JSValue]>) throws(JSException) -> Optional<[JSValue]> { + let vIsSome = v.bridgeJSLowerParameter() + bjs_jsRoundTripOptionalJSValueArray(vIsSome) + if let error = _swift_js_take_exception() { + throw error + } + return Optional<[JSValue]>.bridgeJSLiftReturn() +} + #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrVoid") fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 366115792..e9591185d 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -5637,6 +5637,82 @@ } } }, + { + "abiName" : "bjs_roundTripJSValueArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripJSValueArray", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + } + }, + { + "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" : { @@ -12944,6 +13020,68 @@ } } }, + { + "name" : "jsRoundTripJSValueArray", + "parameters" : [ + { + "name" : "v", + "type" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + } + }, + { + "name" : "jsRoundTripOptionalJSValueArray", + "parameters" : [ + { + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + }, + "_1" : "null" + } + } + }, { "name" : "jsThrowOrVoid", "parameters" : [ diff --git a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift index a465c57b4..43aa6d565 100644 --- a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift @@ -73,6 +73,32 @@ class ImportAPITests: XCTestCase { } } + func testRoundTripJSValueArray() throws { + let object = JSObject.global + let symbol = JSSymbol("array") + let bigInt = JSBigInt(_slowBridge: Int64(42)) + let values: [JSValue] = [ + .boolean(false), + .number(123.5), + .string(JSString("hello")), + .object(object), + .null, + .undefined, + .symbol(symbol), + .bigInt(bigInt), + ] + let roundTripped = try jsRoundTripJSValueArray(values) + XCTAssertEqual(roundTripped, values) + XCTAssertEqual(try jsRoundTripJSValueArray([]), []) + } + + func testRoundTripOptionalJSValueArray() throws { + XCTAssertNil(try jsRoundTripOptionalJSValueArray(nil)) + let values: [JSValue] = [.number(1), .undefined, .null] + let result = try jsRoundTripOptionalJSValueArray(values) + XCTAssertEqual(result, values) + } + func testRoundTripFeatureFlag() throws { for v in [FeatureFlag.foo, .bar] { try XCTAssertEqual(jsRoundTripFeatureFlag(v), v) diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts index b7dc6c48d..2f01a5a6e 100644 --- a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts +++ b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts @@ -6,6 +6,8 @@ export function jsRoundTripOptionalNumberNull(v: number | null): number | null export function jsRoundTripOptionalNumberUndefined(v: number | undefined): number | undefined export type JSValue = any export function jsRoundTripJSValue(v: JSValue): JSValue +export function jsRoundTripJSValueArray(v: JSValue[]): JSValue[] +export function jsRoundTripOptionalJSValueArray(v: JSValue[] | null): JSValue[] | null export function jsThrowOrVoid(shouldThrow: boolean): void export function jsThrowOrNumber(shouldThrow: boolean): number export function jsThrowOrBool(shouldThrow: boolean): boolean diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index e8f0b081c..2809a96e9 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -71,6 +71,12 @@ export async function setupOptions(options, context) { "jsRoundTripJSValue": (v) => { return v; }, + "jsRoundTripJSValueArray": (values) => { + return values; + }, + "jsRoundTripOptionalJSValueArray": (values) => { + return values ?? null; + }, "jsRoundTripIntArray": (items) => { return items; }, @@ -273,6 +279,10 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.deepEqual(arrayStructRoundTrip.optStrings, ["a", "b"]); assert.equal(exports.arrayMembersSum(arrayStruct, [10, 20]), 30); assert.equal(exports.arrayMembersFirst(arrayStruct, ["x", "y"]), "x"); + const jsValueArray = [true, 42, "ok", { nested: 1 }, null, undefined]; + assert.deepEqual(exports.roundTripJSValueArray(jsValueArray), jsValueArray); + assert.deepEqual(exports.roundTripOptionalJSValueArray(jsValueArray), jsValueArray); + assert.equal(exports.roundTripOptionalJSValueArray(null), null); for (const p of [1, 4, 1024, 65536, 2147483647]) { assert.equal(exports.roundTripUnsafeRawPointer(p), p); From f56d72f1709e5d172352a763bb2f2e3838a3de2f Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 5 Feb 2026 15:07:13 +0900 Subject: [PATCH 156/252] BridgeJS: Fix throws hint spacing (#584) --- Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index 39e3090cd..3de74f74b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -2017,7 +2017,7 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { DiagnosticError( node: node, message: "@\(attributeName) declarations must be throws.", - hint: "Declare the function as 'throws (JSException)'." + hint: "Declare the function as 'throws(JSException)'." ) ) return nil From 4db13d9af83cc1318c3e122aa32834436b2e1f2a Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 5 Feb 2026 15:07:28 +0900 Subject: [PATCH 157/252] [NFC] BridgeJS: Split out OptionalSupportTests.swift (#583) BridgeJS: Split out OptionalSupportTests.swift --- Package.swift | 1 + Package@swift-6.2.swift | 1 + .../BridgeJSRuntimeTests/ExportAPITests.swift | 190 +- .../Generated/BridgeJS.Macros.swift | 4 - .../Generated/BridgeJS.swift | 2748 ++++++----- .../Generated/JavaScript/BridgeJS.json | 4382 +++++++++-------- .../BridgeJSRuntimeTests/ImportAPITests.swift | 20 - .../JavaScript/OptionalSupportTests.mjs | 219 + .../BridgeJSRuntimeTests/JavaScript/Types.mjs | 6 + .../OptionalSupportTests.swift | 232 + Tests/BridgeJSRuntimeTests/bridge-js.d.ts | 2 - Tests/prelude.mjs | 203 +- 12 files changed, 4108 insertions(+), 3900 deletions(-) create mode 100644 Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs create mode 100644 Tests/BridgeJSRuntimeTests/JavaScript/Types.mjs create mode 100644 Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift diff --git a/Package.swift b/Package.swift index 1d4c8fb06..c7f3517e8 100644 --- a/Package.swift +++ b/Package.swift @@ -183,6 +183,7 @@ let package = Package( "bridge-js.d.ts", "bridge-js.global.d.ts", "Generated/JavaScript", + "JavaScript", ], swiftSettings: [ .enableExperimentalFeature("Extern") diff --git a/Package@swift-6.2.swift b/Package@swift-6.2.swift index 456a87ca0..f640feeb7 100644 --- a/Package@swift-6.2.swift +++ b/Package@swift-6.2.swift @@ -194,6 +194,7 @@ let package = Package( "bridge-js.d.ts", "bridge-js.global.d.ts", "Generated/JavaScript", + "JavaScript", ], swiftSettings: [ .enableExperimentalFeature("Extern") diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index fe73ea6fb..a41cc3029 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -515,123 +515,6 @@ enum ComplexResult { return result } -// MARK: - Optionals - -@JS func roundTripOptionalString(name: String?) -> String? { - return name -} - -@JS func roundTripOptionalInt(value: Int?) -> Int? { - return value -} - -@JS func roundTripOptionalBool(flag: Bool?) -> Bool? { - return flag -} - -@JS func roundTripOptionalFloat(number: Float?) -> Float? { - return number -} - -@JS func roundTripOptionalDouble(precision: Double?) -> Double? { - return precision -} - -@JS func roundTripOptionalSyntax(name: Optional) -> Optional { - return name -} - -@JS func roundTripOptionalMixSyntax(name: String?) -> Optional { - return name -} - -@JS func roundTripOptionalSwiftSyntax(name: Swift.Optional) -> Swift.Optional { - return name -} - -@JS func roundTripOptionalWithSpaces(value: Optional) -> Optional { - return value -} - -typealias OptionalAge = Int? -@JS func roundTripOptionalTypeAlias(age: OptionalAge) -> OptionalAge { - return age -} - -@JS func roundTripOptionalStatus(value: Status?) -> Status? { - return value -} - -@JS func roundTripOptionalTheme(value: Theme?) -> Theme? { - return value -} - -@JS func roundTripOptionalHttpStatus(value: HttpStatus?) -> HttpStatus? { - return value -} - -@JS func roundTripOptionalTSDirection(value: TSDirection?) -> TSDirection? { - return value -} - -@JS func roundTripOptionalTSTheme(value: TSTheme?) -> TSTheme? { - return value -} - -@JS func roundTripOptionalNetworkingAPIMethod(_ method: Networking.API.Method?) -> Networking.API.Method? { - return method -} - -@JS func roundTripOptionalAPIResult(value: APIResult?) -> APIResult? { - return value -} - -@JS enum TypedPayloadResult { - case precision(Precision) - case direction(Direction) - case optPrecision(Precision?) - case optDirection(Direction?) - case empty -} - -@JS func roundTripTypedPayloadResult(_ result: TypedPayloadResult) -> TypedPayloadResult { - return result -} - -@JS func roundTripOptionalTypedPayloadResult(_ result: TypedPayloadResult?) -> TypedPayloadResult? { - return result -} - -@JS func compareAPIResults(_ r1: APIResult?, _ r2: APIResult?) -> String { - let r1Str: String - switch r1 { - case .none: r1Str = "nil" - case .some(.success(let msg)): r1Str = "success:\(msg)" - case .some(.failure(let code)): r1Str = "failure:\(code)" - case .some(.info): r1Str = "info" - case .some(.flag(let b)): r1Str = "flag:\(b)" - case .some(.rate(let r)): r1Str = "rate:\(r)" - case .some(.precise(let p)): r1Str = "precise:\(p)" - } - - let r2Str: String - switch r2 { - case .none: r2Str = "nil" - case .some(.success(let msg)): r2Str = "success:\(msg)" - case .some(.failure(let code)): r2Str = "failure:\(code)" - case .some(.info): r2Str = "info" - case .some(.flag(let b)): r2Str = "flag:\(b)" - case .some(.rate(let r)): r2Str = "rate:\(r)" - case .some(.precise(let p)): r2Str = "precise:\(p)" - } - - return "r1:\(r1Str),r2:\(r2Str)" -} - -@JS func roundTripOptionalComplexResult(_ result: ComplexResult?) -> ComplexResult? { - return result -} - @JS enum AllTypesResult { case structPayload(Address) @@ -644,76 +527,19 @@ enum AllTypesResult { } @JS func roundTripAllTypesResult(_ result: AllTypesResult) -> AllTypesResult { - return result -} - -@JS func roundTripOptionalAllTypesResult(_ result: AllTypesResult?) -> AllTypesResult? { - return result + result } -@JS -enum OptionalAllTypesResult { - case optStruct(Address?) - case optClass(Greeter?) - case optJSObject(JSObject?) - case optNestedEnum(APIResult?) - case optArray([Int]?) - case optJsClass(Foo?) +@JS enum TypedPayloadResult { + case precision(Precision) + case direction(Direction) + case optPrecision(Precision?) + case optDirection(Direction?) case empty } -@JS func roundTripOptionalPayloadResult(_ result: OptionalAllTypesResult) -> OptionalAllTypesResult { - return result -} - -@JS func roundTripOptionalPayloadResultOpt(_ result: OptionalAllTypesResult?) -> OptionalAllTypesResult? { - return result -} - -@JS func roundTripOptionalClass(value: Greeter?) -> Greeter? { - return value -} - -@JS func roundTripOptionalGreeter(_ value: Greeter?) -> Greeter? { - value -} - -@JS func applyOptionalGreeter(_ value: Greeter?, _ transform: (Greeter?) -> Greeter?) -> Greeter? { - transform(value) -} - -@JS class OptionalHolder { - @JS var nullableGreeter: Greeter? - @JS var undefinedNumber: JSUndefinedOr - - @JS init(nullableGreeter: Greeter?, undefinedNumber: JSUndefinedOr) { - self.nullableGreeter = nullableGreeter - self.undefinedNumber = undefinedNumber - } -} - -@JS func makeOptionalHolder(nullableGreeter: Greeter?, undefinedNumber: JSUndefinedOr) -> OptionalHolder { - OptionalHolder(nullableGreeter: nullableGreeter, undefinedNumber: undefinedNumber) -} - -@JS class OptionalPropertyHolder { - @JS var optionalName: String? - @JS var optionalAge: Int? = nil - @JS var optionalGreeter: Greeter? = nil - - @JS init(optionalName: String?) { - self.optionalName = optionalName - } -} - -@JS -enum APIOptionalResult { - case success(String?) - case failure(Int?, Bool?) - case status(Bool?, Int?, String?) -} -@JS func roundTripOptionalAPIOptionalResult(result: APIOptionalResult?) -> APIOptionalResult? { - return result +@JS func roundTripTypedPayloadResult(_ result: TypedPayloadResult) -> TypedPayloadResult { + result } // MARK: - Property Tests diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index 9e05b3ae8..dcaad63fa 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -14,10 +14,6 @@ @JSFunction func jsRoundTripString(_ v: String) throws(JSException) -> String -@JSFunction func jsRoundTripOptionalNumberNull(_ v: Optional) throws(JSException) -> Optional - -@JSFunction func jsRoundTripOptionalNumberUndefined(_ v: JSUndefinedOr) throws(JSException) -> JSUndefinedOr - @JSFunction func jsRoundTripJSValue(_ v: JSValue) throws(JSException) -> JSValue @JSFunction func jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 5638d0442..51751dec1 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -1806,91 +1806,6 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { } } -extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> TypedPayloadResult { - switch caseId { - case 0: - return .precision(Precision.bridgeJSLiftParameter(_swift_js_pop_f32())) - case 1: - return .direction(Direction.bridgeJSLiftParameter(_swift_js_pop_i32())) - case 2: - return .optPrecision(Optional.bridgeJSLiftParameter()) - case 3: - return .optDirection(Optional.bridgeJSLiftParameter()) - case 4: - return .empty - default: - fatalError("Unknown TypedPayloadResult case ID: \(caseId)") - } - } - - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - switch self { - case .precision(let param0): - param0.bridgeJSLowerStackReturn() - return Int32(0) - case .direction(let param0): - param0.bridgeJSLowerStackReturn() - return Int32(1) - case .optPrecision(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - return Int32(2) - case .optDirection(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - return Int32(3) - case .empty: - return Int32(4) - } - } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> TypedPayloadResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> TypedPayloadResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .precision(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) - case .direction(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) - case .optPrecision(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(2)) - case .optDirection(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(3)) - case .empty: - _swift_js_push_tag(Int32(4)) - } - } -} - extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> AllTypesResult { switch caseId { @@ -1976,34 +1891,21 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { } } -extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> OptionalAllTypesResult { +extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> TypedPayloadResult { switch caseId { case 0: - return .optStruct(Optional
        .bridgeJSLiftParameter()) + return .precision(Precision.bridgeJSLiftParameter(_swift_js_pop_f32())) case 1: - return .optClass(Optional.bridgeJSLiftParameter()) + return .direction(Direction.bridgeJSLiftParameter(_swift_js_pop_i32())) case 2: - return .optJSObject(Optional.bridgeJSLiftParameter()) + return .optPrecision(Optional.bridgeJSLiftParameter()) case 3: - return .optNestedEnum(Optional.bridgeJSLiftParameter()) + return .optDirection(Optional.bridgeJSLiftParameter()) case 4: - return .optArray({ - let __isSome = _swift_js_pop_i32() - if __isSome == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() - } - }()) - case 5: - return .optJsClass(Optional.bridgeJSLiftParameter().map { - Foo(unsafelyWrapping: $0) - }) - case 6: return .empty default: - fatalError("Unknown OptionalAllTypesResult case ID: \(caseId)") + fatalError("Unknown TypedPayloadResult case ID: \(caseId)") } } @@ -2011,248 +1913,95 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { - case .optStruct(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + case .precision(let param0): + param0.bridgeJSLowerStackReturn() return Int32(0) - case .optClass(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + case .direction(let param0): + param0.bridgeJSLowerStackReturn() return Int32(1) - case .optJSObject(let param0): + case .optPrecision(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(2) - case .optNestedEnum(let param0): + case .optDirection(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) - case .optArray(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - return Int32(4) - case .optJsClass(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - return Int32(5) case .empty: - return Int32(6) + return Int32(4) } } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> OptionalAllTypesResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> TypedPayloadResult { return _bridgeJSLiftFromCaseId(caseId) } // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> OptionalAllTypesResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> TypedPayloadResult { return _bridgeJSLiftFromCaseId(caseId) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { - case .optStruct(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + case .precision(let param0): + param0.bridgeJSLowerStackReturn() _swift_js_push_tag(Int32(0)) - case .optClass(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + case .direction(let param0): + param0.bridgeJSLowerStackReturn() _swift_js_push_tag(Int32(1)) - case .optJSObject(let param0): + case .optPrecision(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(2)) - case .optNestedEnum(let param0): + case .optDirection(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(3)) - case .optArray(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(4)) - case .optJsClass(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(5)) case .empty: - _swift_js_push_tag(Int32(6)) + _swift_js_push_tag(Int32(4)) } } } -extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIOptionalResult { - switch caseId { +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: - return .success(Optional.bridgeJSLiftParameter()) + self = .scientific case 1: - return .failure(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) - case 2: - return .status(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) + self = .basic default: - fatalError("Unknown APIOptionalResult case ID: \(caseId)") + return nil } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - switch self { - case .success(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - return Int32(0) - case .failure(let param0, let param1): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - let __bjs_isSome_param1 = param1 != nil - if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - return Int32(1) - case .status(let param0, let param1, let param2): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - let __bjs_isSome_param1 = param1 != nil - if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - let __bjs_isSome_param2 = param2 != nil - if let __bjs_unwrapped_param2 = param2 { - __bjs_unwrapped_param2.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) - return Int32(2) - } - } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIOptionalResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIOptionalResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(0)) - case .failure(let param0, let param1): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - let __bjs_isSome_param1 = param1 != nil - if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - _swift_js_push_tag(Int32(1)) - case .status(let param0, let param1, let param2): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - let __bjs_isSome_param1 = param1 != nil - if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - let __bjs_isSome_param2 = param2 != nil - if let __bjs_unwrapped_param2 = param2 { - __bjs_unwrapped_param2.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) - _swift_js_push_tag(Int32(2)) - } - } -} - -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 { + private var bridgeJSRawValue: Int32 { switch self { case .scientific: return 0 @@ -2532,108 +2281,359 @@ public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_se #endif } -extension Point: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { - let y = Int.bridgeJSLiftParameter() - let x = Int.bridgeJSLiftParameter() - return Point(x: x, y: y) +extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> OptionalAllTypesResult { + switch caseId { + case 0: + return .optStruct(Optional
        .bridgeJSLiftParameter()) + case 1: + return .optClass(Optional.bridgeJSLiftParameter()) + case 2: + return .optJSObject(Optional.bridgeJSLiftParameter()) + case 3: + return .optNestedEnum(Optional.bridgeJSLiftParameter()) + case 4: + return .optArray({ + let __isSome = _swift_js_pop_i32() + if __isSome == 0 { + return Optional<[Int]>.none + } else { + return [Int].bridgeJSLiftParameter() + } + }()) + case 5: + return .optJsClass(Optional.bridgeJSLiftParameter().map { + Foo(unsafelyWrapping: $0) + }) + case 6: + return .empty + default: + fatalError("Unknown OptionalAllTypesResult case ID: \(caseId)") + } } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.x.bridgeJSLowerStackReturn() - self.y.bridgeJSLowerStackReturn() - } + // MARK: Protocol Export - init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .optStruct(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(0) + case .optClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(1) + case .optJSObject(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(2) + case .optNestedEnum(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(3) + case .optArray(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(4) + case .optJsClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(5) + case .empty: + return Int32(6) } - self = Self.bridgeJSLiftParameter() } - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Point())) + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> OptionalAllTypesResult { + return _bridgeJSLiftFromCaseId(caseId) } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 -#else -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Point") -fileprivate func _bjs_struct_lift_Point() -> Int32 -#else -fileprivate func _bjs_struct_lift_Point() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif + // MARK: ExportSwift -extension PointerFields: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PointerFields { - let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter() - let ptr = UnsafePointer.bridgeJSLiftParameter() - let opaque = OpaquePointer.bridgeJSLiftParameter() - let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter() - let raw = UnsafeRawPointer.bridgeJSLiftParameter() - return PointerFields(raw: raw, mutRaw: mutRaw, opaque: opaque, ptr: ptr, mutPtr: mutPtr) + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> OptionalAllTypesResult { + return _bridgeJSLiftFromCaseId(caseId) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.raw.bridgeJSLowerStackReturn() - self.mutRaw.bridgeJSLowerStackReturn() - self.opaque.bridgeJSLowerStackReturn() - self.ptr.bridgeJSLowerStackReturn() - self.mutPtr.bridgeJSLowerStackReturn() - } - - init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } - self = Self.bridgeJSLiftParameter() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() - 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(_ objectId: Int32) -> Int32 -#else -fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PointerFields") -fileprivate func _bjs_struct_lift_PointerFields() -> Int32 -#else -fileprivate func _bjs_struct_lift_PointerFields() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -@_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() + switch self { + case .optStruct(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(0)) + case .optClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(1)) + case .optJSObject(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(2)) + case .optNestedEnum(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(3)) + case .optArray(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(4)) + case .optJsClass(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(5)) + case .empty: + _swift_js_push_tag(Int32(6)) + } + } +} + +extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { + private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIOptionalResult { + switch caseId { + case 0: + return .success(Optional.bridgeJSLiftParameter()) + case 1: + return .failure(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) + case 2: + return .status(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) + default: + fatalError("Unknown APIOptionalResult case ID: \(caseId)") + } + } + + // MARK: Protocol Export + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + switch self { + case .success(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + return Int32(0) + case .failure(let param0, let param1): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + let __bjs_isSome_param1 = param1 != nil + if let __bjs_unwrapped_param1 = param1 { + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) + return Int32(1) + case .status(let param0, let param1, let param2): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + let __bjs_isSome_param1 = param1 != nil + if let __bjs_unwrapped_param1 = param1 { + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) + let __bjs_isSome_param2 = param2 != nil + if let __bjs_unwrapped_param2 = param2 { + __bjs_unwrapped_param2.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) + return Int32(2) + } + } + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIOptionalResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + // MARK: ExportSwift + + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIOptionalResult { + return _bridgeJSLiftFromCaseId(caseId) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + switch self { + case .success(let param0): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + _swift_js_push_tag(Int32(0)) + case .failure(let param0, let param1): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + let __bjs_isSome_param1 = param1 != nil + if let __bjs_unwrapped_param1 = param1 { + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) + _swift_js_push_tag(Int32(1)) + case .status(let param0, let param1, let param2): + let __bjs_isSome_param0 = param0 != nil + if let __bjs_unwrapped_param0 = param0 { + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + let __bjs_isSome_param1 = param1 != nil + if let __bjs_unwrapped_param1 = param1 { + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) + let __bjs_isSome_param2 = param2 != nil + if let __bjs_unwrapped_param2 = param2 { + __bjs_unwrapped_param2.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) + _swift_js_push_tag(Int32(2)) + } + } +} + +extension Point: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { + let y = Int.bridgeJSLiftParameter() + let x = Int.bridgeJSLiftParameter() + return Point(x: x, y: y) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + self.x.bridgeJSLowerStackReturn() + self.y.bridgeJSLowerStackReturn() + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + 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(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Point") +fileprivate func _bjs_struct_lift_Point() -> Int32 +#else +fileprivate func _bjs_struct_lift_Point() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +extension PointerFields: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PointerFields { + let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter() + let ptr = UnsafePointer.bridgeJSLiftParameter() + let opaque = OpaquePointer.bridgeJSLiftParameter() + let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter() + let raw = UnsafeRawPointer.bridgeJSLiftParameter() + return PointerFields(raw: raw, mutRaw: mutRaw, opaque: opaque, ptr: ptr, mutPtr: mutPtr) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + self.raw.bridgeJSLowerStackReturn() + self.mutRaw.bridgeJSLowerStackReturn() + self.opaque.bridgeJSLowerStackReturn() + self.ptr.bridgeJSLowerStackReturn() + self.mutPtr.bridgeJSLowerStackReturn() + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + 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(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PointerFields") +fileprivate func _bjs_struct_lift_PointerFields() -> Int32 +#else +fileprivate func _bjs_struct_lift_PointerFields() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_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 @@ -4654,683 +4654,802 @@ public func _bjs_roundtripAPINetworkingResult(_ result: Int32) -> Void { #endif } -@_expose(wasm, "bjs_roundTripOptionalString") -@_cdecl("bjs_roundTripOptionalString") -public func _bjs_roundTripOptionalString(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalString(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalInt") -@_cdecl("bjs_roundTripOptionalInt") -public func _bjs_roundTripOptionalInt(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalInt(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalBool") -@_cdecl("bjs_roundTripOptionalBool") -public func _bjs_roundTripOptionalBool(_ flagIsSome: Int32, _ flagValue: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalBool(flag: Optional.bridgeJSLiftParameter(flagIsSome, flagValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalFloat") -@_cdecl("bjs_roundTripOptionalFloat") -public func _bjs_roundTripOptionalFloat(_ numberIsSome: Int32, _ numberValue: Float32) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalFloat(number: Optional.bridgeJSLiftParameter(numberIsSome, numberValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalDouble") -@_cdecl("bjs_roundTripOptionalDouble") -public func _bjs_roundTripOptionalDouble(_ precisionIsSome: Int32, _ precisionValue: Float64) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalDouble(precision: Optional.bridgeJSLiftParameter(precisionIsSome, precisionValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalSyntax") -@_cdecl("bjs_roundTripOptionalSyntax") -public func _bjs_roundTripOptionalSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { +@_expose(wasm, "bjs_roundTripAllTypesResult") +@_cdecl("bjs_roundTripAllTypesResult") +public func _bjs_roundTripAllTypesResult(_ result: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + let ret = roundTripAllTypesResult(_: AllTypesResult.bridgeJSLiftParameter(result)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalMixSyntax") -@_cdecl("bjs_roundTripOptionalMixSyntax") -public func _bjs_roundTripOptionalMixSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { +@_expose(wasm, "bjs_roundTripTypedPayloadResult") +@_cdecl("bjs_roundTripTypedPayloadResult") +public func _bjs_roundTripTypedPayloadResult(_ result: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalMixSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + let ret = roundTripTypedPayloadResult(_: TypedPayloadResult.bridgeJSLiftParameter(result)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalSwiftSyntax") -@_cdecl("bjs_roundTripOptionalSwiftSyntax") -public func _bjs_roundTripOptionalSwiftSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { +@_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 = roundTripOptionalSwiftSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + 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_roundTripOptionalWithSpaces") -@_cdecl("bjs_roundTripOptionalWithSpaces") -public func _bjs_roundTripOptionalWithSpaces(_ valueIsSome: Int32, _ valueValue: Float64) -> Void { +@_expose(wasm, "bjs_testPropertyHolder") +@_cdecl("bjs_testPropertyHolder") +public func _bjs_testPropertyHolder(_ holder: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = roundTripOptionalWithSpaces(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + let ret = testPropertyHolder(holder: PropertyHolder.bridgeJSLiftParameter(holder)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalTypeAlias") -@_cdecl("bjs_roundTripOptionalTypeAlias") -public func _bjs_roundTripOptionalTypeAlias(_ ageIsSome: Int32, _ ageValue: Int32) -> Void { +@_expose(wasm, "bjs_resetObserverCounts") +@_cdecl("bjs_resetObserverCounts") +public func _bjs_resetObserverCounts() -> Void { #if arch(wasm32) - let ret = roundTripOptionalTypeAlias(age: Optional.bridgeJSLiftParameter(ageIsSome, ageValue)) - return ret.bridgeJSLowerReturn() + resetObserverCounts() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalStatus") -@_cdecl("bjs_roundTripOptionalStatus") -public func _bjs_roundTripOptionalStatus(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { +@_expose(wasm, "bjs_getObserverStats") +@_cdecl("bjs_getObserverStats") +public func _bjs_getObserverStats() -> Void { #if arch(wasm32) - let ret = roundTripOptionalStatus(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + let ret = getObserverStats() return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalTheme") -@_cdecl("bjs_roundTripOptionalTheme") -public func _bjs_roundTripOptionalTheme(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { +@_expose(wasm, "bjs_testStringDefault") +@_cdecl("bjs_testStringDefault") +public func _bjs_testStringDefault(_ messageBytes: Int32, _ messageLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalTheme(value: Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength)) + let ret = testStringDefault(message: String.bridgeJSLiftParameter(messageBytes, messageLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalHttpStatus") -@_cdecl("bjs_roundTripOptionalHttpStatus") -public func _bjs_roundTripOptionalHttpStatus(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { +@_expose(wasm, "bjs_testIntDefault") +@_cdecl("bjs_testIntDefault") +public func _bjs_testIntDefault(_ count: Int32) -> Int32 { #if arch(wasm32) - let ret = roundTripOptionalHttpStatus(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + let ret = testIntDefault(count: Int.bridgeJSLiftParameter(count)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalTSDirection") -@_cdecl("bjs_roundTripOptionalTSDirection") -public func _bjs_roundTripOptionalTSDirection(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { +@_expose(wasm, "bjs_testBoolDefault") +@_cdecl("bjs_testBoolDefault") +public func _bjs_testBoolDefault(_ flag: Int32) -> Int32 { #if arch(wasm32) - let ret = roundTripOptionalTSDirection(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + let ret = testBoolDefault(flag: Bool.bridgeJSLiftParameter(flag)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalTSTheme") -@_cdecl("bjs_roundTripOptionalTSTheme") -public func _bjs_roundTripOptionalTSTheme(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { +@_expose(wasm, "bjs_testOptionalDefault") +@_cdecl("bjs_testOptionalDefault") +public func _bjs_testOptionalDefault(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalTSTheme(value: Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength)) + let ret = testOptionalDefault(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalNetworkingAPIMethod") -@_cdecl("bjs_roundTripOptionalNetworkingAPIMethod") -public func _bjs_roundTripOptionalNetworkingAPIMethod(_ methodIsSome: Int32, _ methodValue: Int32) -> Void { +@_expose(wasm, "bjs_testMultipleDefaults") +@_cdecl("bjs_testMultipleDefaults") +public func _bjs_testMultipleDefaults(_ titleBytes: Int32, _ titleLength: Int32, _ count: Int32, _ enabled: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalNetworkingAPIMethod(_: Optional.bridgeJSLiftParameter(methodIsSome, methodValue)) + let ret = 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_roundTripOptionalAPIResult") -@_cdecl("bjs_roundTripOptionalAPIResult") -public func _bjs_roundTripOptionalAPIResult(_ valueIsSome: Int32, _ valueCaseId: Int32) -> Void { +@_expose(wasm, "bjs_testSimpleEnumDefault") +@_cdecl("bjs_testSimpleEnumDefault") +public func _bjs_testSimpleEnumDefault(_ status: Int32) -> Int32 { #if arch(wasm32) - let ret = roundTripOptionalAPIResult(value: Optional.bridgeJSLiftParameter(valueIsSome, valueCaseId)) + let ret = testSimpleEnumDefault(status: Status.bridgeJSLiftParameter(status)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripTypedPayloadResult") -@_cdecl("bjs_roundTripTypedPayloadResult") -public func _bjs_roundTripTypedPayloadResult(_ result: Int32) -> Void { +@_expose(wasm, "bjs_testDirectionDefault") +@_cdecl("bjs_testDirectionDefault") +public func _bjs_testDirectionDefault(_ direction: Int32) -> Int32 { #if arch(wasm32) - let ret = roundTripTypedPayloadResult(_: TypedPayloadResult.bridgeJSLiftParameter(result)) + let ret = testDirectionDefault(direction: Direction.bridgeJSLiftParameter(direction)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalTypedPayloadResult") -@_cdecl("bjs_roundTripOptionalTypedPayloadResult") -public func _bjs_roundTripOptionalTypedPayloadResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { +@_expose(wasm, "bjs_testRawStringEnumDefault") +@_cdecl("bjs_testRawStringEnumDefault") +public func _bjs_testRawStringEnumDefault(_ themeBytes: Int32, _ themeLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalTypedPayloadResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + let ret = testRawStringEnumDefault(theme: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_compareAPIResults") -@_cdecl("bjs_compareAPIResults") -public func _bjs_compareAPIResults(_ r1IsSome: Int32, _ r1CaseId: Int32, _ r2IsSome: Int32, _ r2CaseId: Int32) -> Void { +@_expose(wasm, "bjs_testComplexInit") +@_cdecl("bjs_testComplexInit") +public func _bjs_testComplexInit(_ greeter: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let _tmp_r2 = Optional.bridgeJSLiftParameter(r2IsSome, r2CaseId) - let _tmp_r1 = Optional.bridgeJSLiftParameter(r1IsSome, r1CaseId) - let ret = compareAPIResults(_: _tmp_r1, _: _tmp_r2) + let ret = testComplexInit(greeter: Greeter.bridgeJSLiftParameter(greeter)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalComplexResult") -@_cdecl("bjs_roundTripOptionalComplexResult") -public func _bjs_roundTripOptionalComplexResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { +@_expose(wasm, "bjs_testEmptyInit") +@_cdecl("bjs_testEmptyInit") +public func _bjs_testEmptyInit(_ object: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = roundTripOptionalComplexResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + let ret = testEmptyInit(_: StaticPropertyHolder.bridgeJSLiftParameter(object)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripAllTypesResult") -@_cdecl("bjs_roundTripAllTypesResult") -public func _bjs_roundTripAllTypesResult(_ result: Int32) -> Void { +@_expose(wasm, "bjs_arrayWithDefault") +@_cdecl("bjs_arrayWithDefault") +public func _bjs_arrayWithDefault() -> Int32 { #if arch(wasm32) - let ret = roundTripAllTypesResult(_: AllTypesResult.bridgeJSLiftParameter(result)) + let ret = arrayWithDefault(_: [Int].bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalAllTypesResult") -@_cdecl("bjs_roundTripOptionalAllTypesResult") -public func _bjs_roundTripOptionalAllTypesResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { +@_expose(wasm, "bjs_arrayWithOptionalDefault") +@_cdecl("bjs_arrayWithOptionalDefault") +public func _bjs_arrayWithOptionalDefault(_ values: Int32) -> Int32 { #if arch(wasm32) - let ret = roundTripOptionalAllTypesResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + let ret = arrayWithOptionalDefault(_: { + if values == 0 { + return Optional<[Int]>.none + } else { + return [Int].bridgeJSLiftParameter() + } + }()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalPayloadResult") -@_cdecl("bjs_roundTripOptionalPayloadResult") -public func _bjs_roundTripOptionalPayloadResult(_ result: Int32) -> Void { +@_expose(wasm, "bjs_arrayMixedDefaults") +@_cdecl("bjs_arrayMixedDefaults") +public func _bjs_arrayMixedDefaults(_ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalPayloadResult(_: OptionalAllTypesResult.bridgeJSLiftParameter(result)) + let ret = arrayMixedDefaults(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength), values: [Int].bridgeJSLiftParameter(), suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalPayloadResultOpt") -@_cdecl("bjs_roundTripOptionalPayloadResultOpt") -public func _bjs_roundTripOptionalPayloadResultOpt(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { +@_expose(wasm, "bjs_formatName") +@_cdecl("bjs_formatName") +public func _bjs_formatName(_ nameBytes: Int32, _ nameLength: Int32, _ transform: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalPayloadResultOpt(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + 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_roundTripOptionalClass") -@_cdecl("bjs_roundTripOptionalClass") -public func _bjs_roundTripOptionalClass(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_makeFormatter") +@_cdecl("bjs_makeFormatter") +public func _bjs_makeFormatter(_ prefixBytes: Int32, _ prefixLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = roundTripOptionalClass(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - return ret.bridgeJSLowerReturn() + let ret = makeFormatter(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) + return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalGreeter") -@_cdecl("bjs_roundTripOptionalGreeter") -public func _bjs_roundTripOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_makeAdder") +@_cdecl("bjs_makeAdder") +public func _bjs_makeAdder(_ base: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = roundTripOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - return ret.bridgeJSLowerReturn() + let ret = makeAdder(base: Int.bridgeJSLiftParameter(base)) + return _BJS_Closure_20BridgeJSRuntimeTestsSi_Si.bridgeJSLower(ret) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_applyOptionalGreeter") -@_cdecl("bjs_applyOptionalGreeter") -public func _bjs_applyOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer, _ transform: Int32) -> Void { +@_expose(wasm, "bjs_roundTripIntArray") +@_cdecl("bjs_roundTripIntArray") +public func _bjs_roundTripIntArray() -> Void { #if arch(wasm32) - let ret = applyOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue), _: _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC.bridgeJSLift(transform)) - return ret.bridgeJSLowerReturn() + let ret = roundTripIntArray(_: [Int].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_makeOptionalHolder") -@_cdecl("bjs_makeOptionalHolder") -public func _bjs_makeOptionalHolder(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_roundTripStringArray") +@_cdecl("bjs_roundTripStringArray") +public func _bjs_roundTripStringArray() -> Void { #if arch(wasm32) - let ret = makeOptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsSome, undefinedNumberValue)) - return ret.bridgeJSLowerReturn() + let ret = roundTripStringArray(_: [String].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalAPIOptionalResult") -@_cdecl("bjs_roundTripOptionalAPIOptionalResult") -public func _bjs_roundTripOptionalAPIOptionalResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { +@_expose(wasm, "bjs_roundTripDoubleArray") +@_cdecl("bjs_roundTripDoubleArray") +public func _bjs_roundTripDoubleArray() -> Void { #if arch(wasm32) - let ret = roundTripOptionalAPIOptionalResult(result: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) - return ret.bridgeJSLowerReturn() + let ret = roundTripDoubleArray(_: [Double].bridgeJSLiftParameter()) + 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 { +@_expose(wasm, "bjs_roundTripBoolArray") +@_cdecl("bjs_roundTripBoolArray") +public func _bjs_roundTripBoolArray() -> Void { #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() + let ret = roundTripBoolArray(_: [Bool].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testPropertyHolder") -@_cdecl("bjs_testPropertyHolder") -public func _bjs_testPropertyHolder(_ holder: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_roundTripDirectionArray") +@_cdecl("bjs_roundTripDirectionArray") +public func _bjs_roundTripDirectionArray() -> Void { #if arch(wasm32) - let ret = testPropertyHolder(holder: PropertyHolder.bridgeJSLiftParameter(holder)) - return ret.bridgeJSLowerReturn() + let ret = roundTripDirectionArray(_: [Direction].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_resetObserverCounts") -@_cdecl("bjs_resetObserverCounts") -public func _bjs_resetObserverCounts() -> Void { +@_expose(wasm, "bjs_roundTripStatusArray") +@_cdecl("bjs_roundTripStatusArray") +public func _bjs_roundTripStatusArray() -> Void { #if arch(wasm32) - resetObserverCounts() + let ret = roundTripStatusArray(_: [Status].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_getObserverStats") -@_cdecl("bjs_getObserverStats") -public func _bjs_getObserverStats() -> Void { +@_expose(wasm, "bjs_roundTripThemeArray") +@_cdecl("bjs_roundTripThemeArray") +public func _bjs_roundTripThemeArray() -> Void { #if arch(wasm32) - let ret = getObserverStats() - return ret.bridgeJSLowerReturn() + let ret = roundTripThemeArray(_: [Theme].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testStringDefault") -@_cdecl("bjs_testStringDefault") -public func _bjs_testStringDefault(_ messageBytes: Int32, _ messageLength: Int32) -> Void { +@_expose(wasm, "bjs_roundTripHttpStatusArray") +@_cdecl("bjs_roundTripHttpStatusArray") +public func _bjs_roundTripHttpStatusArray() -> Void { #if arch(wasm32) - let ret = testStringDefault(message: String.bridgeJSLiftParameter(messageBytes, messageLength)) - return ret.bridgeJSLowerReturn() + let ret = roundTripHttpStatusArray(_: [HttpStatus].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testIntDefault") -@_cdecl("bjs_testIntDefault") -public func _bjs_testIntDefault(_ count: Int32) -> Int32 { +@_expose(wasm, "bjs_roundTripDataPointArray") +@_cdecl("bjs_roundTripDataPointArray") +public func _bjs_roundTripDataPointArray() -> Void { #if arch(wasm32) - let ret = testIntDefault(count: Int.bridgeJSLiftParameter(count)) - return ret.bridgeJSLowerReturn() + let ret = roundTripDataPointArray(_: [DataPoint].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testBoolDefault") -@_cdecl("bjs_testBoolDefault") -public func _bjs_testBoolDefault(_ flag: Int32) -> Int32 { +@_expose(wasm, "bjs_roundTripGreeterArray") +@_cdecl("bjs_roundTripGreeterArray") +public func _bjs_roundTripGreeterArray() -> Void { #if arch(wasm32) - let ret = testBoolDefault(flag: Bool.bridgeJSLiftParameter(flag)) - return ret.bridgeJSLowerReturn() + let ret = roundTripGreeterArray(_: [Greeter].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testOptionalDefault") -@_cdecl("bjs_testOptionalDefault") -public func _bjs_testOptionalDefault(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { +@_expose(wasm, "bjs_roundTripOptionalIntArray") +@_cdecl("bjs_roundTripOptionalIntArray") +public func _bjs_roundTripOptionalIntArray() -> Void { #if arch(wasm32) - let ret = testOptionalDefault(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalIntArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testMultipleDefaults") -@_cdecl("bjs_testMultipleDefaults") -public func _bjs_testMultipleDefaults(_ titleBytes: Int32, _ titleLength: Int32, _ count: Int32, _ enabled: Int32) -> Void { +@_expose(wasm, "bjs_roundTripOptionalStringArray") +@_cdecl("bjs_roundTripOptionalStringArray") +public func _bjs_roundTripOptionalStringArray() -> Void { #if arch(wasm32) - let ret = testMultipleDefaults(title: String.bridgeJSLiftParameter(titleBytes, titleLength), count: Int.bridgeJSLiftParameter(count), enabled: Bool.bridgeJSLiftParameter(enabled)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalStringArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testSimpleEnumDefault") -@_cdecl("bjs_testSimpleEnumDefault") -public func _bjs_testSimpleEnumDefault(_ status: Int32) -> Int32 { +@_expose(wasm, "bjs_roundTripOptionalDataPointArray") +@_cdecl("bjs_roundTripOptionalDataPointArray") +public func _bjs_roundTripOptionalDataPointArray() -> Void { #if arch(wasm32) - let ret = testSimpleEnumDefault(status: Status.bridgeJSLiftParameter(status)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalDataPointArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testDirectionDefault") -@_cdecl("bjs_testDirectionDefault") -public func _bjs_testDirectionDefault(_ direction: Int32) -> Int32 { +@_expose(wasm, "bjs_roundTripOptionalDirectionArray") +@_cdecl("bjs_roundTripOptionalDirectionArray") +public func _bjs_roundTripOptionalDirectionArray() -> Void { #if arch(wasm32) - let ret = testDirectionDefault(direction: Direction.bridgeJSLiftParameter(direction)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalDirectionArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testRawStringEnumDefault") -@_cdecl("bjs_testRawStringEnumDefault") -public func _bjs_testRawStringEnumDefault(_ themeBytes: Int32, _ themeLength: Int32) -> Void { +@_expose(wasm, "bjs_roundTripOptionalStatusArray") +@_cdecl("bjs_roundTripOptionalStatusArray") +public func _bjs_roundTripOptionalStatusArray() -> Void { #if arch(wasm32) - let ret = testRawStringEnumDefault(theme: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalStatusArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [Optional] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append(Optional.bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + let __bjs_isSome_ret_elem = __bjs_elem_ret != nil + if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testComplexInit") -@_cdecl("bjs_testComplexInit") -public func _bjs_testComplexInit(_ greeter: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_roundTripOptionalIntArrayType") +@_cdecl("bjs_roundTripOptionalIntArrayType") +public func _bjs_roundTripOptionalIntArrayType(_ values: Int32) -> Void { #if arch(wasm32) - let ret = testComplexInit(greeter: Greeter.bridgeJSLiftParameter(greeter)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalIntArrayType(_: { + if values == 0 { + return Optional<[Int]>.none + } else { + return [Int].bridgeJSLiftParameter() + } + }()) + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + __bjs_unwrapped_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_testEmptyInit") -@_cdecl("bjs_testEmptyInit") -public func _bjs_testEmptyInit(_ object: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_roundTripOptionalStringArrayType") +@_cdecl("bjs_roundTripOptionalStringArrayType") +public func _bjs_roundTripOptionalStringArrayType(_ values: Int32) -> Void { #if arch(wasm32) - let ret = testEmptyInit(_: StaticPropertyHolder.bridgeJSLiftParameter(object)) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalStringArrayType(_: { + if values == 0 { + return Optional<[String]>.none + } else { + return [String].bridgeJSLiftParameter() + } + }()) + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + __bjs_unwrapped_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_arrayWithDefault") -@_cdecl("bjs_arrayWithDefault") -public func _bjs_arrayWithDefault() -> Int32 { +@_expose(wasm, "bjs_roundTripOptionalGreeterArrayType") +@_cdecl("bjs_roundTripOptionalGreeterArrayType") +public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { #if arch(wasm32) - let ret = arrayWithDefault(_: [Int].bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() + let ret = roundTripOptionalGreeterArrayType(_: { + if greeters == 0 { + return Optional<[Greeter]>.none + } else { + return [Greeter].bridgeJSLiftParameter() + } + }()) + let __bjs_isSome_ret = ret != nil + if let __bjs_unwrapped_ret = ret { + __bjs_unwrapped_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_arrayWithOptionalDefault") -@_cdecl("bjs_arrayWithOptionalDefault") -public func _bjs_arrayWithOptionalDefault(_ values: Int32) -> Int32 { +@_expose(wasm, "bjs_roundTripNestedIntArray") +@_cdecl("bjs_roundTripNestedIntArray") +public func _bjs_roundTripNestedIntArray() -> Void { #if arch(wasm32) - let ret = arrayWithOptionalDefault(_: { - if values == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() + let ret = roundTripNestedIntArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[Int]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([Int].bridgeJSLiftParameter()) } + __result.reverse() + return __result }()) - return ret.bridgeJSLowerReturn() + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_arrayMixedDefaults") -@_cdecl("bjs_arrayMixedDefaults") -public func _bjs_arrayMixedDefaults(_ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { +@_expose(wasm, "bjs_roundTripNestedStringArray") +@_cdecl("bjs_roundTripNestedStringArray") +public func _bjs_roundTripNestedStringArray() -> Void { #if arch(wasm32) - let ret = arrayMixedDefaults(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength), values: [Int].bridgeJSLiftParameter(), suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) - return ret.bridgeJSLowerReturn() + let ret = roundTripNestedStringArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[String]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([String].bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #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 { +@_expose(wasm, "bjs_roundTripNestedDoubleArray") +@_cdecl("bjs_roundTripNestedDoubleArray") +public func _bjs_roundTripNestedDoubleArray() -> Void { #if arch(wasm32) - let ret = formatName(_: String.bridgeJSLiftParameter(nameBytes, nameLength), transform: _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(transform)) - return ret.bridgeJSLowerReturn() + let ret = roundTripNestedDoubleArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[Double]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([Double].bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_makeFormatter") -@_cdecl("bjs_makeFormatter") -public func _bjs_makeFormatter(_ prefixBytes: Int32, _ prefixLength: Int32) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_roundTripNestedBoolArray") +@_cdecl("bjs_roundTripNestedBoolArray") +public func _bjs_roundTripNestedBoolArray() -> Void { #if arch(wasm32) - let ret = makeFormatter(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) - return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(ret) + let ret = roundTripNestedBoolArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[Bool]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([Bool].bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_makeAdder") -@_cdecl("bjs_makeAdder") -public func _bjs_makeAdder(_ base: Int32) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_roundTripNestedDataPointArray") +@_cdecl("bjs_roundTripNestedDataPointArray") +public func _bjs_roundTripNestedDataPointArray() -> Void { #if arch(wasm32) - let ret = makeAdder(base: Int.bridgeJSLiftParameter(base)) - return _BJS_Closure_20BridgeJSRuntimeTestsSi_Si.bridgeJSLower(ret) + let ret = roundTripNestedDataPointArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[DataPoint]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([DataPoint].bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripIntArray") -@_cdecl("bjs_roundTripIntArray") -public func _bjs_roundTripIntArray() -> Void { +@_expose(wasm, "bjs_roundTripNestedDirectionArray") +@_cdecl("bjs_roundTripNestedDirectionArray") +public func _bjs_roundTripNestedDirectionArray() -> Void { #if arch(wasm32) - let ret = roundTripIntArray(_: [Int].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripNestedDirectionArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[Direction]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([Direction].bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripStringArray") -@_cdecl("bjs_roundTripStringArray") -public func _bjs_roundTripStringArray() -> Void { +@_expose(wasm, "bjs_roundTripNestedGreeterArray") +@_cdecl("bjs_roundTripNestedGreeterArray") +public func _bjs_roundTripNestedGreeterArray() -> Void { #if arch(wasm32) - let ret = roundTripStringArray(_: [String].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripNestedGreeterArray(_: { + let __count = Int(_swift_js_pop_i32()) + var __result: [[Greeter]] = [] + __result.reserveCapacity(__count) + for _ in 0 ..< __count { + __result.append([Greeter].bridgeJSLiftParameter()) + } + __result.reverse() + return __result + }()) + for __bjs_elem_ret in ret { + __bjs_elem_ret.bridgeJSLowerReturn()} + _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripDoubleArray") -@_cdecl("bjs_roundTripDoubleArray") -public func _bjs_roundTripDoubleArray() -> Void { +@_expose(wasm, "bjs_roundTripUnsafeRawPointerArray") +@_cdecl("bjs_roundTripUnsafeRawPointerArray") +public func _bjs_roundTripUnsafeRawPointerArray() -> Void { #if arch(wasm32) - let ret = roundTripDoubleArray(_: [Double].bridgeJSLiftParameter()) + let ret = roundTripUnsafeRawPointerArray(_: [UnsafeRawPointer].bridgeJSLiftParameter()) ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripBoolArray") -@_cdecl("bjs_roundTripBoolArray") -public func _bjs_roundTripBoolArray() -> Void { +@_expose(wasm, "bjs_roundTripUnsafeMutableRawPointerArray") +@_cdecl("bjs_roundTripUnsafeMutableRawPointerArray") +public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { #if arch(wasm32) - let ret = roundTripBoolArray(_: [Bool].bridgeJSLiftParameter()) + let ret = roundTripUnsafeMutableRawPointerArray(_: [UnsafeMutableRawPointer].bridgeJSLiftParameter()) ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripDirectionArray") -@_cdecl("bjs_roundTripDirectionArray") -public func _bjs_roundTripDirectionArray() -> Void { +@_expose(wasm, "bjs_roundTripOpaquePointerArray") +@_cdecl("bjs_roundTripOpaquePointerArray") +public func _bjs_roundTripOpaquePointerArray() -> Void { #if arch(wasm32) - let ret = roundTripDirectionArray(_: [Direction].bridgeJSLiftParameter()) + let ret = roundTripOpaquePointerArray(_: [OpaquePointer].bridgeJSLiftParameter()) ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripStatusArray") -@_cdecl("bjs_roundTripStatusArray") -public func _bjs_roundTripStatusArray() -> Void { +@_expose(wasm, "bjs_roundTripUnsafePointerArray") +@_cdecl("bjs_roundTripUnsafePointerArray") +public func _bjs_roundTripUnsafePointerArray() -> Void { #if arch(wasm32) - let ret = roundTripStatusArray(_: [Status].bridgeJSLiftParameter()) + let ret = roundTripUnsafePointerArray(_: [UnsafePointer].bridgeJSLiftParameter()) ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripThemeArray") -@_cdecl("bjs_roundTripThemeArray") -public func _bjs_roundTripThemeArray() -> Void { +@_expose(wasm, "bjs_roundTripUnsafeMutablePointerArray") +@_cdecl("bjs_roundTripUnsafeMutablePointerArray") +public func _bjs_roundTripUnsafeMutablePointerArray() -> Void { #if arch(wasm32) - let ret = roundTripThemeArray(_: [Theme].bridgeJSLiftParameter()) + let ret = roundTripUnsafeMutablePointerArray(_: [UnsafeMutablePointer].bridgeJSLiftParameter()) ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripHttpStatusArray") -@_cdecl("bjs_roundTripHttpStatusArray") -public func _bjs_roundTripHttpStatusArray() -> Void { +@_expose(wasm, "bjs_consumeDataProcessorArrayType") +@_cdecl("bjs_consumeDataProcessorArrayType") +public func _bjs_consumeDataProcessorArrayType() -> Int32 { #if arch(wasm32) - let ret = roundTripHttpStatusArray(_: [HttpStatus].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = consumeDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripDataPointArray") -@_cdecl("bjs_roundTripDataPointArray") -public func _bjs_roundTripDataPointArray() -> Void { +@_expose(wasm, "bjs_roundTripDataProcessorArrayType") +@_cdecl("bjs_roundTripDataProcessorArrayType") +public func _bjs_roundTripDataProcessorArrayType() -> Void { #if arch(wasm32) - let ret = roundTripDataPointArray(_: [DataPoint].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSLiftParameter()) + ret.map { + $0 as! AnyDataProcessor + } .bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripGreeterArray") -@_cdecl("bjs_roundTripGreeterArray") -public func _bjs_roundTripGreeterArray() -> Void { +@_expose(wasm, "bjs_roundTripJSObjectArray") +@_cdecl("bjs_roundTripJSObjectArray") +public func _bjs_roundTripJSObjectArray() -> Void { #if arch(wasm32) - let ret = roundTripGreeterArray(_: [Greeter].bridgeJSLiftParameter()) + let ret = roundTripJSObjectArray(_: [JSObject].bridgeJSLiftParameter()) ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalIntArray") -@_cdecl("bjs_roundTripOptionalIntArray") -public func _bjs_roundTripOptionalIntArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalJSObjectArray") +@_cdecl("bjs_roundTripOptionalJSObjectArray") +public func _bjs_roundTripOptionalJSObjectArray() -> Void { #if arch(wasm32) - let ret = roundTripOptionalIntArray(_: { + let ret = roundTripOptionalJSObjectArray(_: { let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] + var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result @@ -5346,41 +5465,40 @@ public func _bjs_roundTripOptionalIntArray() -> Void { #endif } -@_expose(wasm, "bjs_roundTripOptionalStringArray") -@_cdecl("bjs_roundTripOptionalStringArray") -public func _bjs_roundTripOptionalStringArray() -> Void { +@_expose(wasm, "bjs_roundTripFooArray") +@_cdecl("bjs_roundTripFooArray") +public func _bjs_roundTripFooArray() -> Void { #if arch(wasm32) - let ret = roundTripOptionalStringArray(_: { + let ret = roundTripFooArray(_: { let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] + var __result: [Foo] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter())) } __result.reverse() return __result }()) - for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_i32(Int32(ret.count)) + ret.map { + $0.jsObject + } .bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalDataPointArray") -@_cdecl("bjs_roundTripOptionalDataPointArray") -public func _bjs_roundTripOptionalDataPointArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalFooArray") +@_cdecl("bjs_roundTripOptionalFooArray") +public func _bjs_roundTripOptionalFooArray() -> Void { #if arch(wasm32) - let ret = roundTripOptionalDataPointArray(_: { + let ret = roundTripOptionalFooArray(_: { let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] + var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSLiftParameter().map { + Foo(unsafelyWrapping: $0) + }) } __result.reverse() return __result @@ -5388,7 +5506,7 @@ public func _bjs_roundTripOptionalDataPointArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} + __bjs_unwrapped_ret_elem.jsObject.bridgeJSLowerStackReturn()} _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} _swift_js_push_i32(Int32(ret.count)) #else @@ -5396,429 +5514,311 @@ public func _bjs_roundTripOptionalDataPointArray() -> Void { #endif } -@_expose(wasm, "bjs_roundTripOptionalDirectionArray") -@_cdecl("bjs_roundTripOptionalDirectionArray") -public func _bjs_roundTripOptionalDirectionArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalString") +@_cdecl("bjs_roundTripOptionalString") +public func _bjs_roundTripOptionalString(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalDirectionArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalString(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalStatusArray") -@_cdecl("bjs_roundTripOptionalStatusArray") -public func _bjs_roundTripOptionalStatusArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalInt") +@_cdecl("bjs_roundTripOptionalInt") +public func _bjs_roundTripOptionalInt(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalStatusArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalInt(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalIntArrayType") -@_cdecl("bjs_roundTripOptionalIntArrayType") -public func _bjs_roundTripOptionalIntArrayType(_ values: Int32) -> Void { +@_expose(wasm, "bjs_roundTripOptionalBool") +@_cdecl("bjs_roundTripOptionalBool") +public func _bjs_roundTripOptionalBool(_ flagIsSome: Int32, _ flagValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalIntArrayType(_: { - if values == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() - } - }()) - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + let ret = roundTripOptionalBool(flag: Optional.bridgeJSLiftParameter(flagIsSome, flagValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalFloat") +@_cdecl("bjs_roundTripOptionalFloat") +public func _bjs_roundTripOptionalFloat(_ numberIsSome: Int32, _ numberValue: Float32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalFloat(number: Optional.bridgeJSLiftParameter(numberIsSome, numberValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalDouble") +@_cdecl("bjs_roundTripOptionalDouble") +public func _bjs_roundTripOptionalDouble(_ precisionIsSome: Int32, _ precisionValue: Float64) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalDouble(precision: Optional.bridgeJSLiftParameter(precisionIsSome, precisionValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalSyntax") +@_cdecl("bjs_roundTripOptionalSyntax") +public func _bjs_roundTripOptionalSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalMixSyntax") +@_cdecl("bjs_roundTripOptionalMixSyntax") +public func _bjs_roundTripOptionalMixSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalMixSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalSwiftSyntax") +@_cdecl("bjs_roundTripOptionalSwiftSyntax") +public func _bjs_roundTripOptionalSwiftSyntax(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalSwiftSyntax(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalStringArrayType") -@_cdecl("bjs_roundTripOptionalStringArrayType") -public func _bjs_roundTripOptionalStringArrayType(_ values: Int32) -> Void { +@_expose(wasm, "bjs_roundTripOptionalWithSpaces") +@_cdecl("bjs_roundTripOptionalWithSpaces") +public func _bjs_roundTripOptionalWithSpaces(_ valueIsSome: Int32, _ valueValue: Float64) -> Void { #if arch(wasm32) - let ret = roundTripOptionalStringArrayType(_: { - if values == 0 { - return Optional<[String]>.none - } else { - return [String].bridgeJSLiftParameter() - } - }()) - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + let ret = roundTripOptionalWithSpaces(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalGreeterArrayType") -@_cdecl("bjs_roundTripOptionalGreeterArrayType") -public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { +@_expose(wasm, "bjs_roundTripOptionalTypeAlias") +@_cdecl("bjs_roundTripOptionalTypeAlias") +public func _bjs_roundTripOptionalTypeAlias(_ ageIsSome: Int32, _ ageValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalGreeterArrayType(_: { - if greeters == 0 { - return Optional<[Greeter]>.none - } else { - return [Greeter].bridgeJSLiftParameter() - } - }()) - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + let ret = roundTripOptionalTypeAlias(age: Optional.bridgeJSLiftParameter(ageIsSome, ageValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedIntArray") -@_cdecl("bjs_roundTripNestedIntArray") -public func _bjs_roundTripNestedIntArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalStatus") +@_cdecl("bjs_roundTripOptionalStatus") +public func _bjs_roundTripOptionalStatus(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedIntArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Int]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([Int].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalStatus(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedStringArray") -@_cdecl("bjs_roundTripNestedStringArray") -public func _bjs_roundTripNestedStringArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalTheme") +@_cdecl("bjs_roundTripOptionalTheme") +public func _bjs_roundTripOptionalTheme(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedStringArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[String]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([String].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalTheme(value: Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedDoubleArray") -@_cdecl("bjs_roundTripNestedDoubleArray") -public func _bjs_roundTripNestedDoubleArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalHttpStatus") +@_cdecl("bjs_roundTripOptionalHttpStatus") +public func _bjs_roundTripOptionalHttpStatus(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedDoubleArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Double]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([Double].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalHttpStatus(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedBoolArray") -@_cdecl("bjs_roundTripNestedBoolArray") -public func _bjs_roundTripNestedBoolArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalTSDirection") +@_cdecl("bjs_roundTripOptionalTSDirection") +public func _bjs_roundTripOptionalTSDirection(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedBoolArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Bool]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([Bool].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalTSDirection(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedDataPointArray") -@_cdecl("bjs_roundTripNestedDataPointArray") -public func _bjs_roundTripNestedDataPointArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalTSTheme") +@_cdecl("bjs_roundTripOptionalTSTheme") +public func _bjs_roundTripOptionalTSTheme(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedDataPointArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[DataPoint]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([DataPoint].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalTSTheme(value: Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedDirectionArray") -@_cdecl("bjs_roundTripNestedDirectionArray") -public func _bjs_roundTripNestedDirectionArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalNetworkingAPIMethod") +@_cdecl("bjs_roundTripOptionalNetworkingAPIMethod") +public func _bjs_roundTripOptionalNetworkingAPIMethod(_ methodIsSome: Int32, _ methodValue: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedDirectionArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Direction]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([Direction].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalNetworkingAPIMethod(_: Optional.bridgeJSLiftParameter(methodIsSome, methodValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripNestedGreeterArray") -@_cdecl("bjs_roundTripNestedGreeterArray") -public func _bjs_roundTripNestedGreeterArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalAPIResult") +@_cdecl("bjs_roundTripOptionalAPIResult") +public func _bjs_roundTripOptionalAPIResult(_ valueIsSome: Int32, _ valueCaseId: Int32) -> Void { #if arch(wasm32) - let ret = roundTripNestedGreeterArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Greeter]] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append([Greeter].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalAPIResult(value: Optional.bridgeJSLiftParameter(valueIsSome, valueCaseId)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripUnsafeRawPointerArray") -@_cdecl("bjs_roundTripUnsafeRawPointerArray") -public func _bjs_roundTripUnsafeRawPointerArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalTypedPayloadResult") +@_cdecl("bjs_roundTripOptionalTypedPayloadResult") +public func _bjs_roundTripOptionalTypedPayloadResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) - let ret = roundTripUnsafeRawPointerArray(_: [UnsafeRawPointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripOptionalTypedPayloadResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripUnsafeMutableRawPointerArray") -@_cdecl("bjs_roundTripUnsafeMutableRawPointerArray") -public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { +@_expose(wasm, "bjs_compareAPIResults") +@_cdecl("bjs_compareAPIResults") +public func _bjs_compareAPIResults(_ r1IsSome: Int32, _ r1CaseId: Int32, _ r2IsSome: Int32, _ r2CaseId: Int32) -> Void { #if arch(wasm32) - let ret = roundTripUnsafeMutableRawPointerArray(_: [UnsafeMutableRawPointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let _tmp_r2 = Optional.bridgeJSLiftParameter(r2IsSome, r2CaseId) + let _tmp_r1 = Optional.bridgeJSLiftParameter(r1IsSome, r1CaseId) + let ret = compareAPIResults(_: _tmp_r1, _: _tmp_r2) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOpaquePointerArray") -@_cdecl("bjs_roundTripOpaquePointerArray") -public func _bjs_roundTripOpaquePointerArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalComplexResult") +@_cdecl("bjs_roundTripOptionalComplexResult") +public func _bjs_roundTripOptionalComplexResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOpaquePointerArray(_: [OpaquePointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripOptionalComplexResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripUnsafePointerArray") -@_cdecl("bjs_roundTripUnsafePointerArray") -public func _bjs_roundTripUnsafePointerArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalAllTypesResult") +@_cdecl("bjs_roundTripOptionalAllTypesResult") +public func _bjs_roundTripOptionalAllTypesResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) - let ret = roundTripUnsafePointerArray(_: [UnsafePointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripOptionalAllTypesResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripUnsafeMutablePointerArray") -@_cdecl("bjs_roundTripUnsafeMutablePointerArray") -public func _bjs_roundTripUnsafeMutablePointerArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalPayloadResult") +@_cdecl("bjs_roundTripOptionalPayloadResult") +public func _bjs_roundTripOptionalPayloadResult(_ result: Int32) -> Void { #if arch(wasm32) - let ret = roundTripUnsafeMutablePointerArray(_: [UnsafeMutablePointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripOptionalPayloadResult(_: OptionalAllTypesResult.bridgeJSLiftParameter(result)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_consumeDataProcessorArrayType") -@_cdecl("bjs_consumeDataProcessorArrayType") -public func _bjs_consumeDataProcessorArrayType() -> Int32 { +@_expose(wasm, "bjs_roundTripOptionalPayloadResultOpt") +@_cdecl("bjs_roundTripOptionalPayloadResultOpt") +public func _bjs_roundTripOptionalPayloadResultOpt(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) - let ret = consumeDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSLiftParameter()) + let ret = roundTripOptionalPayloadResultOpt(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripDataProcessorArrayType") -@_cdecl("bjs_roundTripDataProcessorArrayType") -public func _bjs_roundTripDataProcessorArrayType() -> Void { - #if arch(wasm32) - let ret = roundTripDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSLiftParameter()) - ret.map { - $0 as! AnyDataProcessor - } .bridgeJSLowerReturn() +@_expose(wasm, "bjs_roundTripOptionalClass") +@_cdecl("bjs_roundTripOptionalClass") +public func _bjs_roundTripOptionalClass(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalClass(value: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripJSObjectArray") -@_cdecl("bjs_roundTripJSObjectArray") -public func _bjs_roundTripJSObjectArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalGreeter") +@_cdecl("bjs_roundTripOptionalGreeter") +public func _bjs_roundTripOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = roundTripJSObjectArray(_: [JSObject].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalJSObjectArray") -@_cdecl("bjs_roundTripOptionalJSObjectArray") -public func _bjs_roundTripOptionalJSObjectArray() -> Void { +@_expose(wasm, "bjs_applyOptionalGreeter") +@_cdecl("bjs_applyOptionalGreeter") +public func _bjs_applyOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer, _ transform: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalJSObjectArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_i32(Int32(ret.count)) + let ret = applyOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue), _: _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC.bridgeJSLift(transform)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripFooArray") -@_cdecl("bjs_roundTripFooArray") -public func _bjs_roundTripFooArray() -> Void { +@_expose(wasm, "bjs_makeOptionalHolder") +@_cdecl("bjs_makeOptionalHolder") +public func _bjs_makeOptionalHolder(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = roundTripFooArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Foo] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter())) - } - __result.reverse() - return __result - }()) - ret.map { - $0.jsObject - } .bridgeJSLowerReturn() + let ret = makeOptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsSome, undefinedNumberValue)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_roundTripOptionalFooArray") -@_cdecl("bjs_roundTripOptionalFooArray") -public func _bjs_roundTripOptionalFooArray() -> Void { +@_expose(wasm, "bjs_roundTripOptionalAPIOptionalResult") +@_cdecl("bjs_roundTripOptionalAPIOptionalResult") +public func _bjs_roundTripOptionalAPIOptionalResult(_ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { #if arch(wasm32) - let ret = roundTripOptionalFooArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Optional] = [] - __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter().map { - Foo(unsafelyWrapping: $0) - }) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.jsObject.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripOptionalAPIOptionalResult(result: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -6299,302 +6299,125 @@ public func _bjs_Converter_init() -> UnsafeMutableRawPointer { public func _bjs_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_Converter_deinit") -@_cdecl("bjs_Converter_deinit") -public func _bjs_Converter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_Converter_wrap(Unmanaged.passRetained(self).toOpaque())))) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Converter_wrap") -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -@_expose(wasm, "bjs_HTTPServer_init") -@_cdecl("bjs_HTTPServer_init") -public func _bjs_HTTPServer_init() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = Networking.API.HTTPServer() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_HTTPServer_call") -@_cdecl("bjs_HTTPServer_call") -public func _bjs_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_HTTPServer_deinit") -@_cdecl("bjs_HTTPServer_deinit") -public func _bjs_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 { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_HTTPServer_wrap(Unmanaged.passRetained(self).toOpaque())))) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_HTTPServer_wrap") -fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -@_expose(wasm, "bjs_TestServer_init") -@_cdecl("bjs_TestServer_init") -public func _bjs_TestServer_init() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = Internal.TestServer() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TestServer_call") -@_cdecl("bjs_TestServer_call") -public func _bjs_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_TestServer_deinit") -@_cdecl("bjs_TestServer_deinit") -public func _bjs_TestServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_TestServer_wrap(Unmanaged.passRetained(self).toOpaque())))) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TestServer_wrap") -fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -@_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) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_OptionalHolder_deinit") -@_cdecl("bjs_OptionalHolder_deinit") -public func _bjs_OptionalHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_Converter_deinit") +@_cdecl("bjs_Converter_deinit") +public func _bjs_Converter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() + Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") #endif } -extension OptionalHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { +extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + return .object(JSObject(id: UInt32(bitPattern: _bjs_Converter_wrap(Unmanaged.passRetained(self).toOpaque())))) } } #if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalHolder_wrap") -fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Converter_wrap") +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif -@_expose(wasm, "bjs_OptionalPropertyHolder_init") -@_cdecl("bjs_OptionalPropertyHolder_init") -public func _bjs_OptionalPropertyHolder_init(_ optionalNameIsSome: Int32, _ optionalNameBytes: Int32, _ optionalNameLength: Int32) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_HTTPServer_init") +@_cdecl("bjs_HTTPServer_init") +public func _bjs_HTTPServer_init() -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = OptionalPropertyHolder(optionalName: Optional.bridgeJSLiftParameter(optionalNameIsSome, optionalNameBytes, optionalNameLength)) + let ret = Networking.API.HTTPServer() 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 { +@_expose(wasm, "bjs_HTTPServer_call") +@_cdecl("bjs_HTTPServer_call") +public func _bjs_HTTPServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { #if arch(wasm32) - let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName - return ret.bridgeJSLowerReturn() + Networking.API.HTTPServer.bridgeJSLiftParameter(_self).call(_: Networking.API.Method.bridgeJSLiftParameter(method)) #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 { +@_expose(wasm, "bjs_HTTPServer_deinit") +@_cdecl("bjs_HTTPServer_deinit") +public func _bjs_HTTPServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) + Unmanaged.fromOpaque(pointer).release() #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 +extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_HTTPServer_wrap(Unmanaged.passRetained(self).toOpaque())))) + } } -@_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 +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_HTTPServer_wrap") +fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") - #endif } +#endif -@_expose(wasm, "bjs_OptionalPropertyHolder_optionalGreeter_get") -@_cdecl("bjs_OptionalPropertyHolder_optionalGreeter_get") -public func _bjs_OptionalPropertyHolder_optionalGreeter_get(_ _self: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_TestServer_init") +@_cdecl("bjs_TestServer_init") +public func _bjs_TestServer_init() -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter + let ret = Internal.TestServer() 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 { +@_expose(wasm, "bjs_TestServer_call") +@_cdecl("bjs_TestServer_call") +public func _bjs_TestServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { #if arch(wasm32) - OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + Internal.TestServer.bridgeJSLiftParameter(_self).call(_: Internal.SupportedMethod.bridgeJSLiftParameter(method)) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_OptionalPropertyHolder_deinit") -@_cdecl("bjs_OptionalPropertyHolder_deinit") -public func _bjs_OptionalPropertyHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_TestServer_deinit") +@_cdecl("bjs_TestServer_deinit") +public func _bjs_TestServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() + Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") #endif } -extension OptionalPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { +extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + return .object(JSObject(id: UInt32(bitPattern: _bjs_TestServer_wrap(Unmanaged.passRetained(self).toOpaque())))) } } #if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalPropertyHolder_wrap") -fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TestServer_wrap") +fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -8147,181 +7970,358 @@ public func _bjs_TextProcessor_processOptionalGreeter(_ _self: UnsafeMutableRawP #endif } -@_expose(wasm, "bjs_TextProcessor_makeOptionalStringFormatter") -@_cdecl("bjs_TextProcessor_makeOptionalStringFormatter") -public func _bjs_TextProcessor_makeOptionalStringFormatter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_TextProcessor_makeOptionalStringFormatter") +@_cdecl("bjs_TextProcessor_makeOptionalStringFormatter") +public func _bjs_TextProcessor_makeOptionalStringFormatter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalStringFormatter() + return _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeOptionalGreeterCreator") +@_cdecl("bjs_TextProcessor_makeOptionalGreeterCreator") +public func _bjs_TextProcessor_makeOptionalGreeterCreator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalGreeterCreator() + return _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC.bridgeJSLower(ret) + #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) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() + return _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeThemeValidator") +@_cdecl("bjs_TextProcessor_makeThemeValidator") +public func _bjs_TextProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() + return _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeStatusCodeExtractor") +@_cdecl("bjs_TextProcessor_makeStatusCodeExtractor") +public func _bjs_TextProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() + return _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si.bridgeJSLower(ret) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeAPIResultHandler") +@_cdecl("bjs_TextProcessor_makeAPIResultHandler") +public func _bjs_TextProcessor_makeAPIResultHandler(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() + return _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS.bridgeJSLower(ret) + #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) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() + return _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS.bridgeJSLower(ret) + #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) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalStringFormatter() - return _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS.bridgeJSLower(ret) + Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_makeOptionalGreeterCreator") -@_cdecl("bjs_TextProcessor_makeOptionalGreeterCreator") -public func _bjs_TextProcessor_makeOptionalGreeterCreator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +extension TextProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_TextProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TextProcessor_wrap") +fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_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 = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalGreeterCreator() - return _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC.bridgeJSLower(ret) + 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_TextProcessor_processDirection") -@_cdecl("bjs_TextProcessor_processDirection") -public func _bjs_TextProcessor_processDirection(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { +@_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 = TextProcessor.bridgeJSLiftParameter(_self).processDirection(_: _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_SS.bridgeJSLift(callback)) + let ret = OptionalHolder.bridgeJSLiftParameter(_self).nullableGreeter 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 { +@_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) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processTheme(_: _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() + OptionalHolder.bridgeJSLiftParameter(_self).nullableGreeter = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) #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 { +@_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 = TextProcessor.bridgeJSLiftParameter(_self).processHttpStatus(_: _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si.bridgeJSLift(callback)) + let ret = OptionalHolder.bridgeJSLiftParameter(_self).undefinedNumber 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 { +@_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) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processAPIResult(_: _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() + OptionalHolder.bridgeJSLiftParameter(_self).undefinedNumber = JSUndefinedOr.bridgeJSLiftParameter(valueIsSome, valueValue) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_makeDirectionChecker") -@_cdecl("bjs_TextProcessor_makeDirectionChecker") -public func _bjs_TextProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_OptionalHolder_deinit") +@_cdecl("bjs_OptionalHolder_deinit") +public func _bjs_OptionalHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() - return _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb.bridgeJSLower(ret) + Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_makeThemeValidator") -@_cdecl("bjs_TextProcessor_makeThemeValidator") -public func _bjs_TextProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +extension OptionalHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalHolder_wrap") +fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_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 = TextProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() - return _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb.bridgeJSLower(ret) + let ret = OptionalPropertyHolder(optionalName: Optional.bridgeJSLiftParameter(optionalNameIsSome, optionalNameBytes, optionalNameLength)) + return 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) -> UnsafeMutableRawPointer { +@_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 = TextProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() - return _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si.bridgeJSLower(ret) + let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName + return 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) -> UnsafeMutableRawPointer { +@_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) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() - return _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS.bridgeJSLower(ret) + OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) #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 { +@_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 = TextProcessor.bridgeJSLiftParameter(_self).processOptionalDirection(_: _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS.bridgeJSLift(callback)) + let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalAge 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 { +@_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) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalTheme(_: _BJS_Closure_20BridgeJSRuntimeTestsSq5ThemeO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() + OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalAge = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) #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 { +@_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 = TextProcessor.bridgeJSLiftParameter(_self).processOptionalAPIResult(_: _BJS_Closure_20BridgeJSRuntimeTestsSq9APIResultO_SS.bridgeJSLift(callback)) + let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter 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) -> UnsafeMutableRawPointer { +@_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) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() - return _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS.bridgeJSLower(ret) + OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TextProcessor_deinit") -@_cdecl("bjs_TextProcessor_deinit") -public func _bjs_TextProcessor_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_OptionalPropertyHolder_deinit") +@_cdecl("bjs_OptionalPropertyHolder_deinit") +public func _bjs_OptionalPropertyHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() + Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") #endif } -extension TextProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { +extension OptionalPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_TextProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) + return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) } } #if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TextProcessor_wrap") -fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalPropertyHolder_wrap") +fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif @@ -8529,42 +8529,6 @@ func _$jsRoundTripString(_ v: String) throws(JSException) -> String { return String.bridgeJSLiftReturn(ret) } -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalNumberNull") -fileprivate func bjs_jsRoundTripOptionalNumberNull(_ vIsSome: Int32, _ vValue: Float64) -> Void -#else -fileprivate func bjs_jsRoundTripOptionalNumberNull(_ vIsSome: Int32, _ vValue: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$jsRoundTripOptionalNumberNull(_ v: Optional) throws(JSException) -> Optional { - let (vIsSome, vValue) = v.bridgeJSLowerParameter() - bjs_jsRoundTripOptionalNumberNull(vIsSome, vValue) - if let error = _swift_js_take_exception() { - throw error - } - return Optional.bridgeJSLiftReturnFromSideChannel() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalNumberUndefined") -fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ vIsSome: Int32, _ vValue: Float64) -> Void -#else -fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ vIsSome: Int32, _ vValue: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$jsRoundTripOptionalNumberUndefined(_ v: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { - let (vIsSome, vValue) = v.bridgeJSLowerParameter() - bjs_jsRoundTripOptionalNumberUndefined(vIsSome, vValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() -} - #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripJSValue") fileprivate func bjs_jsRoundTripJSValue(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void @@ -9540,4 +9504,92 @@ func _$jsTranslatePoint(_ point: Point, _ dx: Int, _ dy: Int) throws(JSException throw error } return Point.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_runJsOptionalSupportTests") +fileprivate func bjs_runJsOptionalSupportTests() -> Void +#else +fileprivate func bjs_runJsOptionalSupportTests() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$runJsOptionalSupportTests() throws(JSException) -> Void { + bjs_runJsOptionalSupportTests() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalNumberNull") +fileprivate func bjs_jsRoundTripOptionalNumberNull(_ valueIsSome: Int32, _ valueValue: Int32) -> Void +#else +fileprivate func bjs_jsRoundTripOptionalNumberNull(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripOptionalNumberNull(_ value: Optional) throws(JSException) -> Optional { + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + bjs_jsRoundTripOptionalNumberNull(valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturnFromSideChannel() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalNumberUndefined") +fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ valueIsSome: Int32, _ valueValue: Int32) -> Void +#else +fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripOptionalNumberUndefined(_ value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + bjs_jsRoundTripOptionalNumberUndefined(valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalStringNull") +fileprivate func bjs_jsRoundTripOptionalStringNull(_ nameIsSome: Int32, _ nameValue: Int32) -> Void +#else +fileprivate func bjs_jsRoundTripOptionalStringNull(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripOptionalStringNull(_ name: Optional) throws(JSException) -> Optional { + let (nameIsSome, nameValue) = name.bridgeJSLowerParameter() + bjs_jsRoundTripOptionalStringNull(nameIsSome, nameValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturnFromSideChannel() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalStringUndefined") +fileprivate func bjs_jsRoundTripOptionalStringUndefined(_ nameIsSome: Int32, _ nameValue: Int32) -> Void +#else +fileprivate func bjs_jsRoundTripOptionalStringUndefined(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripOptionalStringUndefined(_ name: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { + let (nameIsSome, nameValue) = name.bridgeJSLowerParameter() + bjs_jsRoundTripOptionalStringUndefined(nameIsSome, nameValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() } \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 366115792..01d47b5a0 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -525,161 +525,6 @@ ], "swiftCallName" : "Internal.TestServer" }, - { - "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" : { - "int" : { - - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalGreeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "OptionalPropertyHolder" - }, { "constructor" : { "abiName" : "bjs_SimplePropertyHolder_init", @@ -3241,7 +3086,7 @@ }, { "constructor" : { - "abiName" : "bjs_Container_init", + "abiName" : "bjs_OptionalHolder_init", "effects" : { "isAsync" : false, "isStatic" : false, @@ -3249,25 +3094,30 @@ }, "parameters" : [ { - "label" : "location", - "name" : "location", + "label" : "nullableGreeter", + "name" : "nullableGreeter", "type" : { - "swiftStruct" : { - "_0" : "DataPoint" + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" } } }, { - "label" : "config", - "name" : "config", + "label" : "undefinedNumber", + "name" : "undefinedNumber", "type" : { "nullable" : { "_0" : { - "swiftStruct" : { - "_0" : "Config" + "double" : { + } }, - "_1" : "null" + "_1" : "undefined" } } } @@ -3276,51 +3126,201 @@ "methods" : [ ], - "name" : "Container", + "name" : "OptionalHolder", "properties" : [ { "isReadonly" : false, "isStatic" : false, - "name" : "location", + "name" : "nullableGreeter", "type" : { - "swiftStruct" : { - "_0" : "DataPoint" + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" } } }, { "isReadonly" : false, "isStatic" : false, - "name" : "config", + "name" : "undefinedNumber", "type" : { "nullable" : { "_0" : { - "swiftStruct" : { - "_0" : "Config" + "double" : { + } }, - "_1" : "null" + "_1" : "undefined" } } } ], - "swiftCallName" : "Container" - } - ], - "enums" : [ + "swiftCallName" : "OptionalHolder" + }, { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "north" + "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" : [ { - "associatedValues" : [ + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalName", + "type" : { + "nullable" : { + "_0" : { + "string" : { - ], - "name" : "south" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalAge", + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_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" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "north" + }, + { + "associatedValues" : [ + + ], + "name" : "south" }, { "associatedValues" : [ @@ -4357,86 +4357,6 @@ "swiftCallName" : "API.NetworkingResult", "tsFullPath" : "API.NetworkingResult" }, - { - "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" : [ { @@ -4539,35 +4459,26 @@ "associatedValues" : [ { "type" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "Address" - } - }, - "_1" : "null" + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" } } } ], - "name" : "optStruct" + "name" : "precision" }, { "associatedValues" : [ { "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" + "caseEnum" : { + "_0" : "Direction" } } } ], - "name" : "optClass" + "name" : "direction" }, { "associatedValues" : [ @@ -4575,8 +4486,9 @@ "type" : { "nullable" : { "_0" : { - "jsObject" : { - + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" } }, "_1" : "null" @@ -4584,7 +4496,7 @@ } } ], - "name" : "optJSObject" + "name" : "optPrecision" }, { "associatedValues" : [ @@ -4592,8 +4504,8 @@ "type" : { "nullable" : { "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" + "caseEnum" : { + "_0" : "Direction" } }, "_1" : "null" @@ -4601,45 +4513,7 @@ } } ], - "name" : "optNestedEnum" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "int" : { - - } - } - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optArray" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "jsObject" : { - "_0" : "Foo" - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optJsClass" + "name" : "optDirection" }, { "associatedValues" : [ @@ -4649,116 +4523,15 @@ } ], "emitStyle" : "const", - "name" : "OptionalAllTypesResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "OptionalAllTypesResult", - "tsFullPath" : "OptionalAllTypesResult" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "int" : { - - } - }, - "_1" : "null" - } - } - }, - { - "type" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, - "_1" : "null" - } - } - } - ], - "name" : "failure" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, - "_1" : "null" - } - } - }, - { - "type" : { - "nullable" : { - "_0" : { - "int" : { - - } - }, - "_1" : "null" - } - } - }, - { - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "name" : "status" - } - ], - "emitStyle" : "const", - "name" : "APIOptionalResult", + "name" : "TypedPayloadResult", "staticMethods" : [ ], "staticProperties" : [ ], - "swiftCallName" : "APIOptionalResult", - "tsFullPath" : "APIOptionalResult" + "swiftCallName" : "TypedPayloadResult", + "tsFullPath" : "TypedPayloadResult" }, { "cases" : [ @@ -5207,274 +4980,501 @@ ], "swiftCallName" : "StaticPropertyNamespace.NestedProperties", "tsFullPath" : "StaticPropertyNamespace.NestedProperties" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_roundTripVoid", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripVoid", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } }, { - "abiName" : "bjs_roundTripInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripInt", - "parameters" : [ + "cases" : [ { - "label" : "v", - "name" : "v", - "type" : { - "int" : { - + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "Address" + } + }, + "_1" : "null" + } + } } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_roundTripUInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripUInt", - "parameters" : [ + ], + "name" : "optStruct" + }, { - "label" : "v", - "name" : "v", - "type" : { - "uint" : { - + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } } - } - } - ], - "returnType" : { - "uint" : { - - } - } - }, - { - "abiName" : "bjs_roundTripFloat", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripFloat", - "parameters" : [ + ], + "name" : "optClass" + }, { - "label" : "v", - "name" : "v", - "type" : { - "float" : { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + } + }, + "_1" : "null" + } + } } - } - } - ], - "returnType" : { - "float" : { - - } - } - }, - { - "abiName" : "bjs_roundTripDouble", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripDouble", - "parameters" : [ + ], + "name" : "optJSObject" + }, { - "label" : "v", - "name" : "v", - "type" : { - "double" : { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optNestedEnum" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + } + } + } + }, + "_1" : "null" + } + } } - } + ], + "name" : "optArray" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optJsClass" + }, + { + "associatedValues" : [ + + ], + "name" : "empty" } ], - "returnType" : { - "double" : { + "emitStyle" : "const", + "name" : "OptionalAllTypesResult", + "staticMethods" : [ - } - } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "OptionalAllTypesResult", + "tsFullPath" : "OptionalAllTypesResult" }, { - "abiName" : "bjs_roundTripBool", + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + } + }, + { + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + }, + { + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_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" : "roundTripBool", + "name" : "roundTripVoid", "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "bool" : { - } - } - } ], "returnType" : { - "bool" : { + "void" : { } } }, { - "abiName" : "bjs_roundTripString", + "abiName" : "bjs_roundTripInt", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripString", + "name" : "roundTripInt", "parameters" : [ { "label" : "v", "name" : "v", "type" : { - "string" : { + "int" : { } } } ], "returnType" : { - "string" : { + "int" : { } } }, { - "abiName" : "bjs_roundTripSwiftHeapObject", + "abiName" : "bjs_roundTripUInt", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripSwiftHeapObject", + "name" : "roundTripUInt", "parameters" : [ { "label" : "v", "name" : "v", "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "uint" : { + } } } ], "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "uint" : { + } } }, { - "abiName" : "bjs_roundTripUnsafeRawPointer", + "abiName" : "bjs_roundTripFloat", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripUnsafeRawPointer", + "name" : "roundTripFloat", "parameters" : [ { "label" : "v", "name" : "v", "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } + "float" : { + } } } ], "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } + "float" : { + } } }, { - "abiName" : "bjs_roundTripUnsafeMutableRawPointer", + "abiName" : "bjs_roundTripDouble", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripUnsafeMutableRawPointer", + "name" : "roundTripDouble", "parameters" : [ { "label" : "v", "name" : "v", "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } + "double" : { + } } } ], "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } + "double" : { + } } }, { - "abiName" : "bjs_roundTripOpaquePointer", + "abiName" : "bjs_roundTripBool", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOpaquePointer", + "name" : "roundTripBool", "parameters" : [ { "label" : "v", "name" : "v", "type" : { - "unsafePointer" : { + "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" } @@ -7259,445 +7259,296 @@ } }, { - "abiName" : "bjs_roundTripOptionalString", + "abiName" : "bjs_roundTripAllTypesResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalString", + "name" : "roundTripAllTypesResult", "parameters" : [ { - "label" : "name", - "name" : "name", + "label" : "_", + "name" : "result", "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "AllTypesResult" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "AllTypesResult" } } }, { - "abiName" : "bjs_roundTripOptionalInt", + "abiName" : "bjs_roundTripTypedPayloadResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalInt", + "name" : "roundTripTypedPayloadResult", "parameters" : [ { - "label" : "value", - "name" : "value", + "label" : "_", + "name" : "result", "type" : { - "nullable" : { - "_0" : { - "int" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "int" : { - - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" } } }, { - "abiName" : "bjs_roundTripOptionalBool", + "abiName" : "bjs_createPropertyHolder", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalBool", + "name" : "createPropertyHolder", "parameters" : [ { - "label" : "flag", - "name" : "flag", + "label" : "intValue", + "name" : "intValue", "type" : { - "nullable" : { - "_0" : { - "bool" : { + "int" : { - } - }, - "_1" : "null" } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "bool" : { + }, + { + "label" : "floatValue", + "name" : "floatValue", + "type" : { + "float" : { } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalFloat", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalFloat", - "parameters" : [ + } + }, { - "label" : "number", - "name" : "number", + "label" : "doubleValue", + "name" : "doubleValue", "type" : { - "nullable" : { - "_0" : { - "float" : { + "double" : { - } - }, - "_1" : "null" } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "float" : { + }, + { + "label" : "boolValue", + "name" : "boolValue", + "type" : { + "bool" : { } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalDouble", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalDouble", - "parameters" : [ + } + }, { - "label" : "precision", - "name" : "precision", + "label" : "stringValue", + "name" : "stringValue", "type" : { - "nullable" : { - "_0" : { - "double" : { + "string" : { - } - }, - "_1" : "null" } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalSyntax", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalSyntax", - "parameters" : [ + }, { - "label" : "name", - "name" : "name", + "label" : "jsObject", + "name" : "jsObject", "type" : { - "nullable" : { - "_0" : { - "string" : { + "jsObject" : { - } - }, - "_1" : "null" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" + "swiftHeapObject" : { + "_0" : "PropertyHolder" } } }, { - "abiName" : "bjs_roundTripOptionalMixSyntax", + "abiName" : "bjs_testPropertyHolder", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalMixSyntax", + "name" : "testPropertyHolder", "parameters" : [ { - "label" : "name", - "name" : "name", + "label" : "holder", + "name" : "holder", "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" + "swiftHeapObject" : { + "_0" : "PropertyHolder" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "string" : { + "string" : { - } - }, - "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalSwiftSyntax", + "abiName" : "bjs_resetObserverCounts", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalSwiftSyntax", + "name" : "resetObserverCounts", "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "nullable" : { - "_0" : { - "string" : { - } - }, - "_1" : "null" - } - } - } ], "returnType" : { - "nullable" : { - "_0" : { - "string" : { + "void" : { - } - }, - "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalWithSpaces", + "abiName" : "bjs_getObserverStats", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalWithSpaces", + "name" : "getObserverStats", "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "nullable" : { - "_0" : { - "double" : { - } - }, - "_1" : "null" - } - } - } ], "returnType" : { - "nullable" : { - "_0" : { - "double" : { + "string" : { - } - }, - "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalTypeAlias", + "abiName" : "bjs_testStringDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalTypeAlias", + "name" : "testStringDefault", "parameters" : [ { - "label" : "age", - "name" : "age", + "defaultValue" : { + "string" : { + "_0" : "Hello World" + } + }, + "label" : "message", + "name" : "message", "type" : { - "nullable" : { - "_0" : { - "int" : { + "string" : { - } - }, - "_1" : "null" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "int" : { + "string" : { - } - }, - "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalStatus", + "abiName" : "bjs_testIntDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalStatus", + "name" : "testIntDefault", "parameters" : [ { - "label" : "value", - "name" : "value", + "defaultValue" : { + "int" : { + "_0" : 42 + } + }, + "label" : "count", + "name" : "count", "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "_1" : "null" + "int" : { + } } } ], "returnType" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "_1" : "null" + "int" : { + } } }, { - "abiName" : "bjs_roundTripOptionalTheme", + "abiName" : "bjs_testBoolDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalTheme", + "name" : "testBoolDefault", "parameters" : [ { - "label" : "value", - "name" : "value", + "defaultValue" : { + "bool" : { + "_0" : true + } + }, + "label" : "flag", + "name" : "flag", "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" + "bool" : { + } } } ], "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" + "bool" : { + } } }, { - "abiName" : "bjs_roundTripOptionalHttpStatus", + "abiName" : "bjs_testOptionalDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalHttpStatus", + "name" : "testOptionalDefault", "parameters" : [ { - "label" : "value", - "name" : "value", + "defaultValue" : { + "null" : { + + } + }, + "label" : "name", + "name" : "name", "type" : { "nullable" : { "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "string" : { + } }, "_1" : "null" @@ -7708,9 +7559,8 @@ "returnType" : { "nullable" : { "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "string" : { + } }, "_1" : "null" @@ -7718,530 +7568,671 @@ } }, { - "abiName" : "bjs_roundTripOptionalTSDirection", + "abiName" : "bjs_testMultipleDefaults", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalTSDirection", + "name" : "testMultipleDefaults", "parameters" : [ { - "label" : "value", - "name" : "value", + "defaultValue" : { + "string" : { + "_0" : "Default Title" + } + }, + "label" : "title", + "name" : "title", "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" - } - }, - "_1" : "null" + "string" : { + } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" + }, + { + "defaultValue" : { + "int" : { + "_0" : -10 } }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTSTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTSTheme", - "parameters" : [ + "label" : "count", + "name" : "count", + "type" : { + "int" : { + + } + } + }, { - "label" : "value", - "name" : "value", + "defaultValue" : { + "bool" : { + "_0" : false + } + }, + "label" : "enabled", + "name" : "enabled", "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - }, - "_1" : "null" + "bool" : { + } } } ], "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - }, - "_1" : "null" + "string" : { + } } }, { - "abiName" : "bjs_roundTripOptionalNetworkingAPIMethod", + "abiName" : "bjs_testSimpleEnumDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalNetworkingAPIMethod", + "name" : "testSimpleEnumDefault", "parameters" : [ { - "label" : "_", - "name" : "method", + "defaultValue" : { + "enumCase" : { + "_0" : "Status", + "_1" : "success" + } + }, + "label" : "status", + "name" : "status", "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - }, - "_1" : "null" + "caseEnum" : { + "_0" : "Status" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - }, - "_1" : "null" + "caseEnum" : { + "_0" : "Status" } } }, { - "abiName" : "bjs_roundTripOptionalAPIResult", + "abiName" : "bjs_testDirectionDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalAPIResult", + "name" : "testDirectionDefault", "parameters" : [ { - "label" : "value", - "name" : "value", + "defaultValue" : { + "enumCase" : { + "_0" : "Direction", + "_1" : "north" + } + }, + "label" : "direction", + "name" : "direction", "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" + "caseEnum" : { + "_0" : "Direction" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" + "caseEnum" : { + "_0" : "Direction" } } }, { - "abiName" : "bjs_roundTripTypedPayloadResult", + "abiName" : "bjs_testRawStringEnumDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripTypedPayloadResult", + "name" : "testRawStringEnumDefault", "parameters" : [ { - "label" : "_", - "name" : "result", + "defaultValue" : { + "enumCase" : { + "_0" : "Theme", + "_1" : "light" + } + }, + "label" : "theme", + "name" : "theme", "type" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } } }, { - "abiName" : "bjs_roundTripOptionalTypedPayloadResult", + "abiName" : "bjs_testComplexInit", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalTypedPayloadResult", + "name" : "testComplexInit", "parameters" : [ { - "label" : "_", - "name" : "result", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" + "defaultValue" : { + "objectWithArguments" : { + "_0" : "Greeter", + "_1" : [ + { + "string" : { + "_0" : "DefaultGreeter" + } } - }, - "_1" : "null" + ] + } + }, + "label" : "greeter", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" } } } ], "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" - } - }, - "_1" : "null" + "string" : { + } } }, { - "abiName" : "bjs_compareAPIResults", + "abiName" : "bjs_testEmptyInit", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "compareAPIResults", + "name" : "testEmptyInit", "parameters" : [ { - "label" : "_", - "name" : "r1", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" + "defaultValue" : { + "object" : { + "_0" : "StaticPropertyHolder" } - } - }, - { + }, "label" : "_", - "name" : "r2", + "name" : "object", "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" + "swiftHeapObject" : { + "_0" : "StaticPropertyHolder" } } } ], "returnType" : { - "string" : { - + "swiftHeapObject" : { + "_0" : "StaticPropertyHolder" } } }, { - "abiName" : "bjs_roundTripOptionalComplexResult", + "abiName" : "bjs_arrayWithDefault", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalComplexResult", + "name" : "arrayWithDefault", "parameters" : [ { - "label" : "_", - "name" : "result", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - }, - "_1" : "null" + "defaultValue" : { + "array" : { + "_0" : [ + { + "int" : { + "_0" : 1 + } + }, + { + "int" : { + "_0" : 2 + } + }, + { + "int" : { + "_0" : 3 + } + } + ] + } + }, + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } } } } ], "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" + "int" : { + + } + } + }, + { + "abiName" : "bjs_arrayWithOptionalDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "arrayWithOptionalDefault", + "parameters" : [ + { + "defaultValue" : { + "null" : { + } }, - "_1" : "null" + "label" : "_", + "name" : "values", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "int" : { + } } }, { - "abiName" : "bjs_roundTripAllTypesResult", + "abiName" : "bjs_arrayMixedDefaults", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripAllTypesResult", + "name" : "arrayMixedDefaults", "parameters" : [ { - "label" : "_", - "name" : "result", + "defaultValue" : { + "string" : { + "_0" : "Sum" + } + }, + "label" : "prefix", + "name" : "prefix", "type" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" + "string" : { + + } + } + }, + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "int" : { + "_0" : 10 + } + }, + { + "int" : { + "_0" : 20 + } + } + ] + } + }, + "label" : "values", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "defaultValue" : { + "string" : { + "_0" : "!" + } + }, + "label" : "suffix", + "name" : "suffix", + "type" : { + "string" : { + } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" + "string" : { + } } }, { - "abiName" : "bjs_roundTripOptionalAllTypesResult", + "abiName" : "bjs_formatName", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalAllTypesResult", + "name" : "formatName", "parameters" : [ { "label" : "_", - "name" : "result", + "name" : "name", "type" : { - "nullable" : { + "string" : { + + } + } + }, + { + "label" : "transform", + "name" : "transform", + "type" : { + "closure" : { "_0" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } } - }, - "_1" : "null" + } } } } ], "returnType" : { - "nullable" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_makeFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeFormatter", + "parameters" : [ + { + "label" : "prefix", + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "closure" : { "_0" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } } - }, - "_1" : "null" + } } } }, { - "abiName" : "bjs_roundTripOptionalPayloadResult", + "abiName" : "bjs_makeAdder", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalPayloadResult", + "name" : "makeAdder", + "parameters" : [ + { + "label" : "base", + "name" : "base", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripIntArray", "parameters" : [ { "label" : "_", - "name" : "result", + "name" : "values", "type" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" + "array" : { + "_0" : { + "int" : { + + } + } } } } ], "returnType" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" + "array" : { + "_0" : { + "int" : { + + } + } } } }, { - "abiName" : "bjs_roundTripOptionalPayloadResultOpt", + "abiName" : "bjs_roundTripStringArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalPayloadResultOpt", + "name" : "roundTripStringArray", "parameters" : [ { "label" : "_", - "name" : "result", + "name" : "values", "type" : { - "nullable" : { + "array" : { "_0" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" + "string" : { + } - }, - "_1" : "null" + } } } } ], "returnType" : { - "nullable" : { + "array" : { "_0" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" + "string" : { + } - }, - "_1" : "null" + } } } }, { - "abiName" : "bjs_roundTripOptionalClass", + "abiName" : "bjs_roundTripDoubleArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalClass", + "name" : "roundTripDoubleArray", "parameters" : [ { - "label" : "value", - "name" : "value", + "label" : "_", + "name" : "values", "type" : { - "nullable" : { + "array" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "double" : { + } - }, - "_1" : "null" + } } } } ], "returnType" : { - "nullable" : { + "array" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "double" : { + } - }, - "_1" : "null" + } } } }, { - "abiName" : "bjs_roundTripOptionalGreeter", + "abiName" : "bjs_roundTripBoolArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalGreeter", + "name" : "roundTripBoolArray", "parameters" : [ { "label" : "_", - "name" : "value", + "name" : "values", "type" : { - "nullable" : { + "array" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "bool" : { + } - }, - "_1" : "null" + } } } } ], "returnType" : { - "nullable" : { + "array" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "bool" : { + } - }, - "_1" : "null" + } } } }, { - "abiName" : "bjs_applyOptionalGreeter", + "abiName" : "bjs_roundTripDirectionArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "applyOptionalGreeter", + "name" : "roundTripDirectionArray", "parameters" : [ { "label" : "_", - "name" : "value", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "label" : "_", - "name" : "transform", + "name" : "values", "type" : { - "closure" : { + "array" : { "_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" - } + "caseEnum" : { + "_0" : "Direction" } } } @@ -8249,336 +8240,420 @@ } ], "returnType" : { - "nullable" : { + "array" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "caseEnum" : { + "_0" : "Direction" } - }, - "_1" : "null" + } } } }, { - "abiName" : "bjs_makeOptionalHolder", + "abiName" : "bjs_roundTripStatusArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeOptionalHolder", + "name" : "roundTripStatusArray", "parameters" : [ { - "label" : "nullableGreeter", - "name" : "nullableGreeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "label" : "undefinedNumber", - "name" : "undefinedNumber", + "label" : "_", + "name" : "values", "type" : { - "nullable" : { + "array" : { "_0" : { - "double" : { - + "caseEnum" : { + "_0" : "Status" } - }, - "_1" : "undefined" + } } } } ], "returnType" : { - "swiftHeapObject" : { - "_0" : "OptionalHolder" + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + } } } }, { - "abiName" : "bjs_roundTripOptionalAPIOptionalResult", + "abiName" : "bjs_roundTripThemeArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalAPIOptionalResult", + "name" : "roundTripThemeArray", "parameters" : [ { - "label" : "result", - "name" : "result", + "label" : "_", + "name" : "values", "type" : { - "nullable" : { + "array" : { "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } - }, - "_1" : "null" + } } } } ], "returnType" : { - "nullable" : { + "array" : { "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } - }, - "_1" : "null" + } } } }, { - "abiName" : "bjs_createPropertyHolder", + "abiName" : "bjs_roundTripHttpStatusArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "createPropertyHolder", + "name" : "roundTripHttpStatusArray", "parameters" : [ { - "label" : "intValue", - "name" : "intValue", - "type" : { - "int" : { - - } - } - }, - { - "label" : "floatValue", - "name" : "floatValue", - "type" : { - "float" : { - - } - } - }, - { - "label" : "doubleValue", - "name" : "doubleValue", - "type" : { - "double" : { - - } - } - }, - { - "label" : "boolValue", - "name" : "boolValue", + "label" : "_", + "name" : "values", "type" : { - "bool" : { - + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } } } - }, - { - "label" : "stringValue", - "name" : "stringValue", - "type" : { - "string" : { - + } + ], + "returnType" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" } } - }, + } + } + }, + { + "abiName" : "bjs_roundTripDataPointArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDataPointArray", + "parameters" : [ { - "label" : "jsObject", - "name" : "jsObject", + "label" : "_", + "name" : "points", "type" : { - "jsObject" : { - + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } } } } ], "returnType" : { - "swiftHeapObject" : { - "_0" : "PropertyHolder" + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } } } }, { - "abiName" : "bjs_testPropertyHolder", + "abiName" : "bjs_roundTripGreeterArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testPropertyHolder", + "name" : "roundTripGreeterArray", "parameters" : [ { - "label" : "holder", - "name" : "holder", + "label" : "_", + "name" : "greeters", "type" : { - "swiftHeapObject" : { - "_0" : "PropertyHolder" + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } } } } ], "returnType" : { - "string" : { - + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } } } }, { - "abiName" : "bjs_resetObserverCounts", + "abiName" : "bjs_roundTripOptionalIntArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "resetObserverCounts", + "name" : "roundTripOptionalIntArray", "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "int" : { + } + }, + "_1" : "null" + } + } + } + } + } ], "returnType" : { - "void" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "int" : { + } + }, + "_1" : "null" + } + } } } }, { - "abiName" : "bjs_getObserverStats", + "abiName" : "bjs_roundTripOptionalStringArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "getObserverStats", + "name" : "roundTripOptionalStringArray", "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "string" : { + } + }, + "_1" : "null" + } + } + } + } + } ], "returnType" : { - "string" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "string" : { + } + }, + "_1" : "null" + } + } } } }, { - "abiName" : "bjs_testStringDefault", + "abiName" : "bjs_roundTripOptionalDataPointArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testStringDefault", + "name" : "roundTripOptionalDataPointArray", "parameters" : [ { - "defaultValue" : { - "string" : { - "_0" : "Hello World" - } - }, - "label" : "message", - "name" : "message", + "label" : "_", + "name" : "points", "type" : { - "string" : { - + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + }, + "_1" : "null" + } + } } } } ], "returnType" : { - "string" : { - + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + }, + "_1" : "null" + } + } } } }, { - "abiName" : "bjs_testIntDefault", + "abiName" : "bjs_roundTripOptionalDirectionArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testIntDefault", + "name" : "roundTripOptionalDirectionArray", "parameters" : [ { - "defaultValue" : { - "int" : { - "_0" : 42 - } - }, - "label" : "count", - "name" : "count", + "label" : "_", + "name" : "directions", "type" : { - "int" : { - + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } } } } ], "returnType" : { - "int" : { - + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } } } }, { - "abiName" : "bjs_testBoolDefault", + "abiName" : "bjs_roundTripOptionalStatusArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testBoolDefault", + "name" : "roundTripOptionalStatusArray", "parameters" : [ { - "defaultValue" : { - "bool" : { - "_0" : true - } - }, - "label" : "flag", - "name" : "flag", + "label" : "_", + "name" : "statuses", "type" : { - "bool" : { - + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + }, + "_1" : "null" + } + } } } } ], "returnType" : { - "bool" : { - + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + }, + "_1" : "null" + } + } } } }, { - "abiName" : "bjs_testOptionalDefault", + "abiName" : "bjs_roundTripOptionalIntArrayType", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testOptionalDefault", - "parameters" : [ - { - "defaultValue" : { - "null" : { - - } - }, - "label" : "name", - "name" : "name", + "name" : "roundTripOptionalIntArrayType", + "parameters" : [ + { + "label" : "_", + "name" : "values", "type" : { "nullable" : { "_0" : { - "string" : { + "array" : { + "_0" : { + "int" : { + } + } } }, "_1" : "null" @@ -8589,8 +8664,12 @@ "returnType" : { "nullable" : { "_0" : { - "string" : { + "array" : { + "_0" : { + "int" : { + } + } } }, "_1" : "null" @@ -8598,263 +8677,235 @@ } }, { - "abiName" : "bjs_testMultipleDefaults", + "abiName" : "bjs_roundTripOptionalStringArrayType", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testMultipleDefaults", + "name" : "roundTripOptionalStringArrayType", "parameters" : [ { - "defaultValue" : { - "string" : { - "_0" : "Default Title" - } - }, - "label" : "title", - "name" : "title", - "type" : { - "string" : { - - } - } - }, - { - "defaultValue" : { - "int" : { - "_0" : -10 - } - }, - "label" : "count", - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "defaultValue" : { - "bool" : { - "_0" : false - } - }, - "label" : "enabled", - "name" : "enabled", + "label" : "_", + "name" : "values", "type" : { - "bool" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + } + } + } + }, + "_1" : "null" } } } ], "returnType" : { - "string" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + } + } + } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_testSimpleEnumDefault", + "abiName" : "bjs_roundTripOptionalGreeterArrayType", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testSimpleEnumDefault", + "name" : "roundTripOptionalGreeterArrayType", "parameters" : [ { - "defaultValue" : { - "enumCase" : { - "_0" : "Status", - "_1" : "success" - } - }, - "label" : "status", - "name" : "status", + "label" : "_", + "name" : "greeters", "type" : { - "caseEnum" : { - "_0" : "Status" + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + }, + "_1" : "null" } } } ], "returnType" : { - "caseEnum" : { - "_0" : "Status" + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_testDirectionDefault", + "abiName" : "bjs_roundTripNestedIntArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testDirectionDefault", + "name" : "roundTripNestedIntArray", "parameters" : [ { - "defaultValue" : { - "enumCase" : { - "_0" : "Direction", - "_1" : "north" - } - }, - "label" : "direction", - "name" : "direction", + "label" : "_", + "name" : "values", "type" : { - "caseEnum" : { - "_0" : "Direction" + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } } } } ], "returnType" : { - "caseEnum" : { - "_0" : "Direction" + "array" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } } } }, { - "abiName" : "bjs_testRawStringEnumDefault", + "abiName" : "bjs_roundTripNestedStringArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testRawStringEnumDefault", + "name" : "roundTripNestedStringArray", "parameters" : [ { - "defaultValue" : { - "enumCase" : { - "_0" : "Theme", - "_1" : "light" - } - }, - "label" : "theme", - "name" : "theme", + "label" : "_", + "name" : "values", "type" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "array" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } } } } ], "returnType" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "array" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } } } }, { - "abiName" : "bjs_testComplexInit", + "abiName" : "bjs_roundTripNestedDoubleArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "testComplexInit", + "name" : "roundTripNestedDoubleArray", "parameters" : [ { - "defaultValue" : { - "objectWithArguments" : { - "_0" : "Greeter", - "_1" : [ - { - "string" : { - "_0" : "DefaultGreeter" + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "double" : { + + } } } - ] - } - }, - "label" : "greeter", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" + } } } } ], "returnType" : { - "string" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "double" : { - } - } - }, - { - "abiName" : "bjs_testEmptyInit", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testEmptyInit", - "parameters" : [ - { - "defaultValue" : { - "object" : { - "_0" : "StaticPropertyHolder" - } - }, - "label" : "_", - "name" : "object", - "type" : { - "swiftHeapObject" : { - "_0" : "StaticPropertyHolder" + } + } } } } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "StaticPropertyHolder" - } } }, { - "abiName" : "bjs_arrayWithDefault", + "abiName" : "bjs_roundTripNestedBoolArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "arrayWithDefault", + "name" : "roundTripNestedBoolArray", "parameters" : [ { - "defaultValue" : { - "array" : { - "_0" : [ - { - "int" : { - "_0" : 1 - } - }, - { - "int" : { - "_0" : 2 - } - }, - { - "int" : { - "_0" : 3 - } - } - ] - } - }, "label" : "_", "name" : "values", "type" : { "array" : { "_0" : { - "int" : { + "array" : { + "_0" : { + "bool" : { + } + } } } } @@ -8862,162 +8913,122 @@ } ], "returnType" : { - "int" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "bool" : { + } + } + } + } } } }, { - "abiName" : "bjs_arrayWithOptionalDefault", + "abiName" : "bjs_roundTripNestedDataPointArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "arrayWithOptionalDefault", + "name" : "roundTripNestedDataPointArray", "parameters" : [ { - "defaultValue" : { - "null" : { - - } - }, "label" : "_", - "name" : "values", + "name" : "points", "type" : { - "nullable" : { + "array" : { "_0" : { "array" : { "_0" : { - "int" : { - + "swiftStruct" : { + "_0" : "DataPoint" } } } - }, - "_1" : "null" + } } } } ], "returnType" : { - "int" : { - + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + } } } }, { - "abiName" : "bjs_arrayMixedDefaults", + "abiName" : "bjs_roundTripNestedDirectionArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "arrayMixedDefaults", + "name" : "roundTripNestedDirectionArray", "parameters" : [ { - "defaultValue" : { - "string" : { - "_0" : "Sum" - } - }, - "label" : "prefix", - "name" : "prefix", + "label" : "_", + "name" : "directions", "type" : { - "string" : { - - } - } - }, - { - "defaultValue" : { "array" : { - "_0" : [ - { - "int" : { - "_0" : 10 - } - }, - { - "int" : { - "_0" : 20 + "_0" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } } } - ] + } } - }, - "label" : "values", - "name" : "values", - "type" : { + } + } + ], + "returnType" : { + "array" : { + "_0" : { "array" : { "_0" : { - "int" : { - + "caseEnum" : { + "_0" : "Direction" } } } } - }, - { - "defaultValue" : { - "string" : { - "_0" : "!" - } - }, - "label" : "suffix", - "name" : "suffix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - } } }, { - "abiName" : "bjs_formatName", + "abiName" : "bjs_roundTripNestedGreeterArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "formatName", + "name" : "roundTripNestedGreeterArray", "parameters" : [ { "label" : "_", - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "label" : "transform", - "name" : "transform", + "name" : "greeters", "type" : { - "closure" : { + "array" : { "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" } } - ], - "returnType" : { - "string" : { - - } } } } @@ -9025,47 +9036,87 @@ } ], "returnType" : { - "string" : { - + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } } } }, { - "abiName" : "bjs_makeFormatter", + "abiName" : "bjs_roundTripUnsafeRawPointerArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeFormatter", + "name" : "roundTripUnsafeRawPointerArray", "parameters" : [ { - "label" : "prefix", - "name" : "prefix", + "label" : "_", + "name" : "values", "type" : { - "string" : { - + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } } } } ], "returnType" : { - "closure" : { + "array" : { "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" } - ], - "returnType" : { - "string" : { - + } + } + } + } + }, + { + "abiName" : "bjs_roundTripUnsafeMutableRawPointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUnsafeMutableRawPointerArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" } } } @@ -9073,41 +9124,36 @@ } }, { - "abiName" : "bjs_makeAdder", + "abiName" : "bjs_roundTripOpaquePointerArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "makeAdder", + "name" : "roundTripOpaquePointerArray", "parameters" : [ { - "label" : "base", - "name" : "base", + "label" : "_", + "name" : "values", "type" : { - "int" : { - + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } } } } ], "returnType" : { - "closure" : { + "array" : { "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "int" : { - - } - } - ], - "returnType" : { - "int" : { - + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" } } } @@ -9115,13 +9161,13 @@ } }, { - "abiName" : "bjs_roundTripIntArray", + "abiName" : "bjs_roundTripUnsafePointerArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripIntArray", + "name" : "roundTripUnsafePointerArray", "parameters" : [ { "label" : "_", @@ -9129,8 +9175,11 @@ "type" : { "array" : { "_0" : { - "int" : { - + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } } } } @@ -9140,21 +9189,24 @@ "returnType" : { "array" : { "_0" : { - "int" : { - + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } } } } } }, { - "abiName" : "bjs_roundTripStringArray", + "abiName" : "bjs_roundTripUnsafeMutablePointerArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripStringArray", + "name" : "roundTripUnsafeMutablePointerArray", "parameters" : [ { "label" : "_", @@ -9162,8 +9214,11 @@ "type" : { "array" : { "_0" : { - "string" : { - + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } } } } @@ -9173,30 +9228,33 @@ "returnType" : { "array" : { "_0" : { - "string" : { - + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } } } } } }, { - "abiName" : "bjs_roundTripDoubleArray", + "abiName" : "bjs_consumeDataProcessorArrayType", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripDoubleArray", + "name" : "consumeDataProcessorArrayType", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "processors", "type" : { "array" : { "_0" : { - "double" : { - + "swiftProtocol" : { + "_0" : "DataProcessor" } } } @@ -9204,32 +9262,28 @@ } ], "returnType" : { - "array" : { - "_0" : { - "double" : { + "int" : { - } - } } } }, { - "abiName" : "bjs_roundTripBoolArray", + "abiName" : "bjs_roundTripDataProcessorArrayType", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripBoolArray", + "name" : "roundTripDataProcessorArrayType", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "processors", "type" : { "array" : { "_0" : { - "bool" : { - + "swiftProtocol" : { + "_0" : "DataProcessor" } } } @@ -9239,30 +9293,30 @@ "returnType" : { "array" : { "_0" : { - "bool" : { - + "swiftProtocol" : { + "_0" : "DataProcessor" } } } } }, { - "abiName" : "bjs_roundTripDirectionArray", + "abiName" : "bjs_roundTripJSObjectArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripDirectionArray", + "name" : "roundTripJSObjectArray", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "objects", "type" : { "array" : { "_0" : { - "caseEnum" : { - "_0" : "Direction" + "jsObject" : { + } } } @@ -9272,30 +9326,35 @@ "returnType" : { "array" : { "_0" : { - "caseEnum" : { - "_0" : "Direction" + "jsObject" : { + } } } } }, { - "abiName" : "bjs_roundTripStatusArray", + "abiName" : "bjs_roundTripOptionalJSObjectArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripStatusArray", + "name" : "roundTripOptionalJSObjectArray", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "objects", "type" : { "array" : { "_0" : { - "caseEnum" : { - "_0" : "Status" + "nullable" : { + "_0" : { + "jsObject" : { + + } + }, + "_1" : "null" } } } @@ -9305,31 +9364,35 @@ "returnType" : { "array" : { "_0" : { - "caseEnum" : { - "_0" : "Status" + "nullable" : { + "_0" : { + "jsObject" : { + + } + }, + "_1" : "null" } } } } }, { - "abiName" : "bjs_roundTripThemeArray", + "abiName" : "bjs_roundTripFooArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripThemeArray", + "name" : "roundTripFooArray", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "foos", "type" : { "array" : { "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "jsObject" : { + "_0" : "Foo" } } } @@ -9339,32 +9402,35 @@ "returnType" : { "array" : { "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "jsObject" : { + "_0" : "Foo" } } } } }, { - "abiName" : "bjs_roundTripHttpStatusArray", + "abiName" : "bjs_roundTripOptionalFooArray", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripHttpStatusArray", + "name" : "roundTripOptionalFooArray", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "foos", "type" : { "array" : { "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "nullable" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + }, + "_1" : "null" } } } @@ -9374,316 +9440,280 @@ "returnType" : { "array" : { "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "nullable" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + }, + "_1" : "null" } } } } }, { - "abiName" : "bjs_roundTripDataPointArray", + "abiName" : "bjs_roundTripOptionalString", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripDataPointArray", + "name" : "roundTripOptionalString", "parameters" : [ { - "label" : "_", - "name" : "points", + "label" : "name", + "name" : "name", "type" : { - "array" : { + "nullable" : { "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" + "string" : { + } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" + "string" : { + } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripGreeterArray", + "abiName" : "bjs_roundTripOptionalInt", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripGreeterArray", + "name" : "roundTripOptionalInt", "parameters" : [ { - "label" : "_", - "name" : "greeters", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "int" : { + } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "int" : { + } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalIntArray", + "abiName" : "bjs_roundTripOptionalBool", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalIntArray", + "name" : "roundTripOptionalBool", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "flag", + "name" : "flag", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "int" : { + "bool" : { - } - }, - "_1" : "null" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "int" : { + "bool" : { - } - }, - "_1" : "null" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalStringArray", + "abiName" : "bjs_roundTripOptionalFloat", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalStringArray", + "name" : "roundTripOptionalFloat", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "number", + "name" : "number", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "string" : { + "float" : { - } - }, - "_1" : "null" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "string" : { + "float" : { - } - }, - "_1" : "null" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalDataPointArray", + "abiName" : "bjs_roundTripOptionalDouble", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalDataPointArray", + "name" : "roundTripOptionalDouble", "parameters" : [ { - "label" : "_", - "name" : "points", + "label" : "precision", + "name" : "precision", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - }, - "_1" : "null" + "double" : { + } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - }, - "_1" : "null" + "double" : { + } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalDirectionArray", + "abiName" : "bjs_roundTripOptionalSyntax", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalDirectionArray", + "name" : "roundTripOptionalSyntax", "parameters" : [ { - "label" : "_", - "name" : "directions", + "label" : "name", + "name" : "name", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" + "string" : { + } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" + "string" : { + } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalStatusArray", + "abiName" : "bjs_roundTripOptionalMixSyntax", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalStatusArray", + "name" : "roundTripOptionalMixSyntax", "parameters" : [ { - "label" : "_", - "name" : "statuses", + "label" : "name", + "name" : "name", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "_1" : "null" + "string" : { + } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "_1" : "null" + "string" : { + } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalIntArrayType", + "abiName" : "bjs_roundTripOptionalSwiftSyntax", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalIntArrayType", + "name" : "roundTripOptionalSwiftSyntax", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "name", + "name" : "name", "type" : { "nullable" : { "_0" : { - "array" : { - "_0" : { - "int" : { + "string" : { - } - } } }, "_1" : "null" @@ -9694,12 +9724,8 @@ "returnType" : { "nullable" : { "_0" : { - "array" : { - "_0" : { - "int" : { + "string" : { - } - } } }, "_1" : "null" @@ -9707,26 +9733,22 @@ } }, { - "abiName" : "bjs_roundTripOptionalStringArrayType", + "abiName" : "bjs_roundTripOptionalWithSpaces", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalStringArrayType", + "name" : "roundTripOptionalWithSpaces", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "value", + "name" : "value", "type" : { "nullable" : { "_0" : { - "array" : { - "_0" : { - "string" : { + "double" : { - } - } } }, "_1" : "null" @@ -9737,12 +9759,8 @@ "returnType" : { "nullable" : { "_0" : { - "array" : { - "_0" : { - "string" : { + "double" : { - } - } } }, "_1" : "null" @@ -9750,26 +9768,22 @@ } }, { - "abiName" : "bjs_roundTripOptionalGreeterArrayType", + "abiName" : "bjs_roundTripOptionalTypeAlias", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalGreeterArrayType", + "name" : "roundTripOptionalTypeAlias", "parameters" : [ { - "label" : "_", - "name" : "greeters", + "label" : "age", + "name" : "age", "type" : { "nullable" : { "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } + "int" : { + } }, "_1" : "null" @@ -9780,12 +9794,8 @@ "returnType" : { "nullable" : { "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } + "int" : { + } }, "_1" : "null" @@ -9793,598 +9803,589 @@ } }, { - "abiName" : "bjs_roundTripNestedIntArray", + "abiName" : "bjs_roundTripOptionalStatus", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedIntArray", + "name" : "roundTripOptionalStatus", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "int" : { - - } - } + "caseEnum" : { + "_0" : "Status" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "int" : { - - } - } + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripNestedStringArray", + "abiName" : "bjs_roundTripOptionalTheme", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedStringArray", + "name" : "roundTripOptionalTheme", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripNestedDoubleArray", + "abiName" : "bjs_roundTripOptionalHttpStatus", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedDoubleArray", + "name" : "roundTripOptionalHttpStatus", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "double" : { - - } - } + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "double" : { - - } - } + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripNestedBoolArray", + "abiName" : "bjs_roundTripOptionalTSDirection", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedBoolArray", + "name" : "roundTripOptionalTSDirection", "parameters" : [ { - "label" : "_", - "name" : "values", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "bool" : { - - } - } + "caseEnum" : { + "_0" : "TSDirection" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "bool" : { - - } - } + "caseEnum" : { + "_0" : "TSDirection" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripNestedDataPointArray", + "abiName" : "bjs_roundTripOptionalTSTheme", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedDataPointArray", + "name" : "roundTripOptionalTSTheme", "parameters" : [ { - "label" : "_", - "name" : "points", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripNestedDirectionArray", + "abiName" : "bjs_roundTripOptionalNetworkingAPIMethod", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedDirectionArray", + "name" : "roundTripOptionalNetworkingAPIMethod", "parameters" : [ { "label" : "_", - "name" : "directions", + "name" : "method", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } + "caseEnum" : { + "_0" : "Networking.API.Method" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } + "caseEnum" : { + "_0" : "Networking.API.Method" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripNestedGreeterArray", + "abiName" : "bjs_roundTripOptionalAPIResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripNestedGreeterArray", + "name" : "roundTripOptionalAPIResult", "parameters" : [ { - "label" : "_", - "name" : "greeters", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } + "associatedValueEnum" : { + "_0" : "APIResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } + "associatedValueEnum" : { + "_0" : "APIResult" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripUnsafeRawPointerArray", + "abiName" : "bjs_roundTripOptionalTypedPayloadResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripUnsafeRawPointerArray", + "name" : "roundTripOptionalTypedPayloadResult", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "result", "type" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripUnsafeMutableRawPointerArray", + "abiName" : "bjs_compareAPIResults", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripUnsafeMutableRawPointerArray", + "name" : "compareAPIResults", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "r1", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + }, + { + "label" : "_", + "name" : "r2", "type" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } + "associatedValueEnum" : { + "_0" : "APIResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } - } - } + "string" : { + } } }, { - "abiName" : "bjs_roundTripOpaquePointerArray", + "abiName" : "bjs_roundTripOptionalComplexResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOpaquePointerArray", + "name" : "roundTripOptionalComplexResult", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "result", "type" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } + "associatedValueEnum" : { + "_0" : "ComplexResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } + "associatedValueEnum" : { + "_0" : "ComplexResult" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripUnsafePointerArray", + "abiName" : "bjs_roundTripOptionalAllTypesResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripUnsafePointerArray", + "name" : "roundTripOptionalAllTypesResult", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "result", "type" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" - } + "associatedValueEnum" : { + "_0" : "AllTypesResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" - } + "associatedValueEnum" : { + "_0" : "AllTypesResult" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripUnsafeMutablePointerArray", + "abiName" : "bjs_roundTripOptionalPayloadResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripUnsafeMutablePointerArray", + "name" : "roundTripOptionalPayloadResult", "parameters" : [ { "label" : "_", - "name" : "values", + "name" : "result", "type" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" - } - } - } + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" } } } ], "returnType" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" - } - } - } + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" } } }, { - "abiName" : "bjs_consumeDataProcessorArrayType", + "abiName" : "bjs_roundTripOptionalPayloadResultOpt", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "consumeDataProcessorArrayType", + "name" : "roundTripOptionalPayloadResultOpt", "parameters" : [ { "label" : "_", - "name" : "processors", + "name" : "result", "type" : { - "array" : { + "nullable" : { "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "int" : { - + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripDataProcessorArrayType", + "abiName" : "bjs_roundTripOptionalClass", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripDataProcessorArrayType", + "name" : "roundTripOptionalClass", "parameters" : [ { - "label" : "_", - "name" : "processors", + "label" : "value", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" + "swiftHeapObject" : { + "_0" : "Greeter" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" + "swiftHeapObject" : { + "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripJSObjectArray", + "abiName" : "bjs_roundTripOptionalGreeter", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripJSObjectArray", + "name" : "roundTripOptionalGreeter", "parameters" : [ { "label" : "_", - "name" : "objects", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "jsObject" : { - + "swiftHeapObject" : { + "_0" : "Greeter" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "jsObject" : { - + "swiftHeapObject" : { + "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripOptionalJSObjectArray", + "abiName" : "bjs_applyOptionalGreeter", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalJSObjectArray", + "name" : "applyOptionalGreeter", "parameters" : [ { "label" : "_", - "name" : "objects", + "name" : "value", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - + "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" } - }, - "_1" : "null" + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } } } } @@ -10392,93 +10393,92 @@ } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - - } - }, - "_1" : "null" + "swiftHeapObject" : { + "_0" : "Greeter" } - } + }, + "_1" : "null" } } }, { - "abiName" : "bjs_roundTripFooArray", + "abiName" : "bjs_makeOptionalHolder", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripFooArray", + "name" : "makeOptionalHolder", "parameters" : [ { - "label" : "_", - "name" : "foos", + "label" : "nullableGreeter", + "name" : "nullableGreeter", "type" : { - "array" : { + "nullable" : { "_0" : { - "jsObject" : { - "_0" : "Foo" + "swiftHeapObject" : { + "_0" : "Greeter" } - } + }, + "_1" : "null" + } + } + }, + { + "label" : "undefinedNumber", + "name" : "undefinedNumber", + "type" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "undefined" } } } ], "returnType" : { - "array" : { - "_0" : { - "jsObject" : { - "_0" : "Foo" - } - } + "swiftHeapObject" : { + "_0" : "OptionalHolder" } } }, { - "abiName" : "bjs_roundTripOptionalFooArray", + "abiName" : "bjs_roundTripOptionalAPIOptionalResult", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "roundTripOptionalFooArray", + "name" : "roundTripOptionalAPIOptionalResult", "parameters" : [ { - "label" : "_", - "name" : "foos", + "label" : "result", + "name" : "result", "type" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - "_0" : "Foo" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "APIOptionalResult" } - } + }, + "_1" : "null" } } } ], "returnType" : { - "array" : { + "nullable" : { "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - "_0" : "Foo" - } - }, - "_1" : "null" + "associatedValueEnum" : { + "_0" : "APIOptionalResult" } - } + }, + "_1" : "null" } } }, @@ -12870,62 +12870,6 @@ } } }, - { - "name" : "jsRoundTripOptionalNumberNull", - "parameters" : [ - { - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" - } - } - }, - { - "name" : "jsRoundTripOptionalNumberUndefined", - "parameters" : [ - { - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "undefined" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "undefined" - } - } - }, { "name" : "jsRoundTripJSValue", "parameters" : [ @@ -14025,6 +13969,136 @@ ], "types" : [ + ] + }, + { + "functions" : [ + { + "name" : "runJsOptionalSupportTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "jsRoundTripOptionalNumberNull", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + } + }, + { + "name" : "jsRoundTripOptionalNumberUndefined", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "undefined" + } + } + }, + { + "name" : "jsRoundTripOptionalStringNull", + "parameters" : [ + { + "name" : "name", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "name" : "jsRoundTripOptionalStringUndefined", + "parameters" : [ + { + "name" : "name", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "types" : [ + ] } ] diff --git a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift index a465c57b4..cef881db0 100644 --- a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift @@ -35,26 +35,6 @@ class ImportAPITests: XCTestCase { } } - func testRoundTripOptionalNumberNull() throws { - try XCTAssertEqual(jsRoundTripOptionalNumberNull(42), 42) - try XCTAssertNil(jsRoundTripOptionalNumberNull(nil)) - } - - func testRoundTripOptionalNumberUndefined() throws { - let some = try jsRoundTripOptionalNumberUndefined(.value(42)) - switch some { - case .value(let value): - XCTAssertEqual(value, 42) - case .undefined: - XCTFail("Expected defined value") - } - - let undefined = try jsRoundTripOptionalNumberUndefined(.undefinedValue) - if case .value = undefined { - XCTFail("Expected undefined") - } - } - func testRoundTripJSValue() throws { let symbol = JSSymbol("roundTrip") let bigInt = JSBigInt(_slowBridge: Int64(123456789)) diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs new file mode 100644 index 000000000..8a856582d --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs @@ -0,0 +1,219 @@ +// @ts-check + +import assert from 'node:assert'; +import { + StatusValues, + ThemeValues, + HttpStatusValues, + TSDirection, + TSTheme, + APIResultValues, + APIOptionalResultValues, + AllTypesResultValues, + OptionalAllTypesResultValues, +} from '../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.js'; + +import { ImportedFoo } from './Types.mjs'; + +/** + * Optional value bridging coverage for BridgeJS runtime tests. + * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports + */ +export function runJsOptionalSupportTests(exports) { + assert.equal(exports.roundTripOptionalString(null), null); + assert.equal(exports.roundTripOptionalInt(null), null); + assert.equal(exports.roundTripOptionalBool(null), null); + assert.equal(exports.roundTripOptionalFloat(null), null); + assert.equal(exports.roundTripOptionalDouble(null), null); + + assert.equal(exports.roundTripOptionalString('Hello'), 'Hello'); + assert.equal(exports.roundTripOptionalInt(42), 42); + assert.equal(exports.roundTripOptionalBool(true), true); + assert.equal(exports.roundTripOptionalFloat(3.141592502593994), 3.141592502593994); // Float32 precision + assert.equal(exports.roundTripOptionalDouble(2.718), 2.718); + + assert.equal(exports.roundTripOptionalSyntax(null), null); + assert.equal(exports.roundTripOptionalSyntax('Test'), 'Test'); + assert.equal(exports.roundTripOptionalMixSyntax(null), null); + assert.equal(exports.roundTripOptionalMixSyntax('Mix'), 'Mix'); + assert.equal(exports.roundTripOptionalSwiftSyntax(null), null); + assert.equal(exports.roundTripOptionalSwiftSyntax('Swift'), 'Swift'); + assert.equal(exports.roundTripOptionalWithSpaces(null), null); + assert.equal(exports.roundTripOptionalWithSpaces(1.618), 1.618); + assert.equal(exports.roundTripOptionalTypeAlias(null), null); + assert.equal(exports.roundTripOptionalTypeAlias(25), 25); + assert.equal(exports.roundTripOptionalStatus(exports.Status.Success), StatusValues.Success); + assert.equal(exports.roundTripOptionalTheme(exports.Theme.Light), ThemeValues.Light); + assert.equal(exports.roundTripOptionalHttpStatus(exports.HttpStatus.Ok), HttpStatusValues.Ok); + assert.equal(exports.roundTripOptionalTSDirection(TSDirection.North), TSDirection.North); + assert.equal(exports.roundTripOptionalTSTheme(TSTheme.Light), TSTheme.Light); + assert.equal(exports.roundTripOptionalNetworkingAPIMethod(exports.Networking.API.Method.Get), exports.Networking.API.Method.Get); + + const pVal = 3.141592653589793; + const p1 = { tag: APIResultValues.Tag.Precise, param0: pVal }; + const cl1 = { tag: exports.ComplexResult.Tag.Location, param0: 37.7749, param1: -122.4194, param2: 'San Francisco' }; + + assert.deepEqual(exports.roundTripOptionalAPIResult(p1), p1); + assert.deepEqual(exports.roundTripOptionalComplexResult(cl1), cl1); + + const apiSuccess = { tag: exports.APIResult.Tag.Success, param0: 'test success' }; + const apiFailure = { tag: exports.APIResult.Tag.Failure, param0: 404 }; + const apiInfo = { tag: exports.APIResult.Tag.Info }; + + assert.equal(exports.compareAPIResults(apiSuccess, apiFailure), 'r1:success:test success,r2:failure:404'); + assert.equal(exports.compareAPIResults(null, apiInfo), 'r1:nil,r2:info'); + assert.equal(exports.compareAPIResults(apiFailure, null), 'r1:failure:404,r2:nil'); + assert.equal(exports.compareAPIResults(null, null), 'r1:nil,r2:nil'); + + const optionalGreeter = new exports.Greeter('Schrödinger'); + const optionalGreeter2 = exports.roundTripOptionalClass(optionalGreeter); + assert.equal(optionalGreeter2?.greet() ?? '', 'Hello, Schrödinger!'); + assert.equal(optionalGreeter2?.name ?? '', 'Schrödinger'); + assert.equal(optionalGreeter2?.prefix ?? '', 'Hello'); + assert.equal(exports.roundTripOptionalClass(null), null); + optionalGreeter.release(); + optionalGreeter2?.release(); + + const optionalsHolder = new exports.OptionalPropertyHolder(null); + + assert.equal(optionalsHolder.optionalName, null); + assert.equal(optionalsHolder.optionalAge, null); + assert.equal(optionalsHolder.optionalGreeter, null); + + optionalsHolder.optionalName = 'Alice'; + optionalsHolder.optionalAge = 25; + assert.equal(optionalsHolder.optionalName, 'Alice'); + assert.equal(optionalsHolder.optionalAge, 25); + + const testPropertyGreeter = new exports.Greeter('Bob'); + optionalsHolder.optionalGreeter = testPropertyGreeter; + assert.equal(optionalsHolder.optionalGreeter.greet(), 'Hello, Bob!'); + assert.equal(optionalsHolder.optionalGreeter.name, 'Bob'); + + optionalsHolder.optionalName = null; + optionalsHolder.optionalAge = null; + optionalsHolder.optionalGreeter = null; + assert.equal(optionalsHolder.optionalName, null); + assert.equal(optionalsHolder.optionalAge, null); + assert.equal(optionalsHolder.optionalGreeter, null); + testPropertyGreeter.release(); + optionalsHolder.release(); + + const optGreeter = new exports.Greeter('Optionaly'); + assert.equal(exports.roundTripOptionalGreeter(null), null); + const optGreeterReturned = exports.roundTripOptionalGreeter(optGreeter); + assert.equal(optGreeterReturned.name, 'Optionaly'); + assert.equal(optGreeterReturned.greet(), 'Hello, Optionaly!'); + + const appliedOptional = exports.applyOptionalGreeter(null, (g) => g ?? optGreeter); + assert.equal(appliedOptional.name, 'Optionaly'); + + const holderOpt = exports.makeOptionalHolder(null, undefined); + assert.equal(holderOpt.nullableGreeter, null); + assert.equal(holderOpt.undefinedNumber, undefined); + holderOpt.nullableGreeter = optGreeter; + holderOpt.undefinedNumber = 123.5; + assert.equal(holderOpt.nullableGreeter.name, 'Optionaly'); + assert.equal(holderOpt.undefinedNumber, 123.5); + holderOpt.release(); + optGreeterReturned.release(); + optGreeter.release(); + + const aor1 = { tag: APIOptionalResultValues.Tag.Success, param0: 'hello world' }; + const aor2 = { tag: APIOptionalResultValues.Tag.Success, param0: null }; + const aor3 = { tag: APIOptionalResultValues.Tag.Failure, param0: 404, param1: true }; + const aor4 = { tag: APIOptionalResultValues.Tag.Failure, param0: 404, param1: null }; + const aor5 = { tag: APIOptionalResultValues.Tag.Failure, param0: null, param1: null }; + const aor6 = { tag: APIOptionalResultValues.Tag.Status, param0: true, param1: 200, param2: 'OK' }; + const aor7 = { tag: APIOptionalResultValues.Tag.Status, param0: true, param1: null, param2: 'Partial' }; + const aor8 = { tag: APIOptionalResultValues.Tag.Status, param0: null, param1: null, param2: 'Zero' }; + const aor9 = { tag: APIOptionalResultValues.Tag.Status, param0: false, param1: 500, param2: null }; + const aor10 = { tag: APIOptionalResultValues.Tag.Status, param0: null, param1: 0, param2: 'Zero' }; + + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor1), aor1); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor2), aor2); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor3), aor3); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor4), aor4); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor5), aor5); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor6), aor6); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor7), aor7); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor8), aor8); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor9), aor9); + assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor10), aor10); + assert.equal(exports.roundTripOptionalAPIOptionalResult(null), null); + + // Optional TypedPayloadResult roundtrip + const tpr_precision = { tag: exports.TypedPayloadResult.Tag.Precision, param0: Math.fround(0.1) }; + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_precision), tpr_precision); + const tpr_direction = { tag: exports.TypedPayloadResult.Tag.Direction, param0: exports.Direction.North }; + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_direction), tpr_direction); + const tpr_optPrecisionSome = { tag: exports.TypedPayloadResult.Tag.OptPrecision, param0: Math.fround(0.001) }; + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_optPrecisionSome), tpr_optPrecisionSome); + const tpr_optPrecisionNull = { tag: exports.TypedPayloadResult.Tag.OptPrecision, param0: null }; + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_optPrecisionNull), tpr_optPrecisionNull); + const tpr_empty = { tag: exports.TypedPayloadResult.Tag.Empty }; + assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_empty), tpr_empty); + assert.equal(exports.roundTripOptionalTypedPayloadResult(null), null); + + // Optional AllTypesResult roundtrip + const atr_struct = { tag: AllTypesResultValues.Tag.StructPayload, param0: { street: "100 Main St", city: "Boston", zipCode: 2101 } }; + assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_struct), atr_struct); + const atr_array = { tag: AllTypesResultValues.Tag.ArrayPayload, param0: [10, 20, 30] }; + assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_array), atr_array); + const atr_empty = { tag: AllTypesResultValues.Tag.Empty }; + assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_empty), atr_empty); + assert.equal(exports.roundTripOptionalAllTypesResult(null), null); + + // OptionalAllTypesResult — optional struct, class, JSObject, nested enum, array as associated value payloads + const oatr_structSome = { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: { street: "200 Oak St", city: "Denver", zipCode: null } }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_structSome), oatr_structSome); + + const oatr_structNone = { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_structNone), oatr_structNone); + + const oatr_classSome = { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: new exports.Greeter("OptEnumUser") }; + const oatr_classSome_result = exports.roundTripOptionalPayloadResult(oatr_classSome); + assert.equal(oatr_classSome_result.tag, OptionalAllTypesResultValues.Tag.OptClass); + assert.equal(oatr_classSome_result.param0.name, "OptEnumUser"); + + const oatr_classNone = { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_classNone), oatr_classNone); + + const oatr_jsObjectSome = { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: { key: "value" } }; + const oatr_jsObjectSome_result = exports.roundTripOptionalPayloadResult(oatr_jsObjectSome); + assert.equal(oatr_jsObjectSome_result.tag, OptionalAllTypesResultValues.Tag.OptJSObject); + assert.equal(oatr_jsObjectSome_result.param0.key, "value"); + + const oatr_jsObjectNone = { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_jsObjectNone), oatr_jsObjectNone); + + const oatr_nestedEnumSome = { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: { tag: APIResultValues.Tag.Failure, param0: 404 } }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_nestedEnumSome), oatr_nestedEnumSome); + + const oatr_nestedEnumNone = { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_nestedEnumNone), oatr_nestedEnumNone); + + const oatr_arraySome = { tag: OptionalAllTypesResultValues.Tag.OptArray, param0: [1, 2, 3] }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_arraySome), oatr_arraySome); + + const oatr_arrayNone = { tag: OptionalAllTypesResultValues.Tag.OptArray, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_arrayNone), oatr_arrayNone); + + const oatr_jsClassSome = { tag: OptionalAllTypesResultValues.Tag.OptJsClass, param0: new ImportedFoo("optEnumFoo") }; + const oatr_jsClassSome_result = exports.roundTripOptionalPayloadResult(oatr_jsClassSome); + assert.equal(oatr_jsClassSome_result.tag, OptionalAllTypesResultValues.Tag.OptJsClass); + assert.equal(oatr_jsClassSome_result.param0.value, "optEnumFoo"); + + const oatr_jsClassNone = { tag: OptionalAllTypesResultValues.Tag.OptJsClass, param0: null }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_jsClassNone), oatr_jsClassNone); + + const oatr_empty = { tag: OptionalAllTypesResultValues.Tag.Empty }; + assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_empty), oatr_empty); + + // Optional OptionalAllTypesResult roundtrip + assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_structSome), oatr_structSome); + assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_structNone), oatr_structNone); + assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_empty), oatr_empty); + assert.equal(exports.roundTripOptionalPayloadResultOpt(null), null); + +} diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/Types.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/Types.mjs new file mode 100644 index 000000000..b4c2079d8 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/JavaScript/Types.mjs @@ -0,0 +1,6 @@ +export class ImportedFoo { + /** @param {string} value */ + constructor(value) { + this.value = value; + } +} diff --git a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift new file mode 100644 index 000000000..bc0f1fcc8 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift @@ -0,0 +1,232 @@ +import XCTest +@_spi(Experimental) import JavaScriptKit +import JavaScriptEventLoop + +@JSFunction func runJsOptionalSupportTests() throws + +final class OptionalSupportTests: XCTestCase { + func testRunJsOptionalSupportTests() throws { + try runJsOptionalSupportTests() + } + + // FIXME: Optional return type on imported function is broken + // func testRoundTripOptionalStringNull() throws { + // try XCTAssertEqual(jsRoundTripOptionalStringNull("hello"), "hello") + // try XCTAssertNil(jsRoundTripOptionalStringNull(nil)) + // } + + // func testRoundTripOptionalStringUndefined() throws { + // let some = try jsRoundTripOptionalStringUndefined(.value("hi")) + // switch some { + // case .value(let value): + // XCTAssertEqual(value, "hi") + // case .undefined: + // XCTFail("Expected defined value") + // } + + // let undefined = try jsRoundTripOptionalStringUndefined(.undefinedValue) + // if case .value = undefined { + // XCTFail("Expected undefined") + // } + // } + + func testRoundTripOptionalNumberNull() throws { + try XCTAssertEqual(jsRoundTripOptionalNumberNull(42), 42) + try XCTAssertNil(jsRoundTripOptionalNumberNull(nil)) + } + + func testRoundTripOptionalNumberUndefined() throws { + let some = try jsRoundTripOptionalNumberUndefined(.value(42)) + switch some { + case .value(let value): + XCTAssertEqual(value, 42) + case .undefined: + XCTFail("Expected defined value") + } + + let undefined = try jsRoundTripOptionalNumberUndefined(.undefined) + if case .value = undefined { + XCTFail("Expected undefined") + } + } +} + +// MARK: - Optional Bridging + +@JSFunction func jsRoundTripOptionalNumberNull(_ value: Int?) throws -> Int? +@JSFunction func jsRoundTripOptionalNumberUndefined(_ value: JSUndefinedOr) throws -> JSUndefinedOr +@JSFunction func jsRoundTripOptionalStringNull(_ name: String?) throws -> String? +@JSFunction func jsRoundTripOptionalStringUndefined(_ name: JSUndefinedOr) throws -> JSUndefinedOr + +@JS func roundTripOptionalString(name: String?) -> String? { + name +} + +@JS func roundTripOptionalInt(value: Int?) -> Int? { + value +} + +@JS func roundTripOptionalBool(flag: Bool?) -> Bool? { + flag +} + +@JS func roundTripOptionalFloat(number: Float?) -> Float? { + number +} + +@JS func roundTripOptionalDouble(precision: Double?) -> Double? { + precision +} + +@JS func roundTripOptionalSyntax(name: Optional) -> Optional { + name +} + +@JS func roundTripOptionalMixSyntax(name: String?) -> Optional { + name +} + +@JS func roundTripOptionalSwiftSyntax(name: Swift.Optional) -> Swift.Optional { + name +} + +@JS func roundTripOptionalWithSpaces(value: Optional) -> Optional { + value +} + +typealias OptionalAge = Int? +@JS func roundTripOptionalTypeAlias(age: OptionalAge) -> OptionalAge { + age +} + +@JS func roundTripOptionalStatus(value: Status?) -> Status? { + value +} + +@JS func roundTripOptionalTheme(value: Theme?) -> Theme? { + value +} + +@JS func roundTripOptionalHttpStatus(value: HttpStatus?) -> HttpStatus? { + value +} + +@JS func roundTripOptionalTSDirection(value: TSDirection?) -> TSDirection? { + value +} + +@JS func roundTripOptionalTSTheme(value: TSTheme?) -> TSTheme? { + value +} + +@JS func roundTripOptionalNetworkingAPIMethod(_ method: Networking.API.Method?) -> Networking.API.Method? { + method +} + +@JS func roundTripOptionalAPIResult(value: APIResult?) -> APIResult? { + value +} + +@JS func roundTripOptionalTypedPayloadResult(_ result: TypedPayloadResult?) -> TypedPayloadResult? { + result +} + +@JS func compareAPIResults(_ r1: APIResult?, _ r2: APIResult?) -> String { + let r1Str: String + switch r1 { + case .none: r1Str = "nil" + case .some(.success(let msg)): r1Str = "success:\(msg)" + case .some(.failure(let code)): r1Str = "failure:\(code)" + case .some(.info): r1Str = "info" + case .some(.flag(let b)): r1Str = "flag:\(b)" + case .some(.rate(let r)): r1Str = "rate:\(r)" + case .some(.precise(let p)): r1Str = "precise:\(p)" + } + + let r2Str: String + switch r2 { + case .none: r2Str = "nil" + case .some(.success(let msg)): r2Str = "success:\(msg)" + case .some(.failure(let code)): r2Str = "failure:\(code)" + case .some(.info): r2Str = "info" + case .some(.flag(let b)): r2Str = "flag:\(b)" + case .some(.rate(let r)): r2Str = "rate:\(r)" + case .some(.precise(let p)): r2Str = "precise:\(p)" + } + + return "r1:\(r1Str),r2:\(r2Str)" +} + +@JS func roundTripOptionalComplexResult(_ result: ComplexResult?) -> ComplexResult? { + result +} + +@JS func roundTripOptionalAllTypesResult(_ result: AllTypesResult?) -> AllTypesResult? { + result +} + +@JS +enum OptionalAllTypesResult { + case optStruct(Address?) + case optClass(Greeter?) + case optJSObject(JSObject?) + case optNestedEnum(APIResult?) + case optArray([Int]?) + case optJsClass(Foo?) + case empty +} + +@JS func roundTripOptionalPayloadResult(_ result: OptionalAllTypesResult) -> OptionalAllTypesResult { + result +} + +@JS func roundTripOptionalPayloadResultOpt(_ result: OptionalAllTypesResult?) -> OptionalAllTypesResult? { + result +} + +@JS func roundTripOptionalClass(value: Greeter?) -> Greeter? { + value +} + +@JS func roundTripOptionalGreeter(_ value: Greeter?) -> Greeter? { + value +} + +@JS func applyOptionalGreeter(_ value: Greeter?, _ transform: (Greeter?) -> Greeter?) -> Greeter? { + transform(value) +} + +@JS class OptionalHolder { + @JS var nullableGreeter: Greeter? + @JS var undefinedNumber: JSUndefinedOr + + @JS init(nullableGreeter: Greeter?, undefinedNumber: JSUndefinedOr) { + self.nullableGreeter = nullableGreeter + self.undefinedNumber = undefinedNumber + } +} + +@JS func makeOptionalHolder(nullableGreeter: Greeter?, undefinedNumber: JSUndefinedOr) -> OptionalHolder { + OptionalHolder(nullableGreeter: nullableGreeter, undefinedNumber: undefinedNumber) +} + +@JS class OptionalPropertyHolder { + @JS var optionalName: String? + @JS var optionalAge: Int? = nil + @JS var optionalGreeter: Greeter? = nil + + @JS init(optionalName: String?) { + self.optionalName = optionalName + } +} + +@JS +enum APIOptionalResult { + case success(String?) + case failure(Int?, Bool?) + case status(Bool?, Int?, String?) +} + +@JS func roundTripOptionalAPIOptionalResult(result: APIOptionalResult?) -> APIOptionalResult? { + result +} diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts index b7dc6c48d..08d56adf1 100644 --- a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts +++ b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts @@ -2,8 +2,6 @@ export function jsRoundTripVoid(): void export function jsRoundTripNumber(v: number): number export function jsRoundTripBool(v: boolean): boolean export function jsRoundTripString(v: string): string -export function jsRoundTripOptionalNumberNull(v: number | null): number | null -export function jsRoundTripOptionalNumberUndefined(v: number | undefined): number | undefined export type JSValue = any export function jsRoundTripJSValue(v: JSValue): JSValue export function jsThrowOrVoid(shouldThrow: boolean): void diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index e8f0b081c..70e138e63 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -3,6 +3,8 @@ import { DirectionValues, StatusValues, ThemeValues, HttpStatusValues, TSDirection, TSTheme, APIResultValues, ComplexResultValues, APIOptionalResultValues, StaticCalculatorValues, StaticPropertyEnumValues, PrecisionValues, TypedPayloadResultValues, AllTypesResultValues, OptionalAllTypesResultValues } from '../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.js'; +import { ImportedFoo } from './BridgeJSRuntimeTests/JavaScript/Types.mjs'; +import { runJsOptionalSupportTests } from './BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs'; /** @type {import('../.build/plugins/PackageToJS/outputs/PackageTests/test.d.ts').SetupOptionsFn} */ export async function setupOptions(options, context) { @@ -68,6 +70,12 @@ export async function setupOptions(options, context) { "jsRoundTripOptionalNumberUndefined": (v) => { return v === undefined ? undefined : v; }, + "jsRoundTripOptionalStringNull": (v) => { + return v ?? null; + }, + "jsRoundTripOptionalStringUndefined": (v) => { + return v === undefined ? undefined : v; + }, "jsRoundTripJSValue": (v) => { return v; }, @@ -184,6 +192,11 @@ export async function setupOptions(options, context) { }, roundTripArrayMembers: (value) => { return value; + }, + runJsOptionalSupportTests: () => { + const exports = importsContext.getExports(); + if (!exports) { throw new Error("No exports!?"); } + runJsOptionalSupportTests(exports); } }; }, @@ -220,13 +233,6 @@ export async function setupOptions(options, context) { import assert from "node:assert"; -class ImportedFoo { - /** @param {string} value */ - constructor(value) { - this.value = value; - } -} - /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { exports.roundTripVoid(); @@ -714,123 +720,6 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.deepEqual(exports.makeAPINetworkingResultSuccess("Connected"), { tag: exports.API.NetworkingResult.Tag.Success, param0: "Connected" }); assert.deepEqual(exports.makeAPINetworkingResultFailure("Timeout", 408), { tag: exports.API.NetworkingResult.Tag.Failure, param0: "Timeout", param1: 408 }); - assert.equal(exports.roundTripOptionalString(null), null); - assert.equal(exports.roundTripOptionalInt(null), null); - assert.equal(exports.roundTripOptionalBool(null), null); - assert.equal(exports.roundTripOptionalFloat(null), null); - assert.equal(exports.roundTripOptionalDouble(null), null); - - assert.equal(exports.roundTripOptionalString("Hello"), "Hello"); - assert.equal(exports.roundTripOptionalInt(42), 42); - assert.equal(exports.roundTripOptionalBool(true), true); - assert.equal(exports.roundTripOptionalFloat(3.141592502593994), 3.141592502593994); // Float32 precision - assert.equal(exports.roundTripOptionalDouble(2.718), 2.718); - - assert.equal(exports.roundTripOptionalSyntax(null), null); - assert.equal(exports.roundTripOptionalSyntax("Test"), "Test"); - assert.equal(exports.roundTripOptionalMixSyntax(null), null); - assert.equal(exports.roundTripOptionalMixSyntax("Mix"), "Mix"); - assert.equal(exports.roundTripOptionalSwiftSyntax(null), null); - assert.equal(exports.roundTripOptionalSwiftSyntax("Swift"), "Swift"); - assert.equal(exports.roundTripOptionalWithSpaces(null), null); - assert.equal(exports.roundTripOptionalWithSpaces(1.618), 1.618); - assert.equal(exports.roundTripOptionalTypeAlias(null), null); - assert.equal(exports.roundTripOptionalTypeAlias(25), 25); - assert.equal(exports.roundTripOptionalStatus(exports.Status.Success), StatusValues.Success); - assert.equal(exports.roundTripOptionalTheme(exports.Theme.Light), ThemeValues.Light); - assert.equal(exports.roundTripOptionalHttpStatus(exports.HttpStatus.Ok), HttpStatusValues.Ok); - assert.equal(exports.roundTripOptionalTSDirection(TSDirection.North), TSDirection.North); - assert.equal(exports.roundTripOptionalTSTheme(TSTheme.Light), TSTheme.Light); - assert.equal(exports.roundTripOptionalNetworkingAPIMethod(exports.Networking.API.Method.Get), exports.Networking.API.Method.Get); - assert.deepEqual(exports.roundTripOptionalAPIResult(p1), p1); - assert.deepEqual(exports.roundTripOptionalComplexResult(cl1), cl1); - - const apiSuccess = { tag: exports.APIResult.Tag.Success, param0: "test success" }; - const apiFailure = { tag: exports.APIResult.Tag.Failure, param0: 404 }; - const apiInfo = { tag: exports.APIResult.Tag.Info }; - - assert.equal(exports.compareAPIResults(apiSuccess, apiFailure), "r1:success:test success,r2:failure:404"); - assert.equal(exports.compareAPIResults(null, apiInfo), "r1:nil,r2:info"); - assert.equal(exports.compareAPIResults(apiFailure, null), "r1:failure:404,r2:nil"); - assert.equal(exports.compareAPIResults(null, null), "r1:nil,r2:nil"); - - const optionalGreeter = new exports.Greeter("Schrödinger"); - const optionalGreeter2 = exports.roundTripOptionalClass(optionalGreeter); - assert.equal(optionalGreeter2?.greet() ?? "", "Hello, Schrödinger!"); - assert.equal(optionalGreeter2?.name ?? "", "Schrödinger"); - assert.equal(optionalGreeter2?.prefix ?? "", "Hello"); - assert.equal(exports.roundTripOptionalClass(null), null); - optionalGreeter.release(); - optionalGreeter2?.release(); - - const optionalsHolder = new exports.OptionalPropertyHolder(null); - - assert.equal(optionalsHolder.optionalName, null); - assert.equal(optionalsHolder.optionalAge, null); - assert.equal(optionalsHolder.optionalGreeter, null); - - optionalsHolder.optionalName = "Alice"; - optionalsHolder.optionalAge = 25; - assert.equal(optionalsHolder.optionalName, "Alice"); - assert.equal(optionalsHolder.optionalAge, 25); - - const testPropertyGreeter = new exports.Greeter("Bob"); - optionalsHolder.optionalGreeter = testPropertyGreeter; - assert.equal(optionalsHolder.optionalGreeter.greet(), "Hello, Bob!"); - assert.equal(optionalsHolder.optionalGreeter.name, "Bob"); - - optionalsHolder.optionalName = null; - optionalsHolder.optionalAge = null; - optionalsHolder.optionalGreeter = null; - assert.equal(optionalsHolder.optionalName, null); - assert.equal(optionalsHolder.optionalAge, null); - assert.equal(optionalsHolder.optionalGreeter, null); - testPropertyGreeter.release(); - optionalsHolder.release(); - - const optGreeter = new exports.Greeter("Optionaly"); - assert.equal(exports.roundTripOptionalGreeter(null), null); - const optGreeterReturned = exports.roundTripOptionalGreeter(optGreeter); - assert.equal(optGreeterReturned.name, "Optionaly"); - assert.equal(optGreeterReturned.greet(), "Hello, Optionaly!"); - - const appliedOptional = exports.applyOptionalGreeter(null, (g) => g ?? optGreeter); - assert.equal(appliedOptional.name, "Optionaly"); - - const holderOpt = exports.makeOptionalHolder(null, undefined); - assert.equal(holderOpt.nullableGreeter, null); - assert.equal(holderOpt.undefinedNumber, undefined); - holderOpt.nullableGreeter = optGreeter; - holderOpt.undefinedNumber = 123.5; - assert.equal(holderOpt.nullableGreeter.name, "Optionaly"); - assert.equal(holderOpt.undefinedNumber, 123.5); - holderOpt.release(); - optGreeterReturned.release(); - optGreeter.release(); - - const aor1 = { tag: APIOptionalResultValues.Tag.Success, param0: "hello world" }; - const aor2 = { tag: APIOptionalResultValues.Tag.Success, param0: null }; - const aor3 = { tag: APIOptionalResultValues.Tag.Failure, param0: 404, param1: true }; - const aor4 = { tag: APIOptionalResultValues.Tag.Failure, param0: 404, param1: null }; - const aor5 = { tag: APIOptionalResultValues.Tag.Failure, param0: null, param1: null }; - const aor6 = { tag: APIOptionalResultValues.Tag.Status, param0: true, param1: 200, param2: "OK" }; - const aor7 = { tag: APIOptionalResultValues.Tag.Status, param0: true, param1: null, param2: "Partial" }; - const aor8 = { tag: APIOptionalResultValues.Tag.Status, param0: null, param1: null, param2: "Zero" }; - const aor9 = { tag: APIOptionalResultValues.Tag.Status, param0: false, param1: 500, param2: null }; - const aor10 = { tag: APIOptionalResultValues.Tag.Status, param0: null, param1: 0, param2: "Zero" }; - - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor1), aor1); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor2), aor2); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor3), aor3); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor4), aor4); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor5), aor5); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor6), aor6); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor7), aor7); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor8), aor8); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor9), aor9); - assert.deepEqual(exports.roundTripOptionalAPIOptionalResult(aor10), aor10); - assert.equal(exports.roundTripOptionalAPIOptionalResult(null), null); - // TypedPayloadResult — rawValueEnum and caseEnum as associated value payloads assert.equal(exports.Precision.Rough, 0.1); assert.equal(exports.Precision.Fine, 0.001); @@ -859,14 +748,6 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { const tpr_empty = { tag: exports.TypedPayloadResult.Tag.Empty }; assert.deepEqual(exports.roundTripTypedPayloadResult(tpr_empty), tpr_empty); - // Optional TypedPayloadResult roundtrip - assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_precision), tpr_precision); - assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_direction), tpr_direction); - assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_optPrecisionSome), tpr_optPrecisionSome); - assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_optPrecisionNull), tpr_optPrecisionNull); - assert.deepEqual(exports.roundTripOptionalTypedPayloadResult(tpr_empty), tpr_empty); - assert.equal(exports.roundTripOptionalTypedPayloadResult(null), null); - // AllTypesResult — struct, class, JSObject, nested enum, array as associated value payloads const atr_struct = { tag: AllTypesResultValues.Tag.StructPayload, param0: { street: "100 Main St", city: "Boston", zipCode: 2101 } }; assert.deepEqual(exports.roundTripAllTypesResult(atr_struct), atr_struct); @@ -896,64 +777,6 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { const atr_empty = { tag: AllTypesResultValues.Tag.Empty }; assert.deepEqual(exports.roundTripAllTypesResult(atr_empty), atr_empty); - // Optional AllTypesResult roundtrip - assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_struct), atr_struct); - assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_array), atr_array); - assert.deepEqual(exports.roundTripOptionalAllTypesResult(atr_empty), atr_empty); - assert.equal(exports.roundTripOptionalAllTypesResult(null), null); - - // OptionalAllTypesResult — optional struct, class, JSObject, nested enum, array as associated value payloads - const oatr_structSome = { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: { street: "200 Oak St", city: "Denver", zipCode: null } }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_structSome), oatr_structSome); - - const oatr_structNone = { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: null }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_structNone), oatr_structNone); - - const oatr_classSome = { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: new exports.Greeter("OptEnumUser") }; - const oatr_classSome_result = exports.roundTripOptionalPayloadResult(oatr_classSome); - assert.equal(oatr_classSome_result.tag, OptionalAllTypesResultValues.Tag.OptClass); - assert.equal(oatr_classSome_result.param0.name, "OptEnumUser"); - - const oatr_classNone = { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: null }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_classNone), oatr_classNone); - - const oatr_jsObjectSome = { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: { key: "value" } }; - const oatr_jsObjectSome_result = exports.roundTripOptionalPayloadResult(oatr_jsObjectSome); - assert.equal(oatr_jsObjectSome_result.tag, OptionalAllTypesResultValues.Tag.OptJSObject); - assert.equal(oatr_jsObjectSome_result.param0.key, "value"); - - const oatr_jsObjectNone = { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: null }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_jsObjectNone), oatr_jsObjectNone); - - const oatr_nestedEnumSome = { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: { tag: APIResultValues.Tag.Failure, param0: 404 } }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_nestedEnumSome), oatr_nestedEnumSome); - - const oatr_nestedEnumNone = { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: null }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_nestedEnumNone), oatr_nestedEnumNone); - - const oatr_arraySome = { tag: OptionalAllTypesResultValues.Tag.OptArray, param0: [1, 2, 3] }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_arraySome), oatr_arraySome); - - const oatr_arrayNone = { tag: OptionalAllTypesResultValues.Tag.OptArray, param0: null }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_arrayNone), oatr_arrayNone); - - const oatr_jsClassSome = { tag: OptionalAllTypesResultValues.Tag.OptJsClass, param0: new ImportedFoo("optEnumFoo") }; - const oatr_jsClassSome_result = exports.roundTripOptionalPayloadResult(oatr_jsClassSome); - assert.equal(oatr_jsClassSome_result.tag, OptionalAllTypesResultValues.Tag.OptJsClass); - assert.equal(oatr_jsClassSome_result.param0.value, "optEnumFoo"); - - const oatr_jsClassNone = { tag: OptionalAllTypesResultValues.Tag.OptJsClass, param0: null }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_jsClassNone), oatr_jsClassNone); - - const oatr_empty = { tag: OptionalAllTypesResultValues.Tag.Empty }; - assert.deepEqual(exports.roundTripOptionalPayloadResult(oatr_empty), oatr_empty); - - // Optional OptionalAllTypesResult roundtrip - assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_structSome), oatr_structSome); - assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_structNone), oatr_structNone); - assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_empty), oatr_empty); - assert.equal(exports.roundTripOptionalPayloadResultOpt(null), null); - assert.equal(exports.MathUtils.add(2147483647, 0), 2147483647); assert.equal(exports.StaticCalculator.roundtrip(42), 42); assert.equal(StaticCalculatorValues.Scientific, 0); From b2e93d0322ce11b1e9cbf11b562ace226489c8b4 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 5 Feb 2026 15:01:31 +0900 Subject: [PATCH 158/252] BridgeJS: Fix optional String return handling in generated JS glue code --- .../Sources/BridgeJSLink/JSGlueGen.swift | 20 ++-------- .../BridgeJSLinkTests/Optionals.js | 28 ++++--------- .../OptionalSupportTests.swift | 39 +++++++++---------- 3 files changed, 31 insertions(+), 56 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 410bce672..fc04e4670 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -994,19 +994,13 @@ struct IntrinsicJSFragment: Sendable { "bjs[\"swift_js_return_optional_double\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? \(value) : 0.0);" ) case .string: - let bytesVar = scope.variable("bytes") printer.write("if (\(isSomeVar)) {") printer.indent { - printer.write( - "const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" - ) - printer.write("bjs[\"swift_js_return_optional_string\"](1, \(bytesVar), \(bytesVar).length);") - printer.write("return \(bytesVar).length;") + printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(value);") } printer.write("} else {") printer.indent { - printer.write("bjs[\"swift_js_return_optional_string\"](0, 0, 0);") - printer.write("return -1;") + printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = null;") } printer.write("}") case .jsObject, .swiftProtocol: @@ -1032,19 +1026,13 @@ struct IntrinsicJSFragment: Sendable { case .rawValueEnum(_, let rawType): switch rawType { case .string: - let bytesVar = scope.variable("bytes") printer.write("if (\(isSomeVar)) {") printer.indent { - printer.write( - "const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" - ) - printer.write( - "bjs[\"swift_js_return_optional_string\"](1, \(bytesVar), \(bytesVar).length);" - ) + printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(value);") } printer.write("} else {") printer.indent { - printer.write("bjs[\"swift_js_return_optional_string\"](0, 0, 0);") + printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = null;") } printer.write("}") default: diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 341fcd966..0d45b2169 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -238,12 +238,9 @@ export async function createInstantiator(options, swift) { let ret = swift.memory.getObject(self).stringOrNull; const isSome = ret != null; if (isSome) { - const bytes = textEncoder.encode(ret); - bjs["swift_js_return_optional_string"](1, bytes, bytes.length); - return bytes.length; + tmpRetString = ret; } else { - bjs["swift_js_return_optional_string"](0, 0, 0); - return -1; + tmpRetString = null; } } catch (error) { setException(error); @@ -254,12 +251,9 @@ export async function createInstantiator(options, swift) { let ret = swift.memory.getObject(self).stringOrUndefined; const isSome = ret !== undefined; if (isSome) { - const bytes = textEncoder.encode(ret); - bjs["swift_js_return_optional_string"](1, bytes, bytes.length); - return bytes.length; + tmpRetString = ret; } else { - bjs["swift_js_return_optional_string"](0, 0, 0); - return -1; + tmpRetString = null; } } catch (error) { setException(error); @@ -395,12 +389,9 @@ export async function createInstantiator(options, swift) { let ret = swift.memory.getObject(self).roundTripStringOrNull(valueIsSome ? obj : null); const isSome = ret != null; if (isSome) { - const bytes = textEncoder.encode(ret); - bjs["swift_js_return_optional_string"](1, bytes, bytes.length); - return bytes.length; + tmpRetString = ret; } else { - bjs["swift_js_return_optional_string"](0, 0, 0); - return -1; + tmpRetString = null; } } catch (error) { setException(error); @@ -416,12 +407,9 @@ export async function createInstantiator(options, swift) { let ret = swift.memory.getObject(self).roundTripStringOrUndefined(valueIsSome ? obj : undefined); const isSome = ret !== undefined; if (isSome) { - const bytes = textEncoder.encode(ret); - bjs["swift_js_return_optional_string"](1, bytes, bytes.length); - return bytes.length; + tmpRetString = ret; } else { - bjs["swift_js_return_optional_string"](0, 0, 0); - return -1; + tmpRetString = null; } } catch (error) { setException(error); diff --git a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift index bc0f1fcc8..adfd51dea 100644 --- a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift +++ b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift @@ -9,26 +9,25 @@ final class OptionalSupportTests: XCTestCase { try runJsOptionalSupportTests() } - // FIXME: Optional return type on imported function is broken - // func testRoundTripOptionalStringNull() throws { - // try XCTAssertEqual(jsRoundTripOptionalStringNull("hello"), "hello") - // try XCTAssertNil(jsRoundTripOptionalStringNull(nil)) - // } - - // func testRoundTripOptionalStringUndefined() throws { - // let some = try jsRoundTripOptionalStringUndefined(.value("hi")) - // switch some { - // case .value(let value): - // XCTAssertEqual(value, "hi") - // case .undefined: - // XCTFail("Expected defined value") - // } - - // let undefined = try jsRoundTripOptionalStringUndefined(.undefinedValue) - // if case .value = undefined { - // XCTFail("Expected undefined") - // } - // } + func testRoundTripOptionalStringNull() throws { + try XCTAssertEqual(jsRoundTripOptionalStringNull("hello"), "hello") + try XCTAssertNil(jsRoundTripOptionalStringNull(nil)) + } + + func testRoundTripOptionalStringUndefined() throws { + let some = try jsRoundTripOptionalStringUndefined(.value("hi")) + switch some { + case .value(let value): + XCTAssertEqual(value, "hi") + case .undefined: + XCTFail("Expected defined value") + } + + let undefined = try jsRoundTripOptionalStringUndefined(.undefinedValue) + if case .value = undefined { + XCTFail("Expected undefined") + } + } func testRoundTripOptionalNumberNull() throws { try XCTAssertEqual(jsRoundTripOptionalNumberNull(42), 42) From b9320732ff0b2a2102507c9002f40663624f145e Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 5 Feb 2026 09:39:03 +0100 Subject: [PATCH 159/252] BridgeJS: Skip directories in generate input file processing --- Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index dd37fb3bc..92e74e621 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -148,7 +148,13 @@ import BridgeJSUtilities exposeToGlobal: config.exposeToGlobal ) for inputFile in inputFiles.sorted() { - let content = try String(contentsOf: URL(fileURLWithPath: inputFile), encoding: .utf8) + let inputURL = URL(fileURLWithPath: inputFile) + // Skip directories (e.g. .docc catalogs included in target.sourceFiles) + var isDirectory: ObjCBool = false + if FileManager.default.fileExists(atPath: inputFile, isDirectory: &isDirectory), isDirectory.boolValue { + continue + } + let content = try String(contentsOf: inputURL, encoding: .utf8) if hasBridgeJSSkipComment(content) { continue } From 89d8165c805218defa8de02eb863ace42b976361 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 5 Feb 2026 16:22:21 +0900 Subject: [PATCH 160/252] [NFC] BridgeJS: Add push/pop JS codegen helpers This is a preparation for unifying stacks for param/ret values to make it direction agnostic. --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 4 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 390 +++++++++--------- 2 files changed, 208 insertions(+), 186 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 7a5e02f2d..c2b0c6ed3 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -1065,7 +1065,7 @@ public struct BridgeJSLink { } for enumDef in allAssocEnums { let enumPrinter = CodeFragmentPrinter() - let enumScope = JSGlueVariableScope() + let enumScope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) let enumCleanup = CodeFragmentPrinter() let fragment = IntrinsicJSFragment.associatedValueEnumHelperFactory(enumDefinition: enumDef) _ = fragment.printCode([enumDef.valuesName], enumScope, enumPrinter, enumCleanup) @@ -1608,7 +1608,7 @@ public struct BridgeJSLink { ) throws -> (jsTopLevel: [String], jsExportEntry: [String], dtsType: [String], dtsExportEntry: [String]) { var jsTopLevelLines: [String] = [] var dtsTypeLines: [String] = [] - let scope = JSGlueVariableScope() + let scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) let cleanup = CodeFragmentPrinter() let printer = CodeFragmentPrinter() let enumValuesName = enumDefinition.valuesName diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 1619c2cd2..772c8c84c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -34,7 +34,7 @@ final class JSGlueVariableScope { static let reservedEnumHelpers = "enumHelpers" static let reservedStructHelpers = "structHelpers" - private let intrinsicRegistry: JSIntrinsicRegistry? + private let intrinsicRegistry: JSIntrinsicRegistry private var variables: Set = [ reservedSwift, @@ -66,7 +66,7 @@ final class JSGlueVariableScope { reservedStructHelpers, ] - init(intrinsicRegistry: JSIntrinsicRegistry? = nil) { + init(intrinsicRegistry: JSIntrinsicRegistry) { self.intrinsicRegistry = intrinsicRegistry } @@ -88,7 +88,7 @@ final class JSGlueVariableScope { } func registerIntrinsic(_ name: String, build: (CodeFragmentPrinter) -> Void) { - intrinsicRegistry?.register(name: name, build: build) + intrinsicRegistry.register(name: name, build: build) } func makeChildScope() -> JSGlueVariableScope { @@ -96,6 +96,53 @@ final class JSGlueVariableScope { } } +extension JSGlueVariableScope { + // MARK: Parameter + + func emitPushI32Parameter(_ value: String, printer: CodeFragmentPrinter) { + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(value));") + } + func emitPushF64Parameter(_ value: String, printer: CodeFragmentPrinter) { + printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(value));") + } + func emitPushF32Parameter(_ value: String, printer: CodeFragmentPrinter) { + printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(\(value));") + } + func emitPushPointerParameter(_ value: String, printer: CodeFragmentPrinter) { + printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(\(value));") + } + + // MARK: Return + + func emitPushI32Return(_ value: String, printer: CodeFragmentPrinter) { + printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(\(value));") + } + func emitPushF64Return(_ value: String, printer: CodeFragmentPrinter) { + printer.write("\(JSGlueVariableScope.reservedTmpRetF64s).push(\(value));") + } + func emitPushPointerReturn(_ value: String, printer: CodeFragmentPrinter) { + printer.write("\(JSGlueVariableScope.reservedTmpRetPointers).push(\(value));") + } + func popTagReturn() -> String { + return "\(JSGlueVariableScope.reservedTmpRetTag).pop()" + } + func popStringReturn() -> String { + return "\(JSGlueVariableScope.reservedTmpRetStrings).pop()" + } + func popI32Return() -> String { + return "\(JSGlueVariableScope.reservedTmpRetInts).pop()" + } + func popF64Return() -> String { + return "\(JSGlueVariableScope.reservedTmpRetF64s).pop()" + } + func popF32Return() -> String { + return "\(JSGlueVariableScope.reservedTmpRetF32s).pop()" + } + func popPointerReturn() -> String { + return "\(JSGlueVariableScope.reservedTmpRetPointers).pop()" + } +} + /// A fragment of JS code used to convert a value between Swift and JS. /// /// See `BridgeJSIntrinsics.swift` in the main JavaScriptKit module for Swift side lowering/lifting implementation. @@ -271,7 +318,7 @@ struct IntrinsicJSFragment: Sendable { helperPrinter.write("}") helperPrinter.write("function \(jsValueLiftHelperName)(kind, payload1, payload2) {") helperPrinter.indent { - let helperScope = JSGlueVariableScope() + let helperScope = scope.makeChildScope() let resultVar = emitJSValueConstruction( kind: "kind", payload1: "payload1", @@ -466,9 +513,9 @@ struct IntrinsicJSFragment: Sendable { let kindVar = lowered[0] let payload1Var = lowered[1] let payload2Var = lowered[2] - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(kindVar));") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(payload1Var));") - printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(payload2Var));") + scope.emitPushI32Parameter(kindVar, printer: printer) + scope.emitPushI32Parameter(payload1Var, printer: printer) + scope.emitPushF64Parameter(payload2Var, printer: printer) return [] } ) @@ -482,9 +529,9 @@ struct IntrinsicJSFragment: Sendable { let kindVar = lowered[0] let payload1Var = lowered[1] let payload2Var = lowered[2] - printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(\(kindVar));") - printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(\(payload1Var));") - printer.write("\(JSGlueVariableScope.reservedTmpRetF64s).push(\(payload2Var));") + scope.emitPushI32Parameter(kindVar, printer: printer) + scope.emitPushI32Parameter(payload1Var, printer: printer) + scope.emitPushF64Parameter(payload2Var, printer: printer) return [] } ) @@ -497,9 +544,9 @@ struct IntrinsicJSFragment: Sendable { let payload2 = scope.variable("jsValuePayload2") let payload1 = scope.variable("jsValuePayload1") let kind = scope.variable("jsValueKind") - printer.write("const \(payload2) = \(JSGlueVariableScope.reservedTmpRetF64s).pop();") - printer.write("const \(payload1) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") - printer.write("const \(kind) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(payload2) = \(scope.popF64Return());") + printer.write("const \(payload1) = \(scope.popI32Return());") + printer.write("const \(kind) = \(scope.popI32Return());") let resultVar = scope.variable("jsValue") registerJSValueHelpers(scope: scope) printer.write( @@ -571,7 +618,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { _, scope, printer, _ in let retName = scope.variable("ret") printer.write( - "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lift(\(JSGlueVariableScope.reservedTmpRetTag).pop(), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lift(\(scope.popTagReturn()), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) return [retName] } @@ -886,7 +933,7 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName let tagVar = scope.variable("tag") - printer.write("const \(tagVar) = \(JSGlueVariableScope.reservedTmpRetTag).pop();") + printer.write("const \(tagVar) = \(scope.popTagReturn());") let isNullVar = scope.variable("isNull") printer.write("const \(isNullVar) = (\(tagVar) === -1);") printer.write("let \(resultVar);") @@ -904,7 +951,7 @@ struct IntrinsicJSFragment: Sendable { case .swiftStruct(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(isSomeVar) = \(scope.popI32Return());") printer.write("let \(resultVar);") printer.write("if (\(isSomeVar)) {") printer.indent { @@ -919,7 +966,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("}") case .array(let elementType): let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(isSomeVar) = \(scope.popI32Return());") printer.write("let \(resultVar);") printer.write("if (\(isSomeVar)) {") printer.indent { @@ -936,7 +983,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("}") case .jsValue: let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(isSomeVar) = \(scope.popI32Return());") printer.write("let \(resultVar);") printer.write("if (\(isSomeVar)) {") printer.indent { @@ -1018,11 +1065,11 @@ struct IntrinsicJSFragment: Sendable { let kindVar = lowered[0] let payload1Var = lowered[1] let payload2Var = lowered[2] - printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(\(kindVar));") - printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(\(payload1Var));") - printer.write("\(JSGlueVariableScope.reservedTmpRetF64s).push(\(payload2Var));") + scope.emitPushI32Parameter(kindVar, printer: printer) + scope.emitPushI32Parameter(payload1Var, printer: printer) + scope.emitPushF64Parameter(payload2Var, printer: printer) } - printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) case .array(let elementType): printer.write("if (\(isSomeVar)) {") printer.indent { @@ -1036,7 +1083,7 @@ struct IntrinsicJSFragment: Sendable { } } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) case .rawValueEnum(_, let rawType): switch rawType { case .string: @@ -1635,7 +1682,7 @@ struct IntrinsicJSFragment: Sendable { let base = fullName.components(separatedBy: ".").last ?? fullName let resultVar = scope.variable("result") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetTag).pop(), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popTagReturn()), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) printer.write("return \(resultVar);") return [] @@ -2259,46 +2306,36 @@ struct IntrinsicJSFragment: Sendable { "let \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" ) printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) + scope.emitPushI32Parameter(idVar, printer: printer) } printer.write("} else {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + scope.emitPushI32Parameter("0", printer: printer) + scope.emitPushI32Parameter("0", printer: printer) } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) cleanup.write("if(\(idVar)) {") cleanup.indent { cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") } cleanup.write("}") case .int, .uint: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) | 0) : 0);" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? (\(value) | 0) : 0", printer: printer) + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) case .bool: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) ? 1 : 0) : 0);" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? (\(value) ? 1 : 0) : 0", printer: printer) + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) case .float: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamF32s).push(\(isSomeVar) ? Math.fround(\(value)) : 0.0);" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushF32Parameter("\(isSomeVar) ? Math.fround(\(value)) : 0.0", printer: printer) + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) case .double: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamF64s).push(\(isSomeVar) ? \(value) : 0.0);" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushF64Parameter("\(isSomeVar) ? \(value) : 0.0", printer: printer) + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) case .caseEnum: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) | 0) : 0);" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? (\(value) | 0) : 0", printer: printer) + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) case .rawValueEnum(_, let rawType): switch rawType { case .string: @@ -2313,20 +2350,16 @@ struct IntrinsicJSFragment: Sendable { printer.write( "\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" ) - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);" - ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) + scope.emitPushI32Parameter(idVar, printer: printer) } printer.write("} else {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + scope.emitPushI32Parameter("0", printer: printer) + scope.emitPushI32Parameter("0", printer: printer) } printer.write("}") - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);" - ) + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) cleanup.write("if(\(idVar)) {") cleanup.indent { cleanup.write( @@ -2335,26 +2368,14 @@ struct IntrinsicJSFragment: Sendable { } cleanup.write("}") case .float: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamF32s).push(\(isSomeVar) ? Math.fround(\(value)) : 0.0);" - ) - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);" - ) + scope.emitPushF32Parameter("\(isSomeVar) ? Math.fround(\(value)) : 0.0", printer: printer) + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) case .double: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamF64s).push(\(isSomeVar) ? \(value) : 0.0);" - ) - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);" - ) + scope.emitPushF64Parameter("\(isSomeVar) ? \(value) : 0.0", printer: printer) + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) default: - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? (\(value) | 0) : 0);" - ) - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);" - ) + scope.emitPushI32Parameter("\(isSomeVar) ? (\(value) | 0) : 0", printer: printer) + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) } case .swiftStruct(let structName): let structBase = structName.components(separatedBy: ".").last ?? structName @@ -2369,34 +2390,34 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(nestedCleanupVar) = \(structResultVar).cleanup;") } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) cleanup.write("if (\(nestedCleanupVar)) { \(nestedCleanupVar)(); }") case .swiftHeapObject: printer.write("if (\(isSomeVar)) {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(\(value).pointer);") + scope.emitPushPointerParameter("\(value).pointer", printer: printer) } printer.write("} else {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(0);") + scope.emitPushPointerParameter("0", printer: printer) } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) case .jsObject: let idVar = scope.variable("id") printer.write("let \(idVar);") printer.write("if (\(isSomeVar)) {") printer.indent { printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + scope.emitPushI32Parameter(idVar, printer: printer) } printer.write("} else {") printer.indent { printer.write("\(idVar) = undefined;") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + scope.emitPushI32Parameter("0", printer: printer) } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) case .associatedValueEnum(let enumName): let base = enumName.components(separatedBy: ".").last ?? enumName let caseIdVar = scope.variable("enumCaseId") @@ -2410,14 +2431,14 @@ struct IntrinsicJSFragment: Sendable { ) printer.write("\(caseIdVar) = \(enumResultVar).caseId;") printer.write("\(enumCleanupVar) = \(enumResultVar).cleanup;") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(caseIdVar));") + scope.emitPushI32Parameter(caseIdVar, printer: printer) } printer.write("} else {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + scope.emitPushI32Parameter("0", printer: printer) } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) cleanup.write("if (\(enumCleanupVar)) { \(enumCleanupVar)(); }") case .array(let elementType): // Array cleanup references variables declared inside the if block, @@ -2443,10 +2464,10 @@ struct IntrinsicJSFragment: Sendable { } } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) cleanup.write("if (\(arrCleanupVar)) { \(arrCleanupVar)(); }") default: - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) } return [] @@ -2473,7 +2494,7 @@ struct IntrinsicJSFragment: Sendable { let optVar = scope.variable("optional") let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(isSomeVar) = \(scope.popI32Return());") printer.write("let \(optVar);") printer.write("if (\(isSomeVar)) {") printer.indent { @@ -2482,7 +2503,7 @@ struct IntrinsicJSFragment: Sendable { if case .associatedValueEnum(let fullName) = wrappedType { let base = fullName.components(separatedBy: ".").last ?? fullName let caseIdVar = scope.variable("caseId") - printer.write("const \(caseIdVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(caseIdVar) = \(scope.popI32Return());") printer.write( "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) @@ -2579,7 +2600,7 @@ struct IntrinsicJSFragment: Sendable { } } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(arr).length);") + scope.emitPushI32Parameter("\(arr).length", printer: printer) cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") return [] } @@ -2595,7 +2616,7 @@ struct IntrinsicJSFragment: Sendable { let lenVar = scope.variable("arrayLen") let iVar = scope.variable("i") - printer.write("const \(lenVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(lenVar) = \(scope.popI32Return());") printer.write("const \(resultVar) = [];") printer.write("for (let \(iVar) = 0; \(iVar) < \(lenVar); \(iVar)++) {") printer.indent { @@ -2622,9 +2643,9 @@ struct IntrinsicJSFragment: Sendable { let payload2Var = scope.variable("jsValuePayload2") let payload1Var = scope.variable("jsValuePayload1") let kindVar = scope.variable("jsValueKind") - printer.write("const \(payload2Var) = \(JSGlueVariableScope.reservedTmpRetF64s).pop();") - printer.write("const \(payload1Var) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") - printer.write("const \(kindVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(payload2Var) = \(scope.popF64Return());") + printer.write("const \(payload1Var) = \(scope.popI32Return());") + printer.write("const \(kindVar) = \(scope.popI32Return());") let resultVar = scope.variable("jsValue") printer.write( "const \(resultVar) = \(jsValueLiftHelperName)(\(kindVar), \(payload1Var), \(payload2Var));" @@ -2637,7 +2658,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let strVar = scope.variable("string") - printer.write("const \(strVar) = \(JSGlueVariableScope.reservedTmpRetStrings).pop();") + printer.write("const \(strVar) = \(scope.popStringReturn());") return [strVar] } ) @@ -2646,7 +2667,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let bVar = scope.variable("bool") - printer.write("const \(bVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop() !== 0;") + printer.write("const \(bVar) = \(scope.popI32Return()) !== 0;") return [bVar] } ) @@ -2655,7 +2676,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let iVar = scope.variable("int") - printer.write("const \(iVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(iVar) = \(scope.popI32Return());") return [iVar] } ) @@ -2664,7 +2685,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let fVar = scope.variable("f32") - printer.write("const \(fVar) = \(JSGlueVariableScope.reservedTmpRetF32s).pop();") + printer.write("const \(fVar) = \(scope.popF32Return());") return [fVar] } ) @@ -2673,7 +2694,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let dVar = scope.variable("f64") - printer.write("const \(dVar) = \(JSGlueVariableScope.reservedTmpRetF64s).pop();") + printer.write("const \(dVar) = \(scope.popF64Return());") return [dVar] } ) @@ -2694,7 +2715,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let varName = scope.variable("caseId") - printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(varName) = \(scope.popI32Return());") return [varName] } ) @@ -2705,7 +2726,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let varName = scope.variable("rawValue") - printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetStrings).pop();") + printer.write("const \(varName) = \(scope.popStringReturn());") return [varName] } ) @@ -2714,7 +2735,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let varName = scope.variable("rawValue") - printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetF32s).pop();") + printer.write("const \(varName) = \(scope.popF32Return());") return [varName] } ) @@ -2723,7 +2744,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let varName = scope.variable("rawValue") - printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetF64s).pop();") + printer.write("const \(varName) = \(scope.popF64Return());") return [varName] } ) @@ -2732,7 +2753,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let varName = scope.variable("rawValue") - printer.write("const \(varName) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(varName) = \(scope.popI32Return());") return [varName] } ) @@ -2744,7 +2765,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let resultVar = scope.variable("enumValue") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetTag).pop(), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popTagReturn()), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) return [resultVar] } @@ -2755,7 +2776,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let ptrVar = scope.variable("ptr") let objVar = scope.variable("obj") - printer.write("const \(ptrVar) = \(JSGlueVariableScope.reservedTmpRetPointers).pop();") + printer.write("const \(ptrVar) = \(scope.popPointerReturn());") printer.write("const \(objVar) = _exports['\(className)'].__construct(\(ptrVar));") return [objVar] } @@ -2766,7 +2787,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let idVar = scope.variable("objId") let objVar = scope.variable("obj") - printer.write("const \(idVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(idVar) = \(scope.popI32Return());") printer.write("const \(objVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(idVar));") printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") return [objVar] @@ -2781,7 +2802,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let pVar = scope.variable("pointer") - printer.write("const \(pVar) = \(JSGlueVariableScope.reservedTmpRetPointers).pop();") + printer.write("const \(pVar) = \(scope.popPointerReturn());") return [pVar] } ) @@ -2801,9 +2822,9 @@ struct IntrinsicJSFragment: Sendable { let kindVar = lowered[0] let payload1Var = lowered[1] let payload2Var = lowered[2] - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(kindVar));") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(payload1Var));") - printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(payload2Var));") + scope.emitPushI32Parameter(kindVar, printer: printer) + scope.emitPushI32Parameter(payload1Var, printer: printer) + scope.emitPushF64Parameter(payload2Var, printer: printer) return [] } ) @@ -2816,8 +2837,8 @@ struct IntrinsicJSFragment: Sendable { let idVar = scope.variable("id") printer.write("const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));") printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) + scope.emitPushI32Parameter(idVar, printer: printer) cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") return [] } @@ -2826,7 +2847,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(arguments[0]) ? 1 : 0);") + scope.emitPushI32Parameter("\(arguments[0]) ? 1 : 0", printer: printer) return [] } ) @@ -2834,7 +2855,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(arguments[0]) | 0));") + scope.emitPushI32Parameter("(\(arguments[0]) | 0)", printer: printer) return [] } ) @@ -2842,7 +2863,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(Math.fround(\(arguments[0])));") + scope.emitPushF32Parameter("Math.fround(\(arguments[0]))", printer: printer) return [] } ) @@ -2850,7 +2871,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(arguments[0]));") + scope.emitPushF64Parameter("\(arguments[0])", printer: printer) return [] } ) @@ -2872,7 +2893,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(arguments[0]) | 0));") + scope.emitPushI32Parameter("(\(arguments[0]) | 0)", printer: printer) return [] } ) @@ -2891,8 +2912,8 @@ struct IntrinsicJSFragment: Sendable { printer.write( "const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) + scope.emitPushI32Parameter(idVar, printer: printer) cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") return [] } @@ -2901,7 +2922,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(Math.fround(\(arguments[0])));") + scope.emitPushF32Parameter("Math.fround(\(arguments[0]))", printer: printer) return [] } ) @@ -2909,7 +2930,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(arguments[0]));") + scope.emitPushF64Parameter("\(arguments[0])", printer: printer) return [] } ) @@ -2917,7 +2938,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(arguments[0]) | 0));") + scope.emitPushI32Parameter("(\(arguments[0]) | 0)", printer: printer) return [] } ) @@ -2933,7 +2954,7 @@ struct IntrinsicJSFragment: Sendable { printer.write( "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(caseIdVar));") + scope.emitPushI32Parameter(caseIdVar, printer: printer) cleanup.write("if (\(cleanupVar)) { \(cleanupVar)(); }") return [] } @@ -2942,7 +2963,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(\(arguments[0]).pointer);") + scope.emitPushPointerParameter("\(arguments[0]).pointer", printer: printer) return [] } ) @@ -2953,7 +2974,7 @@ struct IntrinsicJSFragment: Sendable { let value = arguments[0] let idVar = scope.variable("objId") printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + scope.emitPushI32Parameter(idVar, printer: printer) return [] } ) @@ -2972,7 +2993,7 @@ struct IntrinsicJSFragment: Sendable { let value = arguments[0] let idVar = scope.variable("objId") printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + scope.emitPushI32Parameter(idVar, printer: printer) return [] } ) @@ -2980,7 +3001,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanup in - printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push((\(arguments[0]) | 0));") + scope.emitPushPointerParameter("(\(arguments[0]) | 0)", printer: printer) return [] } ) @@ -3000,7 +3021,7 @@ struct IntrinsicJSFragment: Sendable { let isSomeVar = scope.variable("isSome") let resultVar = scope.variable("optValue") - printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(isSomeVar) = \(scope.popI32Return());") printer.write("let \(resultVar);") printer.write("if (\(isSomeVar) === 0) {") printer.indent { @@ -3054,23 +3075,23 @@ struct IntrinsicJSFragment: Sendable { // Push placeholders so Swift can unconditionally pop value slots switch wrappedType { case .float: - printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(0.0);") + scope.emitPushF32Parameter("0.0", printer: printer) case .double: - printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(0.0);") + scope.emitPushF64Parameter("0.0", printer: printer) case .swiftStruct: // No placeholder — Swift only pops struct fields when isSome=1 break case .string, .rawValueEnum(_, .string): - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + scope.emitPushI32Parameter("0", printer: printer) + scope.emitPushI32Parameter("0", printer: printer) case .swiftHeapObject: - printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(0);") + scope.emitPushPointerParameter("0", printer: printer) default: - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + scope.emitPushI32Parameter("0", printer: printer) } } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar));") + scope.emitPushI32Parameter(isSomeVar, printer: printer) return [] } @@ -3271,9 +3292,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(idVar) = undefined;") } printer.write("}") - printer.write( - "\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar) !== undefined ? \(idVar) : 0);" - ) + scope.emitPushI32Parameter("\(idVar) !== undefined ? \(idVar) : 0", printer: printer) cleanup.write("if(\(idVar) !== undefined && \(idVar) !== 0) {") cleanup.indent { cleanup.write("try {") @@ -3298,14 +3317,14 @@ struct IntrinsicJSFragment: Sendable { if case .caseEnum = wrappedType { printer.write("if (\(isSomeVar)) {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(value) | 0));") + scope.emitPushI32Parameter("\(value) | 0", printer: printer) } printer.write("} else {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + scope.emitPushI32Parameter("0", printer: printer) } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) return [] } else if case .rawValueEnum(_, let rawType) = wrappedType { switch rawType { @@ -3321,16 +3340,16 @@ struct IntrinsicJSFragment: Sendable { printer.write( "\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" ) - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) + scope.emitPushI32Parameter(idVar, printer: printer) } printer.write("} else {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + scope.emitPushI32Parameter("0", printer: printer) + scope.emitPushI32Parameter("0", printer: printer) } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) cleanup.write( "if(\(idVar) !== undefined) { \(JSGlueVariableScope.reservedSwift).memory.release(\(idVar)); }" ) @@ -3338,40 +3357,38 @@ struct IntrinsicJSFragment: Sendable { case .float: printer.write("if (\(isSomeVar)) {") printer.indent { - printer.write( - "\(JSGlueVariableScope.reservedTmpParamF32s).push(Math.fround(\(value)));" - ) + scope.emitPushF32Parameter("Math.fround(\(value))", printer: printer) } printer.write("} else {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(0.0);") + scope.emitPushF32Parameter("0.0", printer: printer) } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) return [] case .double: printer.write("if (\(isSomeVar)) {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(value));") + scope.emitPushF64Parameter("\(value)", printer: printer) } printer.write("} else {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(0.0);") + scope.emitPushF64Parameter("0.0", printer: printer) } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) return [] default: printer.write("if (\(isSomeVar)) {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push((\(value) | 0));") + scope.emitPushI32Parameter("\(value) | 0", printer: printer) } printer.write("} else {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + scope.emitPushI32Parameter("0", printer: printer) } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) return [] } } else if case .swiftHeapObject = wrappedType { @@ -3380,14 +3397,14 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") printer.indent { printer.write("\(ptrVar) = \(value).pointer;") - printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(\(ptrVar));") + scope.emitPushPointerParameter("\(ptrVar)", printer: printer) } printer.write("} else {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(0);") + scope.emitPushPointerParameter("0", printer: printer) } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) return [] } else if case .swiftStruct(let structName) = wrappedType { let nestedCleanupVar = scope.variable("nestedCleanup") @@ -3401,7 +3418,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(nestedCleanupVar) = \(structResultVar).cleanup;") } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) cleanup.write("if (\(nestedCleanupVar)) { \(nestedCleanupVar)(); }") return [] } else if case .string = wrappedType { @@ -3414,16 +3431,16 @@ struct IntrinsicJSFragment: Sendable { "const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" ) printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(bytesVar).length);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) + scope.emitPushI32Parameter(idVar, printer: printer) } printer.write("} else {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + scope.emitPushI32Parameter("0", printer: printer) + scope.emitPushI32Parameter("0", printer: printer) } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) cleanup.write( "if(\(idVar) !== undefined) { \(JSGlueVariableScope.reservedSwift).memory.release(\(idVar)); }" ) @@ -3434,15 +3451,15 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") printer.indent { printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(idVar));") + scope.emitPushI32Parameter(idVar, printer: printer) } printer.write("} else {") printer.indent { printer.write("\(idVar) = undefined;") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + scope.emitPushI32Parameter("0", printer: printer) } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) cleanup.write("if(\(idVar) !== undefined && \(idVar) !== 0) {") cleanup.indent { cleanup.write("try {") @@ -3463,7 +3480,8 @@ struct IntrinsicJSFragment: Sendable { stack: .tmpParamInts, convert: "| 0", zeroValue: "0", - printer: printer + printer: printer, + scope: scope ) case .bool: pushOptionalPrimitive( @@ -3472,7 +3490,8 @@ struct IntrinsicJSFragment: Sendable { stack: .tmpParamInts, convert: "? 1 : 0", zeroValue: "0", - printer: printer + printer: printer, + scope: scope ) case .float: pushOptionalPrimitive( @@ -3481,7 +3500,8 @@ struct IntrinsicJSFragment: Sendable { stack: .tmpParamF32s, convert: "Math.fround", zeroValue: "0.0", - printer: printer + printer: printer, + scope: scope ) case .double: pushOptionalPrimitive( @@ -3490,7 +3510,8 @@ struct IntrinsicJSFragment: Sendable { stack: .tmpParamF64s, convert: nil, zeroValue: "0.0", - printer: printer + printer: printer, + scope: scope ) case .associatedValueEnum(let enumName): let base = enumName.components(separatedBy: ".").last ?? enumName @@ -3505,14 +3526,14 @@ struct IntrinsicJSFragment: Sendable { ) printer.write("\(caseIdVar) = \(enumResultVar).caseId;") printer.write("\(enumCleanupVar) = \(enumResultVar).cleanup;") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(caseIdVar));") + scope.emitPushI32Parameter(caseIdVar, printer: printer) } printer.write("} else {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(0);") + scope.emitPushI32Parameter("0", printer: printer) } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) cleanup.write("if (\(enumCleanupVar)) { \(enumCleanupVar)(); }") default: let wrappedFragment = structFieldLowerFragment( @@ -3556,7 +3577,7 @@ struct IntrinsicJSFragment: Sendable { } } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) } return [] } @@ -3596,7 +3617,8 @@ struct IntrinsicJSFragment: Sendable { stack: StackType, convert: String?, zeroValue: String, - printer: CodeFragmentPrinter + printer: CodeFragmentPrinter, + scope: JSGlueVariableScope ) { let stackName: String switch stack { @@ -3624,7 +3646,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(stackName).push(\(zeroValue));") } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) } private enum StackType { @@ -3646,7 +3668,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let isSomeVar = scope.variable("isSome") let optVar = scope.variable("optional") - printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(isSomeVar) = \(scope.popI32Return());") printer.write("let \(optVar);") printer.write("if (\(isSomeVar)) {") printer.indent { @@ -3654,7 +3676,7 @@ struct IntrinsicJSFragment: Sendable { if case .associatedValueEnum(let enumName) = wrappedType { let base = enumName.components(separatedBy: ".").last ?? enumName let caseIdVar = scope.variable("enumCaseId") - printer.write("const \(caseIdVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(caseIdVar) = \(scope.popI32Return());") printer.write( "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" ) @@ -3701,7 +3723,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let objectIdVar = scope.variable("objectId") let varName = scope.variable("value") - printer.write("const \(objectIdVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(objectIdVar) = \(scope.popI32Return());") printer.write("let \(varName);") printer.write("if (\(objectIdVar) !== 0) {") printer.indent { From 63b7b7220272279db6682a9d13dd7ea1c8195837 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 5 Feb 2026 18:53:36 +0900 Subject: [PATCH 161/252] [NFC] BridgeJS: Remove explicit stack storage captures from enum/struct helpers (#588) --- .../Sources/BridgeJSLink/JSGlueGen.swift | 36 ++++++------ .../BridgeJSLinkTests/ArrayTypes.js | 10 ++-- .../BridgeJSLinkTests/DefaultParameters.js | 10 ++-- .../BridgeJSLinkTests/EnumAssociatedValue.js | 58 +++++++++---------- .../ImportedTypeInExportedInterface.js | 4 +- .../BridgeJSLinkTests/Protocol.js | 8 +-- .../StaticFunctions.Global.js | 4 +- .../BridgeJSLinkTests/StaticFunctions.js | 4 +- .../BridgeJSLinkTests/SwiftClosure.js | 6 +- .../BridgeJSLinkTests/SwiftStruct.js | 22 +++---- .../BridgeJSLinkTests/SwiftStructImports.js | 2 +- .../BridgeJSLinkTests/UnsafePointer.js | 6 +- 12 files changed, 85 insertions(+), 85 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 772c8c84c..ae83f33e6 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -618,7 +618,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { _, scope, printer, _ in let retName = scope.variable("ret") printer.write( - "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lift(\(scope.popTagReturn()), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lift(\(scope.popTagReturn()));" ) return [retName] } @@ -699,7 +699,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSome)) {") printer.indent { printer.write( - "\(enumVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(wrappedValue), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "\(enumVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(wrappedValue));" ) } printer.write("}") @@ -711,7 +711,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSome)) {") printer.indent { printer.write( - "\(structVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "\(structVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lift();" ) } printer.write("} else {") @@ -944,7 +944,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("} else {") printer.indent { printer.write( - "\(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(tagVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "\(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(tagVar));" ) } printer.write("}") @@ -956,7 +956,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") printer.indent { printer.write( - "\(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "\(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lift();" ) } printer.write("} else {") @@ -1283,7 +1283,7 @@ struct IntrinsicJSFragment: Sendable { let targetVar = arguments[1] let base = fullName.components(separatedBy: ".").last ?? fullName printer.write( - "let \(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "let \(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseId));" ) return [] } @@ -1354,7 +1354,7 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName printer.write( - "\(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(value), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "\(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(value));" ) default: fatalError("Unsupported optional wrapped type in closure parameter lifting: \(wrappedType)") @@ -1682,7 +1682,7 @@ struct IntrinsicJSFragment: Sendable { let base = fullName.components(separatedBy: ".").last ?? fullName let resultVar = scope.variable("result") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popTagReturn()), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popTagReturn()));" ) printer.write("return \(resultVar);") return [] @@ -1907,7 +1907,7 @@ struct IntrinsicJSFragment: Sendable { let caseId = arguments[0] let resultVar = scope.variable("enumValue") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseId), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseId));" ) return [resultVar] } @@ -1924,7 +1924,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanupCode in let resultVar = scope.variable("structValue") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lift();" ) return [resultVar] } @@ -2107,7 +2107,7 @@ struct IntrinsicJSFragment: Sendable { // Generate lift function printer.write( - "lift: (tag, \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers)) => {" + "lift: (tag) => {" ) printer.indent { printer.write("tag = tag | 0;") @@ -2505,7 +2505,7 @@ struct IntrinsicJSFragment: Sendable { let caseIdVar = scope.variable("caseId") printer.write("const \(caseIdVar) = \(scope.popI32Return());") printer.write( - "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar));" ) } else { let wrappedFragment = associatedValuePopPayload(type: wrappedType) @@ -2565,7 +2565,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanupCode in let resultVar = scope.variable("structValue") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lift();" ) return [resultVar] } @@ -2705,7 +2705,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let resultVar = scope.variable("struct") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lift();" ) return [resultVar] } @@ -2765,7 +2765,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let resultVar = scope.variable("enumValue") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popTagReturn()), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popTagReturn()), );" ) return [resultVar] } @@ -3125,7 +3125,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("},") printer.write( - "lift: (\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers)) => {" + "lift: () => {" ) printer.indent { generateStructLiftCode( @@ -3678,7 +3678,7 @@ struct IntrinsicJSFragment: Sendable { let caseIdVar = scope.variable("enumCaseId") printer.write("const \(caseIdVar) = \(scope.popI32Return());") printer.write( - "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar), \(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar), );" ) } else { let wrappedFragment = structFieldLiftFragment( @@ -3712,7 +3712,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let structVar = scope.variable("struct") printer.write( - "const \(structVar) = \(JSGlueVariableScope.reservedStructHelpers).\(nestedName).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const \(structVar) = \(JSGlueVariableScope.reservedStructHelpers).\(nestedName).lift();" ) return [structVar] } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 6cca17cf6..42176ae1f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -54,7 +54,7 @@ export async function createInstantiator(options, swift) { tmpParamF64s.push(value.y); return { cleanup: undefined }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { const f64 = tmpRetF64s.pop(); const f641 = tmpRetF64s.pop(); return { x: f641, y: f64 }; @@ -481,7 +481,7 @@ export async function createInstantiator(options, swift) { const arrayLen = tmpRetInts.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const struct = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const struct = structHelpers.Point.lift(); arrayResult.push(struct); } arrayResult.reverse(); @@ -544,7 +544,7 @@ export async function createInstantiator(options, swift) { const matchingBytes = textEncoder.encode(matching); const matchingId = swift.memory.retain(matchingBytes); instance.exports.bjs_findFirstPoint(matchingId, matchingBytes.length); - const structValue = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const structValue = structHelpers.Point.lift(); for (const cleanup of arrayCleanups) { cleanup(); } swift.memory.release(matchingId); return structValue; @@ -715,7 +715,7 @@ export async function createInstantiator(options, swift) { if (isSome1 === 0) { optValue = null; } else { - const struct = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const struct = structHelpers.Point.lift(); optValue = struct; } arrayResult.push(optValue); @@ -873,7 +873,7 @@ export async function createInstantiator(options, swift) { const arrayLen1 = tmpRetInts.pop(); const arrayResult1 = []; for (let i1 = 0; i1 < arrayLen1; i1++) { - const struct = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const struct = structHelpers.Point.lift(); arrayResult1.push(struct); } arrayResult1.reverse(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 754c47b0a..4317cc124 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -54,7 +54,7 @@ export async function createInstantiator(options, swift) { }; return { cleanup }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { const bool = tmpRetInts.pop() !== 0; const int = tmpRetInts.pop(); const string = tmpRetStrings.pop(); @@ -68,7 +68,7 @@ export async function createInstantiator(options, swift) { tmpParamF64s.push(value.baseValue); return { cleanup: undefined }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { const f64 = tmpRetF64s.pop(); const instance1 = { baseValue: f64 }; instance1.add = function(a, b = 10.0) { @@ -528,7 +528,7 @@ export async function createInstantiator(options, swift) { const isSome1 = tmpRetInts.pop(); let optResult; if (isSome1) { - optResult = structHelpers.Config.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optResult = structHelpers.Config.lift(); } else { optResult = null; } @@ -546,7 +546,7 @@ export async function createInstantiator(options, swift) { const isSome1 = tmpRetInts.pop(); let optResult; if (isSome1) { - optResult = structHelpers.Config.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optResult = structHelpers.Config.lift(); } else { optResult = null; } @@ -663,7 +663,7 @@ export async function createInstantiator(options, swift) { MathOperations: { init: function(baseValue = 0.0) { instance.exports.bjs_MathOperations_init(baseValue); - const structValue = structHelpers.MathOperations.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const structValue = structHelpers.MathOperations.lift(); return structValue; }, subtract: function(a, b) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 123ba56fa..b25276d9f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -122,7 +122,7 @@ export async function createInstantiator(options, swift) { tmpParamF64s.push(value.y); return { cleanup: undefined }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { const f64 = tmpRetF64s.pop(); const f641 = tmpRetF64s.pop(); return { x: f641, y: f64 }; @@ -171,7 +171,7 @@ export async function createInstantiator(options, swift) { default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } }, - lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tag) => { tag = tag | 0; switch (tag) { case APIResultValues.Tag.Success: { @@ -278,7 +278,7 @@ export async function createInstantiator(options, swift) { default: throw new Error("Unknown ComplexResultValues tag: " + String(enumTag)); } }, - lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tag) => { tag = tag | 0; switch (tag) { case ComplexResultValues.Tag.Success: { @@ -361,7 +361,7 @@ export async function createInstantiator(options, swift) { default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); } }, - lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tag) => { tag = tag | 0; switch (tag) { case ResultValues.Tag.Success: { @@ -413,7 +413,7 @@ export async function createInstantiator(options, swift) { default: throw new Error("Unknown NetworkingResultValues tag: " + String(enumTag)); } }, - lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tag) => { tag = tag | 0; switch (tag) { case NetworkingResultValues.Tag.Success: { @@ -494,7 +494,7 @@ export async function createInstantiator(options, swift) { default: throw new Error("Unknown APIOptionalResultValues tag: " + String(enumTag)); } }, - lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tag) => { tag = tag | 0; switch (tag) { case APIOptionalResultValues.Tag.Success: { @@ -595,7 +595,7 @@ export async function createInstantiator(options, swift) { default: throw new Error("Unknown TypedPayloadResultValues tag: " + String(enumTag)); } }, - lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tag) => { tag = tag | 0; switch (tag) { case TypedPayloadResultValues.Tag.Precision: { @@ -683,11 +683,11 @@ export async function createInstantiator(options, swift) { default: throw new Error("Unknown AllTypesResultValues tag: " + String(enumTag)); } }, - lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tag) => { tag = tag | 0; switch (tag) { case AllTypesResultValues.Tag.StructPayload: { - const struct = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const struct = structHelpers.Point.lift(); return { tag: AllTypesResultValues.Tag.StructPayload, param0: struct }; } case AllTypesResultValues.Tag.ClassPayload: { @@ -702,7 +702,7 @@ export async function createInstantiator(options, swift) { return { tag: AllTypesResultValues.Tag.JsObjectPayload, param0: obj }; } case AllTypesResultValues.Tag.NestedEnum: { - const enumValue = enumHelpers.APIResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const enumValue = enumHelpers.APIResult.lift(tmpRetTag.pop(), ); return { tag: AllTypesResultValues.Tag.NestedEnum, param0: enumValue }; } case AllTypesResultValues.Tag.ArrayPayload: { @@ -807,14 +807,14 @@ export async function createInstantiator(options, swift) { default: throw new Error("Unknown OptionalAllTypesResultValues tag: " + String(enumTag)); } }, - lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tag) => { tag = tag | 0; switch (tag) { case OptionalAllTypesResultValues.Tag.OptStruct: { const isSome = tmpRetInts.pop(); let optional; if (isSome) { - const struct = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const struct = structHelpers.Point.lift(); optional = struct; } else { optional = null; @@ -851,7 +851,7 @@ export async function createInstantiator(options, swift) { let optional; if (isSome) { const caseId = tmpRetInts.pop(); - optional = enumHelpers.APIResult.lift(caseId, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optional = enumHelpers.APIResult.lift(caseId); } else { optional = null; } @@ -1139,13 +1139,13 @@ export async function createInstantiator(options, swift) { }, getResult: function bjs_getResult() { instance.exports.bjs_getResult(); - const ret = enumHelpers.APIResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const ret = enumHelpers.APIResult.lift(tmpRetTag.pop()); return ret; }, roundtripAPIResult: function bjs_roundtripAPIResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.APIResult.lower(result); instance.exports.bjs_roundtripAPIResult(resultCaseId); - const ret = enumHelpers.APIResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const ret = enumHelpers.APIResult.lift(tmpRetTag.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1164,7 +1164,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.APIResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optResult = enumHelpers.APIResult.lift(tag); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -1176,13 +1176,13 @@ export async function createInstantiator(options, swift) { }, getComplexResult: function bjs_getComplexResult() { instance.exports.bjs_getComplexResult(); - const ret = enumHelpers.ComplexResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const ret = enumHelpers.ComplexResult.lift(tmpRetTag.pop()); return ret; }, roundtripComplexResult: function bjs_roundtripComplexResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.ComplexResult.lower(result); instance.exports.bjs_roundtripComplexResult(resultCaseId); - const ret = enumHelpers.ComplexResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const ret = enumHelpers.ComplexResult.lift(tmpRetTag.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1201,7 +1201,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.ComplexResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optResult = enumHelpers.ComplexResult.lift(tag); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -1221,7 +1221,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.Result.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optResult = enumHelpers.Result.lift(tag); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -1241,7 +1241,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.NetworkingResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optResult = enumHelpers.NetworkingResult.lift(tag); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -1261,7 +1261,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.APIOptionalResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optResult = enumHelpers.APIOptionalResult.lift(tag); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -1288,7 +1288,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.APIOptionalResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optResult = enumHelpers.APIOptionalResult.lift(tag); } if (result1Cleanup) { result1Cleanup(); } if (result2Cleanup) { result2Cleanup(); } @@ -1297,7 +1297,7 @@ export async function createInstantiator(options, swift) { roundTripTypedPayloadResult: function bjs_roundTripTypedPayloadResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.TypedPayloadResult.lower(result); instance.exports.bjs_roundTripTypedPayloadResult(resultCaseId); - const ret = enumHelpers.TypedPayloadResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const ret = enumHelpers.TypedPayloadResult.lift(tmpRetTag.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1316,7 +1316,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.TypedPayloadResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optResult = enumHelpers.TypedPayloadResult.lift(tag); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -1324,7 +1324,7 @@ export async function createInstantiator(options, swift) { roundTripAllTypesResult: function bjs_roundTripAllTypesResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.AllTypesResult.lower(result); instance.exports.bjs_roundTripAllTypesResult(resultCaseId); - const ret = enumHelpers.AllTypesResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const ret = enumHelpers.AllTypesResult.lift(tmpRetTag.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1343,7 +1343,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.AllTypesResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optResult = enumHelpers.AllTypesResult.lift(tag); } if (resultCleanup) { resultCleanup(); } return optResult; @@ -1351,7 +1351,7 @@ export async function createInstantiator(options, swift) { roundTripOptionalPayloadResult: function bjs_roundTripOptionalPayloadResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.OptionalAllTypesResult.lower(result); instance.exports.bjs_roundTripOptionalPayloadResult(resultCaseId); - const ret = enumHelpers.OptionalAllTypesResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const ret = enumHelpers.OptionalAllTypesResult.lift(tmpRetTag.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1370,7 +1370,7 @@ export async function createInstantiator(options, swift) { if (isNull) { optResult = null; } else { - optResult = enumHelpers.OptionalAllTypesResult.lift(tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + optResult = enumHelpers.OptionalAllTypesResult.lift(tag); } if (resultCleanup) { resultCleanup(); } return optResult; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index efcbbe2d6..23db5be56 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -70,7 +70,7 @@ export async function createInstantiator(options, swift) { }; return { cleanup }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { const isSome = tmpRetInts.pop(); let optional; if (isSome) { @@ -370,7 +370,7 @@ export async function createInstantiator(options, swift) { roundtripFooContainer: function bjs_roundtripFooContainer(container) { const { cleanup: cleanup } = structHelpers.FooContainer.lower(container); instance.exports.bjs_roundtripFooContainer(); - const structValue = structHelpers.FooContainer.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const structValue = structHelpers.FooContainer.lift(); if (cleanup) { cleanup(); } return structValue; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 7c20130b3..965df2b37 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -81,7 +81,7 @@ export async function createInstantiator(options, swift) { default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); } }, - lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tag) => { tag = tag | 0; switch (tag) { case ResultValues.Tag.Success: { @@ -375,7 +375,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_result_set"] = function bjs_MyViewControllerDelegate_result_set(self, value) { try { - const enumValue = enumHelpers.Result.lift(value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const enumValue = enumHelpers.Result.lift(value); swift.memory.getObject(self).result = enumValue; } catch (error) { setException(error); @@ -399,7 +399,7 @@ export async function createInstantiator(options, swift) { try { let enumValue; if (valueIsSome) { - enumValue = enumHelpers.Result.lift(valueWrappedValue, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + enumValue = enumHelpers.Result.lift(valueWrappedValue); } swift.memory.getObject(self).optionalResult = valueIsSome ? enumValue : null; } catch (error) { @@ -556,7 +556,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_handleResult"] = function bjs_MyViewControllerDelegate_handleResult(self, result) { try { - const enumValue = enumHelpers.Result.lift(result, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const enumValue = enumHelpers.Result.lift(result); swift.memory.getObject(self).handleResult(enumValue); } catch (error) { setException(error); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 391c7167e..451c356a5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -68,7 +68,7 @@ export async function createInstantiator(options, swift) { default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } }, - lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tag) => { tag = tag | 0; switch (tag) { case APIResultValues.Tag.Success: { @@ -335,7 +335,7 @@ export async function createInstantiator(options, swift) { roundtrip: function(value) { const { caseId: valueCaseId, cleanup: valueCleanup } = enumHelpers.APIResult.lower(value); instance.exports.bjs_APIResult_static_roundtrip(valueCaseId); - const ret = enumHelpers.APIResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const ret = enumHelpers.APIResult.lift(tmpRetTag.pop()); if (valueCleanup) { valueCleanup(); } return ret; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index b38668c57..00135e97d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -68,7 +68,7 @@ export async function createInstantiator(options, swift) { default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } }, - lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tag) => { tag = tag | 0; switch (tag) { case APIResultValues.Tag.Success: { @@ -329,7 +329,7 @@ export async function createInstantiator(options, swift) { roundtrip: function(value) { const { caseId: valueCaseId, cleanup: valueCleanup } = enumHelpers.APIResult.lower(value); instance.exports.bjs_APIResult_static_roundtrip(valueCaseId); - const ret = enumHelpers.APIResult.lift(tmpRetTag.pop(), tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const ret = enumHelpers.APIResult.lift(tmpRetTag.pop()); if (valueCleanup) { valueCleanup(); } return ret; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index ff5af72f9..9f2c16b2d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -106,7 +106,7 @@ export async function createInstantiator(options, swift) { default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } }, - lift: (tag, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: (tag) => { tag = tag | 0; switch (tag) { case APIResultValues.Tag.Success: { @@ -422,7 +422,7 @@ export async function createInstantiator(options, swift) { bjs["invoke_js_callback_TestModule_10TestModule9APIResultO_SS"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - let param0 = enumHelpers.APIResult.lift(param0Id, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + let param0 = enumHelpers.APIResult.lift(param0Id); const result = callback(param0); if (typeof result !== "string") { throw new TypeError("Callback must return a string"); @@ -684,7 +684,7 @@ export async function createInstantiator(options, swift) { const callback = swift.memory.getObject(callbackId); let param0; if (param0IsSome) { - param0 = enumHelpers.APIResult.lift(param0Value, tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + param0 = enumHelpers.APIResult.lift(param0Value); } else { param0 = null; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index adbe18856..1198f1539 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -67,7 +67,7 @@ export async function createInstantiator(options, swift) { }; return { cleanup }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { const isSome = tmpRetInts.pop(); let optional; if (isSome) { @@ -115,7 +115,7 @@ export async function createInstantiator(options, swift) { }; return { cleanup }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { const isSome = tmpRetInts.pop(); let optional; if (isSome) { @@ -158,7 +158,7 @@ export async function createInstantiator(options, swift) { }; return { cleanup }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { const isSome = tmpRetInts.pop(); let optional; if (isSome) { @@ -167,7 +167,7 @@ export async function createInstantiator(options, swift) { } else { optional = null; } - const struct = structHelpers.Address.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const struct = structHelpers.Address.lift(); const int = tmpRetInts.pop(); const string1 = tmpRetStrings.pop(); return { name: string1, age: int, address: struct, email: optional }; @@ -181,7 +181,7 @@ export async function createInstantiator(options, swift) { tmpParamPointers.push(value.owner.pointer); return { cleanup: undefined }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { const ptr = tmpRetPointers.pop(); const obj = _exports['Greeter'].__construct(ptr); const int = tmpRetInts.pop(); @@ -203,7 +203,7 @@ export async function createInstantiator(options, swift) { tmpParamInts.push(isSome ? 1 : 0); return { cleanup: undefined }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { const isSome = tmpRetInts.pop(); let optional; if (isSome) { @@ -223,7 +223,7 @@ export async function createInstantiator(options, swift) { lower: (value) => { return { cleanup: undefined }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { return { }; } }); @@ -264,7 +264,7 @@ export async function createInstantiator(options, swift) { }; return { cleanup }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { const isSome = tmpRetInts.pop(); let optional; if (isSome) { @@ -632,14 +632,14 @@ export async function createInstantiator(options, swift) { roundtrip: function bjs_roundtrip(session) { const { cleanup: cleanup } = structHelpers.Person.lower(session); instance.exports.bjs_roundtrip(); - const structValue = structHelpers.Person.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const structValue = structHelpers.Person.lift(); if (cleanup) { cleanup(); } return structValue; }, roundtripContainer: function bjs_roundtripContainer(container) { const { cleanup: cleanup } = structHelpers.Container.lower(container); instance.exports.bjs_roundtripContainer(); - const structValue = structHelpers.Container.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const structValue = structHelpers.Container.lift(); if (cleanup) { cleanup(); } return structValue; }, @@ -651,7 +651,7 @@ export async function createInstantiator(options, swift) { const isSome = optCount != null; const isSome1 = optFlag != null; instance.exports.bjs_DataPoint_init(x, y, labelId, labelBytes.length, +isSome, isSome ? optCount : 0, +isSome1, isSome1 ? optFlag : 0); - const structValue = structHelpers.DataPoint.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const structValue = structHelpers.DataPoint.lift(); swift.memory.release(labelId); return structValue; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index 8f90491df..393cd6847 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -41,7 +41,7 @@ export async function createInstantiator(options, swift) { tmpParamInts.push((value.y | 0)); return { cleanup: undefined }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { const int = tmpRetInts.pop(); const int1 = tmpRetInts.pop(); return { x: int1, y: int }; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index bbeeffa0d..a2240a9e6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -44,7 +44,7 @@ export async function createInstantiator(options, swift) { tmpParamPointers.push((value.mutPtr | 0)); return { cleanup: undefined }; }, - lift: (tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers) => { + lift: () => { const pointer = tmpRetPointers.pop(); const pointer1 = tmpRetPointers.pop(); const pointer2 = tmpRetPointers.pop(); @@ -286,14 +286,14 @@ export async function createInstantiator(options, swift) { roundTripPointerFields: function bjs_roundTripPointerFields(value) { const { cleanup: cleanup } = structHelpers.PointerFields.lower(value); instance.exports.bjs_roundTripPointerFields(); - const structValue = structHelpers.PointerFields.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const structValue = structHelpers.PointerFields.lift(); if (cleanup) { cleanup(); } return structValue; }, PointerFields: { init: function(raw, mutRaw, opaque, ptr, mutPtr) { instance.exports.bjs_PointerFields_init(raw, mutRaw, opaque, ptr, mutPtr); - const structValue = structHelpers.PointerFields.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const structValue = structHelpers.PointerFields.lift(); return structValue; }, }, From 20457f42ab5845b81877aa3017eea70bf0a271c2 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 5 Feb 2026 19:28:49 +0900 Subject: [PATCH 162/252] [NFC] BridgeJS: Remove remaining explicit captures from enum/struct helpers --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 6 +-- .../Sources/BridgeJSLink/JSGlueGen.swift | 4 +- .../BridgeJSLinkTests/ArrayTypes.js | 6 +-- .../BridgeJSLinkTests/DefaultParameters.js | 12 +++--- .../BridgeJSLinkTests/EnumAssociatedValue.js | 38 ++++++++--------- .../ImportedTypeInExportedInterface.js | 6 +-- .../BridgeJSLinkTests/Protocol.js | 4 +- .../StaticFunctions.Global.js | 4 +- .../BridgeJSLinkTests/StaticFunctions.js | 4 +- .../BridgeJSLinkTests/SwiftClosure.js | 4 +- .../BridgeJSLinkTests/SwiftStruct.js | 42 +++++++++---------- .../BridgeJSLinkTests/SwiftStructImports.js | 6 +-- .../BridgeJSLinkTests/UnsafePointer.js | 6 +-- 13 files changed, 71 insertions(+), 71 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index c2b0c6ed3..af6961711 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -478,7 +478,7 @@ public struct BridgeJSLink { printer.write("bjs[\"swift_js_struct_lift_\(structDef.name)\"] = function() {") printer.indent { printer.write( - "const value = \(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));" + "const value = \(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).lift();" ) printer.write("return \(JSGlueVariableScope.reservedSwift).memory.retain(value);") } @@ -1162,7 +1162,7 @@ public struct BridgeJSLink { for skeleton in skeletons.compactMap(\.exported) { for enumDef in skeleton.enums where enumDef.enumType == .associatedValue { printer.write( - "const \(enumDef.name)Helpers = __bjs_create\(enumDef.valuesName)Helpers()(\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTmpParamPointers), \(JSGlueVariableScope.reservedTmpRetPointers), \(JSGlueVariableScope.reservedTextEncoder), \(JSGlueVariableScope.reservedSwift), \(JSGlueVariableScope.reservedStructHelpers), \(JSGlueVariableScope.reservedEnumHelpers));" + "const \(enumDef.name)Helpers = __bjs_create\(enumDef.valuesName)Helpers()();" ) printer.write("\(JSGlueVariableScope.reservedEnumHelpers).\(enumDef.name) = \(enumDef.name)Helpers;") printer.nextLine() @@ -1178,7 +1178,7 @@ public struct BridgeJSLink { for skeleton in skeletons.compactMap(\.exported) { for structDef in skeleton.structs { printer.write( - "const \(structDef.name)Helpers = __bjs_create\(structDef.name)Helpers()(\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTmpParamPointers), \(JSGlueVariableScope.reservedTmpRetPointers), \(JSGlueVariableScope.reservedTextEncoder), \(JSGlueVariableScope.reservedSwift), \(JSGlueVariableScope.reservedEnumHelpers));" + "const \(structDef.name)Helpers = __bjs_create\(structDef.name)Helpers()();" ) printer.write( "\(JSGlueVariableScope.reservedStructHelpers).\(structDef.name) = \(structDef.name)Helpers;" diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index ae83f33e6..ff0343fd3 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -2075,7 +2075,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("const __bjs_create\(enumName)Helpers = () => {") printer.indent() printer.write( - "return (\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTmpParamPointers), \(JSGlueVariableScope.reservedTmpRetPointers), textEncoder, \(JSGlueVariableScope.reservedSwift), \(JSGlueVariableScope.reservedStructHelpers), \(JSGlueVariableScope.reservedEnumHelpers)) => ({" + "return () => ({" ) printer.indent() @@ -3109,7 +3109,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("const __bjs_create\(structName)Helpers = () => {") printer.indent() printer.write( - "return (\(JSGlueVariableScope.reservedTmpParamInts), \(JSGlueVariableScope.reservedTmpParamF32s), \(JSGlueVariableScope.reservedTmpParamF64s), \(JSGlueVariableScope.reservedTmpParamPointers), \(JSGlueVariableScope.reservedTmpRetPointers), textEncoder, \(JSGlueVariableScope.reservedSwift), \(JSGlueVariableScope.reservedEnumHelpers)) => ({" + "return () => ({" ) printer.indent() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 42176ae1f..7093fe417 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -48,7 +48,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; const __bjs_createPointHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { tmpParamF64s.push(value.x); tmpParamF64s.push(value.y); @@ -147,7 +147,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_Point"] = function() { - const value = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.Point.lift(); return swift.memory.retain(value); } bjs["swift_js_return_optional_bool"] = function(isSome, value) { @@ -389,7 +389,7 @@ export async function createInstantiator(options, swift) { } } - const PointHelpers = __bjs_createPointHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const PointHelpers = __bjs_createPointHelpers()(); structHelpers.Point = PointHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 4317cc124..e19eb5fb4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -41,7 +41,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; const __bjs_createConfigHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { const bytes = textEncoder.encode(value.name); const id = swift.memory.retain(bytes); @@ -63,7 +63,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createMathOperationsHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { tmpParamF64s.push(value.baseValue); return { cleanup: undefined }; @@ -172,7 +172,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_Config"] = function() { - const value = structHelpers.Config.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.Config.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_MathOperations"] = function(objectId) { @@ -183,7 +183,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_MathOperations"] = function() { - const value = structHelpers.MathOperations.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.MathOperations.lift(); return swift.memory.retain(value); } bjs["swift_js_return_optional_bool"] = function(isSome, value) { @@ -431,10 +431,10 @@ export async function createInstantiator(options, swift) { } } } - const ConfigHelpers = __bjs_createConfigHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const ConfigHelpers = __bjs_createConfigHelpers()(); structHelpers.Config = ConfigHelpers; - const MathOperationsHelpers = __bjs_createMathOperationsHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const MathOperationsHelpers = __bjs_createMathOperationsHelpers()(); structHelpers.MathOperations = MathOperationsHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index b25276d9f..8491c08a2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -116,7 +116,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; const __bjs_createPointHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { tmpParamF64s.push(value.x); tmpParamF64s.push(value.y); @@ -130,7 +130,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createAPIResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + return () => ({ lower: (value) => { const enumTag = value.tag; switch (enumTag) { @@ -201,7 +201,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createComplexResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + return () => ({ lower: (value) => { const enumTag = value.tag; switch (enumTag) { @@ -321,7 +321,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + return () => ({ lower: (value) => { const enumTag = value.tag; switch (enumTag) { @@ -385,7 +385,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createNetworkingResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + return () => ({ lower: (value) => { const enumTag = value.tag; switch (enumTag) { @@ -431,7 +431,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createAPIOptionalResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + return () => ({ lower: (value) => { const enumTag = value.tag; switch (enumTag) { @@ -560,7 +560,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createTypedPayloadResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + return () => ({ lower: (value) => { const enumTag = value.tag; switch (enumTag) { @@ -635,7 +635,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createAllTypesResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + return () => ({ lower: (value) => { const enumTag = value.tag; switch (enumTag) { @@ -722,7 +722,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createOptionalAllTypesResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + return () => ({ lower: (value) => { const enumTag = value.tag; switch (enumTag) { @@ -965,7 +965,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_Point"] = function() { - const value = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.Point.lift(); return swift.memory.retain(value); } bjs["swift_js_return_optional_bool"] = function(isSome, value) { @@ -1103,31 +1103,31 @@ export async function createInstantiator(options, swift) { } } - const PointHelpers = __bjs_createPointHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const PointHelpers = __bjs_createPointHelpers()(); structHelpers.Point = PointHelpers; - const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(); enumHelpers.APIResult = APIResultHelpers; - const ComplexResultHelpers = __bjs_createComplexResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + const ComplexResultHelpers = __bjs_createComplexResultValuesHelpers()(); enumHelpers.ComplexResult = ComplexResultHelpers; - const ResultHelpers = __bjs_createResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + const ResultHelpers = __bjs_createResultValuesHelpers()(); enumHelpers.Result = ResultHelpers; - const NetworkingResultHelpers = __bjs_createNetworkingResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + const NetworkingResultHelpers = __bjs_createNetworkingResultValuesHelpers()(); enumHelpers.NetworkingResult = NetworkingResultHelpers; - const APIOptionalResultHelpers = __bjs_createAPIOptionalResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + const APIOptionalResultHelpers = __bjs_createAPIOptionalResultValuesHelpers()(); enumHelpers.APIOptionalResult = APIOptionalResultHelpers; - const TypedPayloadResultHelpers = __bjs_createTypedPayloadResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + const TypedPayloadResultHelpers = __bjs_createTypedPayloadResultValuesHelpers()(); enumHelpers.TypedPayloadResult = TypedPayloadResultHelpers; - const AllTypesResultHelpers = __bjs_createAllTypesResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + const AllTypesResultHelpers = __bjs_createAllTypesResultValuesHelpers()(); enumHelpers.AllTypesResult = AllTypesResultHelpers; - const OptionalAllTypesResultHelpers = __bjs_createOptionalAllTypesResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + const OptionalAllTypesResultHelpers = __bjs_createOptionalAllTypesResultValuesHelpers()(); enumHelpers.OptionalAllTypesResult = OptionalAllTypesResultHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index 23db5be56..1e4e1f508 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -35,7 +35,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; const __bjs_createFooContainerHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { let id; if (value.foo != null) { @@ -184,7 +184,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_FooContainer"] = function() { - const value = structHelpers.FooContainer.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.FooContainer.lift(); return swift.memory.retain(value); } bjs["swift_js_return_optional_bool"] = function(isSome, value) { @@ -298,7 +298,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const FooContainerHelpers = __bjs_createFooContainerHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const FooContainerHelpers = __bjs_createFooContainerHelpers()(); structHelpers.FooContainer = FooContainerHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 965df2b37..0ed0be7b6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -59,7 +59,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; const __bjs_createResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + return () => ({ lower: (value) => { const enumTag = value.tag; switch (enumTag) { @@ -723,7 +723,7 @@ export async function createInstantiator(options, swift) { for (const cleanup of arrayCleanups) { cleanup(); } } } - const ResultHelpers = __bjs_createResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + const ResultHelpers = __bjs_createResultValuesHelpers()(); enumHelpers.Result = ResultHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 451c356a5..7579c72f7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -46,7 +46,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; const __bjs_createAPIResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + return () => ({ lower: (value) => { const enumTag = value.tag; switch (enumTag) { @@ -312,7 +312,7 @@ export async function createInstantiator(options, swift) { return ret; } } - const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(); enumHelpers.APIResult = APIResultHelpers; if (typeof globalThis.Utils === 'undefined') { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index 00135e97d..bb3920888 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -46,7 +46,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; const __bjs_createAPIResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + return () => ({ lower: (value) => { const enumTag = value.tag; switch (enumTag) { @@ -312,7 +312,7 @@ export async function createInstantiator(options, swift) { return ret; } } - const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(); enumHelpers.APIResult = APIResultHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 9f2c16b2d..36b712362 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -65,7 +65,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; const __bjs_createAPIResultValuesHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers) => ({ + return () => ({ lower: (value) => { const enumTag = value.tag; switch (enumTag) { @@ -926,7 +926,7 @@ export async function createInstantiator(options, swift) { return bjs["lower_closure_TestModule_10TestModuleSq9DirectionO_SS"](ret); } } - const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, structHelpers, enumHelpers); + const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(); enumHelpers.APIResult = APIResultHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index 1198f1539..b22afee4d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -40,7 +40,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; const __bjs_createDataPointHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { tmpParamF64s.push(value.x); tmpParamF64s.push(value.y); @@ -92,7 +92,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createAddressHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { const bytes = textEncoder.encode(value.street); const id = swift.memory.retain(bytes); @@ -131,7 +131,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createPersonHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { const bytes = textEncoder.encode(value.name); const id = swift.memory.retain(bytes); @@ -175,7 +175,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createSessionHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { tmpParamInts.push((value.id | 0)); tmpParamPointers.push(value.owner.pointer); @@ -190,7 +190,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createMeasurementHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { tmpParamF64s.push(value.value); tmpParamF32s.push(Math.fround(value.precision)); @@ -219,7 +219,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createConfigStructHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { return { cleanup: undefined }; }, @@ -229,7 +229,7 @@ export async function createInstantiator(options, swift) { }); }; const __bjs_createContainerHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { let id; if (value.object != null) { @@ -377,7 +377,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_DataPoint"] = function() { - const value = structHelpers.DataPoint.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.DataPoint.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Address"] = function(objectId) { @@ -388,7 +388,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_Address"] = function() { - const value = structHelpers.Address.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.Address.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Person"] = function(objectId) { @@ -399,7 +399,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_Person"] = function() { - const value = structHelpers.Person.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.Person.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Session"] = function(objectId) { @@ -410,7 +410,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_Session"] = function() { - const value = structHelpers.Session.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.Session.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Measurement"] = function(objectId) { @@ -421,7 +421,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_Measurement"] = function() { - const value = structHelpers.Measurement.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.Measurement.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_ConfigStruct"] = function(objectId) { @@ -432,7 +432,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_ConfigStruct"] = function() { - const value = structHelpers.ConfigStruct.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.ConfigStruct.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Container"] = function(objectId) { @@ -443,7 +443,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_Container"] = function() { - const value = structHelpers.Container.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.Container.lift(); return swift.memory.retain(value); } bjs["swift_js_return_optional_bool"] = function(isSome, value) { @@ -606,25 +606,25 @@ export async function createInstantiator(options, swift) { swift.memory.release(valueId); } } - const DataPointHelpers = __bjs_createDataPointHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const DataPointHelpers = __bjs_createDataPointHelpers()(); structHelpers.DataPoint = DataPointHelpers; - const AddressHelpers = __bjs_createAddressHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const AddressHelpers = __bjs_createAddressHelpers()(); structHelpers.Address = AddressHelpers; - const PersonHelpers = __bjs_createPersonHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const PersonHelpers = __bjs_createPersonHelpers()(); structHelpers.Person = PersonHelpers; - const SessionHelpers = __bjs_createSessionHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const SessionHelpers = __bjs_createSessionHelpers()(); structHelpers.Session = SessionHelpers; - const MeasurementHelpers = __bjs_createMeasurementHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const MeasurementHelpers = __bjs_createMeasurementHelpers()(); structHelpers.Measurement = MeasurementHelpers; - const ConfigStructHelpers = __bjs_createConfigStructHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const ConfigStructHelpers = __bjs_createConfigStructHelpers()(); structHelpers.ConfigStruct = ConfigStructHelpers; - const ContainerHelpers = __bjs_createContainerHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const ContainerHelpers = __bjs_createContainerHelpers()(); structHelpers.Container = ContainerHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index 393cd6847..f6f63ba8d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -35,7 +35,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; const __bjs_createPointHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { tmpParamInts.push((value.x | 0)); tmpParamInts.push((value.y | 0)); @@ -134,7 +134,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_Point"] = function() { - const value = structHelpers.Point.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.Point.lift(); return swift.memory.retain(value); } bjs["swift_js_return_optional_bool"] = function(isSome, value) { @@ -250,7 +250,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const PointHelpers = __bjs_createPointHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const PointHelpers = __bjs_createPointHelpers()(); structHelpers.Point = PointHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index a2240a9e6..9d94d5f0a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -35,7 +35,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; const __bjs_createPointerFieldsHelpers = () => { - return (tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers) => ({ + return () => ({ lower: (value) => { tmpParamPointers.push((value.raw | 0)); tmpParamPointers.push((value.mutRaw | 0)); @@ -139,7 +139,7 @@ export async function createInstantiator(options, swift) { return 0; } bjs["swift_js_struct_lift_PointerFields"] = function() { - const value = structHelpers.PointerFields.lift(tmpRetStrings, tmpRetInts, tmpRetF32s, tmpRetF64s, tmpRetPointers); + const value = structHelpers.PointerFields.lift(); return swift.memory.retain(value); } bjs["swift_js_return_optional_bool"] = function(isSome, value) { @@ -244,7 +244,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const PointerFieldsHelpers = __bjs_createPointerFieldsHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); + const PointerFieldsHelpers = __bjs_createPointerFieldsHelpers()(); structHelpers.PointerFields = PointerFieldsHelpers; const exports = { From 516fb9d452057ae0083541df346bb9d21e1c47a0 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 5 Feb 2026 19:00:44 +0900 Subject: [PATCH 163/252] BridgeJS: Make Stack ABI storage direction agnostic --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 36 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 160 ++++---- .../BridgeJSLinkTests/ArrayTypes.js | 328 ++++++++------- .../__Snapshots__/BridgeJSLinkTests/Async.js | 36 +- .../BridgeJSLinkTests/DefaultParameters.js | 104 +++-- .../BridgeJSLinkTests/EnumAssociatedValue.js | 378 +++++++++--------- .../BridgeJSLinkTests/EnumCase.js | 36 +- .../BridgeJSLinkTests/EnumNamespace.Global.js | 36 +- .../BridgeJSLinkTests/EnumNamespace.js | 36 +- .../BridgeJSLinkTests/EnumRawType.js | 36 +- .../BridgeJSLinkTests/GlobalGetter.js | 36 +- .../BridgeJSLinkTests/GlobalThisImports.js | 36 +- .../BridgeJSLinkTests/ImportArray.js | 48 +-- .../ImportedTypeInExportedInterface.js | 72 ++-- .../BridgeJSLinkTests/InvalidPropertyNames.js | 36 +- .../BridgeJSLinkTests/JSClass.js | 36 +- .../JSClassStaticFunctions.js | 36 +- .../BridgeJSLinkTests/JSValue.js | 134 +++---- .../BridgeJSLinkTests/MixedGlobal.js | 36 +- .../BridgeJSLinkTests/MixedModules.js | 36 +- .../BridgeJSLinkTests/MixedPrivate.js | 36 +- .../BridgeJSLinkTests/Namespaces.Global.js | 36 +- .../BridgeJSLinkTests/Namespaces.js | 36 +- .../BridgeJSLinkTests/Optionals.js | 36 +- .../BridgeJSLinkTests/PrimitiveParameters.js | 36 +- .../BridgeJSLinkTests/PrimitiveReturn.js | 36 +- .../BridgeJSLinkTests/PropertyTypes.js | 36 +- .../BridgeJSLinkTests/Protocol.js | 66 ++- .../StaticFunctions.Global.js | 48 +-- .../BridgeJSLinkTests/StaticFunctions.js | 48 +-- .../StaticProperties.Global.js | 36 +- .../BridgeJSLinkTests/StaticProperties.js | 36 +- .../BridgeJSLinkTests/StringParameter.js | 36 +- .../BridgeJSLinkTests/StringReturn.js | 36 +- .../BridgeJSLinkTests/SwiftClass.js | 36 +- .../BridgeJSLinkTests/SwiftClosure.js | 58 ++- .../BridgeJSLinkTests/SwiftClosureImports.js | 36 +- .../BridgeJSLinkTests/SwiftStruct.js | 156 ++++---- .../BridgeJSLinkTests/SwiftStructImports.js | 44 +- .../__Snapshots__/BridgeJSLinkTests/Throws.js | 36 +- .../BridgeJSLinkTests/UnsafePointer.js | 56 ++- .../VoidParameterVoidReturn.js | 36 +- 42 files changed, 1268 insertions(+), 1440 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index af6961711..9689f708d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -246,16 +246,12 @@ public struct BridgeJSLink { "let \(JSGlueVariableScope.reservedStorageToReturnOptionalFloat);", "let \(JSGlueVariableScope.reservedStorageToReturnOptionalDouble);", "let \(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject);", - "let \(JSGlueVariableScope.reservedTmpRetTag) = [];", - "let \(JSGlueVariableScope.reservedTmpRetStrings) = [];", - "let \(JSGlueVariableScope.reservedTmpRetInts) = [];", - "let \(JSGlueVariableScope.reservedTmpRetF32s) = [];", - "let \(JSGlueVariableScope.reservedTmpRetF64s) = [];", - "let \(JSGlueVariableScope.reservedTmpParamInts) = [];", - "let \(JSGlueVariableScope.reservedTmpParamF32s) = [];", - "let \(JSGlueVariableScope.reservedTmpParamF64s) = [];", - "let \(JSGlueVariableScope.reservedTmpRetPointers) = [];", - "let \(JSGlueVariableScope.reservedTmpParamPointers) = [];", + "let \(JSGlueVariableScope.reservedTagStack) = [];", + "let \(JSGlueVariableScope.reservedStringStack) = [];", + "let \(JSGlueVariableScope.reservedI32Stack) = [];", + "let \(JSGlueVariableScope.reservedF32Stack) = [];", + "let \(JSGlueVariableScope.reservedF64Stack) = [];", + "let \(JSGlueVariableScope.reservedPointerStack) = [];", "let \(JSGlueVariableScope.reservedTmpStructCleanups) = [];", "const \(JSGlueVariableScope.reservedEnumHelpers) = {};", "const \(JSGlueVariableScope.reservedStructHelpers) = {};", @@ -388,22 +384,22 @@ public struct BridgeJSLink { printer.write("}") printer.write("bjs[\"swift_js_push_tag\"] = function(tag) {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpRetTag).push(tag);") + printer.write("\(JSGlueVariableScope.reservedTagStack).push(tag);") } printer.write("}") printer.write("bjs[\"swift_js_push_i32\"] = function(v) {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(v | 0);") + printer.write("\(JSGlueVariableScope.reservedI32Stack).push(v | 0);") } printer.write("}") printer.write("bjs[\"swift_js_push_f32\"] = function(v) {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpRetF32s).push(Math.fround(v));") + printer.write("\(JSGlueVariableScope.reservedF32Stack).push(Math.fround(v));") } printer.write("}") printer.write("bjs[\"swift_js_push_f64\"] = function(v) {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpRetF64s).push(v);") + printer.write("\(JSGlueVariableScope.reservedF64Stack).push(v);") } printer.write("}") printer.write("bjs[\"swift_js_push_string\"] = function(ptr, len) {") @@ -412,32 +408,32 @@ public struct BridgeJSLink { "const bytes = new Uint8Array(\(JSGlueVariableScope.reservedMemory).buffer, ptr, len)\(sharedMemory ? ".slice()" : "");" ) printer.write("const value = \(JSGlueVariableScope.reservedTextDecoder).decode(bytes);") - printer.write("\(JSGlueVariableScope.reservedTmpRetStrings).push(value);") + printer.write("\(JSGlueVariableScope.reservedStringStack).push(value);") } printer.write("}") printer.write("bjs[\"swift_js_pop_i32\"] = function() {") printer.indent { - printer.write("return \(JSGlueVariableScope.reservedTmpParamInts).pop();") + printer.write("return \(JSGlueVariableScope.reservedI32Stack).pop();") } printer.write("}") printer.write("bjs[\"swift_js_pop_f32\"] = function() {") printer.indent { - printer.write("return \(JSGlueVariableScope.reservedTmpParamF32s).pop();") + printer.write("return \(JSGlueVariableScope.reservedF32Stack).pop();") } printer.write("}") printer.write("bjs[\"swift_js_pop_f64\"] = function() {") printer.indent { - printer.write("return \(JSGlueVariableScope.reservedTmpParamF64s).pop();") + printer.write("return \(JSGlueVariableScope.reservedF64Stack).pop();") } printer.write("}") printer.write("bjs[\"swift_js_push_pointer\"] = function(pointer) {") printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpRetPointers).push(pointer);") + printer.write("\(JSGlueVariableScope.reservedPointerStack).push(pointer);") } printer.write("}") printer.write("bjs[\"swift_js_pop_pointer\"] = function() {") printer.indent { - printer.write("return \(JSGlueVariableScope.reservedTmpParamPointers).pop();") + printer.write("return \(JSGlueVariableScope.reservedPointerStack).pop();") } printer.write("}") printer.write("bjs[\"swift_js_struct_cleanup\"] = function(cleanupId) {") diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index ff0343fd3..ae595d656 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -20,16 +20,12 @@ final class JSGlueVariableScope { static let reservedStorageToReturnOptionalHeapObject = "tmpRetOptionalHeapObject" static let reservedTextEncoder = "textEncoder" static let reservedTextDecoder = "textDecoder" - static let reservedTmpRetTag = "tmpRetTag" - static let reservedTmpRetStrings = "tmpRetStrings" - static let reservedTmpRetInts = "tmpRetInts" - static let reservedTmpRetF32s = "tmpRetF32s" - static let reservedTmpRetF64s = "tmpRetF64s" - static let reservedTmpParamInts = "tmpParamInts" - static let reservedTmpParamF32s = "tmpParamF32s" - static let reservedTmpParamF64s = "tmpParamF64s" - static let reservedTmpRetPointers = "tmpRetPointers" - static let reservedTmpParamPointers = "tmpParamPointers" + static let reservedTagStack = "tagStack" + static let reservedStringStack = "strStack" + static let reservedI32Stack = "i32Stack" + static let reservedF32Stack = "f32Stack" + static let reservedF64Stack = "f64Stack" + static let reservedPointerStack = "ptrStack" static let reservedTmpStructCleanups = "tmpStructCleanups" static let reservedEnumHelpers = "enumHelpers" static let reservedStructHelpers = "structHelpers" @@ -51,16 +47,12 @@ final class JSGlueVariableScope { reservedStorageToReturnOptionalHeapObject, reservedTextEncoder, reservedTextDecoder, - reservedTmpRetTag, - reservedTmpRetStrings, - reservedTmpRetInts, - reservedTmpRetF32s, - reservedTmpRetF64s, - reservedTmpParamInts, - reservedTmpParamF32s, - reservedTmpParamF64s, - reservedTmpRetPointers, - reservedTmpParamPointers, + reservedTagStack, + reservedStringStack, + reservedI32Stack, + reservedF32Stack, + reservedF64Stack, + reservedPointerStack, reservedTmpStructCleanups, reservedEnumHelpers, reservedStructHelpers, @@ -100,46 +92,46 @@ extension JSGlueVariableScope { // MARK: Parameter func emitPushI32Parameter(_ value: String, printer: CodeFragmentPrinter) { - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(value));") + printer.write("\(JSGlueVariableScope.reservedI32Stack).push(\(value));") } func emitPushF64Parameter(_ value: String, printer: CodeFragmentPrinter) { - printer.write("\(JSGlueVariableScope.reservedTmpParamF64s).push(\(value));") + printer.write("\(JSGlueVariableScope.reservedF64Stack).push(\(value));") } func emitPushF32Parameter(_ value: String, printer: CodeFragmentPrinter) { - printer.write("\(JSGlueVariableScope.reservedTmpParamF32s).push(\(value));") + printer.write("\(JSGlueVariableScope.reservedF32Stack).push(\(value));") } func emitPushPointerParameter(_ value: String, printer: CodeFragmentPrinter) { - printer.write("\(JSGlueVariableScope.reservedTmpParamPointers).push(\(value));") + printer.write("\(JSGlueVariableScope.reservedPointerStack).push(\(value));") } // MARK: Return func emitPushI32Return(_ value: String, printer: CodeFragmentPrinter) { - printer.write("\(JSGlueVariableScope.reservedTmpRetInts).push(\(value));") + printer.write("\(JSGlueVariableScope.reservedI32Stack).push(\(value));") } func emitPushF64Return(_ value: String, printer: CodeFragmentPrinter) { - printer.write("\(JSGlueVariableScope.reservedTmpRetF64s).push(\(value));") + printer.write("\(JSGlueVariableScope.reservedF64Stack).push(\(value));") } func emitPushPointerReturn(_ value: String, printer: CodeFragmentPrinter) { - printer.write("\(JSGlueVariableScope.reservedTmpRetPointers).push(\(value));") + printer.write("\(JSGlueVariableScope.reservedPointerStack).push(\(value));") } - func popTagReturn() -> String { - return "\(JSGlueVariableScope.reservedTmpRetTag).pop()" + func popTag() -> String { + return "\(JSGlueVariableScope.reservedTagStack).pop()" } - func popStringReturn() -> String { - return "\(JSGlueVariableScope.reservedTmpRetStrings).pop()" + func popString() -> String { + return "\(JSGlueVariableScope.reservedStringStack).pop()" } - func popI32Return() -> String { - return "\(JSGlueVariableScope.reservedTmpRetInts).pop()" + func popI32() -> String { + return "\(JSGlueVariableScope.reservedI32Stack).pop()" } - func popF64Return() -> String { - return "\(JSGlueVariableScope.reservedTmpRetF64s).pop()" + func popF64() -> String { + return "\(JSGlueVariableScope.reservedF64Stack).pop()" } - func popF32Return() -> String { - return "\(JSGlueVariableScope.reservedTmpRetF32s).pop()" + func popF32() -> String { + return "\(JSGlueVariableScope.reservedF32Stack).pop()" } - func popPointerReturn() -> String { - return "\(JSGlueVariableScope.reservedTmpRetPointers).pop()" + func popPointer() -> String { + return "\(JSGlueVariableScope.reservedPointerStack).pop()" } } @@ -544,9 +536,9 @@ struct IntrinsicJSFragment: Sendable { let payload2 = scope.variable("jsValuePayload2") let payload1 = scope.variable("jsValuePayload1") let kind = scope.variable("jsValueKind") - printer.write("const \(payload2) = \(scope.popF64Return());") - printer.write("const \(payload1) = \(scope.popI32Return());") - printer.write("const \(kind) = \(scope.popI32Return());") + printer.write("const \(payload2) = \(scope.popF64());") + printer.write("const \(payload1) = \(scope.popI32());") + printer.write("const \(kind) = \(scope.popI32());") let resultVar = scope.variable("jsValue") registerJSValueHelpers(scope: scope) printer.write( @@ -618,7 +610,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { _, scope, printer, _ in let retName = scope.variable("ret") printer.write( - "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lift(\(scope.popTagReturn()));" + "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lift(\(scope.popTag()));" ) return [retName] } @@ -933,7 +925,7 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName let tagVar = scope.variable("tag") - printer.write("const \(tagVar) = \(scope.popTagReturn());") + printer.write("const \(tagVar) = \(scope.popTag());") let isNullVar = scope.variable("isNull") printer.write("const \(isNullVar) = (\(tagVar) === -1);") printer.write("let \(resultVar);") @@ -951,7 +943,7 @@ struct IntrinsicJSFragment: Sendable { case .swiftStruct(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(scope.popI32Return());") + printer.write("const \(isSomeVar) = \(scope.popI32());") printer.write("let \(resultVar);") printer.write("if (\(isSomeVar)) {") printer.indent { @@ -966,7 +958,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("}") case .array(let elementType): let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(scope.popI32Return());") + printer.write("const \(isSomeVar) = \(scope.popI32());") printer.write("let \(resultVar);") printer.write("if (\(isSomeVar)) {") printer.indent { @@ -983,7 +975,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("}") case .jsValue: let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(scope.popI32Return());") + printer.write("const \(isSomeVar) = \(scope.popI32());") printer.write("let \(resultVar);") printer.write("if (\(isSomeVar)) {") printer.indent { @@ -1682,7 +1674,7 @@ struct IntrinsicJSFragment: Sendable { let base = fullName.components(separatedBy: ".").last ?? fullName let resultVar = scope.variable("result") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popTagReturn()));" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popTag()));" ) printer.write("return \(resultVar);") return [] @@ -2494,16 +2486,16 @@ struct IntrinsicJSFragment: Sendable { let optVar = scope.variable("optional") let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(scope.popI32Return());") + printer.write("const \(isSomeVar) = \(scope.popI32());") printer.write("let \(optVar);") printer.write("if (\(isSomeVar)) {") printer.indent { // For optional associated value enums, Swift uses bridgeJSLowerParameter() - // which pushes caseId to tmpRetInts (not tmpRetTag like bridgeJSLowerReturn()). + // which pushes caseId to i32Stack (not tagStack like bridgeJSLowerReturn()). if case .associatedValueEnum(let fullName) = wrappedType { let base = fullName.components(separatedBy: ".").last ?? fullName let caseIdVar = scope.variable("caseId") - printer.write("const \(caseIdVar) = \(scope.popI32Return());") + printer.write("const \(caseIdVar) = \(scope.popI32());") printer.write( "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar));" ) @@ -2616,7 +2608,7 @@ struct IntrinsicJSFragment: Sendable { let lenVar = scope.variable("arrayLen") let iVar = scope.variable("i") - printer.write("const \(lenVar) = \(scope.popI32Return());") + printer.write("const \(lenVar) = \(scope.popI32());") printer.write("const \(resultVar) = [];") printer.write("for (let \(iVar) = 0; \(iVar) < \(lenVar); \(iVar)++) {") printer.indent { @@ -2643,9 +2635,9 @@ struct IntrinsicJSFragment: Sendable { let payload2Var = scope.variable("jsValuePayload2") let payload1Var = scope.variable("jsValuePayload1") let kindVar = scope.variable("jsValueKind") - printer.write("const \(payload2Var) = \(scope.popF64Return());") - printer.write("const \(payload1Var) = \(scope.popI32Return());") - printer.write("const \(kindVar) = \(scope.popI32Return());") + printer.write("const \(payload2Var) = \(scope.popF64());") + printer.write("const \(payload1Var) = \(scope.popI32());") + printer.write("const \(kindVar) = \(scope.popI32());") let resultVar = scope.variable("jsValue") printer.write( "const \(resultVar) = \(jsValueLiftHelperName)(\(kindVar), \(payload1Var), \(payload2Var));" @@ -2658,7 +2650,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let strVar = scope.variable("string") - printer.write("const \(strVar) = \(scope.popStringReturn());") + printer.write("const \(strVar) = \(scope.popString());") return [strVar] } ) @@ -2667,7 +2659,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let bVar = scope.variable("bool") - printer.write("const \(bVar) = \(scope.popI32Return()) !== 0;") + printer.write("const \(bVar) = \(scope.popI32()) !== 0;") return [bVar] } ) @@ -2676,7 +2668,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let iVar = scope.variable("int") - printer.write("const \(iVar) = \(scope.popI32Return());") + printer.write("const \(iVar) = \(scope.popI32());") return [iVar] } ) @@ -2685,7 +2677,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let fVar = scope.variable("f32") - printer.write("const \(fVar) = \(scope.popF32Return());") + printer.write("const \(fVar) = \(scope.popF32());") return [fVar] } ) @@ -2694,7 +2686,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let dVar = scope.variable("f64") - printer.write("const \(dVar) = \(scope.popF64Return());") + printer.write("const \(dVar) = \(scope.popF64());") return [dVar] } ) @@ -2715,7 +2707,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let varName = scope.variable("caseId") - printer.write("const \(varName) = \(scope.popI32Return());") + printer.write("const \(varName) = \(scope.popI32());") return [varName] } ) @@ -2726,7 +2718,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let varName = scope.variable("rawValue") - printer.write("const \(varName) = \(scope.popStringReturn());") + printer.write("const \(varName) = \(scope.popString());") return [varName] } ) @@ -2735,7 +2727,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let varName = scope.variable("rawValue") - printer.write("const \(varName) = \(scope.popF32Return());") + printer.write("const \(varName) = \(scope.popF32());") return [varName] } ) @@ -2744,7 +2736,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let varName = scope.variable("rawValue") - printer.write("const \(varName) = \(scope.popF64Return());") + printer.write("const \(varName) = \(scope.popF64());") return [varName] } ) @@ -2753,7 +2745,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let varName = scope.variable("rawValue") - printer.write("const \(varName) = \(scope.popI32Return());") + printer.write("const \(varName) = \(scope.popI32());") return [varName] } ) @@ -2765,7 +2757,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let resultVar = scope.variable("enumValue") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popTagReturn()), );" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popTag()), );" ) return [resultVar] } @@ -2776,7 +2768,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let ptrVar = scope.variable("ptr") let objVar = scope.variable("obj") - printer.write("const \(ptrVar) = \(scope.popPointerReturn());") + printer.write("const \(ptrVar) = \(scope.popPointer());") printer.write("const \(objVar) = _exports['\(className)'].__construct(\(ptrVar));") return [objVar] } @@ -2787,7 +2779,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let idVar = scope.variable("objId") let objVar = scope.variable("obj") - printer.write("const \(idVar) = \(scope.popI32Return());") + printer.write("const \(idVar) = \(scope.popI32());") printer.write("const \(objVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(idVar));") printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") return [objVar] @@ -2802,7 +2794,7 @@ struct IntrinsicJSFragment: Sendable { parameters: [], printCode: { arguments, scope, printer, cleanup in let pVar = scope.variable("pointer") - printer.write("const \(pVar) = \(scope.popPointerReturn());") + printer.write("const \(pVar) = \(scope.popPointer());") return [pVar] } ) @@ -3021,7 +3013,7 @@ struct IntrinsicJSFragment: Sendable { let isSomeVar = scope.variable("isSome") let resultVar = scope.variable("optValue") - printer.write("const \(isSomeVar) = \(scope.popI32Return());") + printer.write("const \(isSomeVar) = \(scope.popI32());") printer.write("let \(resultVar);") printer.write("if (\(isSomeVar) === 0) {") printer.indent { @@ -3477,7 +3469,7 @@ struct IntrinsicJSFragment: Sendable { pushOptionalPrimitive( value: value, isSomeVar: isSomeVar, - stack: .tmpParamInts, + stack: .i32Stack, convert: "| 0", zeroValue: "0", printer: printer, @@ -3487,7 +3479,7 @@ struct IntrinsicJSFragment: Sendable { pushOptionalPrimitive( value: value, isSomeVar: isSomeVar, - stack: .tmpParamInts, + stack: .i32Stack, convert: "? 1 : 0", zeroValue: "0", printer: printer, @@ -3497,7 +3489,7 @@ struct IntrinsicJSFragment: Sendable { pushOptionalPrimitive( value: value, isSomeVar: isSomeVar, - stack: .tmpParamF32s, + stack: .f32Stack, convert: "Math.fround", zeroValue: "0.0", printer: printer, @@ -3507,7 +3499,7 @@ struct IntrinsicJSFragment: Sendable { pushOptionalPrimitive( value: value, isSomeVar: isSomeVar, - stack: .tmpParamF64s, + stack: .f64Stack, convert: nil, zeroValue: "0.0", printer: printer, @@ -3622,9 +3614,9 @@ struct IntrinsicJSFragment: Sendable { ) { let stackName: String switch stack { - case .tmpParamInts: stackName = JSGlueVariableScope.reservedTmpParamInts - case .tmpParamF32s: stackName = JSGlueVariableScope.reservedTmpParamF32s - case .tmpParamF64s: stackName = JSGlueVariableScope.reservedTmpParamF64s + case .i32Stack: stackName = JSGlueVariableScope.reservedI32Stack + case .f32Stack: stackName = JSGlueVariableScope.reservedF32Stack + case .f64Stack: stackName = JSGlueVariableScope.reservedF64Stack } printer.write("if (\(isSomeVar)) {") @@ -3650,9 +3642,9 @@ struct IntrinsicJSFragment: Sendable { } private enum StackType { - case tmpParamInts - case tmpParamF32s - case tmpParamF64s + case i32Stack + case f32Stack + case f64Stack } private static func structFieldLiftFragment( @@ -3668,15 +3660,15 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let isSomeVar = scope.variable("isSome") let optVar = scope.variable("optional") - printer.write("const \(isSomeVar) = \(scope.popI32Return());") + printer.write("const \(isSomeVar) = \(scope.popI32());") printer.write("let \(optVar);") printer.write("if (\(isSomeVar)) {") printer.indent { - // Special handling for associated value enum - in struct fields, case ID is pushed to tmpRetInts + // Special handling for associated value enum - in struct fields, case ID is pushed to i32Stack if case .associatedValueEnum(let enumName) = wrappedType { let base = enumName.components(separatedBy: ".").last ?? enumName let caseIdVar = scope.variable("enumCaseId") - printer.write("const \(caseIdVar) = \(scope.popI32Return());") + printer.write("const \(caseIdVar) = \(scope.popI32());") printer.write( "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar), );" ) @@ -3723,7 +3715,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanup in let objectIdVar = scope.variable("objectId") let varName = scope.variable("value") - printer.write("const \(objectIdVar) = \(scope.popI32Return());") + printer.write("const \(objectIdVar) = \(scope.popI32());") printer.write("let \(varName);") printer.write("if (\(objectIdVar) !== 0) {") printer.indent { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 7093fe417..5b8c451e2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -31,16 +31,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -50,13 +46,13 @@ export async function createInstantiator(options, swift) { const __bjs_createPointHelpers = () => { return () => ({ lower: (value) => { - tmpParamF64s.push(value.x); - tmpParamF64s.push(value.y); + f64Stack.push(value.x); + f64Stack.push(value.y); return { cleanup: undefined }; }, lift: () => { - const f64 = tmpRetF64s.pop(); - const f641 = tmpRetF64s.pop(); + const f64 = f64Stack.pop(); + const f641 = f64Stack.pop(); return { x: f641, y: f64 }; } }); @@ -98,36 +94,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } @@ -265,10 +261,10 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_importProcessNumbers"] = function bjs_importProcessNumbers() { try { - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const f64 = tmpRetF64s.pop(); + const f64 = f64Stack.pop(); arrayResult.push(f64); } arrayResult.reverse(); @@ -282,38 +278,38 @@ export async function createInstantiator(options, swift) { let ret = imports.importGetNumbers(); const arrayCleanups = []; for (const elem of ret) { - tmpParamF64s.push(elem); + f64Stack.push(elem); } - tmpParamInts.push(ret.length); + i32Stack.push(ret.length); } catch (error) { setException(error); } } TestModule["bjs_importTransformNumbers"] = function bjs_importTransformNumbers() { try { - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const f64 = tmpRetF64s.pop(); + const f64 = f64Stack.pop(); arrayResult.push(f64); } arrayResult.reverse(); let ret = imports.importTransformNumbers(arrayResult); const arrayCleanups = []; for (const elem of ret) { - tmpParamF64s.push(elem); + f64Stack.push(elem); } - tmpParamInts.push(ret.length); + i32Stack.push(ret.length); } catch (error) { setException(error); } } TestModule["bjs_importProcessStrings"] = function bjs_importProcessStrings() { try { - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); arrayResult.push(string); } arrayResult.reverse(); @@ -322,32 +318,32 @@ export async function createInstantiator(options, swift) { for (const elem of ret) { const bytes = textEncoder.encode(elem); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); arrayCleanups.push(() => { swift.memory.release(id); }); } - tmpParamInts.push(ret.length); + i32Stack.push(ret.length); } catch (error) { setException(error); } } TestModule["bjs_importProcessBooleans"] = function bjs_importProcessBooleans() { try { - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const bool = tmpRetInts.pop() !== 0; + const bool = i32Stack.pop() !== 0; arrayResult.push(bool); } arrayResult.reverse(); let ret = imports.importProcessBooleans(arrayResult); const arrayCleanups = []; for (const elem of ret) { - tmpParamInts.push(elem ? 1 : 0); + i32Stack.push(elem ? 1 : 0); } - tmpParamInts.push(ret.length); + i32Stack.push(ret.length); } catch (error) { setException(error); } @@ -397,14 +393,14 @@ export async function createInstantiator(options, swift) { processIntArray: function bjs_processIntArray(values) { const arrayCleanups = []; for (const elem of values) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_processIntArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); arrayResult.push(int); } arrayResult.reverse(); @@ -416,18 +412,18 @@ export async function createInstantiator(options, swift) { for (const elem of values) { const bytes = textEncoder.encode(elem); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); arrayCleanups.push(() => { swift.memory.release(id); }); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_processStringArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); arrayResult.push(string); } arrayResult.reverse(); @@ -437,14 +433,14 @@ export async function createInstantiator(options, swift) { processDoubleArray: function bjs_processDoubleArray(values) { const arrayCleanups = []; for (const elem of values) { - tmpParamF64s.push(elem); + f64Stack.push(elem); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_processDoubleArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const f64 = tmpRetF64s.pop(); + const f64 = f64Stack.pop(); arrayResult.push(f64); } arrayResult.reverse(); @@ -454,14 +450,14 @@ export async function createInstantiator(options, swift) { processBoolArray: function bjs_processBoolArray(values) { const arrayCleanups = []; for (const elem of values) { - tmpParamInts.push(elem ? 1 : 0); + i32Stack.push(elem ? 1 : 0); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_processBoolArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const bool = tmpRetInts.pop() !== 0; + const bool = i32Stack.pop() !== 0; arrayResult.push(bool); } arrayResult.reverse(); @@ -476,9 +472,9 @@ export async function createInstantiator(options, swift) { if (structCleanup) { structCleanup(); } }); } - tmpParamInts.push(points.length); + i32Stack.push(points.length); instance.exports.bjs_processPointArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { const struct = structHelpers.Point.lift(); @@ -491,14 +487,14 @@ export async function createInstantiator(options, swift) { processDirectionArray: function bjs_processDirectionArray(directions) { const arrayCleanups = []; for (const elem of directions) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } - tmpParamInts.push(directions.length); + i32Stack.push(directions.length); instance.exports.bjs_processDirectionArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const caseId = tmpRetInts.pop(); + const caseId = i32Stack.pop(); arrayResult.push(caseId); } arrayResult.reverse(); @@ -508,14 +504,14 @@ export async function createInstantiator(options, swift) { processStatusArray: function bjs_processStatusArray(statuses) { const arrayCleanups = []; for (const elem of statuses) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } - tmpParamInts.push(statuses.length); + i32Stack.push(statuses.length); instance.exports.bjs_processStatusArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const rawValue = tmpRetInts.pop(); + const rawValue = i32Stack.pop(); arrayResult.push(rawValue); } arrayResult.reverse(); @@ -525,9 +521,9 @@ export async function createInstantiator(options, swift) { sumIntArray: function bjs_sumIntArray(values) { const arrayCleanups = []; for (const elem of values) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); const ret = instance.exports.bjs_sumIntArray(); for (const cleanup of arrayCleanups) { cleanup(); } return ret; @@ -540,7 +536,7 @@ export async function createInstantiator(options, swift) { if (structCleanup) { structCleanup(); } }); } - tmpParamInts.push(points.length); + i32Stack.push(points.length); const matchingBytes = textEncoder.encode(matching); const matchingId = swift.memory.retain(matchingBytes); instance.exports.bjs_findFirstPoint(matchingId, matchingBytes.length); @@ -552,14 +548,14 @@ export async function createInstantiator(options, swift) { processUnsafeRawPointerArray: function bjs_processUnsafeRawPointerArray(values) { const arrayCleanups = []; for (const elem of values) { - tmpParamPointers.push((elem | 0)); + ptrStack.push((elem | 0)); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_processUnsafeRawPointerArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const pointer = tmpRetPointers.pop(); + const pointer = ptrStack.pop(); arrayResult.push(pointer); } arrayResult.reverse(); @@ -569,14 +565,14 @@ export async function createInstantiator(options, swift) { processUnsafeMutableRawPointerArray: function bjs_processUnsafeMutableRawPointerArray(values) { const arrayCleanups = []; for (const elem of values) { - tmpParamPointers.push((elem | 0)); + ptrStack.push((elem | 0)); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_processUnsafeMutableRawPointerArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const pointer = tmpRetPointers.pop(); + const pointer = ptrStack.pop(); arrayResult.push(pointer); } arrayResult.reverse(); @@ -586,14 +582,14 @@ export async function createInstantiator(options, swift) { processOpaquePointerArray: function bjs_processOpaquePointerArray(values) { const arrayCleanups = []; for (const elem of values) { - tmpParamPointers.push((elem | 0)); + ptrStack.push((elem | 0)); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_processOpaquePointerArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const pointer = tmpRetPointers.pop(); + const pointer = ptrStack.pop(); arrayResult.push(pointer); } arrayResult.reverse(); @@ -605,23 +601,23 @@ export async function createInstantiator(options, swift) { for (const elem of values) { const isSome = elem != null ? 1 : 0; if (isSome) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } else { - tmpParamInts.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome); + i32Stack.push(isSome); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_processOptionalIntArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optValue; if (isSome1 === 0) { optValue = null; } else { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); optValue = int; } arrayResult.push(optValue); @@ -637,26 +633,26 @@ export async function createInstantiator(options, swift) { if (isSome) { const bytes = textEncoder.encode(elem); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); arrayCleanups.push(() => { swift.memory.release(id); }); } else { - tmpParamInts.push(0); - tmpParamInts.push(0); + i32Stack.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome); + i32Stack.push(isSome); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_processOptionalStringArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optValue; if (isSome1 === 0) { optValue = null; } else { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); optValue = string; } arrayResult.push(optValue); @@ -671,19 +667,19 @@ export async function createInstantiator(options, swift) { if (isSome) { const arrayCleanups = []; for (const elem of values) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); } instance.exports.bjs_processOptionalArray(+isSome); - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); arrayResult.push(int); } arrayResult.reverse(); @@ -703,14 +699,14 @@ export async function createInstantiator(options, swift) { arrayCleanups.push(() => { if (structCleanup) { structCleanup(); } }); } else { } - tmpParamInts.push(isSome); + i32Stack.push(isSome); } - tmpParamInts.push(points.length); + i32Stack.push(points.length); instance.exports.bjs_processOptionalPointArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optValue; if (isSome1 === 0) { optValue = null; @@ -729,23 +725,23 @@ export async function createInstantiator(options, swift) { for (const elem of directions) { const isSome = elem != null ? 1 : 0; if (isSome) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } else { - tmpParamInts.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome); + i32Stack.push(isSome); } - tmpParamInts.push(directions.length); + i32Stack.push(directions.length); instance.exports.bjs_processOptionalDirectionArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optValue; if (isSome1 === 0) { optValue = null; } else { - const caseId = tmpRetInts.pop(); + const caseId = i32Stack.pop(); optValue = caseId; } arrayResult.push(optValue); @@ -759,23 +755,23 @@ export async function createInstantiator(options, swift) { for (const elem of statuses) { const isSome = elem != null ? 1 : 0; if (isSome) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } else { - tmpParamInts.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome); + i32Stack.push(isSome); } - tmpParamInts.push(statuses.length); + i32Stack.push(statuses.length); instance.exports.bjs_processOptionalStatusArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optValue; if (isSome1 === 0) { optValue = null; } else { - const rawValue = tmpRetInts.pop(); + const rawValue = i32Stack.pop(); optValue = rawValue; } arrayResult.push(optValue); @@ -789,22 +785,22 @@ export async function createInstantiator(options, swift) { for (const elem of values) { const arrayCleanups1 = []; for (const elem1 of elem) { - tmpParamInts.push((elem1 | 0)); + i32Stack.push((elem1 | 0)); } - tmpParamInts.push(elem.length); + i32Stack.push(elem.length); arrayCleanups.push(() => { for (const cleanup of arrayCleanups1) { cleanup(); } }); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_processNestedIntArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const arrayLen1 = tmpRetInts.pop(); + const arrayLen1 = i32Stack.pop(); const arrayResult1 = []; for (let i1 = 0; i1 < arrayLen1; i1++) { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); arrayResult1.push(int); } arrayResult1.reverse(); @@ -821,26 +817,26 @@ export async function createInstantiator(options, swift) { for (const elem1 of elem) { const bytes = textEncoder.encode(elem1); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); arrayCleanups1.push(() => { swift.memory.release(id); }); } - tmpParamInts.push(elem.length); + i32Stack.push(elem.length); arrayCleanups.push(() => { for (const cleanup of arrayCleanups1) { cleanup(); } }); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_processNestedStringArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const arrayLen1 = tmpRetInts.pop(); + const arrayLen1 = i32Stack.pop(); const arrayResult1 = []; for (let i1 = 0; i1 < arrayLen1; i1++) { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); arrayResult1.push(string); } arrayResult1.reverse(); @@ -860,17 +856,17 @@ export async function createInstantiator(options, swift) { if (structCleanup) { structCleanup(); } }); } - tmpParamInts.push(elem.length); + i32Stack.push(elem.length); arrayCleanups.push(() => { for (const cleanup of arrayCleanups1) { cleanup(); } }); } - tmpParamInts.push(points.length); + i32Stack.push(points.length); instance.exports.bjs_processNestedPointArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const arrayLen1 = tmpRetInts.pop(); + const arrayLen1 = i32Stack.pop(); const arrayResult1 = []; for (let i1 = 0; i1 < arrayLen1; i1++) { const struct = structHelpers.Point.lift(); @@ -886,14 +882,14 @@ export async function createInstantiator(options, swift) { processItemArray: function bjs_processItemArray(items) { const arrayCleanups = []; for (const elem of items) { - tmpParamPointers.push(elem.pointer); + ptrStack.push(elem.pointer); } - tmpParamInts.push(items.length); + i32Stack.push(items.length); instance.exports.bjs_processItemArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const ptr = tmpRetPointers.pop(); + const ptr = ptrStack.pop(); const obj = _exports['Item'].__construct(ptr); arrayResult.push(obj); } @@ -906,22 +902,22 @@ export async function createInstantiator(options, swift) { for (const elem of items) { const arrayCleanups1 = []; for (const elem1 of elem) { - tmpParamPointers.push(elem1.pointer); + ptrStack.push(elem1.pointer); } - tmpParamInts.push(elem.length); + i32Stack.push(elem.length); arrayCleanups.push(() => { for (const cleanup of arrayCleanups1) { cleanup(); } }); } - tmpParamInts.push(items.length); + i32Stack.push(items.length); instance.exports.bjs_processNestedItemArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const arrayLen1 = tmpRetInts.pop(); + const arrayLen1 = i32Stack.pop(); const arrayResult1 = []; for (let i1 = 0; i1 < arrayLen1; i1++) { - const ptr = tmpRetPointers.pop(); + const ptr = ptrStack.pop(); const obj = _exports['Item'].__construct(ptr); arrayResult1.push(obj); } @@ -936,14 +932,14 @@ export async function createInstantiator(options, swift) { const arrayCleanups = []; for (const elem of objects) { const objId = swift.memory.retain(elem); - tmpParamInts.push(objId); + i32Stack.push(objId); } - tmpParamInts.push(objects.length); + i32Stack.push(objects.length); instance.exports.bjs_processJSObjectArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const objId1 = tmpRetInts.pop(); + const objId1 = i32Stack.pop(); const obj = swift.memory.getObject(objId1); swift.memory.release(objId1); arrayResult.push(obj); @@ -958,23 +954,23 @@ export async function createInstantiator(options, swift) { const isSome = elem != null ? 1 : 0; if (isSome) { const objId = swift.memory.retain(elem); - tmpParamInts.push(objId); + i32Stack.push(objId); } else { - tmpParamInts.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome); + i32Stack.push(isSome); } - tmpParamInts.push(objects.length); + i32Stack.push(objects.length); instance.exports.bjs_processOptionalJSObjectArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optValue; if (isSome1 === 0) { optValue = null; } else { - const objId1 = tmpRetInts.pop(); + const objId1 = i32Stack.pop(); const obj = swift.memory.getObject(objId1); swift.memory.release(objId1); optValue = obj; @@ -991,22 +987,22 @@ export async function createInstantiator(options, swift) { const arrayCleanups1 = []; for (const elem1 of elem) { const objId = swift.memory.retain(elem1); - tmpParamInts.push(objId); + i32Stack.push(objId); } - tmpParamInts.push(elem.length); + i32Stack.push(elem.length); arrayCleanups.push(() => { for (const cleanup of arrayCleanups1) { cleanup(); } }); } - tmpParamInts.push(objects.length); + i32Stack.push(objects.length); instance.exports.bjs_processNestedJSObjectArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const arrayLen1 = tmpRetInts.pop(); + const arrayLen1 = i32Stack.pop(); const arrayResult1 = []; for (let i1 = 0; i1 < arrayLen1; i1++) { - const objId1 = tmpRetInts.pop(); + const objId1 = i32Stack.pop(); const obj = swift.memory.getObject(objId1); swift.memory.release(objId1); arrayResult1.push(obj); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js index 0aa9148c1..40ff4884a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -70,36 +66,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index e19eb5fb4..c7b1dc093 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -24,16 +24,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -45,19 +41,19 @@ export async function createInstantiator(options, swift) { lower: (value) => { const bytes = textEncoder.encode(value.name); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - tmpParamInts.push((value.value | 0)); - tmpParamInts.push(value.enabled ? 1 : 0); + i32Stack.push(bytes.length); + i32Stack.push(id); + i32Stack.push((value.value | 0)); + i32Stack.push(value.enabled ? 1 : 0); const cleanup = () => { swift.memory.release(id); }; return { cleanup }; }, lift: () => { - const bool = tmpRetInts.pop() !== 0; - const int = tmpRetInts.pop(); - const string = tmpRetStrings.pop(); + const bool = i32Stack.pop() !== 0; + const int = i32Stack.pop(); + const string = strStack.pop(); return { name: string, value: int, enabled: bool }; } }); @@ -65,11 +61,11 @@ export async function createInstantiator(options, swift) { const __bjs_createMathOperationsHelpers = () => { return () => ({ lower: (value) => { - tmpParamF64s.push(value.baseValue); + f64Stack.push(value.baseValue); return { cleanup: undefined }; }, lift: () => { - const f64 = tmpRetF64s.pop(); + const f64 = f64Stack.pop(); const instance1 = { baseValue: f64 }; instance1.add = function(a, b = 10.0) { const { cleanup: structCleanup } = structHelpers.MathOperations.lower(this); @@ -123,36 +119,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } @@ -525,7 +521,7 @@ export async function createInstantiator(options, swift) { pointCleanup = structResult.cleanup; } instance.exports.bjs_testOptionalStructDefault(+isSome); - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { optResult = structHelpers.Config.lift(); @@ -543,7 +539,7 @@ export async function createInstantiator(options, swift) { pointCleanup = structResult.cleanup; } instance.exports.bjs_testOptionalStructWithValueDefault(+isSome); - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { optResult = structHelpers.Config.lift(); @@ -556,14 +552,14 @@ export async function createInstantiator(options, swift) { testIntArrayDefault: function bjs_testIntArrayDefault(values = [1, 2, 3]) { const arrayCleanups = []; for (const elem of values) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_testIntArrayDefault(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); arrayResult.push(int); } arrayResult.reverse(); @@ -575,18 +571,18 @@ export async function createInstantiator(options, swift) { for (const elem of names) { const bytes = textEncoder.encode(elem); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); arrayCleanups.push(() => { swift.memory.release(id); }); } - tmpParamInts.push(names.length); + i32Stack.push(names.length); instance.exports.bjs_testStringArrayDefault(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); arrayResult.push(string); } arrayResult.reverse(); @@ -596,14 +592,14 @@ export async function createInstantiator(options, swift) { testDoubleArrayDefault: function bjs_testDoubleArrayDefault(values = [1.5, 2.5, 3.5]) { const arrayCleanups = []; for (const elem of values) { - tmpParamF64s.push(elem); + f64Stack.push(elem); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_testDoubleArrayDefault(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const f64 = tmpRetF64s.pop(); + const f64 = f64Stack.pop(); arrayResult.push(f64); } arrayResult.reverse(); @@ -613,14 +609,14 @@ export async function createInstantiator(options, swift) { testBoolArrayDefault: function bjs_testBoolArrayDefault(flags = [true, false, true]) { const arrayCleanups = []; for (const elem of flags) { - tmpParamInts.push(elem ? 1 : 0); + i32Stack.push(elem ? 1 : 0); } - tmpParamInts.push(flags.length); + i32Stack.push(flags.length); instance.exports.bjs_testBoolArrayDefault(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const bool = tmpRetInts.pop() !== 0; + const bool = i32Stack.pop() !== 0; arrayResult.push(bool); } arrayResult.reverse(); @@ -630,14 +626,14 @@ export async function createInstantiator(options, swift) { testEmptyArrayDefault: function bjs_testEmptyArrayDefault(items = []) { const arrayCleanups = []; for (const elem of items) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } - tmpParamInts.push(items.length); + i32Stack.push(items.length); instance.exports.bjs_testEmptyArrayDefault(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); arrayResult.push(int); } arrayResult.reverse(); @@ -649,9 +645,9 @@ export async function createInstantiator(options, swift) { const nameId = swift.memory.retain(nameBytes); const arrayCleanups = []; for (const elem of values) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_testMixedWithArrayDefault(nameId, nameBytes.length, enabled); const ret = tmpRetString; tmpRetString = undefined; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 8491c08a2..f04b464c6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -99,16 +99,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -118,13 +114,13 @@ export async function createInstantiator(options, swift) { const __bjs_createPointHelpers = () => { return () => ({ lower: (value) => { - tmpParamF64s.push(value.x); - tmpParamF64s.push(value.y); + f64Stack.push(value.x); + f64Stack.push(value.y); return { cleanup: undefined }; }, lift: () => { - const f64 = tmpRetF64s.pop(); - const f641 = tmpRetF64s.pop(); + const f64 = f64Stack.pop(); + const f641 = f64Stack.pop(); return { x: f641, y: f64 }; } }); @@ -137,30 +133,30 @@ export async function createInstantiator(options, swift) { case APIResultValues.Tag.Success: { const bytes = textEncoder.encode(value.param0); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const cleanup = () => { swift.memory.release(id); }; return { caseId: APIResultValues.Tag.Success, cleanup }; } case APIResultValues.Tag.Failure: { - tmpParamInts.push((value.param0 | 0)); + i32Stack.push((value.param0 | 0)); const cleanup = undefined; return { caseId: APIResultValues.Tag.Failure, cleanup }; } case APIResultValues.Tag.Flag: { - tmpParamInts.push(value.param0 ? 1 : 0); + i32Stack.push(value.param0 ? 1 : 0); const cleanup = undefined; return { caseId: APIResultValues.Tag.Flag, cleanup }; } case APIResultValues.Tag.Rate: { - tmpParamF32s.push(Math.fround(value.param0)); + f32Stack.push(Math.fround(value.param0)); const cleanup = undefined; return { caseId: APIResultValues.Tag.Rate, cleanup }; } case APIResultValues.Tag.Precise: { - tmpParamF64s.push(value.param0); + f64Stack.push(value.param0); const cleanup = undefined; return { caseId: APIResultValues.Tag.Precise, cleanup }; } @@ -175,23 +171,23 @@ export async function createInstantiator(options, swift) { tag = tag | 0; switch (tag) { case APIResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); return { tag: APIResultValues.Tag.Success, param0: string }; } case APIResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); return { tag: APIResultValues.Tag.Failure, param0: int }; } case APIResultValues.Tag.Flag: { - const bool = tmpRetInts.pop() !== 0; + const bool = i32Stack.pop() !== 0; return { tag: APIResultValues.Tag.Flag, param0: bool }; } case APIResultValues.Tag.Rate: { - const f32 = tmpRetF32s.pop(); + const f32 = f32Stack.pop(); return { tag: APIResultValues.Tag.Rate, param0: f32 }; } case APIResultValues.Tag.Precise: { - const f64 = tmpRetF64s.pop(); + const f64 = f64Stack.pop(); return { tag: APIResultValues.Tag.Precise, param0: f64 }; } case APIResultValues.Tag.Info: return { tag: APIResultValues.Tag.Info }; @@ -208,19 +204,19 @@ export async function createInstantiator(options, swift) { case ComplexResultValues.Tag.Success: { const bytes = textEncoder.encode(value.param0); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const cleanup = () => { swift.memory.release(id); }; return { caseId: ComplexResultValues.Tag.Success, cleanup }; } case ComplexResultValues.Tag.Error: { - tmpParamInts.push((value.param1 | 0)); + i32Stack.push((value.param1 | 0)); const bytes = textEncoder.encode(value.param0); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const cleanup = () => { swift.memory.release(id); }; @@ -229,41 +225,41 @@ export async function createInstantiator(options, swift) { case ComplexResultValues.Tag.Status: { const bytes = textEncoder.encode(value.param2); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - tmpParamInts.push((value.param1 | 0)); - tmpParamInts.push(value.param0 ? 1 : 0); + i32Stack.push(bytes.length); + i32Stack.push(id); + i32Stack.push((value.param1 | 0)); + i32Stack.push(value.param0 ? 1 : 0); const cleanup = () => { swift.memory.release(id); }; return { caseId: ComplexResultValues.Tag.Status, cleanup }; } case ComplexResultValues.Tag.Coordinates: { - tmpParamF64s.push(value.param2); - tmpParamF64s.push(value.param1); - tmpParamF64s.push(value.param0); + f64Stack.push(value.param2); + f64Stack.push(value.param1); + f64Stack.push(value.param0); const cleanup = undefined; return { caseId: ComplexResultValues.Tag.Coordinates, cleanup }; } case ComplexResultValues.Tag.Comprehensive: { const bytes = textEncoder.encode(value.param8); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const bytes1 = textEncoder.encode(value.param7); const id1 = swift.memory.retain(bytes1); - tmpParamInts.push(bytes1.length); - tmpParamInts.push(id1); + i32Stack.push(bytes1.length); + i32Stack.push(id1); const bytes2 = textEncoder.encode(value.param6); const id2 = swift.memory.retain(bytes2); - tmpParamInts.push(bytes2.length); - tmpParamInts.push(id2); - tmpParamF64s.push(value.param5); - tmpParamF64s.push(value.param4); - tmpParamInts.push((value.param3 | 0)); - tmpParamInts.push((value.param2 | 0)); - tmpParamInts.push(value.param1 ? 1 : 0); - tmpParamInts.push(value.param0 ? 1 : 0); + i32Stack.push(bytes2.length); + i32Stack.push(id2); + f64Stack.push(value.param5); + f64Stack.push(value.param4); + i32Stack.push((value.param3 | 0)); + i32Stack.push((value.param2 | 0)); + i32Stack.push(value.param1 ? 1 : 0); + i32Stack.push(value.param0 ? 1 : 0); const cleanup = () => { swift.memory.release(id); swift.memory.release(id1); @@ -282,36 +278,36 @@ export async function createInstantiator(options, swift) { tag = tag | 0; switch (tag) { case ComplexResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); return { tag: ComplexResultValues.Tag.Success, param0: string }; } case ComplexResultValues.Tag.Error: { - const int = tmpRetInts.pop(); - const string = tmpRetStrings.pop(); + const int = i32Stack.pop(); + const string = strStack.pop(); return { tag: ComplexResultValues.Tag.Error, param0: string, param1: int }; } case ComplexResultValues.Tag.Status: { - const string = tmpRetStrings.pop(); - const int = tmpRetInts.pop(); - const bool = tmpRetInts.pop() !== 0; + const string = strStack.pop(); + const int = i32Stack.pop(); + const bool = i32Stack.pop() !== 0; return { tag: ComplexResultValues.Tag.Status, param0: bool, param1: int, param2: string }; } case ComplexResultValues.Tag.Coordinates: { - const f64 = tmpRetF64s.pop(); - const f641 = tmpRetF64s.pop(); - const f642 = tmpRetF64s.pop(); + const f64 = f64Stack.pop(); + const f641 = f64Stack.pop(); + const f642 = f64Stack.pop(); return { tag: ComplexResultValues.Tag.Coordinates, param0: f642, param1: f641, param2: f64 }; } case ComplexResultValues.Tag.Comprehensive: { - const string = tmpRetStrings.pop(); - const string1 = tmpRetStrings.pop(); - const string2 = tmpRetStrings.pop(); - const f64 = tmpRetF64s.pop(); - const f641 = tmpRetF64s.pop(); - const int = tmpRetInts.pop(); - const int1 = tmpRetInts.pop(); - const bool = tmpRetInts.pop() !== 0; - const bool1 = tmpRetInts.pop() !== 0; + const string = strStack.pop(); + const string1 = strStack.pop(); + const string2 = strStack.pop(); + const f64 = f64Stack.pop(); + const f641 = f64Stack.pop(); + const int = i32Stack.pop(); + const int1 = i32Stack.pop(); + const bool = i32Stack.pop() !== 0; + const bool1 = i32Stack.pop() !== 0; return { tag: ComplexResultValues.Tag.Comprehensive, param0: bool1, param1: bool, param2: int1, param3: int, param4: f641, param5: f64, param6: string2, param7: string1, param8: string }; } case ComplexResultValues.Tag.Info: return { tag: ComplexResultValues.Tag.Info }; @@ -328,19 +324,19 @@ export async function createInstantiator(options, swift) { case ResultValues.Tag.Success: { const bytes = textEncoder.encode(value.param0); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const cleanup = () => { swift.memory.release(id); }; return { caseId: ResultValues.Tag.Success, cleanup }; } case ResultValues.Tag.Failure: { - tmpParamInts.push((value.param1 | 0)); + i32Stack.push((value.param1 | 0)); const bytes = textEncoder.encode(value.param0); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const cleanup = () => { swift.memory.release(id); }; @@ -349,10 +345,10 @@ export async function createInstantiator(options, swift) { case ResultValues.Tag.Status: { const bytes = textEncoder.encode(value.param2); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - tmpParamInts.push((value.param1 | 0)); - tmpParamInts.push(value.param0 ? 1 : 0); + i32Stack.push(bytes.length); + i32Stack.push(id); + i32Stack.push((value.param1 | 0)); + i32Stack.push(value.param0 ? 1 : 0); const cleanup = () => { swift.memory.release(id); }; @@ -365,18 +361,18 @@ export async function createInstantiator(options, swift) { tag = tag | 0; switch (tag) { case ResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); return { tag: ResultValues.Tag.Success, param0: string }; } case ResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); - const string = tmpRetStrings.pop(); + const int = i32Stack.pop(); + const string = strStack.pop(); return { tag: ResultValues.Tag.Failure, param0: string, param1: int }; } case ResultValues.Tag.Status: { - const string = tmpRetStrings.pop(); - const int = tmpRetInts.pop(); - const bool = tmpRetInts.pop() !== 0; + const string = strStack.pop(); + const int = i32Stack.pop(); + const bool = i32Stack.pop() !== 0; return { tag: ResultValues.Tag.Status, param0: bool, param1: int, param2: string }; } default: throw new Error("Unknown ResultValues tag returned from Swift: " + String(tag)); @@ -392,19 +388,19 @@ export async function createInstantiator(options, swift) { case NetworkingResultValues.Tag.Success: { const bytes = textEncoder.encode(value.param0); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const cleanup = () => { swift.memory.release(id); }; return { caseId: NetworkingResultValues.Tag.Success, cleanup }; } case NetworkingResultValues.Tag.Failure: { - tmpParamInts.push((value.param1 | 0)); + i32Stack.push((value.param1 | 0)); const bytes = textEncoder.encode(value.param0); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const cleanup = () => { swift.memory.release(id); }; @@ -417,12 +413,12 @@ export async function createInstantiator(options, swift) { tag = tag | 0; switch (tag) { case NetworkingResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); return { tag: NetworkingResultValues.Tag.Success, param0: string }; } case NetworkingResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); - const string = tmpRetStrings.pop(); + const int = i32Stack.pop(); + const string = strStack.pop(); return { tag: NetworkingResultValues.Tag.Failure, param0: string, param1: int }; } default: throw new Error("Unknown NetworkingResultValues tag returned from Swift: " + String(tag)); @@ -441,13 +437,13 @@ export async function createInstantiator(options, swift) { if (isSome) { let bytes = textEncoder.encode(value.param0); id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); } else { - tmpParamInts.push(0); - tmpParamInts.push(0); + i32Stack.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? 1 : 0); const cleanup = () => { if(id) { swift.memory.release(id); @@ -457,11 +453,11 @@ export async function createInstantiator(options, swift) { } case APIOptionalResultValues.Tag.Failure: { const isSome = value.param1 != null; - tmpParamInts.push(isSome ? (value.param1 ? 1 : 0) : 0); - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? (value.param1 ? 1 : 0) : 0); + i32Stack.push(isSome ? 1 : 0); const isSome1 = value.param0 != null; - tmpParamInts.push(isSome1 ? (value.param0 | 0) : 0); - tmpParamInts.push(isSome1 ? 1 : 0); + i32Stack.push(isSome1 ? (value.param0 | 0) : 0); + i32Stack.push(isSome1 ? 1 : 0); const cleanup = undefined; return { caseId: APIOptionalResultValues.Tag.Failure, cleanup }; } @@ -471,19 +467,19 @@ export async function createInstantiator(options, swift) { if (isSome) { let bytes = textEncoder.encode(value.param2); id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); } else { - tmpParamInts.push(0); - tmpParamInts.push(0); + i32Stack.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? 1 : 0); const isSome1 = value.param1 != null; - tmpParamInts.push(isSome1 ? (value.param1 | 0) : 0); - tmpParamInts.push(isSome1 ? 1 : 0); + i32Stack.push(isSome1 ? (value.param1 | 0) : 0); + i32Stack.push(isSome1 ? 1 : 0); const isSome2 = value.param0 != null; - tmpParamInts.push(isSome2 ? (value.param0 ? 1 : 0) : 0); - tmpParamInts.push(isSome2 ? 1 : 0); + i32Stack.push(isSome2 ? (value.param0 ? 1 : 0) : 0); + i32Stack.push(isSome2 ? 1 : 0); const cleanup = () => { if(id) { swift.memory.release(id); @@ -498,10 +494,10 @@ export async function createInstantiator(options, swift) { tag = tag | 0; switch (tag) { case APIOptionalResultValues.Tag.Success: { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); optional = string; } else { optional = null; @@ -509,18 +505,18 @@ export async function createInstantiator(options, swift) { return { tag: APIOptionalResultValues.Tag.Success, param0: optional }; } case APIOptionalResultValues.Tag.Failure: { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const bool = tmpRetInts.pop() !== 0; + const bool = i32Stack.pop() !== 0; optional = bool; } else { optional = null; } - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optional1; if (isSome1) { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); optional1 = int; } else { optional1 = null; @@ -528,26 +524,26 @@ export async function createInstantiator(options, swift) { return { tag: APIOptionalResultValues.Tag.Failure, param0: optional1, param1: optional }; } case APIOptionalResultValues.Tag.Status: { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); optional = string; } else { optional = null; } - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optional1; if (isSome1) { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); optional1 = int; } else { optional1 = null; } - const isSome2 = tmpRetInts.pop(); + const isSome2 = i32Stack.pop(); let optional2; if (isSome2) { - const bool = tmpRetInts.pop() !== 0; + const bool = i32Stack.pop() !== 0; optional2 = bool; } else { optional2 = null; @@ -565,26 +561,26 @@ export async function createInstantiator(options, swift) { const enumTag = value.tag; switch (enumTag) { case TypedPayloadResultValues.Tag.Precision: { - tmpParamF32s.push(Math.fround(value.param0)); + f32Stack.push(Math.fround(value.param0)); const cleanup = undefined; return { caseId: TypedPayloadResultValues.Tag.Precision, cleanup }; } case TypedPayloadResultValues.Tag.Direction: { - tmpParamInts.push((value.param0 | 0)); + i32Stack.push((value.param0 | 0)); const cleanup = undefined; return { caseId: TypedPayloadResultValues.Tag.Direction, cleanup }; } case TypedPayloadResultValues.Tag.OptPrecision: { const isSome = value.param0 != null; - tmpParamF32s.push(isSome ? Math.fround(value.param0) : 0.0); - tmpParamInts.push(isSome ? 1 : 0); + f32Stack.push(isSome ? Math.fround(value.param0) : 0.0); + i32Stack.push(isSome ? 1 : 0); const cleanup = undefined; return { caseId: TypedPayloadResultValues.Tag.OptPrecision, cleanup }; } case TypedPayloadResultValues.Tag.OptDirection: { const isSome = value.param0 != null; - tmpParamInts.push(isSome ? (value.param0 | 0) : 0); - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? (value.param0 | 0) : 0); + i32Stack.push(isSome ? 1 : 0); const cleanup = undefined; return { caseId: TypedPayloadResultValues.Tag.OptDirection, cleanup }; } @@ -599,18 +595,18 @@ export async function createInstantiator(options, swift) { tag = tag | 0; switch (tag) { case TypedPayloadResultValues.Tag.Precision: { - const rawValue = tmpRetF32s.pop(); + const rawValue = f32Stack.pop(); return { tag: TypedPayloadResultValues.Tag.Precision, param0: rawValue }; } case TypedPayloadResultValues.Tag.Direction: { - const caseId = tmpRetInts.pop(); + const caseId = i32Stack.pop(); return { tag: TypedPayloadResultValues.Tag.Direction, param0: caseId }; } case TypedPayloadResultValues.Tag.OptPrecision: { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const rawValue = tmpRetF32s.pop(); + const rawValue = f32Stack.pop(); optional = rawValue; } else { optional = null; @@ -618,10 +614,10 @@ export async function createInstantiator(options, swift) { return { tag: TypedPayloadResultValues.Tag.OptPrecision, param0: optional }; } case TypedPayloadResultValues.Tag.OptDirection: { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const caseId = tmpRetInts.pop(); + const caseId = i32Stack.pop(); optional = caseId; } else { optional = null; @@ -647,19 +643,19 @@ export async function createInstantiator(options, swift) { return { caseId: AllTypesResultValues.Tag.StructPayload, cleanup }; } case AllTypesResultValues.Tag.ClassPayload: { - tmpParamPointers.push(value.param0.pointer); + ptrStack.push(value.param0.pointer); const cleanup = undefined; return { caseId: AllTypesResultValues.Tag.ClassPayload, cleanup }; } case AllTypesResultValues.Tag.JsObjectPayload: { const objId = swift.memory.retain(value.param0); - tmpParamInts.push(objId); + i32Stack.push(objId); const cleanup = undefined; return { caseId: AllTypesResultValues.Tag.JsObjectPayload, cleanup }; } case AllTypesResultValues.Tag.NestedEnum: { const { caseId: caseId, cleanup: enumCleanup } = enumHelpers.APIResult.lower(value.param0); - tmpParamInts.push(caseId); + i32Stack.push(caseId); const cleanup = () => { if (enumCleanup) { enumCleanup(); } }; @@ -668,9 +664,9 @@ export async function createInstantiator(options, swift) { case AllTypesResultValues.Tag.ArrayPayload: { const arrayCleanups = []; for (const elem of value.param0) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } - tmpParamInts.push(value.param0.length); + i32Stack.push(value.param0.length); const cleanup = () => { for (const cleanup of arrayCleanups) { cleanup(); } }; @@ -691,25 +687,25 @@ export async function createInstantiator(options, swift) { return { tag: AllTypesResultValues.Tag.StructPayload, param0: struct }; } case AllTypesResultValues.Tag.ClassPayload: { - const ptr = tmpRetPointers.pop(); + const ptr = ptrStack.pop(); const obj = _exports['User'].__construct(ptr); return { tag: AllTypesResultValues.Tag.ClassPayload, param0: obj }; } case AllTypesResultValues.Tag.JsObjectPayload: { - const objId = tmpRetInts.pop(); + const objId = i32Stack.pop(); const obj = swift.memory.getObject(objId); swift.memory.release(objId); return { tag: AllTypesResultValues.Tag.JsObjectPayload, param0: obj }; } case AllTypesResultValues.Tag.NestedEnum: { - const enumValue = enumHelpers.APIResult.lift(tmpRetTag.pop(), ); + const enumValue = enumHelpers.APIResult.lift(tagStack.pop(), ); return { tag: AllTypesResultValues.Tag.NestedEnum, param0: enumValue }; } case AllTypesResultValues.Tag.ArrayPayload: { - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); arrayResult.push(int); } arrayResult.reverse(); @@ -733,7 +729,7 @@ export async function createInstantiator(options, swift) { const structResult = structHelpers.Point.lower(value.param0); nestedCleanup = structResult.cleanup; } - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? 1 : 0); const cleanup = () => { if (nestedCleanup) { nestedCleanup(); } }; @@ -742,11 +738,11 @@ export async function createInstantiator(options, swift) { case OptionalAllTypesResultValues.Tag.OptClass: { const isSome = value.param0 != null; if (isSome) { - tmpParamPointers.push(value.param0.pointer); + ptrStack.push(value.param0.pointer); } else { - tmpParamPointers.push(0); + ptrStack.push(0); } - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? 1 : 0); const cleanup = undefined; return { caseId: OptionalAllTypesResultValues.Tag.OptClass, cleanup }; } @@ -755,12 +751,12 @@ export async function createInstantiator(options, swift) { let id; if (isSome) { id = swift.memory.retain(value.param0); - tmpParamInts.push(id); + i32Stack.push(id); } else { id = undefined; - tmpParamInts.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? 1 : 0); const cleanup = undefined; return { caseId: OptionalAllTypesResultValues.Tag.OptJSObject, cleanup }; } @@ -771,11 +767,11 @@ export async function createInstantiator(options, swift) { const enumResult = enumHelpers.APIResult.lower(value.param0); enumCaseId = enumResult.caseId; enumCleanup = enumResult.cleanup; - tmpParamInts.push(enumCaseId); + i32Stack.push(enumCaseId); } else { - tmpParamInts.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? 1 : 0); const cleanup = () => { if (enumCleanup) { enumCleanup(); } }; @@ -787,14 +783,14 @@ export async function createInstantiator(options, swift) { if (isSome) { const arrayCleanups = []; for (const elem of value.param0) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } - tmpParamInts.push(value.param0.length); + i32Stack.push(value.param0.length); arrCleanup = () => { for (const cleanup of arrayCleanups) { cleanup(); } }; } - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? 1 : 0); const cleanup = () => { if (arrCleanup) { arrCleanup(); } }; @@ -811,7 +807,7 @@ export async function createInstantiator(options, swift) { tag = tag | 0; switch (tag) { case OptionalAllTypesResultValues.Tag.OptStruct: { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { const struct = structHelpers.Point.lift(); @@ -822,10 +818,10 @@ export async function createInstantiator(options, swift) { return { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: optional }; } case OptionalAllTypesResultValues.Tag.OptClass: { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const ptr = tmpRetPointers.pop(); + const ptr = ptrStack.pop(); const obj = _exports['User'].__construct(ptr); optional = obj; } else { @@ -834,10 +830,10 @@ export async function createInstantiator(options, swift) { return { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: optional }; } case OptionalAllTypesResultValues.Tag.OptJSObject: { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const objId = tmpRetInts.pop(); + const objId = i32Stack.pop(); const obj = swift.memory.getObject(objId); swift.memory.release(objId); optional = obj; @@ -847,10 +843,10 @@ export async function createInstantiator(options, swift) { return { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: optional }; } case OptionalAllTypesResultValues.Tag.OptNestedEnum: { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const caseId = tmpRetInts.pop(); + const caseId = i32Stack.pop(); optional = enumHelpers.APIResult.lift(caseId); } else { optional = null; @@ -858,13 +854,13 @@ export async function createInstantiator(options, swift) { return { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: optional }; } case OptionalAllTypesResultValues.Tag.OptArray: { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); arrayResult.push(int); } arrayResult.reverse(); @@ -916,36 +912,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } @@ -1139,13 +1135,13 @@ export async function createInstantiator(options, swift) { }, getResult: function bjs_getResult() { instance.exports.bjs_getResult(); - const ret = enumHelpers.APIResult.lift(tmpRetTag.pop()); + const ret = enumHelpers.APIResult.lift(tagStack.pop()); return ret; }, roundtripAPIResult: function bjs_roundtripAPIResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.APIResult.lower(result); instance.exports.bjs_roundtripAPIResult(resultCaseId); - const ret = enumHelpers.APIResult.lift(tmpRetTag.pop()); + const ret = enumHelpers.APIResult.lift(tagStack.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1158,7 +1154,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalAPIResult(+isSome, isSome ? resultCaseId : 0); - const tag = tmpRetTag.pop(); + const tag = tagStack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1176,13 +1172,13 @@ export async function createInstantiator(options, swift) { }, getComplexResult: function bjs_getComplexResult() { instance.exports.bjs_getComplexResult(); - const ret = enumHelpers.ComplexResult.lift(tmpRetTag.pop()); + const ret = enumHelpers.ComplexResult.lift(tagStack.pop()); return ret; }, roundtripComplexResult: function bjs_roundtripComplexResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.ComplexResult.lower(result); instance.exports.bjs_roundtripComplexResult(resultCaseId); - const ret = enumHelpers.ComplexResult.lift(tmpRetTag.pop()); + const ret = enumHelpers.ComplexResult.lift(tagStack.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1195,7 +1191,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalComplexResult(+isSome, isSome ? resultCaseId : 0); - const tag = tmpRetTag.pop(); + const tag = tagStack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1215,7 +1211,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalUtilitiesResult(+isSome, isSome ? resultCaseId : 0); - const tag = tmpRetTag.pop(); + const tag = tagStack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1235,7 +1231,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalNetworkingResult(+isSome, isSome ? resultCaseId : 0); - const tag = tmpRetTag.pop(); + const tag = tagStack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1255,7 +1251,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalAPIOptionalResult(+isSome, isSome ? resultCaseId : 0); - const tag = tmpRetTag.pop(); + const tag = tagStack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1282,7 +1278,7 @@ export async function createInstantiator(options, swift) { result2Cleanup = enumResult1.cleanup; } instance.exports.bjs_compareAPIResults(+isSome, isSome ? result1CaseId : 0, +isSome1, isSome1 ? result2CaseId : 0); - const tag = tmpRetTag.pop(); + const tag = tagStack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1297,7 +1293,7 @@ export async function createInstantiator(options, swift) { roundTripTypedPayloadResult: function bjs_roundTripTypedPayloadResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.TypedPayloadResult.lower(result); instance.exports.bjs_roundTripTypedPayloadResult(resultCaseId); - const ret = enumHelpers.TypedPayloadResult.lift(tmpRetTag.pop()); + const ret = enumHelpers.TypedPayloadResult.lift(tagStack.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1310,7 +1306,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalTypedPayloadResult(+isSome, isSome ? resultCaseId : 0); - const tag = tmpRetTag.pop(); + const tag = tagStack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1324,7 +1320,7 @@ export async function createInstantiator(options, swift) { roundTripAllTypesResult: function bjs_roundTripAllTypesResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.AllTypesResult.lower(result); instance.exports.bjs_roundTripAllTypesResult(resultCaseId); - const ret = enumHelpers.AllTypesResult.lift(tmpRetTag.pop()); + const ret = enumHelpers.AllTypesResult.lift(tagStack.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1337,7 +1333,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalAllTypesResult(+isSome, isSome ? resultCaseId : 0); - const tag = tmpRetTag.pop(); + const tag = tagStack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1351,7 +1347,7 @@ export async function createInstantiator(options, swift) { roundTripOptionalPayloadResult: function bjs_roundTripOptionalPayloadResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.OptionalAllTypesResult.lower(result); instance.exports.bjs_roundTripOptionalPayloadResult(resultCaseId); - const ret = enumHelpers.OptionalAllTypesResult.lift(tmpRetTag.pop()); + const ret = enumHelpers.OptionalAllTypesResult.lift(tagStack.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1364,7 +1360,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalPayloadResultOpt(+isSome, isSome ? resultCaseId : 0); - const tag = tmpRetTag.pop(); + const tag = tagStack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js index 9ca596a6e..0c8eee729 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js @@ -42,16 +42,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -94,36 +90,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index a7a2c4b98..28cfe9dd9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -62,16 +62,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -114,36 +110,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index b195b6945..a933ed735 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -43,16 +43,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,36 +91,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index c906f27ff..06ebbe269 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -93,16 +93,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -146,36 +142,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js index ac6170b08..97f34b1bb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -71,36 +67,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js index dc2220715..bc186d4c1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -70,36 +66,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js index daa601aed..3a04c5308 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -71,36 +67,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } @@ -205,29 +201,29 @@ export async function createInstantiator(options, swift) { const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_roundtrip"] = function bjs_roundtrip() { try { - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); arrayResult.push(int); } arrayResult.reverse(); let ret = imports.roundtrip(arrayResult); const arrayCleanups = []; for (const elem of ret) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } - tmpParamInts.push(ret.length); + i32Stack.push(ret.length); } catch (error) { setException(error); } } TestModule["bjs_logStrings"] = function bjs_logStrings() { try { - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); arrayResult.push(string); } arrayResult.reverse(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index 1e4e1f508..4f3fa39a6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -43,17 +39,17 @@ export async function createInstantiator(options, swift) { } else { id = undefined; } - tmpParamInts.push(id !== undefined ? id : 0); + i32Stack.push(id !== undefined ? id : 0); const isSome = value.optionalFoo != null; let id1; if (isSome) { id1 = swift.memory.retain(value.optionalFoo); - tmpParamInts.push(id1); + i32Stack.push(id1); } else { id1 = undefined; - tmpParamInts.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? 1 : 0); const cleanup = () => { if(id !== undefined && id !== 0) { try { @@ -71,10 +67,10 @@ export async function createInstantiator(options, swift) { return { cleanup }; }, lift: () => { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const objectId = tmpRetInts.pop(); + const objectId = i32Stack.pop(); let value; if (objectId !== 0) { value = swift.memory.getObject(objectId); @@ -86,7 +82,7 @@ export async function createInstantiator(options, swift) { } else { optional = null; } - const objectId1 = tmpRetInts.pop(); + const objectId1 = i32Stack.pop(); let value1; if (objectId1 !== 0) { value1 = swift.memory.getObject(objectId1); @@ -135,36 +131,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } @@ -318,14 +314,14 @@ export async function createInstantiator(options, swift) { const arrayCleanups = []; for (const elem of foos) { const objId = swift.memory.retain(elem); - tmpParamInts.push(objId); + i32Stack.push(objId); } - tmpParamInts.push(foos.length); + i32Stack.push(foos.length); instance.exports.bjs_processFooArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const objId1 = tmpRetInts.pop(); + const objId1 = i32Stack.pop(); const obj = swift.memory.getObject(objId1); swift.memory.release(objId1); arrayResult.push(obj); @@ -340,23 +336,23 @@ export async function createInstantiator(options, swift) { const isSome = elem != null ? 1 : 0; if (isSome) { const objId = swift.memory.retain(elem); - tmpParamInts.push(objId); + i32Stack.push(objId); } else { - tmpParamInts.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome); + i32Stack.push(isSome); } - tmpParamInts.push(foos.length); + i32Stack.push(foos.length); instance.exports.bjs_processOptionalFooArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optValue; if (isSome1 === 0) { optValue = null; } else { - const objId1 = tmpRetInts.pop(); + const objId1 = i32Stack.pop(); const obj = swift.memory.getObject(objId1); swift.memory.release(objId1); optValue = obj; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js index d64ff7e96..d3514253a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -71,36 +67,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js index 096e3a345..2bbddd396 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -71,36 +67,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index cacaa87a3..c05e4e114 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -71,36 +67,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index f5c360bb0..754a17e3c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -160,36 +156,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } @@ -305,21 +301,21 @@ export async function createInstantiator(options, swift) { const jsValue = __bjs_jsValueLift(valueKind, valuePayload1, valuePayload2); let ret = imports.jsEchoJSValue(jsValue); const [retKind, retPayload1, retPayload2] = __bjs_jsValueLower(ret); - tmpParamInts.push(retKind); - tmpParamInts.push(retPayload1); - tmpParamF64s.push(retPayload2); + i32Stack.push(retKind); + i32Stack.push(retPayload1); + f64Stack.push(retPayload2); } catch (error) { setException(error); } } TestModule["bjs_jsEchoJSValueArray"] = function bjs_jsEchoJSValueArray() { try { - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const jsValuePayload2 = tmpRetF64s.pop(); - const jsValuePayload1 = tmpRetInts.pop(); - const jsValueKind = tmpRetInts.pop(); + const jsValuePayload2 = f64Stack.pop(); + const jsValuePayload1 = i32Stack.pop(); + const jsValueKind = i32Stack.pop(); const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); arrayResult.push(jsValue); } @@ -328,11 +324,11 @@ export async function createInstantiator(options, swift) { const arrayCleanups = []; for (const elem of ret) { const [elemKind, elemPayload1, elemPayload2] = __bjs_jsValueLower(elem); - tmpParamInts.push(elemKind); - tmpParamInts.push(elemPayload1); - tmpParamF64s.push(elemPayload2); + i32Stack.push(elemKind); + i32Stack.push(elemPayload1); + f64Stack.push(elemPayload2); } - tmpParamInts.push(ret.length); + i32Stack.push(ret.length); } catch (error) { setException(error); } @@ -389,9 +385,9 @@ export async function createInstantiator(options, swift) { echo(value) { const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); instance.exports.bjs_JSValueHolder_echo(this.pointer, valueKind, valuePayload1, valuePayload2); - const jsValuePayload2 = tmpRetF64s.pop(); - const jsValuePayload1 = tmpRetInts.pop(); - const jsValueKind = tmpRetInts.pop(); + const jsValuePayload2 = f64Stack.pop(); + const jsValuePayload1 = i32Stack.pop(); + const jsValueKind = i32Stack.pop(); const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); return jsValue; } @@ -399,12 +395,12 @@ export async function createInstantiator(options, swift) { const isSome = value != null; const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); instance.exports.bjs_JSValueHolder_echoOptional(this.pointer, +isSome, valueKind, valuePayload1, valuePayload2); - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { - const jsValuePayload2 = tmpRetF64s.pop(); - const jsValuePayload1 = tmpRetInts.pop(); - const jsValueKind = tmpRetInts.pop(); + const jsValuePayload2 = f64Stack.pop(); + const jsValuePayload1 = i32Stack.pop(); + const jsValueKind = i32Stack.pop(); const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); optResult = jsValue; } else { @@ -414,9 +410,9 @@ export async function createInstantiator(options, swift) { } get value() { instance.exports.bjs_JSValueHolder_value_get(this.pointer); - const jsValuePayload2 = tmpRetF64s.pop(); - const jsValuePayload1 = tmpRetInts.pop(); - const jsValueKind = tmpRetInts.pop(); + const jsValuePayload2 = f64Stack.pop(); + const jsValuePayload1 = i32Stack.pop(); + const jsValueKind = i32Stack.pop(); const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); return jsValue; } @@ -426,12 +422,12 @@ export async function createInstantiator(options, swift) { } get optionalValue() { instance.exports.bjs_JSValueHolder_optionalValue_get(this.pointer); - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optResult; if (isSome) { - const jsValuePayload2 = tmpRetF64s.pop(); - const jsValuePayload1 = tmpRetInts.pop(); - const jsValueKind = tmpRetInts.pop(); + const jsValuePayload2 = f64Stack.pop(); + const jsValuePayload1 = i32Stack.pop(); + const jsValueKind = i32Stack.pop(); const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); optResult = jsValue; } else { @@ -450,9 +446,9 @@ export async function createInstantiator(options, swift) { roundTripJSValue: function bjs_roundTripJSValue(value) { const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); instance.exports.bjs_roundTripJSValue(valueKind, valuePayload1, valuePayload2); - const jsValuePayload2 = tmpRetF64s.pop(); - const jsValuePayload1 = tmpRetInts.pop(); - const jsValueKind = tmpRetInts.pop(); + const jsValuePayload2 = f64Stack.pop(); + const jsValuePayload1 = i32Stack.pop(); + const jsValueKind = i32Stack.pop(); const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); return jsValue; }, @@ -460,12 +456,12 @@ export async function createInstantiator(options, swift) { const isSome = value != null; const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); instance.exports.bjs_roundTripOptionalJSValue(+isSome, valueKind, valuePayload1, valuePayload2); - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { - const jsValuePayload2 = tmpRetF64s.pop(); - const jsValuePayload1 = tmpRetInts.pop(); - const jsValueKind = tmpRetInts.pop(); + const jsValuePayload2 = f64Stack.pop(); + const jsValuePayload1 = i32Stack.pop(); + const jsValueKind = i32Stack.pop(); const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); optResult = jsValue; } else { @@ -477,18 +473,18 @@ export async function createInstantiator(options, swift) { const arrayCleanups = []; for (const elem of values) { const [elemKind, elemPayload1, elemPayload2] = __bjs_jsValueLower(elem); - tmpParamInts.push(elemKind); - tmpParamInts.push(elemPayload1); - tmpParamF64s.push(elemPayload2); + i32Stack.push(elemKind); + i32Stack.push(elemPayload1); + f64Stack.push(elemPayload2); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); instance.exports.bjs_roundTripJSValueArray(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const jsValuePayload2 = tmpRetF64s.pop(); - const jsValuePayload1 = tmpRetInts.pop(); - const jsValueKind = tmpRetInts.pop(); + const jsValuePayload2 = f64Stack.pop(); + const jsValuePayload1 = i32Stack.pop(); + const jsValueKind = i32Stack.pop(); const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); arrayResult.push(jsValue); } @@ -503,23 +499,23 @@ export async function createInstantiator(options, swift) { const arrayCleanups = []; for (const elem of values) { const [elemKind, elemPayload1, elemPayload2] = __bjs_jsValueLower(elem); - tmpParamInts.push(elemKind); - tmpParamInts.push(elemPayload1); - tmpParamF64s.push(elemPayload2); + i32Stack.push(elemKind); + i32Stack.push(elemPayload1); + f64Stack.push(elemPayload2); } - tmpParamInts.push(values.length); + i32Stack.push(values.length); valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); } instance.exports.bjs_roundTripOptionalJSValueArray(+isSome); - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const jsValuePayload2 = tmpRetF64s.pop(); - const jsValuePayload1 = tmpRetInts.pop(); - const jsValueKind = tmpRetInts.pop(); + const jsValuePayload2 = f64Stack.pop(); + const jsValuePayload1 = i32Stack.pop(); + const jsValueKind = i32Stack.pop(); const jsValue = __bjs_jsValueLift(jsValueKind, jsValuePayload1, jsValuePayload2); arrayResult.push(jsValue); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index 4ac3b11b7..d9521754f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -70,36 +66,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index 9eb55f30b..907e955b1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -70,36 +66,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index e81a95669..cbeae41d8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -70,36 +66,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index c8d0b935e..92aeeae95 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -70,36 +66,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index bb2c93649..e2f425455 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -70,36 +66,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 0d45b2169..923a1f354 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -71,36 +67,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js index 2d754a5c3..e148b94ac 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -71,36 +67,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js index f348869b2..b803936d0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -71,36 +67,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index 7be6cd924..916d5e1b5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -70,36 +66,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 0ed0be7b6..ee1a2345c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -42,16 +42,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -66,15 +62,15 @@ export async function createInstantiator(options, swift) { case ResultValues.Tag.Success: { const bytes = textEncoder.encode(value.param0); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const cleanup = () => { swift.memory.release(id); }; return { caseId: ResultValues.Tag.Success, cleanup }; } case ResultValues.Tag.Failure: { - tmpParamInts.push((value.param0 | 0)); + i32Stack.push((value.param0 | 0)); const cleanup = undefined; return { caseId: ResultValues.Tag.Failure, cleanup }; } @@ -85,11 +81,11 @@ export async function createInstantiator(options, swift) { tag = tag | 0; switch (tag) { case ResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); return { tag: ResultValues.Tag.Success, param0: string }; } case ResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); return { tag: ResultValues.Tag.Failure, param0: int }; } default: throw new Error("Unknown ResultValues tag returned from Swift: " + String(tag)); @@ -133,36 +129,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } @@ -689,9 +685,9 @@ export async function createInstantiator(options, swift) { const arrayCleanups = []; for (const elem of delegates) { const objId = swift.memory.retain(elem); - tmpParamInts.push(objId); + i32Stack.push(objId); } - tmpParamInts.push(delegates.length); + i32Stack.push(delegates.length); const ret = instance.exports.bjs_DelegateManager_init(); for (const cleanup of arrayCleanups) { cleanup(); } return DelegateManager.__construct(ret); @@ -701,10 +697,10 @@ export async function createInstantiator(options, swift) { } get delegates() { instance.exports.bjs_DelegateManager_delegates_get(this.pointer); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const objId = tmpRetInts.pop(); + const objId = i32Stack.pop(); const obj = swift.memory.getObject(objId); swift.memory.release(objId); arrayResult.push(obj); @@ -716,9 +712,9 @@ export async function createInstantiator(options, swift) { const arrayCleanups = []; for (const elem of value) { const objId = swift.memory.retain(elem); - tmpParamInts.push(objId); + i32Stack.push(objId); } - tmpParamInts.push(value.length); + i32Stack.push(value.length); instance.exports.bjs_DelegateManager_delegates_set(this.pointer); for (const cleanup of arrayCleanups) { cleanup(); } } @@ -734,14 +730,14 @@ export async function createInstantiator(options, swift) { const arrayCleanups = []; for (const elem of delegates) { const objId = swift.memory.retain(elem); - tmpParamInts.push(objId); + i32Stack.push(objId); } - tmpParamInts.push(delegates.length); + i32Stack.push(delegates.length); instance.exports.bjs_processDelegates(); - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { - const objId1 = tmpRetInts.pop(); + const objId1 = i32Stack.pop(); const obj = swift.memory.getObject(objId1); swift.memory.release(objId1); arrayResult.push(obj); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 7579c72f7..d07af4cdb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -29,16 +29,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -53,15 +49,15 @@ export async function createInstantiator(options, swift) { case APIResultValues.Tag.Success: { const bytes = textEncoder.encode(value.param0); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const cleanup = () => { swift.memory.release(id); }; return { caseId: APIResultValues.Tag.Success, cleanup }; } case APIResultValues.Tag.Failure: { - tmpParamInts.push((value.param0 | 0)); + i32Stack.push((value.param0 | 0)); const cleanup = undefined; return { caseId: APIResultValues.Tag.Failure, cleanup }; } @@ -72,11 +68,11 @@ export async function createInstantiator(options, swift) { tag = tag | 0; switch (tag) { case APIResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); return { tag: APIResultValues.Tag.Success, param0: string }; } case APIResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); return { tag: APIResultValues.Tag.Failure, param0: int }; } default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); @@ -120,36 +116,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } @@ -335,7 +331,7 @@ export async function createInstantiator(options, swift) { roundtrip: function(value) { const { caseId: valueCaseId, cleanup: valueCleanup } = enumHelpers.APIResult.lower(value); instance.exports.bjs_APIResult_static_roundtrip(valueCaseId); - const ret = enumHelpers.APIResult.lift(tmpRetTag.pop()); + const ret = enumHelpers.APIResult.lift(tagStack.pop()); if (valueCleanup) { valueCleanup(); } return ret; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index bb3920888..63c5c964b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -29,16 +29,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -53,15 +49,15 @@ export async function createInstantiator(options, swift) { case APIResultValues.Tag.Success: { const bytes = textEncoder.encode(value.param0); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const cleanup = () => { swift.memory.release(id); }; return { caseId: APIResultValues.Tag.Success, cleanup }; } case APIResultValues.Tag.Failure: { - tmpParamInts.push((value.param0 | 0)); + i32Stack.push((value.param0 | 0)); const cleanup = undefined; return { caseId: APIResultValues.Tag.Failure, cleanup }; } @@ -72,11 +68,11 @@ export async function createInstantiator(options, swift) { tag = tag | 0; switch (tag) { case APIResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); return { tag: APIResultValues.Tag.Success, param0: string }; } case APIResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); return { tag: APIResultValues.Tag.Failure, param0: int }; } default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); @@ -120,36 +116,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } @@ -329,7 +325,7 @@ export async function createInstantiator(options, swift) { roundtrip: function(value) { const { caseId: valueCaseId, cleanup: valueCleanup } = enumHelpers.APIResult.lower(value); instance.exports.bjs_APIResult_static_roundtrip(valueCaseId); - const ret = enumHelpers.APIResult.lift(tmpRetTag.pop()); + const ret = enumHelpers.APIResult.lift(tagStack.pop()); if (valueCleanup) { valueCleanup(); } return ret; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index 293ae4f7d..c1d59bf69 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -23,16 +23,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -75,36 +71,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index 27e3df464..f086f2919 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -23,16 +23,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -75,36 +71,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js index e57c5153d..20ea91e3c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -71,36 +67,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js index 74d140236..0f002bf31 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -71,36 +67,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index 27398d2a4..ee4333f03 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -70,36 +66,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 36b712362..bc0def6f1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -48,16 +48,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -72,30 +68,30 @@ export async function createInstantiator(options, swift) { case APIResultValues.Tag.Success: { const bytes = textEncoder.encode(value.param0); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const cleanup = () => { swift.memory.release(id); }; return { caseId: APIResultValues.Tag.Success, cleanup }; } case APIResultValues.Tag.Failure: { - tmpParamInts.push((value.param0 | 0)); + i32Stack.push((value.param0 | 0)); const cleanup = undefined; return { caseId: APIResultValues.Tag.Failure, cleanup }; } case APIResultValues.Tag.Flag: { - tmpParamInts.push(value.param0 ? 1 : 0); + i32Stack.push(value.param0 ? 1 : 0); const cleanup = undefined; return { caseId: APIResultValues.Tag.Flag, cleanup }; } case APIResultValues.Tag.Rate: { - tmpParamF32s.push(Math.fround(value.param0)); + f32Stack.push(Math.fround(value.param0)); const cleanup = undefined; return { caseId: APIResultValues.Tag.Rate, cleanup }; } case APIResultValues.Tag.Precise: { - tmpParamF64s.push(value.param0); + f64Stack.push(value.param0); const cleanup = undefined; return { caseId: APIResultValues.Tag.Precise, cleanup }; } @@ -110,23 +106,23 @@ export async function createInstantiator(options, swift) { tag = tag | 0; switch (tag) { case APIResultValues.Tag.Success: { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); return { tag: APIResultValues.Tag.Success, param0: string }; } case APIResultValues.Tag.Failure: { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); return { tag: APIResultValues.Tag.Failure, param0: int }; } case APIResultValues.Tag.Flag: { - const bool = tmpRetInts.pop() !== 0; + const bool = i32Stack.pop() !== 0; return { tag: APIResultValues.Tag.Flag, param0: bool }; } case APIResultValues.Tag.Rate: { - const f32 = tmpRetF32s.pop(); + const f32 = f32Stack.pop(); return { tag: APIResultValues.Tag.Rate, param0: f32 }; } case APIResultValues.Tag.Precise: { - const f64 = tmpRetF64s.pop(); + const f64 = f64Stack.pop(); return { tag: APIResultValues.Tag.Precise, param0: f64 }; } case APIResultValues.Tag.Info: return { tag: APIResultValues.Tag.Info }; @@ -171,36 +167,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index 52e12ef7c..6c1397fff 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -71,36 +67,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index b22afee4d..b4cf995cb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -23,16 +23,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -42,51 +38,51 @@ export async function createInstantiator(options, swift) { const __bjs_createDataPointHelpers = () => { return () => ({ lower: (value) => { - tmpParamF64s.push(value.x); - tmpParamF64s.push(value.y); + f64Stack.push(value.x); + f64Stack.push(value.y); const bytes = textEncoder.encode(value.label); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const isSome = value.optCount != null; if (isSome) { - tmpParamInts.push(value.optCount | 0); + i32Stack.push(value.optCount | 0); } else { - tmpParamInts.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? 1 : 0); const isSome1 = value.optFlag != null; if (isSome1) { - tmpParamInts.push(value.optFlag ? 1 : 0); + i32Stack.push(value.optFlag ? 1 : 0); } else { - tmpParamInts.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome1 ? 1 : 0); + i32Stack.push(isSome1 ? 1 : 0); const cleanup = () => { swift.memory.release(id); }; return { cleanup }; }, lift: () => { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const bool = tmpRetInts.pop() !== 0; + const bool = i32Stack.pop() !== 0; optional = bool; } else { optional = null; } - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optional1; if (isSome1) { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); optional1 = int; } else { optional1 = null; } - const string = tmpRetStrings.pop(); - const f64 = tmpRetF64s.pop(); - const f641 = tmpRetF64s.pop(); + const string = strStack.pop(); + const f64 = f64Stack.pop(); + const f641 = f64Stack.pop(); return { x: f641, y: f64, label: string, optCount: optional1, optFlag: optional }; } }); @@ -96,19 +92,19 @@ export async function createInstantiator(options, swift) { lower: (value) => { const bytes = textEncoder.encode(value.street); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); const bytes1 = textEncoder.encode(value.city); const id1 = swift.memory.retain(bytes1); - tmpParamInts.push(bytes1.length); - tmpParamInts.push(id1); + i32Stack.push(bytes1.length); + i32Stack.push(id1); const isSome = value.zipCode != null; if (isSome) { - tmpParamInts.push(value.zipCode | 0); + i32Stack.push(value.zipCode | 0); } else { - tmpParamInts.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? 1 : 0); const cleanup = () => { swift.memory.release(id); swift.memory.release(id1); @@ -116,16 +112,16 @@ export async function createInstantiator(options, swift) { return { cleanup }; }, lift: () => { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); optional = int; } else { optional = null; } - const string = tmpRetStrings.pop(); - const string1 = tmpRetStrings.pop(); + const string = strStack.pop(); + const string1 = strStack.pop(); return { street: string1, city: string, zipCode: optional }; } }); @@ -135,22 +131,22 @@ export async function createInstantiator(options, swift) { lower: (value) => { const bytes = textEncoder.encode(value.name); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); - tmpParamInts.push((value.age | 0)); + i32Stack.push(bytes.length); + i32Stack.push(id); + i32Stack.push((value.age | 0)); const structResult = structHelpers.Address.lower(value.address); const isSome = value.email != null; let id1; if (isSome) { const bytes1 = textEncoder.encode(value.email); id1 = swift.memory.retain(bytes1); - tmpParamInts.push(bytes1.length); - tmpParamInts.push(id1); + i32Stack.push(bytes1.length); + i32Stack.push(id1); } else { - tmpParamInts.push(0); - tmpParamInts.push(0); + i32Stack.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? 1 : 0); const cleanup = () => { swift.memory.release(id); if (structResult.cleanup) { structResult.cleanup(); } @@ -159,17 +155,17 @@ export async function createInstantiator(options, swift) { return { cleanup }; }, lift: () => { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const string = tmpRetStrings.pop(); + const string = strStack.pop(); optional = string; } else { optional = null; } const struct = structHelpers.Address.lift(); - const int = tmpRetInts.pop(); - const string1 = tmpRetStrings.pop(); + const int = i32Stack.pop(); + const string1 = strStack.pop(); return { name: string1, age: int, address: struct, email: optional }; } }); @@ -177,14 +173,14 @@ export async function createInstantiator(options, swift) { const __bjs_createSessionHelpers = () => { return () => ({ lower: (value) => { - tmpParamInts.push((value.id | 0)); - tmpParamPointers.push(value.owner.pointer); + i32Stack.push((value.id | 0)); + ptrStack.push(value.owner.pointer); return { cleanup: undefined }; }, lift: () => { - const ptr = tmpRetPointers.pop(); + const ptr = ptrStack.pop(); const obj = _exports['Greeter'].__construct(ptr); - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); return { id: int, owner: obj }; } }); @@ -192,28 +188,28 @@ export async function createInstantiator(options, swift) { const __bjs_createMeasurementHelpers = () => { return () => ({ lower: (value) => { - tmpParamF64s.push(value.value); - tmpParamF32s.push(Math.fround(value.precision)); + f64Stack.push(value.value); + f32Stack.push(Math.fround(value.precision)); const isSome = value.optionalPrecision != null; if (isSome) { - tmpParamF32s.push(Math.fround(value.optionalPrecision)); + f32Stack.push(Math.fround(value.optionalPrecision)); } else { - tmpParamF32s.push(0.0); + f32Stack.push(0.0); } - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? 1 : 0); return { cleanup: undefined }; }, lift: () => { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const rawValue = tmpRetF32s.pop(); + const rawValue = f32Stack.pop(); optional = rawValue; } else { optional = null; } - const rawValue1 = tmpRetF32s.pop(); - const f64 = tmpRetF64s.pop(); + const rawValue1 = f32Stack.pop(); + const f64 = f64Stack.pop(); return { value: f64, precision: rawValue1, optionalPrecision: optional }; } }); @@ -237,17 +233,17 @@ export async function createInstantiator(options, swift) { } else { id = undefined; } - tmpParamInts.push(id !== undefined ? id : 0); + i32Stack.push(id !== undefined ? id : 0); const isSome = value.optionalObject != null; let id1; if (isSome) { id1 = swift.memory.retain(value.optionalObject); - tmpParamInts.push(id1); + i32Stack.push(id1); } else { id1 = undefined; - tmpParamInts.push(0); + i32Stack.push(0); } - tmpParamInts.push(isSome ? 1 : 0); + i32Stack.push(isSome ? 1 : 0); const cleanup = () => { if(id !== undefined && id !== 0) { try { @@ -265,10 +261,10 @@ export async function createInstantiator(options, swift) { return { cleanup }; }, lift: () => { - const isSome = tmpRetInts.pop(); + const isSome = i32Stack.pop(); let optional; if (isSome) { - const objectId = tmpRetInts.pop(); + const objectId = i32Stack.pop(); let value; if (objectId !== 0) { value = swift.memory.getObject(objectId); @@ -280,7 +276,7 @@ export async function createInstantiator(options, swift) { } else { optional = null; } - const objectId1 = tmpRetInts.pop(); + const objectId1 = i32Stack.pop(); let value1; if (objectId1 !== 0) { value1 = swift.memory.getObject(objectId1); @@ -328,36 +324,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index f6f63ba8d..959572255 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -37,13 +33,13 @@ export async function createInstantiator(options, swift) { const __bjs_createPointHelpers = () => { return () => ({ lower: (value) => { - tmpParamInts.push((value.x | 0)); - tmpParamInts.push((value.y | 0)); + i32Stack.push((value.x | 0)); + i32Stack.push((value.y | 0)); return { cleanup: undefined }; }, lift: () => { - const int = tmpRetInts.pop(); - const int1 = tmpRetInts.pop(); + const int = i32Stack.pop(); + const int1 = i32Stack.pop(); return { x: int1, y: int }; } }); @@ -85,36 +81,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js index 2e2f8bf6a..487645d70 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -70,36 +66,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index 9d94d5f0a..dc478a642 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -37,19 +33,19 @@ export async function createInstantiator(options, swift) { const __bjs_createPointerFieldsHelpers = () => { return () => ({ lower: (value) => { - tmpParamPointers.push((value.raw | 0)); - tmpParamPointers.push((value.mutRaw | 0)); - tmpParamPointers.push((value.opaque | 0)); - tmpParamPointers.push((value.ptr | 0)); - tmpParamPointers.push((value.mutPtr | 0)); + ptrStack.push((value.raw | 0)); + ptrStack.push((value.mutRaw | 0)); + ptrStack.push((value.opaque | 0)); + ptrStack.push((value.ptr | 0)); + ptrStack.push((value.mutPtr | 0)); return { cleanup: undefined }; }, lift: () => { - const pointer = tmpRetPointers.pop(); - const pointer1 = tmpRetPointers.pop(); - const pointer2 = tmpRetPointers.pop(); - const pointer3 = tmpRetPointers.pop(); - const pointer4 = tmpRetPointers.pop(); + const pointer = ptrStack.pop(); + const pointer1 = ptrStack.pop(); + const pointer2 = ptrStack.pop(); + const pointer3 = ptrStack.pop(); + const pointer4 = ptrStack.pop(); return { raw: pointer4, mutRaw: pointer3, opaque: pointer2, ptr: pointer1, mutPtr: pointer }; } }); @@ -90,36 +86,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js index 45374093b..428c422e0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -71,36 +67,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } From 72ec08dda19736c2f94c0908a3e5727955a44b6a Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 5 Feb 2026 19:49:56 +0900 Subject: [PATCH 164/252] BridgeJS: Add Dictionary support (#581) --- .../Sources/BridgeJSCore/ExportSwift.swift | 136 +++++- .../Sources/BridgeJSCore/ImportTS.swift | 4 +- .../BridgeJSCore/SwiftToSkeleton.swift | 39 ++ .../Sources/BridgeJSLink/BridgeJSLink.swift | 5 + .../Sources/BridgeJSLink/JSGlueGen.swift | 190 ++++++- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 7 + .../Inputs/MacroSwift/DictionaryTypes.swift | 15 + .../BridgeJSCodegenTests/DictionaryTypes.json | 259 ++++++++++ .../DictionaryTypes.swift | 97 ++++ .../BridgeJSLinkTests/DictionaryTypes.d.ts | 34 ++ .../BridgeJSLinkTests/DictionaryTypes.js | 462 ++++++++++++++++++ .../JavaScriptKit/BridgeJSIntrinsics.swift | 119 +++++ .../DictionaryTests.swift | 96 ++++ .../BridgeJSRuntimeTests/ExportAPITests.swift | 8 + .../Generated/BridgeJS.swift | 166 +++++++ .../Generated/JavaScript/BridgeJS.json | 319 ++++++++++++ Tests/prelude.mjs | 29 ++ 17 files changed, 1978 insertions(+), 7 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/DictionaryTypes.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js create mode 100644 Tests/BridgeJSRuntimeTests/DictionaryTests.swift diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 51ff91695..aa01a2c5c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -832,6 +832,8 @@ struct StackCodegen { return liftNullableExpression(wrappedType: wrappedType, kind: kind) case .array(let elementType): return liftArrayExpression(elementType: elementType) + case .dictionary(let valueType): + return liftDictionaryExpression(valueType: valueType) case .closure: return "JSObject.bridgeJSLiftParameter()" case .void, .namespaceEnum: @@ -849,7 +851,7 @@ struct StackCodegen { return liftArrayExpressionInline(elementType: elementType) case .swiftProtocol(let protocolName): return "[Any\(raw: protocolName)].bridgeJSLiftParameter()" - case .nullable, .array, .closure: + case .nullable, .array, .closure, .dictionary: return liftArrayExpressionInline(elementType: elementType) case .void, .namespaceEnum: fatalError("Invalid array element type: \(elementType)") @@ -873,6 +875,51 @@ struct StackCodegen { """ } + func liftDictionaryExpression(valueType: BridgeType) -> ExprSyntax { + switch valueType { + case .int, .uint, .float, .double, .string, .bool, .jsValue, + .jsObject(nil), .swiftStruct, .caseEnum, .swiftHeapObject, + .unsafePointer, .rawValueEnum, .associatedValueEnum: + return "[String: \(raw: valueType.swiftType)].bridgeJSLiftParameter()" + case .jsObject(let className?): + return """ + { + let __dict = [String: JSObject].bridgeJSLiftParameter() + return __dict.mapValues { \(raw: className)(unsafelyWrapping: $0) } + }() + """ + case .swiftProtocol(let protocolName): + return """ + { + let __dict = [String: JSObject].bridgeJSLiftParameter() + return __dict.mapValues { $0 as! Any\(raw: protocolName) } + }() + """ + case .nullable, .array, .dictionary, .closure: + return liftDictionaryExpressionInline(valueType: valueType) + case .void, .namespaceEnum: + fatalError("Invalid dictionary value type: \(valueType)") + } + } + + private func liftDictionaryExpressionInline(valueType: BridgeType) -> ExprSyntax { + let valueLift = liftExpression(for: valueType) + let swiftTypeName = valueType.swiftType + return """ + { + let __count = Int(_swift_js_pop_i32()) + var __result: [String: \(raw: swiftTypeName)] = [:] + __result.reserveCapacity(__count) + for _ in 0..<__count { + let __value = \(valueLift) + let __key = String.bridgeJSLiftParameter() + __result[__key] = __value + } + return __result + }() + """ + } + private func liftNullableExpression(wrappedType: BridgeType, kind: JSOptionalKind) -> ExprSyntax { let typeName = kind == .null ? "Optional" : "JSUndefinedOr" switch wrappedType { @@ -897,6 +944,23 @@ struct StackCodegen { } }() """ + case .dictionary(let valueType): + let dictionaryLift = liftDictionaryExpression(valueType: valueType) + let swiftTypeName = valueType.swiftType + let absentExpr = + kind == .null + ? "\(typeName)<[String: \(swiftTypeName)]>.none" + : "\(typeName)<[String: \(swiftTypeName)]>.undefinedValue" + return """ + { + let __isSome = _swift_js_pop_i32() + if __isSome == 0 { + return \(raw: absentExpr) + } else { + return \(dictionaryLift) + } + }() + """ case .nullable, .void, .namespaceEnum, .closure, .unsafePointer, .swiftProtocol: fatalError("Invalid nullable wrapped type: \(wrappedType)") } @@ -935,6 +999,8 @@ struct StackCodegen { return [] case .array(let elementType): return lowerArrayStatements(elementType: elementType, accessor: accessor, varPrefix: varPrefix) + case .dictionary(let valueType): + return lowerDictionaryStatements(valueType: valueType, accessor: accessor, varPrefix: varPrefix) } } @@ -952,7 +1018,7 @@ struct StackCodegen { return ["\(raw: accessor).map { $0.jsObject }.bridgeJSLowerReturn()"] case .swiftProtocol(let protocolName): return ["\(raw: accessor).map { $0 as! Any\(raw: protocolName) }.bridgeJSLowerReturn()"] - case .nullable, .array, .closure: + case .nullable, .array, .closure, .dictionary: return lowerArrayStatementsInline( elementType: elementType, accessor: accessor, @@ -986,6 +1052,65 @@ struct StackCodegen { return statements } + private func lowerDictionaryStatements( + valueType: BridgeType, + accessor: String, + varPrefix: String + ) -> [CodeBlockItemSyntax] { + switch valueType { + case .int, .uint, .float, .double, .string, .bool, .jsValue, + .jsObject(nil), .swiftStruct, .caseEnum, .swiftHeapObject, + .unsafePointer, .rawValueEnum, .associatedValueEnum: + return ["\(raw: accessor).bridgeJSLowerReturn()"] + case .jsObject(_?): + return ["\(raw: accessor).mapValues { $0.jsObject }.bridgeJSLowerReturn()"] + case .swiftProtocol(let protocolName): + return ["\(raw: accessor).mapValues { $0 as! Any\(raw: protocolName) }.bridgeJSLowerReturn()"] + case .nullable, .array, .dictionary, .closure: + return lowerDictionaryStatementsInline( + valueType: valueType, + accessor: accessor, + varPrefix: varPrefix + ) + case .void, .namespaceEnum: + fatalError("Invalid dictionary value type: \(valueType)") + } + } + + private func lowerDictionaryStatementsInline( + valueType: BridgeType, + accessor: String, + varPrefix: String + ) -> [CodeBlockItemSyntax] { + var statements: [CodeBlockItemSyntax] = [] + let pairVarName = "__bjs_kv_\(varPrefix)" + statements.append("for \(raw: pairVarName) in \(raw: accessor) {") + statements.append("let __bjs_key_\(raw: varPrefix) = \(raw: pairVarName).key") + statements.append("let __bjs_value_\(raw: varPrefix) = \(raw: pairVarName).value") + + let keyStatements = lowerStatements( + for: .string, + accessor: "__bjs_key_\(varPrefix)", + varPrefix: "\(varPrefix)_key" + ) + for stmt in keyStatements { + statements.append(stmt) + } + + let valueStatements = lowerStatements( + for: valueType, + accessor: "__bjs_value_\(varPrefix)", + varPrefix: "\(varPrefix)_value" + ) + for stmt in valueStatements { + statements.append(stmt) + } + + statements.append("}") + statements.append("_swift_js_push_i32(Int32(\(raw: accessor).count))") + return statements + } + private func lowerOptionalStatements( wrappedType: BridgeType, accessor: String, @@ -1033,6 +1158,8 @@ struct StackCodegen { return ["\(raw: unwrappedVar).jsObject.bridgeJSLowerStackReturn()"] case .array(let elementType): return lowerArrayStatements(elementType: elementType, accessor: unwrappedVar, varPrefix: varPrefix) + case .dictionary(let valueType): + return lowerDictionaryStatements(valueType: valueType, accessor: unwrappedVar, varPrefix: varPrefix) default: return ["preconditionFailure(\"BridgeJS: unsupported optional wrapped type\")"] } @@ -1616,6 +1743,7 @@ extension BridgeType { case .nullable(let wrappedType, let kind): return kind == .null ? "Optional<\(wrappedType.swiftType)>" : "JSUndefinedOr<\(wrappedType.swiftType)>" case .array(let elementType): return "[\(elementType.swiftType)]" + case .dictionary(let valueType): return "[String: \(valueType.swiftType)]" case .caseEnum(let name): return name case .rawValueEnum(let name, _): return name case .associatedValueEnum(let name): return name @@ -1675,7 +1803,7 @@ extension BridgeType { throw BridgeJSCoreError("Namespace enums are not supported to pass as parameters") case .closure: return LiftingIntrinsicInfo(parameters: [("callbackId", .i32)]) - case .array: + case .array, .dictionary: return LiftingIntrinsicInfo(parameters: []) } } @@ -1726,7 +1854,7 @@ extension BridgeType { throw BridgeJSCoreError("Namespace enums are not supported to pass as parameters") case .closure: return .swiftHeapObject - case .array: + case .array, .dictionary: return .array } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 8db872c6e..7c3ecd6ea 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -980,7 +980,7 @@ extension BridgeType { var params = [("isSome", WasmCoreType.i32)] params.append(contentsOf: wrappedInfo.loweredParameters) return LoweringParameterInfo(loweredParameters: params) - case .array: + case .array, .dictionary: return LoweringParameterInfo(loweredParameters: []) } } @@ -1059,7 +1059,7 @@ extension BridgeType { case .nullable(let wrappedType, _): let wrappedInfo = try wrappedType.liftingReturnInfo(context: context) return LiftingReturnInfo(valueToLift: wrappedInfo.valueToLift) - case .array: + case .array, .dictionary: return LiftingReturnInfo(valueToLift: nil) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index 3de74f74b..e571d955e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -213,6 +213,45 @@ public final class SwiftToSkeleton { return .array(elementType) } } + // [String: T] + if let dictType = type.as(DictionaryTypeSyntax.self) { + if let keyType = lookupType(for: dictType.key, errors: &errors), + keyType == .string, + let valueType = lookupType(for: dictType.value, errors: &errors) + { + return .dictionary(valueType) + } + } + // Dictionary + if let identifierType = type.as(IdentifierTypeSyntax.self), + identifierType.name.text == "Dictionary", + let genericArgs = identifierType.genericArgumentClause?.arguments, + genericArgs.count == 2, + let keyArg = TypeSyntax(genericArgs.first?.argument), + let valueArg = TypeSyntax(genericArgs.last?.argument), + let keyType = lookupType(for: keyArg, errors: &errors), + keyType == .string + { + if let valueType = lookupType(for: valueArg, errors: &errors) { + return .dictionary(valueType) + } + } + // Swift.Dictionary + if let memberType = type.as(MemberTypeSyntax.self), + let baseType = memberType.baseType.as(IdentifierTypeSyntax.self), + baseType.name.text == "Swift", + memberType.name.text == "Dictionary", + let genericArgs = memberType.genericArgumentClause?.arguments, + genericArgs.count == 2, + let keyArg = TypeSyntax(genericArgs.first?.argument), + let valueArg = TypeSyntax(genericArgs.last?.argument), + let keyType = lookupType(for: keyArg, errors: &errors), + keyType == .string + { + if let valueType = lookupType(for: valueArg, errors: &errors) { + return .dictionary(valueType) + } + } if let aliasDecl = typeDeclResolver.resolveTypeAlias(type) { if let resolvedType = lookupType(for: aliasDecl.initializer.value, errors: &errors) { return resolvedType diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index c2b0c6ed3..9303962a6 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -1462,6 +1462,9 @@ public struct BridgeJSLink { return "(\(elementTypeStr))[]" } return "\(elementTypeStr)[]" + case .dictionary(let valueType): + let valueTypeStr = resolveTypeScriptType(valueType, exportedSkeletons: exportedSkeletons) + return "Record" default: return type.tsType } @@ -3564,6 +3567,8 @@ extension BridgeType { return "(\(inner))[]" } return "\(inner)[]" + case .dictionary(let valueType): + return "Record" } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index ae83f33e6..0b170d5d5 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -737,6 +737,23 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") resultExpr = arrayVar + case .dictionary(let valueType): + let dictVar = scope.variable("dictValue") + printer.write("let \(dictVar);") + printer.write("if (\(isSome)) {") + printer.indent { + let dictLiftFragment = try! dictionaryLift(valueType: valueType) + let liftResults = dictLiftFragment.printCode([], scope, printer, cleanupCode) + if let liftResult = liftResults.first { + printer.write("\(dictVar) = \(liftResult);") + } + } + printer.write("} else {") + printer.indent { + printer.write("\(dictVar) = \(absenceLiteral);") + } + printer.write("}") + resultExpr = dictVar default: resultExpr = "\(isSome) ? \(wrappedValue) : \(absenceLiteral)" } @@ -830,6 +847,23 @@ struct IntrinsicJSFragment: Sendable { printer.write("}") cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") return ["+\(isSomeVar)"] + case .dictionary(let valueType): + let cleanupArrayVar = scope.variable("\(value)Cleanups") + printer.write("const \(cleanupArrayVar) = [];") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let dictLowerFragment = try! dictionaryLower(valueType: valueType) + let dictCleanup = CodeFragmentPrinter() + let _ = dictLowerFragment.printCode([value], scope, printer, dictCleanup) + if !dictCleanup.lines.isEmpty { + for line in dictCleanup.lines { + printer.write("\(cleanupArrayVar).push(() => { \(line) });") + } + } + } + printer.write("}") + cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") + return ["+\(isSomeVar)"] default: switch wrappedType { case .swiftHeapObject: @@ -981,6 +1015,23 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(resultVar) = \(absenceLiteral);") } printer.write("}") + case .dictionary(let valueType): + let isSomeVar = scope.variable("isSome") + printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("let \(resultVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + let dictLiftFragment = try! dictionaryLift(valueType: valueType) + let liftResults = dictLiftFragment.printCode([], scope, printer, cleanupCode) + if let liftResult = liftResults.first { + printer.write("\(resultVar) = \(liftResult);") + } + } + printer.write("} else {") + printer.indent { + printer.write("\(resultVar) = \(absenceLiteral);") + } + printer.write("}") case .jsValue: let isSomeVar = scope.variable("isSome") printer.write("const \(isSomeVar) = \(scope.popI32Return());") @@ -1133,6 +1184,52 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") + case .dictionary(let valueType): + printer.write("if (\(isSomeVar)) {") + printer.indent { + let cleanupArrayVar = scope.variable("arrayCleanups") + let entriesVar = scope.variable("entries") + let entryVar = scope.variable("entry") + printer.write("const \(cleanupArrayVar) = [];") + printer.write("const \(entriesVar) = Object.entries(\(value));") + printer.write("for (const \(entryVar) of \(entriesVar)) {") + printer.indent { + let keyVar = scope.variable("key") + let valueVar = scope.variable("value") + printer.write("const [\(keyVar), \(valueVar)] = \(entryVar);") + + let keyFragment = try! stackLowerFragment(elementType: .string) + let keyCleanup = CodeFragmentPrinter() + let _ = keyFragment.printCode([keyVar], scope, printer, keyCleanup) + if !keyCleanup.lines.isEmpty { + printer.write("\(cleanupArrayVar).push(() => {") + printer.indent { + for line in keyCleanup.lines { + printer.write(line) + } + } + printer.write("});") + } + + let valueFragment = try! stackLowerFragment(elementType: valueType) + let valueCleanup = CodeFragmentPrinter() + let _ = valueFragment.printCode([valueVar], scope, printer, valueCleanup) + if !valueCleanup.lines.isEmpty { + printer.write("\(cleanupArrayVar).push(() => {") + printer.indent { + for line in valueCleanup.lines { + printer.write(line) + } + } + printer.write("});") + } + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(entriesVar).length);") + cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") default: () } @@ -1807,6 +1904,8 @@ struct IntrinsicJSFragment: Sendable { throw BridgeJSLinkError(message: "Namespace enums are not supported to be passed as parameters: \(string)") case .array(let elementType): return try arrayLower(elementType: elementType) + case .dictionary(let valueType): + return try dictionaryLower(valueType: valueType) } } @@ -1854,6 +1953,8 @@ struct IntrinsicJSFragment: Sendable { ) case .array(let elementType): return try arrayLift(elementType: elementType) + case .dictionary(let valueType): + return try dictionaryLift(valueType: valueType) } } @@ -1945,6 +2046,8 @@ struct IntrinsicJSFragment: Sendable { ) case .array(let elementType): return try arrayLift(elementType: elementType) + case .dictionary(let valueType): + return try dictionaryLift(valueType: valueType) } } @@ -2014,6 +2117,8 @@ struct IntrinsicJSFragment: Sendable { ) case .array(let elementType): return try arrayLower(elementType: elementType) + case .dictionary(let valueType): + return try dictionaryLower(valueType: valueType) } } @@ -2607,6 +2712,58 @@ struct IntrinsicJSFragment: Sendable { ) } + /// Lowers a dictionary from JS to Swift by iterating entries and pushing to stacks + static func dictionaryLower(valueType: BridgeType) throws -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: ["dict"], + printCode: { arguments, scope, printer, cleanupCode in + let dict = arguments[0] + let cleanupArrayVar = scope.variable("arrayCleanups") + + printer.write("const \(cleanupArrayVar) = [];") + let entriesVar = scope.variable("entries") + let entryVar = scope.variable("entry") + printer.write("const \(entriesVar) = Object.entries(\(dict));") + printer.write("for (const \(entryVar) of \(entriesVar)) {") + printer.indent { + let keyVar = scope.variable("key") + let valueVar = scope.variable("value") + printer.write("const [\(keyVar), \(valueVar)] = \(entryVar);") + + let keyFragment = try! stackLowerFragment(elementType: .string) + let keyCleanup = CodeFragmentPrinter() + let _ = keyFragment.printCode([keyVar], scope, printer, keyCleanup) + if !keyCleanup.lines.isEmpty { + printer.write("\(cleanupArrayVar).push(() => {") + printer.indent { + for line in keyCleanup.lines { + printer.write(line) + } + } + printer.write("});") + } + + let valueFragment = try! stackLowerFragment(elementType: valueType) + let valueCleanup = CodeFragmentPrinter() + let _ = valueFragment.printCode([valueVar], scope, printer, valueCleanup) + if !valueCleanup.lines.isEmpty { + printer.write("\(cleanupArrayVar).push(() => {") + printer.indent { + for line in valueCleanup.lines { + printer.write(line) + } + } + printer.write("});") + } + } + printer.write("}") + printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(entriesVar).length);") + cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") + return [] + } + ) + } + /// Lifts an array from Swift to JS by popping elements from stacks static func arrayLift(elementType: BridgeType) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( @@ -2633,13 +2790,39 @@ struct IntrinsicJSFragment: Sendable { ) } + /// Lifts a dictionary from Swift to JS by popping key/value pairs from stacks + static func dictionaryLift(valueType: BridgeType) throws -> IntrinsicJSFragment { + return IntrinsicJSFragment( + parameters: [], + printCode: { arguments, scope, printer, cleanupCode in + let resultVar = scope.variable("dictResult") + let lenVar = scope.variable("dictLen") + let iVar = scope.variable("i") + + printer.write("const \(lenVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(resultVar) = {};") + printer.write("for (let \(iVar) = 0; \(iVar) < \(lenVar); \(iVar)++) {") + printer.indent { + let valueFragment = try! stackLiftFragment(elementType: valueType) + let valueResults = valueFragment.printCode([], scope, printer, cleanupCode) + let keyFragment = try! stackLiftFragment(elementType: .string) + let keyResults = keyFragment.printCode([], scope, printer, cleanupCode) + if let keyExpr = keyResults.first, let valueExpr = valueResults.first { + printer.write("\(resultVar)[\(keyExpr)] = \(valueExpr);") + } + } + printer.write("}") + return [resultVar] + } + ) + } + private static func stackLiftFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { switch elementType { case .jsValue: return IntrinsicJSFragment( parameters: [], printCode: { _, scope, printer, cleanup in - registerJSValueHelpers(scope: scope) let payload2Var = scope.variable("jsValuePayload2") let payload1Var = scope.variable("jsValuePayload1") let kindVar = scope.variable("jsValueKind") @@ -2647,6 +2830,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("const \(payload1Var) = \(scope.popI32Return());") printer.write("const \(kindVar) = \(scope.popI32Return());") let resultVar = scope.variable("jsValue") + registerJSValueHelpers(scope: scope) printer.write( "const \(resultVar) = \(jsValueLiftHelperName)(\(kindVar), \(payload1Var), \(payload2Var));" ) @@ -2795,6 +2979,8 @@ struct IntrinsicJSFragment: Sendable { ) case .array(let innerElementType): return try! arrayLift(elementType: innerElementType) + case .dictionary(let valueType): + return try! dictionaryLift(valueType: valueType) case .nullable(let wrappedType, let kind): return try optionalElementRaiseFragment(wrappedType: wrappedType, kind: kind) case .unsafePointer: @@ -2980,6 +3166,8 @@ struct IntrinsicJSFragment: Sendable { ) case .array(let innerElementType): return try! arrayLower(elementType: innerElementType) + case .dictionary(let valueType): + return try! dictionaryLower(valueType: valueType) case .nullable(let wrappedType, let kind): return try optionalElementLowerFragment( wrappedType: wrappedType, diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 0d4a78d3e..3029fe0c9 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -153,6 +153,7 @@ public enum BridgeType: Codable, Equatable, Hashable, Sendable { case unsafePointer(UnsafePointerType) indirect case nullable(BridgeType, JSOptionalKind) indirect case array(BridgeType) + indirect case dictionary(BridgeType) case caseEnum(String) case rawValueEnum(String, SwiftEnumRawType) case associatedValueEnum(String) @@ -959,6 +960,9 @@ extension BridgeType { case .array: // Arrays use stack-based return with length prefix (no direct WASM return type) return nil + case .dictionary: + // Dictionaries use stack-based return with entry count (no direct WASM return type) + return nil } } @@ -1024,6 +1028,9 @@ extension BridgeType { case .array(let elementType): // Array mangling: "Sa" prefix followed by element type return "Sa\(elementType.mangleTypeName)" + case .dictionary(let valueType): + // Dictionary mangling: "SD" prefix followed by value type (key is always String) + return "SD\(valueType.mangleTypeName)" } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/DictionaryTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/DictionaryTypes.swift new file mode 100644 index 000000000..c699ea79b --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/DictionaryTypes.swift @@ -0,0 +1,15 @@ +@JS class Box { + var value: Int + + init(value: Int) { + self.value = value + } +} + +@JS func mirrorDictionary(_ values: [String: Int]) -> [String: Int] +@JS func optionalDictionary(_ values: [String: String]?) -> [String: String]? +@JS func nestedDictionary(_ values: [String: [Int]]) -> [String: [Int]] +@JS func boxDictionary(_ boxes: [String: Box]) -> [String: Box] +@JS func optionalBoxDictionary(_ boxes: [String: Box?]) -> [String: Box?] + +@JSFunction func importMirrorDictionary(_ values: [String: Double]) throws(JSException) -> [String: Double] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.json new file mode 100644 index 000000000..af5b83dc7 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.json @@ -0,0 +1,259 @@ +{ + "exported" : { + "classes" : [ + { + "methods" : [ + + ], + "name" : "Box", + "properties" : [ + + ], + "swiftCallName" : "Box" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_mirrorDictionary", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "mirrorDictionary", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_optionalDictionary", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "optionalDictionary", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_nestedDictionary", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "nestedDictionary", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + } + } + }, + { + "abiName" : "bjs_boxDictionary", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "boxDictionary", + "parameters" : [ + { + "label" : "_", + "name" : "boxes", + "type" : { + "dictionary" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Box" + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Box" + } + } + } + } + }, + { + "abiName" : "bjs_optionalBoxDictionary", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "optionalBoxDictionary", + "parameters" : [ + { + "label" : "_", + "name" : "boxes", + "type" : { + "dictionary" : { + "_0" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Box" + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Box" + } + }, + "_1" : "null" + } + } + } + } + } + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "importMirrorDictionary", + "parameters" : [ + { + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "types" : [ + + ] + } + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.swift new file mode 100644 index 000000000..2a41c35a7 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.swift @@ -0,0 +1,97 @@ +@_expose(wasm, "bjs_mirrorDictionary") +@_cdecl("bjs_mirrorDictionary") +public func _bjs_mirrorDictionary() -> Void { + #if arch(wasm32) + let ret = mirrorDictionary(_: [String: Int].bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_optionalDictionary") +@_cdecl("bjs_optionalDictionary") +public func _bjs_optionalDictionary(_ values: Int32) -> Void { + #if arch(wasm32) + let ret = optionalDictionary(_: Optional<[String: String]>.bridgeJSLiftParameter(values)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_nestedDictionary") +@_cdecl("bjs_nestedDictionary") +public func _bjs_nestedDictionary() -> Void { + #if arch(wasm32) + let ret = nestedDictionary(_: [String: [Int]].bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_boxDictionary") +@_cdecl("bjs_boxDictionary") +public func _bjs_boxDictionary() -> Void { + #if arch(wasm32) + let ret = boxDictionary(_: [String: Box].bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_optionalBoxDictionary") +@_cdecl("bjs_optionalBoxDictionary") +public func _bjs_optionalBoxDictionary() -> Void { + #if arch(wasm32) + let ret = optionalBoxDictionary(_: [String: Optional].bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Box_deinit") +@_cdecl("bjs_Box_deinit") +public func _bjs_Box_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension Box: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_Box_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Box_wrap") +fileprivate func _bjs_Box_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Box_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_importMirrorDictionary") +fileprivate func bjs_importMirrorDictionary() -> Void +#else +fileprivate func bjs_importMirrorDictionary() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$importMirrorDictionary(_ values: [String: Double]) throws(JSException) -> [String: Double] { + let _ = values.bridgeJSLowerParameter() + bjs_importMirrorDictionary() + if let error = _swift_js_take_exception() { + throw error + } + return [String: Double].bridgeJSLiftReturn() +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.d.ts new file mode 100644 index 000000000..dadcc74ba --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.d.ts @@ -0,0 +1,34 @@ +// 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 Box extends SwiftHeapObject { +} +export type Exports = { + Box: { + } + mirrorDictionary(values: Record): Record; + optionalDictionary(values: Record | null): Record | null; + nestedDictionary(values: Record): Record; + boxDictionary(boxes: Record): Record; + optionalBoxDictionary(boxes: Record): Record; +} +export type Imports = { + importMirrorDictionary(values: Record): Record; +} +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/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js new file mode 100644 index 000000000..0388f7de1 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -0,0 +1,462 @@ +// 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; + 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 tmpRetTag = []; + let tmpRetStrings = []; + let tmpRetInts = []; + let tmpRetF32s = []; + let tmpRetF64s = []; + let tmpParamInts = []; + let tmpParamF32s = []; + let tmpParamF64s = []; + let tmpRetPointers = []; + let tmpParamPointers = []; + let tmpStructCleanups = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); + bjs["swift_js_return_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + return swift.memory.retain(textDecoder.decode(bytes)); + } + 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_tag"] = function(tag) { + tmpRetTag.push(tag); + } + bjs["swift_js_push_i32"] = function(v) { + tmpRetInts.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + tmpRetF32s.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + tmpRetF64s.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const bytes = new Uint8Array(memory.buffer, ptr, len); + const value = textDecoder.decode(bytes); + tmpRetStrings.push(value); + } + bjs["swift_js_pop_i32"] = function() { + return tmpParamInts.pop(); + } + bjs["swift_js_pop_f32"] = function() { + return tmpParamF32s.pop(); + } + bjs["swift_js_pop_f64"] = function() { + return tmpParamF64s.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + tmpRetPointers.push(pointer); + } + bjs["swift_js_pop_pointer"] = function() { + return tmpParamPointers.pop(); + } + bjs["swift_js_struct_cleanup"] = function(cleanupId) { + if (cleanupId === 0) { return; } + const index = (cleanupId | 0) - 1; + const cleanup = tmpStructCleanups[index]; + tmpStructCleanups[index] = null; + if (cleanup) { cleanup(); } + while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { + tmpStructCleanups.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 { + const bytes = new Uint8Array(memory.buffer, ptr, len); + tmpRetString = textDecoder.decode(bytes); + } + } + 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; + } + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_Box_wrap"] = function(pointer) { + const obj = Box.__construct(pointer); + return swift.memory.retain(obj); + }; + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_importMirrorDictionary"] = function bjs_importMirrorDictionary() { + try { + const dictLen = tmpRetInts.pop(); + const dictResult = {}; + for (let i = 0; i < dictLen; i++) { + const f64 = tmpRetF64s.pop(); + const string = tmpRetStrings.pop(); + dictResult[string] = f64; + } + let ret = imports.importMirrorDictionary(dictResult); + const arrayCleanups = []; + const entries = Object.entries(ret); + for (const entry of entries) { + const [key, value] = entry; + const bytes = textEncoder.encode(key); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + arrayCleanups.push(() => { + swift.memory.release(id); + }); + tmpParamF64s.push(value); + } + tmpParamInts.push(entries.length); + } catch (error) { + setException(error); + } + } + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype) { + const obj = Object.create(prototype); + obj.pointer = pointer; + obj.hasReleased = false; + obj.deinit = deinit; + obj.registry = new FinalizationRegistry((pointer) => { + deinit(pointer); + }); + obj.registry.register(this, obj.pointer); + return obj; + } + + release() { + this.registry.unregister(this); + this.deinit(this.pointer); + } + } + class Box extends SwiftHeapObject { + static __construct(ptr) { + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Box_deinit, Box.prototype); + } + + } + const exports = { + Box, + mirrorDictionary: function bjs_mirrorDictionary(values) { + const arrayCleanups = []; + const entries = Object.entries(values); + for (const entry of entries) { + const [key, value] = entry; + const bytes = textEncoder.encode(key); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + arrayCleanups.push(() => { + swift.memory.release(id); + }); + tmpParamInts.push((value | 0)); + } + tmpParamInts.push(entries.length); + instance.exports.bjs_mirrorDictionary(); + const dictLen = tmpRetInts.pop(); + const dictResult = {}; + for (let i = 0; i < dictLen; i++) { + const int = tmpRetInts.pop(); + const string = tmpRetStrings.pop(); + dictResult[string] = int; + } + for (const cleanup of arrayCleanups) { cleanup(); } + return dictResult; + }, + optionalDictionary: function bjs_optionalDictionary(values) { + const isSome = values != null; + const valuesCleanups = []; + if (isSome) { + const arrayCleanups = []; + const entries = Object.entries(values); + for (const entry of entries) { + const [key, value] = entry; + const bytes = textEncoder.encode(key); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + arrayCleanups.push(() => { + swift.memory.release(id); + }); + const bytes1 = textEncoder.encode(value); + const id1 = swift.memory.retain(bytes1); + tmpParamInts.push(bytes1.length); + tmpParamInts.push(id1); + arrayCleanups.push(() => { + swift.memory.release(id1); + }); + } + tmpParamInts.push(entries.length); + valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); + } + instance.exports.bjs_optionalDictionary(+isSome); + const isSome1 = tmpRetInts.pop(); + let optResult; + if (isSome1) { + const dictLen = tmpRetInts.pop(); + const dictResult = {}; + for (let i = 0; i < dictLen; i++) { + const string = tmpRetStrings.pop(); + const string1 = tmpRetStrings.pop(); + dictResult[string1] = string; + } + optResult = dictResult; + } else { + optResult = null; + } + for (const cleanup of valuesCleanups) { cleanup(); } + return optResult; + }, + nestedDictionary: function bjs_nestedDictionary(values) { + const arrayCleanups = []; + const entries = Object.entries(values); + for (const entry of entries) { + const [key, value] = entry; + const bytes = textEncoder.encode(key); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + arrayCleanups.push(() => { + swift.memory.release(id); + }); + const arrayCleanups1 = []; + for (const elem of value) { + tmpParamInts.push((elem | 0)); + } + tmpParamInts.push(value.length); + arrayCleanups.push(() => { + for (const cleanup of arrayCleanups1) { cleanup(); } + }); + } + tmpParamInts.push(entries.length); + instance.exports.bjs_nestedDictionary(); + const dictLen = tmpRetInts.pop(); + const dictResult = {}; + for (let i = 0; i < dictLen; i++) { + const arrayLen = tmpRetInts.pop(); + const arrayResult = []; + for (let i1 = 0; i1 < arrayLen; i1++) { + const int = tmpRetInts.pop(); + arrayResult.push(int); + } + arrayResult.reverse(); + const string = tmpRetStrings.pop(); + dictResult[string] = arrayResult; + } + for (const cleanup of arrayCleanups) { cleanup(); } + return dictResult; + }, + boxDictionary: function bjs_boxDictionary(boxes) { + const arrayCleanups = []; + const entries = Object.entries(boxes); + for (const entry of entries) { + const [key, value] = entry; + const bytes = textEncoder.encode(key); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + arrayCleanups.push(() => { + swift.memory.release(id); + }); + tmpParamPointers.push(value.pointer); + } + tmpParamInts.push(entries.length); + instance.exports.bjs_boxDictionary(); + const dictLen = tmpRetInts.pop(); + const dictResult = {}; + for (let i = 0; i < dictLen; i++) { + const ptr = tmpRetPointers.pop(); + const obj = _exports['Box'].__construct(ptr); + const string = tmpRetStrings.pop(); + dictResult[string] = obj; + } + for (const cleanup of arrayCleanups) { cleanup(); } + return dictResult; + }, + optionalBoxDictionary: function bjs_optionalBoxDictionary(boxes) { + const arrayCleanups = []; + const entries = Object.entries(boxes); + for (const entry of entries) { + const [key, value] = entry; + const bytes = textEncoder.encode(key); + const id = swift.memory.retain(bytes); + tmpParamInts.push(bytes.length); + tmpParamInts.push(id); + arrayCleanups.push(() => { + swift.memory.release(id); + }); + const isSome = value != null ? 1 : 0; + if (isSome) { + tmpParamPointers.push(value.pointer); + } else { + tmpParamPointers.push(0); + } + tmpParamInts.push(isSome); + } + tmpParamInts.push(entries.length); + instance.exports.bjs_optionalBoxDictionary(); + const dictLen = tmpRetInts.pop(); + const dictResult = {}; + for (let i = 0; i < dictLen; i++) { + const isSome1 = tmpRetInts.pop(); + let optValue; + if (isSome1 === 0) { + optValue = null; + } else { + const ptr = tmpRetPointers.pop(); + const obj = _exports['Box'].__construct(ptr); + optValue = obj; + } + const string = tmpRetStrings.pop(); + dictResult[string] = optValue; + } + for (const cleanup of arrayCleanups) { cleanup(); } + return dictResult; + }, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 1c8592724..fd2cbd909 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -2375,3 +2375,122 @@ extension Array: _BridgedSwiftStackType where Element: _BridgedSwiftStackType, E bridgeJSLowerReturn() } } + +// MARK: - Dictionary Support + +public protocol _BridgedSwiftDictionaryStackType: _BridgedSwiftTypeLoweredIntoVoidType { + associatedtype DictionaryValue: _BridgedSwiftStackType + where DictionaryValue.StackLiftResult == DictionaryValue +} + +extension Dictionary: _BridgedSwiftStackType +where Key == String, Value: _BridgedSwiftStackType, Value.StackLiftResult == Value { + public typealias StackLiftResult = [String: Value] + // Lowering/return use stack-based encoding, so dictionary also behaves like a void-lowered type. + // Optional/JSUndefinedOr wrappers rely on this conformance to push an isSome flag and + // then delegate to the stack-based lowering defined below. + // swiftlint:disable:next type_name +} + +extension Dictionary: _BridgedSwiftTypeLoweredIntoVoidType, _BridgedSwiftDictionaryStackType +where Key == String, Value: _BridgedSwiftStackType, Value.StackLiftResult == Value { + public typealias DictionaryValue = Value + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> [String: Value] { + let count = Int(_swift_js_pop_i32()) + var result: [String: Value] = [:] + result.reserveCapacity(count) + for _ in 0.. [String: Value] { + bridgeJSLiftParameter() + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + bridgeJSLowerReturn() + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { + let count = Int32(self.count) + for (key, value) in self { + key.bridgeJSLowerStackReturn() + value.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(count) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() { + bridgeJSLowerReturn() + } +} + +extension Optional where Wrapped: _BridgedSwiftDictionaryStackType { + typealias DictionaryValue = Wrapped.DictionaryValue + + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + switch consume self { + case .none: + return 0 + case .some(let dict): + dict.bridgeJSLowerReturn() + return 1 + } + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { + switch consume self { + case .none: + _swift_js_push_i32(0) + case .some(let dict): + dict.bridgeJSLowerReturn() + _swift_js_push_i32(1) + } + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32) -> [String: Wrapped.DictionaryValue]? { + if isSome == 0 { + return nil + } + return Dictionary.bridgeJSLiftParameter() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> [String: Wrapped.DictionaryValue]? { + bridgeJSLiftParameter(_swift_js_pop_i32()) + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> [String: Wrapped.DictionaryValue]? { + let isSome = _swift_js_pop_i32() + if isSome == 0 { + return nil + } + return Dictionary.bridgeJSLiftParameter() + } +} + +extension _BridgedAsOptional where Wrapped: _BridgedSwiftDictionaryStackType { + typealias DictionaryValue = Wrapped.DictionaryValue + + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + let opt = optionalRepresentation + if let dict = opt { + dict.bridgeJSLowerReturn() + return 1 + } + return 0 + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> Self { + let isSome = _swift_js_pop_i32() + if isSome == 0 { + return Self(optional: nil) + } + let value = Dictionary.bridgeJSLiftParameter() as! Wrapped + return Self(optional: value) + } +} diff --git a/Tests/BridgeJSRuntimeTests/DictionaryTests.swift b/Tests/BridgeJSRuntimeTests/DictionaryTests.swift new file mode 100644 index 000000000..83ca72d04 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/DictionaryTests.swift @@ -0,0 +1,96 @@ +@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +import XCTest + +final class DictionaryTests: XCTestCase { + func testRoundTripDictionary() throws { + let input: [String: Int] = ["a": 1, "b": 2] + let result = try jsRoundTripDictionary(input) + XCTAssertEqual(result, input) + } + + func testRoundTripDictionaryBool() throws { + let input: [String: Bool] = ["yes": true, "no": false] + let result = try jsRoundTripDictionaryBool(input) + XCTAssertEqual(result, input) + } + + func testRoundTripDictionaryDouble() throws { + let input: [String: Double] = ["pi": 3.14, "tau": 6.28] + let result = try jsRoundTripDictionaryDouble(input) + XCTAssertEqual(result, input) + } + + func testRoundTripDictionaryJSObject() throws { + let global = JSObject.global + let input: [String: JSObject] = [ + "global": global + ] + let result = try jsRoundTripDictionaryJSObject(input) + XCTAssertEqual(result, input) + } + + func testRoundTripDictionaryJSValue() throws { + let input: [String: JSValue] = [ + "number": .number(123.5), + "boolean": .boolean(true), + "string": .string("hello"), + "null": .null, + ] + let result = try jsRoundTripDictionaryJSValue(input) + XCTAssertEqual(result, input) + } + + func testRoundTripNestedDictionary() throws { + let input: [String: [Double]] = [ + "xs": [1.0, 2.5], + "ys": [], + ] + let result = try jsRoundTripNestedDictionary(input) + XCTAssertEqual(result, input) + } + + func testRoundTripOptionalDictionaryNull() throws { + let some: [String: String]? = ["k": "v"] + XCTAssertEqual(try jsRoundTripOptionalDictionary(some), some) + XCTAssertNil(try jsRoundTripOptionalDictionary(nil)) + } + + func testRoundTripOptionalDictionaryUndefined() throws { + let some: JSUndefinedOr<[String: Int]> = .value(["n": 42]) + let undefined: JSUndefinedOr<[String: Int]> = .undefinedValue + + let returnedSome = try jsRoundTripUndefinedDictionary(some) + switch returnedSome { + case .value(let dict): + XCTAssertEqual(dict, ["n": 42]) + case .undefined: + XCTFail("Expected defined dictionary") + } + + let returnedUndefined = try jsRoundTripUndefinedDictionary(undefined) + switch returnedUndefined { + case .value: + XCTFail("Expected undefined") + case .undefined: + break + } + } +} + +@JSFunction func jsRoundTripDictionary(_ values: [String: Int]) throws(JSException) -> [String: Int] + +@JSFunction func jsRoundTripDictionaryBool(_ values: [String: Bool]) throws(JSException) -> [String: Bool] + +@JSFunction func jsRoundTripDictionaryDouble(_ values: [String: Double]) throws(JSException) -> [String: Double] + +@JSFunction func jsRoundTripDictionaryJSObject(_ values: [String: JSObject]) throws(JSException) -> [String: JSObject] + +@JSFunction func jsRoundTripDictionaryJSValue(_ values: [String: JSValue]) throws(JSException) -> [String: JSValue] + +@JSFunction func jsRoundTripNestedDictionary(_ values: [String: [Double]]) throws(JSException) -> [String: [Double]] + +@JSFunction func jsRoundTripOptionalDictionary(_ values: [String: String]?) throws(JSException) -> [String: String]? + +@JSFunction func jsRoundTripUndefinedDictionary( + _ values: JSUndefinedOr<[String: Int]> +) throws(JSException) -> JSUndefinedOr<[String: Int]> diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 74817d82b..7f9a20586 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -52,6 +52,14 @@ func runJsWorks() -> Void return v } +@JS func roundTripDictionaryExport(v: [String: Int]) -> [String: Int] { + return v +} + +@JS func roundTripOptionalDictionaryExport(v: [String: String]?) -> [String: String]? { + return v +} + @JS func roundTripJSValue(v: JSValue) -> JSValue { return v } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 194ed04b3..7ca92b35c 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -3810,6 +3810,28 @@ public func _bjs_roundTripJSObject(_ v: Int32) -> Int32 { #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(_ v: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalDictionaryExport(v: Optional<[String: String]>.bridgeJSLiftParameter(v)) + 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 { @@ -8437,6 +8459,150 @@ fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int3 } #endif +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripDictionary") +fileprivate func bjs_jsRoundTripDictionary() -> Void +#else +fileprivate func bjs_jsRoundTripDictionary() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripDictionary(_ values: [String: Int]) throws(JSException) -> [String: Int] { + let _ = values.bridgeJSLowerParameter() + bjs_jsRoundTripDictionary() + if let error = _swift_js_take_exception() { + throw error + } + return [String: Int].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripDictionaryBool") +fileprivate func bjs_jsRoundTripDictionaryBool() -> Void +#else +fileprivate func bjs_jsRoundTripDictionaryBool() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripDictionaryBool(_ values: [String: Bool]) throws(JSException) -> [String: Bool] { + let _ = values.bridgeJSLowerParameter() + bjs_jsRoundTripDictionaryBool() + if let error = _swift_js_take_exception() { + throw error + } + return [String: Bool].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripDictionaryDouble") +fileprivate func bjs_jsRoundTripDictionaryDouble() -> Void +#else +fileprivate func bjs_jsRoundTripDictionaryDouble() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripDictionaryDouble(_ values: [String: Double]) throws(JSException) -> [String: Double] { + let _ = values.bridgeJSLowerParameter() + bjs_jsRoundTripDictionaryDouble() + if let error = _swift_js_take_exception() { + throw error + } + return [String: Double].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripDictionaryJSObject") +fileprivate func bjs_jsRoundTripDictionaryJSObject() -> Void +#else +fileprivate func bjs_jsRoundTripDictionaryJSObject() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripDictionaryJSObject(_ values: [String: JSObject]) throws(JSException) -> [String: JSObject] { + let _ = values.bridgeJSLowerParameter() + bjs_jsRoundTripDictionaryJSObject() + if let error = _swift_js_take_exception() { + throw error + } + return [String: JSObject].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripDictionaryJSValue") +fileprivate func bjs_jsRoundTripDictionaryJSValue() -> Void +#else +fileprivate func bjs_jsRoundTripDictionaryJSValue() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripDictionaryJSValue(_ values: [String: JSValue]) throws(JSException) -> [String: JSValue] { + let _ = values.bridgeJSLowerParameter() + bjs_jsRoundTripDictionaryJSValue() + if let error = _swift_js_take_exception() { + throw error + } + return [String: JSValue].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripNestedDictionary") +fileprivate func bjs_jsRoundTripNestedDictionary() -> Void +#else +fileprivate func bjs_jsRoundTripNestedDictionary() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripNestedDictionary(_ values: [String: [Double]]) throws(JSException) -> [String: [Double]] { + let _ = values.bridgeJSLowerParameter() + bjs_jsRoundTripNestedDictionary() + if let error = _swift_js_take_exception() { + throw error + } + return [String: [Double]].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalDictionary") +fileprivate func bjs_jsRoundTripOptionalDictionary(_ values: Int32) -> Void +#else +fileprivate func bjs_jsRoundTripOptionalDictionary(_ values: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripOptionalDictionary(_ values: Optional<[String: String]>) throws(JSException) -> Optional<[String: String]> { + let valuesIsSome = values.bridgeJSLowerParameter() + bjs_jsRoundTripOptionalDictionary(valuesIsSome) + if let error = _swift_js_take_exception() { + throw error + } + return Optional<[String: String]>.bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripUndefinedDictionary") +fileprivate func bjs_jsRoundTripUndefinedDictionary(_ values: Int32) -> Void +#else +fileprivate func bjs_jsRoundTripUndefinedDictionary(_ values: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripUndefinedDictionary(_ values: JSUndefinedOr<[String: Int]>) throws(JSException) -> JSUndefinedOr<[String: Int]> { + let valuesIsSome = values.bridgeJSLowerParameter() + bjs_jsRoundTripUndefinedDictionary(valuesIsSome) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr<[String: Int]>.bridgeJSLiftReturn() +} + #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Foo_init") fileprivate func bjs_Foo_init(_ value: Int32) -> Int32 diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 10ca73fe8..8171fd95f 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -5577,6 +5577,82 @@ } } }, + { + "abiName" : "bjs_roundTripDictionaryExport", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDictionaryExport", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "dictionary" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "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" : { @@ -12838,6 +12914,249 @@ }, "imported" : { "children" : [ + { + "functions" : [ + { + "name" : "jsRoundTripDictionary", + "parameters" : [ + { + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "name" : "jsRoundTripDictionaryBool", + "parameters" : [ + { + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "name" : "jsRoundTripDictionaryDouble", + "parameters" : [ + { + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "name" : "jsRoundTripDictionaryJSObject", + "parameters" : [ + { + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "jsObject" : { + + } + } + } + } + }, + { + "name" : "jsRoundTripDictionaryJSValue", + "parameters" : [ + { + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "jsValue" : { + + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "jsValue" : { + + } + } + } + } + }, + { + "name" : "jsRoundTripNestedDictionary", + "parameters" : [ + { + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + } + }, + { + "name" : "jsRoundTripOptionalDictionary", + "parameters" : [ + { + "name" : "values", + "type" : { + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + }, + { + "name" : "jsRoundTripUndefinedDictionary", + "parameters" : [ + { + "name" : "values", + "type" : { + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "int" : { + + } + } + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "int" : { + + } + } + } + }, + "_1" : "undefined" + } + } + } + ], + "types" : [ + + ] + }, { "functions" : [ diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 92f5079d4..934c4f01c 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -64,6 +64,30 @@ export async function setupOptions(options, context) { "jsRoundTripString": (v) => { return v; }, + "jsRoundTripDictionary": (dict) => { + return { ...dict }; + }, + "jsRoundTripDictionaryBool": (dict) => { + return { ...dict }; + }, + "jsRoundTripDictionaryDouble": (dict) => { + return { ...dict }; + }, + "jsRoundTripDictionaryJSObject": (dict) => { + return dict; + }, + "jsRoundTripDictionaryJSValue": (dict) => { + return dict; + }, + "jsRoundTripNestedDictionary": (dict) => { + return Object.fromEntries(Object.entries(dict).map(([k, v]) => [k, [...v]])); + }, + "jsRoundTripOptionalDictionary": (dict) => { + return dict ?? null; + }, + "jsRoundTripUndefinedDictionary": (dict) => { + return dict; + }, "jsRoundTripOptionalNumberNull": (v) => { return v ?? null; }, @@ -279,6 +303,11 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { ]) { assert.equal(exports.roundTripString(v), v); } + const dict = { a: 1, b: 2 }; + assert.deepEqual(exports.roundTripDictionaryExport(dict), dict); + const optDict = { hello: "world" }; + assert.deepEqual(exports.roundTripOptionalDictionaryExport(optDict), optDict); + assert.equal(exports.roundTripOptionalDictionaryExport(null), null); const arrayStruct = { ints: [1, 2, 3], optStrings: ["a", "b"] }; const arrayStructRoundTrip = exports.roundTripArrayMembers(arrayStruct); assert.deepEqual(arrayStructRoundTrip.ints, [1, 2, 3]); From 3da2172ec333e73fff759c2c41da83c223851de7 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 5 Feb 2026 12:14:53 +0100 Subject: [PATCH 165/252] PackageToJS: Fix skeleton file discovery path for build plugin output The SkeletonCollector was looking for BridgeJS.json at the wrong path for build-time generated files. Since commit 91d2f061, BridgeJSTool writes skeleton files to `destination/BridgeJS/JavaScript/BridgeJS.json`, but PackageToJS was searching in `destination/BridgeJS/BridgeJS.json` (missing the JavaScript/ subdirectory). This caused projects using dynamic BridgeJS generation via the build plugin to fail - PackageToJS couldn't find the skeleton files, resulting in HAS_BRIDGE=false and stub implementations in instantiate.js. --- Plugins/PackageToJS/Sources/PackageToJSPlugin.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift index 3cbd29014..7e335c68e 100644 --- a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift +++ b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift @@ -751,9 +751,9 @@ class SkeletonCollector { let directories = [ target.directoryURL.appending(path: "Generated/JavaScript"), // context.pluginWorkDirectoryURL: ".build/plugins/PackageToJS/outputs/" - // .build/plugins/outputs/exportswift/MyApp/destination/BridgeJS/BridgeJS.ExportSwift.json + // .build/plugins/outputs/[package]/[target]/destination/BridgeJS/JavaScript/BridgeJS.json context.pluginWorkDirectoryURL.deletingLastPathComponent().deletingLastPathComponent() - .appending(path: "outputs/\(package.id)/\(target.name)/destination/BridgeJS"), + .appending(path: "outputs/\(package.id)/\(target.name)/destination/BridgeJS/JavaScript"), ] for directory in directories { let skeletonURL = directory.appending(path: skeletonFile) From 6b3a697340cf5d1e3a861f25c589b136a107b179 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 5 Feb 2026 22:22:59 +0900 Subject: [PATCH 166/252] Add ts2swift Record to Dictionary mapping (#582) --- .../TS2Swift/JavaScript/src/processor.js | 54 +++++++++++++++++++ .../test/__snapshots__/ts2swift.test.js.snap | 30 +++++++++++ .../test/fixtures/RecordDictionary.d.ts | 17 ++++++ 3 files changed, 101 insertions(+) create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/RecordDictionary.d.ts diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index ef446af0f..04578e9ea 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -663,6 +663,7 @@ export class TypeProcessor { * @private */ visitType(type, node) { + const typeArguments = this.getTypeArguments(type); if (this.checker.isArrayType(type)) { const typeArgs = this.checker.getTypeArguments(type); if (typeArgs && typeArgs.length > 0) { @@ -672,6 +673,11 @@ export class TypeProcessor { return "[JSObject]"; } + const recordType = this.convertRecordType(type, typeArguments, node); + if (recordType) { + return recordType; + } + // Treat A and A as the same type if (isTypeReference(type)) { type = type.target; @@ -760,6 +766,54 @@ export class TypeProcessor { return swiftType; } + /** + * Convert a `Record` TypeScript type into a Swift dictionary type. + * Falls back to `JSObject` when keys are not string-compatible or type arguments are missing. + * @param {ts.Type} type + * @param {ts.Type[]} typeArguments + * @param {ts.Node} node + * @returns {string | null} + * @private + */ + convertRecordType(type, typeArguments, node) { + const symbol = type.aliasSymbol ?? type.getSymbol(); + if (!symbol || symbol.name !== "Record") { + return null; + } + if (typeArguments.length !== 2) { + this.diagnosticEngine.print("warning", "Record expects two type arguments", node); + return "JSObject"; + } + const [keyType, valueType] = typeArguments; + const stringType = this.checker.getStringType(); + if (!this.checker.isTypeAssignableTo(keyType, stringType)) { + this.diagnosticEngine.print( + "warning", + `Record key type must be assignable to string: ${this.checker.typeToString(keyType)}`, + node + ); + return "JSObject"; + } + + const valueSwiftType = this.visitType(valueType, node); + return `[String: ${valueSwiftType}]`; + } + + /** + * Retrieve type arguments for a given type, including type alias instantiations. + * @param {ts.Type} type + * @returns {ts.Type[]} + * @private + */ + getTypeArguments(type) { + if (isTypeReference(type)) { + return this.checker.getTypeArguments(type); + } + // Non-TypeReference alias instantiations store type arguments separately. + // @ts-ignore: `aliasTypeArguments` is intentionally accessed for alias instantiations. + return type.aliasTypeArguments ?? []; + } + /** * Derive the type name from a type * @param {ts.Type} type - TypeScript type diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index 6fdb79f78..e6fb234c4 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -251,6 +251,36 @@ exports[`ts2swift > snapshots Swift output for ReExportFrom.d.ts > ReExportFrom " `; +exports[`ts2swift > snapshots Swift output for RecordDictionary.d.ts > RecordDictionary 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func takeRecord(_ value: [String: Double]) throws(JSException) -> Void + +@JSFunction func returnRecord() throws(JSException) -> [String: String] + +@JSFunction func optionalRecord(_ value: Optional<[String: Bool]>) throws(JSException) -> Optional<[String: Bool]> + +@JSFunction func nestedRecord(_ value: [String: [String: Double]]) throws(JSException) -> [String: [String: Double]] + +@JSFunction func recordWithArrayValues(_ values: [String: [Double]]) throws(JSException) -> [String: [Double]] + +@JSFunction func recordWithObjects(_ values: [String: Optional]) throws(JSException) -> [String: Optional] + +@JSClass struct Box { + @JSGetter var value: Double + @JSSetter func setValue(_ value: Double) throws(JSException) +} + +@JSFunction func unsupportedKeyRecord(_ values: JSObject) throws(JSException) -> Void +" +`; + exports[`ts2swift > snapshots Swift output for StringEnum.d.ts > StringEnum 1`] = ` "// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/RecordDictionary.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/RecordDictionary.d.ts new file mode 100644 index 000000000..cfaf5f309 --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/RecordDictionary.d.ts @@ -0,0 +1,17 @@ +export interface Box { + value: number; +} + +export function takeRecord(value: Record): void; + +export function returnRecord(): Record; + +export function optionalRecord(value: Record | null): Record | null; + +export function nestedRecord(value: Record>): Record>; + +export function recordWithArrayValues(values: Record): Record; + +export function recordWithObjects(values: Record): Record; + +export function unsupportedKeyRecord(values: Record): void; From b1fb45edf79e44d5b73136c3303d8fa9104be478 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 5 Feb 2026 21:30:36 +0700 Subject: [PATCH 167/252] BridgeJS: Add missing `function` keyword for namespace function declarations in TypeScript (#592) --- Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift | 2 +- .../BridgeJSLinkTests/EnumNamespace.Global.d.ts | 6 +++--- .../__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts | 2 +- .../__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts | 2 +- .../BridgeJSLinkTests/StaticFunctions.Global.d.ts | 2 +- .../Exporting-Swift/Exporting-Swift-Static-Functions.md | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 39fb77b7d..fb232355d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -3094,7 +3094,7 @@ extension BridgeJSLink { let sortedFunctions = childNode.content.functions.sorted { $0.name < $1.name } for function in sortedFunctions { let signature = - "\(function.name)\(renderTSSignatureCallback(function.parameters, function.returnType, function.effects));" + "function \(function.name)\(renderTSSignatureCallback(function.parameters, function.returnType, function.effects));" printer.write(signature) } let sortedProperties = childNode.content.staticProperties.sorted { $0.name < $1.name } 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 f1dc0a926..be77e759c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.d.ts @@ -61,9 +61,9 @@ declare global { namespace Services { namespace Graph { namespace GraphOperations { - createGraph(rootId: number): number; - nodeCount(graphId: number): number; - validate(graphId: number): boolean; + function createGraph(rootId: number): number; + function nodeCount(graphId: number): number; + function validate(graphId: number): boolean; } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts index 67a6eebcf..6f18e53ed 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts @@ -12,7 +12,7 @@ declare global { constructor(); greet(): string; } - globalFunction(): string; + function globalFunction(): string; } } 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 cdf83f36d..77d9cc0e9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts @@ -9,7 +9,7 @@ export {}; declare global { namespace MyModule { namespace Utils { - namespacedFunction(): string; + function namespacedFunction(): string; } } namespace Utils { 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 069c1628c..a2f1c7d6d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.d.ts @@ -33,7 +33,7 @@ export {}; declare global { namespace Utils { namespace String { - uppercase(text: string): string; + function uppercase(text: string): string; } } } diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Functions.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Functions.md index 00e7c1f22..b6f680d1f 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Functions.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Functions.md @@ -140,7 +140,7 @@ Generated TypeScript definitions: declare global { namespace Utils { namespace String { - uppercase(text: string): string; + function uppercase(text: string): string; } } } From 444393fc387337bff355adadda094250003fb7f6 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 6 Feb 2026 04:33:32 +0700 Subject: [PATCH 168/252] BridgeJS: Fix Dictionary bridging after Stack ABI refactor (#594) --- .../Sources/BridgeJSLink/JSGlueGen.swift | 10 +- .../BridgeJSLinkTests/DictionaryTypes.js | 134 +++++++++--------- 2 files changed, 70 insertions(+), 74 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 1507d76c0..8d909623c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -1009,7 +1009,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("}") case .dictionary(let valueType): let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(isSomeVar) = \(scope.popI32());") printer.write("let \(resultVar);") printer.write("if (\(isSomeVar)) {") printer.indent { @@ -1217,11 +1217,11 @@ struct IntrinsicJSFragment: Sendable { } } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(entriesVar).length);") + scope.emitPushI32Parameter("\(entriesVar).length", printer: printer) cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(isSomeVar) ? 1 : 0);") + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) default: () } @@ -2749,7 +2749,7 @@ struct IntrinsicJSFragment: Sendable { } } printer.write("}") - printer.write("\(JSGlueVariableScope.reservedTmpParamInts).push(\(entriesVar).length);") + scope.emitPushI32Parameter("\(entriesVar).length", printer: printer) cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") return [] } @@ -2791,7 +2791,7 @@ struct IntrinsicJSFragment: Sendable { let lenVar = scope.variable("dictLen") let iVar = scope.variable("i") - printer.write("const \(lenVar) = \(JSGlueVariableScope.reservedTmpRetInts).pop();") + printer.write("const \(lenVar) = \(scope.popI32());") printer.write("const \(resultVar) = {};") printer.write("for (let \(iVar) = 0; \(iVar) < \(lenVar); \(iVar)++) {") printer.indent { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index 0388f7de1..5453ec525 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -18,16 +18,12 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tmpRetTag = []; - let tmpRetStrings = []; - let tmpRetInts = []; - let tmpRetF32s = []; - let tmpRetF64s = []; - let tmpParamInts = []; - let tmpParamF32s = []; - let tmpParamF64s = []; - let tmpRetPointers = []; - let tmpParamPointers = []; + let tagStack = []; + let strStack = []; + let i32Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -71,36 +67,36 @@ export async function createInstantiator(options, swift) { swift.memory.release(id); } bjs["swift_js_push_tag"] = function(tag) { - tmpRetTag.push(tag); + tagStack.push(tag); } bjs["swift_js_push_i32"] = function(v) { - tmpRetInts.push(v | 0); + i32Stack.push(v | 0); } bjs["swift_js_push_f32"] = function(v) { - tmpRetF32s.push(Math.fround(v)); + f32Stack.push(Math.fround(v)); } bjs["swift_js_push_f64"] = function(v) { - tmpRetF64s.push(v); + f64Stack.push(v); } bjs["swift_js_push_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); const value = textDecoder.decode(bytes); - tmpRetStrings.push(value); + strStack.push(value); } bjs["swift_js_pop_i32"] = function() { - return tmpParamInts.pop(); + return i32Stack.pop(); } bjs["swift_js_pop_f32"] = function() { - return tmpParamF32s.pop(); + return f32Stack.pop(); } bjs["swift_js_pop_f64"] = function() { - return tmpParamF64s.pop(); + return f64Stack.pop(); } bjs["swift_js_push_pointer"] = function(pointer) { - tmpRetPointers.push(pointer); + ptrStack.push(pointer); } bjs["swift_js_pop_pointer"] = function() { - return tmpParamPointers.pop(); + return ptrStack.pop(); } bjs["swift_js_struct_cleanup"] = function(cleanupId) { if (cleanupId === 0) { return; } @@ -213,11 +209,11 @@ export async function createInstantiator(options, swift) { const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_importMirrorDictionary"] = function bjs_importMirrorDictionary() { try { - const dictLen = tmpRetInts.pop(); + const dictLen = i32Stack.pop(); const dictResult = {}; for (let i = 0; i < dictLen; i++) { - const f64 = tmpRetF64s.pop(); - const string = tmpRetStrings.pop(); + const f64 = f64Stack.pop(); + const string = strStack.pop(); dictResult[string] = f64; } let ret = imports.importMirrorDictionary(dictResult); @@ -227,14 +223,14 @@ export async function createInstantiator(options, swift) { const [key, value] = entry; const bytes = textEncoder.encode(key); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); arrayCleanups.push(() => { swift.memory.release(id); }); - tmpParamF64s.push(value); + f64Stack.push(value); } - tmpParamInts.push(entries.length); + i32Stack.push(entries.length); } catch (error) { setException(error); } @@ -285,20 +281,20 @@ export async function createInstantiator(options, swift) { const [key, value] = entry; const bytes = textEncoder.encode(key); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); arrayCleanups.push(() => { swift.memory.release(id); }); - tmpParamInts.push((value | 0)); + i32Stack.push((value | 0)); } - tmpParamInts.push(entries.length); + i32Stack.push(entries.length); instance.exports.bjs_mirrorDictionary(); - const dictLen = tmpRetInts.pop(); + const dictLen = i32Stack.pop(); const dictResult = {}; for (let i = 0; i < dictLen; i++) { - const int = tmpRetInts.pop(); - const string = tmpRetStrings.pop(); + const int = i32Stack.pop(); + const string = strStack.pop(); dictResult[string] = int; } for (const cleanup of arrayCleanups) { cleanup(); } @@ -314,31 +310,31 @@ export async function createInstantiator(options, swift) { const [key, value] = entry; const bytes = textEncoder.encode(key); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); arrayCleanups.push(() => { swift.memory.release(id); }); const bytes1 = textEncoder.encode(value); const id1 = swift.memory.retain(bytes1); - tmpParamInts.push(bytes1.length); - tmpParamInts.push(id1); + i32Stack.push(bytes1.length); + i32Stack.push(id1); arrayCleanups.push(() => { swift.memory.release(id1); }); } - tmpParamInts.push(entries.length); + i32Stack.push(entries.length); valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); } instance.exports.bjs_optionalDictionary(+isSome); - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { - const dictLen = tmpRetInts.pop(); + const dictLen = i32Stack.pop(); const dictResult = {}; for (let i = 0; i < dictLen; i++) { - const string = tmpRetStrings.pop(); - const string1 = tmpRetStrings.pop(); + const string = strStack.pop(); + const string1 = strStack.pop(); dictResult[string1] = string; } optResult = dictResult; @@ -355,33 +351,33 @@ export async function createInstantiator(options, swift) { const [key, value] = entry; const bytes = textEncoder.encode(key); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); arrayCleanups.push(() => { swift.memory.release(id); }); const arrayCleanups1 = []; for (const elem of value) { - tmpParamInts.push((elem | 0)); + i32Stack.push((elem | 0)); } - tmpParamInts.push(value.length); + i32Stack.push(value.length); arrayCleanups.push(() => { for (const cleanup of arrayCleanups1) { cleanup(); } }); } - tmpParamInts.push(entries.length); + i32Stack.push(entries.length); instance.exports.bjs_nestedDictionary(); - const dictLen = tmpRetInts.pop(); + const dictLen = i32Stack.pop(); const dictResult = {}; for (let i = 0; i < dictLen; i++) { - const arrayLen = tmpRetInts.pop(); + const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i1 = 0; i1 < arrayLen; i1++) { - const int = tmpRetInts.pop(); + const int = i32Stack.pop(); arrayResult.push(int); } arrayResult.reverse(); - const string = tmpRetStrings.pop(); + const string = strStack.pop(); dictResult[string] = arrayResult; } for (const cleanup of arrayCleanups) { cleanup(); } @@ -394,21 +390,21 @@ export async function createInstantiator(options, swift) { const [key, value] = entry; const bytes = textEncoder.encode(key); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); arrayCleanups.push(() => { swift.memory.release(id); }); - tmpParamPointers.push(value.pointer); + ptrStack.push(value.pointer); } - tmpParamInts.push(entries.length); + i32Stack.push(entries.length); instance.exports.bjs_boxDictionary(); - const dictLen = tmpRetInts.pop(); + const dictLen = i32Stack.pop(); const dictResult = {}; for (let i = 0; i < dictLen; i++) { - const ptr = tmpRetPointers.pop(); + const ptr = ptrStack.pop(); const obj = _exports['Box'].__construct(ptr); - const string = tmpRetStrings.pop(); + const string = strStack.pop(); dictResult[string] = obj; } for (const cleanup of arrayCleanups) { cleanup(); } @@ -421,34 +417,34 @@ export async function createInstantiator(options, swift) { const [key, value] = entry; const bytes = textEncoder.encode(key); const id = swift.memory.retain(bytes); - tmpParamInts.push(bytes.length); - tmpParamInts.push(id); + i32Stack.push(bytes.length); + i32Stack.push(id); arrayCleanups.push(() => { swift.memory.release(id); }); const isSome = value != null ? 1 : 0; if (isSome) { - tmpParamPointers.push(value.pointer); + ptrStack.push(value.pointer); } else { - tmpParamPointers.push(0); + ptrStack.push(0); } - tmpParamInts.push(isSome); + i32Stack.push(isSome); } - tmpParamInts.push(entries.length); + i32Stack.push(entries.length); instance.exports.bjs_optionalBoxDictionary(); - const dictLen = tmpRetInts.pop(); + const dictLen = i32Stack.pop(); const dictResult = {}; for (let i = 0; i < dictLen; i++) { - const isSome1 = tmpRetInts.pop(); + const isSome1 = i32Stack.pop(); let optValue; if (isSome1 === 0) { optValue = null; } else { - const ptr = tmpRetPointers.pop(); + const ptr = ptrStack.pop(); const obj = _exports['Box'].__construct(ptr); optValue = obj; } - const string = tmpRetStrings.pop(); + const string = strStack.pop(); dictResult[string] = optValue; } for (const cleanup of arrayCleanups) { cleanup(); } From bc752fc534be8bfd6604f2ff6229f699a8f35671 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 6 Feb 2026 13:57:50 +0900 Subject: [PATCH 169/252] BridgeJS: Generate Swift doc-comment based on JSDoc (#596) * Doc comments from .d.ts JSDoc now flow into generated Swift DocC output. - Added JSDoc parsing (description/@param/@returns) and DocC emission for callable/typed declarations, including classes/interfaces/enums, in `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js`, with guards to only read param/return tags on callable nodes. - Added a documented fixture to cover the new behavior and updated the Vitest snapshot (`Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/Documentation.d.ts`, `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap`). Tests: - `npm test -- -u` (Plugins/BridgeJS/Sources/TS2Swift/JavaScript) Next steps: optionally run `swift test --package-path ./Plugins/BridgeJS` to keep the Swift-side suite green. * Added richer WebIDL-derived doc coverage using the bridgejs-development skill: new fixtures model lib.dom-style comments (MDN reference blocks, @param text) and updated Vitest snapshots to show how those JSDoc comments render into DocC. Key files: `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/WebIDLDOMDocs.d.ts`, `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/DOMLike.d.ts`, and the refreshed snapshot in `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap`. Tests run: `npm test -- -u` (TS2Swift JavaScript). * Removed the DOM-like fixture and refreshed snapshots to drop its output. Changes: deleted `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/DOMLike.d.ts` and updated `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap`. Tests: `npm test -- -u` (TS2Swift JavaScript). --- .../TS2Swift/JavaScript/src/processor.js | 230 +++++++++++++++--- .../test/__snapshots__/ts2swift.test.js.snap | 144 +++++++++++ .../test/fixtures/Documentation.d.ts | 56 +++++ .../test/fixtures/WebIDLDOMDocs.d.ts | 81 ++++++ 4 files changed, 476 insertions(+), 35 deletions(-) create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/Documentation.d.ts create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/WebIDLDOMDocs.d.ts diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 04578e9ea..302058036 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -157,10 +157,9 @@ export class TypeProcessor { this.visitEnumType(type, node); continue; } - const typeString = this.checker.typeToString(type); const members = type.getProperties(); if (members) { - this.visitStructuredType(typeString, members); + this.visitStructuredType(type, node, members); } } }); @@ -284,6 +283,7 @@ export class TypeProcessor { if (fromArg) args.push(fromArg); const annotation = this.renderMacroAnnotation("JSGetter", args); + this.emitDocComment(decl, { indent: "" }); this.swiftLines.push(`${annotation} var ${swiftVarName}: ${swiftType}`); this.swiftLines.push(""); } @@ -338,6 +338,7 @@ export class TypeProcessor { this.emittedEnumNames.add(enumName); const members = decl.members ?? []; + this.emitDocComment(decl, { indent: "" }); if (members.length === 0) { this.diagnosticEngine.print("warning", `Empty enum is not supported: ${enumName}`, diagnosticNode); this.swiftLines.push(`typealias ${this.renderIdentifier(enumName)} = String`); @@ -448,54 +449,194 @@ export class TypeProcessor { const signature = this.checker.getSignatureFromDeclaration(node); if (!signature) return; - const params = this.renderParameters(signature.getParameters(), node); + const parameters = signature.getParameters(); + const parameterNameMap = this.buildParameterNameMap(parameters); + const params = this.renderParameters(parameters, node); const returnType = this.visitType(signature.getReturnType(), node); const effects = this.renderEffects({ isAsync: false }); const swiftFuncName = this.renderIdentifier(swiftName); + this.emitDocComment(node, { parameterNameMap }); this.swiftLines.push(`${annotation} func ${swiftFuncName}(${params}) ${effects} -> ${returnType}`); this.swiftLines.push(""); } /** - * Get the full JSDoc text from a node - * @param {ts.Node} node - The node to get the JSDoc text from - * @returns {string | undefined} The full JSDoc text + * Convert a JSDoc comment node content to plain text. + * @param {string | ts.NodeArray | undefined} comment + * @returns {string} + * @private */ - getFullJSDocText(node) { - const docs = ts.getJSDocCommentsAndTags(node); - const parts = []; - for (const doc of docs) { - if (ts.isJSDoc(doc)) { - parts.push(doc.comment ?? ""); + renderJSDocText(comment) { + if (!comment) return ""; + if (typeof comment === "string") return comment; + let result = ""; + for (const part of comment) { + if (typeof part === "string") { + result += part; + continue; + } + // JSDocText/JSDocLink both have a `text` field + // https://github.com/microsoft/TypeScript/blob/main/src/compiler/types.ts + // @ts-ignore + if (typeof part.text === "string") { + // @ts-ignore + result += part.text; + continue; + } + if (typeof part.getText === "function") { + result += part.getText(); } } - if (parts.length === 0) return undefined; - return parts.join("\n"); + return result; } - /** @returns {string} */ - renderDefaultJSImportFromArgument() { - if (this.defaultImportFromGlobal) return "from: .global"; - return ""; + /** + * Split documentation text into lines suitable for DocC rendering. + * @param {string} text + * @returns {string[]} + * @private + */ + splitDocumentationText(text) { + if (!text) return []; + return text.split(/\r?\n/).map(line => line.trimEnd()); } /** - * Render constructor parameters - * @param {ts.ConstructorDeclaration} node - * @returns {string} Rendered parameters + * @param {string[]} lines + * @returns {boolean} * @private */ - renderConstructorParameters(node) { - const signature = this.checker.getSignatureFromDeclaration(node); - if (!signature) return ""; + hasMeaningfulLine(lines) { + return lines.some(line => line.trim().length > 0); + } + + /** + * Render Swift doc comments from a node's JSDoc, including parameter/return tags. + * @param {ts.Node} node + * @param {{ indent?: string, parameterNameMap?: Map }} options + * @private + */ + emitDocComment(node, options = {}) { + const indent = options.indent ?? ""; + const parameterNameMap = options.parameterNameMap ?? new Map(); + + /** @type {string[]} */ + const descriptionLines = []; + for (const doc of ts.getJSDocCommentsAndTags(node)) { + if (!ts.isJSDoc(doc)) continue; + const text = this.renderJSDocText(doc.comment); + if (text) { + descriptionLines.push(...this.splitDocumentationText(text)); + } + } + + /** @type {Array<{ name: string, lines: string[] }>} */ + const parameterDocs = []; + const supportsParameters = ( + ts.isFunctionLike(node) || + ts.isMethodSignature(node) || + ts.isCallSignatureDeclaration(node) || + ts.isConstructSignatureDeclaration(node) + ); + /** @type {ts.JSDocReturnTag | undefined} */ + let returnTag = undefined; + if (supportsParameters) { + for (const tag of ts.getJSDocTags(node)) { + if (ts.isJSDocParameterTag(tag)) { + const tsName = tag.name.getText(); + const name = parameterNameMap.get(tsName) ?? this.renderIdentifier(tsName); + const text = this.renderJSDocText(tag.comment); + const lines = this.splitDocumentationText(text); + parameterDocs.push({ name, lines }); + } else if (!returnTag && ts.isJSDocReturnTag(tag)) { + returnTag = tag; + } + } + } + + const returnLines = returnTag ? this.splitDocumentationText(this.renderJSDocText(returnTag.comment)) : []; + const hasDescription = this.hasMeaningfulLine(descriptionLines); + const hasParameters = parameterDocs.length > 0; + const hasReturns = returnTag !== undefined; + + if (!hasDescription && !hasParameters && !hasReturns) { + return; + } - return this.renderParameters(signature.getParameters(), node); + /** @type {string[]} */ + const docLines = []; + if (hasDescription) { + docLines.push(...descriptionLines); + } + + if (hasDescription && (hasParameters || hasReturns)) { + docLines.push(""); + } + + if (hasParameters) { + docLines.push("- Parameters:"); + for (const param of parameterDocs) { + const hasParamDescription = this.hasMeaningfulLine(param.lines); + const [firstParamLine, ...restParamLines] = param.lines; + if (hasParamDescription) { + docLines.push(` - ${param.name}: ${firstParamLine}`); + for (const line of restParamLines) { + docLines.push(` ${line}`); + } + } else { + docLines.push(` - ${param.name}:`); + } + } + } + + if (hasReturns) { + const hasReturnDescription = this.hasMeaningfulLine(returnLines); + const [firstReturnLine, ...restReturnLines] = returnLines; + if (hasReturnDescription) { + docLines.push(`- Returns: ${firstReturnLine}`); + for (const line of restReturnLines) { + docLines.push(` ${line}`); + } + } else { + docLines.push("- Returns:"); + } + } + + const prefix = `${indent}///`; + for (const line of docLines) { + if (line.length === 0) { + this.swiftLines.push(prefix); + } else { + this.swiftLines.push(`${prefix} ${line}`); + } + } } /** + * Build a map from TypeScript parameter names to rendered Swift identifiers. + * @param {ts.Symbol[]} parameters + * @returns {Map} + * @private + */ + buildParameterNameMap(parameters) { + const map = new Map(); + for (const parameter of parameters) { + map.set(parameter.name, this.renderIdentifier(parameter.name)); + } + return map; + } + + /** @returns {string} */ + renderDefaultJSImportFromArgument() { + if (this.defaultImportFromGlobal) return "from: .global"; + return ""; + } + + /** + * Visit a property declaration and extract metadata * @param {ts.PropertyDeclaration | ts.PropertySignature} node - * @returns {{ jsName: string, swiftName: string, type: string, isReadonly: boolean, documentation: string | undefined } | null} + * @returns {{ jsName: string, swiftName: string, type: string, isReadonly: boolean } | null} */ visitPropertyDecl(node) { if (!node.name) return null; @@ -515,8 +656,7 @@ export class TypeProcessor { const type = this.checker.getTypeAtLocation(node) const swiftType = this.visitType(type, node); const isReadonly = node.modifiers?.some(m => m.kind === ts.SyntaxKind.ReadonlyKeyword) ?? false; - const documentation = this.getFullJSDocText(node); - return { jsName, swiftName, type: swiftType, isReadonly, documentation }; + return { jsName, swiftName, type: swiftType, isReadonly }; } /** @@ -551,6 +691,7 @@ export class TypeProcessor { if (fromArg) args.push(fromArg); const annotation = this.renderMacroAnnotation("JSClass", args); const className = this.renderIdentifier(swiftName); + this.emitDocComment(node, { indent: "" }); this.swiftLines.push(`${annotation} struct ${className} {`); // Process members in declaration order @@ -600,11 +741,15 @@ export class TypeProcessor { /** * Visit a structured type (interface) and render Swift code - * @param {string} name + * @param {ts.Type} type + * @param {ts.Node} diagnosticNode * @param {ts.Symbol[]} members * @private */ - visitStructuredType(name, members) { + visitStructuredType(type, diagnosticNode, members) { + const symbol = type.getSymbol() ?? type.aliasSymbol; + const name = symbol?.name ?? this.checker.typeToString(type); + if (!name) return; if (this.emittedStructuredTypeNames.has(name)) return; this.emittedStructuredTypeNames.add(name); @@ -615,17 +760,22 @@ export class TypeProcessor { if (jsNameArg) args.push(jsNameArg); const annotation = this.renderMacroAnnotation("JSClass", args); const typeName = this.renderIdentifier(swiftName); + const docNode = symbol?.getDeclarations()?.[0] ?? diagnosticNode; + if (docNode) { + this.emitDocComment(docNode, { indent: "" }); + } this.swiftLines.push(`${annotation} struct ${typeName} {`); // Collect all declarations with their positions to preserve order /** @type {Array<{ decl: ts.Node, symbol: ts.Symbol, position: number }>} */ const allDecls = []; - for (const symbol of members) { - for (const decl of symbol.getDeclarations() ?? []) { + const typeMembers = members ?? type.getProperties() ?? []; + for (const memberSymbol of typeMembers) { + for (const decl of memberSymbol.getDeclarations() ?? []) { const sourceFile = decl.getSourceFile(); const pos = sourceFile ? decl.getStart() : 0; - allDecls.push({ decl, symbol, position: pos }); + allDecls.push({ decl, symbol: memberSymbol, position: pos }); } } @@ -854,6 +1004,7 @@ export class TypeProcessor { const getterAnnotation = this.renderMacroAnnotation("JSGetter", getterArgs); // Always render getter + this.emitDocComment(node, { indent: " " }); this.swiftLines.push(` ${getterAnnotation} var ${swiftName}: ${type}`); // Render setter if not readonly @@ -903,7 +1054,9 @@ export class TypeProcessor { const signature = this.checker.getSignatureFromDeclaration(node); if (!signature) return; - const params = this.renderParameters(signature.getParameters(), node); + const parameters = signature.getParameters(); + const parameterNameMap = this.buildParameterNameMap(parameters); + const params = this.renderParameters(parameters, node); const returnType = this.visitType(signature.getReturnType(), node); const effects = this.renderEffects({ isAsync: false }); const swiftMethodName = this.renderIdentifier(swiftName); @@ -912,6 +1065,7 @@ export class TypeProcessor { ) ?? false; const staticKeyword = isStatic ? "static " : ""; + this.emitDocComment(node, { indent: " ", parameterNameMap }); this.swiftLines.push(` ${annotation} ${staticKeyword}func ${swiftMethodName}(${params}) ${effects} -> ${returnType}`); } @@ -930,8 +1084,14 @@ export class TypeProcessor { * @private */ renderConstructor(node) { - const params = this.renderConstructorParameters(node); + const signature = this.checker.getSignatureFromDeclaration(node); + if (!signature) return; + + const parameters = signature.getParameters(); + const parameterNameMap = this.buildParameterNameMap(parameters); + const params = this.renderParameters(parameters, node); const effects = this.renderEffects({ isAsync: false }); + this.emitDocComment(node, { indent: " ", parameterNameMap }); this.swiftLines.push(` @JSFunction init(${params}) ${effects}`); } diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index e6fb234c4..343f8795b 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -48,6 +48,63 @@ exports[`ts2swift > snapshots Swift output for Async.d.ts > Async 1`] = ` " `; +exports[`ts2swift > snapshots Swift output for Documentation.d.ts > Documentation 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +/// Return a greeting for a user. +/// +/// - Parameters: +/// - name: The user's name. +/// - Returns: The greeting message. +@JSFunction func greet(_ name: String) throws(JSException) -> String + +@JSFunction func origin() throws(JSException) -> Point + +/// Represents a 2D point. +@JSClass struct Point { + /// The horizontal position. + @JSGetter var x: Double + @JSSetter func setX(_ value: Double) throws(JSException) + /// Translate the point. + /// + /// - Parameters: + /// - dx: Delta to apply on x. + /// - dy: Delta to apply on y. + /// - Returns: The moved point. + @JSFunction func translate(_ dx: Double, _ dy: Double) throws(JSException) -> Point +} + +/// Move a point by the given delta. +/// +/// - Parameters: +/// - point: The point to move. +/// - dx: Delta to apply on x. +/// - dy: Delta to apply on y. +@JSFunction func translatePoint(_ point: Point, _ dx: Double, _ dy: Double) throws(JSException) -> Point + +/// A greeter that keeps the target name. +@JSClass struct Greeter { + /// Create a greeter. + /// + /// - Parameters: + /// - name: Name to greet. + @JSFunction init(_ name: String) throws(JSException) + /// The configured name. + @JSGetter var targetName: String + /// Say hello. + /// + /// - Returns: Greeting message. + @JSFunction func greet() throws(JSException) -> String +} +" +`; + exports[`ts2swift > snapshots Swift output for Interface.d.ts > Interface 1`] = ` "// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. @@ -402,3 +459,90 @@ exports[`ts2swift > snapshots Swift output for VoidParameterVoidReturn.d.ts > Vo @JSFunction func check() throws(JSException) -> Void " `; + +exports[`ts2swift > snapshots Swift output for WebIDLDOMDocs.d.ts > WebIDLDOMDocs 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +/// [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document) +@JSGetter var document: Document + +/// A simple Document subset with WebIDL-derived comments. +@JSClass struct Document { + /// Creates an instance of the element for the specified tag. + /// + /// - Parameters: + /// - tagName: The name of an element. + /// + /// [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createElement) + @JSFunction func createElement(_ tagName: String, _ options: JSUndefinedOr) throws(JSException) -> Element + /// Returns an element with namespace namespace. Its namespace prefix will be everything before ":" (U+003E) in qualifiedName or null. Its local name will be everything after ":" (U+003E) in qualifiedName or qualifiedName. + /// + /// If localName does not match the Name production an "InvalidCharacterError" DOMException will be thrown. + /// + /// If one of the following conditions is true a "NamespaceError" DOMException will be thrown: + /// + /// localName does not match the QName production. + /// Namespace prefix is not null and namespace is the empty string. + /// Namespace prefix is "xml" and namespace is not the XML namespace. + /// qualifiedName or namespace prefix is "xmlns" and namespace is not the XMLNS namespace. + /// namespace is the XMLNS namespace and neither qualifiedName nor namespace prefix is "xmlns". + /// + /// When supplied, options's is can be used to create a customized built-in element. + /// + /// [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createElementNS) + @JSFunction func createElementNS(_ namespaceURI: Optional, _ qualifiedName: String, _ options: JSObject) throws(JSException) -> Element + /// Creates a TreeWalker object. + /// + /// - Parameters: + /// - root: The root element or node to start traversing on. + /// - whatToShow: The type of nodes or elements to appear in the node list + /// - filter: A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + /// - Returns: The created TreeWalker. + /// + /// [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createTreeWalker) + @JSFunction func createTreeWalker(_ root: Node, _ whatToShow: JSUndefinedOr, _ filter: JSUndefinedOr) throws(JSException) -> TreeWalker +} + +@JSClass struct ElementCreationOptions { + @JSGetter var \`is\`: JSUndefinedOr + @JSSetter func setIs(_ value: JSUndefinedOr) throws(JSException) +} + +@JSClass struct Element { + /// [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/textContent) + @JSGetter var textContent: Optional + @JSSetter func setTextContent(_ value: Optional) throws(JSException) + /// Returns a copy of node. If deep is true, the copy also includes the node's descendants. + /// + /// [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/cloneNode) + @JSFunction func cloneNode(_ subtree: JSObject) throws(JSException) -> Node +} + +/// Minimal stubs to mirror lib.dom.d.ts documentation converted from WebIDL. +@JSClass struct Node { + /// [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/textContent) + @JSGetter var textContent: Optional + @JSSetter func setTextContent(_ value: Optional) throws(JSException) + /// Returns a copy of node. If deep is true, the copy also includes the node's descendants. + /// + /// [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/cloneNode) + @JSFunction func cloneNode(_ subtree: JSObject) throws(JSException) -> Node +} + +@JSClass struct TreeWalker { + /// [MDN Reference](https://developer.mozilla.org/docs/Web/API/TreeWalker/currentNode) + @JSGetter var currentNode: Node + @JSSetter func setCurrentNode(_ value: Node) throws(JSException) + /// Moves the currentNode to the next visible node in the document order. + /// + /// [MDN Reference](https://developer.mozilla.org/docs/Web/API/TreeWalker/nextNode) + @JSFunction func nextNode() throws(JSException) -> Optional +} +" +`; diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/Documentation.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/Documentation.d.ts new file mode 100644 index 000000000..90ba064bb --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/Documentation.d.ts @@ -0,0 +1,56 @@ +/** + * Return a greeting for a user. + * @param name The user's name. + * @returns The greeting message. + */ +export function greet(name: string): string; + +/** + * Represents a 2D point. + */ +export interface Point { + /** + * The horizontal position. + */ + x: number; + + /** + * Translate the point. + * @param dx Delta to apply on x. + * @param dy Delta to apply on y. + * @returns The moved point. + */ + translate(dx: number, dy: number): Point; +} + +export function origin(): Point; + +/** + * Move a point by the given delta. + * @param point The point to move. + * @param dx Delta to apply on x. + * @param dy Delta to apply on y. + */ +export function translatePoint(point: Point, dx: number, dy: number): Point; + +/** + * A greeter that keeps the target name. + */ +export class Greeter { + /** + * Create a greeter. + * @param name Name to greet. + */ + constructor(name: string); + + /** + * The configured name. + */ + readonly targetName: string; + + /** + * Say hello. + * @returns Greeting message. + */ + greet(): string; +} diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/WebIDLDOMDocs.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/WebIDLDOMDocs.d.ts new file mode 100644 index 000000000..ace4011a4 --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/WebIDLDOMDocs.d.ts @@ -0,0 +1,81 @@ +/** + * Minimal stubs to mirror lib.dom.d.ts documentation converted from WebIDL. + */ + +interface Node { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/textContent) */ + textContent: string | null; + /** + * Returns a copy of node. If deep is true, the copy also includes the node's descendants. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/cloneNode) + */ + cloneNode(subtree?: boolean): Node; +} + +interface Element extends Node {} +type HTMLElement = Element; +type SVGElement = Element; +type MathMLElement = Element; +type DocumentFragment = Node; + +interface ElementCreationOptions { + is?: string; +} + +/** + * A simple Document subset with WebIDL-derived comments. + */ +interface Document { + /** + * Creates an instance of the element for the specified tag. + * @param tagName The name of an element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createElement) + */ + createElement(tagName: string, options?: ElementCreationOptions): HTMLElement; + + /** + * Returns an element with namespace namespace. Its namespace prefix will be everything before ":" (U+003E) in qualifiedName or null. Its local name will be everything after ":" (U+003E) in qualifiedName or qualifiedName. + * + * If localName does not match the Name production an "InvalidCharacterError" DOMException will be thrown. + * + * If one of the following conditions is true a "NamespaceError" DOMException will be thrown: + * + * localName does not match the QName production. + * Namespace prefix is not null and namespace is the empty string. + * Namespace prefix is "xml" and namespace is not the XML namespace. + * qualifiedName or namespace prefix is "xmlns" and namespace is not the XMLNS namespace. + * namespace is the XMLNS namespace and neither qualifiedName nor namespace prefix is "xmlns". + * + * When supplied, options's is can be used to create a customized built-in element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createElementNS) + */ + createElementNS(namespaceURI: string | null, qualifiedName: string, options?: string | ElementCreationOptions): Element; + + /** + * Creates a TreeWalker object. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list + * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + * @returns The created TreeWalker. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createTreeWalker) + */ + createTreeWalker(root: Node, whatToShow?: number, filter?: (node: Node) => number | null): TreeWalker; +} + +interface TreeWalker { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TreeWalker/currentNode) */ + currentNode: Node; + /** + * Moves the currentNode to the next visible node in the document order. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TreeWalker/nextNode) + */ + nextNode(): Node | null; +} + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document) */ +export const document: Document; From 610b1a60bde271d90d7a2d74b94fedac909dd35e Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 5 Feb 2026 09:39:48 +0900 Subject: [PATCH 170/252] BridgeJS: Improve diagnostics and fix-its for macros Examples added/covered in this change: - @JSFunction: enforce throws(JSException) (missing or wrong type) with note + fix-it ("Declare throws(JSException)"). - @JSFunction: instance members outside @JSClass emit a clear diagnostic. - @JSGetter/@JSSetter: members (instance/static/class) outside @JSClass emit a clear diagnostic. - @JSSetter: invalid setter names (e.g. updateFoo) emit a diagnostic and suggest a rename fix-it (e.g. setFoo). - @JSSetter: missing value parameter emits a diagnostic and suggests adding a placeholder parameter. - @JSClass: using @JSClass on non-struct declarations emits a diagnostic; for "class" also suggests "Change 'class' to 'struct'". --- .../Sources/BridgeJSMacros/JSClassMacro.swift | 29 +- .../BridgeJSMacros/JSFunctionMacro.swift | 69 ++++- .../BridgeJSMacros/JSGetterMacro.swift | 36 ++- .../BridgeJSMacros/JSMacroSupport.swift | 188 ++++++++++++- .../BridgeJSMacros/JSSetterMacro.swift | 162 ++++++++++- .../JSClassMacroTests.swift | 30 +- .../JSFunctionMacroTests.swift | 261 ++++++++++++++---- .../JSGetterMacroTests.swift | 60 +++- .../JSSetterMacroTests.swift | 189 ++++++++++++- Sources/JavaScriptKit/Macros.swift | 2 +- 10 files changed, 937 insertions(+), 89 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift index 2641df4bf..79c3105ee 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift @@ -13,8 +13,35 @@ extension JSClassMacro: MemberMacro { in context: some MacroExpansionContext ) throws -> [DeclSyntax] { guard declaration.is(StructDeclSyntax.self) else { + var fixIts: [FixIt] = [] + let note = Note( + node: Syntax(declaration), + message: JSMacroNoteMessage( + message: "Use @JSClass on a struct wrapper to synthesize jsObject and JS bridging members." + ) + ) + + if let classDecl = declaration.as(ClassDeclSyntax.self) { + let structKeyword = classDecl.classKeyword.with(\.tokenKind, .keyword(.struct)) + fixIts.append( + FixIt( + message: JSMacroFixItMessage(message: "Change 'class' to 'struct'"), + changes: [ + .replace( + oldNode: Syntax(classDecl.classKeyword), + newNode: Syntax(structKeyword) + ) + ] + ) + ) + } context.diagnose( - Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedJSClassDeclaration) + Diagnostic( + node: Syntax(declaration), + message: JSMacroMessage.unsupportedJSClassDeclaration, + notes: [note], + fixIts: fixIts + ) ) return [] } diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift index a51bf10c5..0fff3546a 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift @@ -14,7 +14,17 @@ extension JSFunctionMacro: BodyMacro { if let functionDecl = declaration.as(FunctionDeclSyntax.self) { let enclosingTypeName = JSMacroHelper.enclosingTypeName(from: context) let isStatic = JSMacroHelper.isStatic(functionDecl.modifiers) - let isInstanceMember = enclosingTypeName != nil && !isStatic + let isTopLevel = enclosingTypeName == nil + let isInstanceMember = !isTopLevel && !isStatic + if !isTopLevel { + JSMacroHelper.diagnoseMissingJSClass(node: node, for: "JSFunction", in: context) + } + + JSMacroHelper.diagnoseThrowsRequiresJSException( + signature: functionDecl.signature, + on: Syntax(functionDecl), + in: context + ) // Strip backticks from function name (e.g., "`prefix`" -> "prefix") // Backticks are only needed for Swift identifiers, not function names @@ -34,8 +44,7 @@ extension JSFunctionMacro: BodyMacro { let effects = functionDecl.signature.effectSpecifiers let isAsync = effects?.asyncSpecifier != nil - let isThrows = effects?.throwsClause != nil - let prefix = JSMacroHelper.tryAwaitPrefix(isAsync: isAsync, isThrows: isThrows) + let prefix = JSMacroHelper.tryAwaitPrefix(isAsync: isAsync, isThrows: true) let isVoid = JSMacroHelper.isVoidReturn(functionDecl.signature.returnClause?.type) let line = isVoid ? "\(prefix)\(call)" : "return \(prefix)\(call)" @@ -45,11 +54,29 @@ extension JSFunctionMacro: BodyMacro { if let initializerDecl = declaration.as(InitializerDeclSyntax.self) { guard let enclosingTypeName = JSMacroHelper.enclosingTypeName(from: context) else { context.diagnose( - Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedDeclaration) + Diagnostic( + node: Syntax(declaration), + message: JSMacroMessage.unsupportedDeclaration, + notes: [ + Note( + node: Syntax(declaration), + message: JSMacroNoteMessage( + message: "Move this initializer inside a JS wrapper type annotated with @JSClass." + ) + ) + ] + ) ) return [CodeBlockItemSyntax(stringLiteral: "fatalError(\"@JSFunction init must be inside a type\")")] } + JSMacroHelper.diagnoseMissingJSClass(node: node, for: "JSFunction", in: context) + JSMacroHelper.diagnoseThrowsRequiresJSException( + signature: initializerDecl.signature, + on: Syntax(initializerDecl), + in: context + ) + let glueName = JSMacroHelper.glueName(baseName: "init", enclosingTypeName: enclosingTypeName) let parameters = initializerDecl.signature.parameterClause.parameters let arguments = JSMacroHelper.parameterNames(parameters) @@ -57,8 +84,7 @@ extension JSFunctionMacro: BodyMacro { let effects = initializerDecl.signature.effectSpecifiers let isAsync = effects?.asyncSpecifier != nil - let isThrows = effects?.throwsClause != nil - let prefix = JSMacroHelper.tryAwaitPrefix(isAsync: isAsync, isThrows: isThrows) + let prefix = JSMacroHelper.tryAwaitPrefix(isAsync: isAsync, isThrows: true) return [ CodeBlockItemSyntax(stringLiteral: "let jsObject = \(prefix)\(call)"), @@ -66,7 +92,20 @@ extension JSFunctionMacro: BodyMacro { ] } - context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedDeclaration)) + context.diagnose( + Diagnostic( + node: Syntax(declaration), + message: JSMacroMessage.unsupportedDeclaration, + notes: [ + Note( + node: Syntax(declaration), + message: JSMacroNoteMessage( + message: "Apply @JSFunction to a function or initializer on your @JSClass wrapper type." + ) + ) + ] + ) + ) return [] } } @@ -82,7 +121,21 @@ extension JSFunctionMacro: PeerMacro { ) throws -> [DeclSyntax] { if declaration.is(FunctionDeclSyntax.self) { return [] } if declaration.is(InitializerDeclSyntax.self) { return [] } - context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedDeclaration)) + context.diagnose( + Diagnostic( + node: Syntax(declaration), + message: JSMacroMessage.unsupportedDeclaration, + notes: [ + Note( + node: Syntax(declaration), + message: JSMacroNoteMessage( + message: + "Place @JSFunction on a function or initializer; use @JSGetter/@JSSetter for properties." + ) + ) + ] + ) + ) return [] } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift index 44c3620cf..a3b9435ea 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift @@ -15,13 +15,30 @@ extension JSGetterMacro: AccessorMacro { let binding = variableDecl.bindings.first, let identifier = binding.pattern.as(IdentifierPatternSyntax.self) else { - context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedVariable)) + context.diagnose( + Diagnostic( + node: Syntax(declaration), + message: JSMacroMessage.unsupportedVariable, + notes: [ + Note( + node: Syntax(declaration), + message: JSMacroNoteMessage( + message: "@JSGetter must be attached to a single stored or computed property." + ) + ) + ] + ) + ) return [] } let enclosingTypeName = JSMacroHelper.enclosingTypeName(from: context) let isStatic = JSMacroHelper.isStatic(variableDecl.modifiers) - let isInstanceMember = enclosingTypeName != nil && !isStatic + let isTopLevel = enclosingTypeName == nil + let isInstanceMember = !isTopLevel && !isStatic + if !isTopLevel { + JSMacroHelper.diagnoseMissingJSClass(node: node, for: "JSGetter", in: context) + } // Strip backticks from property name (e.g., "`prefix`" -> "prefix") // Backticks are only needed for Swift identifiers, not function names @@ -71,7 +88,20 @@ extension JSGetterMacro: PeerMacro { in context: some MacroExpansionContext ) throws -> [DeclSyntax] { guard declaration.is(VariableDeclSyntax.self) else { - context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedVariable)) + context.diagnose( + Diagnostic( + node: Syntax(declaration), + message: JSMacroMessage.unsupportedVariable, + notes: [ + Note( + node: Syntax(declaration), + message: JSMacroNoteMessage( + message: "@JSGetter must be attached to a single stored or computed property." + ) + ) + ] + ) + ) return [] } return [] diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift index 59fa1c4c2..c30d91dd1 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift @@ -11,26 +11,41 @@ enum JSMacroMessage: String, DiagnosticMessage { case invalidSetterName = "@JSSetter function name must start with 'set' followed by a property name (e.g., 'setFoo')." case setterRequiresParameter = "@JSSetter function must have at least one parameter." + case setterRequiresThrows = "@JSSetter function must declare throws(JSException)." + case jsFunctionRequiresThrows = "@JSFunction throws must be declared as throws(JSException)." + case requiresJSClass = "JavaScript members must be declared inside a @JSClass struct." var message: String { rawValue } var diagnosticID: MessageID { MessageID(domain: "JavaScriptKitMacros", id: rawValue) } var severity: DiagnosticSeverity { .error } } +struct JSMacroNoteMessage: NoteMessage { + let message: String + var noteID: MessageID { MessageID(domain: "JavaScriptKitMacros", id: message) } +} + +struct JSMacroFixItMessage: FixItMessage { + let message: String + var fixItID: MessageID { MessageID(domain: "JavaScriptKitMacros", id: message) } +} + +enum JSMacroText { + static let jsExceptionPropagation = "@JSFunction must propagate JavaScript errors as JSException." + static let jsSetterExceptionPropagation = "@JSSetter must propagate JavaScript errors as JSException." +} + enum JSMacroHelper { static func enclosingTypeName(from context: some MacroExpansionContext) -> String? { + enclosingTypeSyntax(from: context).flatMap(typeName(of:)) + } + + static func enclosingTypeSyntax(from context: some MacroExpansionContext) -> Syntax? { for syntax in context.lexicalContext { - if let decl = syntax.as(ClassDeclSyntax.self) { - return decl.name.text - } - if let decl = syntax.as(StructDeclSyntax.self) { - return decl.name.text - } - if let decl = syntax.as(EnumDeclSyntax.self) { - return decl.name.text - } - if let decl = syntax.as(ActorDeclSyntax.self) { - return decl.name.text + if syntax.is(ClassDeclSyntax.self) || syntax.is(StructDeclSyntax.self) + || syntax.is(EnumDeclSyntax.self) || syntax.is(ActorDeclSyntax.self) + { + return Syntax(syntax) } } return nil @@ -98,4 +113,155 @@ enum JSMacroHelper { } return name } + + static func capitalizingFirstLetter(_ value: String) -> String { + guard let first = value.first else { return value } + return first.uppercased() + value.dropFirst() + } + + static func hasJSClassAttribute(_ typeSyntax: Syntax) -> Bool { + guard let attributes = attributes(of: typeSyntax) else { return false } + for attribute in attributes.compactMap({ $0.as(AttributeSyntax.self) }) { + let name = attribute.attributeName.trimmedDescription + if name == "JSClass" || name == "@JSClass" { + return true + } + } + return false + } + + static func typeName(of syntax: Syntax) -> String? { + switch syntax.as(SyntaxEnum.self) { + case .structDecl(let decl): return decl.name.text + case .classDecl(let decl): return decl.name.text + case .enumDecl(let decl): return decl.name.text + case .actorDecl(let decl): return decl.name.text + default: return nil + } + } + + private static func attributes(of syntax: Syntax) -> AttributeListSyntax? { + switch syntax.as(SyntaxEnum.self) { + case .structDecl(let decl): return decl.attributes + case .classDecl(let decl): return decl.attributes + case .enumDecl(let decl): return decl.attributes + case .actorDecl(let decl): return decl.attributes + default: return nil + } + } + + static func diagnoseThrowsRequiresJSException( + signature: FunctionSignatureSyntax, + on node: Syntax, + in context: some MacroExpansionContext, + additionalNotes: [Note] = [] + ) { + let throwsClause = signature.effectSpecifiers?.throwsClause + let throwsTypeName = throwsClause?.type?.as(IdentifierTypeSyntax.self)?.name.text + let isJSException = throwsTypeName == "JSException" + let isAllowedGenericError = + throwsClause != nil + && (throwsTypeName == nil || throwsTypeName == "Error" || throwsTypeName == "Swift.Error") + guard !isJSException else { return } + guard !isAllowedGenericError else { return } + + let newThrowsClause = jsExceptionThrowsClause(from: throwsClause) + + let fixIt: FixIt + if let throwsClause = signature.effectSpecifiers?.throwsClause { + fixIt = FixIt( + message: JSMacroFixItMessage(message: "Declare throws(JSException)"), + changes: [.replace(oldNode: Syntax(throwsClause), newNode: Syntax(newThrowsClause))] + ) + } else { + let adjustedParameterClause = signature.parameterClause.with(\.rightParen.trailingTrivia, .spaces(0)) + let newEffects = FunctionEffectSpecifiersSyntax( + asyncSpecifier: signature.effectSpecifiers?.asyncSpecifier, + throwsClause: newThrowsClause + ) + let newSignature = + signature + .with(\.parameterClause, adjustedParameterClause) + .with(\.effectSpecifiers, newEffects) + fixIt = FixIt( + message: JSMacroFixItMessage(message: "Declare throws(JSException)"), + changes: [.replace(oldNode: Syntax(signature), newNode: Syntax(newSignature))] + ) + } + + var notes: [Note] = [ + jsExceptionPropagationNote(on: node) + ] + notes.append(contentsOf: additionalNotes) + + context.diagnose( + Diagnostic( + node: node, + message: JSMacroMessage.jsFunctionRequiresThrows, + notes: notes, + fixIts: [fixIt] + ) + ) + } + + static func diagnoseMissingJSClass( + node: some SyntaxProtocol, + for macroName: String, + in context: some MacroExpansionContext + ) { + guard let typeSyntax = enclosingTypeSyntax(from: context) else { return } + guard !hasJSClassAttribute(typeSyntax) else { return } + context.diagnose(Diagnostic(node: node, message: JSMacroMessage.requiresJSClass)) + } + + static func setterPropertyBase(from parameter: FunctionParameterSyntax?) -> String? { + guard let parameter else { return nil } + let candidateNames = [ + parameter.secondName, + parameter.firstName.tokenKind == .wildcard ? nil : parameter.firstName, + ].compactMap { $0?.text }.filter { $0 != "_" } + if let explicitName = candidateNames.first(where: { name in name != "value" && name != "newValue" }) { + return explicitName + } + if let identifierType = parameter.type.as(IdentifierTypeSyntax.self) { + let typeName = identifierType.name.text + guard let first = typeName.first else { return nil } + return first.lowercased() + typeName.dropFirst() + } + return candidateNames.first + } + + static func suggestedSetterName(rawFunctionName: String, firstParameter: FunctionParameterSyntax?) -> String? { + guard let base = setterPropertyBase(from: firstParameter) else { return nil } + return "set" + capitalizingFirstLetter(base) + } + + /// Build a typed throws(JSException) clause preserving trivia when possible. + static func jsExceptionThrowsClause(from throwsClause: ThrowsClauseSyntax?) -> ThrowsClauseSyntax { + let throwsSpecifier = (throwsClause?.throwsSpecifier ?? .keyword(.throws, leadingTrivia: .space)) + .with(\.trailingTrivia, .spaces(0)) + .with(\.leadingTrivia, throwsClause?.throwsSpecifier.leadingTrivia ?? .space) + let leftParen = throwsClause?.leftParen ?? .leftParenToken() + let rightParen = (throwsClause?.rightParen ?? .rightParenToken()) + .with(\.trailingTrivia, throwsClause?.rightParen?.trailingTrivia ?? .space) + + return ThrowsClauseSyntax( + throwsSpecifier: throwsSpecifier, + leftParen: leftParen, + type: TypeSyntax(IdentifierTypeSyntax(name: .identifier("JSException"))), + rightParen: rightParen + ) + } + + static func jsExceptionPropagationNote( + on node: Syntax, + message: String = JSMacroText.jsExceptionPropagation + ) -> Note { + Note( + node: node, + message: JSMacroNoteMessage( + message: message + ) + ) + } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift index 3c7280079..ba171e8eb 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift @@ -13,18 +13,86 @@ extension JSSetterMacro: BodyMacro { ) throws -> [CodeBlockItemSyntax] { guard let functionDecl = declaration.as(FunctionDeclSyntax.self) else { context.diagnose( - Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedSetterDeclaration) + Diagnostic( + node: Syntax(declaration), + message: JSMacroMessage.unsupportedSetterDeclaration, + notes: [ + Note( + node: Syntax(declaration), + message: JSMacroNoteMessage( + message: "@JSSetter can only be used on methods that set a JavaScript property." + ) + ) + ] + ) ) return [] } let functionName = functionDecl.name.text + let parameters = functionDecl.signature.parameterClause.parameters + let suggestedSetterName = JSMacroHelper.suggestedSetterName( + rawFunctionName: JSMacroHelper.stripBackticks(functionName), + firstParameter: parameters.first + ) + let renameFixIts: [FixIt] + if let name = suggestedSetterName { + let replacement = functionDecl.name.with(\.tokenKind, .identifier(name)) + .with(\.leadingTrivia, functionDecl.name.leadingTrivia) + .with(\.trailingTrivia, functionDecl.name.trailingTrivia) + renameFixIts = [ + FixIt( + message: JSMacroFixItMessage(message: "Rename setter to '\(name)'"), + changes: [.replace(oldNode: Syntax(functionDecl.name), newNode: Syntax(replacement))] + ) + ] + } else { + renameFixIts = [] + } + let addParameterFixIts: [FixIt] = { + let placeholderParameter = FunctionParameterSyntax( + firstName: .wildcardToken(trailingTrivia: .space), + secondName: .identifier("value"), + colon: .colonToken(trailingTrivia: .space), + type: TypeSyntax(stringLiteral: "<#Type#>") + ) + let newClause = FunctionParameterClauseSyntax( + leftParen: .leftParenToken(), + parameters: FunctionParameterListSyntax([placeholderParameter]), + rightParen: .rightParenToken(trailingTrivia: .space) + ) + return [ + FixIt( + message: JSMacroFixItMessage(message: "Add a value parameter to the setter"), + changes: [ + .replace( + oldNode: Syntax(functionDecl.signature.parameterClause), + newNode: Syntax(newClause) + ) + ] + ) + ] + }() // Extract property name from setter function name (e.g., "setFoo" -> "foo") // Strip backticks if present (e.g., "set`prefix`" -> "prefix") let rawFunctionName = JSMacroHelper.stripBackticks(functionName) guard rawFunctionName.hasPrefix("set"), rawFunctionName.count > 3 else { - context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.invalidSetterName)) + context.diagnose( + Diagnostic( + node: Syntax(declaration), + message: JSMacroMessage.invalidSetterName, + notes: [ + Note( + node: Syntax(functionDecl.name), + message: JSMacroNoteMessage( + message: "Setter names must start with 'set' followed by the property name." + ) + ) + ], + fixIts: renameFixIts + ) + ) return [ CodeBlockItemSyntax( stringLiteral: @@ -35,7 +103,21 @@ extension JSSetterMacro: BodyMacro { let propertyName = String(rawFunctionName.dropFirst(3)) guard !propertyName.isEmpty else { - context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.invalidSetterName)) + context.diagnose( + Diagnostic( + node: Syntax(declaration), + message: JSMacroMessage.invalidSetterName, + notes: [ + Note( + node: Syntax(functionDecl.name), + message: JSMacroNoteMessage( + message: "Setter names must include the property after 'set'." + ) + ) + ], + fixIts: renameFixIts + ) + ) return [ CodeBlockItemSyntax( stringLiteral: @@ -49,7 +131,11 @@ extension JSSetterMacro: BodyMacro { let enclosingTypeName = JSMacroHelper.enclosingTypeName(from: context) let isStatic = JSMacroHelper.isStatic(functionDecl.modifiers) - let isInstanceMember = enclosingTypeName != nil && !isStatic + let isTopLevel = enclosingTypeName == nil + let isInstanceMember = !isTopLevel && !isStatic + if !isTopLevel { + JSMacroHelper.diagnoseMissingJSClass(node: node, for: "JSSetter", in: context) + } let glueName = JSMacroHelper.glueName( baseName: baseName, @@ -63,9 +149,22 @@ extension JSSetterMacro: BodyMacro { } // Get the parameter name(s) - setters typically have one parameter - let parameters = functionDecl.signature.parameterClause.parameters guard let firstParam = parameters.first else { - context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.setterRequiresParameter)) + context.diagnose( + Diagnostic( + node: Syntax(declaration), + message: JSMacroMessage.setterRequiresParameter, + notes: [ + Note( + node: Syntax(declaration), + message: JSMacroNoteMessage( + message: "@JSSetter needs a parameter for the value being assigned." + ) + ) + ], + fixIts: addParameterFixIts + ) + ) return [ CodeBlockItemSyntax( stringLiteral: "fatalError(\"@JSSetter function must have at least one parameter\")" @@ -76,6 +175,44 @@ extension JSSetterMacro: BodyMacro { let paramName = firstParam.secondName ?? firstParam.firstName arguments.append(paramName.text) + // Ensure throws(JSException) is declared to match the generated body. + let existingThrowsClause = functionDecl.signature.effectSpecifiers?.throwsClause + let existingThrowsType = existingThrowsClause?.type + .flatMap { $0.as(IdentifierTypeSyntax.self)?.name.text } + let hasTypedJSException = existingThrowsType == "JSException" + let isAllowedGenericError = + existingThrowsClause != nil + && (existingThrowsType == nil || existingThrowsType == "Error" || existingThrowsType == "Swift.Error") + + if !hasTypedJSException && !isAllowedGenericError { + let throwsClause = JSMacroHelper.jsExceptionThrowsClause( + from: existingThrowsClause + ) + let newEffects = + (functionDecl.signature.effectSpecifiers + ?? FunctionEffectSpecifiersSyntax(asyncSpecifier: nil, throwsClause: nil)) + .with(\.throwsClause, throwsClause) + let newSignature = functionDecl.signature.with(\.effectSpecifiers, newEffects) + let fixIt = FixIt( + message: JSMacroFixItMessage(message: "Declare throws(JSException)"), + changes: [.replace(oldNode: Syntax(functionDecl.signature), newNode: Syntax(newSignature))] + ) + let notes: [Note] = [ + JSMacroHelper.jsExceptionPropagationNote( + on: Syntax(functionDecl), + message: JSMacroText.jsSetterExceptionPropagation + ) + ] + context.diagnose( + Diagnostic( + node: Syntax(functionDecl), + message: JSMacroMessage.setterRequiresThrows, + notes: notes, + fixIts: [fixIt] + ) + ) + } + let argsJoined = arguments.joined(separator: ", ") let call = "\(glueName)(\(argsJoined))" @@ -94,7 +231,18 @@ extension JSSetterMacro: PeerMacro { ) throws -> [DeclSyntax] { guard declaration.is(FunctionDeclSyntax.self) else { context.diagnose( - Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedSetterDeclaration) + Diagnostic( + node: Syntax(declaration), + message: JSMacroMessage.unsupportedSetterDeclaration, + notes: [ + Note( + node: Syntax(declaration), + message: JSMacroNoteMessage( + message: "@JSSetter should be attached to a method that writes a JavaScript property." + ) + ) + ] + ) ) return [] } diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift index 7640916e4..86a1f6b7c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift @@ -159,7 +159,17 @@ import BridgeJSMacros DiagnosticSpec( message: "@JSClass can only be applied to structs.", line: 1, - column: 1 + column: 1, + notes: [ + NoteSpec( + message: "Use @JSClass on a struct wrapper to synthesize jsObject and JS bridging members.", + line: 1, + column: 1 + ) + ], + fixIts: [ + FixItSpec(message: "Change 'class' to 'struct'") + ] ) ], macroSpecs: macroSpecs, @@ -182,7 +192,14 @@ import BridgeJSMacros DiagnosticSpec( message: "@JSClass can only be applied to structs.", line: 1, - column: 1 + column: 1, + notes: [ + NoteSpec( + message: "Use @JSClass on a struct wrapper to synthesize jsObject and JS bridging members.", + line: 1, + column: 1 + ) + ] ) ], macroSpecs: macroSpecs, @@ -205,7 +222,14 @@ import BridgeJSMacros DiagnosticSpec( message: "@JSClass can only be applied to structs.", line: 1, - column: 1 + column: 1, + notes: [ + NoteSpec( + message: "Use @JSClass on a struct wrapper to synthesize jsObject and JS bridging members.", + line: 1, + column: 1 + ) + ] ) ], macroSpecs: macroSpecs, diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift index 756935e7d..28eade958 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift @@ -15,13 +15,40 @@ import BridgeJSMacros TestSupport.assertMacroExpansion( """ @JSFunction - func greet(name: String) -> String + func greet(name: String) throws(JSException) -> String """, expandedSource: """ - func greet(name: String) -> String { - return _$greet(name) + func greet(name: String) throws(JSException) -> String { + return try _$greet(name) + } + """, + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, + ) + } + + @Test func instanceMethodRequiresJSClass() { + TestSupport.assertMacroExpansion( + """ + struct MyClass { + @JSFunction + func getName() throws(JSException) -> String + } + """, + expandedSource: """ + struct MyClass { + func getName() throws(JSException) -> String { + return try _$MyClass_getName(self.jsObject) + } } """, + diagnostics: [ + DiagnosticSpec( + message: "JavaScript members must be declared inside a @JSClass struct.", + line: 2, + column: 5 + ) + ], macroSpecs: macroSpecs, indentationWidth: indentationWidth, ) @@ -31,11 +58,11 @@ import BridgeJSMacros TestSupport.assertMacroExpansion( """ @JSFunction - func log(message: String) + func log(message: String) throws(JSException) """, expandedSource: """ - func log(message: String) { - _$log(message) + func log(message: String) throws(JSException) { + try _$log(message) } """, macroSpecs: macroSpecs, @@ -47,11 +74,11 @@ import BridgeJSMacros TestSupport.assertMacroExpansion( """ @JSFunction - func log(message: String) -> Void + func log(message: String) throws(JSException) -> Void """, expandedSource: """ - func log(message: String) -> Void { - _$log(message) + func log(message: String) throws(JSException) -> Void { + try _$log(message) } """, macroSpecs: macroSpecs, @@ -63,11 +90,11 @@ import BridgeJSMacros TestSupport.assertMacroExpansion( """ @JSFunction - func log(message: String) -> () + func log(message: String) throws(JSException) -> () """, expandedSource: """ - func log(message: String) -> () { - _$log(message) + func log(message: String) throws(JSException) -> () { + try _$log(message) } """, macroSpecs: macroSpecs, @@ -76,6 +103,22 @@ import BridgeJSMacros } @Test func topLevelFunctionThrows() { + TestSupport.assertMacroExpansion( + """ + @JSFunction + func parse(json: String) throws(JSException) -> [String: Any] + """, + expandedSource: """ + func parse(json: String) throws(JSException) -> [String: Any] { + return try _$parse(json) + } + """, + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, + ) + } + + @Test func topLevelFunctionThrowsMissingType() { TestSupport.assertMacroExpansion( """ @JSFunction @@ -91,15 +134,92 @@ import BridgeJSMacros ) } + @Test func topLevelFunctionThrowsWrongType() { + TestSupport.assertMacroExpansion( + """ + @JSFunction + func parse(json: String) throws(CustomError) -> [String: Any] + """, + expandedSource: """ + func parse(json: String) throws(CustomError) -> [String: Any] { + return try _$parse(json) + } + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSFunction throws must be declared as throws(JSException).", + line: 1, + column: 1, + severity: .error, + notes: [ + NoteSpec( + message: "@JSFunction must propagate JavaScript errors as JSException.", + line: 1, + column: 1 + ) + ], + fixIts: [ + FixItSpec(message: "Declare throws(JSException)") + ] + ) + ], + macroSpecs: macroSpecs, + applyFixIts: ["Declare throws(JSException)"], + fixedSource: """ + @JSFunction + func parse(json: String) throws(JSException) -> [String: Any] + """, + indentationWidth: indentationWidth, + ) + } + + @Test func topLevelFunctionMissingThrowsClause() { + TestSupport.assertMacroExpansion( + """ + @JSFunction + func greet(name: String) -> String + """, + expandedSource: """ + func greet(name: String) -> String { + return try _$greet(name) + } + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSFunction throws must be declared as throws(JSException).", + line: 1, + column: 1, + notes: [ + NoteSpec( + message: "@JSFunction must propagate JavaScript errors as JSException.", + line: 1, + column: 1 + ) + ], + fixIts: [ + FixItSpec(message: "Declare throws(JSException)") + ] + ) + ], + macroSpecs: macroSpecs, + applyFixIts: ["Declare throws(JSException)"], + fixedSource: """ + @JSFunction + func greet(name: String) throws(JSException) -> String + """, + indentationWidth: indentationWidth, + ) + } + @Test func topLevelFunctionAsync() { TestSupport.assertMacroExpansion( """ @JSFunction - func fetch(url: String) async -> String + func fetch(url: String) async throws(JSException) -> String """, expandedSource: """ - func fetch(url: String) async -> String { - return await _$fetch(url) + func fetch(url: String) async throws(JSException) -> String { + return try await _$fetch(url) } """, macroSpecs: macroSpecs, @@ -111,10 +231,10 @@ import BridgeJSMacros TestSupport.assertMacroExpansion( """ @JSFunction - func fetch(url: String) async throws -> String + func fetch(url: String) async throws(JSException) -> String """, expandedSource: """ - func fetch(url: String) async throws -> String { + func fetch(url: String) async throws(JSException) -> String { return try await _$fetch(url) } """, @@ -127,11 +247,11 @@ import BridgeJSMacros TestSupport.assertMacroExpansion( """ @JSFunction - func process(_ value: Int) -> Int + func process(_ value: Int) throws(JSException) -> Int """, expandedSource: """ - func process(_ value: Int) -> Int { - return _$process(value) + func process(_ value: Int) throws(JSException) -> Int { + return try _$process(value) } """, macroSpecs: macroSpecs, @@ -143,11 +263,11 @@ import BridgeJSMacros TestSupport.assertMacroExpansion( """ @JSFunction - func add(a: Int, b: Int) -> Int + func add(a: Int, b: Int) throws(JSException) -> Int """, expandedSource: """ - func add(a: Int, b: Int) -> Int { - return _$add(a, b) + func add(a: Int, b: Int) throws(JSException) -> Int { + return try _$add(a, b) } """, macroSpecs: macroSpecs, @@ -158,15 +278,17 @@ import BridgeJSMacros @Test func instanceMethod() { TestSupport.assertMacroExpansion( """ + @JSClass struct MyClass { @JSFunction - func getName() -> String + func getName() throws(JSException) -> String } """, expandedSource: """ + @JSClass struct MyClass { - func getName() -> String { - return _$MyClass_getName(self.jsObject) + func getName() throws(JSException) -> String { + return try _$MyClass_getName(self.jsObject) } } """, @@ -180,16 +302,23 @@ import BridgeJSMacros """ struct MyClass { @JSFunction - static func create() -> MyClass + static func create() throws(JSException) -> MyClass } """, expandedSource: """ struct MyClass { - static func create() -> MyClass { - return _$MyClass_create() + static func create() throws(JSException) -> MyClass { + return try _$MyClass_create() } } """, + diagnostics: [ + DiagnosticSpec( + message: "JavaScript members must be declared inside a @JSClass struct.", + line: 2, + column: 5 + ) + ], macroSpecs: macroSpecs, indentationWidth: indentationWidth, ) @@ -200,16 +329,23 @@ import BridgeJSMacros """ class MyClass { @JSFunction - class func create() -> MyClass + class func create() throws(JSException) -> MyClass } """, expandedSource: """ class MyClass { - class func create() -> MyClass { - return _$MyClass_create() + class func create() throws(JSException) -> MyClass { + return try _$MyClass_create() } } """, + diagnostics: [ + DiagnosticSpec( + message: "JavaScript members must be declared inside a @JSClass struct.", + line: 2, + column: 5 + ) + ], macroSpecs: macroSpecs, indentationWidth: indentationWidth, ) @@ -218,15 +354,17 @@ import BridgeJSMacros @Test func initializer() { TestSupport.assertMacroExpansion( """ + @JSClass struct MyClass { @JSFunction - init(name: String) + init(name: String) throws(JSException) } """, expandedSource: """ + @JSClass struct MyClass { - init(name: String) { - let jsObject = _$MyClass_init(name) + init(name: String) throws(JSException) { + let jsObject = try _$MyClass_init(name) self.init(unsafelyWrapping: jsObject) } } @@ -239,14 +377,16 @@ import BridgeJSMacros @Test func initializerThrows() { TestSupport.assertMacroExpansion( """ + @JSClass struct MyClass { @JSFunction - init(name: String) throws + init(name: String) throws(JSException) } """, expandedSource: """ + @JSClass struct MyClass { - init(name: String) throws { + init(name: String) throws(JSException) { let jsObject = try _$MyClass_init(name) self.init(unsafelyWrapping: jsObject) } @@ -260,14 +400,16 @@ import BridgeJSMacros @Test func initializerAsyncThrows() { TestSupport.assertMacroExpansion( """ + @JSClass struct MyClass { @JSFunction - init(name: String) async throws + init(name: String) async throws(JSException) } """, expandedSource: """ + @JSClass struct MyClass { - init(name: String) async throws { + init(name: String) async throws(JSException) { let jsObject = try await _$MyClass_init(name) self.init(unsafelyWrapping: jsObject) } @@ -293,7 +435,14 @@ import BridgeJSMacros DiagnosticSpec( message: "@JSFunction can only be applied to functions or initializers.", line: 1, - column: 1 + column: 1, + notes: [ + NoteSpec( + message: "Move this initializer inside a JS wrapper type annotated with @JSClass.", + line: 1, + column: 1 + ) + ] ) ], macroSpecs: macroSpecs, @@ -314,7 +463,15 @@ import BridgeJSMacros DiagnosticSpec( message: "@JSFunction can only be applied to functions or initializers.", line: 1, - column: 1 + column: 1, + notes: [ + NoteSpec( + message: + "Place @JSFunction on a function or initializer; use @JSGetter/@JSSetter for properties.", + line: 1, + column: 1 + ) + ] ) ], macroSpecs: macroSpecs, @@ -325,15 +482,17 @@ import BridgeJSMacros @Test func enumInstanceMethod() { TestSupport.assertMacroExpansion( """ + @JSClass enum MyEnum { @JSFunction - func getValue() -> Int + func getValue() throws(JSException) -> Int } """, expandedSource: """ + @JSClass enum MyEnum { - func getValue() -> Int { - return _$MyEnum_getValue(self.jsObject) + func getValue() throws(JSException) -> Int { + return try _$MyEnum_getValue(self.jsObject) } } """, @@ -345,15 +504,17 @@ import BridgeJSMacros @Test func actorInstanceMethod() { TestSupport.assertMacroExpansion( """ + @JSClass actor MyActor { @JSFunction - func getValue() -> Int + func getValue() throws(JSException) -> Int } """, expandedSource: """ + @JSClass actor MyActor { - func getValue() -> Int { - return _$MyActor_getValue(self.jsObject) + func getValue() throws(JSException) -> Int { + return try _$MyActor_getValue(self.jsObject) } } """, @@ -366,13 +527,13 @@ import BridgeJSMacros TestSupport.assertMacroExpansion( """ @JSFunction - func greet(name: String) -> String { + func greet(name: String) throws(JSException) -> String { return "Hello, \\(name)" } """, expandedSource: """ - func greet(name: String) -> String { - return _$greet(name) + func greet(name: String) throws(JSException) -> String { + return try _$greet(name) } """, macroSpecs: macroSpecs, diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift index 6e47475b1..0e4cea844 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift @@ -50,12 +50,14 @@ import BridgeJSMacros @Test func instanceProperty() { TestSupport.assertMacroExpansion( """ + @JSClass struct MyClass { @JSGetter var name: String } """, expandedSource: """ + @JSClass struct MyClass { var name: String { get throws(JSException) { @@ -69,15 +71,46 @@ import BridgeJSMacros ) } + @Test func instancePropertyRequiresJSClass() { + TestSupport.assertMacroExpansion( + """ + struct MyClass { + @JSGetter + var name: String + } + """, + expandedSource: """ + struct MyClass { + var name: String { + get throws(JSException) { + return try _$MyClass_name_get(self.jsObject) + } + } + } + """, + diagnostics: [ + DiagnosticSpec( + message: "JavaScript members must be declared inside a @JSClass struct.", + line: 2, + column: 5 + ) + ], + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, + ) + } + @Test func instanceLetProperty() { TestSupport.assertMacroExpansion( """ + @JSClass struct MyClass { @JSGetter let id: Int } """, expandedSource: """ + @JSClass struct MyClass { let id: Int { get throws(JSException) { @@ -108,6 +141,13 @@ import BridgeJSMacros } } """, + diagnostics: [ + DiagnosticSpec( + message: "JavaScript members must be declared inside a @JSClass struct.", + line: 2, + column: 5 + ) + ], macroSpecs: macroSpecs, indentationWidth: indentationWidth, ) @@ -130,6 +170,13 @@ import BridgeJSMacros } } """, + diagnostics: [ + DiagnosticSpec( + message: "JavaScript members must be declared inside a @JSClass struct.", + line: 2, + column: 5 + ) + ], macroSpecs: macroSpecs, indentationWidth: indentationWidth, ) @@ -138,12 +185,14 @@ import BridgeJSMacros @Test func enumProperty() { TestSupport.assertMacroExpansion( """ + @JSClass enum MyEnum { @JSGetter var value: Int } """, expandedSource: """ + @JSClass enum MyEnum { var value: Int { get throws(JSException) { @@ -160,12 +209,14 @@ import BridgeJSMacros @Test func actorProperty() { TestSupport.assertMacroExpansion( """ + @JSClass actor MyActor { @JSGetter var state: String } """, expandedSource: """ + @JSClass actor MyActor { var state: String { get throws(JSException) { @@ -262,7 +313,14 @@ import BridgeJSMacros message: "@JSGetter can only be applied to single-variable declarations.", line: 1, column: 1, - severity: .error + severity: .error, + notes: [ + NoteSpec( + message: "@JSGetter must be attached to a single stored or computed property.", + line: 1, + column: 1 + ) + ] ) ], macroSpecs: macroSpecs, diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift index 1ed4e1081..00d959921 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift @@ -46,12 +46,14 @@ import BridgeJSMacros @Test func instanceSetter() { TestSupport.assertMacroExpansion( """ + @JSClass struct MyClass { @JSSetter func setName(_ name: String) throws(JSException) } """, expandedSource: """ + @JSClass struct MyClass { func setName(_ name: String) throws(JSException) { try _$MyClass_name_set(self.jsObject, name) @@ -63,6 +65,33 @@ import BridgeJSMacros ) } + @Test func instanceSetterRequiresJSClass() { + TestSupport.assertMacroExpansion( + """ + struct MyClass { + @JSSetter + func setName(_ name: String) throws(JSException) + } + """, + expandedSource: """ + struct MyClass { + func setName(_ name: String) throws(JSException) { + try _$MyClass_name_set(self.jsObject, name) + } + } + """, + diagnostics: [ + DiagnosticSpec( + message: "JavaScript members must be declared inside a @JSClass struct.", + line: 2, + column: 5 + ) + ], + macroSpecs: macroSpecs, + indentationWidth: indentationWidth, + ) + } + @Test func staticSetter() { TestSupport.assertMacroExpansion( """ @@ -78,6 +107,13 @@ import BridgeJSMacros } } """, + diagnostics: [ + DiagnosticSpec( + message: "JavaScript members must be declared inside a @JSClass struct.", + line: 2, + column: 5 + ) + ], macroSpecs: macroSpecs, indentationWidth: indentationWidth, ) @@ -98,6 +134,13 @@ import BridgeJSMacros } } """, + diagnostics: [ + DiagnosticSpec( + message: "JavaScript members must be declared inside a @JSClass struct.", + line: 2, + column: 5 + ) + ], macroSpecs: macroSpecs, indentationWidth: indentationWidth, ) @@ -106,12 +149,14 @@ import BridgeJSMacros @Test func enumSetter() { TestSupport.assertMacroExpansion( """ + @JSClass enum MyEnum { @JSSetter func setValue(_ value: Int) throws(JSException) } """, expandedSource: """ + @JSClass enum MyEnum { func setValue(_ value: Int) throws(JSException) { try _$MyEnum_value_set(self.jsObject, value) @@ -126,12 +171,14 @@ import BridgeJSMacros @Test func actorSetter() { TestSupport.assertMacroExpansion( """ + @JSClass actor MyActor { @JSSetter func setState(_ state: String) throws(JSException) } """, expandedSource: """ + @JSClass actor MyActor { func setState(_ state: String) throws(JSException) { try _$MyActor_state_set(self.jsObject, state) @@ -177,7 +224,17 @@ import BridgeJSMacros message: "@JSSetter function name must start with 'set' followed by a property name (e.g., 'setFoo').", line: 1, - column: 1 + column: 1, + notes: [ + NoteSpec( + message: "Setter names must start with 'set' followed by the property name.", + line: 2, + column: 6 + ) + ], + fixIts: [ + FixItSpec(message: "Rename setter to 'setFoo'") + ] ) ], macroSpecs: macroSpecs, @@ -201,7 +258,17 @@ import BridgeJSMacros message: "@JSSetter function name must start with 'set' followed by a property name (e.g., 'setFoo').", line: 1, - column: 1 + column: 1, + notes: [ + NoteSpec( + message: "Setter names must start with 'set' followed by the property name.", + line: 2, + column: 6 + ) + ], + fixIts: [ + FixItSpec(message: "Rename setter to 'setFoo'") + ] ) ], macroSpecs: macroSpecs, @@ -224,10 +291,117 @@ import BridgeJSMacros DiagnosticSpec( message: "@JSSetter function must have at least one parameter.", line: 1, - column: 1 + column: 1, + notes: [ + NoteSpec( + message: "@JSSetter needs a parameter for the value being assigned.", + line: 1, + column: 1 + ) + ], + fixIts: [ + FixItSpec(message: "Add a value parameter to the setter") + ] + ) + ], + macroSpecs: macroSpecs, + applyFixIts: ["Add a value parameter to the setter"], + fixedSource: """ + @JSSetter + func setFoo(_ value: <#Type#>) throws(JSException) + """, + indentationWidth: indentationWidth, + ) + } + + @Test func setterMissingThrows() { + TestSupport.assertMacroExpansion( + """ + @JSSetter + func setFoo(_ value: Foo) + """, + expandedSource: """ + func setFoo(_ value: Foo) { + try _$foo_set(value) + } + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSSetter function must declare throws(JSException).", + line: 1, + column: 1, + notes: [ + NoteSpec( + message: "@JSSetter must propagate JavaScript errors as JSException.", + line: 1, + column: 1 + ) + ], + fixIts: [ + FixItSpec(message: "Declare throws(JSException)") + ] ) ], macroSpecs: macroSpecs, + applyFixIts: ["Declare throws(JSException)"], + fixedSource: """ + @JSSetter + func setFoo(_ value: Foo) throws(JSException) + """, + indentationWidth: indentationWidth, + ) + } + + @Test func setterThrowsWrongType() { + TestSupport.assertMacroExpansion( + """ + @JSSetter + func setFoo(_ value: Foo) throws(CustomError) + """, + expandedSource: """ + func setFoo(_ value: Foo) throws(CustomError) { + try _$foo_set(value) + } + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSSetter function must declare throws(JSException).", + line: 1, + column: 1, + notes: [ + NoteSpec( + message: "@JSSetter must propagate JavaScript errors as JSException.", + line: 1, + column: 1 + ) + ], + fixIts: [ + FixItSpec(message: "Declare throws(JSException)") + ] + ) + ], + macroSpecs: macroSpecs, + applyFixIts: ["Declare throws(JSException)"], + fixedSource: """ + @JSSetter + func setFoo(_ value: Foo) throws(JSException) + """, + indentationWidth: indentationWidth, + ) + } + + @Test func setterThrowsErrorAccepted() { + TestSupport.assertMacroExpansion( + """ + @JSSetter + func setFoo(_ value: Foo) throws(Error) + """, + expandedSource: """ + func setFoo(_ value: Foo) throws(Error) { + try _$foo_set(value) + } + """, + macroSpecs: macroSpecs, indentationWidth: indentationWidth, ) } @@ -245,7 +419,14 @@ import BridgeJSMacros DiagnosticSpec( message: "@JSSetter can only be applied to functions.", line: 1, - column: 1 + column: 1, + notes: [ + NoteSpec( + message: "@JSSetter should be attached to a method that writes a JavaScript property.", + line: 1, + column: 1 + ) + ] ) ], macroSpecs: macroSpecs, diff --git a/Sources/JavaScriptKit/Macros.swift b/Sources/JavaScriptKit/Macros.swift index 329945f2f..8decf1a76 100644 --- a/Sources/JavaScriptKit/Macros.swift +++ b/Sources/JavaScriptKit/Macros.swift @@ -202,7 +202,7 @@ public macro JSFunction(jsName: String? = nil, from: JSImportFrom? = nil) = /// /// - Parameter from: Selects where the constructor is looked up from. /// Use `.global` to construct globals like `WebSocket` via `globalThis`. -@attached(member, names: arbitrary) +@attached(member, names: named(jsObject), named(init(unsafelyWrapping:))) @attached(extension, conformances: _JSBridgedClass) @_spi(Experimental) public macro JSClass(jsName: String? = nil, from: JSImportFrom? = nil) = From 8217d069d66d1efa353f2894c31a2b3370abcf88 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 6 Feb 2026 18:39:14 +0900 Subject: [PATCH 171/252] BridgeJS: Add `JSTypedClosure` API (#578) The new API allows managing JS closures converted from Swift closures from Swift side. It allows us to get the underlying `JSObject` and manage its lifetime manually from Swift. ```swift @JS func makeIntToInt() throws(JSException) -> JSTypedClosure<(Int) -> Int> { return JSTypedClosure { x in return x + 1 } } @JSFunction func takeIntToInt(_ transform: JSTypedClosure<(Int) -> Int>) throws(JSException) let closure = JSTypedClosure<(Int) -> Int> { x in return x * 2 } defer { closure.release() } try takeIntToInt(closure) ``` Likewise to `JSClosure`, API users are responsible for "manually" releasing the closure when it's no longer needed by calling `release()`. After releasing, the closure becomes unusable and calling it will throw a JS exception (note that we will not segfault even if the closure is called after releasing). ```swift let closure = JSTypedClosure<(Int) -> Int> { x in return x * 2 } closure.release() try closure(10) // "JSException: Attempted to call a released JSTypedClosure created at :" ``` As a belt-and-suspenders measure, the underlying JS closure is also registered with a `FinalizationRegistry` to ensure that the Swift closure box is released when the JS closure is garbage collected, in case the API user forgets to call `release()`. However, relying on this mechanism is **not recommended** because the timing of garbage collection is non-deterministic and it's not guaranteed that it will happen in a timely manner. ---- On the top of the new API, this commit also fixes memory leak issues of closures exported to JS. --- Package.swift | 15 +- Package@swift-6.2.swift | 15 +- .../Sources/BridgeJSCore/ClosureCodegen.swift | 81 +- .../Sources/BridgeJSCore/ExportSwift.swift | 27 +- .../Sources/BridgeJSCore/ImportTS.swift | 61 +- .../BridgeJSCore/SwiftToSkeleton.swift | 31 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 188 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 44 +- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 19 +- .../BridgeJSCodegenTests/SwiftClosure.json | 60 +- .../BridgeJSCodegenTests/SwiftClosure.swift | 435 ++-- .../SwiftClosureImports.json | 6 +- .../SwiftClosureImports.swift | 42 +- .../BridgeJSLinkTests/SwiftClosure.js | 399 ++-- .../BridgeJSLinkTests/SwiftClosureImports.js | 49 +- Plugins/PackageToJS/Templates/instantiate.js | 1 + .../JavaScriptKit/BridgeJSIntrinsics.swift | 49 + .../FundamentalObjects/JSClosure.swift | 91 + .../ClosureSupportTests.swift | 290 +++ .../Generated/BridgeJS.swift | 1769 ++++++++++++----- .../Generated/JavaScript/BridgeJS.json | 1527 ++++++++++---- .../BridgeJSRuntimeTests/ImportAPITests.swift | 30 - .../ImportClosureAPIs.swift | 11 - .../JavaScript/ClosureSupportTests.mjs | 311 +++ .../JavaScriptKitTests.swift | 4 + Tests/prelude.mjs | 215 +- 26 files changed, 4105 insertions(+), 1665 deletions(-) create mode 100644 Tests/BridgeJSRuntimeTests/ClosureSupportTests.swift delete mode 100644 Tests/BridgeJSRuntimeTests/ImportClosureAPIs.swift create mode 100644 Tests/BridgeJSRuntimeTests/JavaScript/ClosureSupportTests.mjs diff --git a/Package.swift b/Package.swift index c7f3517e8..60adb7a5f 100644 --- a/Package.swift +++ b/Package.swift @@ -9,12 +9,15 @@ let useLegacyResourceBundling = Context.environment["JAVASCRIPTKIT_USE_LEGACY_RESOURCE_BUNDLING"].flatMap(Bool.init) ?? false let testingLinkerFlags: [LinkerSetting] = [ - .unsafeFlags([ - "-Xlinker", "--stack-first", - "-Xlinker", "--global-base=524288", - "-Xlinker", "-z", - "-Xlinker", "stack-size=524288", - ]) + .unsafeFlags( + [ + "-Xlinker", "--stack-first", + "-Xlinker", "--global-base=524288", + "-Xlinker", "-z", + "-Xlinker", "stack-size=524288", + ], + .when(platforms: [.wasi]) + ) ] let package = Package( diff --git a/Package@swift-6.2.swift b/Package@swift-6.2.swift index f640feeb7..20583865b 100644 --- a/Package@swift-6.2.swift +++ b/Package@swift-6.2.swift @@ -16,12 +16,15 @@ let tracingTrait = Trait( ) let testingLinkerFlags: [LinkerSetting] = [ - .unsafeFlags([ - "-Xlinker", "--stack-first", - "-Xlinker", "--global-base=524288", - "-Xlinker", "-z", - "-Xlinker", "stack-size=524288", - ]) + .unsafeFlags( + [ + "-Xlinker", "--stack-first", + "-Xlinker", "--global-base=524288", + "-Xlinker", "-z", + "-Xlinker", "stack-size=524288", + ], + .when(platforms: [.wasi]) + ) ] let package = Package( diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift index 30cf8b2c2..12e4a413c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift @@ -16,7 +16,7 @@ public struct ClosureCodegen { func collectClosureSignatures(from type: BridgeType, into signatures: inout Set) { switch type { - case .closure(let signature): + case .closure(let signature, _): signatures.insert(signature) for paramType in signature.parameters { collectClosureSignatures(from: paramType, into: &signatures) @@ -32,7 +32,6 @@ public struct ClosureCodegen { func renderClosureHelpers(_ signature: ClosureSignature) throws -> [DeclSyntax] { let mangledName = signature.mangleName let helperName = "_BJS_Closure_\(mangledName)" - let boxClassName = "_BJS_ClosureBox_\(mangledName)" let closureParams = signature.parameters.enumerated().map { _, type in "\(type.swiftType)" @@ -40,7 +39,7 @@ public struct ClosureCodegen { let swiftEffects = (signature.isAsync ? " async" : "") + (signature.isThrows ? " throws" : "") let swiftReturnType = signature.returnType.swiftType - let closureType = "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)" + let swiftClosureType = "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)" let externName = "invoke_js_callback_\(signature.moduleName)_\(mangledName)" @@ -69,13 +68,15 @@ public struct ClosureCodegen { // Generate extern declaration using CallJSEmission let externDecl = builder.renderImportDecl() - let boxClassDecl: DeclSyntax = """ - private final class \(raw: boxClassName): _BridgedSwiftClosureBox { - let closure: \(raw: closureType) - init(_ closure: @escaping \(raw: closureType)) { - self.closure = closure - } + let makeClosureExternDecl: DeclSyntax = """ + #if arch(wasm32) + @_extern(wasm, module: "bjs", name: "make_swift_closure_\(raw: signature.moduleName)_\(raw: signature.mangleName)") + fileprivate func make_swift_closure_\(raw: signature.moduleName)_\(raw: signature.mangleName)(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 + #else + fileprivate func make_swift_closure_\(raw: signature.moduleName)_\(raw: signature.mangleName)(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } + #endif """ let helperEnumDecl = EnumDeclSyntax( @@ -84,33 +85,6 @@ public struct ClosureCodegen { }, name: .identifier(helperName), memberBlockBuilder: { - DeclSyntax( - FunctionDeclSyntax( - modifiers: DeclModifierListSyntax { - DeclModifierSyntax(name: .keyword(.static)) - }, - name: .identifier("bridgeJSLower"), - signature: FunctionSignatureSyntax( - parameterClause: FunctionParameterClauseSyntax { - FunctionParameterSyntax( - firstName: .wildcardToken(), - secondName: .identifier("closure"), - colon: .colonToken(), - type: TypeSyntax("@escaping \(raw: closureType)") - ) - }, - returnClause: ReturnClauseSyntax( - arrow: .arrowToken(), - type: IdentifierTypeSyntax(name: .identifier("UnsafeMutableRawPointer")) - ) - ), - body: CodeBlockSyntax { - "let box = \(raw: boxClassName)(closure)" - "return Unmanaged.passRetained(box).toOpaque()" - } - ) - ) - DeclSyntax( FunctionDeclSyntax( modifiers: DeclModifierListSyntax { @@ -128,7 +102,7 @@ public struct ClosureCodegen { }, returnClause: ReturnClauseSyntax( arrow: .arrowToken(), - type: IdentifierTypeSyntax(name: .identifier(closureType)) + type: IdentifierTypeSyntax(name: .identifier(swiftClosureType)) ) ), body: CodeBlockSyntax { @@ -178,11 +152,32 @@ public struct ClosureCodegen { ) } ) - return [externDecl, boxClassDecl, DeclSyntax(helperEnumDecl)] + let typedClosureExtension: DeclSyntax = """ + extension JSTypedClosure where Signature == \(raw: swiftClosureType) { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping \(raw: swiftClosureType)) { + self.init( + makeClosure: make_swift_closure_\(raw: signature.moduleName)_\(raw: signature.mangleName), + body: body, + fileID: fileID, + line: line + ) + } + } + """ + + return [ + externDecl, makeClosureExternDecl, DeclSyntax(helperEnumDecl), typedClosureExtension, + ] } func renderClosureInvokeHandler(_ signature: ClosureSignature) throws -> DeclSyntax { - let boxClassName = "_BJS_ClosureBox_\(signature.mangleName)" + let closureParams = signature.parameters.enumerated().map { _, type in + "\(type.swiftType)" + }.joined(separator: ", ") + let swiftEffects = (signature.isAsync ? " async" : "") + (signature.isThrows ? " throws" : "") + let swiftReturnType = signature.returnType.swiftType + let swiftClosureType = "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)" + let boxType = "_BridgeJSTypedClosureBox<\(swiftClosureType)>" let abiName = "invoke_swift_closure_\(signature.moduleName)_\(signature.mangleName)" // Build ABI parameters directly with WasmCoreType (no string conversion needed) @@ -205,7 +200,7 @@ public struct ClosureCodegen { liftedParams.append("\(paramType.swiftType).bridgeJSLiftParameter(\(argNames.joined(separator: ", ")))") } - let closureCallExpr = ExprSyntax("box.closure(\(raw: liftedParams.joined(separator: ", ")))") + let closureCallExpr = ExprSyntax("closure(\(raw: liftedParams.joined(separator: ", ")))") // Determine return type let abiReturnWasmType: WasmCoreType? @@ -217,6 +212,8 @@ public struct ClosureCodegen { abiReturnWasmType = nil } + let throwReturn = abiReturnWasmType?.swiftReturnPlaceholderStmt ?? "return" + // Build signature using SwiftSignatureBuilder let funcSignature = SwiftSignatureBuilder.buildABIFunctionSignature( abiParameters: abiParams, @@ -225,7 +222,7 @@ public struct ClosureCodegen { // Build body let body = CodeBlockItemListSyntax { - "let box = Unmanaged<\(raw: boxClassName)>.fromOpaque(boxPtr).takeUnretainedValue()" + "let closure = Unmanaged<\(raw: boxType)>.fromOpaque(boxPtr).takeUnretainedValue().closure" if signature.returnType == .void { closureCallExpr } else { @@ -315,7 +312,7 @@ public struct ClosureCodegen { for setter in type.setters { collectClosureSignatures(from: setter.type, into: &closureSignatures) } - for method in type.methods { + for method in type.methods + type.staticMethods { collectClosureSignatures(from: method.parameters, into: &closureSignatures) collectClosureSignatures(from: method.returnType, into: &closureSignatures) } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index aa01a2c5c..acff21847 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -124,7 +124,7 @@ public class ExportSwift { let liftingExpr: ExprSyntax switch param.type { - case .closure(let signature): + case .closure(let signature, _): typeNameForIntrinsic = param.type.swiftType liftingExpr = ExprSyntax("_BJS_Closure_\(raw: signature.mangleName).bridgeJSLift(\(raw: param.name))") case .swiftStruct(let structName): @@ -364,8 +364,8 @@ public class ExportSwift { } switch returnType { - case .closure(let signature): - append("return _BJS_Closure_\(raw: signature.mangleName).bridgeJSLower(ret)") + case .closure(_, useJSTypedClosure: false): + append("return JSTypedClosure(ret).bridgeJSLowerReturn()") case .array, .nullable(.array, _): let stackCodegen = StackCodegen() for stmt in stackCodegen.lowerStatements(for: returnType, accessor: "ret", varPrefix: "ret") { @@ -423,14 +423,7 @@ public class ExportSwift { } private func returnPlaceholderStmt() -> String { - switch abiReturnType { - case .i32: return "return 0" - case .i64: return "return 0" - case .f32: return "return 0.0" - case .f64: return "return 0.0" - case .pointer: return "return UnsafeMutableRawPointer(bitPattern: -1).unsafelyUnwrapped" - case .none: return "return" - } + return abiReturnType?.swiftReturnPlaceholderStmt ?? "return" } } @@ -1749,13 +1742,19 @@ extension BridgeType { case .associatedValueEnum(let name): return name case .swiftStruct(let name): return name case .namespaceEnum(let name): return name - case .closure(let signature): + case .closure(let signature, let useJSTypedClosure): let paramTypes = signature.parameters.map { $0.swiftType }.joined(separator: ", ") let effectsStr = (signature.isAsync ? " async" : "") + (signature.isThrows ? " throws" : "") - return "(\(paramTypes))\(effectsStr) -> \(signature.returnType.swiftType)" + let closureType = "(\(paramTypes))\(effectsStr) -> \(signature.returnType.swiftType)" + return useJSTypedClosure ? "JSTypedClosure<\(closureType)>" : closureType } } + var isClosureType: Bool { + if case .closure = self { return true } + return false + } + struct LiftingIntrinsicInfo: Sendable { let parameters: [(name: String, type: WasmCoreType)] @@ -1853,7 +1852,7 @@ extension BridgeType { case .namespaceEnum: throw BridgeJSCoreError("Namespace enums are not supported to pass as parameters") case .closure: - return .swiftHeapObject + return .jsObject case .array, .dictionary: return .array } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 7c3ecd6ea..0424d8ca0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -85,6 +85,8 @@ public struct ImportTS { var destructuredVarNames: [String] = [] // Stack-lowered parameters should be evaluated in reverse order to match LIFO stacks var stackLoweringStmts: [CodeBlockItemSyntax] = [] + // Values to extend lifetime during call + var valuesToExtendLifetimeDuringCall: [ExprSyntax] = [] init(moduleName: String, abiName: String, context: BridgeContext = .importTS) { self.moduleName = moduleName @@ -95,15 +97,17 @@ public struct ImportTS { func lowerParameter(param: Parameter) throws { let loweringInfo = try param.type.loweringParameterInfo(context: context) - let initializerExpr: ExprSyntax switch param.type { - case .closure(let signature): - initializerExpr = ExprSyntax( - "_BJS_Closure_\(raw: signature.mangleName).bridgeJSLower(\(raw: param.name))" - ) + case .closure(let signature, useJSTypedClosure: false): + let jsTypedClosureType = BridgeType.closure(signature, useJSTypedClosure: true).swiftType + body.append("let \(raw: param.name) = \(raw: jsTypedClosureType)(\(raw: param.name))") + // The just created JSObject is not owned by the caller unlike those passed in parameters, + // so we need to extend its lifetime during the call to ensure the JSObject.id is valid. + valuesToExtendLifetimeDuringCall.append("\(raw: param.name)") default: - initializerExpr = ExprSyntax("\(raw: param.name).bridgeJSLowerParameter()") + break } + let initializerExpr = ExprSyntax("\(raw: param.name).bridgeJSLowerParameter()") if loweringInfo.loweredParameters.isEmpty { let stmt = CodeBlockItemSyntax( @@ -193,7 +197,7 @@ public struct ImportTS { let liftingInfo = try returnType.liftingReturnInfo(context: context) body.append(contentsOf: stackLoweringStmts) - let callExpr = FunctionCallExprSyntax( + var callExpr = FunctionCallExprSyntax( calledExpression: ExprSyntax("\(raw: abiName)"), leftParen: .leftParenToken(), arguments: LabeledExprListSyntax { @@ -204,12 +208,33 @@ public struct ImportTS { rightParen: .rightParenToken() ) - if returnType == .void { - body.append(CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr))))) - } else if returnType.usesSideChannelForOptionalReturn() { - // Side channel returns don't need "let ret =" - body.append(CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr))))) - } else if liftingInfo.valueToLift == nil { + if !valuesToExtendLifetimeDuringCall.isEmpty { + callExpr = FunctionCallExprSyntax( + calledExpression: ExprSyntax("withExtendedLifetime"), + leftParen: .leftParenToken(), + arguments: LabeledExprListSyntax { + LabeledExprSyntax( + expression: TupleExprSyntax( + elements: LabeledExprListSyntax { + for value in valuesToExtendLifetimeDuringCall { + LabeledExprSyntax(expression: value) + } + } + ) + ) + }, + rightParen: .rightParenToken(), + trailingClosure: ClosureExprSyntax( + leftBrace: .leftBraceToken(), + statements: CodeBlockItemListSyntax { + CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr)))) + }, + rightBrace: .rightBraceToken() + ) + ) + } + + if returnType == .void || returnType.usesSideChannelForOptionalReturn() || liftingInfo.valueToLift == nil { body.append(CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr))))) } else { body.append("let ret = \(raw: callExpr)") @@ -249,7 +274,7 @@ public struct ImportTS { abiReturnType = liftingInfo.valueToLift let liftExpr: ExprSyntax switch returnType { - case .closure(let signature): + case .closure(let signature, _): liftExpr = ExprSyntax("_BJS_Closure_\(raw: signature.mangleName).bridgeJSLift(ret)") default: if liftingInfo.valueToLift != nil { @@ -722,11 +747,9 @@ struct SwiftSignatureBuilder { } /// Builds a parameter type syntax from a BridgeType. - /// - /// Swift closure parameters must be `@escaping` because they are boxed and can be invoked from JavaScript. static func buildParameterTypeSyntax(from type: BridgeType) -> TypeSyntax { switch type { - case .closure: + case .closure(_, useJSTypedClosure: false): return TypeSyntax("@escaping \(raw: type.swiftType)") default: return buildTypeSyntax(from: type) @@ -930,8 +953,8 @@ extension BridgeType { case .jsValue: return .jsValue case .void: return .void case .closure: - // Swift closure is boxed and passed to JS as a pointer. - return LoweringParameterInfo(loweredParameters: [("pointer", .pointer)]) + // Swift closure is passed to JS as a JS function reference. + return LoweringParameterInfo(loweredParameters: [("funcRef", .i32)]) case .unsafePointer: return LoweringParameterInfo(loweredParameters: [("pointer", .pointer)]) case .swiftHeapObject(let className): diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index e571d955e..1d775fbc6 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -100,6 +100,17 @@ public final class SwiftToSkeleton { return lookupType(for: attributedType.baseType, errors: &errors) } + if let identifierType = type.as(IdentifierTypeSyntax.self), + identifierType.name.text == "JSTypedClosure", + let genericArgs = identifierType.genericArgumentClause?.arguments, + genericArgs.count == 1, + let argument = genericArgs.firstAsTypeSyntax, + let signatureType = lookupType(for: argument, errors: &errors), + case .closure(let signature, false) = signatureType + { + return .closure(signature, useJSTypedClosure: true) + } + // (T1, T2, ...) -> R if let functionType = type.as(FunctionTypeSyntax.self) { var parameters: [BridgeType] = [] @@ -124,7 +135,8 @@ public final class SwiftToSkeleton { moduleName: moduleName, isAsync: isAsync, isThrows: isThrows - ) + ), + useJSTypedClosure: false ) } @@ -889,7 +901,7 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { guard let type = resolvedType else { continue // Skip unsupported types } - if case .closure(let signature) = type { + if case .closure(let signature, _) = type { if signature.isAsync { diagnose( node: param.type, @@ -2537,3 +2549,18 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor { } } } + +extension GenericArgumentListSyntax { + /// Compatibility helper for accessing the first argument as a TypeSyntax + /// + /// Note: SwiftSyntax 601 and later support InlineArrayTypeSyntax and + /// ``GenericArgumentSyntax/argument`` is now a ``TypeSyntax`` or ``ExprSyntax``. + fileprivate var firstAsTypeSyntax: TypeSyntax? { + guard let first = self.first else { return nil } + #if canImport(SwiftSyntax601) + return first.argument.as(TypeSyntax.self) + #else + return TypeSyntax(first.argument) + #endif + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index e77bfd870..1be1f4966 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -261,46 +261,6 @@ public struct BridgeJSLink { ] } - /// Checks if a skeleton contains any closure types - private func hasClosureTypes(in skeleton: ExportedSkeleton) -> Bool { - for function in skeleton.functions { - if containsClosureType(in: function.parameters) || containsClosureType(in: function.returnType) { - return true - } - } - for klass in skeleton.classes { - if let constructor = klass.constructor, containsClosureType(in: constructor.parameters) { - return true - } - for method in klass.methods { - if containsClosureType(in: method.parameters) || containsClosureType(in: method.returnType) { - return true - } - } - for property in klass.properties { - if containsClosureType(in: property.type) { - return true - } - } - } - return false - } - - private func containsClosureType(in parameters: [Parameter]) -> Bool { - parameters.contains { containsClosureType(in: $0.type) } - } - - private func containsClosureType(in type: BridgeType) -> Bool { - switch type { - case .closure: - return true - case .nullable(let wrapped, _): - return containsClosureType(in: wrapped) - default: - return false - } - } - private func generateAddImports(needsImportsObject: Bool) -> CodeFragmentPrinter { let printer = CodeFragmentPrinter() let allStructs = skeletons.compactMap { $0.exported?.structs }.flatMap { $0 } @@ -655,6 +615,71 @@ public struct BridgeJSLink { guard !closureSignatures.isEmpty else { continue } + intrinsicRegistry.register(name: "swiftClosureHelpers") { helperPrinter in + helperPrinter.write( + "const \(JSGlueVariableScope.reservedSwiftClosureRegistry) = (typeof FinalizationRegistry === \"undefined\") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => {" + ) + helperPrinter.indent { + helperPrinter.write("if (state.unregistered) { return; }") + helperPrinter.write( + "\(JSGlueVariableScope.reservedInstance)?.exports?.bjs_release_swift_closure(state.pointer);" + ) + } + helperPrinter.write("});") + helperPrinter.write( + "const \(JSGlueVariableScope.reservedMakeSwiftClosure) = (pointer, file, line, func) => {" + ) + helperPrinter.indent { + helperPrinter.write( + "const state = { pointer, file, line, unregistered: false };" + ) + helperPrinter.write("const real = (...args) => {") + helperPrinter.indent { + helperPrinter.write("if (state.unregistered) {") + helperPrinter.indent { + helperPrinter.write( + "const bytes = new Uint8Array(\(JSGlueVariableScope.reservedMemory).buffer, state.file);" + ) + helperPrinter.write("let length = 0;") + helperPrinter.write("while (bytes[length] !== 0) { length += 1; }") + helperPrinter.write( + "const fileID = \(JSGlueVariableScope.reservedTextDecoder).decode(bytes.subarray(0, length));" + ) + helperPrinter.write( + "throw new Error(`Attempted to call a released JSTypedClosure created at ${fileID}:${state.line}`);" + ) + } + helperPrinter.write("}") + helperPrinter.write("return func(...args);") + } + helperPrinter.write("};") + helperPrinter.write( + "real.__unregister = () => {" + ) + helperPrinter.indent { + helperPrinter.write( + "if (state.unregistered) { return; }" + ) + helperPrinter.write("state.unregistered = true;") + helperPrinter.write( + "\(JSGlueVariableScope.reservedSwiftClosureRegistry).unregister(state);" + ) + } + helperPrinter.write("};") + helperPrinter.write( + "\(JSGlueVariableScope.reservedSwiftClosureRegistry).register(real, state, state);" + ) + helperPrinter.write("return \(JSGlueVariableScope.reservedSwift).memory.retain(real);") + } + helperPrinter.write("};") + } + printer.write("bjs[\"swift_js_closure_unregister\"] = function(funcRef) {") + printer.indent { + printer.write("const func = \(JSGlueVariableScope.reservedSwift).memory.getObject(funcRef);") + printer.write("func.__unregister();") + } + printer.write("}") + for signature in closureSignatures.sorted(by: { $0.mangleName < $1.mangleName }) { let invokeFuncName = "invoke_js_callback_\(moduleName)_\(signature.mangleName)" printer.write( @@ -665,12 +690,17 @@ public struct BridgeJSLink { ) let lowerFuncName = "lower_closure_\(moduleName)_\(signature.mangleName)" - printer.write( - lines: generateLowerClosureFunction( - signature: signature, - functionName: lowerFuncName + let makeFuncName = "make_swift_closure_\(moduleName)_\(signature.mangleName)" + printer.write("bjs[\"\(makeFuncName)\"] = function(boxPtr, file, line) {") + printer.indent { + printer.write( + lines: generateLowerClosureFunction(signature: signature, functionName: lowerFuncName) ) - ) + printer.write( + "return \(JSGlueVariableScope.reservedMakeSwiftClosure)(boxPtr, file, line, \(lowerFuncName));" + ) + } + printer.write("}") } } } @@ -721,7 +751,7 @@ public struct BridgeJSLink { for setter in type.setters { collectClosureSignatures(from: setter.type, into: &signatures) } - for method in type.methods { + for method in type.methods + type.staticMethods { collectClosureSignatures(from: method.parameters, into: &signatures) collectClosureSignatures(from: method.returnType, into: &signatures) } @@ -737,7 +767,7 @@ public struct BridgeJSLink { private func collectClosureSignatures(from type: BridgeType, into signatures: inout Set) { switch type { - case .closure(let signature): + case .closure(let signature, _): signatures.insert(signature) for paramType in signature.parameters { collectClosureSignatures(from: paramType, into: &signatures) @@ -827,44 +857,40 @@ public struct BridgeJSLink { let scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) let cleanupCode = CodeFragmentPrinter() - printer.nextLine() - printer.write("bjs[\"\(functionName)\"] = function(closurePtr) {") + printer.write( + "const \(functionName) = function(\(signature.parameters.indices.map { "param\($0)" }.joined(separator: ", "))) {" + ) printer.indent { - printer.write( - "return function(\(signature.parameters.indices.map { "param\($0)" }.joined(separator: ", "))) {" - ) - printer.indent { - printer.write("try {") - printer.indent { - var invokeArgs: [String] = ["closurePtr"] + var invokeArgs: [String] = ["boxPtr"] - for (index, paramType) in signature.parameters.enumerated() { - let paramName = "param\(index)" - let fragment = try! IntrinsicJSFragment.lowerParameter(type: paramType) - let lowered = fragment.printCode([paramName], scope, printer, cleanupCode) - invokeArgs.append(contentsOf: lowered) - } + for (index, paramType) in signature.parameters.enumerated() { + let paramName = "param\(index)" + let fragment = try! IntrinsicJSFragment.lowerParameter(type: paramType) + let lowered = fragment.printCode([paramName], scope, printer, cleanupCode) + invokeArgs.append(contentsOf: lowered) + } - // Call the Swift invoke function - let invokeCall = - "\(JSGlueVariableScope.reservedInstance).exports.invoke_swift_closure_\(signature.moduleName)_\(signature.mangleName)(\(invokeArgs.joined(separator: ", ")))" + // Call the Swift invoke function + let invokeCall = + "\(JSGlueVariableScope.reservedInstance).exports.invoke_swift_closure_\(signature.moduleName)_\(signature.mangleName)(\(invokeArgs.joined(separator: ", ")))" + let invokeResultName = "invokeResult" + printer.write("const \(invokeResultName) = \(invokeCall);") - let returnFragment = try! IntrinsicJSFragment.closureLiftReturn(type: signature.returnType) - _ = returnFragment.printCode([invokeCall], scope, printer, cleanupCode) - } - printer.write("} catch (error) {") - printer.indent { - printer.write("\(JSGlueVariableScope.reservedSetException)?.(error);") - switch signature.returnType { - case .void: - printer.write("return;") - default: - printer.write("throw error;") - } - } - printer.write("}") + printer.write("if (\(JSGlueVariableScope.reservedStorageToReturnException)) {") + printer.indent { + printer.write( + "const error = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(JSGlueVariableScope.reservedStorageToReturnException));" + ) + printer.write( + "\(JSGlueVariableScope.reservedSwift).memory.release(\(JSGlueVariableScope.reservedStorageToReturnException));" + ) + printer.write("\(JSGlueVariableScope.reservedStorageToReturnException) = undefined;") + printer.write("throw error;") } - printer.write("};") + printer.write("}") + + let returnFragment = try! IntrinsicJSFragment.closureLiftReturn(type: signature.returnType) + _ = returnFragment.printCode([invokeResultName], scope, printer, cleanupCode) } printer.write("};") @@ -3552,7 +3578,7 @@ extension BridgeType { return name case .swiftProtocol(let name): return name - case .closure(let signature): + case .closure(let signature, _): let paramTypes = signature.parameters.enumerated().map { index, param in "arg\(index): \(param.tsType)" }.joined(separator: ", ") diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 8d909623c..dec77b3cb 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -29,6 +29,8 @@ final class JSGlueVariableScope { static let reservedTmpStructCleanups = "tmpStructCleanups" static let reservedEnumHelpers = "enumHelpers" static let reservedStructHelpers = "structHelpers" + static let reservedSwiftClosureRegistry = "swiftClosureRegistry" + static let reservedMakeSwiftClosure = "makeClosure" private let intrinsicRegistry: JSIntrinsicRegistry @@ -56,6 +58,8 @@ final class JSGlueVariableScope { reservedTmpStructCleanups, reservedEnumHelpers, reservedStructHelpers, + reservedSwiftClosureRegistry, + reservedMakeSwiftClosure, ] init(intrinsicRegistry: JSIntrinsicRegistry) { @@ -660,6 +664,9 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") resultExpr = "\(isSome) ? \(objectLabel) : \(absenceLiteral)" + case .closure: + resultExpr = + "\(isSome) ? \(JSGlueVariableScope.reservedSwift).memory.getObject(\(wrappedValue)) : \(absenceLiteral)" case .swiftHeapObject(let name): resultExpr = "\(isSome) ? \(name).__construct(\(wrappedValue)) : \(absenceLiteral)" case .jsObject: @@ -1392,7 +1399,7 @@ struct IntrinsicJSFragment: Sendable { let absenceLiteral = kind.absenceLiteral switch wrappedType { case .string, .rawValueEnum, .int, .bool, .double, .float, .jsObject, .swiftHeapObject, .caseEnum, - .associatedValueEnum: + .associatedValueEnum, .closure: break default: throw BridgeJSLinkError( @@ -1445,6 +1452,9 @@ struct IntrinsicJSFragment: Sendable { printer.write( "\(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(value));" ) + case .closure: + printer.write("\(targetVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(value));") + printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(value));") default: fatalError("Unsupported optional wrapped type in closure parameter lifting: \(wrappedType)") } @@ -1731,6 +1741,20 @@ struct IntrinsicJSFragment: Sendable { return [] } ) + case .closure: + return IntrinsicJSFragment( + parameters: ["invokeCall"], + printCode: { arguments, scope, printer, cleanupCode in + let funcRefVar = scope.variable("swiftClosureFuncRef") + printer.write("const \(funcRefVar) = \(arguments[0]);") + printer.write( + "const funcObj = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(funcRefVar));" + ) + printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(funcRefVar));") + printer.write("return funcObj;") + return [] + } + ) case .rawValueEnum(_, let rawType): switch rawType { case .string: @@ -1929,14 +1953,12 @@ struct IntrinsicJSFragment: Sendable { case .swiftStruct(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName return swiftStructLiftReturn(structBase: base) - case .closure(let signature): - let lowerFuncName = "lower_closure_\(signature.moduleName)_\(signature.mangleName)" + case .closure: return IntrinsicJSFragment( - parameters: ["boxPtr"], + parameters: ["funcRef"], printCode: { arguments, scope, printer, cleanupCode in - let boxPtr = arguments[0] - printer.write("return bjs[\"\(lowerFuncName)\"](\(boxPtr));") - return [] + let funcRef = arguments[0] + return ["\(JSGlueVariableScope.reservedSwift).memory.getObject(\(funcRef))"] } ) case .namespaceEnum(let string): @@ -2023,12 +2045,12 @@ struct IntrinsicJSFragment: Sendable { } ) } - case .closure(let signature): - let lowerFuncName = "lower_closure_\(signature.moduleName)_\(signature.mangleName)" + case .closure: return IntrinsicJSFragment( - parameters: ["boxPtr"], + parameters: ["funcRef"], printCode: { arguments, scope, printer, cleanupCode in - return ["bjs[\"\(lowerFuncName)\"](\(arguments[0]))"] + let funcRef = arguments[0] + return ["\(JSGlueVariableScope.reservedSwift).memory.getObject(\(funcRef))"] } ) case .namespaceEnum(let string): diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 3029fe0c9..3ebc91306 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -160,7 +160,7 @@ public enum BridgeType: Codable, Equatable, Hashable, Sendable { case namespaceEnum(String) case swiftProtocol(String) case swiftStruct(String) - indirect case closure(ClosureSignature) + indirect case closure(ClosureSignature, useJSTypedClosure: Bool) } public enum WasmCoreType: String, Codable, Sendable { @@ -1019,12 +1019,12 @@ extension BridgeType { return "\(name.count)\(name)P" case .swiftStruct(let name): return "\(name.count)\(name)V" - case .closure(let signature): + case .closure(let signature, let useJSTypedClosure): let params = signature.parameters.isEmpty ? "y" : signature.parameters.map { $0.mangleTypeName }.joined() - return "K\(params)_\(signature.returnType.mangleTypeName)" + return "K\(params)_\(signature.returnType.mangleTypeName)\(useJSTypedClosure ? "J" : "")" case .array(let elementType): // Array mangling: "Sa" prefix followed by element type return "Sa\(elementType.mangleTypeName)" @@ -1060,3 +1060,16 @@ extension BridgeType { } } } + +extension WasmCoreType { + /// Returns a Swift statement that returns a placeholder value for this Wasm core type. + public var swiftReturnPlaceholderStmt: String { + switch self { + case .i32: return "return 0" + case .i64: return "return 0" + case .f32: return "return 0.0" + case .f64: return "return 0.0" + case .pointer: return "return UnsafeMutableRawPointer(bitPattern: -1).unsafelyUnwrapped" + } + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json index d71726828..ee551fa47 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json @@ -62,7 +62,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -99,7 +100,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -143,7 +145,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -237,7 +240,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -279,7 +283,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -303,7 +308,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -343,7 +349,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -372,7 +379,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -407,7 +415,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -450,7 +459,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -493,7 +503,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -535,7 +546,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -576,7 +588,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -611,7 +624,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -646,7 +660,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -680,7 +695,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -720,7 +736,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -768,7 +785,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -815,7 +833,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -861,7 +880,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift index 94351dbdf..e659988d1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift @@ -7,18 +7,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si(_ ca } #endif -private final class _BJS_ClosureBox_10TestModule10HttpStatusO_Si: _BridgedSwiftClosureBox { - let closure: (HttpStatus) -> Int - init(_ closure: @escaping (HttpStatus) -> Int) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule10HttpStatusO_Si") +fileprivate func make_swift_closure_TestModule_10TestModule10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModule10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModule10HttpStatusO_Si { - static func bridgeJSLower(_ closure: @escaping (HttpStatus) -> Int) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModule10HttpStatusO_Si(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> Int { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -34,12 +32,23 @@ private enum _BJS_Closure_10TestModule10HttpStatusO_Si { } } +extension JSTypedClosure where Signature == (HttpStatus) -> Int { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (HttpStatus) -> Int) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModule10HttpStatusO_Si, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si") @_cdecl("invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si") public func _invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModule10HttpStatusO_Si>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(HttpStatus.bridgeJSLiftParameter(param0)) + 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") @@ -55,18 +64,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_SS(_ callback } #endif -private final class _BJS_ClosureBox_10TestModule5ThemeO_SS: _BridgedSwiftClosureBox { - let closure: (Theme) -> String - init(_ closure: @escaping (Theme) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule5ThemeO_SS") +fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModule5ThemeO_SS { - static func bridgeJSLower(_ closure: @escaping (Theme) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModule5ThemeO_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -82,12 +89,23 @@ private enum _BJS_Closure_10TestModule5ThemeO_SS { } } +extension JSTypedClosure where Signature == (Theme) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Theme) -> String) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModule5ThemeO_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule5ThemeO_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModule5ThemeO_SS") public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModule5ThemeO_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + 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") @@ -103,18 +121,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_Sb(_ callback } #endif -private final class _BJS_ClosureBox_10TestModule5ThemeO_Sb: _BridgedSwiftClosureBox { - let closure: (Theme) -> Bool - init(_ closure: @escaping (Theme) -> Bool) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule5ThemeO_Sb") +fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModule5ThemeO_Sb { - static func bridgeJSLower(_ closure: @escaping (Theme) -> Bool) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModule5ThemeO_Sb(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Bool { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -130,12 +146,23 @@ private enum _BJS_Closure_10TestModule5ThemeO_Sb { } } +extension JSTypedClosure where Signature == (Theme) -> Bool { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Theme) -> Bool) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModule5ThemeO_Sb, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb") @_cdecl("invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb") public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModule5ThemeO_Sb>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + 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") @@ -151,18 +178,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_SS(_ callbac } #endif -private final class _BJS_ClosureBox_10TestModule6PersonC_SS: _BridgedSwiftClosureBox { - let closure: (Person) -> String - init(_ closure: @escaping (Person) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule6PersonC_SS") +fileprivate func make_swift_closure_TestModule_10TestModule6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModule6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModule6PersonC_SS { - static func bridgeJSLower(_ closure: @escaping (Person) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModule6PersonC_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Person) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -178,12 +203,23 @@ private enum _BJS_Closure_10TestModule6PersonC_SS { } } +extension JSTypedClosure where Signature == (Person) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Person) -> String) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModule6PersonC_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule6PersonC_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModule6PersonC_SS") public func _invoke_swift_closure_TestModule_10TestModule6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModule6PersonC_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Person.bridgeJSLiftParameter(param0)) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Person) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Person.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -199,18 +235,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_SS(_ call } #endif -private final class _BJS_ClosureBox_10TestModule9APIResultO_SS: _BridgedSwiftClosureBox { - let closure: (APIResult) -> String - init(_ closure: @escaping (APIResult) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule9APIResultO_SS") +fileprivate func make_swift_closure_TestModule_10TestModule9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModule9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModule9APIResultO_SS { - static func bridgeJSLower(_ closure: @escaping (APIResult) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModule9APIResultO_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -226,12 +260,23 @@ private enum _BJS_Closure_10TestModule9APIResultO_SS { } } +extension JSTypedClosure where Signature == (APIResult) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (APIResult) -> String) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModule9APIResultO_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9APIResultO_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModule9APIResultO_SS") public func _invoke_swift_closure_TestModule_10TestModule9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModule9APIResultO_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(APIResult.bridgeJSLiftParameter(param0)) + 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") @@ -247,18 +292,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_SS(_ call } #endif -private final class _BJS_ClosureBox_10TestModule9DirectionO_SS: _BridgedSwiftClosureBox { - let closure: (Direction) -> String - init(_ closure: @escaping (Direction) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule9DirectionO_SS") +fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModule9DirectionO_SS { - static func bridgeJSLower(_ closure: @escaping (Direction) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModule9DirectionO_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -274,12 +317,23 @@ private enum _BJS_Closure_10TestModule9DirectionO_SS { } } +extension JSTypedClosure where Signature == (Direction) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Direction) -> String) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModule9DirectionO_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9DirectionO_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModule9DirectionO_SS") public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModule9DirectionO_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Direction.bridgeJSLiftParameter(param0)) + 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") @@ -295,18 +349,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_Sb(_ call } #endif -private final class _BJS_ClosureBox_10TestModule9DirectionO_Sb: _BridgedSwiftClosureBox { - let closure: (Direction) -> Bool - init(_ closure: @escaping (Direction) -> Bool) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule9DirectionO_Sb") +fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModule9DirectionO_Sb { - static func bridgeJSLower(_ closure: @escaping (Direction) -> Bool) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModule9DirectionO_Sb(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Bool { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -322,12 +374,23 @@ private enum _BJS_Closure_10TestModule9DirectionO_Sb { } } +extension JSTypedClosure where Signature == (Direction) -> Bool { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Direction) -> Bool) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModule9DirectionO_Sb, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb") @_cdecl("invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb") public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModule9DirectionO_Sb>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Direction.bridgeJSLiftParameter(param0)) + 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") @@ -343,18 +406,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS(_ callback: Int } #endif -private final class _BJS_ClosureBox_10TestModuleSS_SS: _BridgedSwiftClosureBox { - let closure: (String) -> String - init(_ closure: @escaping (String) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSS_SS") +fileprivate func make_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModuleSS_SS { - static func bridgeJSLower(_ closure: @escaping (String) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModuleSS_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -370,12 +431,23 @@ private enum _BJS_Closure_10TestModuleSS_SS { } } +extension JSTypedClosure where Signature == (String) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (String) -> String) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModuleSS_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSS_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModuleSS_SS") public func _invoke_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModuleSS_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) + 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") @@ -391,18 +463,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS(_ callba } #endif -private final class _BJS_ClosureBox_10TestModuleSq5ThemeO_SS: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq5ThemeO_SS") +fileprivate func make_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModuleSq5ThemeO_SS { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModuleSq5ThemeO_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -418,12 +488,23 @@ private enum _BJS_Closure_10TestModuleSq5ThemeO_SS { } } +extension JSTypedClosure where Signature == (Optional) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModuleSq5ThemeO_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS") public func _invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq5ThemeO_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) + 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") @@ -439,18 +520,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS } #endif -private final class _BJS_ClosureBox_10TestModuleSq6PersonCSqSSSqSd_SS: _BridgedSwiftClosureBox { - let closure: (Optional, Optional, Optional) -> String - init(_ closure: @escaping (Optional, Optional, Optional) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") +fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModuleSq6PersonCSqSSSqSd_SS { - static func bridgeJSLower(_ closure: @escaping (Optional, Optional, Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModuleSq6PersonCSqSSSqSd_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Optional, Optional, Optional) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0, param1, param2 in @@ -468,12 +547,23 @@ private enum _BJS_Closure_10TestModuleSq6PersonCSqSSSqSd_SS { } } +extension JSTypedClosure where Signature == (Optional, Optional, Optional) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional, Optional, Optional) -> String) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: UnsafeMutableRawPointer, _ param1IsSome: Int32, _ param1Bytes: Int32, _ param1Length: Int32, _ param2IsSome: Int32, _ param2Value: Float64) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq6PersonCSqSSSqSd_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value), Optional.bridgeJSLiftParameter(param1IsSome, param1Bytes, param1Length), Optional.bridgeJSLiftParameter(param2IsSome, param2Value)) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional, Optional, Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value), Optional.bridgeJSLiftParameter(param1IsSome, param1Bytes, param1Length), Optional.bridgeJSLiftParameter(param2IsSome, param2Value)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -489,18 +579,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS(_ callb } #endif -private final class _BJS_ClosureBox_10TestModuleSq6PersonC_SS: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq6PersonC_SS") +fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModuleSq6PersonC_SS { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModuleSq6PersonC_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -516,12 +604,23 @@ private enum _BJS_Closure_10TestModuleSq6PersonC_SS { } } +extension JSTypedClosure where Signature == (Optional) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModuleSq6PersonC_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS") public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq6PersonC_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + 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") @@ -537,18 +636,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS(_ ca } #endif -private final class _BJS_ClosureBox_10TestModuleSq9APIResultO_SS: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq9APIResultO_SS") +fileprivate func make_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModuleSq9APIResultO_SS { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModuleSq9APIResultO_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -564,12 +661,23 @@ private enum _BJS_Closure_10TestModuleSq9APIResultO_SS { } } +extension JSTypedClosure where Signature == (Optional) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModuleSq9APIResultO_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS") public func _invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq9APIResultO_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0CaseId)) + 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") @@ -585,18 +693,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS(_ ca } #endif -private final class _BJS_ClosureBox_10TestModuleSq9DirectionO_SS: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq9DirectionO_SS") +fileprivate func make_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModuleSq9DirectionO_SS { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModuleSq9DirectionO_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -612,12 +718,23 @@ private enum _BJS_Closure_10TestModuleSq9DirectionO_SS { } } +extension JSTypedClosure where Signature == (Optional) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModuleSq9DirectionO_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS") @_cdecl("invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS") public func _invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModuleSq9DirectionO_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + 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") @@ -799,10 +916,10 @@ public func _bjs_TestProcessor_init(_ transform: Int32) -> UnsafeMutableRawPoint @_expose(wasm, "bjs_TestProcessor_getTransform") @_cdecl("bjs_TestProcessor_getTransform") -public func _bjs_TestProcessor_getTransform(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_getTransform(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).getTransform() - return _BJS_Closure_10TestModuleSS_SS.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -832,10 +949,10 @@ public func _bjs_TestProcessor_printTogether(_ _self: UnsafeMutableRawPointer, _ @_expose(wasm, "bjs_TestProcessor_roundtrip") @_cdecl("bjs_TestProcessor_roundtrip") -public func _bjs_TestProcessor_roundtrip(_ _self: UnsafeMutableRawPointer, _ personClosure: Int32) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_roundtrip(_ _self: UnsafeMutableRawPointer, _ personClosure: Int32) -> Int32 { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).roundtrip(_: _BJS_Closure_10TestModule6PersonC_SS.bridgeJSLift(personClosure)) - return _BJS_Closure_10TestModule6PersonC_SS.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -843,10 +960,10 @@ public func _bjs_TestProcessor_roundtrip(_ _self: UnsafeMutableRawPointer, _ per @_expose(wasm, "bjs_TestProcessor_roundtripOptional") @_cdecl("bjs_TestProcessor_roundtripOptional") -public func _bjs_TestProcessor_roundtripOptional(_ _self: UnsafeMutableRawPointer, _ personClosure: Int32) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_roundtripOptional(_ _self: UnsafeMutableRawPointer, _ personClosure: Int32) -> Int32 { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).roundtripOptional(_: _BJS_Closure_10TestModuleSq6PersonC_SS.bridgeJSLift(personClosure)) - return _BJS_Closure_10TestModuleSq6PersonC_SS.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -898,10 +1015,10 @@ public func _bjs_TestProcessor_processAPIResult(_ _self: UnsafeMutableRawPointer @_expose(wasm, "bjs_TestProcessor_makeDirectionChecker") @_cdecl("bjs_TestProcessor_makeDirectionChecker") -public func _bjs_TestProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() - return _BJS_Closure_10TestModule9DirectionO_Sb.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -909,10 +1026,10 @@ public func _bjs_TestProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPoi @_expose(wasm, "bjs_TestProcessor_makeThemeValidator") @_cdecl("bjs_TestProcessor_makeThemeValidator") -public func _bjs_TestProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() - return _BJS_Closure_10TestModule5ThemeO_Sb.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -920,10 +1037,10 @@ public func _bjs_TestProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPoint @_expose(wasm, "bjs_TestProcessor_makeStatusCodeExtractor") @_cdecl("bjs_TestProcessor_makeStatusCodeExtractor") -public func _bjs_TestProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() - return _BJS_Closure_10TestModule10HttpStatusO_Si.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -931,10 +1048,10 @@ public func _bjs_TestProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRaw @_expose(wasm, "bjs_TestProcessor_makeAPIResultHandler") @_cdecl("bjs_TestProcessor_makeAPIResultHandler") -public func _bjs_TestProcessor_makeAPIResultHandler(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_makeAPIResultHandler(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() - return _BJS_Closure_10TestModule9APIResultO_SS.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -975,10 +1092,10 @@ public func _bjs_TestProcessor_processOptionalAPIResult(_ _self: UnsafeMutableRa @_expose(wasm, "bjs_TestProcessor_makeOptionalDirectionFormatter") @_cdecl("bjs_TestProcessor_makeOptionalDirectionFormatter") -public func _bjs_TestProcessor_makeOptionalDirectionFormatter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TestProcessor_makeOptionalDirectionFormatter(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TestProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() - return _BJS_Closure_10TestModuleSq9DirectionO_SS.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json index 9e0e0a491..0013c810c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.json @@ -35,7 +35,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -77,7 +78,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.swift index c833a54d1..c42c3b36f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.swift @@ -7,18 +7,16 @@ fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si(_ callback: Int } #endif -private final class _BJS_ClosureBox_10TestModuleSi_Si: _BridgedSwiftClosureBox { - let closure: (Int) -> Int - init(_ closure: @escaping (Int) -> Int) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSi_Si") +fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_10TestModuleSi_Si { - static func bridgeJSLower(_ closure: @escaping (Int) -> Int) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_10TestModuleSi_Si(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Int { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -34,12 +32,23 @@ private enum _BJS_Closure_10TestModuleSi_Si { } } +extension JSTypedClosure where Signature == (Int) -> Int { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Int) -> Int) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModuleSi_Si, + body: body, + fileID: fileID, + line: line + ) + } +} + @_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSi_Si") @_cdecl("invoke_swift_closure_TestModule_10TestModuleSi_Si") public func _invoke_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { #if arch(wasm32) - let box = Unmanaged<_BJS_ClosureBox_10TestModuleSi_Si>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Int.bridgeJSLiftParameter(param0)) + 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") @@ -48,17 +57,20 @@ public func _invoke_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeM #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_applyInt") -fileprivate func bjs_applyInt(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 +fileprivate func bjs_applyInt(_ value: Int32, _ transform: Int32) -> Int32 #else -fileprivate func bjs_applyInt(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 { +fileprivate func bjs_applyInt(_ value: Int32, _ transform: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif func _$applyInt(_ value: Int, _ transform: @escaping (Int) -> Int) throws(JSException) -> Int { let valueValue = value.bridgeJSLowerParameter() - let transformPointer = _BJS_Closure_10TestModuleSi_Si.bridgeJSLower(transform) - let ret = bjs_applyInt(valueValue, transformPointer) + let transform = JSTypedClosure<(Int) -> Int>(transform) + let transformFuncRef = transform.bridgeJSLowerParameter() + let ret = withExtendedLifetime((transform)) { + bjs_applyInt(valueValue, transformFuncRef) + } if let error = _swift_js_take_exception() { throw error } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index bc0def6f1..a6966ae40 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -60,6 +60,31 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + if (state.unregistered) { return; } + instance?.exports?.bjs_release_swift_closure(state.pointer); + }); + const makeClosure = (pointer, file, line, func) => { + const state = { pointer, file, line, unregistered: false }; + const real = (...args) => { + if (state.unregistered) { + const bytes = new Uint8Array(memory.buffer, state.file); + let length = 0; + while (bytes[length] !== 0) { length += 1; } + const fileID = textDecoder.decode(bytes.subarray(0, length)); + throw new Error(`Attempted to call a released JSTypedClosure created at ${fileID}:${state.line}`); + } + return func(...args); + }; + real.__unregister = () => { + if (state.unregistered) { return; } + state.unregistered = true; + swiftClosureRegistry.unregister(state); + }; + swiftClosureRegistry.register(real, state, state); + return swift.memory.retain(real); + }; + const __bjs_createAPIResultValuesHelpers = () => { return () => ({ lower: (value) => { @@ -298,6 +323,10 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) { + const func = swift.memory.getObject(funcRef); + func.__unregister(); + } bjs["invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si"] = function(callbackId, param0Id) { try { @@ -310,17 +339,19 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModule10HttpStatusO_Si"] = function(closurePtr) { - return function(param0) { - try { - return instance.exports.invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si(closurePtr, param0) | 0; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModule10HttpStatusO_Si"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModule10HttpStatusO_Si = function(param0) { + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si(boxPtr, param0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + return invokeResult | 0; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule10HttpStatusO_Si); + } bjs["invoke_js_callback_TestModule_10TestModule5ThemeO_SS"] = function(callbackId, param0Id) { try { @@ -340,22 +371,24 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModule5ThemeO_SS"] = function(closurePtr) { - return function(param0) { - try { - const param0Bytes = textEncoder.encode(param0); - const param0Id = swift.memory.retain(param0Bytes); - const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModule5ThemeO_SS(closurePtr, param0Id, param0Bytes.length); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModule5ThemeO_SS"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModule5ThemeO_SS = function(param0) { + const param0Bytes = textEncoder.encode(param0); + const param0Id = swift.memory.retain(param0Bytes); + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule5ThemeO_SS(boxPtr, param0Id, param0Bytes.length); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + const resultLen = invokeResult; + const ret = tmpRetString; + tmpRetString = undefined; + return ret; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule5ThemeO_SS); + } bjs["invoke_js_callback_TestModule_10TestModule5ThemeO_Sb"] = function(callbackId, param0Id) { try { @@ -370,19 +403,21 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModule5ThemeO_Sb"] = function(closurePtr) { - return function(param0) { - try { - const param0Bytes = textEncoder.encode(param0); - const param0Id = swift.memory.retain(param0Bytes); - return instance.exports.invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb(closurePtr, param0Id, param0Bytes.length) !== 0; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModule5ThemeO_Sb"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModule5ThemeO_Sb = function(param0) { + const param0Bytes = textEncoder.encode(param0); + const param0Id = swift.memory.retain(param0Bytes); + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb(boxPtr, param0Id, param0Bytes.length); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + return invokeResult !== 0; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule5ThemeO_Sb); + } bjs["invoke_js_callback_TestModule_10TestModule6PersonC_SS"] = function(callbackId, param0Id) { try { @@ -400,20 +435,22 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModule6PersonC_SS"] = function(closurePtr) { - return function(param0) { - try { - const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModule6PersonC_SS(closurePtr, param0.pointer); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModule6PersonC_SS"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModule6PersonC_SS = function(param0) { + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule6PersonC_SS(boxPtr, param0.pointer); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + const resultLen = invokeResult; + const ret = tmpRetString; + tmpRetString = undefined; + return ret; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule6PersonC_SS); + } bjs["invoke_js_callback_TestModule_10TestModule9APIResultO_SS"] = function(callbackId, param0Id) { try { @@ -431,21 +468,23 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModule9APIResultO_SS"] = function(closurePtr) { - return function(param0) { - try { - const { caseId: param0CaseId, cleanup: param0Cleanup } = enumHelpers.APIResult.lower(param0); - const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModule9APIResultO_SS(closurePtr, param0CaseId); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModule9APIResultO_SS"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModule9APIResultO_SS = function(param0) { + const { caseId: param0CaseId, cleanup: param0Cleanup } = enumHelpers.APIResult.lower(param0); + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule9APIResultO_SS(boxPtr, param0CaseId); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + const resultLen = invokeResult; + const ret = tmpRetString; + tmpRetString = undefined; + return ret; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule9APIResultO_SS); + } bjs["invoke_js_callback_TestModule_10TestModule9DirectionO_SS"] = function(callbackId, param0Id) { try { @@ -463,20 +502,22 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModule9DirectionO_SS"] = function(closurePtr) { - return function(param0) { - try { - const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModule9DirectionO_SS(closurePtr, param0); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModule9DirectionO_SS"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModule9DirectionO_SS = function(param0) { + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule9DirectionO_SS(boxPtr, param0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + const resultLen = invokeResult; + const ret = tmpRetString; + tmpRetString = undefined; + return ret; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule9DirectionO_SS); + } bjs["invoke_js_callback_TestModule_10TestModule9DirectionO_Sb"] = function(callbackId, param0Id) { try { @@ -489,17 +530,19 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModule9DirectionO_Sb"] = function(closurePtr) { - return function(param0) { - try { - return instance.exports.invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb(closurePtr, param0) !== 0; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModule9DirectionO_Sb"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModule9DirectionO_Sb = function(param0) { + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb(boxPtr, param0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + return invokeResult !== 0; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule9DirectionO_Sb); + } bjs["invoke_js_callback_TestModule_10TestModuleSS_SS"] = function(callbackId, param0Id) { try { @@ -519,22 +562,24 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModuleSS_SS"] = function(closurePtr) { - return function(param0) { - try { - const param0Bytes = textEncoder.encode(param0); - const param0Id = swift.memory.retain(param0Bytes); - const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModuleSS_SS(closurePtr, param0Id, param0Bytes.length); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModuleSS_SS"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSS_SS = function(param0) { + const param0Bytes = textEncoder.encode(param0); + const param0Id = swift.memory.retain(param0Bytes); + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSS_SS(boxPtr, param0Id, param0Bytes.length); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + const resultLen = invokeResult; + const ret = tmpRetString; + tmpRetString = undefined; + return ret; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSS_SS); + } bjs["invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS"] = function(callbackId, param0IsSome, param0Value) { try { @@ -559,26 +604,28 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModuleSq5ThemeO_SS"] = function(closurePtr) { - return function(param0) { - try { - const isSome = param0 != null; - let param0Id, param0Bytes; - if (isSome) { - param0Bytes = textEncoder.encode(param0); - param0Id = swift.memory.retain(param0Bytes); - } - const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(closurePtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModuleSq5ThemeO_SS"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSq5ThemeO_SS = function(param0) { + const isSome = param0 != null; + let param0Id, param0Bytes; + if (isSome) { + param0Bytes = textEncoder.encode(param0); + param0Id = swift.memory.retain(param0Bytes); + } + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(boxPtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + const resultLen = invokeResult; + const ret = tmpRetString; + tmpRetString = undefined; + return ret; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq5ThemeO_SS); + } bjs["invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS"] = function(callbackId, param0IsSome, param0Value, param1IsSome, param1Value, param2IsSome, param2Value) { try { @@ -615,28 +662,30 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS"] = function(closurePtr) { - return function(param0, param1, param2) { - try { - const isSome = param0 != null; - const isSome1 = param1 != null; - let param1Id, param1Bytes; - if (isSome1) { - param1Bytes = textEncoder.encode(param1); - param1Id = swift.memory.retain(param1Bytes); - } - const isSome2 = param2 != null; - const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(closurePtr, +isSome, isSome ? param0.pointer : 0, +isSome1, isSome1 ? param1Id : 0, isSome1 ? param1Bytes.length : 0, +isSome2, isSome2 ? param2 : 0); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS = function(param0, param1, param2) { + const isSome = param0 != null; + const isSome1 = param1 != null; + let param1Id, param1Bytes; + if (isSome1) { + param1Bytes = textEncoder.encode(param1); + param1Id = swift.memory.retain(param1Bytes); + } + const isSome2 = param2 != null; + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(boxPtr, +isSome, isSome ? param0.pointer : 0, +isSome1, isSome1 ? param1Id : 0, isSome1 ? param1Bytes.length : 0, +isSome2, isSome2 ? param2 : 0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + const resultLen = invokeResult; + const ret = tmpRetString; + tmpRetString = undefined; + return ret; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS); + } bjs["invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS"] = function(callbackId, param0IsSome, param0Value) { try { @@ -659,21 +708,23 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModuleSq6PersonC_SS"] = function(closurePtr) { - return function(param0) { - try { - const isSome = param0 != null; - const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS(closurePtr, +isSome, isSome ? param0.pointer : 0); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModuleSq6PersonC_SS"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSq6PersonC_SS = function(param0) { + const isSome = param0 != null; + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS(boxPtr, +isSome, isSome ? param0.pointer : 0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + const resultLen = invokeResult; + const ret = tmpRetString; + tmpRetString = undefined; + return ret; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq6PersonC_SS); + } bjs["invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS"] = function(callbackId, param0IsSome, param0Value) { try { @@ -696,27 +747,29 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModuleSq9APIResultO_SS"] = function(closurePtr) { - return function(param0) { - try { - const isSome = param0 != null; - let param0CaseId, param0Cleanup; - if (isSome) { - const enumResult = enumHelpers.APIResult.lower(param0); - param0CaseId = enumResult.caseId; - param0Cleanup = enumResult.cleanup; - } - const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(closurePtr, +isSome, isSome ? param0CaseId : 0); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModuleSq9APIResultO_SS"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSq9APIResultO_SS = function(param0) { + const isSome = param0 != null; + let param0CaseId, param0Cleanup; + if (isSome) { + const enumResult = enumHelpers.APIResult.lower(param0); + param0CaseId = enumResult.caseId; + param0Cleanup = enumResult.cleanup; + } + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(boxPtr, +isSome, isSome ? param0CaseId : 0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + const resultLen = invokeResult; + const ret = tmpRetString; + tmpRetString = undefined; + return ret; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq9APIResultO_SS); + } bjs["invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS"] = function(callbackId, param0IsSome, param0Value) { try { @@ -739,21 +792,23 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModuleSq9DirectionO_SS"] = function(closurePtr) { - return function(param0) { - try { - const isSome = param0 != null; - const resultLen = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(closurePtr, +isSome, isSome ? param0 : 0); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModuleSq9DirectionO_SS"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSq9DirectionO_SS = function(param0) { + const isSome = param0 != null; + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(boxPtr, +isSome, isSome ? param0 : 0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + const resultLen = invokeResult; + const ret = tmpRetString; + tmpRetString = undefined; + return ret; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq9DirectionO_SS); + } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; @@ -822,7 +877,7 @@ export async function createInstantiator(options, swift) { } getTransform() { const ret = instance.exports.bjs_TestProcessor_getTransform(this.pointer); - return bjs["lower_closure_TestModule_10TestModuleSS_SS"](ret); + return swift.memory.getObject(ret); } processWithCustom(text, customTransform) { const textBytes = textEncoder.encode(text); @@ -847,12 +902,12 @@ export async function createInstantiator(options, swift) { roundtrip(personClosure) { const callbackId = swift.memory.retain(personClosure); const ret = instance.exports.bjs_TestProcessor_roundtrip(this.pointer, callbackId); - return bjs["lower_closure_TestModule_10TestModule6PersonC_SS"](ret); + return swift.memory.getObject(ret); } roundtripOptional(personClosure) { const callbackId = swift.memory.retain(personClosure); const ret = instance.exports.bjs_TestProcessor_roundtripOptional(this.pointer, callbackId); - return bjs["lower_closure_TestModule_10TestModuleSq6PersonC_SS"](ret); + return swift.memory.getObject(ret); } processDirection(callback) { const callbackId = swift.memory.retain(callback); @@ -882,19 +937,19 @@ export async function createInstantiator(options, swift) { } makeDirectionChecker() { const ret = instance.exports.bjs_TestProcessor_makeDirectionChecker(this.pointer); - return bjs["lower_closure_TestModule_10TestModule9DirectionO_Sb"](ret); + return swift.memory.getObject(ret); } makeThemeValidator() { const ret = instance.exports.bjs_TestProcessor_makeThemeValidator(this.pointer); - return bjs["lower_closure_TestModule_10TestModule5ThemeO_Sb"](ret); + return swift.memory.getObject(ret); } makeStatusCodeExtractor() { const ret = instance.exports.bjs_TestProcessor_makeStatusCodeExtractor(this.pointer); - return bjs["lower_closure_TestModule_10TestModule10HttpStatusO_Si"](ret); + return swift.memory.getObject(ret); } makeAPIResultHandler() { const ret = instance.exports.bjs_TestProcessor_makeAPIResultHandler(this.pointer); - return bjs["lower_closure_TestModule_10TestModule9APIResultO_SS"](ret); + return swift.memory.getObject(ret); } processOptionalDirection(callback) { const callbackId = swift.memory.retain(callback); @@ -919,7 +974,7 @@ export async function createInstantiator(options, swift) { } makeOptionalDirectionFormatter() { const ret = instance.exports.bjs_TestProcessor_makeOptionalDirectionFormatter(this.pointer); - return bjs["lower_closure_TestModule_10TestModuleSq9DirectionO_SS"](ret); + return swift.memory.getObject(ret); } } const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index 6c1397fff..c61b71313 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -30,6 +30,31 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + if (state.unregistered) { return; } + instance?.exports?.bjs_release_swift_closure(state.pointer); + }); + const makeClosure = (pointer, file, line, func) => { + const state = { pointer, file, line, unregistered: false }; + const real = (...args) => { + if (state.unregistered) { + const bytes = new Uint8Array(memory.buffer, state.file); + let length = 0; + while (bytes[length] !== 0) { length += 1; } + const fileID = textDecoder.decode(bytes.subarray(0, length)); + throw new Error(`Attempted to call a released JSTypedClosure created at ${fileID}:${state.line}`); + } + return func(...args); + }; + real.__unregister = () => { + if (state.unregistered) { return; } + state.unregistered = true; + swiftClosureRegistry.unregister(state); + }; + swiftClosureRegistry.register(real, state, state); + return swift.memory.retain(real); + }; + return { /** @@ -198,6 +223,10 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) { + const func = swift.memory.getObject(funcRef); + func.__unregister(); + } bjs["invoke_js_callback_TestModule_10TestModuleSi_Si"] = function(callbackId, param0Id) { try { @@ -210,21 +239,23 @@ export async function createInstantiator(options, swift) { return 0; } }; - - bjs["lower_closure_TestModule_10TestModuleSi_Si"] = function(closurePtr) { - return function(param0) { - try { - return instance.exports.invoke_swift_closure_TestModule_10TestModuleSi_Si(closurePtr, param0) | 0; - } catch (error) { - setException?.(error); + bjs["make_swift_closure_TestModule_10TestModuleSi_Si"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSi_Si = function(param0) { + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSi_Si(boxPtr, param0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; throw error; } + return invokeResult | 0; }; - }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSi_Si); + } const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_applyInt"] = function bjs_applyInt(value, transform) { try { - let ret = imports.applyInt(value, bjs["lower_closure_TestModule_10TestModuleSi_Si"](transform)); + let ret = imports.applyInt(value, swift.memory.getObject(transform)); return ret; } catch (error) { setException(error); diff --git a/Plugins/PackageToJS/Templates/instantiate.js b/Plugins/PackageToJS/Templates/instantiate.js index c17d78841..a0920964b 100644 --- a/Plugins/PackageToJS/Templates/instantiate.js +++ b/Plugins/PackageToJS/Templates/instantiate.js @@ -65,6 +65,7 @@ async function createInstantiator(options, swift) { swift_js_push_pointer: unexpectedBjsCall, swift_js_pop_pointer: unexpectedBjsCall, swift_js_struct_cleanup: unexpectedBjsCall, + swift_js_closure_unregister: unexpectedBjsCall, } }, /** @param {WebAssembly.Instance} instance */ diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index fd2cbd909..4c8fdf3db 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -49,6 +49,40 @@ import _CJavaScriptKit #endif } +/// Releases a Swift closure from the FinalizationRegistry +/// +/// This function is called by the BridgeJS code generator when a Swift closure is released. +/// The closure is released from the FinalizationRegistry so it can be garbage collected to +/// balance the +/// +/// - Parameter pointer: The pointer to `_BridgeJSTypedClosureBox` instance +@_expose(wasm, "bjs_release_swift_closure") +public func _bjs_release_swift_closure(_ pointer: UnsafeMutableRawPointer) { + Unmanaged.fromOpaque(pointer).release() +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_closure_unregister") +internal func _swift_js_closure_unregister(_ id: Int32) +#else +/// Unregisters a Swift closure from the FinalizationRegistry +/// +/// - Parameter id: The JavaScriptObjectRef of the JS closure object created by +/// the BridgeJS's `make_swift_closure_{signature}` function. +/// +/// - Note: This is a best-effort operation. +/// According to the ECMAScript specification, calling +/// `FinalizationRegistry.prototype.unregister` does not guarantee that +/// a finalization callback will be suppressed if the target object has +/// already been garbage-collected and cleanup has been scheduled. +/// This means that the finalization callback should be tolerant of the +/// object being already collected. +/// See: https://tc39.es/ecma262/multipage/managing-memory.html#sec-finalization-registry.prototype.unregister +internal func _swift_js_closure_unregister(_ id: Int32) { + _onlyAvailableOnWasm() +} +#endif + // MARK: Type lowering/lifting // // The following part defines the parameter and return value lowering/lifting @@ -1108,6 +1142,21 @@ extension UnsafeMutablePointer: _BridgedSwiftStackType { } } +// Optional support for JSTypedClosure +extension Optional { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> ( + isSome: Int32, value: Int32 + ) where Wrapped == JSTypedClosure { + switch consume self { + case .none: + return (isSome: 0, value: 0) + case .some(let wrapped): + // Use return lowering to retain the JS function so JS lifting can fetch it from the heap. + return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) + } + } +} + extension Optional where Wrapped == Bool { // MARK: ExportSwift diff --git a/Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift b/Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift index 941b3f468..b3e80e66f 100644 --- a/Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift +++ b/Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift @@ -245,6 +245,97 @@ public class JSClosure: JSObject, JSClosureProtocol { #endif } +/// Heap storage for typed closures generated by BridgeJS. +/// +/// The storage is owned by the JavaScript closure and keeps the call-site metadata +/// so that calls after `release()` can report a helpful error. +@_spi(BridgeJS) public final class _BridgeJSTypedClosureBox: _BridgedSwiftClosureBox { + @_spi(BridgeJS) public var closure: Signature + var isManuallyReleased: Bool = false + + init(_ closure: Signature) { + self.closure = closure + } +} + +/// A typed handle to a JavaScript closure generated by BridgeJS. +/// +/// Use `JSTypedClosure` when you need to pass a Swift closure to JavaScript and then +/// manage its lifetime explicitly from Swift. You must call `release()` when the closure +/// is no longer needed. After releasing, any attempt to invoke the closure from JavaScript +/// throws a `JSException` (no crash), including a file/line message pointing to where the +/// typed closure was created. +/// +/// The underlying JavaScript function is also registered with a `FinalizationRegistry` as a +/// safety net to release the Swift closure storage if `release()` is forgotten, but this +/// is non-deterministic and should not be relied on for timely cleanup. +/// +/// ```swift +/// @JSFunction func someJSFunction(_ c: JSTypedClosure<(Int) -> Int>) throws(JSException) +/// let closure = JSTypedClosure<(Int) -> Int> { $0 + 1 } +/// defer { closure.release() } +/// try someJSFunction(closure) +/// ``` +public struct JSTypedClosure { + private let storage: _BridgeJSTypedClosureBox + private let _jsObject: JSObject + + @_spi(BridgeJS) + public init( + makeClosure: (_ pointer: UnsafeMutableRawPointer, _ fileID: UnsafePointer, _ line: UInt32) -> Int32, + body: Signature, + fileID: StaticString, + line: UInt32 + ) { + let storage = _BridgeJSTypedClosureBox(body) + // NOTE: Perform an unbalanced retain to give the closure box storage ownership + // to the JavaScript side. It will be balanced by two code paths: + // + // 1. When the JS closure made by `makeClosure` is GC'ed, the FinalizationRegistry + // will call `_bjs_release_swift_closure` to release the closure box storage. + // 2. When Swift side manually calls `release()` on the closure, it will release + // the closure box storage. + let pointer = Unmanaged.passRetained(storage).toOpaque() + let id = makeClosure(pointer, fileID.utf8Start, line) + self._jsObject = JSObject(id: UInt32(bitPattern: id)) + self.storage = storage + } + + @_spi(BridgeJS) + public func bridgeJSLowerParameter() -> Int32 { + return _jsObject.bridgeJSLowerParameter() + } + + @_spi(BridgeJS) + public func bridgeJSLowerReturn() -> Int32 { + return _jsObject.bridgeJSLowerReturn() + } + + /// The underlying JavaScript function handle. + /// + /// Use this when you need to store or compare the JS function identity on the JavaScript side. + public var jsObject: JSObject { _jsObject } + + /// Releases the Swift closure storage owned by this typed closure. + /// + /// Call this exactly once when the closure is no longer needed by JavaScript. + /// After release, any attempt to invoke the closure from JavaScript throws a `JSException` + /// describing a call on a released `JSTypedClosure`. + /// Calling `release()` multiple times has no effect. + public func release() { + guard !storage.isManuallyReleased else { + // Already manually released + return + } + storage.isManuallyReleased = true + // Unregister the closure from the FinalizationRegistry because we here decrement + // the refcount of the storage, so the finalizer won't be responsible for releasing it. + _swift_js_closure_unregister(Int32(bitPattern: _jsObject.id)) + // Balance the retain given to the JavaScript side + Unmanaged.passUnretained(storage).release() + } +} + #if compiler(>=5.5) && (!hasFeature(Embedded) || os(WASI)) @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) private func makeAsyncClosure( diff --git a/Tests/BridgeJSRuntimeTests/ClosureSupportTests.swift b/Tests/BridgeJSRuntimeTests/ClosureSupportTests.swift new file mode 100644 index 000000000..320fec526 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/ClosureSupportTests.swift @@ -0,0 +1,290 @@ +import XCTest +@_spi(Experimental) import JavaScriptKit + +@JSClass struct ClosureSupportImports { + + @JSFunction static func jsApplyVoid(_ callback: JSTypedClosure<() -> Void>) throws(JSException) + @JSFunction static func jsApplyBool(_ callback: JSTypedClosure<() -> Bool>) throws(JSException) -> Bool + @JSFunction static func jsApplyInt( + _ value: Int, + _ transform: JSTypedClosure<(Int) -> Int> + ) throws(JSException) -> Int + @JSFunction static func jsApplyDouble( + _ value: Double, + _ transform: JSTypedClosure<(Double) -> Double> + ) throws(JSException) -> Double + @JSFunction static func jsApplyString( + _ value: String, + _ transform: JSTypedClosure<(String) -> String> + ) throws(JSException) -> String + // @JSFunction static func jsApplyJSValue( + // _ value: JSValue, + // _ transform: JSTypedClosure<(JSValue) -> JSValue> + // ) throws(JSException) -> JSValue + @JSFunction static func jsApplyJSObject( + _ value: JSObject, + _ transform: JSTypedClosure<(JSObject) -> JSObject> + ) throws(JSException) -> JSObject + // @JSFunction static func jsApplyArrayInt( + // _ value: [Int], + // _ transform: JSTypedClosure<([Int]) -> [Int]> + // ) throws(JSException) -> [Int] + // @JSFunction static func jsApplyArrayDouble( + // _ value: [Double], + // _ transform: JSTypedClosure<([Double]) -> [Double]> + // ) throws(JSException) -> [Double] + // @JSFunction static func jsApplyArrayString( + // _ value: [String], + // _ transform: JSTypedClosure<([String]) -> [String]> + // ) throws(JSException) -> [String] + // @JSFunction static func jsApplyArrayJSValue( + // _ value: [JSValue], + // _ transform: JSTypedClosure<([JSValue]) -> [JSValue]> + // ) throws(JSException) -> [JSValue] + // @JSFunction static func jsApplyArrayJSObject( + // _ value: [JSObject], + // _ transform: JSTypedClosure<([JSObject]) -> [JSObject]> + // ) throws(JSException) -> [JSObject] + + @JSFunction static func jsMakeIntToInt(_ base: Int) throws(JSException) -> (Int) -> Int + @JSFunction static func jsMakeDoubleToDouble(_ base: Double) throws(JSException) -> (Double) -> Double + @JSFunction static func jsMakeStringToString(_ `prefix`: String) throws(JSException) -> (String) -> String + + @JSFunction static func jsCallTwice( + _ value: Int, + _ callback: JSTypedClosure<(Int) -> Void> + ) throws(JSException) -> Int + @JSFunction static func jsCallBinary(_ callback: JSTypedClosure<(Int, Int) -> Int>) throws(JSException) -> Int + @JSFunction static func jsCallTriple(_ callback: JSTypedClosure<(Int, Int, Int) -> Int>) throws(JSException) -> Int + @JSFunction static func jsCallAfterRelease(_ callback: JSTypedClosure<() -> Void>) throws(JSException) -> String + @JSFunction static func jsOptionalInvoke(_ callback: JSTypedClosure<() -> Bool>?) throws(JSException) -> Bool + @JSFunction static func jsStoreClosure(_ callback: JSTypedClosure<() -> Void>) throws(JSException) + @JSFunction static func jsCallStoredClosure() throws(JSException) + @JSFunction static func jsHeapCount() throws(JSException) -> Int + + @JSFunction static func runJsClosureSupportTests() throws(JSException) +} + +@JS class ClosureSupportExports { + @JS static func makeIntToInt(_ base: Int) -> (Int) -> Int { + return { $0 + base } + } + @JS static func makeDoubleToDouble(_ base: Double) -> (Double) -> Double { + return { $0 + base } + } + @JS static func makeStringToString(_ prefix: String) -> (String) -> String { + return { prefix + $0 } + } + + @JS static func makeJSIntToInt(_ base: Int) -> JSTypedClosure<(Int) -> Int> { + return JSTypedClosure { $0 + base } + } + @JS static func makeJSDoubleToDouble(_ base: Double) -> JSTypedClosure<(Double) -> Double> { + return JSTypedClosure { $0 + base } + } + @JS static func makeJSStringToString(_ prefix: String) -> JSTypedClosure<(String) -> String> { + return JSTypedClosure { prefix + $0 } + } +} + +final class ClosureSupportTests: XCTestCase { + + func testRunJsClosureSupportTests() throws { + try ClosureSupportImports.runJsClosureSupportTests() + } + + func testClosureParameterVoidToVoid() throws { + var called = false + let transform = JSTypedClosure<() -> Void> { + called = true + } + defer { transform.release() } + try ClosureSupportImports.jsApplyVoid(transform) + XCTAssertTrue(called) + } + + func testClosureParameterBoolToBool() throws { + let transform = JSTypedClosure<() -> Bool> { true } + defer { transform.release() } + let result = try ClosureSupportImports.jsApplyBool(transform) + XCTAssertTrue(result) + } + + func testClosureParameterIntToInt() throws { + let transform = JSTypedClosure { $0 * 2 } + defer { transform.release() } + let result = try ClosureSupportImports.jsApplyInt(21, transform) + XCTAssertEqual(result, 42) + } + + func testClosureParameterDoubleToDouble() throws { + let transform = JSTypedClosure<(Double) -> Double> { $0 * 2 } + defer { transform.release() } + let result = try ClosureSupportImports.jsApplyDouble(21.0, transform) + XCTAssertEqual(result, 42.0) + } + + func testClosureParameterStringToString() throws { + let transform = JSTypedClosure { (value: String) in + value + ", world!" + } + defer { transform.release() } + let result = try ClosureSupportImports.jsApplyString("Hello", transform) + XCTAssertEqual(result, "Hello, world!") + } + + // func testClosureParameterJSValueToJSValue() throws { + // let transform = JSTypedClosure<(JSValue) -> JSValue> { $0 } + // defer { transform.release() } + // let result = try JSTypedClosureImports.jsApplyJSValue(.number(1), transform) + // XCTAssertEqual(result, .number(1)) + // } + + func testClosureParameterJSObjectToJSObject() throws { + let transform = JSTypedClosure<(JSObject) -> JSObject> { $0 } + defer { transform.release() } + let obj = JSObject() + let result = try ClosureSupportImports.jsApplyJSObject(obj, transform) + XCTAssertEqual(result, obj) + } + + // func testClosureParameterArrayIntToArrayInt() throws { + // let transform = JSTypedClosure<([Int]) -> [Int]> { $0 } + // defer { transform.release() } + // let result = try ClosureSupportImports.jsApplyArrayInt([1, 2, 3], transform) + // XCTAssertEqual(result, [1, 2, 3]) + // } + + // func testClosureParameterArrayDoubleToArrayDouble() throws { + // let transform = JSTypedClosure<([Double]) -> [Double]> { $0 } + // defer { transform.release() } + // let result = try ClosureSupportImports.jsApplyArrayDouble([1.0, 2.0, 3.0], transform) + // XCTAssertEqual(result, [1.0, 2.0, 3.0]) + // } + + // func testClosureParameterArrayStringToArrayString() throws { + // let transform = JSTypedClosure<([String]) -> [String]> { $0 } + // defer { transform.release() } + // let result = try ClosureSupportImports.jsApplyArrayString(["a", "b", "c"], transform) + // XCTAssertEqual(result, ["a", "b", "c"]) + // } + + // func testClosureParameterArrayJSValueToArrayJSValue() throws { + // let transform = JSTypedClosure<([JSValue]) -> [JSValue]> { $0 } + // defer { transform.release() } + // let result = try ClosureSupportImports.jsApplyArrayJSValue([.number(1), .number(2), .number(3)], transform) + // XCTAssertEqual(result, [.number(1), .number(2), .number(3)]) + // } + + // func testClosureParameterArrayJSObjectToArrayJSObject() throws { + // let transform = JSTypedClosure<([JSObject]) -> [JSObject]> { $0 } + // defer { transform.release() } + // let obj1 = JSObject() + // let obj2 = JSObject() + // let obj3 = JSObject() + // let result = try ClosureSupportImports.jsApplyArrayJSObject([obj1, obj2, obj3], transform) + // XCTAssertEqual(result, [obj1, obj2, obj3]) + // } + + func testClosureReturnIntToInt() throws { + let c = try ClosureSupportImports.jsMakeIntToInt(10) + XCTAssertEqual(c(0), 10) + XCTAssertEqual(c(32), 42) + } + + func testClosureReturnDoubleToDouble() throws { + let c = try ClosureSupportImports.jsMakeDoubleToDouble(10.0) + XCTAssertEqual(c(0.0), 10.0) + XCTAssertEqual(c(32.0), 42.0) + } + + func testClosureReturnStringToString() throws { + let c = try ClosureSupportImports.jsMakeStringToString("Hello, ") + XCTAssertEqual(c("world!"), "Hello, world!") + } + + func testClosureParameterIntToVoid() throws { + var total = 0 + let callback = JSTypedClosure<(Int) -> Void> { value in + total += value + } + defer { callback.release() } + let ret = try ClosureSupportImports.jsCallTwice(5, callback) + XCTAssertEqual(ret, 5) + XCTAssertEqual(total, 10) + } + + func testCallingReleasedClosureThrows() { + let transform = JSTypedClosure<(Int) -> Int> { $0 + 1 } + transform.release() + + do { + _ = try ClosureSupportImports.jsApplyInt(41, transform) + XCTFail("Expected JSException for released closure") + } catch let error { + let message = error.thrownValue.object?["message"].string + XCTAssertNotNil(message) + XCTAssertTrue(message?.contains(#fileID) ?? false, "message=\(message ?? "nil")") + } + } + + func testMultipleArity() throws { + let sum = JSTypedClosure<(Int, Int) -> Int> { $0 + $1 } + defer { sum.release() } + XCTAssertEqual(try ClosureSupportImports.jsCallBinary(sum), 3) + } + + func testTripleArity() throws { + let sum = JSTypedClosure<(Int, Int, Int) -> Int> { $0 + $1 + $2 } + defer { sum.release() } + XCTAssertEqual(try ClosureSupportImports.jsCallTriple(sum), 6) + } + + func testOptionalNoneSkipsCall() throws { + XCTAssertFalse(try ClosureSupportImports.jsOptionalInvoke(nil)) + } + + func testOptionalSomeCalls() throws { + var called = false + let closure = JSTypedClosure<() -> Bool> { + called = true + return true + } + defer { closure.release() } + XCTAssertTrue(try ClosureSupportImports.jsOptionalInvoke(closure)) + XCTAssertTrue(called) + } + + func testDropDuringCallThenThrows() throws { + var closure: JSTypedClosure<() -> Void>! = nil + closure = JSTypedClosure { + closure.release() + } + let message = try ClosureSupportImports.jsCallAfterRelease(closure) + XCTAssertTrue( + message.contains(#fileID), + "\"\(message)\" does not contain expected file name" + ) + } + + func testStoredClosureAfterReleaseThrows() throws { + let closure = JSTypedClosure<() -> Void> {} + try ClosureSupportImports.jsStoreClosure(closure) + closure.release() + XCTAssertThrowsError(try ClosureSupportImports.jsCallStoredClosure()) + } + + func testClosuresDoNotLeakHeapEntries() throws { + let baseline = try ClosureSupportImports.jsHeapCount() + + for _ in 0..<50 { + let closure: JSTypedClosure<(Int) -> Void> = JSTypedClosure { _ in } + _ = try? ClosureSupportImports.jsCallTwice(0, closure) + } + + // Trigger GC and read heap size from JS side + let after = try ClosureSupportImports.jsHeapCount() + XCTAssertEqual(after, baseline, "Heap entry count should return to baseline after GC") + } + +} diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 7ca92b35c..163c9e479 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -16,18 +16,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests1 } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTests10HttpStatusO_Si: _BridgedSwiftClosureBox { - let closure: (HttpStatus) -> Int - init(_ closure: @escaping (HttpStatus) -> Int) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si { - static func bridgeJSLower(_ closure: @escaping (HttpStatus) -> Int) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTests10HttpStatusO_Si(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> Int { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -43,12 +41,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests10HttpStatusO_Si>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(HttpStatus.bridgeJSLiftParameter(param0)) + 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") @@ -64,18 +73,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5 } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_SS: _BridgedSwiftClosureBox { - let closure: (Theme) -> String - init(_ closure: @escaping (Theme) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_SS { - static func bridgeJSLower(_ closure: @escaping (Theme) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -91,12 +98,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_SS { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + 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") @@ -112,18 +130,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5 } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_Sb: _BridgedSwiftClosureBox { - let closure: (Theme) -> Bool - init(_ closure: @escaping (Theme) -> Bool) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb { - static func bridgeJSLower(_ closure: @escaping (Theme) -> Bool) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_Sb(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Bool { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -139,12 +155,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests5ThemeO_Sb>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + 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") @@ -160,18 +187,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7 } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTests7GreeterC_SS: _BridgedSwiftClosureBox { - let closure: (Greeter) -> String - init(_ closure: @escaping (Greeter) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTests7GreeterC_SS { - static func bridgeJSLower(_ closure: @escaping (Greeter) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTests7GreeterC_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Greeter) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -187,12 +212,80 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests7GreeterC_SS { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests7GreeterC_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Greeter.bridgeJSLiftParameter(param0)) + 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(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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") @@ -208,18 +301,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9 } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTests9APIResultO_SS: _BridgedSwiftClosureBox { - let closure: (APIResult) -> String - init(_ closure: @escaping (APIResult) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS { - static func bridgeJSLower(_ closure: @escaping (APIResult) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTests9APIResultO_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -235,12 +326,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests9APIResultO_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(APIResult.bridgeJSLiftParameter(param0)) + 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") @@ -256,18 +358,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9 } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_SS: _BridgedSwiftClosureBox { - let closure: (Direction) -> String - init(_ closure: @escaping (Direction) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_SS { - static func bridgeJSLower(_ closure: @escaping (Direction) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -283,12 +383,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_SS { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Direction.bridgeJSLiftParameter(param0)) + 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") @@ -304,18 +415,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9 } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_Sb: _BridgedSwiftClosureBox { - let closure: (Direction) -> Bool - init(_ closure: @escaping (Direction) -> Bool) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb { - static func bridgeJSLower(_ closure: @escaping (Direction) -> Bool) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_Sb(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Bool { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -331,12 +440,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTests9DirectionO_Sb>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Direction.bridgeJSLiftParameter(param0)) + 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") @@ -352,18 +472,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_7GreeterC: _BridgedSwiftClosureBox { - let closure: (String) -> Greeter - init(_ closure: @escaping (String) -> Greeter) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_7GreeterC { - static func bridgeJSLower(_ closure: @escaping (String) -> Greeter) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_7GreeterC(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (String) -> Greeter { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -379,12 +497,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_7GreeterC { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSS_7GreeterC>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) + 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") @@ -400,18 +529,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_SS: _BridgedSwiftClosureBox { - let closure: (String) -> String - init(_ closure: @escaping (String) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_SS { - static func bridgeJSLower(_ closure: @escaping (String) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSS_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -427,12 +554,80 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_SS { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSS_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) + 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(_ callback: Int32, _ param0: Float64) -> Float64 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd(_ callback: Int32, _ param0: Float64) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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") @@ -448,18 +643,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSiSSSd_SS: _BridgedSwiftClosureBox { - let closure: (Int, String, Double) -> String - init(_ closure: @escaping (Int, String, Double) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTestsSiSSSd_SS { - static func bridgeJSLower(_ closure: @escaping (Int, String, Double) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSiSSSd_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Int, String, Double) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0, param1, param2 in @@ -477,12 +670,140 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSiSSSd_SS { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSiSSSd_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Int.bridgeJSLiftParameter(param0), String.bridgeJSLiftParameter(param1Bytes, param1Length), Double.bridgeJSLiftParameter(param2)) + 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(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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(_ callback: Int32, _ param0: Int32, _ param1: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si(_ callback: Int32, _ param0: Int32, _ param1: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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") @@ -498,18 +819,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSi_Si: _BridgedSwiftClosureBox { - let closure: (Int) -> Int - init(_ closure: @escaping (Int) -> Int) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTestsSi_Si { - static func bridgeJSLower(_ closure: @escaping (Int) -> Int) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSi_Si(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Int { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -525,12 +844,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSi_Si { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSi_Si>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Int.bridgeJSLiftParameter(param0)) + 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") @@ -546,18 +876,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSi_y: _BridgedSwiftClosureBox { - let closure: (Int) -> Void - init(_ closure: @escaping (Int) -> Void) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTestsSi_y { - static func bridgeJSLower(_ closure: @escaping (Int) -> Void) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSi_y(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Void { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -572,12 +900,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSi_y { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSi_y>.fromOpaque(boxPtr).takeUnretainedValue() - box.closure(Int.bridgeJSLiftParameter(param0)) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Int) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure(Int.bridgeJSLiftParameter(param0)) #else fatalError("Only available on WebAssembly") #endif @@ -592,18 +931,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq5ThemeO_SS: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTestsSq5ThemeO_SS { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq5ThemeO_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -619,12 +956,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSq5ThemeO_SS { } } -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq5ThemeO_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) + 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") @@ -640,18 +988,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_SS: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_SS { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -667,12 +1013,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_SS { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + 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") @@ -688,18 +1045,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC: _BridgedSwiftClosureBox { - let closure: (Optional) -> Optional - init(_ closure: @escaping (Optional) -> Optional) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC { - static func bridgeJSLower(_ closure: @escaping (Optional) -> Optional) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -715,12 +1070,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + 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") @@ -736,18 +1102,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9APIResultO_SS: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9APIResultO_SS { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9APIResultO_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -763,12 +1127,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9APIResultO_SS { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq9APIResultO_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0CaseId)) + 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") @@ -784,18 +1159,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9DirectionO_SS: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSq9DirectionO_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -811,12 +1184,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSq9DirectionO_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + 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") @@ -832,18 +1216,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSS_SS: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSS_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -859,12 +1241,23 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSqSS_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) + 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") @@ -880,18 +1273,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSi_SS: _BridgedSwiftClosureBox { - let closure: (Optional) -> String - init(_ closure: @escaping (Optional) -> String) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSi_SS { - static func bridgeJSLower(_ closure: @escaping (Optional) -> String) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsSqSi_SS(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] param0 in @@ -907,12 +1298,79 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSi_SS { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsSqSi_SS>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + 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_20BridgeJSRuntimeTestsy_Sb") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(_ callback: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(_ callback: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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") @@ -928,18 +1386,16 @@ fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy } #endif -private final class _BJS_ClosureBox_20BridgeJSRuntimeTestsy_Sq7GreeterC: _BridgedSwiftClosureBox { - let closure: () -> Optional - init(_ closure: @escaping () -> Optional) { - self.closure = closure - } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") } +#endif private enum _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC { - static func bridgeJSLower(_ closure: @escaping () -> Optional) -> UnsafeMutableRawPointer { - let box = _BJS_ClosureBox_20BridgeJSRuntimeTestsy_Sq7GreeterC(closure) - return Unmanaged.passRetained(box).toOpaque() - } static func bridgeJSLift(_ callbackId: Int32) -> () -> Optional { let callback = JSObject.bridgeJSLiftParameter(callbackId) return { [callback] in @@ -954,18 +1410,83 @@ private enum _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC { } } +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 box = Unmanaged<_BJS_ClosureBox_20BridgeJSRuntimeTestsy_Sq7GreeterC>.fromOpaque(boxPtr).takeUnretainedValue() - let result = box.closure() + 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(_ callback: Int32) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y(_ callback: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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 AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { let jsObject: JSObject @@ -4934,10 +5455,10 @@ public func _bjs_formatName(_ nameBytes: Int32, _ nameLength: Int32, _ transform @_expose(wasm, "bjs_makeFormatter") @_cdecl("bjs_makeFormatter") -public func _bjs_makeFormatter(_ prefixBytes: Int32, _ prefixLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_makeFormatter(_ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { #if arch(wasm32) let ret = makeFormatter(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) - return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -4945,10 +5466,10 @@ public func _bjs_makeFormatter(_ prefixBytes: Int32, _ prefixLength: Int32) -> U @_expose(wasm, "bjs_makeAdder") @_cdecl("bjs_makeAdder") -public func _bjs_makeAdder(_ base: Int32) -> UnsafeMutableRawPointer { +public func _bjs_makeAdder(_ base: Int32) -> Int32 { #if arch(wasm32) let ret = makeAdder(base: Int.bridgeJSLiftParameter(base)) - return _BJS_Closure_20BridgeJSRuntimeTestsSi_Si.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -6081,6 +6602,97 @@ public func _bjs_arrayMembersFirst() -> Void { #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 { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ClosureSupportExports_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportExports_wrap") +fileprivate func _bjs_ClosureSupportExports_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ClosureSupportExports_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_Greeter_init") @_cdecl("bjs_Greeter_init") public func _bjs_Greeter_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { @@ -6126,10 +6738,10 @@ public func _bjs_Greeter_greetWith(_ _self: UnsafeMutableRawPointer, _ greeter: @_expose(wasm, "bjs_Greeter_makeFormatter") @_cdecl("bjs_Greeter_makeFormatter") -public func _bjs_Greeter_makeFormatter(_ _self: UnsafeMutableRawPointer, _ suffixBytes: Int32, _ suffixLength: Int32) -> UnsafeMutableRawPointer { +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 _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -6137,10 +6749,10 @@ public func _bjs_Greeter_makeFormatter(_ _self: UnsafeMutableRawPointer, _ suffi @_expose(wasm, "bjs_Greeter_static_makeCreator") @_cdecl("bjs_Greeter_static_makeCreator") -public func _bjs_Greeter_static_makeCreator(_ defaultNameBytes: Int32, _ defaultNameLength: Int32) -> UnsafeMutableRawPointer { +public func _bjs_Greeter_static_makeCreator(_ defaultNameBytes: Int32, _ defaultNameLength: Int32) -> Int32 { #if arch(wasm32) let ret = Greeter.makeCreator(defaultName: String.bridgeJSLiftParameter(defaultNameBytes, defaultNameLength)) - return _BJS_Closure_20BridgeJSRuntimeTestsSS_7GreeterC.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -6148,10 +6760,10 @@ public func _bjs_Greeter_static_makeCreator(_ defaultNameBytes: Int32, _ default @_expose(wasm, "bjs_Greeter_makeCustomGreeter") @_cdecl("bjs_Greeter_makeCustomGreeter") -public func _bjs_Greeter_makeCustomGreeter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_Greeter_makeCustomGreeter(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = Greeter.bridgeJSLiftParameter(_self).makeCustomGreeter() - return _BJS_Closure_20BridgeJSRuntimeTests7GreeterC_SS.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -7981,10 +8593,10 @@ public func _bjs_TextProcessor_processWithCustom(_ _self: UnsafeMutableRawPointe @_expose(wasm, "bjs_TextProcessor_getTransform") @_cdecl("bjs_TextProcessor_getTransform") -public func _bjs_TextProcessor_getTransform(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_getTransform(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).getTransform() - return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -8025,10 +8637,10 @@ public func _bjs_TextProcessor_processOptionalGreeter(_ _self: UnsafeMutableRawP @_expose(wasm, "bjs_TextProcessor_makeOptionalStringFormatter") @_cdecl("bjs_TextProcessor_makeOptionalStringFormatter") -public func _bjs_TextProcessor_makeOptionalStringFormatter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeOptionalStringFormatter(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalStringFormatter() - return _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -8036,10 +8648,10 @@ public func _bjs_TextProcessor_makeOptionalStringFormatter(_ _self: UnsafeMutabl @_expose(wasm, "bjs_TextProcessor_makeOptionalGreeterCreator") @_cdecl("bjs_TextProcessor_makeOptionalGreeterCreator") -public func _bjs_TextProcessor_makeOptionalGreeterCreator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeOptionalGreeterCreator(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalGreeterCreator() - return _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -8091,10 +8703,10 @@ public func _bjs_TextProcessor_processAPIResult(_ _self: UnsafeMutableRawPointer @_expose(wasm, "bjs_TextProcessor_makeDirectionChecker") @_cdecl("bjs_TextProcessor_makeDirectionChecker") -public func _bjs_TextProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() - return _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -8102,10 +8714,10 @@ public func _bjs_TextProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPoi @_expose(wasm, "bjs_TextProcessor_makeThemeValidator") @_cdecl("bjs_TextProcessor_makeThemeValidator") -public func _bjs_TextProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() - return _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -8113,10 +8725,10 @@ public func _bjs_TextProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPoint @_expose(wasm, "bjs_TextProcessor_makeStatusCodeExtractor") @_cdecl("bjs_TextProcessor_makeStatusCodeExtractor") -public func _bjs_TextProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() - return _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -8124,10 +8736,10 @@ public func _bjs_TextProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRaw @_expose(wasm, "bjs_TextProcessor_makeAPIResultHandler") @_cdecl("bjs_TextProcessor_makeAPIResultHandler") -public func _bjs_TextProcessor_makeAPIResultHandler(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeAPIResultHandler(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() - return _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -8168,10 +8780,10 @@ public func _bjs_TextProcessor_processOptionalAPIResult(_ _self: UnsafeMutableRa @_expose(wasm, "bjs_TextProcessor_makeOptionalDirectionFormatter") @_cdecl("bjs_TextProcessor_makeOptionalDirectionFormatter") -public func _bjs_TextProcessor_makeOptionalDirectionFormatter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +public func _bjs_TextProcessor_makeOptionalDirectionFormatter(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() - return _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS.bridgeJSLower(ret) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -8302,162 +8914,484 @@ public func _bjs_OptionalPropertyHolder_optionalName_get(_ _self: UnsafeMutableR #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_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 { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalPropertyHolder_wrap") +fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_Container_init") +@_cdecl("bjs_Container_init") +public func _bjs_Container_init(_ config: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let _tmp_config = Optional.bridgeJSLiftParameter(config) + 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, _ value: Int32) -> Void { + #if arch(wasm32) + Container.bridgeJSLiftParameter(_self).config = Optional.bridgeJSLiftParameter(value) + #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 { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_Container_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Container_wrap") +fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyVoid_static") +fileprivate func bjs_ClosureSupportImports_jsApplyVoid_static(_ callback: Int32) -> Void +#else +fileprivate func bjs_ClosureSupportImports_jsApplyVoid_static(_ callback: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyBool_static") +fileprivate func bjs_ClosureSupportImports_jsApplyBool_static(_ callback: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsApplyBool_static(_ callback: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyInt_static") +fileprivate func bjs_ClosureSupportImports_jsApplyInt_static(_ value: Int32, _ transform: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsApplyInt_static(_ value: Int32, _ transform: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyDouble_static") +fileprivate func bjs_ClosureSupportImports_jsApplyDouble_static(_ value: Float64, _ transform: Int32) -> Float64 +#else +fileprivate func bjs_ClosureSupportImports_jsApplyDouble_static(_ value: Float64, _ transform: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyString_static") +fileprivate func bjs_ClosureSupportImports_jsApplyString_static(_ value: Int32, _ transform: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsApplyString_static(_ value: Int32, _ transform: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyJSObject_static") +fileprivate func bjs_ClosureSupportImports_jsApplyJSObject_static(_ value: Int32, _ transform: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsApplyJSObject_static(_ value: Int32, _ transform: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsMakeIntToInt_static") +fileprivate func bjs_ClosureSupportImports_jsMakeIntToInt_static(_ base: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsMakeIntToInt_static(_ base: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsMakeDoubleToDouble_static") +fileprivate func bjs_ClosureSupportImports_jsMakeDoubleToDouble_static(_ base: Float64) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsMakeDoubleToDouble_static(_ base: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsMakeStringToString_static") +fileprivate func bjs_ClosureSupportImports_jsMakeStringToString_static(_ prefix: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsMakeStringToString_static(_ prefix: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallTwice_static") +fileprivate func bjs_ClosureSupportImports_jsCallTwice_static(_ value: Int32, _ callback: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsCallTwice_static(_ value: Int32, _ callback: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallBinary_static") +fileprivate func bjs_ClosureSupportImports_jsCallBinary_static(_ callback: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsCallBinary_static(_ callback: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallTriple_static") +fileprivate func bjs_ClosureSupportImports_jsCallTriple_static(_ callback: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsCallTriple_static(_ callback: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallAfterRelease_static") +fileprivate func bjs_ClosureSupportImports_jsCallAfterRelease_static(_ callback: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsCallAfterRelease_static(_ callback: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsOptionalInvoke_static") +fileprivate func bjs_ClosureSupportImports_jsOptionalInvoke_static(_ callbackIsSome: Int32, _ callbackFuncRef: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsOptionalInvoke_static(_ callbackIsSome: Int32, _ callbackFuncRef: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsStoreClosure_static") +fileprivate func bjs_ClosureSupportImports_jsStoreClosure_static(_ callback: Int32) -> Void +#else +fileprivate func bjs_ClosureSupportImports_jsStoreClosure_static(_ callback: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallStoredClosure_static") +fileprivate func bjs_ClosureSupportImports_jsCallStoredClosure_static() -> Void +#else +fileprivate func bjs_ClosureSupportImports_jsCallStoredClosure_static() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsHeapCount_static") +fileprivate func bjs_ClosureSupportImports_jsHeapCount_static() -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsHeapCount_static() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_runJsClosureSupportTests_static") +fileprivate func bjs_ClosureSupportImports_runJsClosureSupportTests_static() -> Void +#else +fileprivate func bjs_ClosureSupportImports_runJsClosureSupportTests_static() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +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) } -@_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 +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) } -@_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 +func _$ClosureSupportImports_jsApplyString(_ value: String, _ transform: JSTypedClosure<(String) -> String>) throws(JSException) -> String { + let valueValue = value.bridgeJSLowerParameter() + let transformFuncRef = transform.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsApplyString_static(valueValue, transformFuncRef) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) } -@_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 +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) } -@_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 +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) } -@_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 +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) } -extension OptionalPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) +func _$ClosureSupportImports_jsMakeStringToString(_ prefix: String) throws(JSException) -> (String) -> String { + let prefixValue = prefix.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsMakeStringToString_static(prefixValue) + if let error = _swift_js_take_exception() { + throw error } + return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(ret) } -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalPropertyHolder_wrap") -fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") +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) } -#endif -@_expose(wasm, "bjs_Container_init") -@_cdecl("bjs_Container_init") -public func _bjs_Container_init(_ config: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let _tmp_config = Optional.bridgeJSLiftParameter(config) - let _tmp_location = DataPoint.bridgeJSLiftParameter() - let ret = Container(location: _tmp_location, config: _tmp_config) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif +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) } -@_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 +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) } -@_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 +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) } -@_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 +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) } -@_expose(wasm, "bjs_Container_config_set") -@_cdecl("bjs_Container_config_set") -public func _bjs_Container_config_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - Container.bridgeJSLiftParameter(_self).config = Optional.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif +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 + } } -@_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 +func _$ClosureSupportImports_jsCallStoredClosure() throws(JSException) -> Void { + bjs_ClosureSupportImports_jsCallStoredClosure_static() + if let error = _swift_js_take_exception() { + throw error + } } -extension Container: ConvertibleToJSValue, _BridgedSwiftHeapObject { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_Container_wrap(Unmanaged.passRetained(self).toOpaque())))) +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) } -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Container_wrap") -fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") +func _$ClosureSupportImports_runJsClosureSupportTests() throws(JSException) -> Void { + bjs_ClosureSupportImports_runJsClosureSupportTests_static() + if let error = _swift_js_take_exception() { + throw error + } } -#endif #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripDictionary") @@ -9626,99 +10560,6 @@ func _$ArrayHost_firstLabel(_ self: JSObject, _ values: [String]) throws(JSExcep return String.bridgeJSLiftReturn(ret) } -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsApplyInt") -fileprivate func bjs_jsApplyInt(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func bjs_jsApplyInt(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$jsApplyInt(_ value: Int, _ transform: @escaping (Int) -> Int) throws(JSException) -> Int { - let valueValue = value.bridgeJSLowerParameter() - let transformPointer = _BJS_Closure_20BridgeJSRuntimeTestsSi_Si.bridgeJSLower(transform) - let ret = bjs_jsApplyInt(valueValue, transformPointer) - if let error = _swift_js_take_exception() { - throw error - } - return Int.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsMakeAdder") -fileprivate func bjs_jsMakeAdder(_ base: Int32) -> Int32 -#else -fileprivate func bjs_jsMakeAdder(_ base: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$jsMakeAdder(_ base: Int) throws(JSException) -> (Int) -> Int { - let baseValue = base.bridgeJSLowerParameter() - let ret = bjs_jsMakeAdder(baseValue) - if let error = _swift_js_take_exception() { - throw error - } - return _BJS_Closure_20BridgeJSRuntimeTestsSi_Si.bridgeJSLift(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsMapString") -fileprivate func bjs_jsMapString(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func bjs_jsMapString(_ value: Int32, _ transform: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$jsMapString(_ value: String, _ transform: @escaping (String) -> String) throws(JSException) -> String { - let valueValue = value.bridgeJSLowerParameter() - let transformPointer = _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLower(transform) - let ret = bjs_jsMapString(valueValue, transformPointer) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsMakePrefixer") -fileprivate func bjs_jsMakePrefixer(_ prefix: Int32) -> Int32 -#else -fileprivate func bjs_jsMakePrefixer(_ prefix: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$jsMakePrefixer(_ prefix: String) throws(JSException) -> (String) -> String { - let prefixValue = prefix.bridgeJSLowerParameter() - let ret = bjs_jsMakePrefixer(prefixValue) - if let error = _swift_js_take_exception() { - throw error - } - return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsCallTwice") -fileprivate func bjs_jsCallTwice(_ value: Int32, _ callback: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func bjs_jsCallTwice(_ value: Int32, _ callback: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func _$jsCallTwice(_ value: Int, _ callback: @escaping (Int) -> Void) throws(JSException) -> Int { - let valueValue = value.bridgeJSLowerParameter() - let callbackPointer = _BJS_Closure_20BridgeJSRuntimeTestsSi_y.bridgeJSLower(callback) - let ret = bjs_jsCallTwice(valueValue, callbackPointer) - if let error = _swift_js_take_exception() { - throw error - } - return Int.bridgeJSLiftReturn(ret) -} - #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsTranslatePoint") fileprivate func bjs_jsTranslatePoint(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 8171fd95f..23f47b03d 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -2,134 +2,165 @@ "exported" : { "classes" : [ { - "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", + "abiName" : "bjs_ClosureSupportExports_static_makeIntToInt", "effects" : { "isAsync" : false, - "isStatic" : false, + "isStatic" : true, "isThrows" : false }, - "name" : "greet", + "name" : "makeIntToInt", "parameters" : [ + { + "label" : "_", + "name" : "base", + "type" : { + "int" : { + } + } + } ], "returnType" : { - "string" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + } + } + }, + "useJSTypedClosure" : false + } + }, + "staticContext" : { + "className" : { + "_0" : "ClosureSupportExports" } } }, { - "abiName" : "bjs_Greeter_changeName", + "abiName" : "bjs_ClosureSupportExports_static_makeDoubleToDouble", "effects" : { "isAsync" : false, - "isStatic" : false, + "isStatic" : true, "isThrows" : false }, - "name" : "changeName", + "name" : "makeDoubleToDouble", "parameters" : [ { - "label" : "name", - "name" : "name", + "label" : "_", + "name" : "base", "type" : { - "string" : { + "double" : { } } } ], "returnType" : { - "void" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSd_Sd", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "double" : { + + } + } + ], + "returnType" : { + "double" : { + } + } + }, + "useJSTypedClosure" : false + } + }, + "staticContext" : { + "className" : { + "_0" : "ClosureSupportExports" } } }, { - "abiName" : "bjs_Greeter_greetWith", + "abiName" : "bjs_ClosureSupportExports_static_makeStringToString", "effects" : { "isAsync" : false, - "isStatic" : false, + "isStatic" : true, "isThrows" : false }, - "name" : "greetWith", + "name" : "makeStringToString", "parameters" : [ { - "label" : "greeter", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "label" : "customGreeting", - "name" : "customGreeting", + "label" : "_", + "name" : "prefix", "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests7GreeterC_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - ], - "returnType" : { - "string" : { + "string" : { - } - } - } } } } ], "returnType" : { - "string" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + } + } + }, + "useJSTypedClosure" : false + } + }, + "staticContext" : { + "className" : { + "_0" : "ClosureSupportExports" } } }, { - "abiName" : "bjs_Greeter_makeFormatter", + "abiName" : "bjs_ClosureSupportExports_static_makeJSIntToInt", "effects" : { "isAsync" : false, - "isStatic" : false, + "isStatic" : true, "isThrows" : false }, - "name" : "makeFormatter", + "name" : "makeJSIntToInt", "parameters" : [ { - "label" : "suffix", - "name" : "suffix", + "label" : "_", + "name" : "base", "type" : { - "string" : { + "int" : { } } @@ -140,38 +171,44 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "string" : { + "int" : { } } ], "returnType" : { - "string" : { + "int" : { } } - } + }, + "useJSTypedClosure" : true + } + }, + "staticContext" : { + "className" : { + "_0" : "ClosureSupportExports" } } }, { - "abiName" : "bjs_Greeter_static_makeCreator", + "abiName" : "bjs_ClosureSupportExports_static_makeJSDoubleToDouble", "effects" : { "isAsync" : false, "isStatic" : true, "isThrows" : false }, - "name" : "makeCreator", + "name" : "makeJSDoubleToDouble", "parameters" : [ { - "label" : "defaultName", - "name" : "defaultName", + "label" : "_", + "name" : "base", "type" : { - "string" : { + "double" : { } } @@ -182,51 +219,60 @@ "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_7GreeterC", + "mangleName" : "20BridgeJSRuntimeTestsSd_Sd", "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "string" : { + "double" : { } } ], "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" + "double" : { + } } - } + }, + "useJSTypedClosure" : true } }, "staticContext" : { "className" : { - "_0" : "Greeter" + "_0" : "ClosureSupportExports" } } }, { - "abiName" : "bjs_Greeter_makeCustomGreeter", + "abiName" : "bjs_ClosureSupportExports_static_makeJSStringToString", "effects" : { "isAsync" : false, - "isStatic" : false, + "isStatic" : true, "isThrows" : false }, - "name" : "makeCustomGreeter", + "name" : "makeJSStringToString", "parameters" : [ + { + "label" : "_", + "name" : "prefix", + "type" : { + "string" : { + } + } + } ], "returnType" : { "closure" : { "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests7GreeterC_SS", + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", "moduleName" : "BridgeJSRuntimeTests", "parameters" : [ { - "swiftHeapObject" : { - "_0" : "Greeter" + "string" : { + } } ], @@ -235,50 +281,305 @@ } } - } + }, + "useJSTypedClosure" : true + } + }, + "staticContext" : { + "className" : { + "_0" : "ClosureSupportExports" } } } ], - "name" : "Greeter", + "name" : "ClosureSupportExports", "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - } - } - }, - { - "isReadonly" : true, + ], + "swiftCallName" : "ClosureSupportExports" + }, + { + "constructor" : { + "abiName" : "bjs_Greeter_init", + "effects" : { + "isAsync" : false, "isStatic" : false, - "name" : "prefix", - "type" : { - "string" : { + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + } } } - } - ], - "swiftCallName" : "Greeter" - }, - { + ] + }, + "explicitAccessControl" : "public", "methods" : [ { - "abiName" : "bjs_Calculator_square", + "abiName" : "bjs_Greeter_greet", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : false }, - "name" : "square", + "name" : "greet", "parameters" : [ - { - "label" : "value", - "name" : "value", + + ], + "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" : { + + } + } + }, + "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" : { + + } + } + }, + "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" + } + } + }, + "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" : { + + } + } + }, + "useJSTypedClosure" : false + } + } + } + ], + "name" : "Greeter", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "Greeter" + }, + { + "methods" : [ + { + "abiName" : "bjs_Calculator_square", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "square", + "parameters" : [ + { + "label" : "value", + "name" : "value", "type" : { "int" : { @@ -2246,7 +2547,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -2328,7 +2630,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -2369,7 +2672,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -2409,7 +2713,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -2456,7 +2761,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -2503,7 +2809,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -2549,7 +2856,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -2584,7 +2892,8 @@ "_1" : "null" } } - } + }, + "useJSTypedClosure" : false } } }, @@ -2619,7 +2928,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -2662,7 +2972,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -2705,7 +3016,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -2747,7 +3059,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -2788,7 +3101,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -2823,7 +3137,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -2858,7 +3173,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -2892,7 +3208,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -2932,7 +3249,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -2980,7 +3298,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -3027,7 +3346,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -3073,7 +3393,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -8141,7 +8462,8 @@ } } - } + }, + "useJSTypedClosure" : false } } } @@ -8190,7 +8512,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -8232,7 +8555,8 @@ } } - } + }, + "useJSTypedClosure" : false } } }, @@ -10539,7 +10863,8 @@ "_1" : "null" } } - } + }, + "useJSTypedClosure" : false } } } @@ -12866,54 +13191,688 @@ "string" : { } - }, - "_1" : "null" - } - } - } - ], - "name" : "ArrayMembers", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "ints", - "type" : { - "array" : { - "_0" : { + }, + "_1" : "null" + } + } + } + ], + "name" : "ArrayMembers", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "ints", + "type" : { + "array" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optStrings", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "ArrayMembers" + } + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "ClosureSupportImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "name" : "jsApplyVoid", + "parameters" : [ + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsy_y", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "jsApplyBool", + "parameters" : [ + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsy_Sb", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "name" : "jsApplyInt", + "parameters" : [ + { + "name" : "value", + "type" : { + "int" : { + + } + } + }, + { + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "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" : { + + } + } + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "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" : { + + } + } + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "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" : { + + } + } + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "name" : "jsMakeIntToInt", + "parameters" : [ + { + "name" : "base", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + "useJSTypedClosure" : false + } + } + }, + { + "name" : "jsMakeDoubleToDouble", + "parameters" : [ + { + "name" : "base", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSd_Sd", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "double" : { + + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + "useJSTypedClosure" : false + } + } + }, + { + "name" : "jsMakeStringToString", + "parameters" : [ + { + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + "useJSTypedClosure" : false + } + } + }, + { + "name" : "jsCallTwice", + "parameters" : [ + { + "name" : "value", + "type" : { + "int" : { + + } + } + }, + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_y", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "name" : "jsCallBinary", + "parameters" : [ + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSiSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + }, + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "name" : "jsCallTriple", + "parameters" : [ + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSiSiSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + }, + { + "int" : { + + } + }, + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "name" : "jsCallAfterRelease", + "parameters" : [ + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsy_y", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "name" : "jsOptionalInvoke", + "parameters" : [ + { + "name" : "callback", + "type" : { + "nullable" : { + "_0" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsy_Sb", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + "useJSTypedClosure" : true + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "name" : "jsStoreClosure", + "parameters" : [ + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsy_y", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "jsCallStoredClosure", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "jsHeapCount", + "parameters" : [ + + ], + "returnType" : { "int" : { } } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optStrings", - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "string" : { + }, + { + "name" : "runJsClosureSupportTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { - } - } } - }, - "_1" : "null" + } } - } + ] } - ], - "swiftCallName" : "ArrayMembers" - } - ] - }, - "imported" : { - "children" : [ + ] + }, { "functions" : [ { @@ -14181,212 +15140,6 @@ } ] }, - { - "functions" : [ - { - "name" : "jsApplyInt", - "parameters" : [ - { - "name" : "value", - "type" : { - "int" : { - - } - } - }, - { - "name" : "transform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "int" : { - - } - } - ], - "returnType" : { - "int" : { - - } - } - } - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "name" : "jsMakeAdder", - "parameters" : [ - { - "name" : "base", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "int" : { - - } - } - ], - "returnType" : { - "int" : { - - } - } - } - } - } - }, - { - "name" : "jsMapString", - "parameters" : [ - { - "name" : "value", - "type" : { - "string" : { - - } - } - }, - { - "name" : "transform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "name" : "jsMakePrefixer", - "parameters" : [ - { - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - }, - { - "name" : "jsCallTwice", - "parameters" : [ - { - "name" : "value", - "type" : { - "int" : { - - } - } - }, - { - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_y", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "int" : { - - } - } - ], - "returnType" : { - "void" : { - - } - } - } - } - } - } - ], - "returnType" : { - "int" : { - - } - } - } - ], - "types" : [ - - ] - }, { "functions" : [ { diff --git a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift index 4aa96e1b2..fa97c3197 100644 --- a/Tests/BridgeJSRuntimeTests/ImportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ImportAPITests.swift @@ -135,29 +135,6 @@ class ImportAPITests: XCTestCase { XCTAssertEqual(try greeter.prefix, "Hello") } - func testClosureParameterIntToInt() throws { - let result = try jsApplyInt(21) { $0 * 2 } - XCTAssertEqual(result, 42) - } - - func testClosureReturnIntToInt() throws { - let add10 = try jsMakeAdder(10) - XCTAssertEqual(add10(0), 10) - XCTAssertEqual(add10(32), 42) - } - - func testClosureParameterStringToString() throws { - let result = try jsMapString("Hello") { value in - value + ", world!" - } - XCTAssertEqual(result, "Hello, world!") - } - - func testClosureReturnStringToString() throws { - let prefixer = try jsMakePrefixer("Hello, ") - XCTAssertEqual(prefixer("world!"), "Hello, world!") - } - func testRoundTripIntArray() throws { let values = [1, 2, 3, 4, 5] let result = try jsRoundTripIntArray(values) @@ -185,13 +162,6 @@ class ImportAPITests: XCTestCase { XCTAssertEqual(try host.firstLabel(["zeta"]), "zeta") } - func testClosureParameterIntToVoid() throws { - var total = 0 - let ret = try jsCallTwice(5) { total += $0 } - XCTAssertEqual(ret, 5) - XCTAssertEqual(total, 10) - } - func testJSNameFunctionAndClass() throws { XCTAssertEqual(try _jsWeirdFunction(), 42) diff --git a/Tests/BridgeJSRuntimeTests/ImportClosureAPIs.swift b/Tests/BridgeJSRuntimeTests/ImportClosureAPIs.swift deleted file mode 100644 index bb913300b..000000000 --- a/Tests/BridgeJSRuntimeTests/ImportClosureAPIs.swift +++ /dev/null @@ -1,11 +0,0 @@ -@_spi(Experimental) import JavaScriptKit - -@JSFunction func jsApplyInt(_ value: Int, _ transform: @escaping (Int) -> Int) throws(JSException) -> Int - -@JSFunction func jsMakeAdder(_ base: Int) throws(JSException) -> (Int) -> Int - -@JSFunction func jsMapString(_ value: String, _ transform: @escaping (String) -> String) throws(JSException) -> String - -@JSFunction func jsMakePrefixer(_ `prefix`: String) throws(JSException) -> (String) -> String - -@JSFunction func jsCallTwice(_ value: Int, _ callback: @escaping (Int) -> Void) throws(JSException) -> Int diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/ClosureSupportTests.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/ClosureSupportTests.mjs new file mode 100644 index 000000000..0d5560fae --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/JavaScript/ClosureSupportTests.mjs @@ -0,0 +1,311 @@ +/** + * @returns {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Imports["ClosureSupportImports"]} + */ +export function getImports(importsContext) { + return { + jsApplyVoid: (fn) => { + fn(); + }, + jsApplyBool: (fn) => { + return fn(); + }, + jsApplyInt: (v, fn) => { + return fn(v); + }, + jsApplyDouble: (v, fn) => { + return fn(v); + }, + jsApplyString: (v, fn) => { + return fn(v); + }, + jsApplyJSValue: (v, fn) => { + return fn(v); + }, + jsApplyJSObject: (v, fn) => { + return fn(v); + }, + jsApplyArrayInt: (v, fn) => { + return fn(v); + }, + jsApplyArrayDouble: (v, fn) => { + return fn(v); + }, + jsApplyArrayString: (v, fn) => { + return fn(v); + }, + jsApplyArrayJSValue: (v, fn) => { + return fn(v); + }, + jsApplyArrayJSObject: (v, fn) => { + return fn(v); + }, + jsMakeIntToInt: (base) => { + return (v) => base + v; + }, + jsMakeDoubleToDouble: (base) => { + return (v) => base + v; + }, + jsMakeStringToString: (prefix) => { + return (name) => `${prefix}${name}`; + }, + jsCallTwice: (v, fn) => { + fn(v); + fn(v); + return v; + }, + jsCallBinary: (fn) => fn(1, 2), + jsCallTriple: (fn) => fn(1, 2, 3), + jsCallTripleMut: (fn) => { + fn(1, 2, 3); + fn(4, 5, 6); + }, + jsCallTwiceMut: (fn) => { + fn(); + fn(); + }, + jsHeapCount: () => { + globalThis.gc?.(); + return globalThis.swift?.memory?._heapValueById?.size ?? -1; + }, + jsCallAfterRelease: (fn) => { + try { + fn(); + fn(); + return "null"; + } catch (e) { + return e?.message ?? "error"; + } + }, + jsOptionalInvoke: (fn) => { + if (fn == null) { return false; } + return fn(); + }, + jsStoreClosure: (fn) => { globalThis.__storedClosure = fn; }, + jsCallStoredClosure: () => { return globalThis.__storedClosure?.(); }, + + runJsClosureSupportTests: () => { + const exports = importsContext.getExports(); + if (!exports) { throw new Error("No exports!?"); } + runJsClosureSupportTests(exports); + }, + }; +} + +import assert from "node:assert"; + +/** @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ +export function runJsClosureSupportTests(exports) { + const upperTransform = (text) => text.toUpperCase(); + const processor = new exports.TextProcessor(upperTransform); + + assert.equal(processor.process("hello"), "HELLO"); + + const multiParamTransform = (count, text, ratio) => { + return `${text.toUpperCase()}-${count}-${ratio.toFixed(2)}`; + }; + assert.equal(processor.processWithCustom("world", multiParamTransform), "WORLD-42-3.14"); + assert.equal(processor.process("test"), "TEST"); + + const greeterForClosure = new exports.Greeter("World"); + const greeterCaller = new exports.Greeter("Caller"); + const customGreeting = (greeter) => `Custom greeting for ${greeter.name}: ${greeter.greet()}`; + const greetResult = greeterCaller.greetWith(greeterForClosure, customGreeting); + assert.equal(greetResult, "Custom greeting for World: Hello, World!"); + greeterForClosure.release(); + greeterCaller.release(); + + assert.equal(exports.formatName("ada", (name) => name.toUpperCase()), "ADA"); + assert.equal(exports.formatName("grace", (name) => `Dr. ${name}`), "Dr. grace"); + + const addDr = exports.makeFormatter("Dr."); + assert.equal(addDr("Ada"), "Dr. Ada"); + assert.equal(addDr("Grace"), "Dr. Grace"); + + const addProf = exports.makeFormatter("Prof."); + assert.equal(addProf("Hopper"), "Prof. Hopper"); + + const add10 = exports.makeAdder(10); + assert.equal(add10(5), 15); + assert.equal(add10(32), 42); + + const add100 = exports.makeAdder(100); + assert.equal(add100(23), 123); + + const storedTransform = processor.getTransform(); + assert.equal(storedTransform("hello"), "HELLO"); + assert.equal(storedTransform("world"), "WORLD"); + + const greeterForFormatter = new exports.Greeter("Formatter"); + const greeterFormatter = greeterForFormatter.makeFormatter(" [suffix]"); + assert.equal(greeterFormatter("test"), "Hello, Formatter! - test - [suffix]"); + assert.equal(greeterFormatter("data"), "Hello, Formatter! - data - [suffix]"); + greeterForFormatter.release(); + + const greeterCreator = exports.Greeter.makeCreator("Default"); + const createdG1 = greeterCreator("Alice"); + assert.equal(createdG1.name, "Alice"); + assert.equal(createdG1.greet(), "Hello, Alice!"); + const createdG2 = greeterCreator(""); + assert.equal(createdG2.name, "Default"); + assert.equal(createdG2.greet(), "Hello, Default!"); + createdG1.release(); + createdG2.release(); + + const greeterHost = new exports.Greeter("Host"); + const greeterGreeter = greeterHost.makeCustomGreeter(); + const guest1 = new exports.Greeter("Guest1"); + const guest2 = new exports.Greeter("Guest2"); + assert.equal(greeterGreeter(guest1), "Host greets Guest1: Hello, Guest1!"); + assert.equal(greeterGreeter(guest2), "Host greets Guest2: Hello, Guest2!"); + greeterHost.release(); + guest1.release(); + guest2.release(); + + const greeterForMethod = new exports.Greeter("Method"); + const greeterParam = new exports.Greeter("Param"); + const methodResult = greeterForMethod.greetWith(greeterParam, (g) => { + return `Custom: ${g.name} says ${g.greet()}`; + }); + assert.equal(methodResult, "Custom: Param says Hello, Param!"); + greeterForMethod.release(); + greeterParam.release(); + + const optResult1 = processor.processOptionalString((value) => { + return value !== null ? `Got: ${value}` : `Got: null`; + }); + assert.equal(optResult1, "Got: test | Got: null"); + + const optResult2 = processor.processOptionalInt((value) => { + return value !== null ? `Number: ${value}` : `Number: null`; + }); + assert.equal(optResult2, "Number: 42 | Number: null"); + + const optResult3 = processor.processOptionalGreeter((greeter) => { + return greeter !== null ? `Greeter: ${greeter.name}` : `Greeter: null`; + }); + assert.equal(optResult3, "Greeter: Alice | Greeter: null"); + + const optFormatter = processor.makeOptionalStringFormatter(); + assert.equal(optFormatter("world"), "Got: world"); + assert.equal(optFormatter(null), "Got: nil"); + + const optCreator = processor.makeOptionalGreeterCreator(); + const opt1 = optCreator(); + assert.equal(opt1, null); + const opt2 = optCreator(); + assert.notEqual(opt2, null); + assert.equal(opt2.name, "Greeter2"); + assert.equal(opt2.greet(), "Hello, Greeter2!"); + opt2.release(); + const opt3 = optCreator(); + assert.equal(opt3, null); + const opt4 = optCreator(); + assert.notEqual(opt4, null); + assert.equal(opt4.name, "Greeter4"); + opt4.release(); + + const dirResult = processor.processDirection((dir) => { + switch (dir) { + case exports.Direction.North: return "Going North"; + case exports.Direction.South: return "Going South"; + case exports.Direction.East: return "Going East"; + case exports.Direction.West: return "Going West"; + default: return "Unknown"; + } + }); + assert.equal(dirResult, "Going North"); + + const themeResult = processor.processTheme((theme) => { + return theme === exports.Theme.Dark ? "Dark mode" : "Light mode"; + }); + assert.equal(themeResult, "Dark mode"); + + const statusResult = processor.processHttpStatus((status) => { + return status; + }); + assert.equal(statusResult, exports.HttpStatus.Ok); + + const apiResult = processor.processAPIResult((result) => { + if (result.tag === exports.APIResult.Tag.Success) { + return `API Success: ${result.param0}`; + } + return "API Other"; + }); + assert.equal(apiResult, "API Success: test"); + + const dirChecker = processor.makeDirectionChecker(); + assert.equal(dirChecker(exports.Direction.North), true); + assert.equal(dirChecker(exports.Direction.South), true); + assert.equal(dirChecker(exports.Direction.East), false); + assert.equal(dirChecker(exports.Direction.West), false); + + const themeValidator = processor.makeThemeValidator(); + assert.equal(themeValidator(exports.Theme.Dark), true); + assert.equal(themeValidator(exports.Theme.Light), false); + assert.equal(themeValidator(exports.Theme.Auto), false); + + const statusExtractor = processor.makeStatusCodeExtractor(); + assert.equal(statusExtractor(exports.HttpStatus.Ok), 200); + assert.equal(statusExtractor(exports.HttpStatus.NotFound), 404); + assert.equal(statusExtractor(exports.HttpStatus.ServerError), 500); + assert.equal(statusExtractor(exports.HttpStatus.Unknown), -1); + + const apiHandler = processor.makeAPIResultHandler(); + assert.equal(apiHandler({ tag: exports.APIResult.Tag.Success, param0: "done" }), "Success: done"); + assert.equal(apiHandler({ tag: exports.APIResult.Tag.Failure, param0: 500 }), "Failure: 500"); + assert.equal(apiHandler({ tag: exports.APIResult.Tag.Info }), "Info"); + assert.equal(apiHandler({ tag: exports.APIResult.Tag.Flag, param0: true }), "Flag: true"); + assert.equal(apiHandler({ tag: exports.APIResult.Tag.Rate, param0: 1.5 }), "Rate: 1.5"); + assert.equal(apiHandler({ tag: exports.APIResult.Tag.Precise, param0: 3.14159 }), "Precise: 3.14159"); + + const optDirResult = processor.processOptionalDirection((dir) => { + return dir !== null ? `Dir: ${dir}` : "Dir: null"; + }); + assert.equal(optDirResult, `Dir: ${exports.Direction.North} | Dir: null`); + + const optThemeResult = processor.processOptionalTheme((theme) => { + return theme !== null ? `Theme: ${theme}` : "Theme: null"; + }); + assert.equal(optThemeResult, `Theme: ${exports.Theme.Light} | Theme: null`); + + const optApiResult = processor.processOptionalAPIResult((result) => { + if (result === null) return "Result: null"; + if (result.tag === exports.APIResult.Tag.Success) { + return `Result: Success(${result.param0})`; + } + return "Result: other"; + }); + assert.equal(optApiResult, "Result: Success(ok) | Result: null"); + + const optDirFormatter = processor.makeOptionalDirectionFormatter(); + assert.equal(optDirFormatter(exports.Direction.North), "N"); + assert.equal(optDirFormatter(exports.Direction.South), "S"); + assert.equal(optDirFormatter(exports.Direction.East), "E"); + assert.equal(optDirFormatter(exports.Direction.West), "W"); + assert.equal(optDirFormatter(null), "nil"); + + processor.release(); + + + const intToInt = exports.ClosureSupportExports.makeIntToInt(10); + assert.equal(intToInt(0), 10); + assert.equal(intToInt(32), 42); + + const doubleToDouble = exports.ClosureSupportExports.makeDoubleToDouble(10.0); + assert.equal(doubleToDouble(0.0), 10.0); + assert.equal(doubleToDouble(32.0), 42.0); + + const stringToString = exports.ClosureSupportExports.makeStringToString("Hello, "); + assert.equal(stringToString("world!"), "Hello, world!"); + + const jsIntToInt = exports.ClosureSupportExports.makeJSIntToInt(10); + assert.equal(jsIntToInt(0), 10); + assert.equal(jsIntToInt(32), 42); + + const jsDoubleToDouble = exports.ClosureSupportExports.makeJSDoubleToDouble(10.0); + assert.equal(jsDoubleToDouble(0.0), 10.0); + assert.equal(jsDoubleToDouble(32.0), 42.0); + + const jsStringToString = exports.ClosureSupportExports.makeJSStringToString("Hello, "); + assert.equal(jsStringToString("world!"), "Hello, world!"); +} diff --git a/Tests/JavaScriptKitTests/JavaScriptKitTests.swift b/Tests/JavaScriptKitTests/JavaScriptKitTests.swift index b69334ce5..280a17b62 100644 --- a/Tests/JavaScriptKitTests/JavaScriptKitTests.swift +++ b/Tests/JavaScriptKitTests/JavaScriptKitTests.swift @@ -523,5 +523,9 @@ class JavaScriptKitTests: XCTestCase { } } +#if arch(wasm32) @_extern(c, "llvm.wasm.memory.grow.i32") func growMemory(_ memory: Int32, _ pages: Int32) -> Int32 +#else +func growMemory(_ memory: Int32, _ pages: Int32) -> Int32 { return 0 } +#endif diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 934c4f01c..95573b34e 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -5,6 +5,7 @@ import { } from '../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.js'; import { ImportedFoo } from './BridgeJSRuntimeTests/JavaScript/Types.mjs'; import { runJsOptionalSupportTests } from './BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs'; +import { getImports as getClosureSupportImports } from './BridgeJSRuntimeTests/JavaScript/ClosureSupportTests.mjs'; /** @type {import('../.build/plugins/PackageToJS/outputs/PackageTests/test.d.ts').SetupOptionsFn} */ export async function setupOptions(options, context) { @@ -185,23 +186,6 @@ export async function setupOptions(options, context) { BridgeJSRuntimeTests_runAsyncWorks(exports); return; }, - jsApplyInt: (v, fn) => { - return fn(v); - }, - jsMakeAdder: (base) => { - return (v) => base + v; - }, - jsMapString: (value, fn) => { - return fn(value); - }, - jsMakePrefixer: (prefix) => { - return (name) => `${prefix}${name}`; - }, - jsCallTwice: (v, fn) => { - fn(v); - fn(v); - return v; - }, jsTranslatePoint: (point, dx, dy) => { return { x: (point.x | 0) + (dx | 0), y: (point.y | 0) + (dy | 0) }; }, @@ -227,7 +211,8 @@ export async function setupOptions(options, context) { const exports = importsContext.getExports(); if (!exports) { throw new Error("No exports!?"); } runJsOptionalSupportTests(exports); - } + }, + ClosureSupportImports: getClosureSupportImports(importsContext), }; }, addToCoreImports(importObject, importsContext) { @@ -893,202 +878,8 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { cd5.release(); testProtocolSupport(exports); - testClosureSupport(exports); testArraySupport(exports); } -/** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ -function testClosureSupport(exports) { - const upperTransform = (text) => text.toUpperCase(); - const processor = new exports.TextProcessor(upperTransform); - - assert.equal(processor.process("hello"), "HELLO"); - - const multiParamTransform = (count, text, ratio) => { - return `${text.toUpperCase()}-${count}-${ratio.toFixed(2)}`; - }; - assert.equal(processor.processWithCustom("world", multiParamTransform), "WORLD-42-3.14"); - assert.equal(processor.process("test"), "TEST"); - - const greeterForClosure = new exports.Greeter("World"); - const greeterCaller = new exports.Greeter("Caller"); - const customGreeting = (greeter) => `Custom greeting for ${greeter.name}: ${greeter.greet()}`; - const greetResult = greeterCaller.greetWith(greeterForClosure, customGreeting); - assert.equal(greetResult, "Custom greeting for World: Hello, World!"); - greeterForClosure.release(); - greeterCaller.release(); - - assert.equal(exports.formatName("ada", (name) => name.toUpperCase()), "ADA"); - assert.equal(exports.formatName("grace", (name) => `Dr. ${name}`), "Dr. grace"); - - const addDr = exports.makeFormatter("Dr."); - assert.equal(addDr("Ada"), "Dr. Ada"); - assert.equal(addDr("Grace"), "Dr. Grace"); - - const addProf = exports.makeFormatter("Prof."); - assert.equal(addProf("Hopper"), "Prof. Hopper"); - - const add10 = exports.makeAdder(10); - assert.equal(add10(5), 15); - assert.equal(add10(32), 42); - - const add100 = exports.makeAdder(100); - assert.equal(add100(23), 123); - - const storedTransform = processor.getTransform(); - assert.equal(storedTransform("hello"), "HELLO"); - assert.equal(storedTransform("world"), "WORLD"); - - const greeterForFormatter = new exports.Greeter("Formatter"); - const greeterFormatter = greeterForFormatter.makeFormatter(" [suffix]"); - assert.equal(greeterFormatter("test"), "Hello, Formatter! - test - [suffix]"); - assert.equal(greeterFormatter("data"), "Hello, Formatter! - data - [suffix]"); - greeterForFormatter.release(); - - const greeterCreator = exports.Greeter.makeCreator("Default"); - const createdG1 = greeterCreator("Alice"); - assert.equal(createdG1.name, "Alice"); - assert.equal(createdG1.greet(), "Hello, Alice!"); - const createdG2 = greeterCreator(""); - assert.equal(createdG2.name, "Default"); - assert.equal(createdG2.greet(), "Hello, Default!"); - createdG1.release(); - createdG2.release(); - - const greeterHost = new exports.Greeter("Host"); - const greeterGreeter = greeterHost.makeCustomGreeter(); - const guest1 = new exports.Greeter("Guest1"); - const guest2 = new exports.Greeter("Guest2"); - assert.equal(greeterGreeter(guest1), "Host greets Guest1: Hello, Guest1!"); - assert.equal(greeterGreeter(guest2), "Host greets Guest2: Hello, Guest2!"); - greeterHost.release(); - guest1.release(); - guest2.release(); - - const greeterForMethod = new exports.Greeter("Method"); - const greeterParam = new exports.Greeter("Param"); - const methodResult = greeterForMethod.greetWith(greeterParam, (g) => { - return `Custom: ${g.name} says ${g.greet()}`; - }); - assert.equal(methodResult, "Custom: Param says Hello, Param!"); - greeterForMethod.release(); - greeterParam.release(); - - const optResult1 = processor.processOptionalString((value) => { - return value !== null ? `Got: ${value}` : `Got: null`; - }); - assert.equal(optResult1, "Got: test | Got: null"); - - const optResult2 = processor.processOptionalInt((value) => { - return value !== null ? `Number: ${value}` : `Number: null`; - }); - assert.equal(optResult2, "Number: 42 | Number: null"); - - const optResult3 = processor.processOptionalGreeter((greeter) => { - return greeter !== null ? `Greeter: ${greeter.name}` : `Greeter: null`; - }); - assert.equal(optResult3, "Greeter: Alice | Greeter: null"); - - const optFormatter = processor.makeOptionalStringFormatter(); - assert.equal(optFormatter("world"), "Got: world"); - assert.equal(optFormatter(null), "Got: nil"); - - const optCreator = processor.makeOptionalGreeterCreator(); - const opt1 = optCreator(); - assert.equal(opt1, null); - const opt2 = optCreator(); - assert.notEqual(opt2, null); - assert.equal(opt2.name, "Greeter2"); - assert.equal(opt2.greet(), "Hello, Greeter2!"); - opt2.release(); - const opt3 = optCreator(); - assert.equal(opt3, null); - const opt4 = optCreator(); - assert.notEqual(opt4, null); - assert.equal(opt4.name, "Greeter4"); - opt4.release(); - - const dirResult = processor.processDirection((dir) => { - switch (dir) { - case exports.Direction.North: return "Going North"; - case exports.Direction.South: return "Going South"; - case exports.Direction.East: return "Going East"; - case exports.Direction.West: return "Going West"; - default: return "Unknown"; - } - }); - assert.equal(dirResult, "Going North"); - - const themeResult = processor.processTheme((theme) => { - return theme === exports.Theme.Dark ? "Dark mode" : "Light mode"; - }); - assert.equal(themeResult, "Dark mode"); - - const statusResult = processor.processHttpStatus((status) => { - return status; - }); - assert.equal(statusResult, exports.HttpStatus.Ok); - - const apiResult = processor.processAPIResult((result) => { - if (result.tag === exports.APIResult.Tag.Success) { - return `API Success: ${result.param0}`; - } - return "API Other"; - }); - assert.equal(apiResult, "API Success: test"); - - const dirChecker = processor.makeDirectionChecker(); - assert.equal(dirChecker(exports.Direction.North), true); - assert.equal(dirChecker(exports.Direction.South), true); - assert.equal(dirChecker(exports.Direction.East), false); - assert.equal(dirChecker(exports.Direction.West), false); - - const themeValidator = processor.makeThemeValidator(); - assert.equal(themeValidator(exports.Theme.Dark), true); - assert.equal(themeValidator(exports.Theme.Light), false); - assert.equal(themeValidator(exports.Theme.Auto), false); - - const statusExtractor = processor.makeStatusCodeExtractor(); - assert.equal(statusExtractor(exports.HttpStatus.Ok), 200); - assert.equal(statusExtractor(exports.HttpStatus.NotFound), 404); - assert.equal(statusExtractor(exports.HttpStatus.ServerError), 500); - assert.equal(statusExtractor(exports.HttpStatus.Unknown), -1); - - const apiHandler = processor.makeAPIResultHandler(); - assert.equal(apiHandler({ tag: exports.APIResult.Tag.Success, param0: "done" }), "Success: done"); - assert.equal(apiHandler({ tag: exports.APIResult.Tag.Failure, param0: 500 }), "Failure: 500"); - assert.equal(apiHandler({ tag: exports.APIResult.Tag.Info }), "Info"); - assert.equal(apiHandler({ tag: exports.APIResult.Tag.Flag, param0: true }), "Flag: true"); - assert.equal(apiHandler({ tag: exports.APIResult.Tag.Rate, param0: 1.5 }), "Rate: 1.5"); - assert.equal(apiHandler({ tag: exports.APIResult.Tag.Precise, param0: 3.14159 }), "Precise: 3.14159"); - - const optDirResult = processor.processOptionalDirection((dir) => { - return dir !== null ? `Dir: ${dir}` : "Dir: null"; - }); - assert.equal(optDirResult, `Dir: ${exports.Direction.North} | Dir: null`); - - const optThemeResult = processor.processOptionalTheme((theme) => { - return theme !== null ? `Theme: ${theme}` : "Theme: null"; - }); - assert.equal(optThemeResult, `Theme: ${exports.Theme.Light} | Theme: null`); - - const optApiResult = processor.processOptionalAPIResult((result) => { - if (result === null) return "Result: null"; - if (result.tag === exports.APIResult.Tag.Success) { - return `Result: Success(${result.param0})`; - } - return "Result: other"; - }); - assert.equal(optApiResult, "Result: Success(ok) | Result: null"); - - const optDirFormatter = processor.makeOptionalDirectionFormatter(); - assert.equal(optDirFormatter(exports.Direction.North), "N"); - assert.equal(optDirFormatter(exports.Direction.South), "S"); - assert.equal(optDirFormatter(exports.Direction.East), "E"); - assert.equal(optDirFormatter(exports.Direction.West), "W"); - assert.equal(optDirFormatter(null), "nil"); - - processor.release(); -} /** @param {import('./../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ function testStructSupport(exports) { From 18339d39239438e36cf5419625f346dc4ed92004 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 6 Feb 2026 18:20:32 +0100 Subject: [PATCH 172/252] BridgeJS: Always provide swift_js_closure_unregister intrinsic in generated bridge-js.js --- Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift | 5 +++++ .../__Snapshots__/BridgeJSLinkTests/ArrayTypes.js | 1 + .../__Snapshots__/BridgeJSLinkTests/Async.js | 1 + .../__Snapshots__/BridgeJSLinkTests/DefaultParameters.js | 1 + .../__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js | 1 + .../__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js | 1 + .../__Snapshots__/BridgeJSLinkTests/EnumCase.js | 1 + .../__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js | 1 + .../__Snapshots__/BridgeJSLinkTests/EnumNamespace.js | 1 + .../__Snapshots__/BridgeJSLinkTests/EnumRawType.js | 1 + .../__Snapshots__/BridgeJSLinkTests/GlobalGetter.js | 1 + .../__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js | 1 + .../__Snapshots__/BridgeJSLinkTests/ImportArray.js | 1 + .../BridgeJSLinkTests/ImportedTypeInExportedInterface.js | 1 + .../__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js | 1 + .../__Snapshots__/BridgeJSLinkTests/JSClass.js | 1 + .../BridgeJSLinkTests/JSClassStaticFunctions.js | 1 + .../__Snapshots__/BridgeJSLinkTests/JSValue.js | 1 + .../__Snapshots__/BridgeJSLinkTests/MixedGlobal.js | 1 + .../__Snapshots__/BridgeJSLinkTests/MixedModules.js | 1 + .../__Snapshots__/BridgeJSLinkTests/MixedPrivate.js | 1 + .../__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js | 1 + .../__Snapshots__/BridgeJSLinkTests/Namespaces.js | 1 + .../__Snapshots__/BridgeJSLinkTests/Optionals.js | 1 + .../__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js | 1 + .../__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js | 1 + .../__Snapshots__/BridgeJSLinkTests/PropertyTypes.js | 1 + .../__Snapshots__/BridgeJSLinkTests/Protocol.js | 1 + .../BridgeJSLinkTests/StaticFunctions.Global.js | 1 + .../__Snapshots__/BridgeJSLinkTests/StaticFunctions.js | 1 + .../BridgeJSLinkTests/StaticProperties.Global.js | 1 + .../__Snapshots__/BridgeJSLinkTests/StaticProperties.js | 1 + .../__Snapshots__/BridgeJSLinkTests/StringParameter.js | 1 + .../__Snapshots__/BridgeJSLinkTests/StringReturn.js | 1 + .../__Snapshots__/BridgeJSLinkTests/SwiftClass.js | 1 + .../__Snapshots__/BridgeJSLinkTests/SwiftClosure.js | 1 + .../__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js | 1 + .../__Snapshots__/BridgeJSLinkTests/SwiftStruct.js | 1 + .../__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js | 1 + .../__Snapshots__/BridgeJSLinkTests/Throws.js | 1 + .../__Snapshots__/BridgeJSLinkTests/UnsafePointer.js | 1 + .../BridgeJSLinkTests/VoidParameterVoidReturn.js | 1 + 42 files changed, 46 insertions(+) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 1be1f4966..13ea4e910 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -602,6 +602,11 @@ public struct BridgeJSLink { printer.write("return pointer || 0;") } printer.write("}") + // Always provide swift_js_closure_unregister as a no-op by default. + // The @_extern(wasm) declaration in BridgeJSIntrinsics.swift is unconditional, + // so the WASM binary always imports this symbol. When closures ARE used, + // the real implementation below will override this no-op. + printer.write("bjs[\"swift_js_closure_unregister\"] = function(funcRef) {}") for unified in skeletons { let moduleName = unified.moduleName diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 5b8c451e2..d858d8e38 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -236,6 +236,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js index 40ff4884a..0f4dce413 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js @@ -197,6 +197,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index c7b1dc093..079618bbf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -272,6 +272,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index 5453ec525..54f00021d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -198,6 +198,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index f04b464c6..18c6999c1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -1054,6 +1054,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js index 0c8eee729..6ed445811 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js @@ -221,6 +221,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index 28cfe9dd9..55f995024 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -241,6 +241,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index a933ed735..179712fef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -222,6 +222,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index 06ebbe269..0855f11ec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -273,6 +273,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_takesFeatureFlag"] = function bjs_takesFeatureFlag(flag) { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js index 97f34b1bb..c9ccf98fe 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js @@ -198,6 +198,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_console_get"] = function bjs_console_get() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js index bc186d4c1..947ee4d11 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js @@ -197,6 +197,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_console_get"] = function bjs_console_get() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js index 3a04c5308..6c56cce6f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js @@ -198,6 +198,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_roundtrip"] = function bjs_roundtrip() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index 4f3fa39a6..b0674f388 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -273,6 +273,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_Foo_init"] = function bjs_Foo_init() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js index d3514253a..9ac03ee73 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js @@ -198,6 +198,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_createWeirdObject"] = function bjs_createWeirdObject() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js index 2bbddd396..6e9100b11 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js @@ -198,6 +198,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_returnAnimatable"] = function bjs_returnAnimatable() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index c05e4e114..b466d0900 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -198,6 +198,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_StaticBox_create_static"] = function bjs_StaticBox_create_static(value) { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index 754a17e3c..888a11a4c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -287,6 +287,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index d9521754f..7bb3c14d6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -197,6 +197,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index 907e955b1..ac2270b9f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -197,6 +197,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: GlobalModule if (!importObject["GlobalModule"]) { importObject["GlobalModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index cbeae41d8..3205ef5d0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -197,6 +197,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index 92aeeae95..ed8f6db8b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -197,6 +197,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index e2f425455..c148f0761 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -197,6 +197,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 923a1f354..b69033543 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -198,6 +198,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js index e148b94ac..11a199b71 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js @@ -198,6 +198,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_check"] = function bjs_check(a, b) { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js index b803936d0..bb1e7ad40 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js @@ -198,6 +198,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_checkNumber"] = function bjs_checkNumber() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index 916d5e1b5..4e8e86821 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -197,6 +197,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index ee1a2345c..57587d84a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -260,6 +260,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index d07af4cdb..fcf19c54f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -247,6 +247,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index 63c5c964b..5e82061d9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -247,6 +247,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index c1d59bf69..ad44e80fa 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -202,6 +202,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index f086f2919..fb43d426b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -202,6 +202,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js index 20ea91e3c..1ee9f519e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js @@ -198,6 +198,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_checkString"] = function bjs_checkString(a) { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js index 0f002bf31..02833d1c6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js @@ -198,6 +198,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_checkString"] = function bjs_checkString() { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index ee4333f03..6002d190f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -197,6 +197,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index a6966ae40..38c248cae 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -323,6 +323,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} bjs["swift_js_closure_unregister"] = function(funcRef) { const func = swift.memory.getObject(funcRef); func.__unregister(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index c61b71313..57b34d426 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -223,6 +223,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} bjs["swift_js_closure_unregister"] = function(funcRef) { const func = swift.memory.getObject(funcRef); func.__unregister(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index b4cf995cb..3f42f3103 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -532,6 +532,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { importObject["TestModule"] = {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index 959572255..751b28959 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -223,6 +223,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_translate"] = function bjs_translate(point, dx, dy) { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js index 487645d70..50276543c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js @@ -197,6 +197,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index dc478a642..29474892f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -228,6 +228,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} }, setInstance: (i) => { instance = i; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js index 428c422e0..de17f5edc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js @@ -198,6 +198,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } + bjs["swift_js_closure_unregister"] = function(funcRef) {} const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; TestModule["bjs_check"] = function bjs_check() { try { From 180c0100c8ab7a6d18783bdab29892e4b33c0c0f Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sun, 8 Feb 2026 12:44:51 +0900 Subject: [PATCH 173/252] BridgeJS: show unified diff on snapshot mismatch (#600) --- .../BridgeJSToolTests/SnapshotTesting.swift | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/SnapshotTesting.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/SnapshotTesting.swift index ce7066a6d..de7ebd0c3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/SnapshotTesting.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/SnapshotTesting.swift @@ -22,17 +22,26 @@ func assertSnapshot( if FileManager.default.fileExists(atPath: snapshotPath.path) { let existingSnapshot = try String(contentsOf: snapshotPath, encoding: .utf8) - let ok = existingSnapshot == String(data: input, encoding: .utf8)! + let actual = String(data: input, encoding: .utf8)! + let ok = existingSnapshot == actual let actualFilePath = snapshotPath.path + ".actual" let updateSnapshots = ProcessInfo.processInfo.environment["UPDATE_SNAPSHOTS"] != nil - func buildComment() -> Comment { - "Snapshot mismatch: \(actualFilePath) \(snapshotPath.path)" - } + if !updateSnapshots { - #expect(ok, buildComment(), sourceLocation: sourceLocation) if !ok { - try input.write(to: URL(fileURLWithPath: actualFilePath)) + try actual.write(toFile: actualFilePath, atomically: true, encoding: .utf8) } + + let diff = ok ? nil : unifiedDiff(expectedPath: snapshotPath.path, actualPath: actualFilePath) + func buildComment() -> Comment { + var message = "Snapshot mismatch: \(actualFilePath) \(snapshotPath.path)" + if let diff { + message.append("\n\n" + diff) + } + return Comment(rawValue: message) + } + + #expect(ok, buildComment(), sourceLocation: sourceLocation) } else { try input.write(to: snapshotPath) } @@ -41,3 +50,23 @@ func assertSnapshot( #expect(Bool(false), "Snapshot created at \(snapshotPath.path)", sourceLocation: sourceLocation) } } + +private func unifiedDiff(expectedPath: String, actualPath: String) -> String? { + let process = Process() + process.executableURL = URL(fileURLWithPath: "/usr/bin/env") + process.arguments = ["diff", "-u", expectedPath, actualPath] + let output = Pipe() + process.standardOutput = output + process.standardError = Pipe() + + do { + try process.run() + } catch { + return nil + } + process.waitUntilExit() + + let data = output.fileHandleForReading.readDataToEndOfFile() + guard !data.isEmpty else { return nil } + return String(data: data, encoding: .utf8) +} From 6d103abc6438505220c45829fb6d48c12aa180fa Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 08:54:16 +0900 Subject: [PATCH 174/252] [NFC] BridgeJS: Cover more types in closure snapshot tests (#602) --- .../Inputs/MacroSwift/SwiftClosure.swift | 53 +- .../BridgeJSCodegenTests/SwiftClosure.json | 2192 +++++++++++------ .../BridgeJSCodegenTests/SwiftClosure.swift | 1111 ++++++--- .../BridgeJSLinkTests/SwiftClosure.d.ts | 38 +- .../BridgeJSLinkTests/SwiftClosure.js | 745 +++--- 5 files changed, 2729 insertions(+), 1410 deletions(-) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClosure.swift index 129f53b50..791b1b7a9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClosure.swift @@ -9,41 +9,34 @@ import JavaScriptKit } @JS class TestProcessor { - private var transform: (String) -> String - - @JS init(transform: @escaping (String) -> String) { - self.transform = transform - } - - @JS func getTransform() -> (String) -> String - - @JS func processWithCustom(_ text: String, customTransform: (String) -> String) -> String + @JS init(transform: @escaping (String) -> String) {} +} - @JS func printTogether( - person: Person, - name: String, - ratio: Double, - customTransform: (Person?, String?, Double?) -> String - ) -> String +@JS func roundtripString(_ stringClosure: (String) -> String) -> (String) -> String +@JS func roundtripInt(_ intClosure: (Int) -> Int) -> (Int) -> Int +@JS func roundtripBool(_ boolClosure: (Bool) -> Bool) -> (Bool) -> Bool +@JS func roundtripFloat(_ floatClosure: (Float) -> Float) -> (Float) -> Float +@JS func roundtripDouble(_ doubleClosure: (Double) -> Double) -> (Double) -> Double - @JS func roundtrip(_ personClosure: (Person) -> String) -> (Person) -> String - @JS func roundtripOptional(_ personClosure: (Person?) -> String) -> (Person?) -> String +@JS func roundtripOptionalString(_ stringClosure: (String?) -> String?) -> (String?) -> String? +@JS func roundtripOptionalInt(_ intClosure: (Int?) -> Int?) -> (Int?) -> Int? +@JS func roundtripOptionalBool(_ boolClosure: (Bool?) -> Bool?) -> (Bool?) -> Bool? +@JS func roundtripOptionalFloat(_ floatClosure: (Float?) -> Float?) -> (Float?) -> Float? +@JS func roundtripOptionalDouble(_ doubleClosure: (Double?) -> Double?) -> (Double?) -> Double? - @JS func processDirection(_ callback: (Direction) -> String) -> String - @JS func processTheme(_ callback: (Theme) -> String) -> String - @JS func processHttpStatus(_ callback: (HttpStatus) -> Int) -> Int - @JS func processAPIResult(_ callback: (APIResult) -> String) -> String +@JS func roundtripPerson(_ personClosure: (Person) -> Person) -> (Person) -> Person +@JS func roundtripOptionalPerson(_ personClosure: (Person?) -> Person?) -> (Person?) -> Person? - @JS func makeDirectionChecker() -> (Direction) -> Bool - @JS func makeThemeValidator() -> (Theme) -> Bool - @JS func makeStatusCodeExtractor() -> (HttpStatus) -> Int - @JS func makeAPIResultHandler() -> (APIResult) -> String +@JS func roundtripDirection(_ callback: (Direction) -> Direction) -> (Direction) -> Direction +@JS func roundtripTheme(_ callback: (Theme) -> Theme) -> (Theme) -> Theme +@JS func roundtripHttpStatus(_ callback: (HttpStatus) -> HttpStatus) -> (HttpStatus) -> HttpStatus +@JS func roundtripAPIResult(_ callback: (APIResult) -> APIResult) -> (APIResult) -> APIResult - @JS func processOptionalDirection(_ callback: (Direction?) -> String) -> String - @JS func processOptionalTheme(_ callback: (Theme?) -> String) -> String - @JS func processOptionalAPIResult(_ callback: (APIResult?) -> String) -> String - @JS func makeOptionalDirectionFormatter() -> (Direction?) -> String -} +@JS func roundtripOptionalDirection(_ callback: (Direction?) -> Direction?) -> (Direction?) -> Direction? +@JS func roundtripOptionalTheme(_ callback: (Theme?) -> Theme?) -> (Theme?) -> Theme? +@JS func roundtripOptionalHttpStatus(_ callback: (HttpStatus?) -> HttpStatus?) -> (HttpStatus?) -> HttpStatus? +@JS func roundtripOptionalAPIResult(_ callback: (APIResult?) -> APIResult?) -> (APIResult?) -> APIResult? +@JS func roundtripOptionalDirection(_ callback: (Direction?) -> Direction?) -> (Direction?) -> Direction? @JS enum Direction { case north diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json index ee551fa47..11c6cb893 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.json @@ -70,236 +70,239 @@ ] }, "methods" : [ + + ], + "name" : "TestProcessor", + "properties" : [ + + ], + "swiftCallName" : "TestProcessor" + } + ], + "enums" : [ + { + "cases" : [ { - "abiName" : "bjs_TestProcessor_getTransform", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTransform", - "parameters" : [ + "associatedValues" : [ ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSS_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "string" : { + "name" : "north" + }, + { + "associatedValues" : [ - } - } - ], - "returnType" : { - "string" : { + ], + "name" : "south" + }, + { + "associatedValues" : [ - } - } - }, - "useJSTypedClosure" : false - } - } + ], + "name" : "east" }, { - "abiName" : "bjs_TestProcessor_processWithCustom", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processWithCustom", - "parameters" : [ - { - "label" : "_", - "name" : "text", - "type" : { - "string" : { + "associatedValues" : [ - } - } - }, - { - "label" : "customTransform", - "name" : "customTransform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSS_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "string" : { + ], + "name" : "west" + } + ], + "emitStyle" : "const", + "name" : "Direction", + "staticMethods" : [ - } - } - ], - "returnType" : { - "string" : { + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Direction", + "tsFullPath" : "Direction" + }, + { + "cases" : [ + { + "associatedValues" : [ - } - } - }, - "useJSTypedClosure" : false - } - } - } ], - "returnType" : { - "string" : { + "name" : "light", + "rawValue" : "light" + }, + { + "associatedValues" : [ - } - } + ], + "name" : "dark", + "rawValue" : "dark" }, { - "abiName" : "bjs_TestProcessor_printTogether", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "printTogether", - "parameters" : [ + "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" : [ { - "label" : "person", - "name" : "person", "type" : { - "swiftHeapObject" : { - "_0" : "Person" + "string" : { + } } - }, + } + ], + "name" : "success" + }, + { + "associatedValues" : [ { - "label" : "name", - "name" : "name", "type" : { - "string" : { + "int" : { } } - }, + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ { - "label" : "ratio", - "name" : "ratio", "type" : { - "double" : { + "bool" : { } } - }, + } + ], + "name" : "flag" + }, + { + "associatedValues" : [ { - "label" : "customTransform", - "name" : "customTransform", "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSq6PersonCSqSSSqSd_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Person" - } - }, - "_1" : "null" - } - }, - { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - }, - { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "string" : { + "float" : { - } - } - }, - "useJSTypedClosure" : false } } } ], - "returnType" : { - "string" : { - - } - } + "name" : "rate" }, { - "abiName" : "bjs_TestProcessor_roundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtrip", - "parameters" : [ + "associatedValues" : [ { - "label" : "_", - "name" : "personClosure", "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule6PersonC_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "swiftHeapObject" : { - "_0" : "Person" - } - } - ], - "returnType" : { - "string" : { + "double" : { - } - } - }, - "useJSTypedClosure" : false } } } ], - "returnType" : { + "name" : "precise" + }, + { + "associatedValues" : [ + + ], + "name" : "info" + } + ], + "emitStyle" : "const", + "name" : "APIResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "APIResult", + "tsFullPath" : "APIResult" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_roundtripString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripString", + "parameters" : [ + { + "label" : "_", + "name" : "stringClosure", + "type" : { "closure" : { "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "10TestModule6PersonC_SS", + "mangleName" : "10TestModuleSS_SS", "moduleName" : "TestModule", "parameters" : [ { - "swiftHeapObject" : { - "_0" : "Person" + "string" : { + } } ], @@ -312,70 +315,60 @@ "useJSTypedClosure" : false } } - }, - { - "abiName" : "bjs_TestProcessor_roundtripOptional", - "effects" : { + } + ], + "returnType" : { + "closure" : { + "_0" : { "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripOptional", - "parameters" : [ - { - "label" : "_", - "name" : "personClosure", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSq6PersonC_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Person" - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "string" : { + "isThrows" : false, + "mangleName" : "10TestModuleSS_SS", + "moduleName" : "TestModule", + "parameters" : [ + { + "string" : { - } - } - }, - "useJSTypedClosure" : false } } + ], + "returnType" : { + "string" : { + + } } - ], - "returnType" : { + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripInt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripInt", + "parameters" : [ + { + "label" : "_", + "name" : "intClosure", + "type" : { "closure" : { "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "10TestModuleSq6PersonC_SS", + "mangleName" : "10TestModuleSi_Si", "moduleName" : "TestModule", "parameters" : [ { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Person" - } - }, - "_1" : "null" + "int" : { + } } ], "returnType" : { - "string" : { + "int" : { } } @@ -383,208 +376,121 @@ "useJSTypedClosure" : false } } - }, - { - "abiName" : "bjs_TestProcessor_processDirection", - "effects" : { + } + ], + "returnType" : { + "closure" : { + "_0" : { "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processDirection", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule9DirectionO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "caseEnum" : { - "_0" : "Direction" - } - } - ], - "returnType" : { - "string" : { + "isThrows" : false, + "mangleName" : "10TestModuleSi_Si", + "moduleName" : "TestModule", + "parameters" : [ + { + "int" : { - } - } - }, - "useJSTypedClosure" : false } } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TestProcessor_processTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processTheme", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule5ThemeO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - ], - "returnType" : { - "string" : { + ], + "returnType" : { + "int" : { - } - } - }, - "useJSTypedClosure" : false - } } } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TestProcessor_processHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false }, - "name" : "processHttpStatus", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule10HttpStatusO_Si", - "moduleName" : "TestModule", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - ], - "returnType" : { - "int" : { + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripBool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripBool", + "parameters" : [ + { + "label" : "_", + "name" : "boolClosure", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSb_Sb", + "moduleName" : "TestModule", + "parameters" : [ + { + "bool" : { - } } - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "int" : { + } + ], + "returnType" : { + "bool" : { + } + } + }, + "useJSTypedClosure" : false } } - }, - { - "abiName" : "bjs_TestProcessor_processAPIResult", - "effects" : { + } + ], + "returnType" : { + "closure" : { + "_0" : { "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModule9APIResultO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - ], - "returnType" : { - "string" : { + "isThrows" : false, + "mangleName" : "10TestModuleSb_Sb", + "moduleName" : "TestModule", + "parameters" : [ + { + "bool" : { - } - } - }, - "useJSTypedClosure" : false } } - } - ], - "returnType" : { - "string" : { + ], + "returnType" : { + "bool" : { + } } - } - }, - { - "abiName" : "bjs_TestProcessor_makeDirectionChecker", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false }, - "name" : "makeDirectionChecker", - "parameters" : [ - - ], - "returnType" : { + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripFloat", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripFloat", + "parameters" : [ + { + "label" : "_", + "name" : "floatClosure", + "type" : { "closure" : { "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "10TestModule9DirectionO_Sb", + "mangleName" : "10TestModuleSf_Sf", "moduleName" : "TestModule", "parameters" : [ { - "caseEnum" : { - "_0" : "Direction" + "float" : { + } } ], "returnType" : { - "bool" : { + "float" : { } } @@ -592,35 +498,60 @@ "useJSTypedClosure" : false } } - }, - { - "abiName" : "bjs_TestProcessor_makeThemeValidator", - "effects" : { + } + ], + "returnType" : { + "closure" : { + "_0" : { "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeThemeValidator", - "parameters" : [ + "isThrows" : false, + "mangleName" : "10TestModuleSf_Sf", + "moduleName" : "TestModule", + "parameters" : [ + { + "float" : { - ], - "returnType" : { + } + } + ], + "returnType" : { + "float" : { + + } + } + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripDouble", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripDouble", + "parameters" : [ + { + "label" : "_", + "name" : "doubleClosure", + "type" : { "closure" : { "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "10TestModule5ThemeO_Sb", + "mangleName" : "10TestModuleSd_Sd", "moduleName" : "TestModule", "parameters" : [ { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" + "double" : { + } } ], "returnType" : { - "bool" : { + "double" : { } } @@ -628,247 +559,300 @@ "useJSTypedClosure" : false } } - }, - { - "abiName" : "bjs_TestProcessor_makeStatusCodeExtractor", - "effects" : { + } + ], + "returnType" : { + "closure" : { + "_0" : { "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeStatusCodeExtractor", - "parameters" : [ + "isThrows" : false, + "mangleName" : "10TestModuleSd_Sd", + "moduleName" : "TestModule", + "parameters" : [ + { + "double" : { - ], - "returnType" : { + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripOptionalString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalString", + "parameters" : [ + { + "label" : "_", + "name" : "stringClosure", + "type" : { "closure" : { "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "10TestModule10HttpStatusO_Si", + "mangleName" : "10TestModuleSqSS_SqSS", "moduleName" : "TestModule", "parameters" : [ { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" } } ], "returnType" : { - "int" : { + "nullable" : { + "_0" : { + "string" : { + } + }, + "_1" : "null" } } }, "useJSTypedClosure" : false } } - }, - { - "abiName" : "bjs_TestProcessor_makeAPIResultHandler", - "effects" : { + } + ], + "returnType" : { + "closure" : { + "_0" : { "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultHandler", - "parameters" : [ + "isThrows" : false, + "mangleName" : "10TestModuleSqSS_SqSS", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "string" : { - ], - "returnType" : { + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripOptionalInt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalInt", + "parameters" : [ + { + "label" : "_", + "name" : "intClosure", + "type" : { "closure" : { "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "10TestModule9APIResultO_SS", + "mangleName" : "10TestModuleSqSi_SqSi", "moduleName" : "TestModule", "parameters" : [ { - "associatedValueEnum" : { - "_0" : "APIResult" + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" } } ], "returnType" : { - "string" : { + "nullable" : { + "_0" : { + "int" : { + } + }, + "_1" : "null" } } }, "useJSTypedClosure" : false } } - }, - { - "abiName" : "bjs_TestProcessor_processOptionalDirection", - "effects" : { + } + ], + "returnType" : { + "closure" : { + "_0" : { "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalDirection", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { + "isThrows" : false, + "mangleName" : "10TestModuleSqSi_SqSi", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSq9DirectionO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "string" : { + "int" : { - } } }, - "useJSTypedClosure" : false + "_1" : "null" } } - } - ], - "returnType" : { - "string" : { + ], + "returnType" : { + "nullable" : { + "_0" : { + "int" : { + } + }, + "_1" : "null" + } } - } - }, - { - "abiName" : "bjs_TestProcessor_processOptionalTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false }, - "name" : "processOptionalTheme", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSq5ThemeO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripOptionalBool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalBool", + "parameters" : [ + { + "label" : "_", + "name" : "boolClosure", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSqSb_SqSb", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "bool" : { + } - } - ], - "returnType" : { - "string" : { + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "bool" : { } - } - }, - "useJSTypedClosure" : false + }, + "_1" : "null" + } } - } - } - ], - "returnType" : { - "string" : { - + }, + "useJSTypedClosure" : false } } - }, - { - "abiName" : "bjs_TestProcessor_processOptionalAPIResult", - "effects" : { + } + ], + "returnType" : { + "closure" : { + "_0" : { "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { + "isThrows" : false, + "mangleName" : "10TestModuleSqSb_SqSb", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "10TestModuleSq9APIResultO_SS", - "moduleName" : "TestModule", - "parameters" : [ - { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "string" : { + "bool" : { - } } }, - "useJSTypedClosure" : false + "_1" : "null" } } - } - ], - "returnType" : { - "string" : { + ], + "returnType" : { + "nullable" : { + "_0" : { + "bool" : { + } + }, + "_1" : "null" + } } - } - }, - { - "abiName" : "bjs_TestProcessor_makeOptionalDirectionFormatter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false }, - "name" : "makeOptionalDirectionFormatter", - "parameters" : [ - - ], - "returnType" : { + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripOptionalFloat", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalFloat", + "parameters" : [ + { + "label" : "_", + "name" : "floatClosure", + "type" : { "closure" : { "_0" : { "isAsync" : false, "isThrows" : false, - "mangleName" : "10TestModuleSq9DirectionO_SS", + "mangleName" : "10TestModuleSqSf_SqSf", "moduleName" : "TestModule", "parameters" : [ { "nullable" : { "_0" : { - "caseEnum" : { - "_0" : "Direction" + "float" : { + } }, "_1" : "null" @@ -876,8 +860,13 @@ } ], "returnType" : { - "string" : { + "nullable" : { + "_0" : { + "float" : { + } + }, + "_1" : "null" } } }, @@ -886,215 +875,928 @@ } } ], - "name" : "TestProcessor", - "properties" : [ - - ], - "swiftCallName" : "TestProcessor" - } - ], - "enums" : [ - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "north" - }, - { - "associatedValues" : [ - - ], - "name" : "south" - }, - { - "associatedValues" : [ + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSqSf_SqSf", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "float" : { - ], - "name" : "east" - }, - { - "associatedValues" : [ + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "float" : { - ], - "name" : "west" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false } - ], - "emitStyle" : "const", - "name" : "Direction", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Direction", - "tsFullPath" : "Direction" + } }, { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "light", - "rawValue" : "light" - }, + "abiName" : "bjs_roundtripOptionalDouble", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalDouble", + "parameters" : [ { - "associatedValues" : [ + "label" : "_", + "name" : "doubleClosure", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSqSd_SqSd", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "double" : { - ], - "name" : "dark", - "rawValue" : "dark" - }, - { - "associatedValues" : [ + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "double" : { - ], - "name" : "auto", - "rawValue" : "auto" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } } ], - "emitStyle" : "const", - "name" : "Theme", - "rawType" : "String", - "staticMethods" : [ + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSqSd_SqSd", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "double" : { - ], - "staticProperties" : [ + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "double" : { - ], - "swiftCallName" : "Theme", - "tsFullPath" : "Theme" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } }, { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "ok", - "rawValue" : "200" - }, - { - "associatedValues" : [ - - ], - "name" : "notFound", - "rawValue" : "404" - }, - { - "associatedValues" : [ - - ], - "name" : "serverError", - "rawValue" : "500" - }, + "abiName" : "bjs_roundtripPerson", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripPerson", + "parameters" : [ { - "associatedValues" : [ - - ], - "name" : "unknown", - "rawValue" : "-1" + "label" : "_", + "name" : "personClosure", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule6PersonC_6PersonC", + "moduleName" : "TestModule", + "parameters" : [ + { + "swiftHeapObject" : { + "_0" : "Person" + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Person" + } + } + }, + "useJSTypedClosure" : false + } + } } ], - "emitStyle" : "const", - "name" : "HttpStatus", - "rawType" : "Int", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "HttpStatus", - "tsFullPath" : "HttpStatus" + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule6PersonC_6PersonC", + "moduleName" : "TestModule", + "parameters" : [ + { + "swiftHeapObject" : { + "_0" : "Person" + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Person" + } + } + }, + "useJSTypedClosure" : false + } + } }, { - "cases" : [ + "abiName" : "bjs_roundtripOptionalPerson", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalPerson", + "parameters" : [ { - "associatedValues" : [ - { - "type" : { - "string" : { - + "label" : "_", + "name" : "personClosure", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq6PersonC_Sq6PersonC", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Person" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Person" + } + }, + "_1" : "null" + } } + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq6PersonC_Sq6PersonC", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Person" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Person" + } + }, + "_1" : "null" } } - ], - "name" : "success" - }, + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripDirection", + "parameters" : [ { - "associatedValues" : [ - { - "type" : { - "int" : { - + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule9DirectionO_9DirectionO", + "moduleName" : "TestModule", + "parameters" : [ + { + "caseEnum" : { + "_0" : "Direction" + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Direction" + } } + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule9DirectionO_9DirectionO", + "moduleName" : "TestModule", + "parameters" : [ + { + "caseEnum" : { + "_0" : "Direction" + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Direction" } } - ], - "name" : "failure" - }, + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripTheme", + "parameters" : [ { - "associatedValues" : [ - { - "type" : { - "bool" : { - + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule5ThemeO_5ThemeO", + "moduleName" : "TestModule", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule5ThemeO_5ThemeO", + "moduleName" : "TestModule", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" } } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } } - ], - "name" : "flag" - }, + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripHttpStatus", + "parameters" : [ { - "associatedValues" : [ - { - "type" : { - "float" : { - + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule10HttpStatusO_10HttpStatusO", + "moduleName" : "TestModule", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule10HttpStatusO_10HttpStatusO", + "moduleName" : "TestModule", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" } } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } } - ], - "name" : "rate" - }, + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripAPIResult", + "parameters" : [ { - "associatedValues" : [ - { - "type" : { - "double" : { - + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule9APIResultO_9APIResultO", + "moduleName" : "TestModule", + "parameters" : [ + { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } } + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModule9APIResultO_9APIResultO", + "moduleName" : "TestModule", + "parameters" : [ + { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" } } - ], - "name" : "precise" - }, + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripOptionalDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalDirection", + "parameters" : [ { - "associatedValues" : [ - - ], - "name" : "info" + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq9DirectionO_Sq9DirectionO", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } } ], - "emitStyle" : "const", - "name" : "APIResult", - "staticMethods" : [ - + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq9DirectionO_Sq9DirectionO", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripOptionalTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalTheme", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq5ThemeO_Sq5ThemeO", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } + } ], - "staticProperties" : [ - + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq5ThemeO_Sq5ThemeO", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripOptionalHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq10HttpStatusO_Sq10HttpStatusO", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } + } ], - "swiftCallName" : "APIResult", - "tsFullPath" : "APIResult" + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq10HttpStatusO_Sq10HttpStatusO", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripOptionalAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq9APIResultO_Sq9APIResultO", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq9APIResultO_Sq9APIResultO", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_roundtripOptionalDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripOptionalDirection", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq9DirectionO_Sq9DirectionO", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "10TestModuleSq9DirectionO_Sq9DirectionO", + "moduleName" : "TestModule", + "parameters" : [ + { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + }, + "useJSTypedClosure" : false + } + } } - ], - "exposeToGlobal" : false, - "functions" : [ - ], "protocols" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift index e659988d1..8aa9efd65 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift @@ -1,30 +1,30 @@ #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si") -fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si(_ callback: Int32, _ param0: Int32) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO") +fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule10HttpStatusO_Si") -fileprivate func make_swift_closure_TestModule_10TestModule10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO") +fileprivate func make_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModule10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private enum _BJS_Closure_10TestModule10HttpStatusO_Si { - static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> Int { +private enum _BJS_Closure_10TestModule10HttpStatusO_10HttpStatusO { + static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> HttpStatus { 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_TestModule_10TestModule10HttpStatusO_Si(callbackValue, param0Value) - return Int.bridgeJSLiftReturn(ret) + let ret = invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO(callbackValue, param0Value) + return HttpStatus.bridgeJSLiftReturn(ret) #else fatalError("Only available on WebAssembly") #endif @@ -32,10 +32,10 @@ private enum _BJS_Closure_10TestModule10HttpStatusO_Si { } } -extension JSTypedClosure where Signature == (HttpStatus) -> Int { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (HttpStatus) -> Int) { +extension JSTypedClosure where Signature == (HttpStatus) -> HttpStatus { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (HttpStatus) -> HttpStatus) { self.init( - makeClosure: make_swift_closure_TestModule_10TestModule10HttpStatusO_Si, + makeClosure: make_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO, body: body, fileID: fileID, line: line @@ -43,11 +43,11 @@ extension JSTypedClosure where Signature == (HttpStatus) -> Int { } } -@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si") -@_cdecl("invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si") -public func _invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO") +@_cdecl("invoke_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO") +public func _invoke_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(HttpStatus) -> Int>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let closure = Unmanaged<_BridgeJSTypedClosureBox<(HttpStatus) -> HttpStatus>>.fromOpaque(boxPtr).takeUnretainedValue().closure let result = closure(HttpStatus.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else @@ -56,32 +56,32 @@ public func _invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si(_ boxP } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule5ThemeO_SS") -fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_SS(_ callback: Int32, _ param0: Int32) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO") +fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule5ThemeO_SS") -fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO") +fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private enum _BJS_Closure_10TestModule5ThemeO_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> String { +private enum _BJS_Closure_10TestModule5ThemeO_5ThemeO { + static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Theme { 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_TestModule_10TestModule5ThemeO_SS(callbackValue, param0Value) - return String.bridgeJSLiftReturn(ret) + let ret = invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO(callbackValue, param0Value) + return Theme.bridgeJSLiftReturn(ret) #else fatalError("Only available on WebAssembly") #endif @@ -89,10 +89,10 @@ private enum _BJS_Closure_10TestModule5ThemeO_SS { } } -extension JSTypedClosure where Signature == (Theme) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Theme) -> String) { +extension JSTypedClosure where Signature == (Theme) -> Theme { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Theme) -> Theme) { self.init( - makeClosure: make_swift_closure_TestModule_10TestModule5ThemeO_SS, + makeClosure: make_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO, body: body, fileID: fileID, line: line @@ -100,11 +100,11 @@ extension JSTypedClosure where Signature == (Theme) -> String { } } -@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule5ThemeO_SS") -@_cdecl("invoke_swift_closure_TestModule_10TestModule5ThemeO_SS") -public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO") +@_cdecl("invoke_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO") +public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Theme) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Theme) -> Theme>>.fromOpaque(boxPtr).takeUnretainedValue().closure let result = closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) return result.bridgeJSLowerReturn() #else @@ -113,32 +113,32 @@ public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_SS(_ boxPtr: Un } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule5ThemeO_Sb") -fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC") +fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer #else -fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule5ThemeO_Sb") -fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule6PersonC_6PersonC") +fileprivate func make_swift_closure_TestModule_10TestModule6PersonC_6PersonC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModule6PersonC_6PersonC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private enum _BJS_Closure_10TestModule5ThemeO_Sb { - static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Bool { +private enum _BJS_Closure_10TestModule6PersonC_6PersonC { + static func bridgeJSLift(_ callbackId: Int32) -> (Person) -> Person { 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_TestModule_10TestModule5ThemeO_Sb(callbackValue, param0Value) - return Bool.bridgeJSLiftReturn(ret) + let param0Pointer = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC(callbackValue, param0Pointer) + return Person.bridgeJSLiftReturn(ret) #else fatalError("Only available on WebAssembly") #endif @@ -146,10 +146,10 @@ private enum _BJS_Closure_10TestModule5ThemeO_Sb { } } -extension JSTypedClosure where Signature == (Theme) -> Bool { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Theme) -> Bool) { +extension JSTypedClosure where Signature == (Person) -> Person { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Person) -> Person) { self.init( - makeClosure: make_swift_closure_TestModule_10TestModule5ThemeO_Sb, + makeClosure: make_swift_closure_TestModule_10TestModule6PersonC_6PersonC, body: body, fileID: fileID, line: line @@ -157,12 +157,12 @@ extension JSTypedClosure where Signature == (Theme) -> Bool { } } -@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb") -@_cdecl("invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb") -public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule6PersonC_6PersonC") +@_cdecl("invoke_swift_closure_TestModule_10TestModule6PersonC_6PersonC") +public func _invoke_swift_closure_TestModule_10TestModule6PersonC_6PersonC(_ boxPtr: UnsafeMutableRawPointer, _ param0: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Theme) -> Bool>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Person) -> Person>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Person.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -170,32 +170,32 @@ public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb(_ boxPtr: Un } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule6PersonC_SS") -fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_SS(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO") +fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_SS(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule6PersonC_SS") -fileprivate func make_swift_closure_TestModule_10TestModule6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO") +fileprivate func make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModule6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private enum _BJS_Closure_10TestModule6PersonC_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Person) -> String { +private enum _BJS_Closure_10TestModule9APIResultO_9APIResultO { + static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> APIResult { 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_TestModule_10TestModule6PersonC_SS(callbackValue, param0Pointer) - return String.bridgeJSLiftReturn(ret) + let param0CaseId = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO(callbackValue, param0CaseId) + return APIResult.bridgeJSLiftReturn(ret) #else fatalError("Only available on WebAssembly") #endif @@ -203,10 +203,10 @@ private enum _BJS_Closure_10TestModule6PersonC_SS { } } -extension JSTypedClosure where Signature == (Person) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Person) -> String) { +extension JSTypedClosure where Signature == (APIResult) -> APIResult { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (APIResult) -> APIResult) { self.init( - makeClosure: make_swift_closure_TestModule_10TestModule6PersonC_SS, + makeClosure: make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO, body: body, fileID: fileID, line: line @@ -214,12 +214,12 @@ extension JSTypedClosure where Signature == (Person) -> String { } } -@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule6PersonC_SS") -@_cdecl("invoke_swift_closure_TestModule_10TestModule6PersonC_SS") -public func _invoke_swift_closure_TestModule_10TestModule6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO") +@_cdecl("invoke_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO") +public func _invoke_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Person) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Person.bridgeJSLiftParameter(param0)) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(APIResult) -> APIResult>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(APIResult.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -227,32 +227,32 @@ public func _invoke_swift_closure_TestModule_10TestModule6PersonC_SS(_ boxPtr: U } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9APIResultO_SS") -fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_SS(_ callback: Int32, _ param0: Int32) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO") +fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule9APIResultO_SS") -fileprivate func make_swift_closure_TestModule_10TestModule9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO") +fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModule9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private enum _BJS_Closure_10TestModule9APIResultO_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> String { +private enum _BJS_Closure_10TestModule9DirectionO_9DirectionO { + static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Direction { 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_TestModule_10TestModule9APIResultO_SS(callbackValue, param0CaseId) - return String.bridgeJSLiftReturn(ret) + let param0Value = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO(callbackValue, param0Value) + return Direction.bridgeJSLiftReturn(ret) #else fatalError("Only available on WebAssembly") #endif @@ -260,10 +260,10 @@ private enum _BJS_Closure_10TestModule9APIResultO_SS { } } -extension JSTypedClosure where Signature == (APIResult) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (APIResult) -> String) { +extension JSTypedClosure where Signature == (Direction) -> Direction { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Direction) -> Direction) { self.init( - makeClosure: make_swift_closure_TestModule_10TestModule9APIResultO_SS, + makeClosure: make_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO, body: body, fileID: fileID, line: line @@ -271,12 +271,12 @@ extension JSTypedClosure where Signature == (APIResult) -> String { } } -@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9APIResultO_SS") -@_cdecl("invoke_swift_closure_TestModule_10TestModule9APIResultO_SS") -public func _invoke_swift_closure_TestModule_10TestModule9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO") +@_cdecl("invoke_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO") +public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(APIResult) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(APIResult.bridgeJSLiftParameter(param0)) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Direction) -> Direction>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Direction.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -284,31 +284,31 @@ public func _invoke_swift_closure_TestModule_10TestModule9APIResultO_SS(_ boxPtr } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9DirectionO_SS") -fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_SS(_ callback: Int32, _ param0: Int32) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSS_SS") +fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule9DirectionO_SS") -fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSS_SS") +fileprivate func make_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private enum _BJS_Closure_10TestModule9DirectionO_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> String { +private enum _BJS_Closure_10TestModuleSS_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 param0Value = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_TestModule_10TestModule9DirectionO_SS(callbackValue, param0Value) + let ret = invoke_js_callback_TestModule_10TestModuleSS_SS(callbackValue, param0Value) return String.bridgeJSLiftReturn(ret) #else fatalError("Only available on WebAssembly") @@ -317,10 +317,10 @@ private enum _BJS_Closure_10TestModule9DirectionO_SS { } } -extension JSTypedClosure where Signature == (Direction) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Direction) -> String) { +extension JSTypedClosure where Signature == (String) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (String) -> String) { self.init( - makeClosure: make_swift_closure_TestModule_10TestModule9DirectionO_SS, + makeClosure: make_swift_closure_TestModule_10TestModuleSS_SS, body: body, fileID: fileID, line: line @@ -328,12 +328,12 @@ extension JSTypedClosure where Signature == (Direction) -> String { } } -@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9DirectionO_SS") -@_cdecl("invoke_swift_closure_TestModule_10TestModule9DirectionO_SS") -public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSS_SS") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSS_SS") +public func _invoke_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Direction) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Direction.bridgeJSLiftParameter(param0)) + 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") @@ -341,31 +341,31 @@ public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_SS(_ boxPtr } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9DirectionO_Sb") -fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSb_Sb") +fileprivate func invoke_js_callback_TestModule_10TestModuleSb_Sb(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSb_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule9DirectionO_Sb") -fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSb_Sb") +fileprivate func make_swift_closure_TestModule_10TestModuleSb_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSb_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private enum _BJS_Closure_10TestModule9DirectionO_Sb { - static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Bool { +private enum _BJS_Closure_10TestModuleSb_Sb { + static func bridgeJSLift(_ callbackId: Int32) -> (Bool) -> 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_TestModule_10TestModule9DirectionO_Sb(callbackValue, param0Value) + let ret = invoke_js_callback_TestModule_10TestModuleSb_Sb(callbackValue, param0Value) return Bool.bridgeJSLiftReturn(ret) #else fatalError("Only available on WebAssembly") @@ -374,10 +374,10 @@ private enum _BJS_Closure_10TestModule9DirectionO_Sb { } } -extension JSTypedClosure where Signature == (Direction) -> Bool { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Direction) -> Bool) { +extension JSTypedClosure where Signature == (Bool) -> Bool { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Bool) -> Bool) { self.init( - makeClosure: make_swift_closure_TestModule_10TestModule9DirectionO_Sb, + makeClosure: make_swift_closure_TestModule_10TestModuleSb_Sb, body: body, fileID: fileID, line: line @@ -385,12 +385,12 @@ extension JSTypedClosure where Signature == (Direction) -> Bool { } } -@_expose(wasm, "invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb") -@_cdecl("invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb") -public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSb_Sb") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSb_Sb") +public func _invoke_swift_closure_TestModule_10TestModuleSb_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)) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Bool) -> Bool>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Bool.bridgeJSLiftParameter(param0)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -398,32 +398,32 @@ public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb(_ boxPtr } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSS_SS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSd_Sd") +fileprivate func invoke_js_callback_TestModule_10TestModuleSd_Sd(_ callback: Int32, _ param0: Float64) -> Float64 #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSd_Sd(_ callback: Int32, _ param0: Float64) -> Float64 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSS_SS") -fileprivate func make_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSd_Sd") +fileprivate func make_swift_closure_TestModule_10TestModuleSd_Sd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSd_Sd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private enum _BJS_Closure_10TestModuleSS_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { +private enum _BJS_Closure_10TestModuleSd_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_TestModule_10TestModuleSS_SS(callbackValue, param0Value) - return String.bridgeJSLiftReturn(ret) + let ret = invoke_js_callback_TestModule_10TestModuleSd_Sd(callbackValue, param0Value) + return Double.bridgeJSLiftReturn(ret) #else fatalError("Only available on WebAssembly") #endif @@ -431,10 +431,10 @@ private enum _BJS_Closure_10TestModuleSS_SS { } } -extension JSTypedClosure where Signature == (String) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (String) -> String) { +extension JSTypedClosure where Signature == (Double) -> Double { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Double) -> Double) { self.init( - makeClosure: make_swift_closure_TestModule_10TestModuleSS_SS, + makeClosure: make_swift_closure_TestModule_10TestModuleSd_Sd, body: body, fileID: fileID, line: line @@ -442,12 +442,126 @@ extension JSTypedClosure where Signature == (String) -> String { } } -@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSS_SS") -@_cdecl("invoke_swift_closure_TestModule_10TestModuleSS_SS") -public func _invoke_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSd_Sd") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSd_Sd") +public func _invoke_swift_closure_TestModule_10TestModuleSd_Sd(_ boxPtr: UnsafeMutableRawPointer, _ param0: Float64) -> Float64 { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(String) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) + 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_TestModule_10TestModuleSf_Sf") +fileprivate func invoke_js_callback_TestModule_10TestModuleSf_Sf(_ callback: Int32, _ param0: Float32) -> Float32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModuleSf_Sf(_ callback: Int32, _ param0: Float32) -> Float32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSf_Sf") +fileprivate func make_swift_closure_TestModule_10TestModuleSf_Sf(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSf_Sf(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +private enum _BJS_Closure_10TestModuleSf_Sf { + static func bridgeJSLift(_ callbackId: Int32) -> (Float) -> Float { + 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_TestModule_10TestModuleSf_Sf(callbackValue, param0Value) + return Float.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Float) -> Float { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Float) -> Float) { + self.init( + makeClosure: make_swift_closure_TestModule_10TestModuleSf_Sf, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSf_Sf") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSf_Sf") +public func _invoke_swift_closure_TestModule_10TestModuleSf_Sf(_ boxPtr: UnsafeMutableRawPointer, _ param0: Float32) -> Float32 { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Float) -> Float>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Float.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSi_Si") +fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSi_Si") +fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +private enum _BJS_Closure_10TestModuleSi_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_TestModule_10TestModuleSi_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_TestModule_10TestModuleSi_Si, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSi_Si") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSi_Si") +public func _invoke_swift_closure_TestModule_10TestModuleSi_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") @@ -455,32 +569,32 @@ public func _invoke_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeM } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO") +fileprivate func invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq5ThemeO_SS") -fileprivate func make_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO") +fileprivate func make_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private enum _BJS_Closure_10TestModuleSq5ThemeO_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { +private enum _BJS_Closure_10TestModuleSq10HttpStatusO_Sq10HttpStatusO { + 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, param0Value) = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS(callbackValue, param0IsSome, param0Value) - return String.bridgeJSLiftReturn(ret) + invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(callbackValue, param0IsSome, param0Value) + return Optional.bridgeJSLiftReturnFromSideChannel() #else fatalError("Only available on WebAssembly") #endif @@ -488,10 +602,10 @@ private enum _BJS_Closure_10TestModuleSq5ThemeO_SS { } } -extension JSTypedClosure where Signature == (Optional) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { +extension JSTypedClosure where Signature == (Optional) -> Optional { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> Optional) { self.init( - makeClosure: make_swift_closure_TestModule_10TestModuleSq5ThemeO_SS, + makeClosure: make_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO, body: body, fileID: fileID, line: line @@ -499,12 +613,12 @@ extension JSTypedClosure where Signature == (Optional) -> String { } } -@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS") -@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS") -public func _invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO") +public func _invoke_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(_ 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, param0Bytes, param0Length)) + 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") @@ -512,34 +626,32 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(_ boxPtr: } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer, _ param1IsSome: Int32, _ param1Value: Int32, _ param2IsSome: Int32, _ param2Value: Float64) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO") +fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer, _ param1IsSome: Int32, _ param1Value: Int32, _ param2IsSome: Int32, _ param2Value: Float64) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") -fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO") +fileprivate func make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private enum _BJS_Closure_10TestModuleSq6PersonCSqSSSqSd_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Optional, Optional, Optional) -> String { +private enum _BJS_Closure_10TestModuleSq5ThemeO_Sq5ThemeO { + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0, param1, param2 in + return { [callback] param0 in #if arch(wasm32) let callbackValue = callback.bridgeJSLowerParameter() - let (param0IsSome, param0Pointer) = param0.bridgeJSLowerParameter() - let (param1IsSome, param1Value) = param1.bridgeJSLowerParameter() - let (param2IsSome, param2Value) = param2.bridgeJSLowerParameter() - let ret = invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(callbackValue, param0IsSome, param0Pointer, param1IsSome, param1Value, param2IsSome, param2Value) - return String.bridgeJSLiftReturn(ret) + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameter() + invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(callbackValue, param0IsSome, param0Value) + return Optional.bridgeJSLiftReturnFromSideChannel() #else fatalError("Only available on WebAssembly") #endif @@ -547,10 +659,10 @@ private enum _BJS_Closure_10TestModuleSq6PersonCSqSSSqSd_SS { } } -extension JSTypedClosure where Signature == (Optional, Optional, Optional) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional, Optional, Optional) -> String) { +extension JSTypedClosure where Signature == (Optional) -> Optional { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> Optional) { self.init( - makeClosure: make_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS, + makeClosure: make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO, body: body, fileID: fileID, line: line @@ -558,12 +670,12 @@ extension JSTypedClosure where Signature == (Optional, Optional, } } -@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") -@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS") -public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: UnsafeMutableRawPointer, _ param1IsSome: Int32, _ param1Bytes: Int32, _ param1Length: Int32, _ param2IsSome: Int32, _ param2Value: Float64) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO") +public func _invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional, Optional, Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value), Optional.bridgeJSLiftParameter(param1IsSome, param1Bytes, param1Length), Optional.bridgeJSLiftParameter(param2IsSome, param2Value)) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> Optional>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) return result.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -571,32 +683,32 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(_ } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC") +fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq6PersonC_SS") -fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC") +fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private enum _BJS_Closure_10TestModuleSq6PersonC_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { +private enum _BJS_Closure_10TestModuleSq6PersonC_Sq6PersonC { + 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_TestModule_10TestModuleSq6PersonC_SS(callbackValue, param0IsSome, param0Pointer) - return String.bridgeJSLiftReturn(ret) + let ret = invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC(callbackValue, param0IsSome, param0Pointer) + return Optional.bridgeJSLiftReturn(ret) #else fatalError("Only available on WebAssembly") #endif @@ -604,10 +716,10 @@ private enum _BJS_Closure_10TestModuleSq6PersonC_SS { } } -extension JSTypedClosure where Signature == (Optional) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { +extension JSTypedClosure where Signature == (Optional) -> Optional { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> Optional) { self.init( - makeClosure: make_swift_closure_TestModule_10TestModuleSq6PersonC_SS, + makeClosure: make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC, body: body, fileID: fileID, line: line @@ -615,11 +727,11 @@ extension JSTypedClosure where Signature == (Optional) -> String { } } -@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS") -@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS") -public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC") +public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> Optional>>.fromOpaque(boxPtr).takeUnretainedValue().closure let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) return result.bridgeJSLowerReturn() #else @@ -628,32 +740,32 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS(_ boxPtr: } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO") +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq9APIResultO_SS") -fileprivate func make_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO") +fileprivate func make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private enum _BJS_Closure_10TestModuleSq9APIResultO_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { +private enum _BJS_Closure_10TestModuleSq9APIResultO_Sq9APIResultO { + 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, param0CaseId) = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS(callbackValue, param0IsSome, param0CaseId) - return String.bridgeJSLiftReturn(ret) + let ret = invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(callbackValue, param0IsSome, param0CaseId) + return Optional.bridgeJSLiftReturn(ret) #else fatalError("Only available on WebAssembly") #endif @@ -661,10 +773,10 @@ private enum _BJS_Closure_10TestModuleSq9APIResultO_SS { } } -extension JSTypedClosure where Signature == (Optional) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { +extension JSTypedClosure where Signature == (Optional) -> Optional { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> Optional) { self.init( - makeClosure: make_swift_closure_TestModule_10TestModuleSq9APIResultO_SS, + makeClosure: make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO, body: body, fileID: fileID, line: line @@ -672,11 +784,11 @@ extension JSTypedClosure where Signature == (Optional) -> String { } } -@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS") -@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS") -public func _invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO") +public func _invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Void { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> Optional>>.fromOpaque(boxPtr).takeUnretainedValue().closure let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0CaseId)) return result.bridgeJSLowerReturn() #else @@ -685,32 +797,32 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(_ boxP } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO") +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq9DirectionO_SS") -fileprivate func make_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO") +fileprivate func make_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif -private enum _BJS_Closure_10TestModuleSq9DirectionO_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { +private enum _BJS_Closure_10TestModuleSq9DirectionO_Sq9DirectionO { + 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, param0Value) = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS(callbackValue, param0IsSome, param0Value) - return String.bridgeJSLiftReturn(ret) + let ret = invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(callbackValue, param0IsSome, param0Value) + return Optional.bridgeJSLiftReturn(ret) #else fatalError("Only available on WebAssembly") #endif @@ -718,10 +830,10 @@ private enum _BJS_Closure_10TestModuleSq9DirectionO_SS { } } -extension JSTypedClosure where Signature == (Optional) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { +extension JSTypedClosure where Signature == (Optional) -> Optional { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> Optional) { self.init( - makeClosure: make_swift_closure_TestModule_10TestModuleSq9DirectionO_SS, + makeClosure: make_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO, body: body, fileID: fileID, line: line @@ -729,11 +841,11 @@ extension JSTypedClosure where Signature == (Optional) -> String { } } -@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS") -@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS") -public func _invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO") +public func _invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> Optional>>.fromOpaque(boxPtr).takeUnretainedValue().closure let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) return result.bridgeJSLowerReturn() #else @@ -741,6 +853,291 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(_ boxP #endif } +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSqSS_SqSS") +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSS_SqSS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void +#else +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSS_SqSS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSqSS_SqSS") +fileprivate func make_swift_closure_TestModule_10TestModuleSqSS_SqSS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSqSS_SqSS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +private enum _BJS_Closure_10TestModuleSqSS_SqSS { + 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, param0Value) = param0.bridgeJSLowerParameter() + invoke_js_callback_TestModule_10TestModuleSqSS_SqSS(callbackValue, param0IsSome, param0Value) + return Optional.bridgeJSLiftReturnFromSideChannel() + #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_TestModule_10TestModuleSqSS_SqSS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSqSS_SqSS") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSqSS_SqSS") +public func _invoke_swift_closure_TestModule_10TestModuleSqSS_SqSS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> Optional>>.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_TestModule_10TestModuleSqSb_SqSb") +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSb_SqSb(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSb_SqSb(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSqSb_SqSb") +fileprivate func make_swift_closure_TestModule_10TestModuleSqSb_SqSb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSqSb_SqSb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +private enum _BJS_Closure_10TestModuleSqSb_SqSb { + 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, param0Value) = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_TestModule_10TestModuleSqSb_SqSb(callbackValue, param0IsSome, param0Value) + 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_TestModule_10TestModuleSqSb_SqSb, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSqSb_SqSb") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSqSb_SqSb") +public func _invoke_swift_closure_TestModule_10TestModuleSqSb_SqSb(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> 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_TestModule_10TestModuleSqSd_SqSd") +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSd_SqSd(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float64) -> Void +#else +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSd_SqSd(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSqSd_SqSd") +fileprivate func make_swift_closure_TestModule_10TestModuleSqSd_SqSd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSqSd_SqSd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +private enum _BJS_Closure_10TestModuleSqSd_SqSd { + 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, param0Value) = param0.bridgeJSLowerParameter() + invoke_js_callback_TestModule_10TestModuleSqSd_SqSd(callbackValue, param0IsSome, param0Value) + return Optional.bridgeJSLiftReturnFromSideChannel() + #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_TestModule_10TestModuleSqSd_SqSd, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSqSd_SqSd") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSqSd_SqSd") +public func _invoke_swift_closure_TestModule_10TestModuleSqSd_SqSd(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Float64) -> 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_TestModule_10TestModuleSqSf_SqSf") +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSf_SqSf(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float32) -> Void +#else +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSf_SqSf(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSqSf_SqSf") +fileprivate func make_swift_closure_TestModule_10TestModuleSqSf_SqSf(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSqSf_SqSf(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +private enum _BJS_Closure_10TestModuleSqSf_SqSf { + 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, param0Value) = param0.bridgeJSLowerParameter() + invoke_js_callback_TestModule_10TestModuleSqSf_SqSf(callbackValue, param0IsSome, param0Value) + return Optional.bridgeJSLiftReturnFromSideChannel() + #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_TestModule_10TestModuleSqSf_SqSf, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSqSf_SqSf") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSqSf_SqSf") +public func _invoke_swift_closure_TestModule_10TestModuleSqSf_SqSf(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Float32) -> 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_TestModule_10TestModuleSqSi_SqSi") +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSi_SqSi(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void +#else +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSi_SqSi(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSqSi_SqSi") +fileprivate func make_swift_closure_TestModule_10TestModuleSqSi_SqSi(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_TestModule_10TestModuleSqSi_SqSi(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +private enum _BJS_Closure_10TestModuleSqSi_SqSi { + 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, param0Value) = param0.bridgeJSLowerParameter() + invoke_js_callback_TestModule_10TestModuleSqSi_SqSi(callbackValue, param0IsSome, param0Value) + return Optional.bridgeJSLiftReturnFromSideChannel() + #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_TestModule_10TestModuleSqSi_SqSi, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_TestModule_10TestModuleSqSi_SqSi") +@_cdecl("invoke_swift_closure_TestModule_10TestModuleSqSi_SqSi") +public func _invoke_swift_closure_TestModule_10TestModuleSqSi_SqSi(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> 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 +} + extension Direction: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { return bridgeJSRawValue @@ -867,235 +1264,279 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } -@_expose(wasm, "bjs_Person_init") -@_cdecl("bjs_Person_init") -public func _bjs_Person_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_roundtripString") +@_cdecl("bjs_roundtripString") +public func _bjs_roundtripString(_ stringClosure: Int32) -> Int32 { #if arch(wasm32) - let ret = Person(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) - return ret.bridgeJSLowerReturn() + let ret = roundtripString(_: _BJS_Closure_10TestModuleSS_SS.bridgeJSLift(stringClosure)) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_Person_deinit") -@_cdecl("bjs_Person_deinit") -public func _bjs_Person_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_roundtripInt") +@_cdecl("bjs_roundtripInt") +public func _bjs_roundtripInt(_ intClosure: Int32) -> Int32 { #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() + let ret = roundtripInt(_: _BJS_Closure_10TestModuleSi_Si.bridgeJSLift(intClosure)) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -extension Person: ConvertibleToJSValue, _BridgedSwiftHeapObject { - public var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_Person_wrap(Unmanaged.passRetained(self).toOpaque())))) - } +@_expose(wasm, "bjs_roundtripBool") +@_cdecl("bjs_roundtripBool") +public func _bjs_roundtripBool(_ boolClosure: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundtripBool(_: _BJS_Closure_10TestModuleSb_Sb.bridgeJSLift(boolClosure)) + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif } -#if arch(wasm32) -@_extern(wasm, module: "TestModule", name: "bjs_Person_wrap") -fileprivate func _bjs_Person_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_Person_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_roundtripFloat") +@_cdecl("bjs_roundtripFloat") +public func _bjs_roundtripFloat(_ floatClosure: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundtripFloat(_: _BJS_Closure_10TestModuleSf_Sf.bridgeJSLift(floatClosure)) + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else fatalError("Only available on WebAssembly") + #endif } -#endif -@_expose(wasm, "bjs_TestProcessor_init") -@_cdecl("bjs_TestProcessor_init") -public func _bjs_TestProcessor_init(_ transform: Int32) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_roundtripDouble") +@_cdecl("bjs_roundtripDouble") +public func _bjs_roundtripDouble(_ doubleClosure: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor(transform: _BJS_Closure_10TestModuleSS_SS.bridgeJSLift(transform)) - return ret.bridgeJSLowerReturn() + let ret = roundtripDouble(_: _BJS_Closure_10TestModuleSd_Sd.bridgeJSLift(doubleClosure)) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_getTransform") -@_cdecl("bjs_TestProcessor_getTransform") -public func _bjs_TestProcessor_getTransform(_ _self: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_roundtripOptionalString") +@_cdecl("bjs_roundtripOptionalString") +public func _bjs_roundtripOptionalString(_ stringClosure: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).getTransform() + let ret = roundtripOptionalString(_: _BJS_Closure_10TestModuleSqSS_SqSS.bridgeJSLift(stringClosure)) return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_processWithCustom") -@_cdecl("bjs_TestProcessor_processWithCustom") -public func _bjs_TestProcessor_processWithCustom(_ _self: UnsafeMutableRawPointer, _ textBytes: Int32, _ textLength: Int32, _ customTransform: Int32) -> Void { +@_expose(wasm, "bjs_roundtripOptionalInt") +@_cdecl("bjs_roundtripOptionalInt") +public func _bjs_roundtripOptionalInt(_ intClosure: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processWithCustom(_: String.bridgeJSLiftParameter(textBytes, textLength), customTransform: _BJS_Closure_10TestModuleSS_SS.bridgeJSLift(customTransform)) - return ret.bridgeJSLowerReturn() + let ret = roundtripOptionalInt(_: _BJS_Closure_10TestModuleSqSi_SqSi.bridgeJSLift(intClosure)) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_printTogether") -@_cdecl("bjs_TestProcessor_printTogether") -public func _bjs_TestProcessor_printTogether(_ _self: UnsafeMutableRawPointer, _ person: UnsafeMutableRawPointer, _ nameBytes: Int32, _ nameLength: Int32, _ ratio: Float64, _ customTransform: Int32) -> Void { +@_expose(wasm, "bjs_roundtripOptionalBool") +@_cdecl("bjs_roundtripOptionalBool") +public func _bjs_roundtripOptionalBool(_ boolClosure: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).printTogether(person: Person.bridgeJSLiftParameter(person), name: String.bridgeJSLiftParameter(nameBytes, nameLength), ratio: Double.bridgeJSLiftParameter(ratio), customTransform: _BJS_Closure_10TestModuleSq6PersonCSqSSSqSd_SS.bridgeJSLift(customTransform)) - return ret.bridgeJSLowerReturn() + let ret = roundtripOptionalBool(_: _BJS_Closure_10TestModuleSqSb_SqSb.bridgeJSLift(boolClosure)) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_roundtrip") -@_cdecl("bjs_TestProcessor_roundtrip") -public func _bjs_TestProcessor_roundtrip(_ _self: UnsafeMutableRawPointer, _ personClosure: Int32) -> Int32 { +@_expose(wasm, "bjs_roundtripOptionalFloat") +@_cdecl("bjs_roundtripOptionalFloat") +public func _bjs_roundtripOptionalFloat(_ floatClosure: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).roundtrip(_: _BJS_Closure_10TestModule6PersonC_SS.bridgeJSLift(personClosure)) + let ret = roundtripOptionalFloat(_: _BJS_Closure_10TestModuleSqSf_SqSf.bridgeJSLift(floatClosure)) return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_roundtripOptional") -@_cdecl("bjs_TestProcessor_roundtripOptional") -public func _bjs_TestProcessor_roundtripOptional(_ _self: UnsafeMutableRawPointer, _ personClosure: Int32) -> Int32 { +@_expose(wasm, "bjs_roundtripOptionalDouble") +@_cdecl("bjs_roundtripOptionalDouble") +public func _bjs_roundtripOptionalDouble(_ doubleClosure: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).roundtripOptional(_: _BJS_Closure_10TestModuleSq6PersonC_SS.bridgeJSLift(personClosure)) + let ret = roundtripOptionalDouble(_: _BJS_Closure_10TestModuleSqSd_SqSd.bridgeJSLift(doubleClosure)) return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_processDirection") -@_cdecl("bjs_TestProcessor_processDirection") -public func _bjs_TestProcessor_processDirection(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { +@_expose(wasm, "bjs_roundtripPerson") +@_cdecl("bjs_roundtripPerson") +public func _bjs_roundtripPerson(_ personClosure: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processDirection(_: _BJS_Closure_10TestModule9DirectionO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() + let ret = roundtripPerson(_: _BJS_Closure_10TestModule6PersonC_6PersonC.bridgeJSLift(personClosure)) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_processTheme") -@_cdecl("bjs_TestProcessor_processTheme") -public func _bjs_TestProcessor_processTheme(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { +@_expose(wasm, "bjs_roundtripOptionalPerson") +@_cdecl("bjs_roundtripOptionalPerson") +public func _bjs_roundtripOptionalPerson(_ personClosure: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processTheme(_: _BJS_Closure_10TestModule5ThemeO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() + let ret = roundtripOptionalPerson(_: _BJS_Closure_10TestModuleSq6PersonC_Sq6PersonC.bridgeJSLift(personClosure)) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_processHttpStatus") -@_cdecl("bjs_TestProcessor_processHttpStatus") -public func _bjs_TestProcessor_processHttpStatus(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Int32 { +@_expose(wasm, "bjs_roundtripDirection") +@_cdecl("bjs_roundtripDirection") +public func _bjs_roundtripDirection(_ callback: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processHttpStatus(_: _BJS_Closure_10TestModule10HttpStatusO_Si.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() + let ret = roundtripDirection(_: _BJS_Closure_10TestModule9DirectionO_9DirectionO.bridgeJSLift(callback)) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_processAPIResult") -@_cdecl("bjs_TestProcessor_processAPIResult") -public func _bjs_TestProcessor_processAPIResult(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { +@_expose(wasm, "bjs_roundtripTheme") +@_cdecl("bjs_roundtripTheme") +public func _bjs_roundtripTheme(_ callback: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processAPIResult(_: _BJS_Closure_10TestModule9APIResultO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() + let ret = roundtripTheme(_: _BJS_Closure_10TestModule5ThemeO_5ThemeO.bridgeJSLift(callback)) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_makeDirectionChecker") -@_cdecl("bjs_TestProcessor_makeDirectionChecker") -public func _bjs_TestProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_roundtripHttpStatus") +@_cdecl("bjs_roundtripHttpStatus") +public func _bjs_roundtripHttpStatus(_ callback: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() + let ret = roundtripHttpStatus(_: _BJS_Closure_10TestModule10HttpStatusO_10HttpStatusO.bridgeJSLift(callback)) return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_makeThemeValidator") -@_cdecl("bjs_TestProcessor_makeThemeValidator") -public func _bjs_TestProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_roundtripAPIResult") +@_cdecl("bjs_roundtripAPIResult") +public func _bjs_roundtripAPIResult(_ callback: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() + let ret = roundtripAPIResult(_: _BJS_Closure_10TestModule9APIResultO_9APIResultO.bridgeJSLift(callback)) return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_makeStatusCodeExtractor") -@_cdecl("bjs_TestProcessor_makeStatusCodeExtractor") -public func _bjs_TestProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_roundtripOptionalDirection") +@_cdecl("bjs_roundtripOptionalDirection") +public func _bjs_roundtripOptionalDirection(_ callback: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() + let ret = roundtripOptionalDirection(_: _BJS_Closure_10TestModuleSq9DirectionO_Sq9DirectionO.bridgeJSLift(callback)) return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_makeAPIResultHandler") -@_cdecl("bjs_TestProcessor_makeAPIResultHandler") -public func _bjs_TestProcessor_makeAPIResultHandler(_ _self: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_roundtripOptionalTheme") +@_cdecl("bjs_roundtripOptionalTheme") +public func _bjs_roundtripOptionalTheme(_ callback: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() + let ret = roundtripOptionalTheme(_: _BJS_Closure_10TestModuleSq5ThemeO_Sq5ThemeO.bridgeJSLift(callback)) return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_processOptionalDirection") -@_cdecl("bjs_TestProcessor_processOptionalDirection") -public func _bjs_TestProcessor_processOptionalDirection(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { +@_expose(wasm, "bjs_roundtripOptionalHttpStatus") +@_cdecl("bjs_roundtripOptionalHttpStatus") +public func _bjs_roundtripOptionalHttpStatus(_ callback: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalDirection(_: _BJS_Closure_10TestModuleSq9DirectionO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() + let ret = roundtripOptionalHttpStatus(_: _BJS_Closure_10TestModuleSq10HttpStatusO_Sq10HttpStatusO.bridgeJSLift(callback)) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_processOptionalTheme") -@_cdecl("bjs_TestProcessor_processOptionalTheme") -public func _bjs_TestProcessor_processOptionalTheme(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { +@_expose(wasm, "bjs_roundtripOptionalAPIResult") +@_cdecl("bjs_roundtripOptionalAPIResult") +public func _bjs_roundtripOptionalAPIResult(_ callback: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalTheme(_: _BJS_Closure_10TestModuleSq5ThemeO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() + let ret = roundtripOptionalAPIResult(_: _BJS_Closure_10TestModuleSq9APIResultO_Sq9APIResultO.bridgeJSLift(callback)) + return JSTypedClosure(ret).bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_processOptionalAPIResult") -@_cdecl("bjs_TestProcessor_processOptionalAPIResult") -public func _bjs_TestProcessor_processOptionalAPIResult(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { +@_expose(wasm, "bjs_roundtripOptionalDirection") +@_cdecl("bjs_roundtripOptionalDirection") +public func _bjs_roundtripOptionalDirection(_ callback: Int32) -> Int32 { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).processOptionalAPIResult(_: _BJS_Closure_10TestModuleSq9APIResultO_SS.bridgeJSLift(callback)) + let ret = roundtripOptionalDirection(_: _BJS_Closure_10TestModuleSq9DirectionO_Sq9DirectionO.bridgeJSLift(callback)) + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Person_init") +@_cdecl("bjs_Person_init") +public func _bjs_Person_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Person(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -@_expose(wasm, "bjs_TestProcessor_makeOptionalDirectionFormatter") -@_cdecl("bjs_TestProcessor_makeOptionalDirectionFormatter") -public func _bjs_TestProcessor_makeOptionalDirectionFormatter(_ _self: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_Person_deinit") +@_cdecl("bjs_Person_deinit") +public func _bjs_Person_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = TestProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() - return JSTypedClosure(ret).bridgeJSLowerReturn() + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension Person: ConvertibleToJSValue, _BridgedSwiftHeapObject { + public var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_Person_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_Person_wrap") +fileprivate func _bjs_Person_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Person_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_TestProcessor_init") +@_cdecl("bjs_TestProcessor_init") +public func _bjs_TestProcessor_init(_ transform: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TestProcessor(transform: _BJS_Closure_10TestModuleSS_SS.bridgeJSLift(transform)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts index 942b18269..ccc95eb3b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts @@ -59,23 +59,6 @@ export interface SwiftHeapObject { export interface Person extends SwiftHeapObject { } export interface TestProcessor extends SwiftHeapObject { - getTransform(): (arg0: string) => string; - processWithCustom(text: string, customTransform: (arg0: string) => string): string; - printTogether(person: Person, name: string, ratio: number, customTransform: (arg0: Person | null, arg1: string | null, arg2: number | null) => string): string; - roundtrip(personClosure: (arg0: Person) => string): (arg0: Person) => string; - roundtripOptional(personClosure: (arg0: Person | null) => string): (arg0: Person | null) => string; - processDirection(callback: (arg0: DirectionTag) => string): string; - processTheme(callback: (arg0: ThemeTag) => string): string; - processHttpStatus(callback: (arg0: HttpStatusTag) => number): number; - processAPIResult(callback: (arg0: APIResultTag) => string): string; - makeDirectionChecker(): (arg0: DirectionTag) => boolean; - makeThemeValidator(): (arg0: ThemeTag) => boolean; - makeStatusCodeExtractor(): (arg0: HttpStatusTag) => number; - makeAPIResultHandler(): (arg0: APIResultTag) => string; - processOptionalDirection(callback: (arg0: DirectionTag | null) => string): string; - processOptionalTheme(callback: (arg0: ThemeTag | null) => string): string; - processOptionalAPIResult(callback: (arg0: APIResultTag | null) => string): string; - makeOptionalDirectionFormatter(): (arg0: DirectionTag | null) => string; } export type Exports = { Person: { @@ -84,6 +67,27 @@ export type Exports = { TestProcessor: { new(transform: (arg0: string) => string): TestProcessor; } + roundtripString(stringClosure: (arg0: string) => string): (arg0: string) => string; + roundtripInt(intClosure: (arg0: number) => number): (arg0: number) => number; + roundtripBool(boolClosure: (arg0: boolean) => boolean): (arg0: boolean) => boolean; + roundtripFloat(floatClosure: (arg0: number) => number): (arg0: number) => number; + roundtripDouble(doubleClosure: (arg0: number) => number): (arg0: number) => number; + roundtripOptionalString(stringClosure: (arg0: string | null) => string | null): (arg0: string | null) => string | null; + roundtripOptionalInt(intClosure: (arg0: number | null) => number | null): (arg0: number | null) => number | null; + roundtripOptionalBool(boolClosure: (arg0: boolean | null) => boolean | null): (arg0: boolean | null) => boolean | null; + roundtripOptionalFloat(floatClosure: (arg0: number | null) => number | null): (arg0: number | null) => number | null; + roundtripOptionalDouble(doubleClosure: (arg0: number | null) => number | null): (arg0: number | null) => number | null; + roundtripPerson(personClosure: (arg0: Person) => Person): (arg0: Person) => Person; + roundtripOptionalPerson(personClosure: (arg0: Person | null) => Person | null): (arg0: Person | null) => Person | null; + roundtripDirection(callback: (arg0: DirectionTag) => DirectionTag): (arg0: DirectionTag) => DirectionTag; + roundtripTheme(callback: (arg0: ThemeTag) => ThemeTag): (arg0: ThemeTag) => ThemeTag; + roundtripHttpStatus(callback: (arg0: HttpStatusTag) => HttpStatusTag): (arg0: HttpStatusTag) => HttpStatusTag; + roundtripAPIResult(callback: (arg0: APIResultTag) => APIResultTag): (arg0: APIResultTag) => APIResultTag; + roundtripOptionalDirection(callback: (arg0: DirectionTag | null) => DirectionTag | null): (arg0: DirectionTag | null) => DirectionTag | null; + roundtripOptionalTheme(callback: (arg0: ThemeTag | null) => ThemeTag | null): (arg0: ThemeTag | null) => ThemeTag | null; + roundtripOptionalHttpStatus(callback: (arg0: HttpStatusTag | null) => HttpStatusTag | null): (arg0: HttpStatusTag | null) => HttpStatusTag | null; + roundtripOptionalAPIResult(callback: (arg0: APIResultTag | null) => APIResultTag | null): (arg0: APIResultTag | null) => APIResultTag | null; + roundtripOptionalDirection(callback: (arg0: DirectionTag | null) => DirectionTag | null): (arg0: DirectionTag | null) => DirectionTag | null; Direction: DirectionObject Theme: ThemeObject HttpStatus: HttpStatusObject diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 38c248cae..09f9aee59 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -329,7 +329,7 @@ export async function createInstantiator(options, swift) { func.__unregister(); } - bjs["invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); let param0 = param0Id; @@ -340,9 +340,9 @@ export async function createInstantiator(options, swift) { return 0; } }; - bjs["make_swift_closure_TestModule_10TestModule10HttpStatusO_Si"] = function(boxPtr, file, line) { - const lower_closure_TestModule_10TestModule10HttpStatusO_Si = function(param0) { - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule10HttpStatusO_Si(boxPtr, param0); + bjs["make_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO = function(param0) { + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO(boxPtr, param0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); @@ -351,19 +351,16 @@ export async function createInstantiator(options, swift) { } return invokeResult | 0; }; - return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule10HttpStatusO_Si); + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO); } - bjs["invoke_js_callback_TestModule_10TestModule5ThemeO_SS"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); const param0IdObject = swift.memory.getObject(param0Id); swift.memory.release(param0Id); let param0 = String(param0IdObject); const result = callback(param0); - if (typeof result !== "string") { - throw new TypeError("Callback must return a string"); - } tmpRetBytes = textEncoder.encode(result); return tmpRetBytes.length; } catch (error) { @@ -372,11 +369,11 @@ export async function createInstantiator(options, swift) { return 0; } }; - bjs["make_swift_closure_TestModule_10TestModule5ThemeO_SS"] = function(boxPtr, file, line) { - const lower_closure_TestModule_10TestModule5ThemeO_SS = function(param0) { + bjs["make_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModule5ThemeO_5ThemeO = function(param0) { const param0Bytes = textEncoder.encode(param0); const param0Id = swift.memory.retain(param0Bytes); - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule5ThemeO_SS(boxPtr, param0Id, param0Bytes.length); + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO(boxPtr, param0Id, param0Bytes.length); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); @@ -388,109 +385,95 @@ export async function createInstantiator(options, swift) { tmpRetString = undefined; return ret; }; - return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule5ThemeO_SS); + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule5ThemeO_5ThemeO); } - bjs["invoke_js_callback_TestModule_10TestModule5ThemeO_Sb"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - const param0IdObject = swift.memory.getObject(param0Id); - swift.memory.release(param0Id); - let param0 = String(param0IdObject); + let param0 = _exports['Person'].__construct(param0Id); const result = callback(param0); - return result ? 1 : 0; + return result.pointer; } catch (error) { setException?.(error); return 0; } }; - bjs["make_swift_closure_TestModule_10TestModule5ThemeO_Sb"] = function(boxPtr, file, line) { - const lower_closure_TestModule_10TestModule5ThemeO_Sb = function(param0) { - const param0Bytes = textEncoder.encode(param0); - const param0Id = swift.memory.retain(param0Bytes); - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule5ThemeO_Sb(boxPtr, param0Id, param0Bytes.length); + bjs["make_swift_closure_TestModule_10TestModule6PersonC_6PersonC"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModule6PersonC_6PersonC = function(param0) { + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule6PersonC_6PersonC(boxPtr, param0.pointer); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - return invokeResult !== 0; + const resultPtr = invokeResult; + return _exports['Person'].__construct(resultPtr); }; - return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule5ThemeO_Sb); + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule6PersonC_6PersonC); } - bjs["invoke_js_callback_TestModule_10TestModule6PersonC_SS"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - let param0 = _exports['Person'].__construct(param0Id); + let param0 = enumHelpers.APIResult.lift(param0Id); const result = callback(param0); - if (typeof result !== "string") { - throw new TypeError("Callback must return a string"); - } - tmpRetBytes = textEncoder.encode(result); - return tmpRetBytes.length; + const { caseId: caseId, cleanup: cleanup } = enumHelpers.APIResult.lower(result); + return caseId; } catch (error) { setException?.(error); - tmpRetBytes = new Uint8Array(0); - return 0; + return; } }; - bjs["make_swift_closure_TestModule_10TestModule6PersonC_SS"] = function(boxPtr, file, line) { - const lower_closure_TestModule_10TestModule6PersonC_SS = function(param0) { - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule6PersonC_SS(boxPtr, param0.pointer); + bjs["make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModule9APIResultO_9APIResultO = function(param0) { + const { caseId: param0CaseId, cleanup: param0Cleanup } = enumHelpers.APIResult.lower(param0); + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO(boxPtr, param0CaseId); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - const resultLen = invokeResult; - const ret = tmpRetString; - tmpRetString = undefined; - return ret; + invokeResult; + const result = enumHelpers.APIResult.lift(tagStack.pop()); + return result; }; - return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule6PersonC_SS); + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule9APIResultO_9APIResultO); } - bjs["invoke_js_callback_TestModule_10TestModule9APIResultO_SS"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - let param0 = enumHelpers.APIResult.lift(param0Id); + let param0 = param0Id; const result = callback(param0); - if (typeof result !== "string") { - throw new TypeError("Callback must return a string"); - } - tmpRetBytes = textEncoder.encode(result); - return tmpRetBytes.length; + return result | 0; } catch (error) { setException?.(error); - tmpRetBytes = new Uint8Array(0); return 0; } }; - bjs["make_swift_closure_TestModule_10TestModule9APIResultO_SS"] = function(boxPtr, file, line) { - const lower_closure_TestModule_10TestModule9APIResultO_SS = function(param0) { - const { caseId: param0CaseId, cleanup: param0Cleanup } = enumHelpers.APIResult.lower(param0); - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule9APIResultO_SS(boxPtr, param0CaseId); + bjs["make_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModule9DirectionO_9DirectionO = function(param0) { + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO(boxPtr, param0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - const resultLen = invokeResult; - const ret = tmpRetString; - tmpRetString = undefined; - return ret; + return invokeResult | 0; }; - return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule9APIResultO_SS); + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule9DirectionO_9DirectionO); } - bjs["invoke_js_callback_TestModule_10TestModule9DirectionO_SS"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModuleSS_SS"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - let param0 = param0Id; + const param0IdObject = swift.memory.getObject(param0Id); + swift.memory.release(param0Id); + let param0 = String(param0IdObject); const result = callback(param0); if (typeof result !== "string") { throw new TypeError("Callback must return a string"); @@ -503,9 +486,11 @@ export async function createInstantiator(options, swift) { return 0; } }; - bjs["make_swift_closure_TestModule_10TestModule9DirectionO_SS"] = function(boxPtr, file, line) { - const lower_closure_TestModule_10TestModule9DirectionO_SS = function(param0) { - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule9DirectionO_SS(boxPtr, param0); + bjs["make_swift_closure_TestModule_10TestModuleSS_SS"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSS_SS = function(param0) { + const param0Bytes = textEncoder.encode(param0); + const param0Id = swift.memory.retain(param0Bytes); + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSS_SS(boxPtr, param0Id, param0Bytes.length); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); @@ -517,13 +502,13 @@ export async function createInstantiator(options, swift) { tmpRetString = undefined; return ret; }; - return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule9DirectionO_SS); + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSS_SS); } - bjs["invoke_js_callback_TestModule_10TestModule9DirectionO_Sb"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModuleSb_Sb"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - let param0 = param0Id; + let param0 = param0Id !== 0; const result = callback(param0); return result ? 1 : 0; } catch (error) { @@ -531,9 +516,9 @@ export async function createInstantiator(options, swift) { return 0; } }; - bjs["make_swift_closure_TestModule_10TestModule9DirectionO_Sb"] = function(boxPtr, file, line) { - const lower_closure_TestModule_10TestModule9DirectionO_Sb = function(param0) { - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule9DirectionO_Sb(boxPtr, param0); + bjs["make_swift_closure_TestModule_10TestModuleSb_Sb"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSb_Sb = function(param0) { + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSb_Sb(boxPtr, param0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); @@ -542,47 +527,120 @@ export async function createInstantiator(options, swift) { } return invokeResult !== 0; }; - return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule9DirectionO_Sb); + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSb_Sb); } - bjs["invoke_js_callback_TestModule_10TestModuleSS_SS"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModuleSd_Sd"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); - const param0IdObject = swift.memory.getObject(param0Id); - swift.memory.release(param0Id); - let param0 = String(param0IdObject); + let param0 = param0Id; const result = callback(param0); - if (typeof result !== "string") { - throw new TypeError("Callback must return a string"); + return result; + } catch (error) { + setException?.(error); + return 0.0; + } + }; + bjs["make_swift_closure_TestModule_10TestModuleSd_Sd"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSd_Sd = function(param0) { + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSd_Sd(boxPtr, param0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; + throw error; } - tmpRetBytes = textEncoder.encode(result); - return tmpRetBytes.length; + return invokeResult; + }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSd_Sd); + } + + bjs["invoke_js_callback_TestModule_10TestModuleSf_Sf"] = function(callbackId, param0Id) { + try { + const callback = swift.memory.getObject(callbackId); + let param0 = param0Id; + const result = callback(param0); + return Math.fround(result); + } catch (error) { + setException?.(error); + return 0.0; + } + }; + bjs["make_swift_closure_TestModule_10TestModuleSf_Sf"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSf_Sf = function(param0) { + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSf_Sf(boxPtr, param0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; + throw error; + } + return invokeResult; + }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSf_Sf); + } + + bjs["invoke_js_callback_TestModule_10TestModuleSi_Si"] = function(callbackId, param0Id) { + try { + const callback = swift.memory.getObject(callbackId); + let param0 = param0Id; + const result = callback(param0); + return result | 0; } catch (error) { setException?.(error); - tmpRetBytes = new Uint8Array(0); return 0; } }; - bjs["make_swift_closure_TestModule_10TestModuleSS_SS"] = function(boxPtr, file, line) { - const lower_closure_TestModule_10TestModuleSS_SS = function(param0) { - const param0Bytes = textEncoder.encode(param0); - const param0Id = swift.memory.retain(param0Bytes); - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSS_SS(boxPtr, param0Id, param0Bytes.length); + bjs["make_swift_closure_TestModule_10TestModuleSi_Si"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSi_Si = function(param0) { + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSi_Si(boxPtr, param0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - const resultLen = invokeResult; - const ret = tmpRetString; - tmpRetString = undefined; - return ret; + return invokeResult | 0; }; - return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSS_SS); + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSi_Si); + } + + bjs["invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO"] = function(callbackId, param0IsSome, param0Value) { + try { + const callback = swift.memory.getObject(callbackId); + let param0; + if (param0IsSome) { + param0 = param0Value; + } else { + param0 = null; + } + const result = callback(param0); + tmpRetOptionalInt = result; + return; + } catch (error) { + setException?.(error); + return; + } + }; + bjs["make_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO = function(param0) { + const isSome = param0 != null; + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(boxPtr, +isSome, isSome ? param0 : 0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; + throw error; + } + invokeResult; + const optResult = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; + return optResult; + }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO); } - bjs["invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO"] = function(callbackId, param0IsSome, param0Value) { try { const callback = swift.memory.getObject(callbackId); let param0; @@ -594,41 +652,37 @@ export async function createInstantiator(options, swift) { param0 = null; } const result = callback(param0); - if (typeof result !== "string") { - throw new TypeError("Callback must return a string"); - } - tmpRetBytes = textEncoder.encode(result); - return tmpRetBytes.length; + tmpRetString = result; + return; } catch (error) { setException?.(error); - tmpRetBytes = new Uint8Array(0); - return 0; + return; } }; - bjs["make_swift_closure_TestModule_10TestModuleSq5ThemeO_SS"] = function(boxPtr, file, line) { - const lower_closure_TestModule_10TestModuleSq5ThemeO_SS = function(param0) { + bjs["make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO = function(param0) { const isSome = param0 != null; let param0Id, param0Bytes; if (isSome) { param0Bytes = textEncoder.encode(param0); param0Id = swift.memory.retain(param0Bytes); } - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_SS(boxPtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(boxPtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - const resultLen = invokeResult; - const ret = tmpRetString; + invokeResult; + const optResult = tmpRetString; tmpRetString = undefined; - return ret; + return optResult; }; - return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq5ThemeO_SS); + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO); } - bjs["invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS"] = function(callbackId, param0IsSome, param0Value, param1IsSome, param1Value, param2IsSome, param2Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC"] = function(callbackId, param0IsSome, param0Value) { try { const callback = swift.memory.getObject(callbackId); let param0; @@ -637,142 +691,197 @@ export async function createInstantiator(options, swift) { } else { param0 = null; } - let param1; - if (param1IsSome) { - const param1Object = swift.memory.getObject(param1Value); - swift.memory.release(param1Value); - param1 = String(param1Object); - } else { - param1 = null; + const result = callback(param0); + return result ? result.pointer : 0; + } catch (error) { + setException?.(error); + return 0; + } + }; + bjs["make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC = function(param0) { + const isSome = param0 != null; + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC(boxPtr, +isSome, isSome ? param0.pointer : 0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; + throw error; } - let param2; - if (param2IsSome) { - param2 = param2Value; + invokeResult; + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + const optResult = pointer === null ? null : _exports['Person'].__construct(pointer); + return optResult; + }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC); + } + + bjs["invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO"] = function(callbackId, param0IsSome, param0Value) { + try { + const callback = swift.memory.getObject(callbackId); + let param0; + if (param0IsSome) { + param0 = enumHelpers.APIResult.lift(param0Value); } else { - param2 = null; + param0 = null; } - const result = callback(param0, param1, param2); - if (typeof result !== "string") { - throw new TypeError("Callback must return a string"); + const result = callback(param0); + if (result) { + const { caseId: caseId, cleanup: cleanup } = enumHelpers.APIResult.lower(result); + tmpRetOptionalInt = caseId; + } else { + tmpRetOptionalInt = null; } - tmpRetBytes = textEncoder.encode(result); - return tmpRetBytes.length; + return; } catch (error) { setException?.(error); - tmpRetBytes = new Uint8Array(0); - return 0; + return; } }; - bjs["make_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS"] = function(boxPtr, file, line) { - const lower_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS = function(param0, param1, param2) { + bjs["make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO = function(param0) { const isSome = param0 != null; - const isSome1 = param1 != null; - let param1Id, param1Bytes; - if (isSome1) { - param1Bytes = textEncoder.encode(param1); - param1Id = swift.memory.retain(param1Bytes); - } - const isSome2 = param2 != null; - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS(boxPtr, +isSome, isSome ? param0.pointer : 0, +isSome1, isSome1 ? param1Id : 0, isSome1 ? param1Bytes.length : 0, +isSome2, isSome2 ? param2 : 0); + let param0CaseId, param0Cleanup; + if (isSome) { + const enumResult = enumHelpers.APIResult.lower(param0); + param0CaseId = enumResult.caseId; + param0Cleanup = enumResult.cleanup; + } + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(boxPtr, +isSome, isSome ? param0CaseId : 0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - const resultLen = invokeResult; - const ret = tmpRetString; - tmpRetString = undefined; - return ret; + invokeResult; + const tag = tagStack.pop(); + const isNull = (tag === -1); + let optResult; + if (isNull) { + optResult = null; + } else { + optResult = enumHelpers.APIResult.lift(tag); + } + return optResult; }; - return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS); + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO); } - bjs["invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO"] = function(callbackId, param0IsSome, param0Value) { try { const callback = swift.memory.getObject(callbackId); let param0; if (param0IsSome) { - param0 = _exports['Person'].__construct(param0Value); + param0 = param0Value; } else { param0 = null; } const result = callback(param0); - if (typeof result !== "string") { - throw new TypeError("Callback must return a string"); - } - tmpRetBytes = textEncoder.encode(result); - return tmpRetBytes.length; + tmpRetOptionalInt = result; + return; } catch (error) { setException?.(error); - tmpRetBytes = new Uint8Array(0); - return 0; + return; } }; - bjs["make_swift_closure_TestModule_10TestModuleSq6PersonC_SS"] = function(boxPtr, file, line) { - const lower_closure_TestModule_10TestModuleSq6PersonC_SS = function(param0) { + bjs["make_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO = function(param0) { const isSome = param0 != null; - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq6PersonC_SS(boxPtr, +isSome, isSome ? param0.pointer : 0); + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(boxPtr, +isSome, isSome ? param0 : 0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - const resultLen = invokeResult; - const ret = tmpRetString; - tmpRetString = undefined; - return ret; + invokeResult; + const optResult = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; + return optResult; }; - return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq6PersonC_SS); + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO); } - bjs["invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSqSS_SqSS"] = function(callbackId, param0IsSome, param0Value) { try { const callback = swift.memory.getObject(callbackId); let param0; if (param0IsSome) { - param0 = enumHelpers.APIResult.lift(param0Value); + const param0Object = swift.memory.getObject(param0Value); + swift.memory.release(param0Value); + param0 = String(param0Object); } else { param0 = null; } const result = callback(param0); - if (typeof result !== "string") { - throw new TypeError("Callback must return a string"); - } - tmpRetBytes = textEncoder.encode(result); - return tmpRetBytes.length; + tmpRetString = result; + return; } catch (error) { setException?.(error); - tmpRetBytes = new Uint8Array(0); - return 0; + return; } }; - bjs["make_swift_closure_TestModule_10TestModuleSq9APIResultO_SS"] = function(boxPtr, file, line) { - const lower_closure_TestModule_10TestModuleSq9APIResultO_SS = function(param0) { + bjs["make_swift_closure_TestModule_10TestModuleSqSS_SqSS"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSqSS_SqSS = function(param0) { const isSome = param0 != null; - let param0CaseId, param0Cleanup; + let param0Id, param0Bytes; if (isSome) { - const enumResult = enumHelpers.APIResult.lower(param0); - param0CaseId = enumResult.caseId; - param0Cleanup = enumResult.cleanup; + param0Bytes = textEncoder.encode(param0); + param0Id = swift.memory.retain(param0Bytes); } - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_SS(boxPtr, +isSome, isSome ? param0CaseId : 0); + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSS_SqSS(boxPtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - const resultLen = invokeResult; - const ret = tmpRetString; + invokeResult; + const optResult = tmpRetString; tmpRetString = undefined; - return ret; + return optResult; + }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSqSS_SqSS); + } + + bjs["invoke_js_callback_TestModule_10TestModuleSqSb_SqSb"] = function(callbackId, param0IsSome, param0Value) { + try { + const callback = swift.memory.getObject(callbackId); + let param0; + if (param0IsSome) { + param0 = param0Value !== 0; + } else { + param0 = null; + } + const result = callback(param0); + tmpRetOptionalBool = result; + return; + } catch (error) { + setException?.(error); + return; + } + }; + bjs["make_swift_closure_TestModule_10TestModuleSqSb_SqSb"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSqSb_SqSb = function(param0) { + const isSome = param0 != null; + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSb_SqSb(boxPtr, +isSome, isSome ? param0 : 0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; + throw error; + } + invokeResult; + const optResult = tmpRetOptionalBool; + tmpRetOptionalBool = undefined; + return optResult; }; - return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq9APIResultO_SS); + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSqSb_SqSb); } - bjs["invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSqSd_SqSd"] = function(callbackId, param0IsSome, param0Value) { try { const callback = swift.memory.getObject(callbackId); let param0; @@ -782,33 +891,99 @@ export async function createInstantiator(options, swift) { param0 = null; } const result = callback(param0); - if (typeof result !== "string") { - throw new TypeError("Callback must return a string"); + tmpRetOptionalDouble = result; + return; + } catch (error) { + setException?.(error); + return; + } + }; + bjs["make_swift_closure_TestModule_10TestModuleSqSd_SqSd"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSqSd_SqSd = function(param0) { + const isSome = param0 != null; + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSd_SqSd(boxPtr, +isSome, isSome ? param0 : 0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; + throw error; } - tmpRetBytes = textEncoder.encode(result); - return tmpRetBytes.length; + invokeResult; + const optResult = tmpRetOptionalDouble; + tmpRetOptionalDouble = undefined; + return optResult; + }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSqSd_SqSd); + } + + bjs["invoke_js_callback_TestModule_10TestModuleSqSf_SqSf"] = function(callbackId, param0IsSome, param0Value) { + try { + const callback = swift.memory.getObject(callbackId); + let param0; + if (param0IsSome) { + param0 = Math.fround(param0Value); + } else { + param0 = null; + } + const result = callback(param0); + tmpRetOptionalFloat = result; + return; } catch (error) { setException?.(error); - tmpRetBytes = new Uint8Array(0); - return 0; + return; } }; - bjs["make_swift_closure_TestModule_10TestModuleSq9DirectionO_SS"] = function(boxPtr, file, line) { - const lower_closure_TestModule_10TestModuleSq9DirectionO_SS = function(param0) { + bjs["make_swift_closure_TestModule_10TestModuleSqSf_SqSf"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSqSf_SqSf = function(param0) { const isSome = param0 != null; - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_SS(boxPtr, +isSome, isSome ? param0 : 0); + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSf_SqSf(boxPtr, +isSome, isSome ? param0 : 0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - const resultLen = invokeResult; - const ret = tmpRetString; - tmpRetString = undefined; - return ret; + invokeResult; + const optResult = tmpRetOptionalFloat; + tmpRetOptionalFloat = undefined; + return optResult; }; - return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq9DirectionO_SS); + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSqSf_SqSf); + } + + bjs["invoke_js_callback_TestModule_10TestModuleSqSi_SqSi"] = function(callbackId, param0IsSome, param0Value) { + try { + const callback = swift.memory.getObject(callbackId); + let param0; + if (param0IsSome) { + param0 = param0Value | 0; + } else { + param0 = null; + } + const result = callback(param0); + tmpRetOptionalInt = result; + return; + } catch (error) { + setException?.(error); + return; + } + }; + bjs["make_swift_closure_TestModule_10TestModuleSqSi_SqSi"] = function(boxPtr, file, line) { + const lower_closure_TestModule_10TestModuleSqSi_SqSi = function(param0) { + const isSome = param0 != null; + const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSi_SqSi(boxPtr, +isSome, isSome ? param0 : 0); + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; + throw error; + } + invokeResult; + const optResult = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; + return optResult; + }; + return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSqSi_SqSi); } // Wrapper functions for module: TestModule if (!importObject["TestModule"]) { @@ -876,114 +1051,118 @@ export async function createInstantiator(options, swift) { const ret = instance.exports.bjs_TestProcessor_init(callbackId); return TestProcessor.__construct(ret); } - getTransform() { - const ret = instance.exports.bjs_TestProcessor_getTransform(this.pointer); + } + const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(); + enumHelpers.APIResult = APIResultHelpers; + + const exports = { + Person, + TestProcessor, + roundtripString: function bjs_roundtripString(stringClosure) { + const callbackId = swift.memory.retain(stringClosure); + const ret = instance.exports.bjs_roundtripString(callbackId); return swift.memory.getObject(ret); - } - processWithCustom(text, customTransform) { - const textBytes = textEncoder.encode(text); - const textId = swift.memory.retain(textBytes); - const callbackId = swift.memory.retain(customTransform); - instance.exports.bjs_TestProcessor_processWithCustom(this.pointer, textId, textBytes.length, callbackId); - const ret = tmpRetString; - tmpRetString = undefined; - swift.memory.release(textId); - return ret; - } - printTogether(person, name, ratio, customTransform) { - const nameBytes = textEncoder.encode(name); - const nameId = swift.memory.retain(nameBytes); - const callbackId = swift.memory.retain(customTransform); - instance.exports.bjs_TestProcessor_printTogether(this.pointer, person.pointer, nameId, nameBytes.length, ratio, callbackId); - const ret = tmpRetString; - tmpRetString = undefined; - swift.memory.release(nameId); - return ret; - } - roundtrip(personClosure) { + }, + roundtripInt: function bjs_roundtripInt(intClosure) { + const callbackId = swift.memory.retain(intClosure); + const ret = instance.exports.bjs_roundtripInt(callbackId); + return swift.memory.getObject(ret); + }, + roundtripBool: function bjs_roundtripBool(boolClosure) { + const callbackId = swift.memory.retain(boolClosure); + const ret = instance.exports.bjs_roundtripBool(callbackId); + return swift.memory.getObject(ret); + }, + roundtripFloat: function bjs_roundtripFloat(floatClosure) { + const callbackId = swift.memory.retain(floatClosure); + const ret = instance.exports.bjs_roundtripFloat(callbackId); + return swift.memory.getObject(ret); + }, + roundtripDouble: function bjs_roundtripDouble(doubleClosure) { + const callbackId = swift.memory.retain(doubleClosure); + const ret = instance.exports.bjs_roundtripDouble(callbackId); + return swift.memory.getObject(ret); + }, + roundtripOptionalString: function bjs_roundtripOptionalString(stringClosure) { + const callbackId = swift.memory.retain(stringClosure); + const ret = instance.exports.bjs_roundtripOptionalString(callbackId); + return swift.memory.getObject(ret); + }, + roundtripOptionalInt: function bjs_roundtripOptionalInt(intClosure) { + const callbackId = swift.memory.retain(intClosure); + const ret = instance.exports.bjs_roundtripOptionalInt(callbackId); + return swift.memory.getObject(ret); + }, + roundtripOptionalBool: function bjs_roundtripOptionalBool(boolClosure) { + const callbackId = swift.memory.retain(boolClosure); + const ret = instance.exports.bjs_roundtripOptionalBool(callbackId); + return swift.memory.getObject(ret); + }, + roundtripOptionalFloat: function bjs_roundtripOptionalFloat(floatClosure) { + const callbackId = swift.memory.retain(floatClosure); + const ret = instance.exports.bjs_roundtripOptionalFloat(callbackId); + return swift.memory.getObject(ret); + }, + roundtripOptionalDouble: function bjs_roundtripOptionalDouble(doubleClosure) { + const callbackId = swift.memory.retain(doubleClosure); + const ret = instance.exports.bjs_roundtripOptionalDouble(callbackId); + return swift.memory.getObject(ret); + }, + roundtripPerson: function bjs_roundtripPerson(personClosure) { const callbackId = swift.memory.retain(personClosure); - const ret = instance.exports.bjs_TestProcessor_roundtrip(this.pointer, callbackId); + const ret = instance.exports.bjs_roundtripPerson(callbackId); return swift.memory.getObject(ret); - } - roundtripOptional(personClosure) { + }, + roundtripOptionalPerson: function bjs_roundtripOptionalPerson(personClosure) { const callbackId = swift.memory.retain(personClosure); - const ret = instance.exports.bjs_TestProcessor_roundtripOptional(this.pointer, callbackId); + const ret = instance.exports.bjs_roundtripOptionalPerson(callbackId); return swift.memory.getObject(ret); - } - processDirection(callback) { + }, + roundtripDirection: function bjs_roundtripDirection(callback) { const callbackId = swift.memory.retain(callback); - instance.exports.bjs_TestProcessor_processDirection(this.pointer, callbackId); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } - processTheme(callback) { - const callbackId = swift.memory.retain(callback); - instance.exports.bjs_TestProcessor_processTheme(this.pointer, callbackId); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } - processHttpStatus(callback) { + const ret = instance.exports.bjs_roundtripDirection(callbackId); + return swift.memory.getObject(ret); + }, + roundtripTheme: function bjs_roundtripTheme(callback) { const callbackId = swift.memory.retain(callback); - const ret = instance.exports.bjs_TestProcessor_processHttpStatus(this.pointer, callbackId); - return ret; - } - processAPIResult(callback) { + const ret = instance.exports.bjs_roundtripTheme(callbackId); + return swift.memory.getObject(ret); + }, + roundtripHttpStatus: function bjs_roundtripHttpStatus(callback) { const callbackId = swift.memory.retain(callback); - instance.exports.bjs_TestProcessor_processAPIResult(this.pointer, callbackId); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } - makeDirectionChecker() { - const ret = instance.exports.bjs_TestProcessor_makeDirectionChecker(this.pointer); + const ret = instance.exports.bjs_roundtripHttpStatus(callbackId); return swift.memory.getObject(ret); - } - makeThemeValidator() { - const ret = instance.exports.bjs_TestProcessor_makeThemeValidator(this.pointer); + }, + roundtripAPIResult: function bjs_roundtripAPIResult(callback) { + const callbackId = swift.memory.retain(callback); + const ret = instance.exports.bjs_roundtripAPIResult(callbackId); return swift.memory.getObject(ret); - } - makeStatusCodeExtractor() { - const ret = instance.exports.bjs_TestProcessor_makeStatusCodeExtractor(this.pointer); + }, + roundtripOptionalDirection: function bjs_roundtripOptionalDirection(callback) { + const callbackId = swift.memory.retain(callback); + const ret = instance.exports.bjs_roundtripOptionalDirection(callbackId); return swift.memory.getObject(ret); - } - makeAPIResultHandler() { - const ret = instance.exports.bjs_TestProcessor_makeAPIResultHandler(this.pointer); + }, + roundtripOptionalTheme: function bjs_roundtripOptionalTheme(callback) { + const callbackId = swift.memory.retain(callback); + const ret = instance.exports.bjs_roundtripOptionalTheme(callbackId); return swift.memory.getObject(ret); - } - processOptionalDirection(callback) { + }, + roundtripOptionalHttpStatus: function bjs_roundtripOptionalHttpStatus(callback) { const callbackId = swift.memory.retain(callback); - instance.exports.bjs_TestProcessor_processOptionalDirection(this.pointer, callbackId); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } - processOptionalTheme(callback) { + const ret = instance.exports.bjs_roundtripOptionalHttpStatus(callbackId); + return swift.memory.getObject(ret); + }, + roundtripOptionalAPIResult: function bjs_roundtripOptionalAPIResult(callback) { const callbackId = swift.memory.retain(callback); - instance.exports.bjs_TestProcessor_processOptionalTheme(this.pointer, callbackId); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } - processOptionalAPIResult(callback) { + const ret = instance.exports.bjs_roundtripOptionalAPIResult(callbackId); + return swift.memory.getObject(ret); + }, + roundtripOptionalDirection: function bjs_roundtripOptionalDirection(callback) { const callbackId = swift.memory.retain(callback); - instance.exports.bjs_TestProcessor_processOptionalAPIResult(this.pointer, callbackId); - const ret = tmpRetString; - tmpRetString = undefined; - return ret; - } - makeOptionalDirectionFormatter() { - const ret = instance.exports.bjs_TestProcessor_makeOptionalDirectionFormatter(this.pointer); + const ret = instance.exports.bjs_roundtripOptionalDirection(callbackId); return swift.memory.getObject(ret); - } - } - const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(); - enumHelpers.APIResult = APIResultHelpers; - - const exports = { - Person, - TestProcessor, + }, Direction: DirectionValues, Theme: ThemeValues, HttpStatus: HttpStatusValues, From d9adac0230dd96dfbb07d07bc14b0433e13718b5 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 10:28:46 +0900 Subject: [PATCH 175/252] [NFC] Fix warnings (#603) * [NFC] BridgeJS: Fix unused variable warning in BridgeJSCommandPlugin.swift * [NFC] JavaScriptEventLoop: Fix warnings for undeclared SPI usage --- .../Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift | 1 - .../JavaScriptEventLoop+ExecutorFactory.swift | 4 ++++ Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift b/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift index 3dce62578..a45a06188 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift @@ -98,7 +98,6 @@ extension BridgeJSCommandPlugin.Context { printStderr("Generating bridge code for \(target.name)...") let generatedDirectory = target.directoryURL.appending(path: "Generated") - let generatedJavaScriptDirectory = generatedDirectory.appending(path: "JavaScript") let bridgeDtsPath = target.directoryURL.appending(path: "bridge-js.d.ts") let tsconfigPath = context.package.directoryURL.appending(path: "tsconfig.json") diff --git a/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift b/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift index d31e03597..7de4cb74a 100644 --- a/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift +++ b/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift @@ -4,7 +4,11 @@ // See: https://github.com/swiftlang/swift/pull/80266 // See: https://forums.swift.org/t/pitch-2-custom-main-and-global-executors/78437 +#if compiler(>=6.3) @_spi(ExperimentalCustomExecutors) import _Concurrency +#else +import _Concurrency +#endif import _CJavaScriptKit #if compiler(>=6.3) diff --git a/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift b/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift index 4b4115602..aebc90d65 100644 --- a/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift +++ b/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift @@ -1,5 +1,9 @@ import JavaScriptKit +#if compiler(>=6.3) @_spi(ExperimentalCustomExecutors) import _Concurrency +#else +import _Concurrency +#endif import _CJavaScriptEventLoop import _CJavaScriptKit From f2bf525e0f5ce52f706c016aba815ac0f1857bfe Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 10:36:49 +0900 Subject: [PATCH 176/252] BridgeJS: Support `@JS class` in imported function signatures (#601) --- .../Sources/BridgeJSCore/ImportTS.swift | 28 ++----------- .../Sources/BridgeJSLink/JSGlueGen.swift | 22 ++--------- .../Inputs/MacroSwift/SwiftClass.swift | 2 + .../BridgeJSCodegenTests/SwiftClass.json | 29 ++++++++++++++ .../BridgeJSCodegenTests/SwiftClass.swift | 20 +++++++++- .../BridgeJSLinkTests/Protocol.js | 2 +- .../BridgeJSLinkTests/SwiftClass.d.ts | 1 + .../BridgeJSLinkTests/SwiftClass.js | 11 ++++++ .../Generated/BridgeJS.swift | 18 +++++++++ .../Generated/JavaScript/BridgeJS.json | 39 +++++++++++++++++++ .../JavaScript/SwiftClassSupportTests.mjs | 10 +++++ .../SwiftClassSupportTests.swift | 13 +++++++ Tests/prelude.mjs | 2 + 13 files changed, 153 insertions(+), 44 deletions(-) create mode 100644 Tests/BridgeJSRuntimeTests/JavaScript/SwiftClassSupportTests.mjs create mode 100644 Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 0424d8ca0..08366abf3 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -957,18 +957,8 @@ extension BridgeType { return LoweringParameterInfo(loweredParameters: [("funcRef", .i32)]) case .unsafePointer: return LoweringParameterInfo(loweredParameters: [("pointer", .pointer)]) - case .swiftHeapObject(let className): - switch context { - case .importTS: - throw BridgeJSCoreError( - """ - swiftHeapObject '\(className)' is not supported in TypeScript imports. - Swift classes can only be used in @JS protocols where Swift owns the instance. - """ - ) - case .exportSwift: - return LoweringParameterInfo(loweredParameters: [("pointer", .pointer)]) - } + case .swiftHeapObject: + return LoweringParameterInfo(loweredParameters: [("pointer", .pointer)]) case .swiftProtocol: throw BridgeJSCoreError("swiftProtocol is not supported in imported signatures") case .caseEnum: @@ -1038,18 +1028,8 @@ extension BridgeType { return LiftingReturnInfo(valueToLift: .i32) case .unsafePointer: return LiftingReturnInfo(valueToLift: .pointer) - case .swiftHeapObject(let className): - switch context { - case .importTS: - throw BridgeJSCoreError( - """ - swiftHeapObject '\(className)' cannot be returned from imported TypeScript functions. - JavaScript cannot create Swift heap objects. - """ - ) - case .exportSwift: - return LiftingReturnInfo(valueToLift: .pointer) - } + case .swiftHeapObject: + return LiftingReturnInfo(valueToLift: .pointer) case .swiftProtocol: throw BridgeJSCoreError("swiftProtocol is not supported in imported signatures") case .caseEnum: diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index dec77b3cb..68230e8d1 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -581,7 +581,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["pointer"], printCode: { arguments, scope, printer, cleanupCode in - return ["\(name).__construct(\(arguments[0]))"] + return ["_exports['\(name)'].__construct(\(arguments[0]))"] } ) } @@ -1985,14 +1985,7 @@ struct IntrinsicJSFragment: Sendable { case .jsValue: return .jsValueLiftParameter case .unsafePointer: return .identity case .swiftHeapObject(let name): - switch context { - case .importTS: - throw BridgeJSLinkError( - message: "swiftHeapObject '\(name)' can only be used in protocol exports, not in \(context)" - ) - case .exportSwift: - return .swiftHeapObjectLiftParameter(name) - } + return .swiftHeapObjectLiftParameter(name) case .swiftProtocol: return .jsObjectLiftParameter case .void: throw BridgeJSLinkError( @@ -2074,15 +2067,8 @@ struct IntrinsicJSFragment: Sendable { case .jsObject: return .jsObjectLowerReturn case .jsValue: return .jsValueLowerReturn(context: context) case .unsafePointer: return .identity - case .swiftHeapObject(let name): - switch context { - case .importTS: - throw BridgeJSLinkError( - message: "swiftHeapObject '\(name)' can only be used in protocol exports, not in \(context)" - ) - case .exportSwift: - return .swiftHeapObjectLowerReturn - } + case .swiftHeapObject: + return .swiftHeapObjectLowerReturn case .swiftProtocol: return .jsObjectLowerReturn case .void: return .void case .nullable(let wrappedType, let kind): diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift index 116b00878..aa520783a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift @@ -18,3 +18,5 @@ @JS public class PublicGreeter {} @JS package class PackageGreeter {} + +@JSFunction func jsRoundTripGreeter(greeter: Greeter) throws(JSException) -> Greeter diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.json index 9fe717651..d1bf42cff 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.json @@ -141,5 +141,34 @@ ] }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "jsRoundTripGreeter", + "parameters" : [ + { + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "types" : [ + + ] + } + ] + }, "moduleName" : "TestModule" } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift index 216dfc684..581d6f1c0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift @@ -134,4 +134,22 @@ fileprivate func _bjs_PackageGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> fileprivate func _bjs_PackageGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_jsRoundTripGreeter") +fileprivate func bjs_jsRoundTripGreeter(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +#else +fileprivate func bjs_jsRoundTripGreeter(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripGreeter(_ greeter: Greeter) throws(JSException) -> Greeter { + let greeterPointer = greeter.bridgeJSLowerParameter() + let ret = bjs_jsRoundTripGreeter(greeterPointer) + if let error = _swift_js_take_exception() { + throw error + } + return Greeter.bridgeJSLiftReturn(ret) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 57587d84a..00b9626e3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -513,7 +513,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_onHelperUpdated"] = function bjs_MyViewControllerDelegate_onHelperUpdated(self, helper) { try { - swift.memory.getObject(self).onHelperUpdated(Helper.__construct(helper)); + swift.memory.getObject(self).onHelperUpdated(_exports['Helper'].__construct(helper)); } catch (error) { setException(error); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts index 8718463a9..d3461f8c1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts @@ -31,6 +31,7 @@ export type Exports = { takeGreeter(greeter: Greeter): void; } export type Imports = { + jsRoundTripGreeter(greeter: Greeter): Greeter; } export function createInstantiator(options: { imports: Imports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index 6002d190f..eaa5d7720 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -38,6 +38,7 @@ export async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { bjs = {}; importObject["bjs"] = bjs; + const imports = options.getImports(importsContext); bjs["swift_js_return_string"] = function(ptr, len) { const bytes = new Uint8Array(memory.buffer, ptr, len); tmpRetString = textDecoder.decode(bytes); @@ -214,6 +215,16 @@ export async function createInstantiator(options, swift) { const obj = PublicGreeter.__construct(pointer); return swift.memory.retain(obj); }; + const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; + TestModule["bjs_jsRoundTripGreeter"] = function bjs_jsRoundTripGreeter(greeter) { + try { + let ret = imports.jsRoundTripGreeter(_exports['Greeter'].__construct(greeter)); + return ret.pointer; + } catch (error) { + setException(error); + return 0 + } + } }, setInstance: (i) => { instance = i; diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 163c9e479..1feb3eed6 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -10666,4 +10666,22 @@ func _$jsRoundTripOptionalStringUndefined(_ name: JSUndefinedOr) throws( throw error } return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftClassSupportImports_jsRoundTripGreeter_static") +fileprivate func bjs_SwiftClassSupportImports_jsRoundTripGreeter_static(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +#else +fileprivate func bjs_SwiftClassSupportImports_jsRoundTripGreeter_static(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif + +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) } \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 23f47b03d..de7ab4a5d 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -15310,6 +15310,45 @@ "types" : [ ] + }, + { + "functions" : [ + + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "SwiftClassSupportImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "name" : "jsRoundTripGreeter", + "parameters" : [ + { + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ] + } + ] } ] }, diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/SwiftClassSupportTests.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/SwiftClassSupportTests.mjs new file mode 100644 index 000000000..fdb5d498d --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/JavaScript/SwiftClassSupportTests.mjs @@ -0,0 +1,10 @@ +/** + * @returns {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Imports["SwiftClassSupportImports"]} + */ +export function getImports(importsContext) { + return { + jsRoundTripGreeter: (greeter) => { + return greeter; + }, + }; +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift b/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift new file mode 100644 index 000000000..3cee17554 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift @@ -0,0 +1,13 @@ +import XCTest +@_spi(Experimental) import JavaScriptKit + +@JSClass struct SwiftClassSupportImports { + @JSFunction static func jsRoundTripGreeter(_ greeter: Greeter) throws(JSException) -> Greeter +} + +final class SwiftClassSupportTests: XCTestCase { + func testRoundTripGreeter() throws { + let greeter = try SwiftClassSupportImports.jsRoundTripGreeter(Greeter(name: "Hello")) + XCTAssertEqual(greeter.name, "Hello") + } +} diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 95573b34e..efb168a6d 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -6,6 +6,7 @@ import { import { ImportedFoo } from './BridgeJSRuntimeTests/JavaScript/Types.mjs'; import { runJsOptionalSupportTests } from './BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs'; import { getImports as getClosureSupportImports } from './BridgeJSRuntimeTests/JavaScript/ClosureSupportTests.mjs'; +import { getImports as getSwiftClassSupportImports } from './BridgeJSRuntimeTests/JavaScript/SwiftClassSupportTests.mjs'; /** @type {import('../.build/plugins/PackageToJS/outputs/PackageTests/test.d.ts').SetupOptionsFn} */ export async function setupOptions(options, context) { @@ -213,6 +214,7 @@ export async function setupOptions(options, context) { runJsOptionalSupportTests(exports); }, ClosureSupportImports: getClosureSupportImports(importsContext), + SwiftClassSupportImports: getSwiftClassSupportImports(importsContext), }; }, addToCoreImports(importObject, importsContext) { From 3a22f4d4d443e4f520c61c2a0460a699720df561 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 10:57:19 +0900 Subject: [PATCH 177/252] BridgeJS: Add profiling instrumentation (#604) --- .../Sources/BridgeJSCore/ClosureCodegen.swift | 6 +- .../Sources/BridgeJSCore/ExportSwift.swift | 64 +++++----- .../Sources/BridgeJSCore/ImportTS.swift | 30 +++-- .../BridgeJS/Sources/BridgeJSCore/Misc.swift | 115 ++++++++++++++++++ .../Sources/BridgeJSTool/BridgeJSTool.swift | 102 ++++++++++------ 5 files changed, 236 insertions(+), 81 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift index 12e4a413c..3ec0418b3 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift @@ -328,7 +328,9 @@ public struct ClosureCodegen { decls.append(try renderClosureInvokeHandler(signature)) } - let format = BasicFormat() - return decls.map { $0.formatted(using: format).description }.joined(separator: "\n\n") + return withSpan("Format Closure Glue") { + let format = BasicFormat() + return decls.map { $0.formatted(using: format).description }.joined(separator: "\n\n") + } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index acff21847..70ed8f8a8 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -47,45 +47,53 @@ public class ExportSwift { func renderSwiftGlue() throws -> String? { var decls: [DeclSyntax] = [] - let protocolCodegen = ProtocolCodegen() - for proto in skeleton.protocols { - decls.append(contentsOf: try protocolCodegen.renderProtocolWrapper(proto, moduleName: moduleName)) + try withSpan("Render Protocols") { [self] in + let protocolCodegen = ProtocolCodegen() + for proto in skeleton.protocols { + decls.append(contentsOf: try protocolCodegen.renderProtocolWrapper(proto, moduleName: moduleName)) + } } - let enumCodegen = EnumCodegen() - for enumDef in skeleton.enums { - if let enumHelpers = enumCodegen.renderEnumHelpers(enumDef) { - decls.append(enumHelpers) - } + try withSpan("Render Enums") { [self] in + let enumCodegen = EnumCodegen() + for enumDef in skeleton.enums { + if let enumHelpers = enumCodegen.renderEnumHelpers(enumDef) { + decls.append(enumHelpers) + } - for staticMethod in enumDef.staticMethods { - decls.append(try renderSingleExportedFunction(function: staticMethod)) - } + for staticMethod in enumDef.staticMethods { + decls.append(try renderSingleExportedFunction(function: staticMethod)) + } - for staticProperty in enumDef.staticProperties { - decls.append( - contentsOf: try renderSingleExportedProperty( - property: staticProperty, - context: .enumStatic(enumDef: enumDef) + for staticProperty in enumDef.staticProperties { + decls.append( + contentsOf: try renderSingleExportedProperty( + property: staticProperty, + context: .enumStatic(enumDef: enumDef) + ) ) - ) + } } } - let structCodegen = StructCodegen() - for structDef in skeleton.structs { - decls.append(contentsOf: structCodegen.renderStructHelpers(structDef)) - decls.append(contentsOf: try renderSingleExportedStruct(struct: structDef)) - } + try withSpan("Render Structs") { [self] in + let structCodegen = StructCodegen() + for structDef in skeleton.structs { + decls.append(contentsOf: structCodegen.renderStructHelpers(structDef)) + decls.append(contentsOf: try renderSingleExportedStruct(struct: structDef)) + } - for function in skeleton.functions { - decls.append(try renderSingleExportedFunction(function: function)) + for function in skeleton.functions { + decls.append(try renderSingleExportedFunction(function: function)) + } + for klass in skeleton.classes { + decls.append(contentsOf: try renderSingleExportedClass(klass: klass)) + } } - for klass in skeleton.classes { - decls.append(contentsOf: try renderSingleExportedClass(klass: klass)) + return withSpan("Format Export Glue") { + let format = BasicFormat() + return decls.map { $0.formatted(using: format).description }.joined(separator: "\n\n") } - let format = BasicFormat() - return decls.map { $0.formatted(using: format).description }.joined(separator: "\n\n") } class ExportedThunkBuilder { diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 08366abf3..d5cc945ee 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -32,17 +32,23 @@ public struct ImportTS { var decls: [DeclSyntax] = [] for skeleton in self.skeleton.children { - for getter in skeleton.globalGetters { - let getterDecls = try renderSwiftGlobalGetter(getter, topLevelDecls: &decls) - decls.append(contentsOf: getterDecls) + try withSpan("Render Global Getters") { + for getter in skeleton.globalGetters { + let getterDecls = try renderSwiftGlobalGetter(getter, topLevelDecls: &decls) + decls.append(contentsOf: getterDecls) + } } - for function in skeleton.functions { - let thunkDecls = try renderSwiftThunk(function, topLevelDecls: &decls) - decls.append(contentsOf: thunkDecls) + try withSpan("Render Functions") { + for function in skeleton.functions { + let thunkDecls = try renderSwiftThunk(function, topLevelDecls: &decls) + decls.append(contentsOf: thunkDecls) + } } - for type in skeleton.types { - let typeDecls = try renderSwiftType(type, topLevelDecls: &decls) - decls.append(contentsOf: typeDecls) + try withSpan("Render Types") { + for type in skeleton.types { + let typeDecls = try renderSwiftType(type, topLevelDecls: &decls) + decls.append(contentsOf: typeDecls) + } } } if decls.isEmpty { @@ -50,8 +56,10 @@ public struct ImportTS { return nil } - let format = BasicFormat() - return decls.map { $0.formatted(using: format).description }.joined(separator: "\n\n") + return withSpan("Format Import Glue") { + let format = BasicFormat() + return decls.map { $0.formatted(using: format).description }.joined(separator: "\n\n") + } } func renderSwiftGlobalGetter( diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift index e11bd4058..70dae3a82 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift @@ -1,3 +1,12 @@ +import class Foundation.FileHandle +import class Foundation.ProcessInfo +import func Foundation.open +import func Foundation.strerror +import var Foundation.errno +import var Foundation.O_WRONLY +import var Foundation.O_CREAT +import var Foundation.O_TRUNC + // MARK: - ProgressReporting public struct ProgressReporting { @@ -20,6 +29,112 @@ public struct ProgressReporting { } } +// MARK: - Profiling + +/// A simple time-profiler to emit `chrome://tracing` format +public final class Profiling { + nonisolated(unsafe) static var current: Profiling? + + let startTime: ContinuousClock.Instant + let clock = ContinuousClock() + let output: @Sendable (String) -> Void + var firstEntry = true + + init(output: @Sendable @escaping (String) -> Void) { + self.startTime = ContinuousClock.now + self.output = output + } + + public static func with(body: @escaping () throws -> Void) rethrows -> Void { + guard let outputPath = ProcessInfo.processInfo.environment["BRIDGE_JS_PROFILING"] else { + return try body() + } + let fd = open(outputPath, O_WRONLY | O_CREAT | O_TRUNC, 0o644) + guard fd >= 0 else { + let error = String(cString: strerror(errno)) + fatalError("Failed to open profiling output file \(outputPath): \(error)") + } + let output = FileHandle(fileDescriptor: fd, closeOnDealloc: true) + let profiling = Profiling(output: { output.write($0.data(using: .utf8) ?? Data()) }) + defer { + profiling.output("]\n") + } + Profiling.current = profiling + defer { + Profiling.current = nil + } + return try body() + } + + private func formatTimestamp(instant: ContinuousClock.Instant) -> Int { + let duration = self.startTime.duration(to: instant) + let (seconds, attoseconds) = duration.components + // Convert to microseconds + return Int(seconds * 1_000_000 + attoseconds / 1_000_000_000_000) + } + + func begin(_ label: String, _ instant: ContinuousClock.Instant) { + let entry = #"{"ph":"B","pid":1,"name":\#(JSON.serialize(label)),"ts":\#(formatTimestamp(instant: instant))}"# + if firstEntry { + firstEntry = false + output("[\n\(entry)") + } else { + output(",\n\(entry)") + } + } + + func end(_ label: String, _ instant: ContinuousClock.Instant) { + let entry = #"{"ph":"E","pid":1,"name":\#(JSON.serialize(label)),"ts":\#(formatTimestamp(instant: instant))}"# + output(",\n\(entry)") + } +} + +/// Mark a span of code with a label and measure the duration. +public func withSpan(_ label: String, body: @escaping () throws -> T) rethrows -> T { + guard let profiling = Profiling.current else { + return try body() + } + profiling.begin(label, profiling.clock.now) + defer { + profiling.end(label, profiling.clock.now) + } + return try body() +} + +/// Foundation-less JSON serialization +private enum JSON { + static func serialize(_ value: String) -> String { + // https://www.ietf.org/rfc/rfc4627.txt + var output = "\"" + for scalar in value.unicodeScalars { + switch scalar { + case "\"": + output += "\\\"" + case "\\": + output += "\\\\" + case "\u{08}": + output += "\\b" + case "\u{0C}": + output += "\\f" + case "\n": + output += "\\n" + case "\r": + output += "\\r" + case "\t": + output += "\\t" + case "\u{20}"..."\u{21}", "\u{23}"..."\u{5B}", "\u{5D}"..."\u{10FFFF}": + output.unicodeScalars.append(scalar) + default: + var hex = String(scalar.value, radix: 16, uppercase: true) + hex = String(repeating: "0", count: 4 - hex.count) + hex + output += "\\u" + hex + } + } + output += "\"" + return output + } +} + // MARK: - DiagnosticError import SwiftSyntax diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index 92e74e621..f9fa56c42 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -50,7 +50,9 @@ import BridgeJSUtilities static func main() throws { do { - try run() + try Profiling.with { + try run() + } } catch { printStderr("error: \(error)") exit(1) @@ -121,18 +123,22 @@ import BridgeJSUtilities let bridgeJSMacrosPath = outputDirectory.appending(path: "BridgeJS.Macros.swift") let primaryDtsPath = hasDts ? bridgeJsDtsPath.path : bridgeJsGlobalDtsPath.path let globalDtsFiles = (hasDts && hasGlobalDts) ? [bridgeJsGlobalDtsPath.path] : [] - _ = try invokeTS2Swift( - dtsFile: primaryDtsPath, - globalDtsFiles: globalDtsFiles, - tsconfigPath: tsconfigPath, - nodePath: nodePath, - progress: progress, - outputPath: bridgeJSMacrosPath.path - ) + try withSpan("invokeTS2Swift") { + _ = try invokeTS2Swift( + dtsFile: primaryDtsPath, + globalDtsFiles: globalDtsFiles, + tsconfigPath: tsconfigPath, + nodePath: nodePath, + progress: progress, + outputPath: bridgeJSMacrosPath.path + ) + } generatedMacrosPath = bridgeJSMacrosPath.path } - var inputFiles = inputSwiftFiles(targetDirectory: targetDirectory, positionalArguments: positionalArguments) + var inputFiles = withSpan("Collecting Swift files") { + return inputSwiftFiles(targetDirectory: targetDirectory, positionalArguments: positionalArguments) + } // BridgeJS.Macros.swift contains imported declarations (@JSFunction, @JSClass, etc.) that need // to be processed by SwiftToSkeleton to populate the imported skeleton. The command plugin // filters out Generated/ files, so we explicitly add it here after generation. @@ -148,22 +154,28 @@ import BridgeJSUtilities exposeToGlobal: config.exposeToGlobal ) for inputFile in inputFiles.sorted() { - let inputURL = URL(fileURLWithPath: inputFile) - // Skip directories (e.g. .docc catalogs included in target.sourceFiles) - var isDirectory: ObjCBool = false - if FileManager.default.fileExists(atPath: inputFile, isDirectory: &isDirectory), isDirectory.boolValue { - continue + try withSpan("Parsing \(inputFile)") { + let inputURL = URL(fileURLWithPath: inputFile) + // Skip directories (e.g. .docc catalogs included in target.sourceFiles) + var isDirectory: ObjCBool = false + if FileManager.default.fileExists(atPath: inputFile, isDirectory: &isDirectory), + isDirectory.boolValue + { + return + } + let content = try String(contentsOf: inputURL, encoding: .utf8) + if hasBridgeJSSkipComment(content) { + return + } + + let sourceFile = Parser.parse(source: content) + swiftToSkeleton.addSourceFile(sourceFile, inputFilePath: inputFile) } - let content = try String(contentsOf: inputURL, encoding: .utf8) - if hasBridgeJSSkipComment(content) { - continue - } - - let sourceFile = Parser.parse(source: content) - swiftToSkeleton.addSourceFile(sourceFile, inputFilePath: inputFile) } - let skeleton = try swiftToSkeleton.finalize() + let skeleton = try withSpan("SwiftToSkeleton.finalize") { + return try swiftToSkeleton.finalize() + } var exporter: ExportSwift? if let skeleton = skeleton.exported { @@ -183,10 +195,16 @@ import BridgeJSUtilities } // Generate unified closure support for both import/export to avoid duplicate symbols when concatenating. - let closureSupport = try ClosureCodegen().renderSupport(for: skeleton) + let closureSupport = try withSpan("ClosureCodegen.renderSupport") { + return try ClosureCodegen().renderSupport(for: skeleton) + } - let importResult = try importer?.finalize() - let exportResult = try exporter?.finalize() + let importResult = try withSpan("ImportTS.finalize") { + return try importer?.finalize() + } + let exportResult = try withSpan("ExportSwift.finalize") { + return try exporter?.finalize() + } // Combine and write unified Swift output let outputSwiftURL = outputDirectory.appending(path: "BridgeJS.swift") @@ -194,26 +212,30 @@ import BridgeJSUtilities let outputSwift = combineGeneratedSwift(combinedSwift) let shouldWrite = doubleDashOptions["always-write"] == "true" || !outputSwift.isEmpty if shouldWrite { + try withSpan("Writing output Swift") { + try FileManager.default.createDirectory( + at: outputSwiftURL.deletingLastPathComponent(), + withIntermediateDirectories: true, + attributes: nil + ) + try outputSwift.write(to: outputSwiftURL, atomically: true, encoding: .utf8) + } + } + + // Write unified skeleton + let outputSkeletonURL = outputDirectory.appending(path: "JavaScript/BridgeJS.json") + try withSpan("Writing output skeleton") { try FileManager.default.createDirectory( - at: outputSwiftURL.deletingLastPathComponent(), + at: outputSkeletonURL.deletingLastPathComponent(), withIntermediateDirectories: true, attributes: nil ) - try outputSwift.write(to: outputSwiftURL, atomically: true, encoding: .utf8) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys] + let skeletonData = try encoder.encode(skeleton) + try skeletonData.write(to: outputSkeletonURL) } - // Write unified skeleton - let outputSkeletonURL = outputDirectory.appending(path: "JavaScript/BridgeJS.json") - try FileManager.default.createDirectory( - at: outputSkeletonURL.deletingLastPathComponent(), - withIntermediateDirectories: true, - attributes: nil - ) - let encoder = JSONEncoder() - encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - let skeletonData = try encoder.encode(skeleton) - try skeletonData.write(to: outputSkeletonURL) - if skeleton.exported != nil || skeleton.imported != nil { progress.print("Generated BridgeJS code") } From 788ad44af6b3e327122f379a445fda7c4d10cc16 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 11:00:49 +0900 Subject: [PATCH 178/252] [NFC] BridgeJS: Make JSGlueGen and IntrinsicJSFragment methods throwable Instead of crashing on errors in JS code generation for BridgeJSLink, we should prefer propagating errors. --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 77 +++--- .../BridgeJSLink/CodeFragmentPrinter.swift | 4 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 257 +++++++++--------- 3 files changed, 173 insertions(+), 165 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 13ea4e910..d1f8363d2 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -261,11 +261,11 @@ public struct BridgeJSLink { ] } - private func generateAddImports(needsImportsObject: Bool) -> CodeFragmentPrinter { + private func generateAddImports(needsImportsObject: Bool) throws -> CodeFragmentPrinter { let printer = CodeFragmentPrinter() let allStructs = skeletons.compactMap { $0.exported?.structs }.flatMap { $0 } printer.write("return {") - printer.indent { + try printer.indent { printer.write(lines: [ "/**", " * @param {WebAssembly.Imports} importObject", @@ -273,7 +273,7 @@ public struct BridgeJSLink { "addImports: (importObject, importsContext) => {", ]) - printer.indent { + try printer.indent { printer.write(lines: [ "bjs = {};", "importObject[\"bjs\"] = bjs;", @@ -687,20 +687,21 @@ public struct BridgeJSLink { for signature in closureSignatures.sorted(by: { $0.mangleName < $1.mangleName }) { let invokeFuncName = "invoke_js_callback_\(moduleName)_\(signature.mangleName)" - printer.write( - lines: generateInvokeFunction( - signature: signature, - functionName: invokeFuncName - ) + let invokeLines = try generateInvokeFunction( + signature: signature, + functionName: invokeFuncName ) + printer.write(lines: invokeLines) let lowerFuncName = "lower_closure_\(moduleName)_\(signature.mangleName)" let makeFuncName = "make_swift_closure_\(moduleName)_\(signature.mangleName)" printer.write("bjs[\"\(makeFuncName)\"] = function(boxPtr, file, line) {") - printer.indent { - printer.write( - lines: generateLowerClosureFunction(signature: signature, functionName: lowerFuncName) + try printer.indent { + let lowerLines = try generateLowerClosureFunction( + signature: signature, + functionName: lowerFuncName ) + printer.write(lines: lowerLines) printer.write( "return \(JSGlueVariableScope.reservedMakeSwiftClosure)(boxPtr, file, line, \(lowerFuncName));" ) @@ -788,7 +789,7 @@ public struct BridgeJSLink { private func generateInvokeFunction( signature: ClosureSignature, functionName: String - ) -> [String] { + ) throws -> [String] { let printer = CodeFragmentPrinter() let scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) let cleanupCode = CodeFragmentPrinter() @@ -806,20 +807,20 @@ public struct BridgeJSLink { printer.nextLine() printer.write("bjs[\"\(functionName)\"] = function(\(invokeParams.joined(separator: ", "))) {") - printer.indent { + try printer.indent { printer.write("try {") - printer.indent { + try printer.indent { printer.write("const callback = \(JSGlueVariableScope.reservedSwift).memory.getObject(callbackId);") for (index, paramType) in signature.parameters.enumerated() { - let fragment = try! IntrinsicJSFragment.closureLiftParameter(type: paramType) + let fragment = try IntrinsicJSFragment.closureLiftParameter(type: paramType) let args: [String] if case .nullable = paramType { args = ["param\(index)IsSome", "param\(index)Value", "param\(index)"] } else { args = ["param\(index)Id", "param\(index)"] } - _ = fragment.printCode(args, scope, printer, cleanupCode) + _ = try fragment.printCode(args, scope, printer, cleanupCode) } let callbackParams = signature.parameters.indices.map { "param\($0)" }.joined(separator: ", ") @@ -837,14 +838,14 @@ public struct BridgeJSLink { break } - let returnFragment = try! IntrinsicJSFragment.closureLowerReturn(type: signature.returnType) - _ = returnFragment.printCode(["result"], scope, printer, cleanupCode) + let returnFragment = try IntrinsicJSFragment.closureLowerReturn(type: signature.returnType) + _ = try returnFragment.printCode(["result"], scope, printer, cleanupCode) } printer.write("} catch (error) {") - printer.indent { + try printer.indent { printer.write("\(JSGlueVariableScope.reservedSetException)?.(error);") let errorFragment = IntrinsicJSFragment.closureErrorReturn(type: signature.returnType) - _ = errorFragment.printCode([], scope, printer, cleanupCode) + _ = try errorFragment.printCode([], scope, printer, cleanupCode) } printer.write("}") } @@ -857,7 +858,7 @@ public struct BridgeJSLink { private func generateLowerClosureFunction( signature: ClosureSignature, functionName: String - ) -> [String] { + ) throws -> [String] { let printer = CodeFragmentPrinter() let scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) let cleanupCode = CodeFragmentPrinter() @@ -865,13 +866,13 @@ public struct BridgeJSLink { printer.write( "const \(functionName) = function(\(signature.parameters.indices.map { "param\($0)" }.joined(separator: ", "))) {" ) - printer.indent { + try printer.indent { var invokeArgs: [String] = ["boxPtr"] for (index, paramType) in signature.parameters.enumerated() { let paramName = "param\(index)" - let fragment = try! IntrinsicJSFragment.lowerParameter(type: paramType) - let lowered = fragment.printCode([paramName], scope, printer, cleanupCode) + let fragment = try IntrinsicJSFragment.lowerParameter(type: paramType) + let lowered = try fragment.printCode([paramName], scope, printer, cleanupCode) invokeArgs.append(contentsOf: lowered) } @@ -894,8 +895,8 @@ public struct BridgeJSLink { } printer.write("}") - let returnFragment = try! IntrinsicJSFragment.closureLiftReturn(type: signature.returnType) - _ = returnFragment.printCode([invokeResultName], scope, printer, cleanupCode) + let returnFragment = try IntrinsicJSFragment.closureLiftReturn(type: signature.returnType) + _ = try returnFragment.printCode([invokeResultName], scope, printer, cleanupCode) } printer.write("};") @@ -1073,7 +1074,7 @@ public struct BridgeJSLink { // Main function declaration printer.write("export async function createInstantiator(options, \(JSGlueVariableScope.reservedSwift)) {") - printer.indent { + try printer.indent { printer.write(lines: generateVariableDeclarations()) let bodyPrinter = CodeFragmentPrinter() @@ -1083,7 +1084,7 @@ public struct BridgeJSLink { let structScope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) let structCleanup = CodeFragmentPrinter() let fragment = IntrinsicJSFragment.structHelper(structDefinition: structDef, allStructs: allStructs) - _ = fragment.printCode([structDef.name], structScope, structPrinter, structCleanup) + _ = try fragment.printCode([structDef.name], structScope, structPrinter, structCleanup) bodyPrinter.write(lines: structPrinter.lines) } @@ -1095,11 +1096,11 @@ public struct BridgeJSLink { let enumScope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) let enumCleanup = CodeFragmentPrinter() let fragment = IntrinsicJSFragment.associatedValueEnumHelperFactory(enumDefinition: enumDef) - _ = fragment.printCode([enumDef.valuesName], enumScope, enumPrinter, enumCleanup) + _ = try fragment.printCode([enumDef.valuesName], enumScope, enumPrinter, enumCleanup) bodyPrinter.write(lines: enumPrinter.lines) } bodyPrinter.nextLine() - bodyPrinter.write(contentsOf: generateAddImports(needsImportsObject: data.needsImportsObject)) + bodyPrinter.write(contentsOf: try generateAddImports(needsImportsObject: data.needsImportsObject)) if !intrinsicRegistry.isEmpty { printer.write(lines: intrinsicRegistry.emitLines()) @@ -1356,7 +1357,7 @@ public struct BridgeJSLink { loweringFragment.parameters.count == 1, "Lowering fragment should have exactly one parameter to lower" ) - let loweredValues = loweringFragment.printCode([param.name], scope, body, cleanupCode) + let loweredValues = try loweringFragment.printCode([param.name], scope, body, cleanupCode) parameterForwardings.append(contentsOf: loweredValues) } @@ -1388,7 +1389,7 @@ public struct BridgeJSLink { body.write("const \(returnVariable) = \(call);") fragmentArguments = [returnVariable] } - let liftedValues = liftingFragment.printCode(fragmentArguments, scope, body, cleanupCode) + let liftedValues = try liftingFragment.printCode(fragmentArguments, scope, body, cleanupCode) assert(liftedValues.count <= 1, "Lifting fragment should produce at most one value") return liftedValues.first } @@ -1646,7 +1647,7 @@ public struct BridgeJSLink { switch enumDefinition.enumType { case .simple: let fragment = IntrinsicJSFragment.simpleEnumHelper(enumDefinition: enumDefinition) - _ = fragment.printCode([enumValuesName], scope, printer, cleanup) + _ = try fragment.printCode([enumValuesName], scope, printer, cleanup) jsTopLevelLines.append(contentsOf: printer.lines) case .rawValue: guard enumDefinition.rawType != nil else { @@ -1654,11 +1655,11 @@ public struct BridgeJSLink { } let fragment = IntrinsicJSFragment.rawValueEnumHelper(enumDefinition: enumDefinition) - _ = fragment.printCode([enumValuesName], scope, printer, cleanup) + _ = try fragment.printCode([enumValuesName], scope, printer, cleanup) jsTopLevelLines.append(contentsOf: printer.lines) case .associatedValue: let fragment = IntrinsicJSFragment.associatedValueEnumValues(enumDefinition: enumDefinition) - _ = fragment.printCode([enumValuesName], scope, printer, cleanup) + _ = try fragment.printCode([enumValuesName], scope, printer, cleanup) jsTopLevelLines.append(contentsOf: printer.lines) case .namespace: break @@ -2252,7 +2253,7 @@ extension BridgeJSLink { valuesToLift = liftingFragment.parameters.map { scope.variable(param.name + $0.capitalizedFirstLetter) } parameterNames.append(contentsOf: valuesToLift) } - let liftedValues = liftingFragment.printCode(valuesToLift, scope, body, cleanupCode) + let liftedValues = try liftingFragment.printCode(valuesToLift, scope, body, cleanupCode) assert(liftedValues.count == 1, "Lifting fragment should produce exactly one value") parameterForwardings.append(contentsOf: liftedValues) } @@ -2362,7 +2363,7 @@ extension BridgeJSLink { ) let fragment = try IntrinsicJSFragment.protocolPropertyOptionalToSideChannel(wrappedType: wrappedType) - _ = fragment.printCode([resultVar], scope, body, cleanupCode) + _ = try fragment.printCode([resultVar], scope, body, cleanupCode) return nil // Side-channel types return nil (no direct return value) } @@ -2415,7 +2416,7 @@ extension BridgeJSLink { loweringFragment: IntrinsicJSFragment ) throws -> String? { assert(loweringFragment.parameters.count <= 1, "Lowering fragment should have at most one parameter") - let loweredValues = loweringFragment.printCode(returnExpr.map { [$0] } ?? [], scope, body, cleanupCode) + let loweredValues = try loweringFragment.printCode(returnExpr.map { [$0] } ?? [], scope, body, cleanupCode) assert(loweredValues.count <= 1, "Lowering fragment should produce at most one value") return loweredValues.first } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift index 8c5a47b23..4bad3dd34 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift @@ -6,10 +6,10 @@ final class JSIntrinsicRegistry { entries.isEmpty } - func register(name: String, build: (CodeFragmentPrinter) -> Void) { + func register(name: String, build: (CodeFragmentPrinter) throws -> Void) rethrows { guard entries[name] == nil else { return } let printer = CodeFragmentPrinter() - build(printer) + try build(printer) entries[name] = printer.lines } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 68230e8d1..9402cdd9d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -83,8 +83,8 @@ final class JSGlueVariableScope { return suffixedName } - func registerIntrinsic(_ name: String, build: (CodeFragmentPrinter) -> Void) { - intrinsicRegistry.register(name: name, build: build) + func registerIntrinsic(_ name: String, build: (CodeFragmentPrinter) throws -> Void) rethrows { + try intrinsicRegistry.register(name: name, build: build) } func makeChildScope() -> JSGlueVariableScope { @@ -162,7 +162,7 @@ struct IntrinsicJSFragment: Sendable { _ scope: JSGlueVariableScope, _ printer: CodeFragmentPrinter, _ cleanupCode: CodeFragmentPrinter - ) -> [String] + ) throws -> [String] /// A fragment that does nothing static let void = IntrinsicJSFragment( @@ -505,7 +505,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanupCode in - let lowered = jsValueLower.printCode(arguments, scope, printer, cleanupCode) + let lowered = try jsValueLower.printCode(arguments, scope, printer, cleanupCode) let kindVar = lowered[0] let payload1Var = lowered[1] let payload2Var = lowered[2] @@ -521,7 +521,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, scope, printer, cleanupCode in - let lowered = jsValueLower.printCode(arguments, scope, printer, cleanupCode) + let lowered = try jsValueLower.printCode(arguments, scope, printer, cleanupCode) let kindVar = lowered[0] let payload1Var = lowered[1] let payload2Var = lowered[2] @@ -627,7 +627,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["isSome", "kind", "payload1", "payload2"], printCode: { arguments, scope, printer, cleanupCode in let isSome = arguments[0] - let lifted = jsValueLiftParameter.printCode( + let lifted = try jsValueLiftParameter.printCode( [arguments[1], arguments[2], arguments[3]], scope, printer, @@ -723,9 +723,9 @@ struct IntrinsicJSFragment: Sendable { let arrayVar = scope.variable("arrayValue") printer.write("let \(arrayVar);") printer.write("if (\(isSome)) {") - printer.indent { - let arrayLiftFragment = try! arrayLift(elementType: elementType) - let liftResults = arrayLiftFragment.printCode([], scope, printer, cleanupCode) + try printer.indent { + let arrayLiftFragment = try arrayLift(elementType: elementType) + let liftResults = try arrayLiftFragment.printCode([], scope, printer, cleanupCode) if let liftResult = liftResults.first { printer.write("\(arrayVar) = \(liftResult);") } @@ -740,9 +740,9 @@ struct IntrinsicJSFragment: Sendable { let dictVar = scope.variable("dictValue") printer.write("let \(dictVar);") printer.write("if (\(isSome)) {") - printer.indent { - let dictLiftFragment = try! dictionaryLift(valueType: valueType) - let liftResults = dictLiftFragment.printCode([], scope, printer, cleanupCode) + try printer.indent { + let dictLiftFragment = try dictionaryLift(valueType: valueType) + let liftResults = try dictLiftFragment.printCode([], scope, printer, cleanupCode) if let liftResult = liftResults.first { printer.write("\(dictVar) = \(liftResult);") } @@ -805,7 +805,7 @@ struct IntrinsicJSFragment: Sendable { return ["+\(isSomeVar)", "\(isSomeVar) ? \(idVar) : 0", "\(isSomeVar) ? \(bytesVar).length : 0"] case .jsValue: - let lowered = jsValueLower.printCode([value], scope, printer, cleanupCode) + let lowered = try jsValueLower.printCode([value], scope, printer, cleanupCode) return ["+\(isSomeVar)"] + lowered case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName @@ -833,10 +833,10 @@ struct IntrinsicJSFragment: Sendable { let cleanupArrayVar = scope.variable("\(value)Cleanups") printer.write("const \(cleanupArrayVar) = [];") printer.write("if (\(isSomeVar)) {") - printer.indent { - let arrayLowerFragment = try! arrayLower(elementType: elementType) + try printer.indent { + let arrayLowerFragment = try arrayLower(elementType: elementType) let arrayCleanup = CodeFragmentPrinter() - let _ = arrayLowerFragment.printCode([value], scope, printer, arrayCleanup) + let _ = try arrayLowerFragment.printCode([value], scope, printer, arrayCleanup) if !arrayCleanup.lines.isEmpty { for line in arrayCleanup.lines { printer.write("\(cleanupArrayVar).push(() => { \(line) });") @@ -850,10 +850,10 @@ struct IntrinsicJSFragment: Sendable { let cleanupArrayVar = scope.variable("\(value)Cleanups") printer.write("const \(cleanupArrayVar) = [];") printer.write("if (\(isSomeVar)) {") - printer.indent { - let dictLowerFragment = try! dictionaryLower(valueType: valueType) + try printer.indent { + let dictLowerFragment = try dictionaryLower(valueType: valueType) let dictCleanup = CodeFragmentPrinter() - let _ = dictLowerFragment.printCode([value], scope, printer, dictCleanup) + let _ = try dictLowerFragment.printCode([value], scope, printer, dictCleanup) if !dictCleanup.lines.isEmpty { for line in dictCleanup.lines { printer.write("\(cleanupArrayVar).push(() => { \(line) });") @@ -1002,9 +1002,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("const \(isSomeVar) = \(scope.popI32());") printer.write("let \(resultVar);") printer.write("if (\(isSomeVar)) {") - printer.indent { - let arrayLiftFragment = try! arrayLift(elementType: elementType) - let liftResults = arrayLiftFragment.printCode([], scope, printer, cleanupCode) + try printer.indent { + let arrayLiftFragment = try arrayLift(elementType: elementType) + let liftResults = try arrayLiftFragment.printCode([], scope, printer, cleanupCode) if let liftResult = liftResults.first { printer.write("\(resultVar) = \(liftResult);") } @@ -1019,9 +1019,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("const \(isSomeVar) = \(scope.popI32());") printer.write("let \(resultVar);") printer.write("if (\(isSomeVar)) {") - printer.indent { - let dictLiftFragment = try! dictionaryLift(valueType: valueType) - let liftResults = dictLiftFragment.printCode([], scope, printer, cleanupCode) + try printer.indent { + let dictLiftFragment = try dictionaryLift(valueType: valueType) + let liftResults = try dictLiftFragment.printCode([], scope, printer, cleanupCode) if let liftResult = liftResults.first { printer.write("\(resultVar) = \(liftResult);") } @@ -1036,8 +1036,8 @@ struct IntrinsicJSFragment: Sendable { printer.write("const \(isSomeVar) = \(scope.popI32());") printer.write("let \(resultVar);") printer.write("if (\(isSomeVar)) {") - printer.indent { - let lifted = jsValueLift.printCode([], scope, printer, cleanupCode) + try printer.indent { + let lifted = try jsValueLift.printCode([], scope, printer, cleanupCode) if let liftedValue = lifted.first { printer.write("\(resultVar) = \(liftedValue);") } @@ -1111,7 +1111,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("bjs[\"swift_js_return_optional_object\"](\(isSomeVar) ? 1 : 0, \(idVar));") case .jsValue: if value != "undefined" { - let lowered = jsValueLower.printCode([value], scope, printer, cleanupCode) + let lowered = try jsValueLower.printCode([value], scope, printer, cleanupCode) let kindVar = lowered[0] let payload1Var = lowered[1] let payload2Var = lowered[2] @@ -1122,10 +1122,10 @@ struct IntrinsicJSFragment: Sendable { scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) case .array(let elementType): printer.write("if (\(isSomeVar)) {") - printer.indent { - let arrayLowerFragment = try! arrayLower(elementType: elementType) + try printer.indent { + let arrayLowerFragment = try arrayLower(elementType: elementType) let arrayCleanup = CodeFragmentPrinter() - let _ = arrayLowerFragment.printCode([value], scope, printer, arrayCleanup) + let _ = try arrayLowerFragment.printCode([value], scope, printer, arrayCleanup) if !arrayCleanup.lines.isEmpty { for line in arrayCleanup.lines { printer.write(line) @@ -1185,21 +1185,21 @@ struct IntrinsicJSFragment: Sendable { cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") case .dictionary(let valueType): printer.write("if (\(isSomeVar)) {") - printer.indent { + try printer.indent { let cleanupArrayVar = scope.variable("arrayCleanups") let entriesVar = scope.variable("entries") let entryVar = scope.variable("entry") printer.write("const \(cleanupArrayVar) = [];") printer.write("const \(entriesVar) = Object.entries(\(value));") printer.write("for (const \(entryVar) of \(entriesVar)) {") - printer.indent { + try printer.indent { let keyVar = scope.variable("key") let valueVar = scope.variable("value") printer.write("const [\(keyVar), \(valueVar)] = \(entryVar);") - let keyFragment = try! stackLowerFragment(elementType: .string) + let keyFragment = try stackLowerFragment(elementType: .string) let keyCleanup = CodeFragmentPrinter() - let _ = keyFragment.printCode([keyVar], scope, printer, keyCleanup) + let _ = try keyFragment.printCode([keyVar], scope, printer, keyCleanup) if !keyCleanup.lines.isEmpty { printer.write("\(cleanupArrayVar).push(() => {") printer.indent { @@ -1210,9 +1210,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("});") } - let valueFragment = try! stackLowerFragment(elementType: valueType) + let valueFragment = try stackLowerFragment(elementType: valueType) let valueCleanup = CodeFragmentPrinter() - let _ = valueFragment.printCode([valueVar], scope, printer, valueCleanup) + let _ = try valueFragment.printCode([valueVar], scope, printer, valueCleanup) if !valueCleanup.lines.isEmpty { printer.write("\(cleanupArrayVar).push(() => {") printer.indent { @@ -1302,7 +1302,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["value", "targetVar"], printCode: { arguments, scope, printer, cleanupCode in let baseFragment = boolLiftParameter - let lifted = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) printer.write("let \(arguments[1]) = \(lifted[0]);") return [] } @@ -1312,7 +1312,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["objectId", "targetVar"], printCode: { arguments, scope, printer, cleanupCode in let baseFragment = stringLiftParameter - let lifted = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) printer.write("let \(arguments[1]) = String(\(lifted[0]));") return [] } @@ -1324,7 +1324,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["objectId", "targetVar"], printCode: { arguments, scope, printer, cleanupCode in let baseFragment = stringLiftParameter - let lifted = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) printer.write("let \(arguments[1]) = String(\(lifted[0]));") return [] } @@ -1334,7 +1334,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["value", "targetVar"], printCode: { arguments, scope, printer, cleanupCode in let baseFragment = boolLiftParameter - let lifted = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) printer.write("let \(arguments[1]) = \(lifted[0]);") return [] } @@ -1494,7 +1494,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["result"], printCode: { arguments, scope, printer, cleanupCode in let baseFragment = boolLowerReturn - let lowered = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lowered = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) printer.write("return \(lowered[0]);") return [] } @@ -1520,7 +1520,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["result"], printCode: { arguments, scope, printer, cleanupCode in let baseFragment = stringLowerReturn - let lowered = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lowered = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) printer.write("return \(lowered[0]);") return [] } @@ -1530,7 +1530,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["result"], printCode: { arguments, scope, printer, cleanupCode in let baseFragment = jsObjectLowerReturn - let lowered = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lowered = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) printer.write("return \(lowered[0]);") return [] } @@ -1540,7 +1540,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["result"], printCode: { arguments, scope, printer, cleanupCode in let baseFragment = swiftHeapObjectLowerReturn - let lowered = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lowered = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) printer.write("return \(lowered[0]);") return [] } @@ -1552,7 +1552,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["result"], printCode: { arguments, scope, printer, cleanupCode in let baseFragment = stringLowerReturn - let lowered = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lowered = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) printer.write("return \(lowered[0]);") return [] } @@ -1562,7 +1562,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["result"], printCode: { arguments, scope, printer, cleanupCode in let baseFragment = boolLowerReturn - let lowered = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lowered = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) printer.write("return \(lowered[0]);") return [] } @@ -1697,7 +1697,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["invokeCall"], printCode: { arguments, scope, printer, cleanupCode in let baseFragment = boolLiftReturn - let lifted = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) printer.write("return \(lifted[0]);") return [] } @@ -1716,7 +1716,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanupCode in printer.write("const resultLen = \(arguments[0]);") let baseFragment = stringLiftReturn - let lifted = baseFragment.printCode([], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([], scope, printer, cleanupCode) printer.write("return \(lifted[0]);") return [] } @@ -1727,7 +1727,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanupCode in printer.write("const resultId = \(arguments[0]);") let baseFragment = jsObjectLiftReturn - let lifted = baseFragment.printCode(["resultId"], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode(["resultId"], scope, printer, cleanupCode) printer.write("return \(lifted[0]);") return [] } @@ -1763,7 +1763,7 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, scope, printer, cleanupCode in printer.write("const resultLen = \(arguments[0]);") let baseFragment = stringLiftReturn - let lifted = baseFragment.printCode([], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([], scope, printer, cleanupCode) printer.write("return \(lifted[0]);") return [] } @@ -1773,7 +1773,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["invokeCall"], printCode: { arguments, scope, printer, cleanupCode in let baseFragment = boolLiftReturn - let lifted = baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) printer.write("return \(lifted[0]);") return [] } @@ -1823,7 +1823,7 @@ struct IntrinsicJSFragment: Sendable { context: .importTS, kind: kind ) - let lifted = baseFragment.printCode([], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([], scope, printer, cleanupCode) if !lifted.isEmpty { printer.write("return \(lifted[0]);") } @@ -2186,10 +2186,10 @@ struct IntrinsicJSFragment: Sendable { // Generate lower function printer.write("lower: (value) => {") - printer.indent { + try printer.indent { printer.write("const enumTag = value.tag;") printer.write("switch (enumTag) {") - printer.indent { + try printer.indent { let lowerPrinter = CodeFragmentPrinter() for enumCase in enumDefinition.cases { let caseName = enumCase.name.capitalizedFirstLetter @@ -2197,7 +2197,12 @@ struct IntrinsicJSFragment: Sendable { let caseCleanup = CodeFragmentPrinter() caseCleanup.indent() let fragment = IntrinsicJSFragment.associatedValuePushPayload(enumCase: enumCase) - _ = fragment.printCode(["value", enumName, caseName], caseScope, lowerPrinter, caseCleanup) + _ = try fragment.printCode( + ["value", enumName, caseName], + caseScope, + lowerPrinter, + caseCleanup + ) } for line in lowerPrinter.lines { @@ -2214,10 +2219,10 @@ struct IntrinsicJSFragment: Sendable { printer.write( "lift: (tag) => {" ) - printer.indent { + try printer.indent { printer.write("tag = tag | 0;") printer.write("switch (tag) {") - printer.indent { + try printer.indent { let liftPrinter = CodeFragmentPrinter() for enumCase in enumDefinition.cases { let caseName = enumCase.name.capitalizedFirstLetter @@ -2225,7 +2230,7 @@ struct IntrinsicJSFragment: Sendable { let caseCleanup = CodeFragmentPrinter() let fragment = IntrinsicJSFragment.associatedValuePopPayload(enumCase: enumCase) - _ = fragment.printCode([enumName, caseName], caseScope, liftPrinter, caseCleanup) + _ = try fragment.printCode([enumName, caseName], caseScope, liftPrinter, caseCleanup) } for line in liftPrinter.lines { @@ -2306,7 +2311,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("case \(enumName).Tag.\(caseName): {") - printer.indent { + try printer.indent { if enumCase.associatedValues.isEmpty { printer.write("const cleanup = undefined;") printer.write("return { caseId: \(enumName).Tag.\(caseName), cleanup };") @@ -2316,9 +2321,11 @@ struct IntrinsicJSFragment: Sendable { for (associatedValueIndex, associatedValue) in reversedValues { let prop = associatedValue.label ?? "param\(associatedValueIndex)" - let fragment = IntrinsicJSFragment.associatedValuePushPayload(type: associatedValue.type) + let fragment = try IntrinsicJSFragment.associatedValuePushPayload( + type: associatedValue.type + ) - _ = fragment.printCode(["value.\(prop)"], scope, printer, cleanup) + _ = try fragment.printCode(["value.\(prop)"], scope, printer, cleanup) } if cleanup.lines.isEmpty { @@ -2355,9 +2362,9 @@ struct IntrinsicJSFragment: Sendable { // Process associated values in reverse order (to match the order they'll be popped) for (associatedValueIndex, associatedValue) in enumCase.associatedValues.enumerated().reversed() { let prop = associatedValue.label ?? "param\(associatedValueIndex)" - let fragment = IntrinsicJSFragment.associatedValuePopPayload(type: associatedValue.type) + let fragment = try IntrinsicJSFragment.associatedValuePopPayload(type: associatedValue.type) - let result = fragment.printCode([], scope, casePrinter, cleanup) + let result = try fragment.printCode([], scope, casePrinter, cleanup) let varName = result.first ?? "value_\(associatedValueIndex)" fieldPairs.append("\(prop): \(varName)") @@ -2380,12 +2387,12 @@ struct IntrinsicJSFragment: Sendable { ) } - private static func associatedValuePushPayload(type: BridgeType) -> IntrinsicJSFragment { + private static func associatedValuePushPayload(type: BridgeType) throws -> IntrinsicJSFragment { switch type { case .nullable(let wrappedType, let kind): return associatedValueOptionalPushPayload(wrappedType: wrappedType, kind: kind) default: - return try! stackLowerFragment(elementType: type) + return try stackLowerFragment(elementType: type) } } @@ -2551,10 +2558,10 @@ struct IntrinsicJSFragment: Sendable { let arrCleanupVar = scope.variable("arrCleanup") printer.write("let \(arrCleanupVar);") printer.write("if (\(isSomeVar)) {") - printer.indent { + try printer.indent { let localCleanup = CodeFragmentPrinter() - let arrFragment = try! arrayLower(elementType: elementType) - _ = arrFragment.printCode([value], scope, printer, localCleanup) + let arrFragment = try arrayLower(elementType: elementType) + _ = try arrFragment.printCode([value], scope, printer, localCleanup) let cleanupLines = localCleanup.lines.filter { !$0.trimmingCharacters(in: .whitespaces).isEmpty } @@ -2580,12 +2587,12 @@ struct IntrinsicJSFragment: Sendable { ) } - private static func associatedValuePopPayload(type: BridgeType) -> IntrinsicJSFragment { + private static func associatedValuePopPayload(type: BridgeType) throws -> IntrinsicJSFragment { switch type { case .nullable(let wrappedType, let kind): return associatedValueOptionalPopPayload(wrappedType: wrappedType, kind: kind) default: - return try! stackLiftFragment(elementType: type) + return try stackLiftFragment(elementType: type) } } @@ -2602,7 +2609,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("const \(isSomeVar) = \(scope.popI32());") printer.write("let \(optVar);") printer.write("if (\(isSomeVar)) {") - printer.indent { + try printer.indent { // For optional associated value enums, Swift uses bridgeJSLowerParameter() // which pushes caseId to i32Stack (not tagStack like bridgeJSLowerReturn()). if case .associatedValueEnum(let fullName) = wrappedType { @@ -2613,8 +2620,8 @@ struct IntrinsicJSFragment: Sendable { "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar));" ) } else { - let wrappedFragment = associatedValuePopPayload(type: wrappedType) - let wrappedResults = wrappedFragment.printCode([], scope, printer, cleanup) + let wrappedFragment = try associatedValuePopPayload(type: wrappedType) + let wrappedResults = try wrappedFragment.printCode([], scope, printer, cleanup) if let wrappedResult = wrappedResults.first { printer.write("\(optVar) = \(wrappedResult);") } else { @@ -2690,10 +2697,10 @@ struct IntrinsicJSFragment: Sendable { printer.write("const \(cleanupArrayVar) = [];") let elemVar = scope.variable("elem") printer.write("for (const \(elemVar) of \(arr)) {") - printer.indent { - let elementFragment = try! stackLowerFragment(elementType: elementType) + try printer.indent { + let elementFragment = try stackLowerFragment(elementType: elementType) let elementCleanup = CodeFragmentPrinter() - let _ = elementFragment.printCode([elemVar], scope, printer, elementCleanup) + let _ = try elementFragment.printCode([elemVar], scope, printer, elementCleanup) if !elementCleanup.lines.isEmpty { printer.write("\(cleanupArrayVar).push(() => {") printer.indent { @@ -2725,14 +2732,14 @@ struct IntrinsicJSFragment: Sendable { let entryVar = scope.variable("entry") printer.write("const \(entriesVar) = Object.entries(\(dict));") printer.write("for (const \(entryVar) of \(entriesVar)) {") - printer.indent { + try printer.indent { let keyVar = scope.variable("key") let valueVar = scope.variable("value") printer.write("const [\(keyVar), \(valueVar)] = \(entryVar);") - let keyFragment = try! stackLowerFragment(elementType: .string) + let keyFragment = try stackLowerFragment(elementType: .string) let keyCleanup = CodeFragmentPrinter() - let _ = keyFragment.printCode([keyVar], scope, printer, keyCleanup) + let _ = try keyFragment.printCode([keyVar], scope, printer, keyCleanup) if !keyCleanup.lines.isEmpty { printer.write("\(cleanupArrayVar).push(() => {") printer.indent { @@ -2743,9 +2750,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("});") } - let valueFragment = try! stackLowerFragment(elementType: valueType) + let valueFragment = try stackLowerFragment(elementType: valueType) let valueCleanup = CodeFragmentPrinter() - let _ = valueFragment.printCode([valueVar], scope, printer, valueCleanup) + let _ = try valueFragment.printCode([valueVar], scope, printer, valueCleanup) if !valueCleanup.lines.isEmpty { printer.write("\(cleanupArrayVar).push(() => {") printer.indent { @@ -2776,9 +2783,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("const \(lenVar) = \(scope.popI32());") printer.write("const \(resultVar) = [];") printer.write("for (let \(iVar) = 0; \(iVar) < \(lenVar); \(iVar)++) {") - printer.indent { - let elementFragment = try! stackLiftFragment(elementType: elementType) - let elementResults = elementFragment.printCode([], scope, printer, cleanupCode) + try printer.indent { + let elementFragment = try stackLiftFragment(elementType: elementType) + let elementResults = try elementFragment.printCode([], scope, printer, cleanupCode) if let elementExpr = elementResults.first { printer.write("\(resultVar).push(\(elementExpr));") } @@ -2802,11 +2809,11 @@ struct IntrinsicJSFragment: Sendable { printer.write("const \(lenVar) = \(scope.popI32());") printer.write("const \(resultVar) = {};") printer.write("for (let \(iVar) = 0; \(iVar) < \(lenVar); \(iVar)++) {") - printer.indent { - let valueFragment = try! stackLiftFragment(elementType: valueType) - let valueResults = valueFragment.printCode([], scope, printer, cleanupCode) - let keyFragment = try! stackLiftFragment(elementType: .string) - let keyResults = keyFragment.printCode([], scope, printer, cleanupCode) + try printer.indent { + let valueFragment = try stackLiftFragment(elementType: valueType) + let valueResults = try valueFragment.printCode([], scope, printer, cleanupCode) + let keyFragment = try stackLiftFragment(elementType: .string) + let keyResults = try keyFragment.printCode([], scope, printer, cleanupCode) if let keyExpr = keyResults.first, let valueExpr = valueResults.first { printer.write("\(resultVar)[\(keyExpr)] = \(valueExpr);") } @@ -2978,9 +2985,9 @@ struct IntrinsicJSFragment: Sendable { } ) case .array(let innerElementType): - return try! arrayLift(elementType: innerElementType) + return try arrayLift(elementType: innerElementType) case .dictionary(let valueType): - return try! dictionaryLift(valueType: valueType) + return try dictionaryLift(valueType: valueType) case .nullable(let wrappedType, let kind): return try optionalElementRaiseFragment(wrappedType: wrappedType, kind: kind) case .unsafePointer: @@ -3004,7 +3011,7 @@ struct IntrinsicJSFragment: Sendable { parameters: ["value"], printCode: { arguments, scope, printer, cleanup in registerJSValueHelpers(scope: scope) - let lowered = jsValueLower.printCode([arguments[0]], scope, printer, cleanup) + let lowered = try jsValueLower.printCode([arguments[0]], scope, printer, cleanup) let kindVar = lowered[0] let payload1Var = lowered[1] let payload2Var = lowered[2] @@ -3165,9 +3172,9 @@ struct IntrinsicJSFragment: Sendable { } ) case .array(let innerElementType): - return try! arrayLower(elementType: innerElementType) + return try arrayLower(elementType: innerElementType) case .dictionary(let valueType): - return try! dictionaryLower(valueType: valueType) + return try dictionaryLower(valueType: valueType) case .nullable(let wrappedType, let kind): return try optionalElementLowerFragment( wrappedType: wrappedType, @@ -3216,9 +3223,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(resultVar) = \(absenceLiteral);") } printer.write("} else {") - printer.indent { - let innerFragment = try! stackLiftFragment(elementType: wrappedType) - let innerResults = innerFragment.printCode([], scope, printer, cleanup) + try printer.indent { + let innerFragment = try stackLiftFragment(elementType: wrappedType) + let innerResults = try innerFragment.printCode([], scope, printer, cleanup) if let innerResult = innerResults.first { printer.write("\(resultVar) = \(innerResult);") } else { @@ -3247,9 +3254,9 @@ struct IntrinsicJSFragment: Sendable { // Cleanup is written inside the if block so retained id is in scope let localCleanupWriter = CodeFragmentPrinter() printer.write("if (\(isSomeVar)) {") - printer.indent { - let innerFragment = try! stackLowerFragment(elementType: wrappedType) - let _ = innerFragment.printCode([value], scope, printer, localCleanupWriter) + try printer.indent { + let innerFragment = try stackLowerFragment(elementType: wrappedType) + let _ = try innerFragment.printCode([value], scope, printer, localCleanupWriter) let localCleanupLines = localCleanupWriter.lines.filter { !$0.trimmingCharacters(in: .whitespaces).isEmpty } @@ -3302,8 +3309,8 @@ struct IntrinsicJSFragment: Sendable { printer.indent() printer.write("lower: (value) => {") - printer.indent { - generateStructLowerCode( + try printer.indent { + try generateStructLowerCode( structDef: capturedStructDef, allStructs: capturedAllStructs, scope: scope, @@ -3315,8 +3322,8 @@ struct IntrinsicJSFragment: Sendable { printer.write( "lift: () => {" ) - printer.indent { - generateStructLiftCode( + try printer.indent { + try generateStructLiftCode( structDef: capturedStructDef, allStructs: capturedAllStructs, scope: scope, @@ -3344,7 +3351,7 @@ struct IntrinsicJSFragment: Sendable { allStructs: [ExportedStruct], scope: JSGlueVariableScope, printer: CodeFragmentPrinter - ) { + ) throws { let lowerPrinter = CodeFragmentPrinter() let lowerScope = scope.makeChildScope() let lowerCleanup = CodeFragmentPrinter() @@ -3352,9 +3359,9 @@ struct IntrinsicJSFragment: Sendable { let instanceProps = structDef.properties.filter { !$0.isStatic } for property in instanceProps { - let fragment = structFieldLowerFragment(field: property, allStructs: allStructs) + let fragment = try structFieldLowerFragment(field: property, allStructs: allStructs) let fieldValue = "value.\(property.name)" - _ = fragment.printCode([fieldValue], lowerScope, lowerPrinter, lowerCleanup) + _ = try fragment.printCode([fieldValue], lowerScope, lowerPrinter, lowerCleanup) } for line in lowerPrinter.lines { @@ -3377,7 +3384,7 @@ struct IntrinsicJSFragment: Sendable { scope: JSGlueVariableScope, printer: CodeFragmentPrinter, attachMethods: Bool = false - ) { + ) throws { let liftScope = scope.makeChildScope() let liftCleanup = CodeFragmentPrinter() @@ -3385,8 +3392,8 @@ struct IntrinsicJSFragment: Sendable { let instanceProps = structDef.properties.filter { !$0.isStatic } for property in instanceProps.reversed() { - let fragment = structFieldLiftFragment(field: property, allStructs: allStructs) - let results = fragment.printCode([], liftScope, printer, liftCleanup) + let fragment = try structFieldLiftFragment(field: property, allStructs: allStructs) + let results = try fragment.printCode([], liftScope, printer, liftCleanup) if let resultExpr = results.first { fieldExpressions.append((property.name, resultExpr)) @@ -3411,7 +3418,7 @@ struct IntrinsicJSFragment: Sendable { printer.write( "\(instanceVar).\(method.name) = function(\(paramList)) {" ) - printer.indent { + try printer.indent { let methodScope = scope.makeChildScope() let methodCleanup = CodeFragmentPrinter() @@ -3422,8 +3429,8 @@ struct IntrinsicJSFragment: Sendable { var paramForwardings: [String] = [] for param in method.parameters { - let fragment = try! IntrinsicJSFragment.lowerParameter(type: param.type) - let loweredValues = fragment.printCode([param.name], methodScope, printer, methodCleanup) + let fragment = try IntrinsicJSFragment.lowerParameter(type: param.type) + let loweredValues = try fragment.printCode([param.name], methodScope, printer, methodCleanup) paramForwardings.append(contentsOf: loweredValues) } @@ -3440,9 +3447,9 @@ struct IntrinsicJSFragment: Sendable { // Lift return value if needed if method.returnType != .void { - let liftFragment = try! IntrinsicJSFragment.liftReturn(type: method.returnType) + let liftFragment = try IntrinsicJSFragment.liftReturn(type: method.returnType) let liftArgs = liftFragment.parameters.isEmpty ? [] : ["ret"] - let lifted = liftFragment.printCode(liftArgs, methodScope, printer, methodCleanup) + let lifted = try liftFragment.printCode(liftArgs, methodScope, printer, methodCleanup) if let liftedValue = lifted.first { printer.write("return \(liftedValue);") } @@ -3460,7 +3467,7 @@ struct IntrinsicJSFragment: Sendable { private static func structFieldLowerFragment( field: ExportedProperty, allStructs: [ExportedStruct] - ) -> IntrinsicJSFragment { + ) throws -> IntrinsicJSFragment { switch field.type { case .jsValue: preconditionFailure("Struct field of JSValue is not supported yet") @@ -3724,7 +3731,7 @@ struct IntrinsicJSFragment: Sendable { scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) cleanup.write("if (\(enumCleanupVar)) { \(enumCleanupVar)(); }") default: - let wrappedFragment = structFieldLowerFragment( + let wrappedFragment = try structFieldLowerFragment( field: ExportedProperty( name: field.name, type: wrappedType, @@ -3735,7 +3742,7 @@ struct IntrinsicJSFragment: Sendable { ) let guardedPrinter = CodeFragmentPrinter() let guardedCleanup = CodeFragmentPrinter() - _ = wrappedFragment.printCode([value], scope, guardedPrinter, guardedCleanup) + _ = try wrappedFragment.printCode([value], scope, guardedPrinter, guardedCleanup) var loweredLines = guardedPrinter.lines var hoistedCleanupVar: String? if let first = loweredLines.first { @@ -3794,7 +3801,7 @@ struct IntrinsicJSFragment: Sendable { } ) default: - return try! stackLowerFragment(elementType: field.type) + return try stackLowerFragment(elementType: field.type) } } @@ -3846,7 +3853,7 @@ struct IntrinsicJSFragment: Sendable { private static func structFieldLiftFragment( field: ExportedProperty, allStructs: [ExportedStruct] - ) -> IntrinsicJSFragment { + ) throws -> IntrinsicJSFragment { switch field.type { case .jsValue: preconditionFailure("Struct field of JSValue is not supported yet") @@ -3859,7 +3866,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("const \(isSomeVar) = \(scope.popI32());") printer.write("let \(optVar);") printer.write("if (\(isSomeVar)) {") - printer.indent { + try printer.indent { // Special handling for associated value enum - in struct fields, case ID is pushed to i32Stack if case .associatedValueEnum(let enumName) = wrappedType { let base = enumName.components(separatedBy: ".").last ?? enumName @@ -3869,7 +3876,7 @@ struct IntrinsicJSFragment: Sendable { "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar), );" ) } else { - let wrappedFragment = structFieldLiftFragment( + let wrappedFragment = try structFieldLiftFragment( field: ExportedProperty( name: field.name, type: wrappedType, @@ -3878,7 +3885,7 @@ struct IntrinsicJSFragment: Sendable { ), allStructs: allStructs ) - let wrappedResults = wrappedFragment.printCode([], scope, printer, cleanup) + let wrappedResults = try wrappedFragment.printCode([], scope, printer, cleanup) if let wrappedResult = wrappedResults.first { printer.write("\(optVar) = \(wrappedResult);") } else { @@ -3938,7 +3945,7 @@ struct IntrinsicJSFragment: Sendable { } ) default: - return try! stackLiftFragment(elementType: field.type) + return try stackLiftFragment(elementType: field.type) } } } From 3d9678a2331967ebb937b66d4a8324d06af9451b Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 11:50:40 +0900 Subject: [PATCH 179/252] BridgeJS: Build fixes for profiling API --- .../BridgeJS/Sources/BridgeJSCore/Misc.swift | 110 +++++++++--------- .../Sources/BridgeJSTool/BridgeJSTool.swift | 24 +++- 2 files changed, 76 insertions(+), 58 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift index 70dae3a82..df6d0c755 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift @@ -1,12 +1,3 @@ -import class Foundation.FileHandle -import class Foundation.ProcessInfo -import func Foundation.open -import func Foundation.strerror -import var Foundation.errno -import var Foundation.O_WRONLY -import var Foundation.O_CREAT -import var Foundation.O_TRUNC - // MARK: - ProgressReporting public struct ProgressReporting { @@ -31,61 +22,66 @@ public struct ProgressReporting { // MARK: - Profiling -/// A simple time-profiler to emit `chrome://tracing` format +/// A simple time-profiler API public final class Profiling { nonisolated(unsafe) static var current: Profiling? - let startTime: ContinuousClock.Instant - let clock = ContinuousClock() - let output: @Sendable (String) -> Void - var firstEntry = true - - init(output: @Sendable @escaping (String) -> Void) { - self.startTime = ContinuousClock.now - self.output = output - } - - public static func with(body: @escaping () throws -> Void) rethrows -> Void { - guard let outputPath = ProcessInfo.processInfo.environment["BRIDGE_JS_PROFILING"] else { - return try body() + let beginEntry: (_ label: String) -> Void + let endEntry: (_ label: String) -> Void + let finalize: () -> Void + + /// Create a profiling instance that outputs Trace Event Format, which + /// can be viewed in chrome://tracing or other compatible viewers. + /// https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/edit?usp=sharing + public static func traceEvent(output: @escaping (String) -> Void) -> Profiling { + let clock = ContinuousClock() + let startTime = clock.now + var firstEntry = true + + func formatTimestamp() -> Int { + let duration = startTime.duration(to: .now) + let (seconds, attoseconds) = duration.components + // Convert to microseconds + return Int(seconds * 1_000_000 + attoseconds / 1_000_000_000_000) } - let fd = open(outputPath, O_WRONLY | O_CREAT | O_TRUNC, 0o644) - guard fd >= 0 else { - let error = String(cString: strerror(errno)) - fatalError("Failed to open profiling output file \(outputPath): \(error)") - } - let output = FileHandle(fileDescriptor: fd, closeOnDealloc: true) - let profiling = Profiling(output: { output.write($0.data(using: .utf8) ?? Data()) }) - defer { - profiling.output("]\n") - } - Profiling.current = profiling - defer { - Profiling.current = nil - } - return try body() - } - private func formatTimestamp(instant: ContinuousClock.Instant) -> Int { - let duration = self.startTime.duration(to: instant) - let (seconds, attoseconds) = duration.components - // Convert to microseconds - return Int(seconds * 1_000_000 + attoseconds / 1_000_000_000_000) + return Profiling( + beginEntry: { label in + let entry = #"{"ph":"B","pid":1,"name":\#(JSON.serialize(label)),"ts":\#(formatTimestamp())}"# + if firstEntry { + firstEntry = false + output("[\n\(entry)") + } else { + output(",\n\(entry)") + } + }, + endEntry: { label in + output(#",\n{"ph":"E","pid":1,"name":\#(JSON.serialize(label)),"ts":\#(formatTimestamp())}"#) + }, + finalize: { + output("]\n") + } + ) } - func begin(_ label: String, _ instant: ContinuousClock.Instant) { - let entry = #"{"ph":"B","pid":1,"name":\#(JSON.serialize(label)),"ts":\#(formatTimestamp(instant: instant))}"# - if firstEntry { - firstEntry = false - output("[\n\(entry)") - } else { - output(",\n\(entry)") - } + public init( + beginEntry: @escaping (_ label: String) -> Void, + endEntry: @escaping (_ label: String) -> Void, + finalize: @escaping () -> Void + ) { + self.beginEntry = beginEntry + self.endEntry = endEntry + self.finalize = finalize } - func end(_ label: String, _ instant: ContinuousClock.Instant) { - let entry = #"{"ph":"E","pid":1,"name":\#(JSON.serialize(label)),"ts":\#(formatTimestamp(instant: instant))}"# - output(",\n\(entry)") + public static func with(_ makeCurrent: () -> Profiling?, body: @escaping () throws -> Void) rethrows -> Void { + guard let current = makeCurrent() else { + return try body() + } + defer { current.finalize() } + Profiling.current = current + defer { Profiling.current = nil } + return try body() } } @@ -94,9 +90,9 @@ public func withSpan(_ label: String, body: @escaping () throws -> T) rethrow guard let profiling = Profiling.current else { return try body() } - profiling.begin(label, profiling.clock.now) + profiling.beginEntry(label) defer { - profiling.end(label, profiling.clock.now) + profiling.endEntry(label) } return try body() } diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index f9fa56c42..b36b3ec8c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -1,10 +1,17 @@ @preconcurrency import func Foundation.exit @preconcurrency import func Foundation.fputs +@preconcurrency import func Foundation.open +@preconcurrency import func Foundation.strerror @preconcurrency import var Foundation.stderr +@preconcurrency import var Foundation.errno +@preconcurrency import var Foundation.O_WRONLY +@preconcurrency import var Foundation.O_CREAT +@preconcurrency import var Foundation.O_TRUNC @preconcurrency import struct Foundation.URL @preconcurrency import struct Foundation.Data @preconcurrency import struct Foundation.ObjCBool @preconcurrency import class Foundation.JSONEncoder +@preconcurrency import class Foundation.FileHandle @preconcurrency import class Foundation.FileManager @preconcurrency import class Foundation.JSONDecoder @preconcurrency import class Foundation.ProcessInfo @@ -50,7 +57,7 @@ import BridgeJSUtilities static func main() throws { do { - try Profiling.with { + try Profiling.with(Profiling.make) { try run() } } catch { @@ -318,6 +325,21 @@ private func inputSwiftFiles(targetDirectory: URL, positionalArguments: [String] return positionalArguments } +extension Profiling { + static func make() -> Profiling? { + guard let outputPath = ProcessInfo.processInfo.environment["BRIDGE_JS_PROFILING"] else { + return nil + } + let fd = open(outputPath, O_WRONLY | O_CREAT | O_TRUNC, 0o644) + guard fd >= 0 else { + let error = String(cString: strerror(errno)) + fatalError("Failed to open profiling output file \(outputPath): \(error)") + } + let output = FileHandle(fileDescriptor: fd, closeOnDealloc: true) + return Profiling.traceEvent(output: { output.write($0.data(using: .utf8) ?? Data()) }) + } +} + // MARK: - Minimal Argument Parsing struct OptionRule { From 235a9bd99243d21612aefc398680a7d44a719fd0 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 11:57:01 +0900 Subject: [PATCH 180/252] BridgeJS: Deduplicate closure signature collection logic (#605) Centralize the `BridgeType` traversal logic and use it to collect closure signatures in both `BridgeJSCore` and `BridgeJSLink`, removing redundant code. This is mostly NFC but added new closure signature collection paths for `.array` and `.dictionary` element types and for enums with associated values. --- .../Sources/BridgeJSCore/ClosureCodegen.swift | 102 +----------- .../Sources/BridgeJSLink/BridgeJSLink.swift | 82 +--------- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 146 ++++++++++++++++++ 3 files changed, 154 insertions(+), 176 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift index 3ec0418b3..49f2b99bf 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift @@ -8,27 +8,6 @@ import BridgeJSSkeleton public struct ClosureCodegen { public init() {} - func collectClosureSignatures(from parameters: [Parameter], into signatures: inout Set) { - for param in parameters { - collectClosureSignatures(from: param.type, into: &signatures) - } - } - - func collectClosureSignatures(from type: BridgeType, into signatures: inout Set) { - switch type { - case .closure(let signature, _): - signatures.insert(signature) - for paramType in signature.parameters { - collectClosureSignatures(from: paramType, into: &signatures) - } - collectClosureSignatures(from: signature.returnType, into: &signatures) - case .nullable(let wrapped, _): - collectClosureSignatures(from: wrapped, into: &signatures) - default: - break - } - } - func renderClosureHelpers(_ signature: ClosureSignature) throws -> [DeclSyntax] { let mangledName = signature.mangleName let helperName = "_BJS_Closure_\(mangledName)" @@ -242,83 +221,10 @@ public struct ClosureCodegen { } public func renderSupport(for skeleton: BridgeJSSkeleton) throws -> String? { - var closureSignatures: Set = [] - - if let exported = skeleton.exported { - for function in exported.functions { - collectClosureSignatures(from: function.parameters, into: &closureSignatures) - collectClosureSignatures(from: function.returnType, into: &closureSignatures) - } - for klass in exported.classes { - if let constructor = klass.constructor { - collectClosureSignatures(from: constructor.parameters, into: &closureSignatures) - } - for method in klass.methods { - collectClosureSignatures(from: method.parameters, into: &closureSignatures) - collectClosureSignatures(from: method.returnType, into: &closureSignatures) - } - for property in klass.properties { - collectClosureSignatures(from: property.type, into: &closureSignatures) - } - } - for proto in exported.protocols { - for method in proto.methods { - collectClosureSignatures(from: method.parameters, into: &closureSignatures) - collectClosureSignatures(from: method.returnType, into: &closureSignatures) - } - for property in proto.properties { - collectClosureSignatures(from: property.type, into: &closureSignatures) - } - } - for structDecl in exported.structs { - for property in structDecl.properties { - collectClosureSignatures(from: property.type, into: &closureSignatures) - } - if let constructor = structDecl.constructor { - collectClosureSignatures(from: constructor.parameters, into: &closureSignatures) - } - for method in structDecl.methods { - collectClosureSignatures(from: method.parameters, into: &closureSignatures) - collectClosureSignatures(from: method.returnType, into: &closureSignatures) - } - } - for enumDecl in exported.enums { - for method in enumDecl.staticMethods { - collectClosureSignatures(from: method.parameters, into: &closureSignatures) - collectClosureSignatures(from: method.returnType, into: &closureSignatures) - } - for property in enumDecl.staticProperties { - collectClosureSignatures(from: property.type, into: &closureSignatures) - } - } - } - - if let imported = skeleton.imported { - for fileSkeleton in imported.children { - for getter in fileSkeleton.globalGetters { - collectClosureSignatures(from: getter.type, into: &closureSignatures) - } - for function in fileSkeleton.functions { - collectClosureSignatures(from: function.parameters, into: &closureSignatures) - collectClosureSignatures(from: function.returnType, into: &closureSignatures) - } - for type in fileSkeleton.types { - if let constructor = type.constructor { - collectClosureSignatures(from: constructor.parameters, into: &closureSignatures) - } - for getter in type.getters { - collectClosureSignatures(from: getter.type, into: &closureSignatures) - } - for setter in type.setters { - collectClosureSignatures(from: setter.type, into: &closureSignatures) - } - for method in type.methods + type.staticMethods { - collectClosureSignatures(from: method.parameters, into: &closureSignatures) - collectClosureSignatures(from: method.returnType, into: &closureSignatures) - } - } - } - } + let collector = ClosureSignatureCollectorVisitor() + var walker = BridgeTypeWalker(visitor: collector) + walker.walk(skeleton) + let closureSignatures = walker.visitor.signatures guard !closureSignatures.isEmpty else { return nil } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 13ea4e910..621e9c98b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -610,13 +610,10 @@ public struct BridgeJSLink { for unified in skeletons { let moduleName = unified.moduleName - var closureSignatures: Set = [] - if let exported = unified.exported { - collectClosureSignatures(from: exported, into: &closureSignatures) - } - if let imported = unified.imported { - collectClosureSignatures(from: imported, into: &closureSignatures) - } + let collector = ClosureSignatureCollectorVisitor() + var walker = BridgeTypeWalker(visitor: collector) + walker.walk(unified) + let closureSignatures = walker.visitor.signatures guard !closureSignatures.isEmpty else { continue } @@ -714,77 +711,6 @@ public struct BridgeJSLink { return printer } - private func collectClosureSignatures(from skeleton: ExportedSkeleton, into signatures: inout Set) - { - for function in skeleton.functions { - collectClosureSignatures(from: function.parameters, into: &signatures) - collectClosureSignatures(from: function.returnType, into: &signatures) - } - for klass in skeleton.classes { - if let constructor = klass.constructor { - collectClosureSignatures(from: constructor.parameters, into: &signatures) - } - for method in klass.methods { - collectClosureSignatures(from: method.parameters, into: &signatures) - collectClosureSignatures(from: method.returnType, into: &signatures) - } - for property in klass.properties { - collectClosureSignatures(from: property.type, into: &signatures) - } - } - } - - private func collectClosureSignatures( - from skeleton: ImportedModuleSkeleton, - into signatures: inout Set - ) { - for fileSkeleton in skeleton.children { - for getter in fileSkeleton.globalGetters { - collectClosureSignatures(from: getter.type, into: &signatures) - } - for function in fileSkeleton.functions { - collectClosureSignatures(from: function.parameters, into: &signatures) - collectClosureSignatures(from: function.returnType, into: &signatures) - } - for type in fileSkeleton.types { - if let constructor = type.constructor { - collectClosureSignatures(from: constructor.parameters, into: &signatures) - } - for getter in type.getters { - collectClosureSignatures(from: getter.type, into: &signatures) - } - for setter in type.setters { - collectClosureSignatures(from: setter.type, into: &signatures) - } - for method in type.methods + type.staticMethods { - collectClosureSignatures(from: method.parameters, into: &signatures) - collectClosureSignatures(from: method.returnType, into: &signatures) - } - } - } - } - - private func collectClosureSignatures(from parameters: [Parameter], into signatures: inout Set) { - for param in parameters { - collectClosureSignatures(from: param.type, into: &signatures) - } - } - - private func collectClosureSignatures(from type: BridgeType, into signatures: inout Set) { - switch type { - case .closure(let signature, _): - signatures.insert(signature) - for paramType in signature.parameters { - collectClosureSignatures(from: paramType, into: &signatures) - } - collectClosureSignatures(from: signature.returnType, into: &signatures) - case .nullable(let wrapped, _): - collectClosureSignatures(from: wrapped, into: &signatures) - default: - break - } - } - private func generateInvokeFunction( signature: ClosureSignature, functionName: String diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index 3ebc91306..ba25b6ff9 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -247,6 +247,138 @@ public struct Parameter: Codable, Equatable, Sendable { } } +// MARK: - BridgeType Visitor + +public protocol BridgeTypeVisitor { + mutating func visitClosure(_ signature: ClosureSignature, useJSTypedClosure: Bool) +} + +public struct BridgeTypeWalker { + public var visitor: Visitor + + public init(visitor: Visitor) { + self.visitor = visitor + } + + public mutating func walk(_ type: BridgeType) { + switch type { + case .closure(let signature, let useJSTypedClosure): + visitor.visitClosure(signature, useJSTypedClosure: useJSTypedClosure) + for paramType in signature.parameters { + walk(paramType) + } + walk(signature.returnType) + case .nullable(let wrapped, _): + walk(wrapped) + case .array(let element): + walk(element) + case .dictionary(let value): + walk(value) + default: + break + } + } + public mutating func walk(_ parameters: [Parameter]) { + for param in parameters { + walk(param.type) + } + } + public mutating func walk(_ function: ExportedFunction) { + walk(function.parameters) + walk(function.returnType) + } + public mutating func walk(_ constructor: ExportedConstructor) { + walk(constructor.parameters) + } + public mutating func walk(_ skeleton: ExportedSkeleton) { + for function in skeleton.functions { + walk(function) + } + for klass in skeleton.classes { + if let constructor = klass.constructor { + walk(constructor.parameters) + } + for method in klass.methods { + walk(method) + } + for property in klass.properties { + walk(property.type) + } + } + for proto in skeleton.protocols { + for method in proto.methods { + walk(method) + } + for property in proto.properties { + walk(property.type) + } + } + for structDecl in skeleton.structs { + for property in structDecl.properties { + walk(property.type) + } + if let constructor = structDecl.constructor { + walk(constructor.parameters) + } + for method in structDecl.methods { + walk(method) + } + } + for enumDecl in skeleton.enums { + for enumCase in enumDecl.cases { + for associatedValue in enumCase.associatedValues { + walk(associatedValue.type) + } + } + for method in enumDecl.staticMethods { + walk(method) + } + for property in enumDecl.staticProperties { + walk(property.type) + } + } + } + public mutating func walk(_ function: ImportedFunctionSkeleton) { + walk(function.parameters) + walk(function.returnType) + } + public mutating func walk(_ skeleton: ImportedModuleSkeleton) { + for fileSkeleton in skeleton.children { + for getter in fileSkeleton.globalGetters { + walk(getter.type) + } + for setter in fileSkeleton.globalSetters { + walk(setter.type) + } + for function in fileSkeleton.functions { + walk(function) + } + for type in fileSkeleton.types { + if let constructor = type.constructor { + walk(constructor.parameters) + } + for getter in type.getters { + walk(getter.type) + } + for setter in type.setters { + walk(setter.type) + } + for method in type.methods + type.staticMethods { + walk(method) + } + } + } + } + public mutating func walk(_ skeleton: BridgeJSSkeleton) { + if let exported = skeleton.exported { + walk(exported) + } + if let imported = skeleton.imported { + walk(imported) + } + } +} + public struct Effects: Codable, Equatable, Sendable { public var isAsync: Bool public var isThrows: Bool @@ -873,6 +1005,20 @@ public struct ImportedModuleSkeleton: Codable { } } +// MARK: - Closure signature collection visitor + +public struct ClosureSignatureCollectorVisitor: BridgeTypeVisitor { + public var signatures: Set = [] + + public init(signatures: Set = []) { + self.signatures = signatures + } + + public mutating func visitClosure(_ signature: ClosureSignature, useJSTypedClosure: Bool) { + signatures.insert(signature) + } +} + // MARK: - Unified Skeleton /// Unified skeleton containing both exported and imported API definitions From 3bc0400b3627ca9bc3e2e3fca7d604eef2b9985a Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 11:19:50 +0900 Subject: [PATCH 181/252] [NFC] BridgeJS: Move CodeFragmentPrintetr to BridgeJSCore So that we can use it for Swift code generation --- .../BridgeJSLink/CodeFragmentPrinter.swift | 80 ------------------- .../Sources/BridgeJSLink/JSGlueGen.swift | 3 + .../BridgeJSLink/JSIntrinsicRegistry.swift | 37 +++++++++ .../Sources/BridgeJSUtilities/Utilities.swift | 47 +++++++++++ 4 files changed, 87 insertions(+), 80 deletions(-) delete mode 100644 Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift create mode 100644 Plugins/BridgeJS/Sources/BridgeJSLink/JSIntrinsicRegistry.swift diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift deleted file mode 100644 index 4bad3dd34..000000000 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift +++ /dev/null @@ -1,80 +0,0 @@ -/// Registry for JS helper intrinsics used during code generation. -final class JSIntrinsicRegistry { - private var entries: [String: [String]] = [:] - - var isEmpty: Bool { - entries.isEmpty - } - - func register(name: String, build: (CodeFragmentPrinter) throws -> Void) rethrows { - guard entries[name] == nil else { return } - let printer = CodeFragmentPrinter() - try build(printer) - entries[name] = printer.lines - } - - func reset() { - entries.removeAll() - } - - func emitLines() -> [String] { - var emitted: [String] = [] - for key in entries.keys.sorted() { - if let lines = entries[key] { - emitted.append(contentsOf: lines) - emitted.append("") - } - } - if emitted.last == "" { - emitted.removeLast() - } - return emitted - } -} - -/// A printer for code fragments. -final class CodeFragmentPrinter { - private(set) var lines: [String] = [] - private var indentLevel: Int = 0 - - init(header: String = "") { - self.lines.append(contentsOf: header.split(separator: "\n").map { String($0) }) - } - - func nextLine() { - lines.append("") - } - - 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)) - } - - func write(lines: [String]) { - for line in lines { - write(line) - } - } - - func write(contentsOf printer: CodeFragmentPrinter) { - self.write(lines: printer.lines) - } - - func indent() { - indentLevel += 1 - } - - func unindent() { - indentLevel -= 1 - } - - func indent(_ body: () throws -> Void) rethrows { - indentLevel += 1 - try body() - indentLevel -= 1 - } -} diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 9402cdd9d..7928f480d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -1,6 +1,9 @@ #if canImport(BridgeJSSkeleton) import BridgeJSSkeleton #endif +#if canImport(BridgeJSUtilities) +import BridgeJSUtilities +#endif /// A scope for variables for JS glue code final class JSGlueVariableScope { diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSIntrinsicRegistry.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSIntrinsicRegistry.swift new file mode 100644 index 000000000..c3e77d83f --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSIntrinsicRegistry.swift @@ -0,0 +1,37 @@ +#if canImport(BridgeJSUtilities) +import BridgeJSUtilities +#endif + +/// Registry for JS helper intrinsics used during code generation. +final class JSIntrinsicRegistry { + private var entries: [String: [String]] = [:] + + var isEmpty: Bool { + entries.isEmpty + } + + func register(name: String, build: (CodeFragmentPrinter) throws -> Void) rethrows { + guard entries[name] == nil else { return } + let printer = CodeFragmentPrinter() + try build(printer) + entries[name] = printer.lines + } + + func reset() { + entries.removeAll() + } + + func emitLines() -> [String] { + var emitted: [String] = [] + for key in entries.keys.sorted() { + if let lines = entries[key] { + emitted.append(contentsOf: lines) + emitted.append("") + } + } + if emitted.last == "" { + emitted.removeLast() + } + return emitted + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift b/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift index 2791aa5be..ed6fa04f0 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift @@ -27,3 +27,50 @@ public enum BridgeJSGeneratedFile { """ } } + +/// A printer for code fragments. +public final class CodeFragmentPrinter { + public private(set) var lines: [String] = [] + private var indentLevel: Int = 0 + + public init(header: String = "") { + self.lines.append(contentsOf: header.split(separator: "\n").map { String($0) }) + } + + public func nextLine() { + lines.append("") + } + + public 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)) + } + + public func write(lines: [String]) { + for line in lines { + write(line) + } + } + + public func write(contentsOf printer: CodeFragmentPrinter) { + self.write(lines: printer.lines) + } + + public func indent() { + indentLevel += 1 + } + + public func unindent() { + indentLevel -= 1 + } + + public func indent(_ body: () throws -> Void) rethrows { + indentLevel += 1 + try body() + indentLevel -= 1 + } +} From 2e4de4fe08d5be9a1b7617de6c9287f3c6f76255 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 12:48:00 +0900 Subject: [PATCH 182/252] BridgeJS: Explicitly reject unsupported optional wrapped types --- Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 9402cdd9d..3205388e4 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -1230,7 +1230,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) default: - () + throw BridgeJSLinkError(message: "Unsupported wrapped type for returning from JS function: \(wrappedType)") } return [] From 8f77619d802c83abc0a0531ddaab705c39ebdd71 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 12:56:35 +0900 Subject: [PATCH 183/252] BridgeJS: Fix handling of optional Swift heap objects in JS glue generation --- .../Sources/BridgeJSLink/JSGlueGen.swift | 2 ++ .../Inputs/MacroSwift/SwiftClass.swift | 1 + .../BridgeJSCodegenTests/SwiftClass.json | 28 +++++++++++++++++++ .../BridgeJSCodegenTests/SwiftClass.swift | 18 ++++++++++++ .../BridgeJSLinkTests/Protocol.js | 1 + .../BridgeJSLinkTests/SwiftClass.d.ts | 1 + .../BridgeJSLinkTests/SwiftClass.js | 9 ++++++ .../Generated/BridgeJS.swift | 18 ++++++++++++ .../Generated/JavaScript/BridgeJS.json | 28 +++++++++++++++++++ .../JavaScript/SwiftClassSupportTests.mjs | 3 ++ .../SwiftClassSupportTests.swift | 9 ++++++ 11 files changed, 118 insertions(+) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 3205388e4..c502513d4 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -1120,6 +1120,8 @@ struct IntrinsicJSFragment: Sendable { scope.emitPushF64Parameter(payload2Var, printer: printer) } scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) + case .swiftHeapObject: + printer.write("return \(isSomeVar) ? \(value).pointer : 0;") case .array(let elementType): printer.write("if (\(isSomeVar)) {") try printer.indent { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift index aa520783a..2b41d91d6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift @@ -20,3 +20,4 @@ @JS package class PackageGreeter {} @JSFunction func jsRoundTripGreeter(greeter: Greeter) throws(JSException) -> Greeter +@JSFunction func jsRoundTripOptionalGreeter(greeter: Greeter?) throws(JSException) -> Greeter? \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.json index d1bf42cff..7cebdd5e6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.json @@ -162,6 +162,34 @@ "_0" : "Greeter" } } + }, + { + "name" : "jsRoundTripOptionalGreeter", + "parameters" : [ + { + "name" : "greeter", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } } ], "types" : [ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift index 581d6f1c0..ca82b87c4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift @@ -152,4 +152,22 @@ func _$jsRoundTripGreeter(_ greeter: Greeter) throws(JSException) -> Greeter { throw error } return Greeter.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_jsRoundTripOptionalGreeter") +fileprivate func bjs_jsRoundTripOptionalGreeter(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +#else +fileprivate func bjs_jsRoundTripOptionalGreeter(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripOptionalGreeter(_ greeter: Optional) throws(JSException) -> Optional { + let (greeterIsSome, greeterPointer) = greeter.bridgeJSLowerParameter() + let ret = bjs_jsRoundTripOptionalGreeter(greeterIsSome, greeterPointer) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturn(ret) } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 00b9626e3..4d9f3e0bb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -538,6 +538,7 @@ export async function createInstantiator(options, swift) { try { let ret = swift.memory.getObject(self).createOptionalHelper(); const isSome = ret != null; + return isSome ? ret.pointer : 0; } catch (error) { setException(error); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts index d3461f8c1..05fc97fee 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts @@ -32,6 +32,7 @@ export type Exports = { } export type Imports = { jsRoundTripGreeter(greeter: Greeter): Greeter; + jsRoundTripOptionalGreeter(greeter: Greeter | null): Greeter | null; } export function createInstantiator(options: { imports: Imports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index eaa5d7720..85d423f8a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -225,6 +225,15 @@ export async function createInstantiator(options, swift) { return 0 } } + TestModule["bjs_jsRoundTripOptionalGreeter"] = function bjs_jsRoundTripOptionalGreeter(greeterIsSome, greeterWrappedValue) { + try { + let ret = imports.jsRoundTripOptionalGreeter(greeterIsSome ? Greeter.__construct(greeterWrappedValue) : null); + const isSome = ret != null; + return isSome ? ret.pointer : 0; + } catch (error) { + setException(error); + } + } }, setInstance: (i) => { instance = i; diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 1feb3eed6..b10a82fdf 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -10677,6 +10677,15 @@ fileprivate func bjs_SwiftClassSupportImports_jsRoundTripGreeter_static(_ greete } #endif +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static") +fileprivate func bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +#else +fileprivate func bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif + func _$SwiftClassSupportImports_jsRoundTripGreeter(_ greeter: Greeter) throws(JSException) -> Greeter { let greeterPointer = greeter.bridgeJSLowerParameter() let ret = bjs_SwiftClassSupportImports_jsRoundTripGreeter_static(greeterPointer) @@ -10684,4 +10693,13 @@ func _$SwiftClassSupportImports_jsRoundTripGreeter(_ greeter: Greeter) throws(JS throw error } return Greeter.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) } \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index de7ab4a5d..7e2d4d855 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -15345,6 +15345,34 @@ "_0" : "Greeter" } } + }, + { + "name" : "jsRoundTripOptionalGreeter", + "parameters" : [ + { + "name" : "greeter", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } } ] } diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/SwiftClassSupportTests.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/SwiftClassSupportTests.mjs index fdb5d498d..0368cb74a 100644 --- a/Tests/BridgeJSRuntimeTests/JavaScript/SwiftClassSupportTests.mjs +++ b/Tests/BridgeJSRuntimeTests/JavaScript/SwiftClassSupportTests.mjs @@ -6,5 +6,8 @@ export function getImports(importsContext) { jsRoundTripGreeter: (greeter) => { return greeter; }, + jsRoundTripOptionalGreeter: (greeter) => { + return greeter; + }, }; } \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift b/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift index 3cee17554..1a3dd0a4f 100644 --- a/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift +++ b/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift @@ -3,6 +3,7 @@ import XCTest @JSClass struct SwiftClassSupportImports { @JSFunction static func jsRoundTripGreeter(_ greeter: Greeter) throws(JSException) -> Greeter + @JSFunction static func jsRoundTripOptionalGreeter(_ greeter: Greeter?) throws(JSException) -> Greeter? } final class SwiftClassSupportTests: XCTestCase { @@ -10,4 +11,12 @@ final class SwiftClassSupportTests: XCTestCase { let greeter = try SwiftClassSupportImports.jsRoundTripGreeter(Greeter(name: "Hello")) XCTAssertEqual(greeter.name, "Hello") } + + func testRoundTripOptionalGreeter() throws { + let greeter1 = try SwiftClassSupportImports.jsRoundTripOptionalGreeter(nil) + XCTAssertNil(greeter1) + + let greeter2 = try SwiftClassSupportImports.jsRoundTripOptionalGreeter(Greeter(name: "Hello")) + XCTAssertEqual(greeter2?.name, "Hello") + } } From 4c0a345b09923faa97ae280a2140830a01cbd1ad Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 12:58:39 +0900 Subject: [PATCH 184/252] BridgeJS: Fix optional Swift heap object for parameter lifting in JS glue --- Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift | 6 ++++-- .../BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift | 2 +- .../__Snapshots__/BridgeJSLinkTests/Protocol.js | 2 +- .../__Snapshots__/BridgeJSLinkTests/SwiftClass.js | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index c502513d4..db900cf99 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -668,7 +668,7 @@ struct IntrinsicJSFragment: Sendable { resultExpr = "\(isSome) ? \(JSGlueVariableScope.reservedSwift).memory.getObject(\(wrappedValue)) : \(absenceLiteral)" case .swiftHeapObject(let name): - resultExpr = "\(isSome) ? \(name).__construct(\(wrappedValue)) : \(absenceLiteral)" + resultExpr = "\(isSome) ? _exports['\(name)'].__construct(\(wrappedValue)) : \(absenceLiteral)" case .jsObject: resultExpr = "\(isSome) ? \(JSGlueVariableScope.reservedSwift).memory.getObject(\(wrappedValue)) : \(absenceLiteral)" @@ -1232,7 +1232,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) default: - throw BridgeJSLinkError(message: "Unsupported wrapped type for returning from JS function: \(wrappedType)") + throw BridgeJSLinkError( + message: "Unsupported wrapped type for returning from JS function: \(wrappedType)" + ) } return [] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift index 2b41d91d6..d7b5a5b8e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/SwiftClass.swift @@ -20,4 +20,4 @@ @JS package class PackageGreeter {} @JSFunction func jsRoundTripGreeter(greeter: Greeter) throws(JSException) -> Greeter -@JSFunction func jsRoundTripOptionalGreeter(greeter: Greeter?) throws(JSException) -> Greeter? \ No newline at end of file +@JSFunction func jsRoundTripOptionalGreeter(greeter: Greeter?) throws(JSException) -> Greeter? diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 4d9f3e0bb..fd37c7178 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -529,7 +529,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_MyViewControllerDelegate_onOptionalHelperUpdated"] = function bjs_MyViewControllerDelegate_onOptionalHelperUpdated(self, helperIsSome, helperWrappedValue) { try { - swift.memory.getObject(self).onOptionalHelperUpdated(helperIsSome ? Helper.__construct(helperWrappedValue) : null); + swift.memory.getObject(self).onOptionalHelperUpdated(helperIsSome ? _exports['Helper'].__construct(helperWrappedValue) : null); } catch (error) { setException(error); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index 85d423f8a..13ea6ba75 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -227,7 +227,7 @@ export async function createInstantiator(options, swift) { } TestModule["bjs_jsRoundTripOptionalGreeter"] = function bjs_jsRoundTripOptionalGreeter(greeterIsSome, greeterWrappedValue) { try { - let ret = imports.jsRoundTripOptionalGreeter(greeterIsSome ? Greeter.__construct(greeterWrappedValue) : null); + let ret = imports.jsRoundTripOptionalGreeter(greeterIsSome ? _exports['Greeter'].__construct(greeterWrappedValue) : null); const isSome = ret != null; return isSome ? ret.pointer : 0; } catch (error) { From c74f65991b4dfdc2e8f8b07d4284a50730abe543 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 18:16:19 +0900 Subject: [PATCH 185/252] BridgeJS: Fix missing escape in profiling output --- Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift index df6d0c755..67f5170c4 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift @@ -56,7 +56,7 @@ public final class Profiling { } }, endEntry: { label in - output(#",\n{"ph":"E","pid":1,"name":\#(JSON.serialize(label)),"ts":\#(formatTimestamp())}"#) + output(#",\#n{"ph":"E","pid":1,"name":\#(JSON.serialize(label)),"ts":\#(formatTimestamp())}"#) }, finalize: { output("]\n") From a0b8448a1ffadaaa75e78d0092dc7307783ff2b5 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 19:40:36 +0900 Subject: [PATCH 186/252] BridgeJS: Add `IntrinsicJSFragment.PrintCodeContext` Prepare to extend the context more --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 79 ++- .../Sources/BridgeJSLink/JSGlueGen.swift | 645 +++++++++++------- 2 files changed, 468 insertions(+), 256 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 2695d9861..7e6ce9b55 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -717,8 +717,11 @@ public struct BridgeJSLink { functionName: String ) throws -> [String] { let printer = CodeFragmentPrinter() - let scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) - let cleanupCode = CodeFragmentPrinter() + let context = IntrinsicJSFragment.PrintCodeContext( + scope: JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry), + printer: printer, + cleanupCode: CodeFragmentPrinter() + ) // Build parameter list for invoke function var invokeParams: [String] = ["callbackId"] @@ -746,7 +749,7 @@ public struct BridgeJSLink { } else { args = ["param\(index)Id", "param\(index)"] } - _ = try fragment.printCode(args, scope, printer, cleanupCode) + _ = try fragment.printCode(args, context) } let callbackParams = signature.parameters.indices.map { "param\($0)" }.joined(separator: ", ") @@ -765,13 +768,13 @@ public struct BridgeJSLink { } let returnFragment = try IntrinsicJSFragment.closureLowerReturn(type: signature.returnType) - _ = try returnFragment.printCode(["result"], scope, printer, cleanupCode) + _ = try returnFragment.printCode(["result"], context) } printer.write("} catch (error) {") try printer.indent { printer.write("\(JSGlueVariableScope.reservedSetException)?.(error);") let errorFragment = IntrinsicJSFragment.closureErrorReturn(type: signature.returnType) - _ = try errorFragment.printCode([], scope, printer, cleanupCode) + _ = try errorFragment.printCode([], context) } printer.write("}") } @@ -786,8 +789,11 @@ public struct BridgeJSLink { functionName: String ) throws -> [String] { let printer = CodeFragmentPrinter() - let scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) - let cleanupCode = CodeFragmentPrinter() + let context = IntrinsicJSFragment.PrintCodeContext( + scope: JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry), + printer: printer, + cleanupCode: CodeFragmentPrinter() + ) printer.write( "const \(functionName) = function(\(signature.parameters.indices.map { "param\($0)" }.joined(separator: ", "))) {" @@ -798,7 +804,7 @@ public struct BridgeJSLink { for (index, paramType) in signature.parameters.enumerated() { let paramName = "param\(index)" let fragment = try IntrinsicJSFragment.lowerParameter(type: paramType) - let lowered = try fragment.printCode([paramName], scope, printer, cleanupCode) + let lowered = try fragment.printCode([paramName], context) invokeArgs.append(contentsOf: lowered) } @@ -822,7 +828,7 @@ public struct BridgeJSLink { printer.write("}") let returnFragment = try IntrinsicJSFragment.closureLiftReturn(type: signature.returnType) - _ = try returnFragment.printCode([invokeResultName], scope, printer, cleanupCode) + _ = try returnFragment.printCode([invokeResultName], context) } printer.write("};") @@ -1010,7 +1016,14 @@ public struct BridgeJSLink { let structScope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) let structCleanup = CodeFragmentPrinter() let fragment = IntrinsicJSFragment.structHelper(structDefinition: structDef, allStructs: allStructs) - _ = try fragment.printCode([structDef.name], structScope, structPrinter, structCleanup) + _ = try fragment.printCode( + [structDef.name], + IntrinsicJSFragment.PrintCodeContext( + scope: structScope, + printer: structPrinter, + cleanupCode: structCleanup + ) + ) bodyPrinter.write(lines: structPrinter.lines) } @@ -1022,7 +1035,14 @@ public struct BridgeJSLink { let enumScope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) let enumCleanup = CodeFragmentPrinter() let fragment = IntrinsicJSFragment.associatedValueEnumHelperFactory(enumDefinition: enumDef) - _ = try fragment.printCode([enumDef.valuesName], enumScope, enumPrinter, enumCleanup) + _ = try fragment.printCode( + [enumDef.valuesName], + IntrinsicJSFragment.PrintCodeContext( + scope: enumScope, + printer: enumPrinter, + cleanupCode: enumCleanup + ) + ) bodyPrinter.write(lines: enumPrinter.lines) } bodyPrinter.nextLine() @@ -1269,12 +1289,18 @@ public struct BridgeJSLink { var parameterForwardings: [String] = [] let effects: Effects let scope: JSGlueVariableScope + let context: IntrinsicJSFragment.PrintCodeContext init(effects: Effects, intrinsicRegistry: JSIntrinsicRegistry) { self.effects = effects self.scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) self.body = CodeFragmentPrinter() self.cleanupCode = CodeFragmentPrinter() + self.context = IntrinsicJSFragment.PrintCodeContext( + scope: scope, + printer: body, + cleanupCode: cleanupCode + ) } func lowerParameter(param: Parameter) throws { @@ -1283,7 +1309,7 @@ public struct BridgeJSLink { loweringFragment.parameters.count == 1, "Lowering fragment should have exactly one parameter to lower" ) - let loweredValues = try loweringFragment.printCode([param.name], scope, body, cleanupCode) + let loweredValues = try loweringFragment.printCode([param.name], context) parameterForwardings.append(contentsOf: loweredValues) } @@ -1315,7 +1341,7 @@ public struct BridgeJSLink { body.write("const \(returnVariable) = \(call);") fragmentArguments = [returnVariable] } - let liftedValues = try liftingFragment.printCode(fragmentArguments, scope, body, cleanupCode) + let liftedValues = try liftingFragment.printCode(fragmentArguments, context) assert(liftedValues.count <= 1, "Lifting fragment should produce at most one value") return liftedValues.first } @@ -1566,14 +1592,18 @@ public struct BridgeJSLink { var jsTopLevelLines: [String] = [] var dtsTypeLines: [String] = [] let scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) - let cleanup = CodeFragmentPrinter() let printer = CodeFragmentPrinter() + let context = IntrinsicJSFragment.PrintCodeContext( + scope: scope, + printer: printer, + cleanupCode: CodeFragmentPrinter() + ) let enumValuesName = enumDefinition.valuesName switch enumDefinition.enumType { case .simple: let fragment = IntrinsicJSFragment.simpleEnumHelper(enumDefinition: enumDefinition) - _ = try fragment.printCode([enumValuesName], scope, printer, cleanup) + _ = try fragment.printCode([enumValuesName], context) jsTopLevelLines.append(contentsOf: printer.lines) case .rawValue: guard enumDefinition.rawType != nil else { @@ -1581,11 +1611,11 @@ public struct BridgeJSLink { } let fragment = IntrinsicJSFragment.rawValueEnumHelper(enumDefinition: enumDefinition) - _ = try fragment.printCode([enumValuesName], scope, printer, cleanup) + _ = try fragment.printCode([enumValuesName], context) jsTopLevelLines.append(contentsOf: printer.lines) case .associatedValue: let fragment = IntrinsicJSFragment.associatedValueEnumValues(enumDefinition: enumDefinition) - _ = try fragment.printCode([enumValuesName], scope, printer, cleanup) + _ = try fragment.printCode([enumValuesName], context) jsTopLevelLines.append(contentsOf: printer.lines) case .namespace: break @@ -2155,12 +2185,18 @@ extension BridgeJSLink { let context: BridgeContext var parameterNames: [String] = [] var parameterForwardings: [String] = [] + let printContext: IntrinsicJSFragment.PrintCodeContext init(context: BridgeContext = .importTS, intrinsicRegistry: JSIntrinsicRegistry) { self.body = CodeFragmentPrinter() self.scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) self.cleanupCode = CodeFragmentPrinter() self.context = context + self.printContext = IntrinsicJSFragment.PrintCodeContext( + scope: scope, + printer: body, + cleanupCode: cleanupCode + ) } func liftSelf() { @@ -2179,7 +2215,7 @@ extension BridgeJSLink { valuesToLift = liftingFragment.parameters.map { scope.variable(param.name + $0.capitalizedFirstLetter) } parameterNames.append(contentsOf: valuesToLift) } - let liftedValues = try liftingFragment.printCode(valuesToLift, scope, body, cleanupCode) + let liftedValues = try liftingFragment.printCode(valuesToLift, printContext) assert(liftedValues.count == 1, "Lifting fragment should produce exactly one value") parameterForwardings.append(contentsOf: liftedValues) } @@ -2289,7 +2325,7 @@ extension BridgeJSLink { ) let fragment = try IntrinsicJSFragment.protocolPropertyOptionalToSideChannel(wrappedType: wrappedType) - _ = try fragment.printCode([resultVar], scope, body, cleanupCode) + _ = try fragment.printCode([resultVar], printContext) return nil // Side-channel types return nil (no direct return value) } @@ -2342,7 +2378,10 @@ extension BridgeJSLink { loweringFragment: IntrinsicJSFragment ) throws -> String? { assert(loweringFragment.parameters.count <= 1, "Lowering fragment should have at most one parameter") - let loweredValues = try loweringFragment.printCode(returnExpr.map { [$0] } ?? [], scope, body, cleanupCode) + let loweredValues = try loweringFragment.printCode( + returnExpr.map { [$0] } ?? [], + printContext + ) assert(loweredValues.count <= 1, "Lowering fragment should produce at most one value") return loweredValues.first } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 6e1ead728..c60cc2dbf 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -146,31 +146,54 @@ extension JSGlueVariableScope { /// /// See `BridgeJSIntrinsics.swift` in the main JavaScriptKit module for Swift side lowering/lifting implementation. struct IntrinsicJSFragment: Sendable { - /// The names of the parameters that the fragment expects. - let parameters: [String] - /// Prints the fragment code. + struct PrintCodeContext { + /// The scope of the variables. + var scope: JSGlueVariableScope + /// The printer to print the main fragment code. + var printer: CodeFragmentPrinter + /// The printer to print the code that is expected to be executed at the end of the caller of the fragment. + var cleanupCode: CodeFragmentPrinter + + func with(_ keyPath: WritableKeyPath, _ value: T) -> PrintCodeContext { + var new = self + new[keyPath: keyPath] = value + return new + } + } + + /// A function that prints the fragment code. /// /// - Parameters: /// - arguments: The arguments that the fragment expects. An argument may be an expression with side effects, /// so the callee is responsible for evaluating the arguments only once. - /// - scope: The scope of the variables. - /// - printer: The printer to print the main fragment code. - /// - cleanupCode: The printer to print the code that is expected to be executed at the end of the caller of the - /// fragment. + /// - context: The context of the printing. /// - Returns: List of result expressions. - let printCode: + typealias PrintCode = @Sendable ( _ arguments: [String], - _ scope: JSGlueVariableScope, - _ printer: CodeFragmentPrinter, - _ cleanupCode: CodeFragmentPrinter + _ context: PrintCodeContext ) throws -> [String] + /// The names of the parameters that the fragment expects. + let parameters: [String] + + /// Prints the fragment code. + let printCode: PrintCode + + init(parameters: [String], printCode: @escaping PrintCode) { + self.parameters = parameters + self.printCode = printCode + } + + func printCode(_ arguments: [String], _ context: PrintCodeContext) throws -> [String] { + return try printCode(arguments, context) + } + /// A fragment that does nothing static let void = IntrinsicJSFragment( parameters: [], - printCode: { _, _, _, _ in + printCode: { _, _ in return [] } ) @@ -178,7 +201,7 @@ struct IntrinsicJSFragment: Sendable { /// A fragment that returns the argument as is. static let identity = IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, _ in return [arguments[0]] } ) @@ -188,19 +211,19 @@ struct IntrinsicJSFragment: Sendable { static let boolLowerParameter = identity static let boolLiftReturn = IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, _ in return ["\(arguments[0]) !== 0"] } ) static let boolLiftParameter = IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, _ in return ["\(arguments[0]) !== 0"] } ) static let boolLowerReturn = IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, _ in return ["\(arguments[0]) ? 1 : 0"] } ) @@ -208,7 +231,7 @@ struct IntrinsicJSFragment: Sendable { /// Convert signed Int32 to unsigned for UInt values static let uintLiftReturn = IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, _ in return ["\(arguments[0]) >>> 0"] } ) @@ -216,7 +239,8 @@ struct IntrinsicJSFragment: Sendable { static let stringLowerParameter = IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let argument = arguments[0] let bytesLabel = scope.variable("\(argument)Bytes") let bytesIdLabel = scope.variable("\(argument)Id") @@ -228,7 +252,8 @@ struct IntrinsicJSFragment: Sendable { ) static let stringLiftReturn = IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let resultLabel = scope.variable("ret") printer.write("const \(resultLabel) = \(JSGlueVariableScope.reservedStorageToReturnString);") printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = undefined;") @@ -237,7 +262,8 @@ struct IntrinsicJSFragment: Sendable { ) static let stringLiftParameter = IntrinsicJSFragment( parameters: ["objectId"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let objectId = arguments[0] let objectLabel = scope.variable("\(objectId)Object") // TODO: Implement "take" operation @@ -248,7 +274,8 @@ struct IntrinsicJSFragment: Sendable { ) static let stringLowerReturn = IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) printer.write( "\(JSGlueVariableScope.reservedStorageToReturnBytes) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(arguments[0]));" ) @@ -258,13 +285,14 @@ struct IntrinsicJSFragment: Sendable { static let jsObjectLowerParameter = IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, _ in return ["swift.memory.retain(\(arguments[0]))"] } ) static let jsObjectLiftReturn = IntrinsicJSFragment( parameters: ["retId"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) // TODO: Implement "take" operation let resultLabel = scope.variable("ret") let retId = arguments[0] @@ -275,7 +303,8 @@ struct IntrinsicJSFragment: Sendable { ) static let jsObjectLiftRetainedObjectId = IntrinsicJSFragment( parameters: ["objectId"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let resultLabel = scope.variable("value") let objectId = arguments[0] printer.write( @@ -287,13 +316,13 @@ struct IntrinsicJSFragment: Sendable { ) static let jsObjectLiftParameter = IntrinsicJSFragment( parameters: ["objectId"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, _ in return ["\(JSGlueVariableScope.reservedSwift).memory.getObject(\(arguments[0]))"] } ) static let jsObjectLowerReturn = IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, _ in return ["\(JSGlueVariableScope.reservedSwift).memory.retain(\(arguments[0]))"] } ) @@ -419,7 +448,8 @@ struct IntrinsicJSFragment: Sendable { static let jsValueLower = IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let value = arguments[0] let kindVar = scope.variable("\(value)Kind") let payload1Var = scope.variable("\(value)Payload1") @@ -507,8 +537,9 @@ struct IntrinsicJSFragment: Sendable { // via the parameter stacks that `_swift_js_pop_*` read from. return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in - let lowered = try jsValueLower.printCode(arguments, scope, printer, cleanupCode) + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) + let lowered = try jsValueLower.printCode(arguments, context) let kindVar = lowered[0] let payload1Var = lowered[1] let payload2Var = lowered[2] @@ -523,8 +554,12 @@ struct IntrinsicJSFragment: Sendable { // to tmpRet stacks directly. return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in - let lowered = try jsValueLower.printCode(arguments, scope, printer, cleanupCode) + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) + let lowered = try jsValueLower.printCode( + arguments, + context + ) let kindVar = lowered[0] let payload1Var = lowered[1] let payload2Var = lowered[2] @@ -539,7 +574,8 @@ struct IntrinsicJSFragment: Sendable { static let jsValueLift = IntrinsicJSFragment( parameters: [], - printCode: { _, scope, printer, cleanupCode in + printCode: { _, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let payload2 = scope.variable("jsValuePayload2") let payload1 = scope.variable("jsValuePayload1") let kind = scope.variable("jsValueKind") @@ -556,7 +592,8 @@ struct IntrinsicJSFragment: Sendable { ) static let jsValueLiftParameter = IntrinsicJSFragment( parameters: ["kind", "payload1", "payload2"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let resultVar = scope.variable("jsValue") registerJSValueHelpers(scope: scope) printer.write( @@ -568,14 +605,14 @@ struct IntrinsicJSFragment: Sendable { static let swiftHeapObjectLowerParameter = IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in return ["\(arguments[0]).pointer"] } ) static func swiftHeapObjectLiftReturn(_ name: String) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in return ["\(name).__construct(\(arguments[0]))"] } ) @@ -583,14 +620,14 @@ struct IntrinsicJSFragment: Sendable { static func swiftHeapObjectLiftParameter(_ name: String) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["pointer"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in return ["_exports['\(name)'].__construct(\(arguments[0]))"] } ) } static let swiftHeapObjectLowerReturn = IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in return ["\(arguments[0]).pointer"] } ) @@ -598,7 +635,8 @@ struct IntrinsicJSFragment: Sendable { static func associatedEnumLowerParameter(enumBase: String) -> IntrinsicJSFragment { IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (printer, cleanup) = (context.printer, context.cleanupCode) let value = arguments[0] let caseIdName = "\(value)CaseId" let cleanupName = "\(value)Cleanup" @@ -614,7 +652,8 @@ struct IntrinsicJSFragment: Sendable { static func associatedEnumLiftReturn(enumBase: String) -> IntrinsicJSFragment { IntrinsicJSFragment( parameters: [], - printCode: { _, scope, printer, _ in + printCode: { _, context in + let (scope, printer) = (context.scope, context.printer) let retName = scope.variable("ret") printer.write( "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lift(\(scope.popTag()));" @@ -628,13 +667,11 @@ struct IntrinsicJSFragment: Sendable { if case .jsValue = wrappedType { return IntrinsicJSFragment( parameters: ["isSome", "kind", "payload1", "payload2"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in let isSome = arguments[0] let lifted = try jsValueLiftParameter.printCode( [arguments[1], arguments[2], arguments[3]], - scope, - printer, - cleanupCode + context ) let valueExpr = lifted.first ?? "undefined" return ["\(isSome) ? \(valueExpr) : null"] @@ -644,7 +681,8 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["isSome", "wrappedValue"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let isSome = arguments[0] let wrappedValue = arguments[1] let resultExpr: String @@ -728,7 +766,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSome)) {") try printer.indent { let arrayLiftFragment = try arrayLift(elementType: elementType) - let liftResults = try arrayLiftFragment.printCode([], scope, printer, cleanupCode) + let liftResults = try arrayLiftFragment.printCode([], context) if let liftResult = liftResults.first { printer.write("\(arrayVar) = \(liftResult);") } @@ -745,7 +783,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSome)) {") try printer.indent { let dictLiftFragment = try dictionaryLift(valueType: valueType) - let liftResults = try dictLiftFragment.printCode([], scope, printer, cleanupCode) + let liftResults = try dictLiftFragment.printCode([], context) if let liftResult = liftResults.first { printer.write("\(dictVar) = \(liftResult);") } @@ -768,7 +806,8 @@ struct IntrinsicJSFragment: Sendable { static func optionalLowerParameter(wrappedType: BridgeType) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let value = arguments[0] let isSomeVar = scope.variable("isSome") printer.write("const \(isSomeVar) = \(value) != null;") @@ -808,7 +847,7 @@ struct IntrinsicJSFragment: Sendable { return ["+\(isSomeVar)", "\(isSomeVar) ? \(idVar) : 0", "\(isSomeVar) ? \(bytesVar).length : 0"] case .jsValue: - let lowered = try jsValueLower.printCode([value], scope, printer, cleanupCode) + let lowered = try jsValueLower.printCode([value], context) return ["+\(isSomeVar)"] + lowered case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName @@ -839,7 +878,10 @@ struct IntrinsicJSFragment: Sendable { try printer.indent { let arrayLowerFragment = try arrayLower(elementType: elementType) let arrayCleanup = CodeFragmentPrinter() - let _ = try arrayLowerFragment.printCode([value], scope, printer, arrayCleanup) + let _ = try arrayLowerFragment.printCode( + [value], + context.with(\.cleanupCode, arrayCleanup) + ) if !arrayCleanup.lines.isEmpty { for line in arrayCleanup.lines { printer.write("\(cleanupArrayVar).push(() => { \(line) });") @@ -856,7 +898,10 @@ struct IntrinsicJSFragment: Sendable { try printer.indent { let dictLowerFragment = try dictionaryLower(valueType: valueType) let dictCleanup = CodeFragmentPrinter() - let _ = try dictLowerFragment.printCode([value], scope, printer, dictCleanup) + let _ = try dictLowerFragment.printCode( + [value], + context.with(\.cleanupCode, dictCleanup) + ) if !dictCleanup.lines.isEmpty { for line in dictCleanup.lines { printer.write("\(cleanupArrayVar).push(() => { \(line) });") @@ -903,9 +948,11 @@ struct IntrinsicJSFragment: Sendable { kind: JSOptionalKind ) -> IntrinsicJSFragment { let absenceLiteral = kind.absenceLiteral + let bridgeContext = context return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let resultVar = scope.variable("optResult") switch wrappedType { case .bool: @@ -933,7 +980,7 @@ struct IntrinsicJSFragment: Sendable { ) printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject) = undefined;") let constructExpr = - context == .exportSwift + bridgeContext == .exportSwift ? "\(className).__construct(\(pointerVar))" : "_exports['\(className)'].__construct(\(pointerVar))" printer.write( @@ -1007,7 +1054,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") try printer.indent { let arrayLiftFragment = try arrayLift(elementType: elementType) - let liftResults = try arrayLiftFragment.printCode([], scope, printer, cleanupCode) + let liftResults = try arrayLiftFragment.printCode([], context) if let liftResult = liftResults.first { printer.write("\(resultVar) = \(liftResult);") } @@ -1024,7 +1071,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") try printer.indent { let dictLiftFragment = try dictionaryLift(valueType: valueType) - let liftResults = try dictLiftFragment.printCode([], scope, printer, cleanupCode) + let liftResults = try dictLiftFragment.printCode([], context) if let liftResult = liftResults.first { printer.write("\(resultVar) = \(liftResult);") } @@ -1040,7 +1087,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("let \(resultVar);") printer.write("if (\(isSomeVar)) {") try printer.indent { - let lifted = try jsValueLift.printCode([], scope, printer, cleanupCode) + let lifted = try jsValueLift.printCode([], context) if let liftedValue = lifted.first { printer.write("\(resultVar) = \(liftedValue);") } @@ -1068,7 +1115,8 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let value = arguments[0] let isSomeVar = scope.variable("isSome") let presenceExpr = kind.presenceCheck(value: value) @@ -1114,7 +1162,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("bjs[\"swift_js_return_optional_object\"](\(isSomeVar) ? 1 : 0, \(idVar));") case .jsValue: if value != "undefined" { - let lowered = try jsValueLower.printCode([value], scope, printer, cleanupCode) + let lowered = try jsValueLower.printCode([value], context) let kindVar = lowered[0] let payload1Var = lowered[1] let payload2Var = lowered[2] @@ -1130,7 +1178,10 @@ struct IntrinsicJSFragment: Sendable { try printer.indent { let arrayLowerFragment = try arrayLower(elementType: elementType) let arrayCleanup = CodeFragmentPrinter() - let _ = try arrayLowerFragment.printCode([value], scope, printer, arrayCleanup) + let _ = try arrayLowerFragment.printCode( + [value], + context.with(\.cleanupCode, arrayCleanup) + ) if !arrayCleanup.lines.isEmpty { for line in arrayCleanup.lines { printer.write(line) @@ -1204,7 +1255,10 @@ struct IntrinsicJSFragment: Sendable { let keyFragment = try stackLowerFragment(elementType: .string) let keyCleanup = CodeFragmentPrinter() - let _ = try keyFragment.printCode([keyVar], scope, printer, keyCleanup) + let _ = try keyFragment.printCode( + [keyVar], + context.with(\.cleanupCode, keyCleanup) + ) if !keyCleanup.lines.isEmpty { printer.write("\(cleanupArrayVar).push(() => {") printer.indent { @@ -1217,7 +1271,10 @@ struct IntrinsicJSFragment: Sendable { let valueFragment = try stackLowerFragment(elementType: valueType) let valueCleanup = CodeFragmentPrinter() - let _ = try valueFragment.printCode([valueVar], scope, printer, valueCleanup) + let _ = try valueFragment.printCode( + [valueVar], + context.with(\.cleanupCode, valueCleanup) + ) if !valueCleanup.lines.isEmpty { printer.write("\(cleanupArrayVar).push(() => {") printer.indent { @@ -1268,7 +1325,8 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer let value = arguments[0] switch wrappedType { @@ -1299,7 +1357,8 @@ struct IntrinsicJSFragment: Sendable { case .int, .float, .double, .caseEnum: return IntrinsicJSFragment( parameters: ["value", "targetVar"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer printer.write("let \(arguments[1]) = \(arguments[0]);") return [] } @@ -1307,9 +1366,10 @@ struct IntrinsicJSFragment: Sendable { case .bool: return IntrinsicJSFragment( parameters: ["value", "targetVar"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer let baseFragment = boolLiftParameter - let lifted = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([arguments[0]], context) printer.write("let \(arguments[1]) = \(lifted[0]);") return [] } @@ -1317,9 +1377,10 @@ struct IntrinsicJSFragment: Sendable { case .string: return IntrinsicJSFragment( parameters: ["objectId", "targetVar"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer let baseFragment = stringLiftParameter - let lifted = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([arguments[0]], context) printer.write("let \(arguments[1]) = String(\(lifted[0]));") return [] } @@ -1329,9 +1390,10 @@ struct IntrinsicJSFragment: Sendable { case .string: return IntrinsicJSFragment( parameters: ["objectId", "targetVar"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer let baseFragment = stringLiftParameter - let lifted = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([arguments[0]], context) printer.write("let \(arguments[1]) = String(\(lifted[0]));") return [] } @@ -1339,9 +1401,10 @@ struct IntrinsicJSFragment: Sendable { case .bool: return IntrinsicJSFragment( parameters: ["value", "targetVar"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer let baseFragment = boolLiftParameter - let lifted = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([arguments[0]], context) printer.write("let \(arguments[1]) = \(lifted[0]);") return [] } @@ -1349,7 +1412,8 @@ struct IntrinsicJSFragment: Sendable { default: return IntrinsicJSFragment( parameters: ["value", "targetVar"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer printer.write("let \(arguments[1]) = \(arguments[0]);") return [] } @@ -1358,7 +1422,8 @@ struct IntrinsicJSFragment: Sendable { case .jsObject: return IntrinsicJSFragment( parameters: ["objectId", "targetVar"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer let objectId = arguments[0] let targetVar = arguments[1] printer.write( @@ -1371,7 +1436,8 @@ struct IntrinsicJSFragment: Sendable { case .swiftHeapObject(let name): return IntrinsicJSFragment( parameters: ["pointer", "targetVar"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer let pointer = arguments[0] let targetVar = arguments[1] printer.write("let \(targetVar) = _exports['\(name)'].__construct(\(pointer));") @@ -1381,7 +1447,8 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): return IntrinsicJSFragment( parameters: ["caseId", "targetVar"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer let caseId = arguments[0] let targetVar = arguments[1] let base = fullName.components(separatedBy: ".").last ?? fullName @@ -1416,7 +1483,8 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["isSome", "value", "targetVar"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let isSome = arguments[0] let value = arguments[1] let targetVar = arguments[2] @@ -1483,72 +1551,72 @@ struct IntrinsicJSFragment: Sendable { case .void: return IntrinsicJSFragment( parameters: ["result"], - printCode: { _, _, printer, _ in - printer.write("return;") + printCode: { _, context in + context.printer.write("return;") return [] } ) case .int, .caseEnum: return IntrinsicJSFragment( parameters: ["result"], - printCode: { arguments, scope, printer, cleanupCode in - printer.write("return \(arguments[0]) | 0;") + printCode: { arguments, context in + context.printer.write("return \(arguments[0]) | 0;") return [] } ) case .bool: return IntrinsicJSFragment( parameters: ["result"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in let baseFragment = boolLowerReturn - let lowered = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) - printer.write("return \(lowered[0]);") + let lowered = try baseFragment.printCode([arguments[0]], context) + context.printer.write("return \(lowered[0]);") return [] } ) case .float: return IntrinsicJSFragment( parameters: ["result"], - printCode: { arguments, scope, printer, cleanupCode in - printer.write("return Math.fround(\(arguments[0]));") + printCode: { arguments, context in + context.printer.write("return Math.fround(\(arguments[0]));") return [] } ) case .double: return IntrinsicJSFragment( parameters: ["result"], - printCode: { arguments, scope, printer, cleanupCode in - printer.write("return \(arguments[0]);") + printCode: { arguments, context in + context.printer.write("return \(arguments[0]);") return [] } ) case .string: return IntrinsicJSFragment( parameters: ["result"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in let baseFragment = stringLowerReturn - let lowered = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) - printer.write("return \(lowered[0]);") + let lowered = try baseFragment.printCode([arguments[0]], context) + context.printer.write("return \(lowered[0]);") return [] } ) case .jsObject: return IntrinsicJSFragment( parameters: ["result"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in let baseFragment = jsObjectLowerReturn - let lowered = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) - printer.write("return \(lowered[0]);") + let lowered = try baseFragment.printCode([arguments[0]], context) + context.printer.write("return \(lowered[0]);") return [] } ) case .swiftHeapObject: return IntrinsicJSFragment( parameters: ["result"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in let baseFragment = swiftHeapObjectLowerReturn - let lowered = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) - printer.write("return \(lowered[0]);") + let lowered = try baseFragment.printCode([arguments[0]], context) + context.printer.write("return \(lowered[0]);") return [] } ) @@ -1557,28 +1625,28 @@ struct IntrinsicJSFragment: Sendable { case .string: return IntrinsicJSFragment( parameters: ["result"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in let baseFragment = stringLowerReturn - let lowered = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) - printer.write("return \(lowered[0]);") + let lowered = try baseFragment.printCode([arguments[0]], context) + context.printer.write("return \(lowered[0]);") return [] } ) case .bool: return IntrinsicJSFragment( parameters: ["result"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in let baseFragment = boolLowerReturn - let lowered = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) - printer.write("return \(lowered[0]);") + let lowered = try baseFragment.printCode([arguments[0]], context) + context.printer.write("return \(lowered[0]);") return [] } ) default: return IntrinsicJSFragment( parameters: ["result"], - printCode: { arguments, scope, printer, cleanupCode in - printer.write("return \(arguments[0]) | 0;") + printCode: { arguments, context in + context.printer.write("return \(arguments[0]) | 0;") return [] } ) @@ -1586,7 +1654,8 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): return IntrinsicJSFragment( parameters: ["result"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let result = arguments[0] let base = fullName.components(separatedBy: ".").last ?? fullName let caseIdVar = scope.variable("caseId") @@ -1610,7 +1679,8 @@ struct IntrinsicJSFragment: Sendable { private static func closureOptionalLowerReturn(wrappedType: BridgeType) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["result"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let result = arguments[0] switch wrappedType { @@ -1685,7 +1755,8 @@ struct IntrinsicJSFragment: Sendable { case .void: return IntrinsicJSFragment( parameters: ["invokeCall"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer printer.write("\(arguments[0]);") printer.write("return;") return [] @@ -1694,55 +1765,56 @@ struct IntrinsicJSFragment: Sendable { case .int, .caseEnum: return IntrinsicJSFragment( parameters: ["invokeCall"], - printCode: { arguments, scope, printer, cleanupCode in - printer.write("return \(arguments[0]) | 0;") + printCode: { arguments, context in + context.printer.write("return \(arguments[0]) | 0;") return [] } ) case .bool: return IntrinsicJSFragment( parameters: ["invokeCall"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in let baseFragment = boolLiftReturn - let lifted = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) - printer.write("return \(lifted[0]);") + let lifted = try baseFragment.printCode([arguments[0]], context) + context.printer.write("return \(lifted[0]);") return [] } ) case .float, .double: return IntrinsicJSFragment( parameters: ["invokeCall"], - printCode: { arguments, scope, printer, cleanupCode in - printer.write("return \(arguments[0]);") + printCode: { arguments, context in + context.printer.write("return \(arguments[0]);") return [] } ) case .string: return IntrinsicJSFragment( parameters: ["invokeCall"], - printCode: { arguments, scope, printer, cleanupCode in - printer.write("const resultLen = \(arguments[0]);") + printCode: { arguments, context in + context.printer.write("const resultLen = \(arguments[0]);") let baseFragment = stringLiftReturn - let lifted = try baseFragment.printCode([], scope, printer, cleanupCode) - printer.write("return \(lifted[0]);") + let lifted = try baseFragment.printCode([], context) + context.printer.write("return \(lifted[0]);") return [] } ) case .jsObject: return IntrinsicJSFragment( parameters: ["invokeCall"], - printCode: { arguments, scope, printer, cleanupCode in - printer.write("const resultId = \(arguments[0]);") + printCode: { arguments, context in + context.printer.write("const resultId = \(arguments[0]);") let baseFragment = jsObjectLiftReturn - let lifted = try baseFragment.printCode(["resultId"], scope, printer, cleanupCode) - printer.write("return \(lifted[0]);") + let lifted = try baseFragment.printCode(["resultId"], context) + context.printer.write("return \(lifted[0]);") return [] } ) case .swiftHeapObject(let className): return IntrinsicJSFragment( parameters: ["invokeCall"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer printer.write("const resultPtr = \(arguments[0]);") printer.write("return _exports['\(className)'].__construct(resultPtr);") return [] @@ -1751,7 +1823,8 @@ struct IntrinsicJSFragment: Sendable { case .closure: return IntrinsicJSFragment( parameters: ["invokeCall"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let funcRefVar = scope.variable("swiftClosureFuncRef") printer.write("const \(funcRefVar) = \(arguments[0]);") printer.write( @@ -1767,20 +1840,22 @@ struct IntrinsicJSFragment: Sendable { case .string: return IntrinsicJSFragment( parameters: ["invokeCall"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer printer.write("const resultLen = \(arguments[0]);") let baseFragment = stringLiftReturn - let lifted = try baseFragment.printCode([], scope, printer, cleanupCode) - printer.write("return \(lifted[0]);") + let lifted = try baseFragment.printCode([], context) + context.printer.write("return \(lifted[0]);") return [] } ) case .bool: return IntrinsicJSFragment( parameters: ["invokeCall"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer let baseFragment = boolLiftReturn - let lifted = try baseFragment.printCode([arguments[0]], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([arguments[0]], context) printer.write("return \(lifted[0]);") return [] } @@ -1788,8 +1863,8 @@ struct IntrinsicJSFragment: Sendable { default: return IntrinsicJSFragment( parameters: ["invokeCall"], - printCode: { arguments, scope, printer, cleanupCode in - printer.write("return \(arguments[0]) | 0;") + printCode: { arguments, context in + context.printer.write("return \(arguments[0]) | 0;") return [] } ) @@ -1797,7 +1872,8 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): return IntrinsicJSFragment( parameters: ["invokeCall"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) printer.write("\(arguments[0]);") let base = fullName.components(separatedBy: ".").last ?? fullName let resultVar = scope.variable("result") @@ -1822,7 +1898,8 @@ struct IntrinsicJSFragment: Sendable { ) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["invokeCall"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer let invokeCall = arguments[0] printer.write("\(invokeCall);") let baseFragment = optionalLiftReturn( @@ -1830,7 +1907,7 @@ struct IntrinsicJSFragment: Sendable { context: .importTS, kind: kind ) - let lifted = try baseFragment.printCode([], scope, printer, cleanupCode) + let lifted = try baseFragment.printCode([], context) if !lifted.isEmpty { printer.write("return \(lifted[0]);") } @@ -1843,7 +1920,8 @@ struct IntrinsicJSFragment: Sendable { static func closureErrorReturn(type: BridgeType) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer switch type { case .void: printer.write("return;") @@ -1914,7 +1992,8 @@ struct IntrinsicJSFragment: Sendable { case .closure: return IntrinsicJSFragment( parameters: ["closure"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let closure = arguments[0] let callbackIdVar = scope.variable("callbackId") printer.write( @@ -1963,7 +2042,7 @@ struct IntrinsicJSFragment: Sendable { case .closure: return IntrinsicJSFragment( parameters: ["funcRef"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in let funcRef = arguments[0] return ["\(JSGlueVariableScope.reservedSwift).memory.getObject(\(funcRef))"] } @@ -2018,7 +2097,8 @@ struct IntrinsicJSFragment: Sendable { let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( parameters: ["caseId"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let caseId = arguments[0] let resultVar = scope.variable("enumValue") printer.write( @@ -2036,7 +2116,8 @@ struct IntrinsicJSFragment: Sendable { let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let resultVar = scope.variable("structValue") printer.write( "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lift();" @@ -2048,7 +2129,7 @@ struct IntrinsicJSFragment: Sendable { case .closure: return IntrinsicJSFragment( parameters: ["funcRef"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in let funcRef = arguments[0] return ["\(JSGlueVariableScope.reservedSwift).memory.getObject(\(funcRef))"] } @@ -2108,7 +2189,8 @@ struct IntrinsicJSFragment: Sendable { case .closure: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let printer = context.printer let value = arguments[0] printer.write("if (typeof \(value) !== \"function\") {") printer.indent { @@ -2135,7 +2217,8 @@ struct IntrinsicJSFragment: Sendable { let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let value = arguments[0] let caseIdVar = scope.variable("caseId") let cleanupVar = scope.variable("cleanup") @@ -2154,7 +2237,8 @@ struct IntrinsicJSFragment: Sendable { static func associatedValueEnumValues(enumDefinition: ExportedEnum) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["enumName"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let printer = context.printer let enumName = arguments[0] printer.write("const \(enumName) = {") @@ -2181,7 +2265,8 @@ struct IntrinsicJSFragment: Sendable { static func associatedValueEnumHelperFactory(enumDefinition: ExportedEnum) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["enumName"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let enumName = arguments[0] printer.write("const __bjs_create\(enumName)Helpers = () => {") @@ -2206,9 +2291,11 @@ struct IntrinsicJSFragment: Sendable { let fragment = IntrinsicJSFragment.associatedValuePushPayload(enumCase: enumCase) _ = try fragment.printCode( ["value", enumName, caseName], - caseScope, - lowerPrinter, - caseCleanup + IntrinsicJSFragment.PrintCodeContext( + scope: caseScope, + printer: lowerPrinter, + cleanupCode: caseCleanup + ) ) } @@ -2237,7 +2324,14 @@ struct IntrinsicJSFragment: Sendable { let caseCleanup = CodeFragmentPrinter() let fragment = IntrinsicJSFragment.associatedValuePopPayload(enumCase: enumCase) - _ = try fragment.printCode([enumName, caseName], caseScope, liftPrinter, caseCleanup) + _ = try fragment.printCode( + [enumName, caseName], + IntrinsicJSFragment.PrintCodeContext( + scope: caseScope, + printer: liftPrinter, + cleanupCode: caseCleanup + ) + ) } for line in liftPrinter.lines { @@ -2264,7 +2358,8 @@ struct IntrinsicJSFragment: Sendable { static func simpleEnumHelper(enumDefinition: ExportedEnum) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["enumName"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let printer = context.printer let enumName = arguments[0] printer.write("const \(enumName) = {") printer.indent { @@ -2288,7 +2383,8 @@ struct IntrinsicJSFragment: Sendable { static func rawValueEnumHelper(enumDefinition: ExportedEnum) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["enumName"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let printer = context.printer let enumName = arguments[0] printer.write("const \(enumName) = {") printer.indent { @@ -2312,7 +2408,8 @@ struct IntrinsicJSFragment: Sendable { private static func associatedValuePushPayload(enumCase: EnumCase) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["value", "enumName", "caseName"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) let enumName = arguments[1] let caseName = arguments[2] @@ -2332,7 +2429,7 @@ struct IntrinsicJSFragment: Sendable { type: associatedValue.type ) - _ = try fragment.printCode(["value.\(prop)"], scope, printer, cleanup) + _ = try fragment.printCode(["value.\(prop)"], context) } if cleanup.lines.isEmpty { @@ -2356,7 +2453,8 @@ struct IntrinsicJSFragment: Sendable { private static func associatedValuePopPayload(enumCase: EnumCase) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["enumName", "caseName"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) let enumName = arguments[0] let caseName = arguments[1] @@ -2371,7 +2469,7 @@ struct IntrinsicJSFragment: Sendable { let prop = associatedValue.label ?? "param\(associatedValueIndex)" let fragment = try IntrinsicJSFragment.associatedValuePopPayload(type: associatedValue.type) - let result = try fragment.printCode([], scope, casePrinter, cleanup) + let result = try fragment.printCode([], context.with(\.printer, casePrinter)) let varName = result.first ?? "value_\(associatedValueIndex)" fieldPairs.append("\(prop): \(varName)") @@ -2409,7 +2507,8 @@ struct IntrinsicJSFragment: Sendable { ) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) let value = arguments[0] let isSomeVar = scope.variable("isSome") printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") @@ -2568,7 +2667,10 @@ struct IntrinsicJSFragment: Sendable { try printer.indent { let localCleanup = CodeFragmentPrinter() let arrFragment = try arrayLower(elementType: elementType) - _ = try arrFragment.printCode([value], scope, printer, localCleanup) + _ = try arrFragment.printCode( + [value], + context.with(\.cleanupCode, localCleanup) + ) let cleanupLines = localCleanup.lines.filter { !$0.trimmingCharacters(in: .whitespaces).isEmpty } @@ -2609,7 +2711,8 @@ struct IntrinsicJSFragment: Sendable { ) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) let optVar = scope.variable("optional") let isSomeVar = scope.variable("isSome") @@ -2628,7 +2731,7 @@ struct IntrinsicJSFragment: Sendable { ) } else { let wrappedFragment = try associatedValuePopPayload(type: wrappedType) - let wrappedResults = try wrappedFragment.printCode([], scope, printer, cleanup) + let wrappedResults = try wrappedFragment.printCode([], context) if let wrappedResult = wrappedResults.first { printer.write("\(optVar) = \(wrappedResult);") } else { @@ -2651,7 +2754,8 @@ struct IntrinsicJSFragment: Sendable { let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let value = arguments[0] let cleanupVar = scope.variable("cleanup") printer.write( @@ -2666,7 +2770,8 @@ struct IntrinsicJSFragment: Sendable { static func swiftStructLowerParameter(structBase: String) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let value = arguments[0] let cleanupVar = scope.variable("cleanup") printer.write( @@ -2681,7 +2786,8 @@ struct IntrinsicJSFragment: Sendable { static func swiftStructLiftReturn(structBase: String) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let resultVar = scope.variable("structValue") printer.write( "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lift();" @@ -2697,7 +2803,8 @@ struct IntrinsicJSFragment: Sendable { static func arrayLower(elementType: BridgeType) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["arr"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let arr = arguments[0] let cleanupArrayVar = scope.variable("arrayCleanups") @@ -2707,7 +2814,10 @@ struct IntrinsicJSFragment: Sendable { try printer.indent { let elementFragment = try stackLowerFragment(elementType: elementType) let elementCleanup = CodeFragmentPrinter() - let _ = try elementFragment.printCode([elemVar], scope, printer, elementCleanup) + let _ = try elementFragment.printCode( + [elemVar], + context.with(\.cleanupCode, elementCleanup) + ) if !elementCleanup.lines.isEmpty { printer.write("\(cleanupArrayVar).push(() => {") printer.indent { @@ -2730,7 +2840,8 @@ struct IntrinsicJSFragment: Sendable { static func dictionaryLower(valueType: BridgeType) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["dict"], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) let dict = arguments[0] let cleanupArrayVar = scope.variable("arrayCleanups") @@ -2746,7 +2857,10 @@ struct IntrinsicJSFragment: Sendable { let keyFragment = try stackLowerFragment(elementType: .string) let keyCleanup = CodeFragmentPrinter() - let _ = try keyFragment.printCode([keyVar], scope, printer, keyCleanup) + let _ = try keyFragment.printCode( + [keyVar], + context.with(\.cleanupCode, keyCleanup) + ) if !keyCleanup.lines.isEmpty { printer.write("\(cleanupArrayVar).push(() => {") printer.indent { @@ -2759,7 +2873,10 @@ struct IntrinsicJSFragment: Sendable { let valueFragment = try stackLowerFragment(elementType: valueType) let valueCleanup = CodeFragmentPrinter() - let _ = try valueFragment.printCode([valueVar], scope, printer, valueCleanup) + let _ = try valueFragment.printCode( + [valueVar], + context.with(\.cleanupCode, valueCleanup) + ) if !valueCleanup.lines.isEmpty { printer.write("\(cleanupArrayVar).push(() => {") printer.indent { @@ -2782,7 +2899,8 @@ struct IntrinsicJSFragment: Sendable { static func arrayLift(elementType: BridgeType) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let resultVar = scope.variable("arrayResult") let lenVar = scope.variable("arrayLen") let iVar = scope.variable("i") @@ -2792,7 +2910,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("for (let \(iVar) = 0; \(iVar) < \(lenVar); \(iVar)++) {") try printer.indent { let elementFragment = try stackLiftFragment(elementType: elementType) - let elementResults = try elementFragment.printCode([], scope, printer, cleanupCode) + let elementResults = try elementFragment.printCode([], context) if let elementExpr = elementResults.first { printer.write("\(resultVar).push(\(elementExpr));") } @@ -2808,7 +2926,8 @@ struct IntrinsicJSFragment: Sendable { static func dictionaryLift(valueType: BridgeType) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanupCode in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let resultVar = scope.variable("dictResult") let lenVar = scope.variable("dictLen") let iVar = scope.variable("i") @@ -2818,9 +2937,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("for (let \(iVar) = 0; \(iVar) < \(lenVar); \(iVar)++) {") try printer.indent { let valueFragment = try stackLiftFragment(elementType: valueType) - let valueResults = try valueFragment.printCode([], scope, printer, cleanupCode) + let valueResults = try valueFragment.printCode([], context) let keyFragment = try stackLiftFragment(elementType: .string) - let keyResults = try keyFragment.printCode([], scope, printer, cleanupCode) + let keyResults = try keyFragment.printCode([], context) if let keyExpr = keyResults.first, let valueExpr = valueResults.first { printer.write("\(resultVar)[\(keyExpr)] = \(valueExpr);") } @@ -2836,7 +2955,8 @@ struct IntrinsicJSFragment: Sendable { case .jsValue: return IntrinsicJSFragment( parameters: [], - printCode: { _, scope, printer, cleanup in + printCode: { _, context in + let (scope, printer) = (context.scope, context.printer) let payload2Var = scope.variable("jsValuePayload2") let payload1Var = scope.variable("jsValuePayload1") let kindVar = scope.variable("jsValueKind") @@ -2854,7 +2974,8 @@ struct IntrinsicJSFragment: Sendable { case .string: return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let strVar = scope.variable("string") printer.write("const \(strVar) = \(scope.popString());") return [strVar] @@ -2863,7 +2984,8 @@ struct IntrinsicJSFragment: Sendable { case .bool: return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let bVar = scope.variable("bool") printer.write("const \(bVar) = \(scope.popI32()) !== 0;") return [bVar] @@ -2872,7 +2994,8 @@ struct IntrinsicJSFragment: Sendable { case .int, .uint: return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let iVar = scope.variable("int") printer.write("const \(iVar) = \(scope.popI32());") return [iVar] @@ -2881,7 +3004,8 @@ struct IntrinsicJSFragment: Sendable { case .float: return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let fVar = scope.variable("f32") printer.write("const \(fVar) = \(scope.popF32());") return [fVar] @@ -2890,7 +3014,8 @@ struct IntrinsicJSFragment: Sendable { case .double: return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let dVar = scope.variable("f64") printer.write("const \(dVar) = \(scope.popF64());") return [dVar] @@ -2900,7 +3025,8 @@ struct IntrinsicJSFragment: Sendable { let structBase = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let resultVar = scope.variable("struct") printer.write( "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lift();" @@ -2911,7 +3037,8 @@ struct IntrinsicJSFragment: Sendable { case .caseEnum: return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let varName = scope.variable("caseId") printer.write("const \(varName) = \(scope.popI32());") return [varName] @@ -2922,7 +3049,8 @@ struct IntrinsicJSFragment: Sendable { case .string: return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let varName = scope.variable("rawValue") printer.write("const \(varName) = \(scope.popString());") return [varName] @@ -2931,7 +3059,8 @@ struct IntrinsicJSFragment: Sendable { case .float: return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let varName = scope.variable("rawValue") printer.write("const \(varName) = \(scope.popF32());") return [varName] @@ -2940,7 +3069,8 @@ struct IntrinsicJSFragment: Sendable { case .double: return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let varName = scope.variable("rawValue") printer.write("const \(varName) = \(scope.popF64());") return [varName] @@ -2949,7 +3079,8 @@ struct IntrinsicJSFragment: Sendable { default: return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let varName = scope.variable("rawValue") printer.write("const \(varName) = \(scope.popI32());") return [varName] @@ -2960,7 +3091,8 @@ struct IntrinsicJSFragment: Sendable { let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let resultVar = scope.variable("enumValue") printer.write( "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popTag()), );" @@ -2971,7 +3103,8 @@ struct IntrinsicJSFragment: Sendable { case .swiftHeapObject(let className): return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let ptrVar = scope.variable("ptr") let objVar = scope.variable("obj") printer.write("const \(ptrVar) = \(scope.popPointer());") @@ -2982,7 +3115,8 @@ struct IntrinsicJSFragment: Sendable { case .jsObject, .swiftProtocol: return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let idVar = scope.variable("objId") let objVar = scope.variable("obj") printer.write("const \(idVar) = \(scope.popI32());") @@ -3000,7 +3134,8 @@ struct IntrinsicJSFragment: Sendable { case .unsafePointer: return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let pVar = scope.variable("pointer") printer.write("const \(pVar) = \(scope.popPointer());") return [pVar] @@ -3016,9 +3151,10 @@ struct IntrinsicJSFragment: Sendable { case .jsValue: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) registerJSValueHelpers(scope: scope) - let lowered = try jsValueLower.printCode([arguments[0]], scope, printer, cleanup) + let lowered = try jsValueLower.printCode([arguments[0]], context) let kindVar = lowered[0] let payload1Var = lowered[1] let payload2Var = lowered[2] @@ -3031,7 +3167,8 @@ struct IntrinsicJSFragment: Sendable { case .string: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) let value = arguments[0] let bytesVar = scope.variable("bytes") let idVar = scope.variable("id") @@ -3046,7 +3183,8 @@ struct IntrinsicJSFragment: Sendable { case .bool: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) scope.emitPushI32Parameter("\(arguments[0]) ? 1 : 0", printer: printer) return [] } @@ -3054,7 +3192,8 @@ struct IntrinsicJSFragment: Sendable { case .int, .uint: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) scope.emitPushI32Parameter("(\(arguments[0]) | 0)", printer: printer) return [] } @@ -3062,7 +3201,8 @@ struct IntrinsicJSFragment: Sendable { case .float: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) scope.emitPushF32Parameter("Math.fround(\(arguments[0]))", printer: printer) return [] } @@ -3070,7 +3210,8 @@ struct IntrinsicJSFragment: Sendable { case .double: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) scope.emitPushF64Parameter("\(arguments[0])", printer: printer) return [] } @@ -3079,7 +3220,8 @@ struct IntrinsicJSFragment: Sendable { let structBase = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) let value = arguments[0] let cleanupVar = scope.variable("structCleanup") printer.write( @@ -3092,7 +3234,8 @@ struct IntrinsicJSFragment: Sendable { case .caseEnum: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) scope.emitPushI32Parameter("(\(arguments[0]) | 0)", printer: printer) return [] } @@ -3102,7 +3245,8 @@ struct IntrinsicJSFragment: Sendable { case .string: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) let value = arguments[0] let bytesVar = scope.variable("bytes") let idVar = scope.variable("id") @@ -3121,7 +3265,8 @@ struct IntrinsicJSFragment: Sendable { case .float: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) scope.emitPushF32Parameter("Math.fround(\(arguments[0]))", printer: printer) return [] } @@ -3129,7 +3274,8 @@ struct IntrinsicJSFragment: Sendable { case .double: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) scope.emitPushF64Parameter("\(arguments[0])", printer: printer) return [] } @@ -3137,7 +3283,8 @@ struct IntrinsicJSFragment: Sendable { default: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) scope.emitPushI32Parameter("(\(arguments[0]) | 0)", printer: printer) return [] } @@ -3147,7 +3294,8 @@ struct IntrinsicJSFragment: Sendable { let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) let value = arguments[0] let caseIdVar = scope.variable("caseId") let cleanupVar = scope.variable("enumCleanup") @@ -3162,7 +3310,8 @@ struct IntrinsicJSFragment: Sendable { case .swiftHeapObject: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) scope.emitPushPointerParameter("\(arguments[0]).pointer", printer: printer) return [] } @@ -3170,7 +3319,8 @@ struct IntrinsicJSFragment: Sendable { case .jsObject: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let idVar = scope.variable("objId") printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") @@ -3191,7 +3341,8 @@ struct IntrinsicJSFragment: Sendable { // Same as jsObject but no cleanup — Swift's AnyProtocol wrapper releases via deinit return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let idVar = scope.variable("objId") printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") @@ -3202,7 +3353,8 @@ struct IntrinsicJSFragment: Sendable { case .unsafePointer: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) scope.emitPushPointerParameter("(\(arguments[0]) | 0)", printer: printer) return [] } @@ -3219,7 +3371,8 @@ struct IntrinsicJSFragment: Sendable { let absenceLiteral = kind.absenceLiteral return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) let isSomeVar = scope.variable("isSome") let resultVar = scope.variable("optValue") @@ -3232,7 +3385,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("} else {") try printer.indent { let innerFragment = try stackLiftFragment(elementType: wrappedType) - let innerResults = try innerFragment.printCode([], scope, printer, cleanup) + let innerResults = try innerFragment.printCode([], context) if let innerResult = innerResults.first { printer.write("\(resultVar) = \(innerResult);") } else { @@ -3252,7 +3405,8 @@ struct IntrinsicJSFragment: Sendable { ) throws -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let isSomeVar = scope.variable("isSome") @@ -3263,7 +3417,10 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") try printer.indent { let innerFragment = try stackLowerFragment(elementType: wrappedType) - let _ = try innerFragment.printCode([value], scope, printer, localCleanupWriter) + let _ = try innerFragment.printCode( + [value], + context.with(\.cleanupCode, localCleanupWriter) + ) let localCleanupLines = localCleanupWriter.lines.filter { !$0.trimmingCharacters(in: .whitespaces).isEmpty } @@ -3303,7 +3460,8 @@ struct IntrinsicJSFragment: Sendable { static func structHelper(structDefinition: ExportedStruct, allStructs: [ExportedStruct]) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["structName"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let printer = context.printer let structName = arguments[0] let capturedStructDef = structDefinition let capturedAllStructs = allStructs @@ -3320,8 +3478,7 @@ struct IntrinsicJSFragment: Sendable { try generateStructLowerCode( structDef: capturedStructDef, allStructs: capturedAllStructs, - scope: scope, - printer: printer + context: context ) } printer.write("},") @@ -3333,8 +3490,7 @@ struct IntrinsicJSFragment: Sendable { try generateStructLiftCode( structDef: capturedStructDef, allStructs: capturedAllStructs, - scope: scope, - printer: printer, + context: context, attachMethods: true ) } @@ -3356,9 +3512,9 @@ struct IntrinsicJSFragment: Sendable { private static func generateStructLowerCode( structDef: ExportedStruct, allStructs: [ExportedStruct], - scope: JSGlueVariableScope, - printer: CodeFragmentPrinter + context: IntrinsicJSFragment.PrintCodeContext ) throws { + let (scope, printer) = (context.scope, context.printer) let lowerPrinter = CodeFragmentPrinter() let lowerScope = scope.makeChildScope() let lowerCleanup = CodeFragmentPrinter() @@ -3368,7 +3524,14 @@ struct IntrinsicJSFragment: Sendable { for property in instanceProps { let fragment = try structFieldLowerFragment(field: property, allStructs: allStructs) let fieldValue = "value.\(property.name)" - _ = try fragment.printCode([fieldValue], lowerScope, lowerPrinter, lowerCleanup) + _ = try fragment.printCode( + [fieldValue], + IntrinsicJSFragment.PrintCodeContext( + scope: lowerScope, + printer: lowerPrinter, + cleanupCode: lowerCleanup, + ) + ) } for line in lowerPrinter.lines { @@ -3388,19 +3551,18 @@ struct IntrinsicJSFragment: Sendable { private static func generateStructLiftCode( structDef: ExportedStruct, allStructs: [ExportedStruct], - scope: JSGlueVariableScope, - printer: CodeFragmentPrinter, + context: IntrinsicJSFragment.PrintCodeContext, attachMethods: Bool = false ) throws { - let liftScope = scope.makeChildScope() - let liftCleanup = CodeFragmentPrinter() + let (scope, printer) = (context.scope, context.printer) + let liftScope = context.scope.makeChildScope() var fieldExpressions: [(name: String, expression: String)] = [] let instanceProps = structDef.properties.filter { !$0.isStatic } for property in instanceProps.reversed() { let fragment = try structFieldLiftFragment(field: property, allStructs: allStructs) - let results = try fragment.printCode([], liftScope, printer, liftCleanup) + let results = try fragment.printCode([], context) if let resultExpr = results.first { fieldExpressions.append((property.name, resultExpr)) @@ -3437,7 +3599,7 @@ struct IntrinsicJSFragment: Sendable { var paramForwardings: [String] = [] for param in method.parameters { let fragment = try IntrinsicJSFragment.lowerParameter(type: param.type) - let loweredValues = try fragment.printCode([param.name], methodScope, printer, methodCleanup) + let loweredValues = try fragment.printCode([param.name], context) paramForwardings.append(contentsOf: loweredValues) } @@ -3456,7 +3618,7 @@ struct IntrinsicJSFragment: Sendable { if method.returnType != .void { let liftFragment = try IntrinsicJSFragment.liftReturn(type: method.returnType) let liftArgs = liftFragment.parameters.isEmpty ? [] : ["ret"] - let lifted = try liftFragment.printCode(liftArgs, methodScope, printer, methodCleanup) + let lifted = try liftFragment.printCode(liftArgs, context) if let liftedValue = lifted.first { printer.write("return \(liftedValue);") } @@ -3481,7 +3643,8 @@ struct IntrinsicJSFragment: Sendable { case .jsObject: return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) let value = arguments[0] let idVar = scope.variable("id") printer.write("let \(idVar);") @@ -3511,7 +3674,8 @@ struct IntrinsicJSFragment: Sendable { case .nullable(let wrappedType, let kind): return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) let value = arguments[0] let isSomeVar = scope.variable("isSome") printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") @@ -3749,7 +3913,10 @@ struct IntrinsicJSFragment: Sendable { ) let guardedPrinter = CodeFragmentPrinter() let guardedCleanup = CodeFragmentPrinter() - _ = try wrappedFragment.printCode([value], scope, guardedPrinter, guardedCleanup) + _ = try wrappedFragment.printCode( + [value], + context.with(\.printer, guardedPrinter).with(\.cleanupCode, guardedCleanup) + ) var loweredLines = guardedPrinter.lines var hoistedCleanupVar: String? if let first = loweredLines.first { @@ -3788,13 +3955,14 @@ struct IntrinsicJSFragment: Sendable { case .swiftStruct(let nestedName): return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let structResultVar = scope.variable("structResult") printer.write( "const \(structResultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(nestedName).lower(\(value));" ) - cleanup.write("if (\(structResultVar).cleanup) { \(structResultVar).cleanup(); }") + context.cleanupCode.write("if (\(structResultVar).cleanup) { \(structResultVar).cleanup(); }") return [] } ) @@ -3802,8 +3970,10 @@ struct IntrinsicJSFragment: Sendable { // These types should not appear as struct fields - return error fragment return IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, scope, printer, cleanup in - printer.write("throw new Error(\"Unsupported struct field type for lowering: \(field.type)\");") + printCode: { arguments, context in + context.printer.write( + "throw new Error(\"Unsupported struct field type for lowering: \(field.type)\");" + ) return [] } ) @@ -3867,7 +4037,8 @@ struct IntrinsicJSFragment: Sendable { case .nullable(let wrappedType, let kind): return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let isSomeVar = scope.variable("isSome") let optVar = scope.variable("optional") printer.write("const \(isSomeVar) = \(scope.popI32());") @@ -3892,7 +4063,7 @@ struct IntrinsicJSFragment: Sendable { ), allStructs: allStructs ) - let wrappedResults = try wrappedFragment.printCode([], scope, printer, cleanup) + let wrappedResults = try wrappedFragment.printCode([], context) if let wrappedResult = wrappedResults.first { printer.write("\(optVar) = \(wrappedResult);") } else { @@ -3911,7 +4082,8 @@ struct IntrinsicJSFragment: Sendable { case .swiftStruct(let nestedName): return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let structVar = scope.variable("struct") printer.write( "const \(structVar) = \(JSGlueVariableScope.reservedStructHelpers).\(nestedName).lift();" @@ -3922,7 +4094,8 @@ struct IntrinsicJSFragment: Sendable { case .jsObject: return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) let objectIdVar = scope.variable("objectId") let varName = scope.variable("value") printer.write("const \(objectIdVar) = \(scope.popI32());") @@ -3946,8 +4119,8 @@ struct IntrinsicJSFragment: Sendable { // These types should not appear as struct fields return IntrinsicJSFragment( parameters: [], - printCode: { arguments, scope, printer, cleanup in - printer.write("throw new Error(\"Unsupported struct field type: \(field.type)\");") + printCode: { arguments, context in + context.printer.write("throw new Error(\"Unsupported struct field type: \(field.type)\");") return [] } ) From 00d196786e464adf83ff0140bef1e7625e6d0348 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 21:33:10 +0900 Subject: [PATCH 187/252] BridgeJS: Fix unused variable warnings in JSGlueGen.swift --- Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index c60cc2dbf..915ca2ea5 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -2409,7 +2409,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value", "enumName", "caseName"], printCode: { arguments, context in - let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) + let (printer, cleanup) = (context.printer, context.cleanupCode) let enumName = arguments[1] let caseName = arguments[2] @@ -2454,7 +2454,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["enumName", "caseName"], printCode: { arguments, context in - let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) + let printer = context.printer let enumName = arguments[0] let caseName = arguments[1] @@ -2712,7 +2712,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: [], printCode: { arguments, context in - let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let optVar = scope.variable("optional") let isSomeVar = scope.variable("isSome") @@ -3152,7 +3152,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) registerJSValueHelpers(scope: scope) let lowered = try jsValueLower.printCode([arguments[0]], context) let kindVar = lowered[0] @@ -3372,7 +3372,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: [], printCode: { arguments, context in - let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let isSomeVar = scope.variable("isSome") let resultVar = scope.variable("optValue") From f6959e04e88304826a6c4033b6122a81113dc5dd Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 21:52:42 +0900 Subject: [PATCH 188/252] BridgeJS: Reduce `PrintCodeContext` construction usage --- .../Sources/BridgeJSLink/JSGlueGen.swift | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 915ca2ea5..4ec7f3f55 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -2291,11 +2291,7 @@ struct IntrinsicJSFragment: Sendable { let fragment = IntrinsicJSFragment.associatedValuePushPayload(enumCase: enumCase) _ = try fragment.printCode( ["value", enumName, caseName], - IntrinsicJSFragment.PrintCodeContext( - scope: caseScope, - printer: lowerPrinter, - cleanupCode: caseCleanup - ) + context.with(\.scope, caseScope).with(\.printer, lowerPrinter).with(\.cleanupCode, caseCleanup) ) } @@ -2326,11 +2322,7 @@ struct IntrinsicJSFragment: Sendable { let fragment = IntrinsicJSFragment.associatedValuePopPayload(enumCase: enumCase) _ = try fragment.printCode( [enumName, caseName], - IntrinsicJSFragment.PrintCodeContext( - scope: caseScope, - printer: liftPrinter, - cleanupCode: caseCleanup - ) + context.with(\.scope, caseScope).with(\.printer, liftPrinter).with(\.cleanupCode, caseCleanup) ) } @@ -3526,11 +3518,7 @@ struct IntrinsicJSFragment: Sendable { let fieldValue = "value.\(property.name)" _ = try fragment.printCode( [fieldValue], - IntrinsicJSFragment.PrintCodeContext( - scope: lowerScope, - printer: lowerPrinter, - cleanupCode: lowerCleanup, - ) + context.with(\.scope, lowerScope).with(\.printer, lowerPrinter).with(\.cleanupCode, lowerCleanup) ) } From cb45962b14993cc0963cf090c11e191c22fbdd86 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Feb 2026 21:53:31 +0900 Subject: [PATCH 189/252] ./Utilities/format.swift --- Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 4ec7f3f55..510a361ff 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -2291,7 +2291,10 @@ struct IntrinsicJSFragment: Sendable { let fragment = IntrinsicJSFragment.associatedValuePushPayload(enumCase: enumCase) _ = try fragment.printCode( ["value", enumName, caseName], - context.with(\.scope, caseScope).with(\.printer, lowerPrinter).with(\.cleanupCode, caseCleanup) + context.with(\.scope, caseScope).with(\.printer, lowerPrinter).with( + \.cleanupCode, + caseCleanup + ) ) } @@ -2322,7 +2325,10 @@ struct IntrinsicJSFragment: Sendable { let fragment = IntrinsicJSFragment.associatedValuePopPayload(enumCase: enumCase) _ = try fragment.printCode( [enumName, caseName], - context.with(\.scope, caseScope).with(\.printer, liftPrinter).with(\.cleanupCode, caseCleanup) + context.with(\.scope, caseScope).with(\.printer, liftPrinter).with( + \.cleanupCode, + caseCleanup + ) ) } From f90d9183f24189fbe5c1bfa5afa87693a5d03f67 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sun, 8 Feb 2026 10:45:07 +0900 Subject: [PATCH 190/252] BridgeJS: Unify closure JS glue lift/lower --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 122 +--- .../Sources/BridgeJSLink/JSGlueGen.swift | 624 +----------------- .../BridgeJSLinkTests/SwiftClosure.js | 506 ++++++-------- .../BridgeJSLinkTests/SwiftClosureImports.js | 18 +- 4 files changed, 251 insertions(+), 1019 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 7e6ce9b55..2c800ef0b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -716,71 +716,25 @@ public struct BridgeJSLink { signature: ClosureSignature, functionName: String ) throws -> [String] { - let printer = CodeFragmentPrinter() - let context = IntrinsicJSFragment.PrintCodeContext( - scope: JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry), - printer: printer, - cleanupCode: CodeFragmentPrinter() - ) + let thunkBuilder = ImportedThunkBuilder(context: .exportSwift, intrinsicRegistry: intrinsicRegistry) + thunkBuilder.parameterNames.append("callbackId") + thunkBuilder.body.write("const callback = \(JSGlueVariableScope.reservedSwift).memory.getObject(callbackId);") - // Build parameter list for invoke function - var invokeParams: [String] = ["callbackId"] for (index, paramType) in signature.parameters.enumerated() { - if case .nullable = paramType { - invokeParams.append("param\(index)IsSome") - invokeParams.append("param\(index)Value") - } else { - invokeParams.append("param\(index)Id") - } + let paramName = "param\(index)" + try thunkBuilder.liftParameter(param: Parameter(label: nil, name: paramName, type: paramType)) } - printer.nextLine() - printer.write("bjs[\"\(functionName)\"] = function(\(invokeParams.joined(separator: ", "))) {") - try printer.indent { - printer.write("try {") - try printer.indent { - printer.write("const callback = \(JSGlueVariableScope.reservedSwift).memory.getObject(callbackId);") + let returnExpr = try thunkBuilder.call(calleeExpr: "callback", returnType: signature.returnType) - for (index, paramType) in signature.parameters.enumerated() { - let fragment = try IntrinsicJSFragment.closureLiftParameter(type: paramType) - let args: [String] - if case .nullable = paramType { - args = ["param\(index)IsSome", "param\(index)Value", "param\(index)"] - } else { - args = ["param\(index)Id", "param\(index)"] - } - _ = try fragment.printCode(args, context) - } - - let callbackParams = signature.parameters.indices.map { "param\($0)" }.joined(separator: ", ") - printer.write("const result = callback(\(callbackParams));") - - // Type check if needed (for example, formatName requires string return) - switch signature.returnType { - case .string: - printer.write("if (typeof result !== \"string\") {") - printer.indent { - printer.write("throw new TypeError(\"Callback must return a string\");") - } - printer.write("}") - default: - break - } - - let returnFragment = try IntrinsicJSFragment.closureLowerReturn(type: signature.returnType) - _ = try returnFragment.printCode(["result"], context) - } - printer.write("} catch (error) {") - try printer.indent { - printer.write("\(JSGlueVariableScope.reservedSetException)?.(error);") - let errorFragment = IntrinsicJSFragment.closureErrorReturn(type: signature.returnType) - _ = try errorFragment.printCode([], context) - } - printer.write("}") - } - printer.write("};") + var functionLines = thunkBuilder.renderFunction( + name: nil, + returnExpr: returnExpr, + returnType: signature.returnType + ) + functionLines[0] = "bjs[\"\(functionName)\"] = " + functionLines[0] - return printer.lines + return functionLines } /// Generates a lower_closure_* function that wraps a Swift closure for JavaScript @@ -789,46 +743,27 @@ public struct BridgeJSLink { functionName: String ) throws -> [String] { let printer = CodeFragmentPrinter() - let context = IntrinsicJSFragment.PrintCodeContext( - scope: JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry), - printer: printer, - cleanupCode: CodeFragmentPrinter() + let builder = ExportedThunkBuilder( + effects: Effects(isAsync: false, isThrows: true), + hasDirectAccessToSwiftClass: false, + intrinsicRegistry: intrinsicRegistry ) + builder.parameterForwardings.append("boxPtr") printer.write( "const \(functionName) = function(\(signature.parameters.indices.map { "param\($0)" }.joined(separator: ", "))) {" ) try printer.indent { - var invokeArgs: [String] = ["boxPtr"] - + // Lower parameters using shared thunk builder for (index, paramType) in signature.parameters.enumerated() { let paramName = "param\(index)" - let fragment = try IntrinsicJSFragment.lowerParameter(type: paramType) - let lowered = try fragment.printCode([paramName], context) - invokeArgs.append(contentsOf: lowered) + try builder.lowerParameter(param: Parameter(label: nil, name: paramName, type: paramType)) } - // Call the Swift invoke function let invokeCall = - "\(JSGlueVariableScope.reservedInstance).exports.invoke_swift_closure_\(signature.moduleName)_\(signature.mangleName)(\(invokeArgs.joined(separator: ", ")))" - let invokeResultName = "invokeResult" - printer.write("const \(invokeResultName) = \(invokeCall);") - - printer.write("if (\(JSGlueVariableScope.reservedStorageToReturnException)) {") - printer.indent { - printer.write( - "const error = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(JSGlueVariableScope.reservedStorageToReturnException));" - ) - printer.write( - "\(JSGlueVariableScope.reservedSwift).memory.release(\(JSGlueVariableScope.reservedStorageToReturnException));" - ) - printer.write("\(JSGlueVariableScope.reservedStorageToReturnException) = undefined;") - printer.write("throw error;") - } - printer.write("}") - - let returnFragment = try IntrinsicJSFragment.closureLiftReturn(type: signature.returnType) - _ = try returnFragment.printCode([invokeResultName], context) + "invoke_swift_closure_\(signature.moduleName)_\(signature.mangleName)" + let returnExpr = try builder.call(abiName: invokeCall, returnType: signature.returnType) + builder.renderFunctionBody(into: printer, returnExpr: returnExpr) } printer.write("};") @@ -1291,7 +1226,7 @@ public struct BridgeJSLink { let scope: JSGlueVariableScope let context: IntrinsicJSFragment.PrintCodeContext - init(effects: Effects, intrinsicRegistry: JSIntrinsicRegistry) { + init(effects: Effects, hasDirectAccessToSwiftClass: Bool = true, intrinsicRegistry: JSIntrinsicRegistry) { self.effects = effects self.scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) self.body = CodeFragmentPrinter() @@ -1299,7 +1234,8 @@ public struct BridgeJSLink { self.context = IntrinsicJSFragment.PrintCodeContext( scope: scope, printer: body, - cleanupCode: cleanupCode + cleanupCode: cleanupCode, + hasDirectAccessToSwiftClass: hasDirectAccessToSwiftClass ) } @@ -2221,13 +2157,13 @@ extension BridgeJSLink { } func renderFunction( - name: String, + name: String?, returnExpr: String?, returnType: BridgeType ) -> [String] { let printer = CodeFragmentPrinter() - printer.write("function \(name)(\(parameterNames.joined(separator: ", "))) {") + printer.write("function\(name.map { " \($0)" } ?? "")(\(parameterNames.joined(separator: ", "))) {") printer.indent { printer.write("try {") printer.indent { @@ -2259,7 +2195,7 @@ extension BridgeJSLink { return try call(name: name, fromObjectExpr: "imports", returnType: returnType) } - private func call(calleeExpr: String, returnType: BridgeType) throws -> String? { + func call(calleeExpr: String, returnType: BridgeType) throws -> String? { let callExpr = "\(calleeExpr)(\(parameterForwardings.joined(separator: ", ")))" return try self.call(callExpr: callExpr, returnType: returnType) } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 510a361ff..9f1eddfdd 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -154,6 +154,9 @@ struct IntrinsicJSFragment: Sendable { var printer: CodeFragmentPrinter /// The printer to print the code that is expected to be executed at the end of the caller of the fragment. var cleanupCode: CodeFragmentPrinter + /// Whether the fragment has direct access to the SwiftHeapObject classes. + /// If false, the fragment needs to use `_exports[""]` to access the class. + var hasDirectAccessToSwiftClass: Bool = true func with(_ keyPath: WritableKeyPath, _ value: T) -> PrintCodeContext { var new = self @@ -613,7 +616,9 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - return ["\(name).__construct(\(arguments[0]))"] + return [ + "\(context.hasDirectAccessToSwiftClass ? name : "_exports['\(name)']").__construct(\(arguments[0]))" + ] } ) } @@ -944,11 +949,9 @@ struct IntrinsicJSFragment: Sendable { static func optionalLiftReturn( wrappedType: BridgeType, - context: BridgeContext = .exportSwift, kind: JSOptionalKind ) -> IntrinsicJSFragment { let absenceLiteral = kind.absenceLiteral - let bridgeContext = context return IntrinsicJSFragment( parameters: [], printCode: { arguments, context in @@ -980,7 +983,7 @@ struct IntrinsicJSFragment: Sendable { ) printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject) = undefined;") let constructExpr = - bridgeContext == .exportSwift + context.hasDirectAccessToSwiftClass ? "\(className).__construct(\(pointerVar))" : "_exports['\(className)'].__construct(\(pointerVar))" printer.write( @@ -1349,619 +1352,6 @@ struct IntrinsicJSFragment: Sendable { ) } - // MARK: - Closure Support - - /// Lifts a WASM parameter to JS for passing to a JS callback (invoke_js_callback_*) - static func closureLiftParameter(type: BridgeType) throws -> IntrinsicJSFragment { - switch type { - case .int, .float, .double, .caseEnum: - return IntrinsicJSFragment( - parameters: ["value", "targetVar"], - printCode: { arguments, context in - let printer = context.printer - printer.write("let \(arguments[1]) = \(arguments[0]);") - return [] - } - ) - case .bool: - return IntrinsicJSFragment( - parameters: ["value", "targetVar"], - printCode: { arguments, context in - let printer = context.printer - let baseFragment = boolLiftParameter - let lifted = try baseFragment.printCode([arguments[0]], context) - printer.write("let \(arguments[1]) = \(lifted[0]);") - return [] - } - ) - case .string: - return IntrinsicJSFragment( - parameters: ["objectId", "targetVar"], - printCode: { arguments, context in - let printer = context.printer - let baseFragment = stringLiftParameter - let lifted = try baseFragment.printCode([arguments[0]], context) - printer.write("let \(arguments[1]) = String(\(lifted[0]));") - return [] - } - ) - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - return IntrinsicJSFragment( - parameters: ["objectId", "targetVar"], - printCode: { arguments, context in - let printer = context.printer - let baseFragment = stringLiftParameter - let lifted = try baseFragment.printCode([arguments[0]], context) - printer.write("let \(arguments[1]) = String(\(lifted[0]));") - return [] - } - ) - case .bool: - return IntrinsicJSFragment( - parameters: ["value", "targetVar"], - printCode: { arguments, context in - let printer = context.printer - let baseFragment = boolLiftParameter - let lifted = try baseFragment.printCode([arguments[0]], context) - printer.write("let \(arguments[1]) = \(lifted[0]);") - return [] - } - ) - default: - return IntrinsicJSFragment( - parameters: ["value", "targetVar"], - printCode: { arguments, context in - let printer = context.printer - printer.write("let \(arguments[1]) = \(arguments[0]);") - return [] - } - ) - } - case .jsObject: - return IntrinsicJSFragment( - parameters: ["objectId", "targetVar"], - printCode: { arguments, context in - let printer = context.printer - let objectId = arguments[0] - let targetVar = arguments[1] - printer.write( - "let \(targetVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(objectId));" - ) - printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(objectId));") - return [] - } - ) - case .swiftHeapObject(let name): - return IntrinsicJSFragment( - parameters: ["pointer", "targetVar"], - printCode: { arguments, context in - let printer = context.printer - let pointer = arguments[0] - let targetVar = arguments[1] - printer.write("let \(targetVar) = _exports['\(name)'].__construct(\(pointer));") - return [] - } - ) - case .associatedValueEnum(let fullName): - return IntrinsicJSFragment( - parameters: ["caseId", "targetVar"], - printCode: { arguments, context in - let printer = context.printer - let caseId = arguments[0] - let targetVar = arguments[1] - let base = fullName.components(separatedBy: ".").last ?? fullName - printer.write( - "let \(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseId));" - ) - return [] - } - ) - case .nullable(let wrappedType, let kind): - return try closureOptionalLiftParameter(wrappedType: wrappedType, kind: kind) - default: - throw BridgeJSLinkError(message: "Unsupported closure parameter type for lifting: \(type)") - } - } - - /// Handles optional parameter lifting for closure invocation. - private static func closureOptionalLiftParameter( - wrappedType: BridgeType, - kind: JSOptionalKind - ) throws -> IntrinsicJSFragment { - let absenceLiteral = kind.absenceLiteral - switch wrappedType { - case .string, .rawValueEnum, .int, .bool, .double, .float, .jsObject, .swiftHeapObject, .caseEnum, - .associatedValueEnum, .closure: - break - default: - throw BridgeJSLinkError( - message: "Unsupported optional wrapped type in closure parameter lifting: \(wrappedType)" - ) - } - - return IntrinsicJSFragment( - parameters: ["isSome", "value", "targetVar"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let isSome = arguments[0] - let value = arguments[1] - let targetVar = arguments[2] - - printer.write("let \(targetVar);") - printer.write("if (\(isSome)) {") - printer.indent() - switch wrappedType { - case .string, .rawValueEnum(_, .string): - let objectLabel = scope.variable("\(targetVar)Object") - printer.write( - "const \(objectLabel) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(value));" - ) - printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(value));") - printer.write("\(targetVar) = String(\(objectLabel));") - case .int, .uint: - printer.write("\(targetVar) = \(value) | 0;") - case .bool: - printer.write("\(targetVar) = \(value) !== 0;") - case .double: - printer.write("\(targetVar) = \(value);") - case .float: - printer.write("\(targetVar) = Math.fround(\(value));") - case .jsObject: - printer.write("\(targetVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(value));") - printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(value));") - case .swiftHeapObject(let typeName): - printer.write("\(targetVar) = _exports['\(typeName)'].__construct(\(value));") - case .caseEnum: - printer.write("\(targetVar) = \(value);") - case .rawValueEnum(_, let rawType): - switch rawType { - case .bool: - printer.write("\(targetVar) = \(value) !== 0;") - default: - printer.write("\(targetVar) = \(value);") - } - case .associatedValueEnum(let fullName): - let base = fullName.components(separatedBy: ".").last ?? fullName - printer.write( - "\(targetVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(value));" - ) - case .closure: - printer.write("\(targetVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(value));") - printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(value));") - default: - fatalError("Unsupported optional wrapped type in closure parameter lifting: \(wrappedType)") - } - printer.unindent() - printer.write("} else {") - printer.indent() - printer.write("\(targetVar) = \(absenceLiteral);") - printer.unindent() - printer.write("}") - - return [] - } - ) - } - - /// Lowers a JS return value to WASM for returning from callback (invoke_js_callback_*) - static func closureLowerReturn(type: BridgeType) throws -> IntrinsicJSFragment { - switch type { - case .void: - return IntrinsicJSFragment( - parameters: ["result"], - printCode: { _, context in - context.printer.write("return;") - return [] - } - ) - case .int, .caseEnum: - return IntrinsicJSFragment( - parameters: ["result"], - printCode: { arguments, context in - context.printer.write("return \(arguments[0]) | 0;") - return [] - } - ) - case .bool: - return IntrinsicJSFragment( - parameters: ["result"], - printCode: { arguments, context in - let baseFragment = boolLowerReturn - let lowered = try baseFragment.printCode([arguments[0]], context) - context.printer.write("return \(lowered[0]);") - return [] - } - ) - case .float: - return IntrinsicJSFragment( - parameters: ["result"], - printCode: { arguments, context in - context.printer.write("return Math.fround(\(arguments[0]));") - return [] - } - ) - case .double: - return IntrinsicJSFragment( - parameters: ["result"], - printCode: { arguments, context in - context.printer.write("return \(arguments[0]);") - return [] - } - ) - case .string: - return IntrinsicJSFragment( - parameters: ["result"], - printCode: { arguments, context in - let baseFragment = stringLowerReturn - let lowered = try baseFragment.printCode([arguments[0]], context) - context.printer.write("return \(lowered[0]);") - return [] - } - ) - case .jsObject: - return IntrinsicJSFragment( - parameters: ["result"], - printCode: { arguments, context in - let baseFragment = jsObjectLowerReturn - let lowered = try baseFragment.printCode([arguments[0]], context) - context.printer.write("return \(lowered[0]);") - return [] - } - ) - case .swiftHeapObject: - return IntrinsicJSFragment( - parameters: ["result"], - printCode: { arguments, context in - let baseFragment = swiftHeapObjectLowerReturn - let lowered = try baseFragment.printCode([arguments[0]], context) - context.printer.write("return \(lowered[0]);") - return [] - } - ) - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - return IntrinsicJSFragment( - parameters: ["result"], - printCode: { arguments, context in - let baseFragment = stringLowerReturn - let lowered = try baseFragment.printCode([arguments[0]], context) - context.printer.write("return \(lowered[0]);") - return [] - } - ) - case .bool: - return IntrinsicJSFragment( - parameters: ["result"], - printCode: { arguments, context in - let baseFragment = boolLowerReturn - let lowered = try baseFragment.printCode([arguments[0]], context) - context.printer.write("return \(lowered[0]);") - return [] - } - ) - default: - return IntrinsicJSFragment( - parameters: ["result"], - printCode: { arguments, context in - context.printer.write("return \(arguments[0]) | 0;") - return [] - } - ) - } - case .associatedValueEnum(let fullName): - return IntrinsicJSFragment( - parameters: ["result"], - printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) - let result = arguments[0] - let base = fullName.components(separatedBy: ".").last ?? fullName - let caseIdVar = scope.variable("caseId") - let cleanupVar = scope.variable("cleanup") - printer.write( - "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(result));" - ) - cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") - printer.write("return \(caseIdVar);") - return [] - } - ) - case .nullable(let wrappedType, _): - return try closureOptionalLowerReturn(wrappedType: wrappedType) - default: - throw BridgeJSLinkError(message: "Unsupported closure return type for lowering: \(type)") - } - } - - /// Handles optional return lowering for closure invocation - private static func closureOptionalLowerReturn(wrappedType: BridgeType) throws -> IntrinsicJSFragment { - return IntrinsicJSFragment( - parameters: ["result"], - printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) - let result = arguments[0] - - switch wrappedType { - case .swiftHeapObject: - printer.write("return \(result) ? \(result).pointer : 0;") - case .string: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(result);") - printer.write("return;") - case .int, .uint: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(result);") - printer.write("return;") - case .bool: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalBool) = \(result);") - printer.write("return;") - case .float: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalFloat) = \(result);") - printer.write("return;") - case .double: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalDouble) = \(result);") - printer.write("return;") - case .caseEnum: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(result);") - printer.write("return;") - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(result);") - printer.write("return;") - case .bool: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalBool) = \(result);") - printer.write("return;") - case .float: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalFloat) = \(result);") - printer.write("return;") - case .double: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalDouble) = \(result);") - printer.write("return;") - default: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(result);") - printer.write("return;") - } - case .associatedValueEnum(let fullName): - let base = fullName.components(separatedBy: ".").last ?? fullName - let caseIdVar = scope.variable("caseId") - let cleanupVar = scope.variable("cleanup") - printer.write("if (\(result)) {") - printer.indent() - printer.write( - "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(result));" - ) - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(caseIdVar);") - cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") - printer.unindent() - printer.write("} else {") - printer.indent() - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = null;") - printer.unindent() - printer.write("}") - printer.write("return;") - default: - fatalError("Unsupported optional wrapped type in closure return lowering: \(wrappedType)") - } - - return [] - } - ) - } - - /// Lifts a WASM return value to JS from Swift closure (lower_closure_*) - static func closureLiftReturn(type: BridgeType) throws -> IntrinsicJSFragment { - switch type { - case .void: - return IntrinsicJSFragment( - parameters: ["invokeCall"], - printCode: { arguments, context in - let printer = context.printer - printer.write("\(arguments[0]);") - printer.write("return;") - return [] - } - ) - case .int, .caseEnum: - return IntrinsicJSFragment( - parameters: ["invokeCall"], - printCode: { arguments, context in - context.printer.write("return \(arguments[0]) | 0;") - return [] - } - ) - case .bool: - return IntrinsicJSFragment( - parameters: ["invokeCall"], - printCode: { arguments, context in - let baseFragment = boolLiftReturn - let lifted = try baseFragment.printCode([arguments[0]], context) - context.printer.write("return \(lifted[0]);") - return [] - } - ) - case .float, .double: - return IntrinsicJSFragment( - parameters: ["invokeCall"], - printCode: { arguments, context in - context.printer.write("return \(arguments[0]);") - return [] - } - ) - case .string: - return IntrinsicJSFragment( - parameters: ["invokeCall"], - printCode: { arguments, context in - context.printer.write("const resultLen = \(arguments[0]);") - let baseFragment = stringLiftReturn - let lifted = try baseFragment.printCode([], context) - context.printer.write("return \(lifted[0]);") - return [] - } - ) - case .jsObject: - return IntrinsicJSFragment( - parameters: ["invokeCall"], - printCode: { arguments, context in - context.printer.write("const resultId = \(arguments[0]);") - let baseFragment = jsObjectLiftReturn - let lifted = try baseFragment.printCode(["resultId"], context) - context.printer.write("return \(lifted[0]);") - return [] - } - ) - case .swiftHeapObject(let className): - return IntrinsicJSFragment( - parameters: ["invokeCall"], - printCode: { arguments, context in - let printer = context.printer - printer.write("const resultPtr = \(arguments[0]);") - printer.write("return _exports['\(className)'].__construct(resultPtr);") - return [] - } - ) - case .closure: - return IntrinsicJSFragment( - parameters: ["invokeCall"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let funcRefVar = scope.variable("swiftClosureFuncRef") - printer.write("const \(funcRefVar) = \(arguments[0]);") - printer.write( - "const funcObj = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(funcRefVar));" - ) - printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(funcRefVar));") - printer.write("return funcObj;") - return [] - } - ) - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - return IntrinsicJSFragment( - parameters: ["invokeCall"], - printCode: { arguments, context in - let printer = context.printer - printer.write("const resultLen = \(arguments[0]);") - let baseFragment = stringLiftReturn - let lifted = try baseFragment.printCode([], context) - context.printer.write("return \(lifted[0]);") - return [] - } - ) - case .bool: - return IntrinsicJSFragment( - parameters: ["invokeCall"], - printCode: { arguments, context in - let printer = context.printer - let baseFragment = boolLiftReturn - let lifted = try baseFragment.printCode([arguments[0]], context) - printer.write("return \(lifted[0]);") - return [] - } - ) - default: - return IntrinsicJSFragment( - parameters: ["invokeCall"], - printCode: { arguments, context in - context.printer.write("return \(arguments[0]) | 0;") - return [] - } - ) - } - case .associatedValueEnum(let fullName): - return IntrinsicJSFragment( - parameters: ["invokeCall"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - printer.write("\(arguments[0]);") - let base = fullName.components(separatedBy: ".").last ?? fullName - let resultVar = scope.variable("result") - printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popTag()));" - ) - printer.write("return \(resultVar);") - return [] - } - ) - case .nullable(let wrappedType, let kind): - return try closureOptionalLiftReturn(wrappedType: wrappedType, kind: kind) - default: - throw BridgeJSLinkError(message: "Unsupported closure return type for lifting: \(type)") - } - } - - /// Handles optional return lifting for Swift closure returns - private static func closureOptionalLiftReturn( - wrappedType: BridgeType, - kind: JSOptionalKind - ) throws -> IntrinsicJSFragment { - return IntrinsicJSFragment( - parameters: ["invokeCall"], - printCode: { arguments, context in - let printer = context.printer - let invokeCall = arguments[0] - printer.write("\(invokeCall);") - let baseFragment = optionalLiftReturn( - wrappedType: wrappedType, - context: .importTS, - kind: kind - ) - let lifted = try baseFragment.printCode([], context) - if !lifted.isEmpty { - printer.write("return \(lifted[0]);") - } - return [] - } - ) - } - - /// Provides appropriate default values for error cases in closure invocation - static func closureErrorReturn(type: BridgeType) -> IntrinsicJSFragment { - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, context in - let printer = context.printer - switch type { - case .void: - printer.write("return;") - case .string: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnBytes) = new Uint8Array(0);") - printer.write("return 0;") - case .int, .bool, .caseEnum: - printer.write("return 0;") - case .float, .double: - printer.write("return 0.0;") - case .jsObject, .swiftHeapObject: - printer.write("return 0;") - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnBytes) = new Uint8Array(0);") - printer.write("return 0;") - case .bool, .int, .int32, .int64, .uint, .uint32, .uint64: - printer.write("return 0;") - case .float, .double: - printer.write("return 0.0;") - } - case .associatedValueEnum: - printer.write("return;") - case .nullable(let wrappedType, _): - switch wrappedType { - case .swiftHeapObject: - printer.write("return 0;") - default: - printer.write("return;") - } - default: - printer.write("return 0;") - } - - return [] - } - ) - } - // MARK: - ExportSwift /// Returns a fragment that lowers a JS value to Wasm core values for parameters diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 09f9aee59..2ef9aaf5a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -328,337 +328,299 @@ export async function createInstantiator(options, swift) { const func = swift.memory.getObject(funcRef); func.__unregister(); } - - bjs["invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO"] = function(callbackId, param0) { try { const callback = swift.memory.getObject(callbackId); - let param0 = param0Id; - const result = callback(param0); - return result | 0; + let ret = callback(param0); + return ret; } catch (error) { - setException?.(error); - return 0; + setException(error); + return 0 } - }; + } bjs["make_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO = function(param0) { - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO(boxPtr, param0); + const ret = instance.exports.invoke_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO(boxPtr, param0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - return invokeResult | 0; + return ret; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO); } - - bjs["invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO"] = function(callbackId, param0) { try { const callback = swift.memory.getObject(callbackId); - const param0IdObject = swift.memory.getObject(param0Id); - swift.memory.release(param0Id); - let param0 = String(param0IdObject); - const result = callback(param0); - tmpRetBytes = textEncoder.encode(result); + const param0Object = swift.memory.getObject(param0); + swift.memory.release(param0); + let ret = callback(param0Object); + tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { - setException?.(error); - tmpRetBytes = new Uint8Array(0); - return 0; + setException(error); } - }; + } bjs["make_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModule5ThemeO_5ThemeO = function(param0) { const param0Bytes = textEncoder.encode(param0); const param0Id = swift.memory.retain(param0Bytes); - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO(boxPtr, param0Id, param0Bytes.length); + instance.exports.invoke_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO(boxPtr, param0Id, param0Bytes.length); + const ret = tmpRetString; + tmpRetString = undefined; + swift.memory.release(param0Id); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - const resultLen = invokeResult; - const ret = tmpRetString; - tmpRetString = undefined; return ret; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule5ThemeO_5ThemeO); } - - bjs["invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC"] = function(callbackId, param0) { try { const callback = swift.memory.getObject(callbackId); - let param0 = _exports['Person'].__construct(param0Id); - const result = callback(param0); - return result.pointer; + let ret = callback(_exports['Person'].__construct(param0)); + return ret.pointer; } catch (error) { - setException?.(error); - return 0; + setException(error); + return 0 } - }; + } bjs["make_swift_closure_TestModule_10TestModule6PersonC_6PersonC"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModule6PersonC_6PersonC = function(param0) { - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule6PersonC_6PersonC(boxPtr, param0.pointer); + const ret = instance.exports.invoke_swift_closure_TestModule_10TestModule6PersonC_6PersonC(boxPtr, param0.pointer); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - const resultPtr = invokeResult; - return _exports['Person'].__construct(resultPtr); + return _exports['Person'].__construct(ret); }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule6PersonC_6PersonC); } - - bjs["invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO"] = function(callbackId, param0) { try { const callback = swift.memory.getObject(callbackId); - let param0 = enumHelpers.APIResult.lift(param0Id); - const result = callback(param0); - const { caseId: caseId, cleanup: cleanup } = enumHelpers.APIResult.lower(result); + const enumValue = enumHelpers.APIResult.lift(param0); + let ret = callback(enumValue); + const { caseId: caseId, cleanup: cleanup } = enumHelpers.APIResult.lower(ret); return caseId; } catch (error) { - setException?.(error); - return; + setException(error); } - }; + } bjs["make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModule9APIResultO_9APIResultO = function(param0) { const { caseId: param0CaseId, cleanup: param0Cleanup } = enumHelpers.APIResult.lower(param0); - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO(boxPtr, param0CaseId); + instance.exports.invoke_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO(boxPtr, param0CaseId); + const ret = enumHelpers.APIResult.lift(tagStack.pop()); + if (param0Cleanup) { param0Cleanup(); } if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - invokeResult; - const result = enumHelpers.APIResult.lift(tagStack.pop()); - return result; + return ret; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule9APIResultO_9APIResultO); } - - bjs["invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO"] = function(callbackId, param0) { try { const callback = swift.memory.getObject(callbackId); - let param0 = param0Id; - const result = callback(param0); - return result | 0; + let ret = callback(param0); + return ret; } catch (error) { - setException?.(error); - return 0; + setException(error); + return 0 } - }; + } bjs["make_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModule9DirectionO_9DirectionO = function(param0) { - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO(boxPtr, param0); + const ret = instance.exports.invoke_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO(boxPtr, param0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - return invokeResult | 0; + return ret; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModule9DirectionO_9DirectionO); } - - bjs["invoke_js_callback_TestModule_10TestModuleSS_SS"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModuleSS_SS"] = function(callbackId, param0) { try { const callback = swift.memory.getObject(callbackId); - const param0IdObject = swift.memory.getObject(param0Id); - swift.memory.release(param0Id); - let param0 = String(param0IdObject); - const result = callback(param0); - if (typeof result !== "string") { - throw new TypeError("Callback must return a string"); - } - tmpRetBytes = textEncoder.encode(result); + const param0Object = swift.memory.getObject(param0); + swift.memory.release(param0); + let ret = callback(param0Object); + tmpRetBytes = textEncoder.encode(ret); return tmpRetBytes.length; } catch (error) { - setException?.(error); - tmpRetBytes = new Uint8Array(0); - return 0; + setException(error); } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSS_SS"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSS_SS = function(param0) { const param0Bytes = textEncoder.encode(param0); const param0Id = swift.memory.retain(param0Bytes); - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSS_SS(boxPtr, param0Id, param0Bytes.length); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSS_SS(boxPtr, param0Id, param0Bytes.length); + const ret = tmpRetString; + tmpRetString = undefined; + swift.memory.release(param0Id); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - const resultLen = invokeResult; - const ret = tmpRetString; - tmpRetString = undefined; return ret; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSS_SS); } - - bjs["invoke_js_callback_TestModule_10TestModuleSb_Sb"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModuleSb_Sb"] = function(callbackId, param0) { try { const callback = swift.memory.getObject(callbackId); - let param0 = param0Id !== 0; - const result = callback(param0); - return result ? 1 : 0; + let ret = callback(param0 !== 0); + return ret ? 1 : 0; } catch (error) { - setException?.(error); - return 0; + setException(error); + return 0 } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSb_Sb"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSb_Sb = function(param0) { - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSb_Sb(boxPtr, param0); + const ret = instance.exports.invoke_swift_closure_TestModule_10TestModuleSb_Sb(boxPtr, param0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - return invokeResult !== 0; + return ret !== 0; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSb_Sb); } - - bjs["invoke_js_callback_TestModule_10TestModuleSd_Sd"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModuleSd_Sd"] = function(callbackId, param0) { try { const callback = swift.memory.getObject(callbackId); - let param0 = param0Id; - const result = callback(param0); - return result; + let ret = callback(param0); + return ret; } catch (error) { - setException?.(error); - return 0.0; + setException(error); + return 0 } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSd_Sd"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSd_Sd = function(param0) { - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSd_Sd(boxPtr, param0); + const ret = instance.exports.invoke_swift_closure_TestModule_10TestModuleSd_Sd(boxPtr, param0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - return invokeResult; + return ret; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSd_Sd); } - - bjs["invoke_js_callback_TestModule_10TestModuleSf_Sf"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModuleSf_Sf"] = function(callbackId, param0) { try { const callback = swift.memory.getObject(callbackId); - let param0 = param0Id; - const result = callback(param0); - return Math.fround(result); + let ret = callback(param0); + return ret; } catch (error) { - setException?.(error); - return 0.0; + setException(error); + return 0 } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSf_Sf"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSf_Sf = function(param0) { - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSf_Sf(boxPtr, param0); + const ret = instance.exports.invoke_swift_closure_TestModule_10TestModuleSf_Sf(boxPtr, param0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - return invokeResult; + return ret; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSf_Sf); } - - bjs["invoke_js_callback_TestModule_10TestModuleSi_Si"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModuleSi_Si"] = function(callbackId, param0) { try { const callback = swift.memory.getObject(callbackId); - let param0 = param0Id; - const result = callback(param0); - return result | 0; + let ret = callback(param0); + return ret; } catch (error) { - setException?.(error); - return 0; + setException(error); + return 0 } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSi_Si"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSi_Si = function(param0) { - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSi_Si(boxPtr, param0); + const ret = instance.exports.invoke_swift_closure_TestModule_10TestModuleSi_Si(boxPtr, param0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - return invokeResult | 0; + return ret; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSi_Si); } - - bjs["invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO"] = function(callbackId, param0IsSome, param0WrappedValue) { try { const callback = swift.memory.getObject(callbackId); - let param0; - if (param0IsSome) { - param0 = param0Value; - } else { - param0 = null; - } - const result = callback(param0); - tmpRetOptionalInt = result; - return; + let ret = callback(param0IsSome ? param0WrappedValue : null); + const isSome = ret != null; + bjs["swift_js_return_optional_int"](isSome ? 1 : 0, isSome ? (ret | 0) : 0); } catch (error) { - setException?.(error); - return; + setException(error); } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO = function(param0) { const isSome = param0 != null; - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(boxPtr, +isSome, isSome ? param0 : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(boxPtr, +isSome, isSome ? param0 : 0); + const optResult = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - invokeResult; - const optResult = tmpRetOptionalInt; - tmpRetOptionalInt = undefined; return optResult; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO); } - - bjs["invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO"] = function(callbackId, param0IsSome, param0WrappedValue) { try { const callback = swift.memory.getObject(callbackId); - let param0; + let obj; if (param0IsSome) { - const param0Object = swift.memory.getObject(param0Value); - swift.memory.release(param0Value); - param0 = String(param0Object); + obj = swift.memory.getObject(param0WrappedValue); + swift.memory.release(param0WrappedValue); + } + let ret = callback(param0IsSome ? obj : null); + const isSome = ret != null; + if (isSome) { + tmpRetString = ret; } else { - param0 = null; + tmpRetString = null; } - const result = callback(param0); - tmpRetString = result; - return; } catch (error) { - setException?.(error); - return; + setException(error); } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO = function(param0) { const isSome = param0 != null; @@ -667,78 +629,68 @@ export async function createInstantiator(options, swift) { param0Bytes = textEncoder.encode(param0); param0Id = swift.memory.retain(param0Bytes); } - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(boxPtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(boxPtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); + const optResult = tmpRetString; + tmpRetString = undefined; + if (param0Id != undefined) { + swift.memory.release(param0Id); + } if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - invokeResult; - const optResult = tmpRetString; - tmpRetString = undefined; return optResult; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO); } - - bjs["invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC"] = function(callbackId, param0IsSome, param0WrappedValue) { try { const callback = swift.memory.getObject(callbackId); - let param0; - if (param0IsSome) { - param0 = _exports['Person'].__construct(param0Value); - } else { - param0 = null; - } - const result = callback(param0); - return result ? result.pointer : 0; + let ret = callback(param0IsSome ? _exports['Person'].__construct(param0WrappedValue) : null); + const isSome = ret != null; + return isSome ? ret.pointer : 0; } catch (error) { - setException?.(error); - return 0; + setException(error); } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC = function(param0) { const isSome = param0 != null; - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC(boxPtr, +isSome, isSome ? param0.pointer : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC(boxPtr, +isSome, isSome ? param0.pointer : 0); + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + const optResult = pointer === null ? null : _exports['Person'].__construct(pointer); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - invokeResult; - const pointer = tmpRetOptionalHeapObject; - tmpRetOptionalHeapObject = undefined; - const optResult = pointer === null ? null : _exports['Person'].__construct(pointer); return optResult; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC); } - - bjs["invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO"] = function(callbackId, param0IsSome, param0WrappedValue) { try { const callback = swift.memory.getObject(callbackId); - let param0; + let enumValue; if (param0IsSome) { - param0 = enumHelpers.APIResult.lift(param0Value); - } else { - param0 = null; + enumValue = enumHelpers.APIResult.lift(param0WrappedValue); } - const result = callback(param0); - if (result) { - const { caseId: caseId, cleanup: cleanup } = enumHelpers.APIResult.lower(result); - tmpRetOptionalInt = caseId; + let ret = callback(param0IsSome ? enumValue : null); + const isSome = ret != null; + if (isSome) { + const { caseId: caseId, cleanup: cleanup } = enumHelpers.APIResult.lower(ret); + return caseId; } else { - tmpRetOptionalInt = null; + return -1; } - return; } catch (error) { - setException?.(error); - return; + setException(error); } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO = function(param0) { const isSome = param0 != null; @@ -748,14 +700,7 @@ export async function createInstantiator(options, swift) { param0CaseId = enumResult.caseId; param0Cleanup = enumResult.cleanup; } - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(boxPtr, +isSome, isSome ? param0CaseId : 0); - if (tmpRetException) { - const error = swift.memory.getObject(tmpRetException); - swift.memory.release(tmpRetException); - tmpRetException = undefined; - throw error; - } - invokeResult; + instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(boxPtr, +isSome, isSome ? param0CaseId : 0); const tag = tagStack.pop(); const isNull = (tag === -1); let optResult; @@ -764,65 +709,62 @@ export async function createInstantiator(options, swift) { } else { optResult = enumHelpers.APIResult.lift(tag); } + if (param0Cleanup) { param0Cleanup(); } + if (tmpRetException) { + const error = swift.memory.getObject(tmpRetException); + swift.memory.release(tmpRetException); + tmpRetException = undefined; + throw error; + } return optResult; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO); } - - bjs["invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO"] = function(callbackId, param0IsSome, param0WrappedValue) { try { const callback = swift.memory.getObject(callbackId); - let param0; - if (param0IsSome) { - param0 = param0Value; - } else { - param0 = null; - } - const result = callback(param0); - tmpRetOptionalInt = result; - return; + let ret = callback(param0IsSome ? param0WrappedValue : null); + const isSome = ret != null; + return isSome ? (ret | 0) : -1; } catch (error) { - setException?.(error); - return; + setException(error); } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO = function(param0) { const isSome = param0 != null; - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(boxPtr, +isSome, isSome ? param0 : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(boxPtr, +isSome, isSome ? param0 : 0); + const optResult = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - invokeResult; - const optResult = tmpRetOptionalInt; - tmpRetOptionalInt = undefined; return optResult; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO); } - - bjs["invoke_js_callback_TestModule_10TestModuleSqSS_SqSS"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSqSS_SqSS"] = function(callbackId, param0IsSome, param0WrappedValue) { try { const callback = swift.memory.getObject(callbackId); - let param0; + let obj; if (param0IsSome) { - const param0Object = swift.memory.getObject(param0Value); - swift.memory.release(param0Value); - param0 = String(param0Object); + obj = swift.memory.getObject(param0WrappedValue); + swift.memory.release(param0WrappedValue); + } + let ret = callback(param0IsSome ? obj : null); + const isSome = ret != null; + if (isSome) { + tmpRetString = ret; } else { - param0 = null; + tmpRetString = null; } - const result = callback(param0); - tmpRetString = result; - return; } catch (error) { - setException?.(error); - return; + setException(error); } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSqSS_SqSS"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSqSS_SqSS = function(param0) { const isSome = param0 != null; @@ -831,156 +773,122 @@ export async function createInstantiator(options, swift) { param0Bytes = textEncoder.encode(param0); param0Id = swift.memory.retain(param0Bytes); } - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSS_SqSS(boxPtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSS_SqSS(boxPtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); + const optResult = tmpRetString; + tmpRetString = undefined; + if (param0Id != undefined) { + swift.memory.release(param0Id); + } if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - invokeResult; - const optResult = tmpRetString; - tmpRetString = undefined; return optResult; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSqSS_SqSS); } - - bjs["invoke_js_callback_TestModule_10TestModuleSqSb_SqSb"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSqSb_SqSb"] = function(callbackId, param0IsSome, param0WrappedValue) { try { const callback = swift.memory.getObject(callbackId); - let param0; - if (param0IsSome) { - param0 = param0Value !== 0; - } else { - param0 = null; - } - const result = callback(param0); - tmpRetOptionalBool = result; - return; + let ret = callback(param0IsSome ? param0WrappedValue !== 0 : null); + const isSome = ret != null; + bjs["swift_js_return_optional_bool"](isSome ? 1 : 0, isSome ? (ret ? 1 : 0) : 0); } catch (error) { - setException?.(error); - return; + setException(error); } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSqSb_SqSb"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSqSb_SqSb = function(param0) { const isSome = param0 != null; - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSb_SqSb(boxPtr, +isSome, isSome ? param0 : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSb_SqSb(boxPtr, +isSome, isSome ? param0 : 0); + const optResult = tmpRetOptionalBool; + tmpRetOptionalBool = undefined; if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - invokeResult; - const optResult = tmpRetOptionalBool; - tmpRetOptionalBool = undefined; return optResult; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSqSb_SqSb); } - - bjs["invoke_js_callback_TestModule_10TestModuleSqSd_SqSd"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSqSd_SqSd"] = function(callbackId, param0IsSome, param0WrappedValue) { try { const callback = swift.memory.getObject(callbackId); - let param0; - if (param0IsSome) { - param0 = param0Value; - } else { - param0 = null; - } - const result = callback(param0); - tmpRetOptionalDouble = result; - return; + let ret = callback(param0IsSome ? param0WrappedValue : null); + const isSome = ret != null; + bjs["swift_js_return_optional_double"](isSome ? 1 : 0, isSome ? ret : 0.0); } catch (error) { - setException?.(error); - return; + setException(error); } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSqSd_SqSd"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSqSd_SqSd = function(param0) { const isSome = param0 != null; - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSd_SqSd(boxPtr, +isSome, isSome ? param0 : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSd_SqSd(boxPtr, +isSome, isSome ? param0 : 0); + const optResult = tmpRetOptionalDouble; + tmpRetOptionalDouble = undefined; if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - invokeResult; - const optResult = tmpRetOptionalDouble; - tmpRetOptionalDouble = undefined; return optResult; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSqSd_SqSd); } - - bjs["invoke_js_callback_TestModule_10TestModuleSqSf_SqSf"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSqSf_SqSf"] = function(callbackId, param0IsSome, param0WrappedValue) { try { const callback = swift.memory.getObject(callbackId); - let param0; - if (param0IsSome) { - param0 = Math.fround(param0Value); - } else { - param0 = null; - } - const result = callback(param0); - tmpRetOptionalFloat = result; - return; + let ret = callback(param0IsSome ? param0WrappedValue : null); + const isSome = ret != null; + bjs["swift_js_return_optional_float"](isSome ? 1 : 0, isSome ? Math.fround(ret) : 0.0); } catch (error) { - setException?.(error); - return; + setException(error); } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSqSf_SqSf"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSqSf_SqSf = function(param0) { const isSome = param0 != null; - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSf_SqSf(boxPtr, +isSome, isSome ? param0 : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSf_SqSf(boxPtr, +isSome, isSome ? param0 : 0); + const optResult = tmpRetOptionalFloat; + tmpRetOptionalFloat = undefined; if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - invokeResult; - const optResult = tmpRetOptionalFloat; - tmpRetOptionalFloat = undefined; return optResult; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSqSf_SqSf); } - - bjs["invoke_js_callback_TestModule_10TestModuleSqSi_SqSi"] = function(callbackId, param0IsSome, param0Value) { + bjs["invoke_js_callback_TestModule_10TestModuleSqSi_SqSi"] = function(callbackId, param0IsSome, param0WrappedValue) { try { const callback = swift.memory.getObject(callbackId); - let param0; - if (param0IsSome) { - param0 = param0Value | 0; - } else { - param0 = null; - } - const result = callback(param0); - tmpRetOptionalInt = result; - return; + let ret = callback(param0IsSome ? param0WrappedValue : null); + const isSome = ret != null; + bjs["swift_js_return_optional_int"](isSome ? 1 : 0, isSome ? (ret | 0) : 0); } catch (error) { - setException?.(error); - return; + setException(error); } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSqSi_SqSi"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSqSi_SqSi = function(param0) { const isSome = param0 != null; - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSi_SqSi(boxPtr, +isSome, isSome ? param0 : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSi_SqSi(boxPtr, +isSome, isSome ? param0 : 0); + const optResult = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - invokeResult; - const optResult = tmpRetOptionalInt; - tmpRetOptionalInt = undefined; return optResult; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSqSi_SqSi); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index 57b34d426..98899d4df 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -228,28 +228,26 @@ export async function createInstantiator(options, swift) { const func = swift.memory.getObject(funcRef); func.__unregister(); } - - bjs["invoke_js_callback_TestModule_10TestModuleSi_Si"] = function(callbackId, param0Id) { + bjs["invoke_js_callback_TestModule_10TestModuleSi_Si"] = function(callbackId, param0) { try { const callback = swift.memory.getObject(callbackId); - let param0 = param0Id; - const result = callback(param0); - return result | 0; + let ret = callback(param0); + return ret; } catch (error) { - setException?.(error); - return 0; + setException(error); + return 0 } - }; + } bjs["make_swift_closure_TestModule_10TestModuleSi_Si"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSi_Si = function(param0) { - const invokeResult = instance.exports.invoke_swift_closure_TestModule_10TestModuleSi_Si(boxPtr, param0); + const ret = instance.exports.invoke_swift_closure_TestModule_10TestModuleSi_Si(boxPtr, param0); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); tmpRetException = undefined; throw error; } - return invokeResult | 0; + return ret; }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSi_Si); } From bceaf282812d4d341ec21f22a525d6c7301c90f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 17:50:31 +0000 Subject: [PATCH 191/252] Bump actions/setup-node from 4 to 6 Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4 to 6. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v4...v6) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7b5a808bc..68d6dac21 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -85,7 +85,7 @@ jobs: steps: - uses: actions/checkout@v6 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: '20' - name: Install TypeScript From c6f2642275b2777da95c03c0e98845d48b12e5da Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Mon, 9 Feb 2026 18:51:58 +0100 Subject: [PATCH 192/252] BridgeJS: Fix incorrect TypeScript type names for `tsEnum`-style enums and struct associated values --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 13 +++++++++++-- .../BridgeJSLinkTests/EnumAssociatedValue.d.ts | 4 ++-- .../__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts | 6 +++--- .../BridgeJSLinkTests/EnumRawType.d.ts | 12 ++++++------ 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 13ea4e910..59ab9428b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -1470,6 +1470,9 @@ public struct BridgeJSLink { case .namespaceEnum: return enumDef.tsFullPath default: + if enumDef.emitStyle == .tsEnum { + return enumDef.tsFullPath + } return "\(enumDef.tsFullPath)Tag" } } @@ -1786,7 +1789,7 @@ public struct BridgeJSLink { ] for (associatedValueIndex, associatedValue) in enumCase.associatedValues.enumerated() { let prop = associatedValue.label ?? "param\(associatedValueIndex)" - fields.append("\(prop): \(associatedValue.type.tsType)") + fields.append("\(prop): \(resolveTypeScriptType(associatedValue.type))") } unionParts.append("{ \(fields.joined(separator: "; ")) }") } @@ -2917,6 +2920,7 @@ extension BridgeJSLink { depth: 1, printer: printer, exposeToGlobal: true, + exportedSkeletons: exportedSkeletons, renderTSSignatureCallback: renderTSSignatureCallback ) printer.unindent() @@ -2935,6 +2939,7 @@ extension BridgeJSLink { depth: 1, printer: printer, exposeToGlobal: false, + exportedSkeletons: exportedSkeletons, renderTSSignatureCallback: renderTSSignatureCallback ) } @@ -2948,6 +2953,7 @@ extension BridgeJSLink { depth: Int, printer: CodeFragmentPrinter, exposeToGlobal: Bool, + exportedSkeletons: [ExportedSkeleton], renderTSSignatureCallback: @escaping ([Parameter], BridgeType, Effects) -> String ) { func hasContent(node: NamespaceNode) -> Bool { @@ -3102,7 +3108,9 @@ extension BridgeJSLink { .enumerated() { let prop = associatedValue.label ?? "param\(associatedValueIndex)" - fields.append("\(prop): \(associatedValue.type.tsType)") + fields.append( + "\(prop): \(BridgeJSLink.resolveTypeScriptType(associatedValue.type, exportedSkeletons: exportedSkeletons))" + ) } unionParts.append("{ \(fields.joined(separator: "; ")) }") } @@ -3136,6 +3144,7 @@ extension BridgeJSLink { depth: depth + 1, printer: printer, exposeToGlobal: exposeToGlobal, + exportedSkeletons: exportedSkeletons, renderTSSignatureCallback: renderTSSignatureCallback ) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts index 9ab117011..13f77ae08 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts @@ -82,7 +82,7 @@ export const AllTypesResultValues: { }; export type AllTypesResultTag = - { tag: typeof AllTypesResultValues.Tag.StructPayload; param0: PointTag } | { tag: typeof AllTypesResultValues.Tag.ClassPayload; param0: User } | { tag: typeof AllTypesResultValues.Tag.JsObjectPayload; param0: any } | { tag: typeof AllTypesResultValues.Tag.NestedEnum; param0: APIResultTag } | { tag: typeof AllTypesResultValues.Tag.ArrayPayload; param0: number[] } | { tag: typeof AllTypesResultValues.Tag.Empty } + { tag: typeof AllTypesResultValues.Tag.StructPayload; param0: Point } | { tag: typeof AllTypesResultValues.Tag.ClassPayload; param0: User } | { tag: typeof AllTypesResultValues.Tag.JsObjectPayload; param0: any } | { tag: typeof AllTypesResultValues.Tag.NestedEnum; param0: APIResultTag } | { tag: typeof AllTypesResultValues.Tag.ArrayPayload; param0: number[] } | { tag: typeof AllTypesResultValues.Tag.Empty } export const OptionalAllTypesResultValues: { readonly Tag: { @@ -96,7 +96,7 @@ export const OptionalAllTypesResultValues: { }; export type OptionalAllTypesResultTag = - { tag: typeof OptionalAllTypesResultValues.Tag.OptStruct; param0: PointTag | null } | { tag: typeof OptionalAllTypesResultValues.Tag.OptClass; param0: User | null } | { tag: typeof OptionalAllTypesResultValues.Tag.OptJSObject; param0: any | null } | { tag: typeof OptionalAllTypesResultValues.Tag.OptNestedEnum; param0: APIResultTag | null } | { tag: typeof OptionalAllTypesResultValues.Tag.OptArray; param0: number[] | null } | { tag: typeof OptionalAllTypesResultValues.Tag.Empty } + { tag: typeof OptionalAllTypesResultValues.Tag.OptStruct; param0: Point | null } | { tag: typeof OptionalAllTypesResultValues.Tag.OptClass; param0: User | null } | { tag: typeof OptionalAllTypesResultValues.Tag.OptJSObject; param0: any | null } | { tag: typeof OptionalAllTypesResultValues.Tag.OptNestedEnum; param0: APIResultTag | null } | { tag: typeof OptionalAllTypesResultValues.Tag.OptArray; param0: number[] | null } | { tag: typeof OptionalAllTypesResultValues.Tag.Empty } export interface Point { x: number; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts index 47fb52d94..5581df31e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts @@ -42,9 +42,9 @@ export type Exports = { getDirection(): DirectionTag; processDirection(input: DirectionTag): StatusTag; roundTripOptionalDirection(input: DirectionTag | null): DirectionTag | null; - setTSDirection(direction: TSDirectionTag): void; - getTSDirection(): TSDirectionTag; - roundTripOptionalTSDirection(input: TSDirectionTag | null): TSDirectionTag | null; + setTSDirection(direction: TSDirection): void; + getTSDirection(): TSDirection; + roundTripOptionalTSDirection(input: TSDirection | null): TSDirection | null; Direction: DirectionObject Status: StatusObject PublicStatus: PublicStatusObject diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts index 170d7f07d..50a45a58d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts @@ -113,18 +113,18 @@ export type Exports = { setTheme(theme: ThemeTag): void; getTheme(): ThemeTag; roundTripOptionalTheme(input: ThemeTag | null): ThemeTag | null; - setTSTheme(theme: TSThemeTag): void; - getTSTheme(): TSThemeTag; - roundTripOptionalTSTheme(input: TSThemeTag | null): TSThemeTag | null; + setTSTheme(theme: TSTheme): void; + getTSTheme(): TSTheme; + roundTripOptionalTSTheme(input: TSTheme | null): TSTheme | null; setFeatureFlag(flag: FeatureFlagTag): void; getFeatureFlag(): FeatureFlagTag; roundTripOptionalFeatureFlag(input: FeatureFlagTag | null): FeatureFlagTag | null; setHttpStatus(status: HttpStatusTag): void; getHttpStatus(): HttpStatusTag; roundTripOptionalHttpStatus(input: HttpStatusTag | null): HttpStatusTag | null; - setTSHttpStatus(status: TSHttpStatusTag): void; - getTSHttpStatus(): TSHttpStatusTag; - roundTripOptionalHttpStatus(input: TSHttpStatusTag | null): TSHttpStatusTag | null; + setTSHttpStatus(status: TSHttpStatus): void; + getTSHttpStatus(): TSHttpStatus; + roundTripOptionalHttpStatus(input: TSHttpStatus | null): TSHttpStatus | null; setPriority(priority: PriorityTag): void; getPriority(): PriorityTag; roundTripOptionalPriority(input: PriorityTag | null): PriorityTag | null; From 935130c27b45feb253dc6531d1b9f7ab7854087e Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 10 Feb 2026 11:12:54 +0900 Subject: [PATCH 193/252] BridgeJS: Update `JSUndefinedOr` APIs - Rename `optionalRepresentation` to `asOptional`. - Remove `undefinedValue` static property and use `.undefined` case directly. --- .../Sources/BridgeJSCore/ExportSwift.swift | 6 +- .../JavaScriptKit/BridgeJSIntrinsics.swift | 70 +++++++++---------- Sources/JavaScriptKit/JSUndefinedOr.swift | 19 +++-- .../DictionaryTests.swift | 2 +- .../OptionalSupportTests.swift | 2 +- 5 files changed, 55 insertions(+), 44 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 70ed8f8a8..913bc076b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -156,7 +156,7 @@ public class ExportSwift { let absentExpr = kind == .null ? "\(optionalSwiftType)<[\(swiftTypeName)]>.none" - : "\(optionalSwiftType)<[\(swiftTypeName)]>.undefinedValue" + : "\(optionalSwiftType)<[\(swiftTypeName)]>.undefined" liftingExpr = ExprSyntax( """ { @@ -934,7 +934,7 @@ struct StackCodegen { let swiftTypeName = elementType.swiftType let absentExpr = kind == .null - ? "\(typeName)<[\(swiftTypeName)]>.none" : "\(typeName)<[\(swiftTypeName)]>.undefinedValue" + ? "\(typeName)<[\(swiftTypeName)]>.none" : "\(typeName)<[\(swiftTypeName)]>.undefined" return """ { let __isSome = _swift_js_pop_i32() @@ -951,7 +951,7 @@ struct StackCodegen { let absentExpr = kind == .null ? "\(typeName)<[String: \(swiftTypeName)]>.none" - : "\(typeName)<[String: \(swiftTypeName)]>.undefinedValue" + : "\(typeName)<[String: \(swiftTypeName)]>.undefined" return """ { let __isSome = _swift_js_pop_i32() diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 4c8fdf3db..496b515c9 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -143,7 +143,7 @@ public protocol _BridgedSwiftStackType { /// Used by JSUndefinedOr so all bridge methods delegate to Optional. public protocol _BridgedAsOptional { associatedtype Wrapped - var optionalRepresentation: Wrapped? { get } + var asOptional: Wrapped? { get } init(optional: Wrapped?) } @@ -2019,7 +2019,7 @@ extension Optional where Wrapped: _BridgedSwiftStruct { extension _BridgedAsOptional where Wrapped == Bool { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { @@ -2035,13 +2035,13 @@ extension _BridgedAsOptional where Wrapped == Bool { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped == Int { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { @@ -2057,13 +2057,13 @@ extension _BridgedAsOptional where Wrapped == Int { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped == UInt { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { @@ -2079,13 +2079,13 @@ extension _BridgedAsOptional where Wrapped == UInt { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped == String { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public static func bridgeJSLiftParameter( @@ -2105,13 +2105,13 @@ extension _BridgedAsOptional where Wrapped == String { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped == JSObject { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ objectId: Int32) -> Self { @@ -2123,7 +2123,7 @@ extension _BridgedAsOptional where Wrapped == JSObject { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } @@ -2133,20 +2133,20 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftProtocolWrapper { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped: _BridgedSwiftHeapObject { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, pointer: UnsafeMutableRawPointer) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public consuming func bridgeJSLowerParameterWithRetain() -> ( isSome: Int32, pointer: UnsafeMutableRawPointer ) { - optionalRepresentation.bridgeJSLowerParameterWithRetain() + asOptional.bridgeJSLowerParameterWithRetain() } @_spi(BridgeJS) public static func bridgeJSLiftParameter( @@ -2165,13 +2165,13 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftHeapObject { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped == Float { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float32) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Self { @@ -2187,13 +2187,13 @@ extension _BridgedAsOptional where Wrapped == Float { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped == Double { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float64) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float64) -> Self { @@ -2209,13 +2209,13 @@ extension _BridgedAsOptional where Wrapped == Double { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped: _BridgedSwiftCaseEnum { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ caseId: Int32) -> Self { @@ -2231,20 +2231,20 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftCaseEnum { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped: _BridgedSwiftTypeLoweredIntoVoidType { @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == String { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public static func bridgeJSLiftParameter( @@ -2264,14 +2264,14 @@ where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.Ra } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Int { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { @@ -2287,7 +2287,7 @@ where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.Ra } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } @@ -2302,14 +2302,14 @@ where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.Ra } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Float { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float32) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Self { @@ -2325,14 +2325,14 @@ where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.Ra } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Double { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float64) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float64) -> Self { @@ -2348,13 +2348,13 @@ where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.Ra } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } extension _BridgedAsOptional where Wrapped: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, caseId: Int32) { - optionalRepresentation.bridgeJSLowerParameter() + asOptional.bridgeJSLowerParameter() } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ caseId: Int32) -> Self { @@ -2370,7 +2370,7 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftAssociatedValueEnum { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } @@ -2384,7 +2384,7 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftStruct { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - optionalRepresentation.bridgeJSLowerReturn() + asOptional.bridgeJSLowerReturn() } } @@ -2526,7 +2526,7 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftDictionaryStackType { typealias DictionaryValue = Wrapped.DictionaryValue @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { - let opt = optionalRepresentation + let opt = asOptional if let dict = opt { dict.bridgeJSLowerReturn() return 1 diff --git a/Sources/JavaScriptKit/JSUndefinedOr.swift b/Sources/JavaScriptKit/JSUndefinedOr.swift index 82e218105..de7be09b4 100644 --- a/Sources/JavaScriptKit/JSUndefinedOr.swift +++ b/Sources/JavaScriptKit/JSUndefinedOr.swift @@ -1,17 +1,28 @@ +/// A wrapper that represents a JavaScript value of `Wrapped | undefined`. +/// +/// In BridgeJS, `Optional` is bridged as `Wrapped | null`. +/// Use `JSUndefinedOr` when the JavaScript API expects +/// `Wrapped | undefined` instead. @frozen public enum JSUndefinedOr { + /// The JavaScript value is `undefined`. case undefined + /// The JavaScript value is present and wrapped. case value(Wrapped) - /// Convenience accessor for the undefined case. - public static var undefinedValue: Self { .undefined } - + /// Creates a wrapper from a Swift optional. + /// + /// - Parameter optional: The optional value to wrap. + /// `nil` becomes ``undefined`` and a non-`nil` value becomes ``value(_:)``. @inlinable public init(optional: Wrapped?) { self = optional.map(Self.value) ?? .undefined } + /// Returns the wrapped value as a Swift optional. + /// + /// Returns `nil` when this value is ``undefined``. @inlinable - public var optionalRepresentation: Wrapped? { + public var asOptional: Wrapped? { switch self { case .undefined: return nil diff --git a/Tests/BridgeJSRuntimeTests/DictionaryTests.swift b/Tests/BridgeJSRuntimeTests/DictionaryTests.swift index 83ca72d04..ba702205d 100644 --- a/Tests/BridgeJSRuntimeTests/DictionaryTests.swift +++ b/Tests/BridgeJSRuntimeTests/DictionaryTests.swift @@ -57,7 +57,7 @@ final class DictionaryTests: XCTestCase { func testRoundTripOptionalDictionaryUndefined() throws { let some: JSUndefinedOr<[String: Int]> = .value(["n": 42]) - let undefined: JSUndefinedOr<[String: Int]> = .undefinedValue + let undefined: JSUndefinedOr<[String: Int]> = .undefined let returnedSome = try jsRoundTripUndefinedDictionary(some) switch returnedSome { diff --git a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift index adfd51dea..454f5011d 100644 --- a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift +++ b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift @@ -23,7 +23,7 @@ final class OptionalSupportTests: XCTestCase { XCTFail("Expected defined value") } - let undefined = try jsRoundTripOptionalStringUndefined(.undefinedValue) + let undefined = try jsRoundTripOptionalStringUndefined(.undefined) if case .value = undefined { XCTFail("Expected undefined") } From 9eaefa6dd0210ad3e7f5e52bc23e5e2cc9a0acc5 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 10 Feb 2026 16:19:34 +0900 Subject: [PATCH 194/252] BridgeJS: Rename `BRIDGE_JS_PROFILING` to `BRIDGEJS_PROFILING` to be consistent with other environment variables used by BridgeJS. --- Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index b36b3ec8c..3b784b732 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -327,7 +327,7 @@ private func inputSwiftFiles(targetDirectory: URL, positionalArguments: [String] extension Profiling { static func make() -> Profiling? { - guard let outputPath = ProcessInfo.processInfo.environment["BRIDGE_JS_PROFILING"] else { + guard let outputPath = ProcessInfo.processInfo.environment["BRIDGEJS_PROFILING"] else { return nil } let fd = open(outputPath, O_WRONLY | O_CREAT | O_TRUNC, 0o644) From 929af06dd07205def449f2063646f86466c15e28 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 10 Feb 2026 16:21:25 +0900 Subject: [PATCH 195/252] Merge pull request #616 from swiftwasm/katei/0736-bridgejs-diagnos BridgeJS: Include source-context in diagnostic messages --- Plugins/BridgeJS/Package.swift | 2 + .../BridgeJS/Sources/BridgeJSCore/Misc.swift | 150 ++++++++++++++- .../BridgeJSToolTests/DiagnosticsTests.swift | 182 ++++++++++++++++++ 3 files changed, 328 insertions(+), 6 deletions(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/DiagnosticsTests.swift diff --git a/Plugins/BridgeJS/Package.swift b/Plugins/BridgeJS/Package.swift index 49aa161c9..2074a8a66 100644 --- a/Plugins/BridgeJS/Package.swift +++ b/Plugins/BridgeJS/Package.swift @@ -58,6 +58,8 @@ let package = Package( "BridgeJSCore", "BridgeJSLink", "TS2Swift", + .product(name: "SwiftParser", package: "swift-syntax"), + .product(name: "SwiftSyntax", package: "swift-syntax"), ], exclude: ["__Snapshots__", "Inputs"] ), diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift index 67f5170c4..9db11b14d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift @@ -134,6 +134,7 @@ private enum JSON { // MARK: - DiagnosticError import SwiftSyntax +import class Foundation.ProcessInfo struct DiagnosticError: Error { let node: Syntax @@ -146,17 +147,154 @@ struct DiagnosticError: Error { self.hint = hint } - func formattedDescription(fileName: String) -> String { - let locationConverter = SourceLocationConverter(fileName: fileName, tree: node.root) - let location = locationConverter.location(for: node.position) - var description = "\(fileName):\(location.line):\(location.column): error: \(message)" + /// Formats the diagnostic error as a string. + /// + /// - Parameters: + /// - fileName: The name of the file to display in the output. + /// - colorize: Whether to colorize the output with ANSI escape sequences. + /// - Returns: The formatted diagnostic error string. + func formattedDescription(fileName: String, colorize: Bool = Self.shouldColorize) -> String { + let displayFileName = fileName == "-" ? "" : fileName + let converter = SourceLocationConverter(fileName: displayFileName, tree: node.root) + let startLocation = converter.location(for: node.positionAfterSkippingLeadingTrivia) + let endLocation = converter.location(for: node.endPositionBeforeTrailingTrivia) + + let sourceText = node.root.description + let lines = sourceText.split(omittingEmptySubsequences: false, whereSeparator: \.isNewline) + let startLineIndex = max(0, min(lines.count - 1, startLocation.line - 1)) + let mainLine = String(lines[startLineIndex]) + + let lineNumberWidth = max(3, String(lines.count).count) + + let header: String = { + guard colorize else { + return "\(displayFileName):\(startLocation.line):\(startLocation.column): error: \(message)" + } + return + "\(displayFileName):\(startLocation.line):\(startLocation.column): \(ANSI.boldRed)error: \(ANSI.boldDefault)\(message)\(ANSI.reset)" + }() + + let highlightStartColumn = min(max(1, startLocation.column), mainLine.utf8.count + 1) + let availableColumns = max(0, mainLine.utf8.count - (highlightStartColumn - 1)) + let rawHighlightLength: Int = { + guard availableColumns > 0 else { return 0 } + if startLocation.line == endLocation.line { + return max(1, min(endLocation.column - startLocation.column, availableColumns)) + } else { + return min(1, availableColumns) + } + }() + let highlightLength = min(rawHighlightLength, availableColumns) + + let formattedMainLine: String = { + guard colorize, highlightLength > 0 else { return mainLine } + + let startIndex = Self.index(atUTF8Offset: highlightStartColumn - 1, in: mainLine) + let endIndex = Self.index(atUTF8Offset: highlightStartColumn - 1 + highlightLength, in: mainLine) + + let prefix = String(mainLine[..= 0, lineIndex < lines.count else { continue } + descriptionParts.append( + Self.formatSourceLine( + number: lineIndex + 1, + text: String(lines[lineIndex]), + width: lineNumberWidth, + colorize: colorize + ) + ) + } + + descriptionParts.append( + Self.formatSourceLine( + number: startLocation.line, + text: formattedMainLine, + width: lineNumberWidth, + colorize: colorize + ) + ) + + let pointerSpacing = max(0, highlightStartColumn - 1) + let pointerMessage: String = { + let pointer = String(repeating: " ", count: pointerSpacing) + "`- " + guard colorize else { return pointer + "error: \(message)" } + return pointer + "\(ANSI.boldRed)error: \(ANSI.boldDefault)\(message)\(ANSI.reset)" + }() + descriptionParts.append( + Self.formatSourceLine( + number: nil, + text: pointerMessage, + width: lineNumberWidth, + colorize: colorize + ) + ) + + if startLineIndex + 1 < lines.count { + descriptionParts.append( + Self.formatSourceLine( + number: startLocation.line + 1, + text: String(lines[startLineIndex + 1]), + width: lineNumberWidth, + colorize: colorize + ) + ) + } + if let hint { - description += "\nHint: \(hint)" + descriptionParts.append("Hint: \(hint)") } - return description + + return descriptionParts.joined(separator: "\n") + } + + private static func formatSourceLine( + number: Int?, + text: String, + width: Int, + colorize: Bool + ) -> String { + let gutter: String + if let number { + let paddedNumber = String(repeating: " ", count: max(0, width - String(number).count)) + String(number) + gutter = colorize ? ANSI.cyan + paddedNumber + ANSI.reset : paddedNumber + } else { + gutter = String(repeating: " ", count: width) + } + return "\(gutter) | \(text)" + } + + private static var shouldColorize: Bool { + let env = ProcessInfo.processInfo.environment + let termIsDumb = env["TERM"] == "dumb" + return env["NO_COLOR"] == nil && !termIsDumb + } + + private static func index(atUTF8Offset offset: Int, in line: String) -> String.Index { + let clamped = max(0, min(offset, line.utf8.count)) + let utf8Index = line.utf8.index(line.utf8.startIndex, offsetBy: clamped) + // String.Index initializer is guaranteed to succeed because the UTF8 index comes from the same string. + return String.Index(utf8Index, within: line)! } } +private enum ANSI { + static let reset = "\u{001B}[0;0m" + static let boldRed = "\u{001B}[1;31m" + static let boldDefault = "\u{001B}[1;39m" + static let cyan = "\u{001B}[0;36m" + static let underline = "\u{001B}[4;39m" +} + // MARK: - BridgeJSCoreError public struct BridgeJSCoreError: Swift.Error, CustomStringConvertible { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/DiagnosticsTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/DiagnosticsTests.swift new file mode 100644 index 000000000..500a5db95 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/DiagnosticsTests.swift @@ -0,0 +1,182 @@ +import SwiftParser +import SwiftSyntax +import Testing + +@testable import BridgeJSCore + +@Suite struct DiagnosticsTests { + /// Returns the first parameter's type node from a function in the source (the first `@JS func`-like decl), for pinpointing diagnostics. + private func firstParameterTypeNode(source: String) -> TypeSyntax? { + let tree = Parser.parse(source: source) + for stmt in tree.statements { + if let funcDecl = stmt.item.as(FunctionDeclSyntax.self), + let firstParam = funcDecl.signature.parameterClause.parameters.first + { + return firstParam.type + } + } + return nil + } + + @Test + func diagnosticIncludesLocationSourceAndHint() throws { + let source = "@JS func foo(_ bar: A) {}\n" + let typeNode = try #require(firstParameterTypeNode(source: source)) + let diagnostic = DiagnosticError( + node: typeNode, + message: "Unsupported type 'A'.", + hint: "Only primitive types and types defined in the same module are allowed" + ) + let description = diagnostic.formattedDescription(fileName: "-", colorize: false) + let expectedPrefix = """ + :1:21: error: Unsupported type 'A'. + 1 | @JS func foo(_ bar: A) {} + | `- error: Unsupported type 'A'. + 2 | + """.trimmingCharacters(in: .whitespacesAndNewlines) + #expect(description.hasPrefix(expectedPrefix)) + #expect(description.contains("Hint: Only primitive types and types defined in the same module are allowed")) + } + + @Test + func diagnosticOmitsHintWhenNotProvided() throws { + let source = "@JS static func foo() {}\n" + let tree = Parser.parse(source: source) + let diagnostic = DiagnosticError( + node: tree, + message: "Top-level functions cannot be static", + hint: nil + ) + let description = diagnostic.formattedDescription(fileName: "-", colorize: false) + let expectedPrefix = """ + :1:1: error: Top-level functions cannot be static + 1 | @JS static func foo() {} + | `- error: Top-level functions cannot be static + 2 | + """.trimmingCharacters(in: .whitespacesAndNewlines) + #expect(description.hasPrefix(expectedPrefix)) + #expect(!description.contains("Hint:")) + } + + @Test + func diagnosticUsesGivenFileNameNotStdin() throws { + let source = "@JS func foo(_ bar: A) {}\n" + let typeNode = try #require(firstParameterTypeNode(source: source)) + let diagnostic = DiagnosticError( + node: typeNode, + message: "Unsupported type 'A'.", + hint: nil + ) + let description = diagnostic.formattedDescription(fileName: "Sources/Foo.swift", colorize: false) + #expect(description.hasPrefix("Sources/Foo.swift:1:21: error: Unsupported type 'A'.")) + } + + @Test + func diagnosticWithColorizeTrueIncludesANSISequences() throws { + let source = "@JS func foo(_ bar: A) {}\n" + let typeNode = try #require(firstParameterTypeNode(source: source)) + let diagnostic = DiagnosticError( + node: typeNode, + message: "Unsupported type 'A'.", + hint: nil + ) + let description = diagnostic.formattedDescription(fileName: "-", colorize: true) + let esc = "\u{001B}" + let boldRed = "\(esc)[1;31m" + let boldDefault = "\(esc)[1;39m" + let reset = "\(esc)[0;0m" + let cyan = "\(esc)[0;36m" + let underline = "\(esc)[4;39m" + let expected = + ":1:21: \(boldRed)error: \(boldDefault)Unsupported type 'A'.\(reset)\n" + + "\(cyan) 1\(reset) | @JS func foo(_ bar: \(underline)A\(reset)) {}\n" + + " | `- \(boldRed)error: \(boldDefault)Unsupported type 'A'.\(reset)\n" + + "\(cyan) 2\(reset) | " + #expect(description == expected) + } + + // MARK: - Context source lines + + @Test + func showsOnePreviousLineWhenErrorNotOnFirstLine() throws { + let source = """ + preamble + @JS func foo(_ bar: A) {} + """ + let typeNode = try #require(firstParameterTypeNode(source: source)) + let diagnostic = DiagnosticError(node: typeNode, message: "Unsupported type 'A'.", hint: nil) + let description = diagnostic.formattedDescription(fileName: "-", colorize: false) + #expect(description.contains(" 1 | preamble")) + #expect(description.contains(" 2 | @JS func foo(_ bar: A) {}")) + #expect(description.contains(":2:")) + } + + @Test + func showsThreePreviousLinesWhenAvailable() throws { + let source = """ + first + second + third + @JS func foo(_ bar: A) {} + """ + let typeNode = try #require(firstParameterTypeNode(source: source)) + let diagnostic = DiagnosticError(node: typeNode, message: "Unsupported type 'A'.", hint: nil) + let description = diagnostic.formattedDescription(fileName: "-", colorize: false) + #expect(description.contains(" 1 | first")) + #expect(description.contains(" 2 | second")) + #expect(description.contains(" 3 | third")) + #expect(description.contains(" 4 | @JS func foo(_ bar: A) {}")) + #expect(description.contains(":4:")) + } + + @Test + func capsContextAtThreePreviousLines() throws { + let source = """ + line0 + line1 + line2 + line3 + @JS func foo(_ bar: A) {} + """ + let typeNode = try #require(firstParameterTypeNode(source: source)) + let diagnostic = DiagnosticError(node: typeNode, message: "Unsupported type 'A'.", hint: nil) + let description = diagnostic.formattedDescription(fileName: "-", colorize: false) + #expect(!description.contains(" 1 | line0")) + #expect(description.contains(" 2 | line1")) + #expect(description.contains(" 3 | line2")) + #expect(description.contains(" 4 | line3")) + #expect(description.contains(" 5 | @JS func foo(_ bar: A) {}")) + #expect(description.contains(":5:")) + } + + @Test + func includesNextLineAfterErrorLine() throws { + let source = """ + @JS func foo( + _ bar: A + ) {} + """ + let typeNode = try #require(firstParameterTypeNode(source: source)) + let diagnostic = DiagnosticError(node: typeNode, message: "Unsupported type 'A'.", hint: nil) + let description = diagnostic.formattedDescription(fileName: "-", colorize: false) + #expect(description.contains(" 1 | @JS func foo(")) + #expect(description.contains(" 2 | _ bar: A")) + #expect(description.contains(" 3 | ) {}")) + #expect(description.contains(":2:")) + } + + @Test + func omitsNextLineWhenErrorIsOnLastLine() throws { + let source = """ + preamble + @JS func foo(_ bar: A) + """ + let typeNode = try #require(firstParameterTypeNode(source: source)) + let diagnostic = DiagnosticError(node: typeNode, message: "Unsupported type 'A'.", hint: nil) + let description = diagnostic.formattedDescription(fileName: "-", colorize: false) + #expect(description.contains(" 2 | @JS func foo(_ bar: A)")) + #expect(description.contains(":2:")) + // No line 3 in source, so output must not show a " 3 |" context line after the pointer + #expect(!description.contains(" 3 |")) + } +} From 63cb9af45a7b6b387cd8af50c83b3ad79e07fe29 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 10 Feb 2026 14:38:00 +0700 Subject: [PATCH 196/252] BridgeJS: Check generated TypeScript validity in test suites (#611) --- .github/workflows/test.yml | 4 ++++ .../__Snapshots__/BridgeJSLinkTests/tsconfig.json | 12 ++++++++++++ package.json | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/tsconfig.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 68d6dac21..1e9060f19 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -69,6 +69,8 @@ jobs: git diff --exit-code Sources/JavaScriptKit/Runtime - run: swift test --package-path ./Plugins/PackageToJS - run: swift test --package-path ./Plugins/BridgeJS + - name: Validate BridgeJS TypeScript declarations + run: npm run check:bridgejs-dts test-bridgejs-against-swift-versions: name: Test BridgeJS against Swift versions @@ -90,6 +92,8 @@ jobs: node-version: '20' - name: Install TypeScript run: npm install + - name: Validate BridgeJS TypeScript declarations + run: npm run check:bridgejs-dts - name: Run BridgeJS tests # NOTE: Seems like the prebuilt SwiftSyntax binaries are not compatible with # non-macro dependents, so disable experimental prebuilts for now. diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/tsconfig.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/tsconfig.json new file mode 100644 index 000000000..277b2c578 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "strict": true, + "noEmit": true, + "skipLibCheck": false, + "target": "ES2020", + "module": "ES2020", + "moduleResolution": "node", + "lib": ["ES2020", "DOM"] + }, + "include": ["*.d.ts"] +} diff --git a/package.json b/package.json index 1f3f1871b..509cddde2 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "build:clean": "rm -rf Runtime/lib", "build:ts": "cd Runtime; rollup -c", "prepublishOnly": "npm run build", - "format": "prettier --write Runtime/src" + "format": "prettier --write Runtime/src", + "check:bridgejs-dts": "tsc --project Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/tsconfig.json" }, "keywords": [ "Swift", From b06a79bf9b10dbe868c1e8d2807fd6385f74929c Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 10 Feb 2026 17:27:30 +0900 Subject: [PATCH 197/252] BridgeJS: Allow executing TS2SwiftVitestTests on Xcode --- Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift | 15 ++++++++------- .../BridgeJSToolTests/TS2SwiftVitestTests.swift | 13 +++++++++++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift b/Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift index 795b7b390..6337dcf27 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift +++ b/Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift @@ -20,6 +20,12 @@ import BridgeJSCore import BridgeJSSkeleton #endif +#if os(Windows) +let PATH_SEPARATOR: Character = ";" +#else +let PATH_SEPARATOR: Character = ":" +#endif + internal func which( _ executable: String, environment: [String: String] = ProcessInfo.processInfo.environment @@ -39,13 +45,8 @@ internal func which( } } } - let pathSeparator: Character - #if os(Windows) - pathSeparator = ";" - #else - pathSeparator = ":" - #endif - let paths = environment["PATH"]?.split(separator: pathSeparator) ?? [] + + let paths = environment["PATH"]?.split(separator: PATH_SEPARATOR) ?? [] for path in paths { let url = URL(fileURLWithPath: String(path)).appendingPathComponent(executable) if checkCandidate(url) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/TS2SwiftVitestTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/TS2SwiftVitestTests.swift index bb3d2e0a4..f658b001f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/TS2SwiftVitestTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/TS2SwiftVitestTests.swift @@ -1,5 +1,6 @@ import Foundation import Testing +@testable import TS2Swift /// Runs the TS2Swift JavaScript test suite (Vitest) so that `swift test --package-path ./Plugins/BridgeJS` /// validates both the TypeScript ts2swift output and the Swift codegen. For fast iteration on ts2swift, @@ -17,8 +18,16 @@ import Testing .appendingPathComponent("TS2Swift") .appendingPathComponent("JavaScript") let process = Process() - process.executableURL = URL(fileURLWithPath: "/usr/bin/env") - var arguments = ["npm", "run", "test"] + guard let npmExecutable = which("npm"), let nodeExecutable = which("node") else { + Issue.record("No \"npm\" command found in your system") + return + } + process.executableURL = npmExecutable + var environment = ProcessInfo.processInfo.environment + environment["PATH"] = + "\(nodeExecutable.deletingLastPathComponent().path)\(PATH_SEPARATOR) \(environment["PATH"] ?? "")" + process.environment = environment + var arguments = ["run", "test"] if ProcessInfo.processInfo.environment["UPDATE_SNAPSHOTS"] != nil { arguments.append(contentsOf: ["--", "--update"]) } From cb7b6a92d9127c98b326214ed7f7ac3ced50ad10 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 11 Feb 2026 18:15:32 +0900 Subject: [PATCH 198/252] BridgeJS: Remove parsing API usage from JSSetterMacro --- Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift index ba171e8eb..4d32db449 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift @@ -54,7 +54,7 @@ extension JSSetterMacro: BodyMacro { firstName: .wildcardToken(trailingTrivia: .space), secondName: .identifier("value"), colon: .colonToken(trailingTrivia: .space), - type: TypeSyntax(stringLiteral: "<#Type#>") + type: IdentifierTypeSyntax(name: TokenSyntax(.identifier("<#Type#>"), presence: .present)) ) let newClause = FunctionParameterClauseSyntax( leftParen: .leftParenToken(), From 9162fa0cebca2c7e35a135e0819f8977b92dbf97 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 11 Feb 2026 18:32:46 +0900 Subject: [PATCH 199/252] BridgeJS: Remove BasicFormat usage in ExportSwift --- Benchmarks/Sources/Generated/BridgeJS.swift | 83 ++- .../Sources/BridgeJSCore/ClosureCodegen.swift | 133 ++-- .../Sources/BridgeJSCore/ExportSwift.swift | 612 ++++++++++-------- .../Sources/BridgeJSCore/ImportTS.swift | 584 +++++------------ .../Sources/BridgeJSUtilities/Utilities.swift | 6 + .../BridgeJSCodegenTests/ArrayTypes.swift | 100 +-- .../BridgeJSCodegenTests/Async.swift | 14 +- .../EnumAssociatedValue.swift | 66 +- .../ImportedTypeInExportedInterface.swift | 28 +- .../BridgeJSCodegenTests/JSValue.swift | 5 +- .../BridgeJSCodegenTests/Protocol.swift | 12 +- .../BridgeJSCodegenTests/SwiftStruct.swift | 13 +- .../Generated/BridgeJS.swift | 305 ++++----- 13 files changed, 880 insertions(+), 1081 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 5a480694c..515d3a531 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -312,7 +312,7 @@ extension Person: _BridgedSwiftStruct { self.address.bridgeJSLowerReturn() let __bjs_isSome_email = self.email != nil if let __bjs_unwrapped_email = self.email { - __bjs_unwrapped_email.bridgeJSLowerStackReturn() + __bjs_unwrapped_email.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_email ? 1 : 0) } @@ -1569,12 +1569,12 @@ public func _bjs_ArrayRoundtrip_takeNestedIntArray(_ _self: UnsafeMutableRawPoin let __count = Int(_swift_js_pop_i32()) var __result: [[Int]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([Int].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) #else fatalError("Only available on WebAssembly") #endif @@ -1586,7 +1586,8 @@ public func _bjs_ArrayRoundtrip_makeNestedIntArray(_ _self: UnsafeMutableRawPoin #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeNestedIntArray() for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -1601,14 +1602,15 @@ public func _bjs_ArrayRoundtrip_roundtripNestedIntArray(_ _self: UnsafeMutableRa let __count = Int(_swift_js_pop_i32()) var __result: [[Int]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([Int].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -1623,12 +1625,12 @@ public func _bjs_ArrayRoundtrip_takeNestedPointArray(_ _self: UnsafeMutableRawPo let __count = Int(_swift_js_pop_i32()) var __result: [[Point]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([Point].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) #else fatalError("Only available on WebAssembly") #endif @@ -1640,7 +1642,8 @@ public func _bjs_ArrayRoundtrip_makeNestedPointArray(_ _self: UnsafeMutableRawPo #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeNestedPointArray() for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -1655,14 +1658,15 @@ public func _bjs_ArrayRoundtrip_roundtripNestedPointArray(_ _self: UnsafeMutable let __count = Int(_swift_js_pop_i32()) var __result: [[Point]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([Point].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -1677,12 +1681,12 @@ public func _bjs_ArrayRoundtrip_takeOptionalIntArray(_ _self: UnsafeMutableRawPo let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) #else fatalError("Only available on WebAssembly") #endif @@ -1696,8 +1700,10 @@ public func _bjs_ArrayRoundtrip_makeOptionalIntArray(_ _self: UnsafeMutableRawPo for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -1712,17 +1718,19 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalIntArray(_ _self: UnsafeMutable let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -1737,12 +1745,12 @@ public func _bjs_ArrayRoundtrip_takeOptionalPointArray(_ _self: UnsafeMutableRaw let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) #else fatalError("Only available on WebAssembly") #endif @@ -1756,8 +1764,10 @@ public func _bjs_ArrayRoundtrip_makeOptionalPointArray(_ _self: UnsafeMutableRaw for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -1772,17 +1782,19 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalPointArray(_ _self: UnsafeMutab let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -1799,7 +1811,7 @@ public func _bjs_ArrayRoundtrip_takeOptionalArray(_ _self: UnsafeMutableRawPoint } else { return [Int].bridgeJSLiftParameter() } - }()) + }()) #else fatalError("Only available on WebAssembly") #endif @@ -1812,7 +1824,8 @@ public func _bjs_ArrayRoundtrip_makeOptionalArraySome(_ _self: UnsafeMutableRawP let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalArraySome() let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} + __bjs_unwrapped_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -1826,7 +1839,8 @@ public func _bjs_ArrayRoundtrip_makeOptionalArrayNone(_ _self: UnsafeMutableRawP let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalArrayNone() let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} + __bjs_unwrapped_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -1843,10 +1857,11 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalArray(_ _self: UnsafeMutableRaw } else { return [Int].bridgeJSLiftParameter() } - }()) + }()) let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} + __bjs_unwrapped_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift index 49f2b99bf..eefc63a7e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift @@ -4,6 +4,9 @@ import SwiftSyntaxBuilder #if canImport(BridgeJSSkeleton) import BridgeJSSkeleton #endif +#if canImport(BridgeJSUtilities) +import BridgeJSUtilities +#endif public struct ClosureCodegen { public init() {} @@ -41,9 +44,6 @@ public struct ClosureCodegen { try builder.call(returnType: signature.returnType) try builder.liftReturnValue(returnType: signature.returnType) - // Get the body code - let bodyCode = builder.getBody() - // Generate extern declaration using CallJSEmission let externDecl = builder.renderImportDecl() @@ -58,79 +58,42 @@ public struct ClosureCodegen { #endif """ - let helperEnumDecl = EnumDeclSyntax( - modifiers: DeclModifierListSyntax { - DeclModifierSyntax(name: .keyword(.private)) - }, - name: .identifier(helperName), - memberBlockBuilder: { - DeclSyntax( - FunctionDeclSyntax( - modifiers: DeclModifierListSyntax { - DeclModifierSyntax(name: .keyword(.static)) - }, - name: .identifier("bridgeJSLift"), - signature: FunctionSignatureSyntax( - parameterClause: FunctionParameterClauseSyntax { - FunctionParameterSyntax( - firstName: .wildcardToken(), - secondName: .identifier("callbackId"), - colon: .colonToken(), - type: IdentifierTypeSyntax(name: .identifier("Int32")) - ) - }, - returnClause: ReturnClauseSyntax( - arrow: .arrowToken(), - type: IdentifierTypeSyntax(name: .identifier(swiftClosureType)) - ) - ), - body: CodeBlockSyntax { - "let callback = JSObject.bridgeJSLiftParameter(callbackId)" - ReturnStmtSyntax( - expression: ClosureExprSyntax( - leftBrace: .leftBraceToken(), - signature: ClosureSignatureSyntax( - capture: ClosureCaptureClauseSyntax( - leftSquare: .leftSquareToken(), - items: ClosureCaptureListSyntax { - #if canImport(SwiftSyntax602) - ClosureCaptureSyntax( - name: .identifier("", presence: .missing), - initializer: InitializerClauseSyntax( - equal: .equalToken(presence: .missing), - nil, - value: ExprSyntax("callback") - ), - trailingTrivia: nil - ) - #else - ClosureCaptureSyntax( - expression: ExprSyntax("callback") - ) - #endif - }, - rightSquare: .rightSquareToken() - ), - parameterClause: .simpleInput( - ClosureShorthandParameterListSyntax { - for (index, _) in signature.parameters.enumerated() { - ClosureShorthandParameterSyntax(name: .identifier("param\(index)")) - } - } - ), - inKeyword: .keyword(.in) - ), - statements: CodeBlockItemListSyntax { - SwiftCodePattern.buildWasmConditionalCompilation(wasmBody: bodyCode.statements) - }, - rightBrace: .rightBraceToken() - ) - ) + let helperEnumDeclPrinter = CodeFragmentPrinter() + helperEnumDeclPrinter.write("private enum \(helperName) {") + helperEnumDeclPrinter.indent { + helperEnumDeclPrinter.write("static func bridgeJSLift(_ callbackId: Int32) -> \(swiftClosureType) {") + helperEnumDeclPrinter.indent { + helperEnumDeclPrinter.write("let callback = JSObject.bridgeJSLiftParameter(callbackId)") + let parameters: String + if signature.parameters.isEmpty { + parameters = "" + } else if signature.parameters.count == 1 { + parameters = " param0" + } else { + parameters = + " (" + + signature.parameters.enumerated().map { index, param in + "param\(index)" + }.joined(separator: ", ") + ")" + } + helperEnumDeclPrinter.write("return { [callback]\(parameters) in") + helperEnumDeclPrinter.indent { + SwiftCodePattern.buildWasmConditionalCompilation( + printer: helperEnumDeclPrinter, + wasmBody: { printer in + printer.write(lines: builder.body.lines) } ) - ) + } + helperEnumDeclPrinter.write("}") + } - ) + helperEnumDeclPrinter.write("}") + } + helperEnumDeclPrinter.write("}") + + let helperEnumDecl: DeclSyntax = "\(raw: helperEnumDeclPrinter.lines.joined(separator: "\n"))" + let typedClosureExtension: DeclSyntax = """ extension JSTypedClosure where Signature == \(raw: swiftClosureType) { init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping \(raw: swiftClosureType)) { @@ -145,7 +108,7 @@ public struct ClosureCodegen { """ return [ - externDecl, makeClosureExternDecl, DeclSyntax(helperEnumDecl), typedClosureExtension, + externDecl, makeClosureExternDecl, helperEnumDecl, typedClosureExtension, ] } @@ -199,24 +162,20 @@ public struct ClosureCodegen { returnType: abiReturnWasmType ) - // Build body - let body = CodeBlockItemListSyntax { - "let closure = Unmanaged<\(raw: boxType)>.fromOpaque(boxPtr).takeUnretainedValue().closure" + // Build function declaration using helper + let funcDecl = SwiftCodePattern.buildExposedFunctionDecl( + abiName: abiName, + signature: funcSignature + ) { printer in + printer.write("let closure = Unmanaged<\(boxType)>.fromOpaque(boxPtr).takeUnretainedValue().closure") if signature.returnType == .void { - closureCallExpr + printer.write(closureCallExpr.description) } else { - "let result = \(closureCallExpr)" - "return result.bridgeJSLowerReturn()" + printer.write("let result = \(closureCallExpr)") + printer.write("return result.bridgeJSLowerReturn()") } } - // Build function declaration using helper - let funcDecl = SwiftCodePattern.buildExposedFunctionDecl( - abiName: abiName, - signature: funcSignature, - body: body - ) - return DeclSyntax(funcDecl) } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 913bc076b..2d31cd212 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -91,8 +91,7 @@ public class ExportSwift { } } return withSpan("Format Export Glue") { - let format = BasicFormat() - return decls.map { $0.formatted(using: format).description }.joined(separator: "\n\n") + return decls.map { $0.description }.joined(separator: "\n\n") } } @@ -423,9 +422,10 @@ public class ExportSwift { // Build function declaration using helper function let funcDecl = SwiftCodePattern.buildExposedFunctionDecl( abiName: abiName, - signature: signature, - body: body - ) + signature: signature + ) { printer in + printer.write(multilineString: body.description) + } return DeclSyntax(funcDecl) } @@ -715,11 +715,10 @@ public class ExportSwift { signature: SwiftSignatureBuilder.buildABIFunctionSignature( abiParameters: [("pointer", .pointer)], returnType: nil - ), - body: CodeBlockItemListSyntax { - "Unmanaged<\(raw: klass.swiftCallName)>.fromOpaque(pointer).release()" - } - ) + ) + ) { printer in + printer.write("Unmanaged<\(klass.swiftCallName)>.fromOpaque(pointer).release()") + } decls.append(DeclSyntax(funcDecl)) } @@ -763,34 +762,29 @@ public class ExportSwift { returnType: .i32 ) - // Build extern function declaration (no body) - let externFuncDecl = SwiftCodePattern.buildExternFunctionDecl( - moduleName: moduleName, - abiName: externFunctionName, - functionName: wrapFunctionName, - signature: funcSignature - ) - - // Build stub function declaration (with fatalError body) - let stubFuncDecl = FunctionDeclSyntax( - modifiers: DeclModifierListSyntax { - DeclModifierSyntax(name: .keyword(.fileprivate)) + let externDeclPrinter = CodeFragmentPrinter() + SwiftCodePattern.buildWasmConditionalCompilationDecls( + printer: externDeclPrinter, + wasmDecl: { printer in + SwiftCodePattern.buildExternFunctionDecl( + printer: printer, + moduleName: moduleName, + abiName: externFunctionName, + functionName: wrapFunctionName, + signature: funcSignature + ) }, - funcKeyword: .keyword(.func), - name: .identifier(wrapFunctionName), - signature: funcSignature, - body: CodeBlockSyntax { - "fatalError(\"Only available on WebAssembly\")" + elseDecl: { printer in + printer.write( + multilineString: """ + fileprivate func \(wrapFunctionName)\(funcSignature) { + fatalError("Only available on WebAssembly") + } + """ + ) } ) - - // Use helper function for conditional compilation - let externDecl = DeclSyntax( - SwiftCodePattern.buildWasmConditionalCompilationDecls( - wasmDecl: DeclSyntax(externFuncDecl), - elseDecl: DeclSyntax(stubFuncDecl) - ) - ) + let externDecl: DeclSyntax = "\(raw: externDeclPrinter.lines.joined(separator: "\n"))" return [extensionDecl, externDecl] } } @@ -1035,9 +1029,9 @@ struct StackCodegen { accessor: String, varPrefix: String ) -> [CodeBlockItemSyntax] { - var statements: [CodeBlockItemSyntax] = [] + var statements: [String] = [] let elementVarName = "__bjs_elem_\(varPrefix)" - statements.append("for \(raw: elementVarName) in \(raw: accessor) {") + statements.append("for \(elementVarName) in \(accessor) {") let elementStatements = lowerStatements( for: elementType, @@ -1045,12 +1039,13 @@ struct StackCodegen { varPrefix: "\(varPrefix)_elem" ) for stmt in elementStatements { - statements.append(stmt) + statements.append(stmt.description) } statements.append("}") - statements.append("_swift_js_push_i32(Int32(\(raw: accessor).count))") - return statements + statements.append("_swift_js_push_i32(Int32(\(accessor).count))") + let parsed: CodeBlockItemListSyntax = "\(raw: statements.joined(separator: "\n"))" + return Array(parsed) } private func lowerDictionaryStatements( @@ -1117,9 +1112,9 @@ struct StackCodegen { accessor: String, varPrefix: String ) -> [CodeBlockItemSyntax] { - var statements: [CodeBlockItemSyntax] = [] - statements.append("let __bjs_isSome_\(raw: varPrefix) = \(raw: accessor) != nil") - statements.append("if let __bjs_unwrapped_\(raw: varPrefix) = \(raw: accessor) {") + var statements: [String] = [] + statements.append("let __bjs_isSome_\(varPrefix) = \(accessor) != nil") + statements.append("if let __bjs_unwrapped_\(varPrefix) = \(accessor) {") let innerStatements = lowerUnwrappedOptionalStatements( wrappedType: wrappedType, @@ -1127,12 +1122,13 @@ struct StackCodegen { varPrefix: varPrefix ) for stmt in innerStatements { - statements.append(stmt) + statements.append(stmt.description) } statements.append("}") - statements.append("_swift_js_push_i32(__bjs_isSome_\(raw: varPrefix) ? 1 : 0)") - return statements + statements.append("_swift_js_push_i32(__bjs_isSome_\(varPrefix) ? 1 : 0)") + let parsed: CodeBlockItemListSyntax = "\(raw: statements.joined(separator: "\n"))" + return Array(parsed) } private func lowerUnwrappedOptionalStatements( @@ -1186,104 +1182,151 @@ struct EnumCodegen { } private func renderCaseEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { - let typeName = enumDef.swiftCallName - var initCases: [String] = [] - var valueCases: [String] = [] - for (index, enumCase) in enumDef.cases.enumerated() { - initCases.append("case \(index): self = .\(enumCase.name)") - valueCases.append("case .\(enumCase.name): return \(index)") - } - let initSwitch = (["switch bridgeJSRawValue {"] + initCases + ["default: return nil", "}"]).joined( - separator: "\n" - ) - let valueSwitch = (["switch self {"] + valueCases + ["}"]).joined(separator: "\n") + let printer = CodeFragmentPrinter() + printer.write("extension \(enumDef.swiftCallName): _BridgedSwiftCaseEnum {") + printer.indent { + printer.write( + multilineString: """ + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> \(enumDef.swiftCallName) { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> \(enumDef.swiftCallName) { + return \(enumDef.swiftCallName)(bridgeJSRawValue: value)! + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { + return bridgeJSLowerParameter() + } - return """ - extension \(raw: typeName): _BridgedSwiftCaseEnum { - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - return bridgeJSRawValue - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> \(raw: typeName) { - return bridgeJSLiftParameter(value) - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> \(raw: typeName) { - return \(raw: typeName)(bridgeJSRawValue: value)! - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSLowerParameter() + """ + ) + printer.nextLine() + + printer.write("private init?(bridgeJSRawValue: Int32) {") + printer.indent { + printer.write("switch bridgeJSRawValue {") + for (index, enumCase) in enumDef.cases.enumerated() { + printer.write("case \(index):") + printer.indent { + printer.write("self = .\(enumCase.name)") + } } - - private init?(bridgeJSRawValue: Int32) { - \(raw: initSwitch) + printer.write("default:") + printer.indent { + printer.write("return nil") } - - private var bridgeJSRawValue: Int32 { - \(raw: valueSwitch) + printer.write("}") + } + printer.write("}") + printer.nextLine() + + printer.write("private var bridgeJSRawValue: Int32 {") + printer.indent { + printer.write("switch self {") + for (index, enumCase) in enumDef.cases.enumerated() { + printer.write("case .\(enumCase.name):") + printer.indent { + printer.write("return \(index)") + } } + printer.write("}") } - """ + printer.write("}") + } + printer.write("}") + return "\(raw: printer.lines.joined(separator: "\n"))" } private func renderRawValueEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { let typeName = enumDef.swiftCallName guard enumDef.rawType != nil else { return """ - extension \(raw: typeName): _BridgedSwiftEnumNoPayload {} + extension \(raw: typeName): _BridgedSwiftEnumNoPayload { + } """ } // When rawType is present, conform to _BridgedSwiftRawValueEnum which provides // default implementations for _BridgedSwiftStackType methods via protocol extension. return """ - extension \(raw: typeName): _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} + extension \(raw: typeName): _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { + } """ } private func renderAssociatedValueEnumHelpers(_ enumDef: ExportedEnum) -> DeclSyntax { let typeName = enumDef.swiftCallName - return """ - extension \(raw: typeName): _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> \(raw: typeName) { - switch caseId { - \(raw: generateStackLiftSwitchCases(enumDef: enumDef).joined(separator: "\n")) - default: fatalError("Unknown \(raw: typeName) case ID: \\(caseId)") - } + let printer = CodeFragmentPrinter() + printer.write("extension \(typeName): _BridgedSwiftAssociatedValueEnum {") + printer.indent { + printer.write("private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> \(typeName) {") + printer.indent { + printer.write("switch caseId {") + generateStackLiftSwitchCases(printer: printer, enumDef: enumDef) + printer.write("default:") + printer.indent { + printer.write("fatalError(\"Unknown \(typeName) case ID: \\(caseId)\")") } + printer.write("}") + } + printer.write("}") + printer.nextLine() - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - switch self { - \(raw: generateLowerParameterSwitchCases(enumDef: enumDef).joined(separator: "\n")) - } - } + printer.write("// MARK: Protocol Export") + printer.nextLine() - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> \(raw: typeName) { - return _bridgeJSLiftFromCaseId(caseId) - } + printer.write("@_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 {") + printer.indent { + printer.write("switch self {") + generateLowerParameterSwitchCases(printer: printer, enumDef: enumDef) + printer.write("}") + } + printer.write("}") + printer.nextLine() - // MARK: ExportSwift + printer.write( + multilineString: """ + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> \(typeName) { + return _bridgeJSLiftFromCaseId(caseId) + } + """ + ) + printer.nextLine() - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> \(raw: typeName) { - return _bridgeJSLiftFromCaseId(caseId) - } + printer.write("// MARK: ExportSwift") + printer.nextLine() - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - \(raw: generateReturnSwitchCases(enumDef: enumDef).joined(separator: "\n")) + printer.write( + multilineString: """ + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> \(typeName) { + return _bridgeJSLiftFromCaseId(caseId) } - } + """ + ) + printer.nextLine() + + printer.write("@_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() {") + printer.indent { + printer.write("switch self {") + generateReturnSwitchCases(printer: printer, enumDef: enumDef) + printer.write("}") } - """ + printer.write("}") + } + printer.write("}") + return "\(raw: printer.lines.joined(separator: "\n"))" } - private func generateStackLiftSwitchCases(enumDef: ExportedEnum) -> [String] { - var cases: [String] = [] + private func generateStackLiftSwitchCases(printer: CodeFragmentPrinter, enumDef: ExportedEnum) { for (caseIndex, enumCase) in enumDef.cases.enumerated() { if enumCase.associatedValues.isEmpty { - cases.append("case \(caseIndex): return .\(enumCase.name)") + printer.write("case \(caseIndex):") + printer.indent { + printer.write("return .\(enumCase.name)") + } } else { - var lines: [String] = [] - lines.append("case \(caseIndex):") + printer.write("case \(caseIndex):") let argList = enumCase.associatedValues.map { associatedValue in let labelPrefix: String if let label = associatedValue.label { @@ -1294,17 +1337,17 @@ struct EnumCodegen { let liftExpr = stackCodegen.liftExpression(for: associatedValue.type) return "\(labelPrefix)\(liftExpr)" } - lines.append("return .\(enumCase.name)(\(argList.joined(separator: ", ")))") - cases.append(lines.joined(separator: "\n")) + printer.indent { + printer.write("return .\(enumCase.name)(\(argList.joined(separator: ", ")))") + } } } - return cases } private func generatePayloadPushingCode( + printer: CodeFragmentPrinter, associatedValues: [AssociatedValue] - ) -> [String] { - var bodyLines: [String] = [] + ) { for (index, associatedValue) in associatedValues.enumerated() { let paramName = associatedValue.label ?? "param\(index)" let statements = stackCodegen.lowerStatements( @@ -1312,51 +1355,50 @@ struct EnumCodegen { accessor: paramName, varPrefix: paramName ) - for stmt in statements { - bodyLines.append(stmt.description) - } + printer.write(multilineString: CodeBlockItemListSyntax(statements).description) } - return bodyLines } - private func generateLowerParameterSwitchCases(enumDef: ExportedEnum) -> [String] { - var cases: [String] = [] + private func generateLowerParameterSwitchCases(printer: CodeFragmentPrinter, enumDef: ExportedEnum) { for (caseIndex, enumCase) in enumDef.cases.enumerated() { if enumCase.associatedValues.isEmpty { - cases.append("case .\(enumCase.name):") - cases.append("return Int32(\(caseIndex))") + printer.write("case .\(enumCase.name):") + printer.indent { + printer.write("return Int32(\(caseIndex))") + } } else { - let payloadCode = generatePayloadPushingCode(associatedValues: enumCase.associatedValues) let pattern = enumCase.associatedValues.enumerated() .map { index, associatedValue in "let \(associatedValue.label ?? "param\(index)")" } .joined(separator: ", ") - cases.append("case .\(enumCase.name)(\(pattern)):") - cases.append(contentsOf: payloadCode) - cases.append("return Int32(\(caseIndex))") + printer.write("case .\(enumCase.name)(\(pattern)):") + printer.indent { + generatePayloadPushingCode(printer: printer, associatedValues: enumCase.associatedValues) + printer.write("return Int32(\(caseIndex))") + } } } - return cases } - private func generateReturnSwitchCases(enumDef: ExportedEnum) -> [String] { - var cases: [String] = [] + private func generateReturnSwitchCases(printer: CodeFragmentPrinter, enumDef: ExportedEnum) { for (caseIndex, enumCase) in enumDef.cases.enumerated() { if enumCase.associatedValues.isEmpty { - cases.append("case .\(enumCase.name):") - cases.append("_swift_js_push_tag(Int32(\(caseIndex)))") + printer.write("case .\(enumCase.name):") + printer.indent { + printer.write("_swift_js_push_tag(Int32(\(caseIndex)))") + } } else { let pattern = enumCase.associatedValues.enumerated() .map { index, associatedValue in "let \(associatedValue.label ?? "param\(index)")" } .joined(separator: ", ") - cases.append("case .\(enumCase.name)(\(pattern)):") - let payloadCode = generatePayloadPushingCode(associatedValues: enumCase.associatedValues) - cases.append(contentsOf: payloadCode) - // Push tag AFTER payloads so it's popped first (LIFO) by the JS lift function. - // This ensures nested enum tags don't overwrite the outer tag. - cases.append("_swift_js_push_tag(Int32(\(caseIndex)))") + printer.write("case .\(enumCase.name)(\(pattern)):") + printer.indent { + generatePayloadPushingCode(printer: printer, associatedValues: enumCase.associatedValues) + // Push tag AFTER payloads so it's popped first (LIFO) by the JS lift function. + // This ensures nested enum tags don't overwrite the outer tag. + printer.write("_swift_js_push_tag(Int32(\(caseIndex)))") + } } } - return cases } } @@ -1367,40 +1409,60 @@ struct StructCodegen { func renderStructHelpers(_ structDef: ExportedStruct) -> [DeclSyntax] { let typeName = structDef.swiftCallName - let liftCode = generateStructLiftCode(structDef: structDef) - let lowerCode = generateStructLowerCode(structDef: structDef) - let accessControl = structDef.explicitAccessControl.map { "\($0) " } ?? "" let lowerExternName = "swift_js_struct_lower_\(structDef.name)" let liftExternName = "swift_js_struct_lift_\(structDef.name)" let lowerFunctionName = "_bjs_struct_lower_\(structDef.name)" let liftFunctionName = "_bjs_struct_lift_\(structDef.name)" - let bridgedStructExtension: DeclSyntax = """ - extension \(raw: typeName): _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> \(raw: typeName) { - \(raw: liftCode.joined(separator: "\n")) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - \(raw: lowerCode.joined(separator: "\n")) - } - - \(raw: accessControl)init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = \(raw: lowerFunctionName)(jsObject.bridgeJSLowerParameter()) - defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() - } + let printer = CodeFragmentPrinter() + printer.write("extension \(typeName): _BridgedSwiftStruct {") + printer.indent { + printer.write("@_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> \(typeName) {") + printer.indent { + printer.write(lines: generateStructLiftCode(structDef: structDef)) + } + printer.write("}") + printer.nextLine() - \(raw: accessControl)func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() - return JSObject(id: UInt32(bitPattern: \(raw: liftFunctionName)())) - } + printer.write("@_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() {") + printer.indent { + printer.write(lines: generateStructLowerCode(structDef: structDef)) } - """ + printer.write("}") + printer.nextLine() + + let accessControl = structDef.explicitAccessControl.map { "\($0) " } ?? "" + printer.write( + multilineString: """ + \(accessControl)init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = \(lowerFunctionName)(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + """ + ) + printer.nextLine() + + printer.write( + multilineString: """ + \(accessControl)func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + return JSObject(id: UInt32(bitPattern: \(liftFunctionName)())) + } + """ + ) + } + printer.write("}") - let lowerExternDecl = Self.renderStructExtern( + let bridgedStructExtension: DeclSyntax = "\(raw: printer.lines.joined(separator: "\n"))" + + let lowerExternDeclPrinter = CodeFragmentPrinter() + Self.renderStructExtern( + printer: lowerExternDeclPrinter, externName: lowerExternName, functionName: lowerFunctionName, signature: SwiftSignatureBuilder.buildABIFunctionSignature( @@ -1408,7 +1470,9 @@ struct StructCodegen { returnType: .i32 ) ) - let liftExternDecl = Self.renderStructExtern( + let liftExternDeclPrinter = CodeFragmentPrinter() + Self.renderStructExtern( + printer: liftExternDeclPrinter, externName: liftExternName, functionName: liftFunctionName, signature: SwiftSignatureBuilder.buildABIFunctionSignature( @@ -1417,39 +1481,39 @@ struct StructCodegen { ) ) - return [bridgedStructExtension, lowerExternDecl, liftExternDecl] + return [ + bridgedStructExtension, "\(raw: lowerExternDeclPrinter.lines.joined(separator: "\n"))", + "\(raw: liftExternDeclPrinter.lines.joined(separator: "\n"))", + ] } private static func renderStructExtern( + printer: CodeFragmentPrinter, externName: String, functionName: String, - signature: FunctionSignatureSyntax - ) -> DeclSyntax { - let externFuncDecl = SwiftCodePattern.buildExternFunctionDecl( - moduleName: "bjs", - abiName: externName, - functionName: functionName, - signature: signature - ) - - let stubFuncDecl = FunctionDeclSyntax( - modifiers: DeclModifierListSyntax { - DeclModifierSyntax(name: .keyword(.fileprivate)) + signature: String + ) { + SwiftCodePattern.buildWasmConditionalCompilationDecls( + printer: printer, + wasmDecl: { printer in + SwiftCodePattern.buildExternFunctionDecl( + printer: printer, + moduleName: "bjs", + abiName: externName, + functionName: functionName, + signature: signature + ) }, - funcKeyword: .keyword(.func), - name: .identifier(functionName), - signature: signature, - body: CodeBlockSyntax { - "fatalError(\"Only available on WebAssembly\")" + elseDecl: { printer in + printer.write( + multilineString: """ + fileprivate func \(functionName)\(signature) { + fatalError("Only available on WebAssembly") + } + """ + ) } ) - - return DeclSyntax( - SwiftCodePattern.buildWasmConditionalCompilationDecls( - wasmDecl: DeclSyntax(externFuncDecl), - elseDecl: DeclSyntax(stubFuncDecl) - ) - ) } private func generateStructLiftCode(structDef: ExportedStruct) -> [String] { @@ -1469,7 +1533,7 @@ struct StructCodegen { } private func generateStructLowerCode(structDef: ExportedStruct) -> [String] { - var lines: [String] = [] + let printer = CodeFragmentPrinter() let instanceProps = structDef.properties.filter { !$0.isStatic } for property in instanceProps { @@ -1479,12 +1543,10 @@ struct StructCodegen { accessor: accessor, varPrefix: property.name ) - for stmt in statements { - lines.append(stmt.description) - } + printer.write(multilineString: CodeBlockItemListSyntax(statements).description) } - return lines + return printer.lines } } @@ -1495,7 +1557,7 @@ struct ProtocolCodegen { let wrapperName = "Any\(proto.name)" let protocolName = proto.name - var methodDecls: [DeclSyntax] = [] + var methodDecls: [CodeFragmentPrinter] = [] var externDecls: [DeclSyntax] = [] for method in proto.methods { @@ -1523,72 +1585,72 @@ struct ProtocolCodegen { abiParameters: builder.abiParameterSignatures, returnType: builder.abiReturnType ) - let externFuncDecl = SwiftCodePattern.buildExternFunctionDecl( + let externDeclPrinter = CodeFragmentPrinter() + SwiftCodePattern.buildExternFunctionDecl( + printer: externDeclPrinter, moduleName: moduleName, abiName: method.abiName, functionName: "_extern_\(method.name)", signature: externSignature ) - externDecls.append(DeclSyntax(externFuncDecl)) - let methodImplementation = DeclSyntax( - FunctionDeclSyntax( - name: .identifier(method.name), - signature: signature, - body: builder.getBody() - ) - ) - - methodDecls.append(methodImplementation) + externDecls.append(DeclSyntax("\(raw: externDeclPrinter.lines.joined(separator: "\n"))")) + let methodImplPrinter = CodeFragmentPrinter() + methodImplPrinter.write("func \(method.name)\(signature) {") + methodImplPrinter.indent { + methodImplPrinter.write(lines: builder.body.lines) + } + methodImplPrinter.write("}") + methodDecls.append(methodImplPrinter) } - var propertyDecls: [DeclSyntax] = [] + var propertyDecls: [CodeFragmentPrinter] = [] for property in proto.properties { - let (propertyImpl, propertyExternDecls) = try renderProtocolProperty( + let propertyDeclPrinter = CodeFragmentPrinter() + let propertyExternDecls = try renderProtocolProperty( + printer: propertyDeclPrinter, property: property, protocolName: protocolName, moduleName: moduleName ) - propertyDecls.append(propertyImpl) + propertyDecls.append(propertyDeclPrinter) externDecls.append(contentsOf: propertyExternDecls) } - let structDecl = StructDeclSyntax( - name: .identifier(wrapperName), - inheritanceClause: InheritanceClauseSyntax( - inheritedTypesBuilder: { - InheritedTypeSyntax(type: IdentifierTypeSyntax(name: .identifier(protocolName))) - InheritedTypeSyntax(type: IdentifierTypeSyntax(name: .identifier("_BridgedSwiftProtocolWrapper"))) - } - ), - memberBlockBuilder: { - DeclSyntax( - """ - let jsObject: JSObject - """ - ).with(\.trailingTrivia, .newlines(2)) + let structDeclPrinter = CodeFragmentPrinter() + structDeclPrinter.write("struct \(wrapperName): \(protocolName), _BridgedSwiftProtocolWrapper {") + structDeclPrinter.indent { + structDeclPrinter.write("let jsObject: JSObject") + structDeclPrinter.nextLine() - for decl in methodDecls + propertyDecls { - decl.with(\.trailingTrivia, .newlines(2)) - } + for methodDecl in methodDecls { + structDeclPrinter.write(lines: methodDecl.lines) + structDeclPrinter.nextLine() + } - DeclSyntax( - """ + for decl in propertyDecls { + structDeclPrinter.write(lines: decl.lines) + structDeclPrinter.nextLine() + } + structDeclPrinter.write( + multilineString: """ static func bridgeJSLiftParameter(_ value: Int32) -> Self { - return \(raw: wrapperName)(jsObject: JSObject(id: UInt32(bitPattern: value))) + return \(wrapperName)(jsObject: JSObject(id: UInt32(bitPattern: value))) } """ - ) - } - ) - return [DeclSyntax(structDecl)] + externDecls + ) + } + structDeclPrinter.write("}") + + return ["\(raw: structDeclPrinter.lines.joined(separator: "\n"))"] + externDecls } private func renderProtocolProperty( + printer: CodeFragmentPrinter, property: ExportedProtocolProperty, protocolName: String, moduleName: String - ) throws -> (propertyDecl: DeclSyntax, externDecls: [DeclSyntax]) { + ) throws -> [DeclSyntax] { let getterAbiName = ABINameGenerator.generateABIName( baseName: property.name, operation: "get", @@ -1614,37 +1676,27 @@ struct ProtocolCodegen { abiParameters: getterBuilder.abiParameterSignatures, returnType: getterBuilder.abiReturnType ) - let getterExternDecl = SwiftCodePattern.buildExternFunctionDecl( + let getterExternDeclPrinter = CodeFragmentPrinter() + SwiftCodePattern.buildExternFunctionDecl( + printer: getterExternDeclPrinter, moduleName: moduleName, abiName: getterAbiName, functionName: getterAbiName, signature: getterExternSignature ) + let getterExternDecl = DeclSyntax("\(raw: getterExternDeclPrinter.lines.joined(separator: "\n"))") + var externDecls: [DeclSyntax] = [getterExternDecl] + + printer.write("var \(property.name): \(property.type.swiftType) {") + try printer.indent { + printer.write("get {") + printer.indent { + printer.write(lines: getterBuilder.body.lines) + } + printer.write("}") + + if property.isReadonly { return } - if property.isReadonly { - let propertyDecl = VariableDeclSyntax( - bindingSpecifier: .keyword(.var), - bindings: PatternBindingListSyntax { - PatternBindingSyntax( - pattern: IdentifierPatternSyntax(identifier: .identifier(property.name)), - typeAnnotation: TypeAnnotationSyntax( - type: IdentifierTypeSyntax(name: .identifier(property.type.swiftType)) - ), - accessorBlock: AccessorBlockSyntax( - accessors: .accessors( - AccessorDeclListSyntax { - AccessorDeclSyntax( - accessorSpecifier: .keyword(.get), - body: getterBuilder.getBody() - ) - } - ) - ) - ) - } - ) - return (DeclSyntax(propertyDecl), [DeclSyntax(getterExternDecl)]) - } else { let setterBuilder = ImportTS.CallJSEmission( moduleName: moduleName, abiName: setterAbiName, @@ -1659,40 +1711,26 @@ struct ProtocolCodegen { abiParameters: setterBuilder.abiParameterSignatures, returnType: setterBuilder.abiReturnType ) - let setterExternDecl = SwiftCodePattern.buildExternFunctionDecl( + let setterExternDeclPrinter = CodeFragmentPrinter() + SwiftCodePattern.buildExternFunctionDecl( + printer: setterExternDeclPrinter, moduleName: moduleName, abiName: setterAbiName, functionName: setterAbiName, signature: setterExternSignature ) + let setterExternDecl = DeclSyntax("\(raw: setterExternDeclPrinter.lines.joined(separator: "\n"))") + externDecls.append(setterExternDecl) - let propertyDecl = VariableDeclSyntax( - bindingSpecifier: .keyword(.var), - bindings: PatternBindingListSyntax { - PatternBindingSyntax( - pattern: IdentifierPatternSyntax(identifier: .identifier(property.name)), - typeAnnotation: TypeAnnotationSyntax( - type: IdentifierTypeSyntax(name: .identifier(property.type.swiftType)) - ), - accessorBlock: AccessorBlockSyntax( - accessors: .accessors( - AccessorDeclListSyntax { - AccessorDeclSyntax( - accessorSpecifier: .keyword(.get), - body: getterBuilder.getBody() - ) - AccessorDeclSyntax( - accessorSpecifier: .keyword(.set), - body: setterBuilder.getBody() - ) - } - ) - ) - ) - } - ) - return (DeclSyntax(propertyDecl), [DeclSyntax(getterExternDecl), DeclSyntax(setterExternDecl)]) + printer.write("set {") + printer.indent { + printer.write(lines: setterBuilder.body.lines) + } + printer.write("}") } + printer.write("}") + + return externDecls } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index d5cc945ee..8eead20b7 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -85,16 +85,16 @@ public struct ImportTS { let moduleName: String let context: BridgeContext - var body: [CodeBlockItemSyntax] = [] - var abiParameterForwardings: [LabeledExprSyntax] = [] + var body = CodeFragmentPrinter() + var abiParameterForwardings: [String] = [] var abiParameterSignatures: [(name: String, type: WasmCoreType)] = [] var abiReturnType: WasmCoreType? // Track destructured variable names for multiple lowered parameters var destructuredVarNames: [String] = [] // Stack-lowered parameters should be evaluated in reverse order to match LIFO stacks - var stackLoweringStmts: [CodeBlockItemSyntax] = [] + var stackLoweringStmts: [String] = [] // Values to extend lifetime during call - var valuesToExtendLifetimeDuringCall: [ExprSyntax] = [] + var valuesToExtendLifetimeDuringCall: [String] = [] init(moduleName: String, abiName: String, context: BridgeContext = .importTS) { self.moduleName = moduleName @@ -108,34 +108,17 @@ public struct ImportTS { switch param.type { case .closure(let signature, useJSTypedClosure: false): let jsTypedClosureType = BridgeType.closure(signature, useJSTypedClosure: true).swiftType - body.append("let \(raw: param.name) = \(raw: jsTypedClosureType)(\(raw: param.name))") + body.write("let \(param.name) = \(jsTypedClosureType)(\(param.name))") // The just created JSObject is not owned by the caller unlike those passed in parameters, // so we need to extend its lifetime during the call to ensure the JSObject.id is valid. - valuesToExtendLifetimeDuringCall.append("\(raw: param.name)") + valuesToExtendLifetimeDuringCall.append(param.name) default: break } let initializerExpr = ExprSyntax("\(raw: param.name).bridgeJSLowerParameter()") if loweringInfo.loweredParameters.isEmpty { - let stmt = CodeBlockItemSyntax( - item: .decl( - DeclSyntax( - VariableDeclSyntax( - bindingSpecifier: .keyword(.let), - bindings: PatternBindingListSyntax { - PatternBindingSyntax( - pattern: PatternSyntax( - IdentifierPatternSyntax(identifier: .wildcardToken()) - ), - initializer: InitializerClauseSyntax(value: initializerExpr) - ) - } - ) - ) - ) - ) - stackLoweringStmts.insert(stmt, at: 0) + stackLoweringStmts.insert("let _ = \(initializerExpr)", at: 0) return } @@ -145,40 +128,14 @@ public struct ImportTS { } // Always add destructuring statement to body (unified for single and multiple) - let pattern: PatternSyntax + let pattern: String if destructuredNames.count == 1 { - pattern = PatternSyntax(IdentifierPatternSyntax(identifier: .identifier(destructuredNames[0]))) + pattern = destructuredNames[0] } else { - pattern = PatternSyntax( - TuplePatternSyntax { - for name in destructuredNames { - TuplePatternElementSyntax( - pattern: IdentifierPatternSyntax(identifier: .identifier(name)) - ) - } - } - ) + pattern = "(" + destructuredNames.joined(separator: ", ") + ")" } - body.append( - CodeBlockItemSyntax( - item: .decl( - DeclSyntax( - VariableDeclSyntax( - bindingSpecifier: .keyword(.let), - bindings: PatternBindingListSyntax { - PatternBindingSyntax( - pattern: pattern, - initializer: InitializerClauseSyntax( - value: initializerExpr - ) - ) - } - ) - ) - ) - ) - ) + body.write("let \(pattern) = \(initializerExpr)") destructuredVarNames.append(contentsOf: destructuredNames) // Add to signatures and forwardings (unified for both single and multiple) @@ -194,63 +151,36 @@ public struct ImportTS { // Always use destructured variable in call without labels // Swift allows omitting labels when they match parameter names - let callExpr = ExprSyntax("\(raw: destructuredNames[index])") - abiParameterForwardings.append( - LabeledExprSyntax(expression: callExpr) - ) + abiParameterForwardings.append(destructuredNames[index]) } } func call(returnType: BridgeType) throws { - let liftingInfo = try returnType.liftingReturnInfo(context: context) - body.append(contentsOf: stackLoweringStmts) - - var callExpr = FunctionCallExprSyntax( - calledExpression: ExprSyntax("\(raw: abiName)"), - leftParen: .leftParenToken(), - arguments: LabeledExprListSyntax { - for forwarding in abiParameterForwardings { - forwarding - } - }, - rightParen: .rightParenToken() - ) + let liftingInfo: BridgeType.LiftingReturnInfo = try returnType.liftingReturnInfo(context: context) + for stmt in stackLoweringStmts { + body.write(stmt.description) + } + + let assign = + (returnType == .void || returnType.usesSideChannelForOptionalReturn() || liftingInfo.valueToLift == nil) + ? "" : "let ret = " + let callExpr = "\(abiName)(\(abiParameterForwardings.joined(separator: ", ")))" if !valuesToExtendLifetimeDuringCall.isEmpty { - callExpr = FunctionCallExprSyntax( - calledExpression: ExprSyntax("withExtendedLifetime"), - leftParen: .leftParenToken(), - arguments: LabeledExprListSyntax { - LabeledExprSyntax( - expression: TupleExprSyntax( - elements: LabeledExprListSyntax { - for value in valuesToExtendLifetimeDuringCall { - LabeledExprSyntax(expression: value) - } - } - ) - ) - }, - rightParen: .rightParenToken(), - trailingClosure: ClosureExprSyntax( - leftBrace: .leftBraceToken(), - statements: CodeBlockItemListSyntax { - CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr)))) - }, - rightBrace: .rightBraceToken() - ) + body.write( + "\(assign)withExtendedLifetime((\(valuesToExtendLifetimeDuringCall.joined(separator: ", ")))) {" ) - } - - if returnType == .void || returnType.usesSideChannelForOptionalReturn() || liftingInfo.valueToLift == nil { - body.append(CodeBlockItemSyntax(item: .stmt(StmtSyntax(ExpressionStmtSyntax(expression: callExpr))))) + body.indent { + body.write(callExpr) + } + body.write("}") } else { - body.append("let ret = \(raw: callExpr)") + body.write("\(assign)\(callExpr)") } // Add exception check for ImportTS context if context == .importTS { - body.append("if let error = _swift_js_take_exception() { throw error }") + body.write("if let error = _swift_js_take_exception() { throw error }") } } @@ -265,54 +195,30 @@ public struct ImportTS { if returnType.usesSideChannelForOptionalReturn() { // Side channel returns: extern function returns Void, value is retrieved via side channel abiReturnType = nil - body.append( - CodeBlockItemSyntax( - item: .stmt( - StmtSyntax( - ReturnStmtSyntax( - expression: ExprSyntax( - "\(raw: returnType.swiftType).bridgeJSLiftReturnFromSideChannel()" - ) - ) - ) - ) - ) - ) + body.write("return \(returnType.swiftType).bridgeJSLiftReturnFromSideChannel()") } else { abiReturnType = liftingInfo.valueToLift - let liftExpr: ExprSyntax + let liftExpr: String switch returnType { case .closure(let signature, _): - liftExpr = ExprSyntax("_BJS_Closure_\(raw: signature.mangleName).bridgeJSLift(ret)") + liftExpr = "_BJS_Closure_\(signature.mangleName).bridgeJSLift(ret)" default: if liftingInfo.valueToLift != nil { - liftExpr = "\(raw: returnType.swiftType).bridgeJSLiftReturn(ret)" + liftExpr = "\(returnType.swiftType).bridgeJSLiftReturn(ret)" } else { - liftExpr = "\(raw: returnType.swiftType).bridgeJSLiftReturn()" + liftExpr = "\(returnType.swiftType).bridgeJSLiftReturn()" } } - body.append( - CodeBlockItemSyntax( - item: .stmt( - StmtSyntax( - ReturnStmtSyntax(expression: liftExpr) - ) - ) - ) - ) + body.write("return \(liftExpr)") } } - func getBody() -> CodeBlockSyntax { - return CodeBlockSyntax(statements: CodeBlockItemListSyntax(body)) - } - func assignThis(returnType: BridgeType) { guard case .jsObject = returnType else { preconditionFailure("assignThis can only be called with a jsObject return type") } abiReturnType = .i32 - body.append("self.jsObject = JSObject(id: UInt32(bitPattern: ret))") + body.write("self.jsObject = JSObject(id: UInt32(bitPattern: ret))") } func renderImportDecl() -> DeclSyntax { @@ -321,40 +227,33 @@ public struct ImportTS { returnType: abiReturnType ) - // Build extern function declaration (no body) - let externFuncDecl = FunctionDeclSyntax( - attributes: SwiftCodePattern.buildExternAttribute(moduleName: moduleName, abiName: abiName), - modifiers: DeclModifierListSyntax { - DeclModifierSyntax(name: .keyword(.fileprivate)).with(\.trailingTrivia, .space) - }, - funcKeyword: .keyword(.func).with(\.trailingTrivia, .space), - name: .identifier(abiName), - signature: signature - ) - - // Build stub function declaration (with fatalError body) - let stubFuncDecl = FunctionDeclSyntax( - modifiers: DeclModifierListSyntax { - DeclModifierSyntax(name: .keyword(.fileprivate)).with(\.trailingTrivia, .space) + let printer = CodeFragmentPrinter() + SwiftCodePattern.buildWasmConditionalCompilationDecls( + printer: printer, + wasmDecl: { printer in + SwiftCodePattern.buildExternFunctionDecl( + printer: printer, + moduleName: moduleName, + abiName: abiName, + functionName: abiName, + signature: signature + ) }, - funcKeyword: .keyword(.func).with(\.trailingTrivia, .space), - name: .identifier(abiName), - signature: signature, - body: CodeBlockSyntax { - "fatalError(\"Only available on WebAssembly\")" + elseDecl: { printer in + printer.write( + multilineString: """ + fileprivate func \(abiName)\(signature) { + fatalError("Only available on WebAssembly") + } + """ + ) } ) - - // Use conditional compilation helper - return DeclSyntax( - SwiftCodePattern.buildWasmConditionalCompilationDecls( - wasmDecl: DeclSyntax(externFuncDecl), - elseDecl: DeclSyntax(stubFuncDecl) - ) - ) + return "\(raw: printer.lines.joined(separator: "\n"))" } func renderThunkDecl(name: String, parameters: [Parameter], returnType: BridgeType) -> DeclSyntax { + let printer = CodeFragmentPrinter() let effects = Effects(isAsync: false, isThrows: true) let signature = SwiftSignatureBuilder.buildFunctionSignature( parameters: parameters, @@ -362,35 +261,28 @@ public struct ImportTS { effects: effects, useWildcardLabels: true ) - return DeclSyntax( - FunctionDeclSyntax( - name: .identifier(name.backtickIfNeeded()), - signature: signature, - body: CodeBlockSyntax { - body - } - ) - ) + printer.write("func \(name.backtickIfNeeded())\(signature) {") + printer.indent { + printer.write(lines: body.lines) + } + printer.write("}") + return "\(raw: printer.lines.joined(separator: "\n"))" } func renderConstructorDecl(parameters: [Parameter]) -> DeclSyntax { + let printer = CodeFragmentPrinter() let effects = Effects(isAsync: false, isThrows: true) - // Constructors don't have return types, so build signature without return clause - let signature = FunctionSignatureSyntax( - parameterClause: SwiftSignatureBuilder.buildParameterClause( - parameters: parameters, - useWildcardLabels: true - ), - effectSpecifiers: SwiftSignatureBuilder.buildEffectSpecifiers(effects: effects) - ) - return DeclSyntax( - InitializerDeclSyntax( - signature: signature, - bodyBuilder: { - body - } - ) + let parameterClause = SwiftSignatureBuilder.buildParameterClause( + parameters: parameters, + useWildcardLabels: true ) + let effectSpecifiers = SwiftSignatureBuilder.buildEffectSpecifiers(effects: effects) + printer.write("init\(parameterClause)\(effectSpecifiers.map { " \($0)" } ?? "") {") + printer.indent { + printer.write(lines: body.lines) + } + printer.write("}") + return "\(raw: printer.lines.joined(separator: "\n"))" } } @@ -600,12 +492,17 @@ struct SwiftSignatureBuilder { returnType: BridgeType, effects: Effects? = nil, useWildcardLabels: Bool = false - ) -> FunctionSignatureSyntax { - return FunctionSignatureSyntax( - parameterClause: buildParameterClause(parameters: parameters, useWildcardLabels: useWildcardLabels), - effectSpecifiers: effects.flatMap { buildEffectSpecifiers(effects: $0) }, - returnClause: buildReturnClause(returnType: returnType) - ) + ) -> String { + let parameterClause = buildParameterClause(parameters: parameters, useWildcardLabels: useWildcardLabels) + let effectSpecifiers = effects.flatMap { buildEffectSpecifiers(effects: $0) } + let returnClause = buildReturnClause(returnType: returnType) + var out = "" + out += parameterClause + if let effectSpecifiers { + out += " \(effectSpecifiers)" + } + out += returnClause + return out } /// Builds a function signature for ABI/extern functions using WasmCoreType parameters @@ -619,12 +516,14 @@ struct SwiftSignatureBuilder { abiParameters: [(name: String, type: WasmCoreType)], returnType: WasmCoreType?, effects: Effects? = nil - ) -> FunctionSignatureSyntax { - return FunctionSignatureSyntax( - parameterClause: buildABIParameterClause(abiParameters: abiParameters), - effectSpecifiers: effects.flatMap { buildEffectSpecifiers(effects: $0) }, - returnClause: buildABIReturnClause(returnType: returnType) - ) + ) -> String { + var out = "" + out += buildABIParameterClause(abiParameters: abiParameters) + if let effects = effects, let effectSpecifiers = buildEffectSpecifiers(effects: effects) { + out += " \(effectSpecifiers)" + } + out += buildABIReturnClause(returnType: returnType) + return out } /// Builds a parameter clause from an array of Parameter structs @@ -639,48 +538,28 @@ struct SwiftSignatureBuilder { static func buildParameterClause( parameters: [Parameter], useWildcardLabels: Bool = false - ) -> FunctionParameterClauseSyntax { - return FunctionParameterClauseSyntax(parametersBuilder: { - for param in parameters { - let paramTypeSyntax = buildParameterTypeSyntax(from: param.type) - if useWildcardLabels { - // Always use wildcard labels: "_ name: Type" - FunctionParameterSyntax( - firstName: .wildcardToken(), - secondName: .identifier(param.name), - colon: .colonToken(), - type: paramTypeSyntax - ) - } else { - let label = param.label ?? param.name - if label == param.name { - // External label same as parameter name: "count: Int" - FunctionParameterSyntax( - firstName: .identifier(label), - secondName: nil, - colon: .colonToken(), - type: paramTypeSyntax - ) - } else if param.label == nil { - // No label specified: use wildcard "_ name: Type" - FunctionParameterSyntax( - firstName: .wildcardToken(), - secondName: .identifier(param.name), - colon: .colonToken(), - type: paramTypeSyntax - ) - } else { - // External label differs: "label count: Int" - FunctionParameterSyntax( - firstName: .identifier(label), - secondName: .identifier(param.name), - colon: .colonToken(), - type: paramTypeSyntax - ) - } - } + ) -> String { + var out = "(" + out += parameters.map { param in + let label = param.label ?? param.name + let paramType = buildParameterTypeSyntax(from: param.type) + + if useWildcardLabels { + // Always use wildcard labels: "_ name: Type" + return "_ \(param.name): \(paramType)" + } else if label == param.name { + // External label same as parameter name: "count: Int" + return "\(param.name): \(paramType)" + } else if param.label == nil { + // No label specified: use wildcard "_ name: Type" + return "_ \(param.name): \(paramType)" + } else { + // External label differs: "label count: Int" + return "\(label) \(param.name): \(paramType)" } - }) + }.joined(separator: ", ") + out += ")" + return out } /// Builds a parameter clause for ABI/extern functions @@ -688,77 +567,56 @@ struct SwiftSignatureBuilder { /// All parameters use wildcard labels: "_ name: Type" static func buildABIParameterClause( abiParameters: [(name: String, type: WasmCoreType)] - ) -> FunctionParameterClauseSyntax { - return FunctionParameterClauseSyntax(parametersBuilder: { - for param in abiParameters { - FunctionParameterSyntax( - firstName: .wildcardToken().with(\.trailingTrivia, .space), - secondName: .identifier(param.name), - type: IdentifierTypeSyntax(name: .identifier(param.type.swiftType)) - ) - } - }) + ) -> String { + "(" + + abiParameters.map { param in + "_ \(param.name): \(param.type.swiftType)" + }.joined(separator: ", ") + ")" } /// Builds a return clause from a BridgeType /// /// Always returns a ReturnClauseSyntax, including for Void types /// (to match original behavior that explicitly includes "-> Void") - static func buildReturnClause(returnType: BridgeType) -> ReturnClauseSyntax? { - return ReturnClauseSyntax( - arrow: .arrowToken(), - type: buildTypeSyntax(from: returnType) - ) + static func buildReturnClause(returnType: BridgeType) -> String { + return " -> \(returnType.swiftType)" } /// Builds a return clause for ABI/extern functions /// /// Returns nil for Void (when returnType is nil), otherwise returns a ReturnClauseSyntax - static func buildABIReturnClause(returnType: WasmCoreType?) -> ReturnClauseSyntax? { + static func buildABIReturnClause(returnType: WasmCoreType?) -> String { guard let returnType = returnType else { - return ReturnClauseSyntax( - arrow: .arrowToken(), - type: IdentifierTypeSyntax(name: .identifier("Void")) - ) + return " -> Void" } - return ReturnClauseSyntax( - arrow: .arrowToken(), - type: IdentifierTypeSyntax(name: .identifier(returnType.swiftType)) - ) + return " -> \(returnType.swiftType)" } /// Builds effect specifiers (async/throws) from an Effects struct /// /// Uses JSException as the thrown error type for throws clauses - static func buildEffectSpecifiers(effects: Effects) -> FunctionEffectSpecifiersSyntax? { + static func buildEffectSpecifiers(effects: Effects) -> String? { guard effects.isAsync || effects.isThrows else { return nil } - return FunctionEffectSpecifiersSyntax( - asyncSpecifier: effects.isAsync ? .keyword(.async) : nil, - throwsClause: effects.isThrows - ? ThrowsClauseSyntax( - throwsSpecifier: .keyword(.throws), - leftParen: .leftParenToken(), - type: IdentifierTypeSyntax(name: .identifier("JSException")), - rightParen: .rightParenToken() - ) : nil - ) + var items: [String] = [] + if effects.isAsync { items.append("async") } + if effects.isThrows { items.append("throws(JSException)") } + return items.joined(separator: " ") } /// Builds a TypeSyntax node from a BridgeType /// /// Converts BridgeType to its Swift type representation as a TypeSyntax node - static func buildTypeSyntax(from type: BridgeType) -> TypeSyntax { - let identifierType = IdentifierTypeSyntax(name: .identifier(type.swiftType)) - return TypeSyntax(identifierType) + static func buildTypeSyntax(from type: BridgeType) -> String { + return type.swiftType } /// Builds a parameter type syntax from a BridgeType. - static func buildParameterTypeSyntax(from type: BridgeType) -> TypeSyntax { + static func buildParameterTypeSyntax(from type: BridgeType) -> String { switch type { case .closure(_, useJSTypedClosure: false): - return TypeSyntax("@escaping \(raw: type.swiftType)") + return "@escaping \(type.swiftType)" default: return buildTypeSyntax(from: type) } @@ -768,167 +626,69 @@ struct SwiftSignatureBuilder { enum SwiftCodePattern { /// Builds a conditional compilation block with #if arch(wasm32) and #else fatalError static func buildWasmConditionalCompilation( - wasmBody: CodeBlockItemListSyntax - ) -> IfConfigDeclSyntax { - return IfConfigDeclSyntax( - clauses: IfConfigClauseListSyntax { - IfConfigClauseSyntax( - poundKeyword: .poundIfToken(), - condition: ExprSyntax("arch(wasm32)"), - elements: .statements(wasmBody) - ) - IfConfigClauseSyntax( - poundKeyword: .poundElseToken(), - elements: .statements( - CodeBlockItemListSyntax { - "fatalError(\"Only available on WebAssembly\")" - } - ) - ) - } - ) + printer: CodeFragmentPrinter, + wasmBody: (_ printer: CodeFragmentPrinter) -> Void + ) { + printer.write("#if arch(wasm32)") + wasmBody(printer) + printer.write("#else") + printer.write("fatalError(\"Only available on WebAssembly\")") + printer.write("#endif") } /// Builds a conditional compilation block with #if arch(wasm32) and #else for declarations static func buildWasmConditionalCompilationDecls( - wasmDecl: DeclSyntax, - elseDecl: DeclSyntax - ) -> IfConfigDeclSyntax { - return IfConfigDeclSyntax( - clauses: IfConfigClauseListSyntax { - IfConfigClauseSyntax( - poundKeyword: .poundIfToken(), - condition: ExprSyntax("arch(wasm32)"), - elements: .statements( - CodeBlockItemListSyntax { - CodeBlockItemSyntax(item: .decl(wasmDecl)) - } - ) - ) - IfConfigClauseSyntax( - poundKeyword: .poundElseToken(), - elements: .statements( - CodeBlockItemListSyntax { - CodeBlockItemSyntax(item: .decl(elseDecl)) - } - ) - ) - } - ) + printer: CodeFragmentPrinter, + wasmDecl: (_ printer: CodeFragmentPrinter) -> Void, + elseDecl: (_ printer: CodeFragmentPrinter) -> Void + ) { + printer.write("#if arch(wasm32)") + wasmDecl(printer) + printer.write("#else") + elseDecl(printer) + printer.write("#endif") } /// Builds the @_extern attribute for WebAssembly extern function declarations /// Builds an @_extern function declaration (no body, just the declaration) static func buildExternFunctionDecl( + printer: CodeFragmentPrinter, moduleName: String, abiName: String, functionName: String, - signature: FunctionSignatureSyntax - ) -> FunctionDeclSyntax { - return FunctionDeclSyntax( - attributes: buildExternAttribute(moduleName: moduleName, abiName: abiName), - modifiers: DeclModifierListSyntax { - DeclModifierSyntax(name: .keyword(.fileprivate)) - }, - funcKeyword: .keyword(.func), - name: .identifier(functionName), - signature: signature - ) + signature: String + ) { + printer.write(buildExternAttribute(moduleName: moduleName, abiName: abiName)) + printer.write("fileprivate func \(functionName)\(signature)") } /// Builds the standard @_expose and @_cdecl attributes for WebAssembly-exposed functions - static func buildExposeAttributes(abiName: String) -> AttributeListSyntax { - return AttributeListSyntax { - #if canImport(SwiftSyntax602) - let exposeAttrArgs = AttributeSyntax.Arguments.argumentList( - LabeledExprListSyntax { - LabeledExprSyntax(label: nil, expression: DeclReferenceExprSyntax(baseName: "wasm")) - .with(\.trailingComma, .commaToken()) - LabeledExprSyntax(label: nil, expression: StringLiteralExprSyntax(content: abiName)) - } - ) - let cdeclAttrArgs = AttributeSyntax.Arguments.argumentList( - [ - LabeledExprSyntax(label: nil, expression: StringLiteralExprSyntax(content: abiName)) - ] - ) - #else - let exposeAttrArgs = AttributeSyntax.Arguments.exposeAttributeArguments( - ExposeAttributeArgumentsSyntax( - language: .identifier("wasm"), - comma: .commaToken(), - cxxName: StringLiteralExprSyntax(content: abiName) - ) - ) - let cdeclAttrArgs = AttributeSyntax.Arguments.string(StringLiteralExprSyntax(content: abiName)) - #endif - AttributeSyntax( - attributeName: IdentifierTypeSyntax(name: .identifier("_expose")), - leftParen: .leftParenToken(), - arguments: exposeAttrArgs, - rightParen: .rightParenToken() - ) - .with(\.trailingTrivia, .newline) - - AttributeSyntax( - attributeName: IdentifierTypeSyntax(name: .identifier("_cdecl")), - leftParen: .leftParenToken(), - arguments: cdeclAttrArgs, - rightParen: .rightParenToken() - ) - .with(\.trailingTrivia, .newline) - } + static func buildExposeAttributes(abiName: String) -> String { + return """ + @_expose(wasm, "\(abiName)") + @_cdecl("\(abiName)") + """ } /// Builds a function declaration with @_expose/@_cdecl attributes and conditional compilation static func buildExposedFunctionDecl( abiName: String, - signature: FunctionSignatureSyntax, - body: CodeBlockItemListSyntax - ) -> FunctionDeclSyntax { - let funcBody = CodeBlockSyntax { - buildWasmConditionalCompilation(wasmBody: body) + signature: String, + body: (CodeFragmentPrinter) -> Void + ) -> DeclSyntax { + let printer = CodeFragmentPrinter() + printer.write(buildExposeAttributes(abiName: abiName)) + printer.write("public func _\(abiName)\(signature) {") + printer.indent { + buildWasmConditionalCompilation(printer: printer, wasmBody: body) } - - return FunctionDeclSyntax( - attributes: buildExposeAttributes(abiName: abiName), - modifiers: DeclModifierListSyntax { - DeclModifierSyntax(name: .keyword(.public)) - }, - funcKeyword: .keyword(.func), - name: .identifier("_\(abiName)"), - signature: signature, - body: funcBody - ) + printer.write("}") + return "\(raw: printer.lines.joined(separator: "\n"))" } /// Builds the @_extern attribute for WebAssembly extern function declarations - static func buildExternAttribute(moduleName: String, abiName: String) -> AttributeListSyntax { - return AttributeListSyntax { - AttributeSyntax( - attributeName: IdentifierTypeSyntax(name: .identifier("_extern")), - leftParen: .leftParenToken(), - arguments: .argumentList( - LabeledExprListSyntax { - LabeledExprSyntax( - expression: ExprSyntax("wasm") - ) - LabeledExprSyntax( - label: .identifier("module"), - colon: .colonToken(), - expression: StringLiteralExprSyntax(content: moduleName) - ) - LabeledExprSyntax( - label: .identifier("name"), - colon: .colonToken(), - expression: StringLiteralExprSyntax(content: abiName) - ) - } - ), - rightParen: .rightParenToken() - ) - .with(\.trailingTrivia, .newline) - } + static func buildExternAttribute(moduleName: String, abiName: String) -> String { + return "@_extern(wasm, module: \"\(moduleName)\", name: \"\(abiName)\")" } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift b/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift index ed6fa04f0..68c07f225 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSUtilities/Utilities.swift @@ -60,6 +60,12 @@ public final class CodeFragmentPrinter { self.write(lines: printer.lines) } + public func write(multilineString: String) { + for line in multilineString.split(separator: "\n") { + write(line) + } + } + public func indent() { indentLevel += 1 } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift index 023caf21f..261c0b066 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift @@ -229,17 +229,19 @@ public func _bjs_processOptionalIntArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -254,17 +256,19 @@ public func _bjs_processOptionalStringArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -281,10 +285,11 @@ public func _bjs_processOptionalArray(_ values: Int32) -> Void { } else { return [Int].bridgeJSLiftParameter() } - }()) + }()) let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} + __bjs_unwrapped_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -299,17 +304,19 @@ public func _bjs_processOptionalPointArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -324,17 +331,19 @@ public func _bjs_processOptionalDirectionArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -349,17 +358,19 @@ public func _bjs_processOptionalStatusArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -374,14 +385,15 @@ public func _bjs_processNestedIntArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [[Int]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([Int].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -396,14 +408,15 @@ public func _bjs_processNestedStringArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [[String]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([String].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -418,14 +431,15 @@ public func _bjs_processNestedPointArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [[Point]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([Point].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -451,14 +465,15 @@ public func _bjs_processNestedItemArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [[Item]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([Item].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -484,17 +499,19 @@ public func _bjs_processOptionalJSObjectArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -509,14 +526,15 @@ public func _bjs_processNestedJSObjectArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [[JSObject]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([JSObject].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.swift index 4c97553de..f5230f213 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Async.swift @@ -4,7 +4,7 @@ public func _bjs_asyncReturnVoid() -> Int32 { #if arch(wasm32) let ret = JSPromise.async { await asyncReturnVoid() - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -17,7 +17,7 @@ public func _bjs_asyncRoundTripInt(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripInt(_: Int.bridgeJSLiftParameter(v)).jsValue - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -30,7 +30,7 @@ public func _bjs_asyncRoundTripString(_ vBytes: Int32, _ vLength: Int32) -> Int3 #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripString(_: String.bridgeJSLiftParameter(vBytes, vLength)).jsValue - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -43,7 +43,7 @@ public func _bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripBool(_: Bool.bridgeJSLiftParameter(v)).jsValue - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -56,7 +56,7 @@ public func _bjs_asyncRoundTripFloat(_ v: Float32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripFloat(_: Float.bridgeJSLiftParameter(v)).jsValue - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -69,7 +69,7 @@ public func _bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripDouble(_: Double.bridgeJSLiftParameter(v)).jsValue - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -82,7 +82,7 @@ public func _bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripJSObject(_: JSObject.bridgeJSLiftParameter(v)).jsValue - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift index 26454a2a7..f2029749c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift @@ -309,36 +309,36 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { case .success(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(0) case .failure(let param0, let param1): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) return Int32(1) case .status(let param0, let param1, let param2): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { - __bjs_unwrapped_param2.bridgeJSLowerStackReturn() + __bjs_unwrapped_param2.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) return Int32(2) @@ -360,36 +360,36 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { case .success(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(0)) case .failure(let param0, let param1): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) _swift_js_push_tag(Int32(1)) case .status(let param0, let param1, let param2): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { - __bjs_unwrapped_param2.bridgeJSLowerStackReturn() + __bjs_unwrapped_param2.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) _swift_js_push_tag(Int32(2)) @@ -474,14 +474,14 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { case .optPrecision(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(2) case .optDirection(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) @@ -511,14 +511,14 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { case .optPrecision(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(2)) case .optDirection(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(3)) @@ -618,13 +618,13 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { return .optNestedEnum(Optional.bridgeJSLiftParameter()) case 4: return .optArray({ - let __isSome = _swift_js_pop_i32() - if __isSome == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() - } - }()) + let __isSome = _swift_js_pop_i32() + if __isSome == 0 { + return Optional<[Int]>.none + } else { + return [Int].bridgeJSLiftParameter() + } +}()) case 5: return .empty default: @@ -639,35 +639,35 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { case .optStruct(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() + __bjs_unwrapped_param0.bridgeJSLowerReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(0) case .optClass(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(1) case .optJSObject(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(2) case .optNestedEnum(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) case .optArray(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() + __bjs_unwrapped_param0.bridgeJSLowerReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(4) @@ -691,35 +691,35 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { case .optStruct(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() + __bjs_unwrapped_param0.bridgeJSLowerReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(0)) case .optClass(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(1)) case .optJSObject(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(2)) case .optNestedEnum(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(3)) case .optArray(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() + __bjs_unwrapped_param0.bridgeJSLowerReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(4)) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift index 6d9bee080..cd0f56694 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift @@ -1,8 +1,6 @@ extension FooContainer: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> FooContainer { - let optionalFoo = Optional.bridgeJSLiftParameter().map { - Foo(unsafelyWrapping: $0) - } + let optionalFoo = Optional.bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) } let foo = Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter()) return FooContainer(foo: foo, optionalFoo: optionalFoo) } @@ -11,7 +9,7 @@ extension FooContainer: _BridgedSwiftStruct { self.foo.jsObject.bridgeJSLowerStackReturn() let __bjs_isSome_optionalFoo = self.optionalFoo != nil if let __bjs_unwrapped_optionalFoo = self.optionalFoo { - __bjs_unwrapped_optionalFoo.jsObject.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalFoo.jsObject.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optionalFoo ? 1 : 0) } @@ -82,15 +80,13 @@ public func _bjs_processFooArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Foo] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter())) } __result.reverse() return __result - }()) - ret.map { - $0.jsObject - } .bridgeJSLowerReturn() + }()) + ret.map { $0.jsObject }.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -104,19 +100,19 @@ public func _bjs_processOptionalFooArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter().map { - Foo(unsafelyWrapping: $0) - }) + for _ in 0..<__count { + __result.append(Optional.bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) }) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.jsObject.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.jsObject.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift index f3550129c..b4e45bbc9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift @@ -41,10 +41,11 @@ public func _bjs_roundTripOptionalJSValueArray(_ values: Int32) -> Void { } else { return [JSValue].bridgeJSLiftParameter() } - }()) + }()) let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} + __bjs_unwrapped_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift index 3536b53cb..55521dbaf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift @@ -417,9 +417,7 @@ extension Priority: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { public func _bjs_processDelegates() -> Void { #if arch(wasm32) let ret = processDelegates(_: [AnyMyViewControllerDelegate].bridgeJSLiftParameter()) - ret.map { - $0 as! AnyMyViewControllerDelegate - } .bridgeJSLowerReturn() + ret.map { $0 as! AnyMyViewControllerDelegate }.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -590,9 +588,7 @@ public func _bjs_MyViewController_delegate_set(_ _self: UnsafeMutableRawPointer, @_cdecl("bjs_MyViewController_secondDelegate_get") public func _bjs_MyViewController_secondDelegate_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = MyViewController.bridgeJSLiftParameter(_self).secondDelegate.flatMap { - $0 as? AnyMyViewControllerDelegate - } + let ret = MyViewController.bridgeJSLiftParameter(_self).secondDelegate.flatMap { $0 as? AnyMyViewControllerDelegate } return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -660,9 +656,7 @@ public func _bjs_DelegateManager_notifyAll(_ _self: UnsafeMutableRawPointer) -> public func _bjs_DelegateManager_delegates_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = DelegateManager.bridgeJSLiftParameter(_self).delegates - ret.map { - $0 as! AnyMyViewControllerDelegate - } .bridgeJSLowerReturn() + ret.map { $0 as! AnyMyViewControllerDelegate }.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift index ca2467249..1ff0a4ce8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift @@ -17,12 +17,12 @@ extension DataPoint: _BridgedSwiftStruct { self.label.bridgeJSLowerStackReturn() let __bjs_isSome_optCount = self.optCount != nil if let __bjs_unwrapped_optCount = self.optCount { - __bjs_unwrapped_optCount.bridgeJSLowerStackReturn() + __bjs_unwrapped_optCount.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optCount ? 1 : 0) let __bjs_isSome_optFlag = self.optFlag != nil if let __bjs_unwrapped_optFlag = self.optFlag { - __bjs_unwrapped_optFlag.bridgeJSLowerStackReturn() + __bjs_unwrapped_optFlag.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optFlag ? 1 : 0) } @@ -84,7 +84,7 @@ extension Address: _BridgedSwiftStruct { self.city.bridgeJSLowerStackReturn() let __bjs_isSome_zipCode = self.zipCode != nil if let __bjs_unwrapped_zipCode = self.zipCode { - __bjs_unwrapped_zipCode.bridgeJSLowerStackReturn() + __bjs_unwrapped_zipCode.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_zipCode ? 1 : 0) } @@ -137,7 +137,7 @@ extension Person: _BridgedSwiftStruct { self.address.bridgeJSLowerReturn() let __bjs_isSome_email = self.email != nil if let __bjs_unwrapped_email = self.email { - __bjs_unwrapped_email.bridgeJSLowerStackReturn() + __bjs_unwrapped_email.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_email ? 1 : 0) } @@ -233,7 +233,7 @@ extension Measurement: _BridgedSwiftStruct { self.precision.bridgeJSLowerStackReturn() let __bjs_isSome_optionalPrecision = self.optionalPrecision != nil if let __bjs_unwrapped_optionalPrecision = self.optionalPrecision { - __bjs_unwrapped_optionalPrecision.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalPrecision.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optionalPrecision ? 1 : 0) } @@ -277,7 +277,6 @@ extension ConfigStruct: _BridgedSwiftStruct { } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - } init(unsafelyCopying jsObject: JSObject) { @@ -399,7 +398,7 @@ extension Container: _BridgedSwiftStruct { self.object.bridgeJSLowerStackReturn() let __bjs_isSome_optionalObject = self.optionalObject != nil if let __bjs_unwrapped_optionalObject = self.optionalObject { - __bjs_unwrapped_optionalObject.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalObject.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optionalObject ? 1 : 0) } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index b10a82fdf..af9f15dbc 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -655,7 +655,7 @@ fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS 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 + return { [callback] (param0, param1, param2) in #if arch(wasm32) let callbackValue = callback.bridgeJSLowerParameter() let param0Value = param0.bridgeJSLowerParameter() @@ -714,7 +714,7 @@ fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS 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 + return { [callback] (param0, param1, param2) in #if arch(wasm32) let callbackValue = callback.bridgeJSLowerParameter() let param0Value = param0.bridgeJSLowerParameter() @@ -773,7 +773,7 @@ fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsS private enum _BJS_Closure_20BridgeJSRuntimeTestsSiSi_Si { static func bridgeJSLift(_ callbackId: Int32) -> (Int, Int) -> Int { let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0, param1 in + return { [callback] (param0, param1) in #if arch(wasm32) let callbackValue = callback.bridgeJSLowerParameter() let param0Value = param0.bridgeJSLowerParameter() @@ -2443,14 +2443,14 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { case .optPrecision(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(2) case .optDirection(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) @@ -2480,14 +2480,14 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { case .optPrecision(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(2)) case .optDirection(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(3)) @@ -2815,17 +2815,15 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { return .optNestedEnum(Optional.bridgeJSLiftParameter()) case 4: return .optArray({ - let __isSome = _swift_js_pop_i32() - if __isSome == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() - } - }()) + let __isSome = _swift_js_pop_i32() + if __isSome == 0 { + return Optional<[Int]>.none + } else { + return [Int].bridgeJSLiftParameter() + } +}()) case 5: - return .optJsClass(Optional.bridgeJSLiftParameter().map { - Foo(unsafelyWrapping: $0) - }) + return .optJsClass(Optional.bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) }) case 6: return .empty default: @@ -2840,42 +2838,42 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { case .optStruct(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() + __bjs_unwrapped_param0.bridgeJSLowerReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(0) case .optClass(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(1) case .optJSObject(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(2) case .optNestedEnum(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) case .optArray(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() + __bjs_unwrapped_param0.bridgeJSLowerReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(4) case .optJsClass(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(5) @@ -2899,42 +2897,42 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { case .optStruct(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() + __bjs_unwrapped_param0.bridgeJSLowerReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(0)) case .optClass(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(1)) case .optJSObject(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(2)) case .optNestedEnum(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(3)) case .optArray(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() + __bjs_unwrapped_param0.bridgeJSLowerReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(4)) case .optJsClass(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(5)) @@ -2965,36 +2963,36 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { case .success(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(0) case .failure(let param0, let param1): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) return Int32(1) case .status(let param0, let param1, let param2): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { - __bjs_unwrapped_param2.bridgeJSLowerStackReturn() + __bjs_unwrapped_param2.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) return Int32(2) @@ -3016,36 +3014,36 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { case .success(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(0)) case .failure(let param0, let param1): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) _swift_js_push_tag(Int32(1)) case .status(let param0, let param1, let param2): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { - __bjs_unwrapped_param2.bridgeJSLowerStackReturn() + __bjs_unwrapped_param2.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) _swift_js_push_tag(Int32(2)) @@ -3176,12 +3174,12 @@ extension DataPoint: _BridgedSwiftStruct { self.label.bridgeJSLowerStackReturn() let __bjs_isSome_optCount = self.optCount != nil if let __bjs_unwrapped_optCount = self.optCount { - __bjs_unwrapped_optCount.bridgeJSLowerStackReturn() + __bjs_unwrapped_optCount.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optCount ? 1 : 0) let __bjs_isSome_optFlag = self.optFlag != nil if let __bjs_unwrapped_optFlag = self.optFlag { - __bjs_unwrapped_optFlag.bridgeJSLowerStackReturn() + __bjs_unwrapped_optFlag.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optFlag ? 1 : 0) } @@ -3243,7 +3241,7 @@ extension Address: _BridgedSwiftStruct { self.city.bridgeJSLowerStackReturn() let __bjs_isSome_zipCode = self.zipCode != nil if let __bjs_unwrapped_zipCode = self.zipCode { - __bjs_unwrapped_zipCode.bridgeJSLowerStackReturn() + __bjs_unwrapped_zipCode.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_zipCode ? 1 : 0) } @@ -3297,12 +3295,12 @@ extension Contact: _BridgedSwiftStruct { self.address.bridgeJSLowerReturn() let __bjs_isSome_email = self.email != nil if let __bjs_unwrapped_email = self.email { - __bjs_unwrapped_email.bridgeJSLowerStackReturn() + __bjs_unwrapped_email.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_email ? 1 : 0) let __bjs_isSome_secondaryAddress = self.secondaryAddress != nil if let __bjs_unwrapped_secondaryAddress = self.secondaryAddress { - __bjs_unwrapped_secondaryAddress.bridgeJSLowerReturn() + __bjs_unwrapped_secondaryAddress.bridgeJSLowerReturn() } _swift_js_push_i32(__bjs_isSome_secondaryAddress ? 1 : 0) } @@ -3353,12 +3351,12 @@ extension Config: _BridgedSwiftStruct { self.name.bridgeJSLowerStackReturn() let __bjs_isSome_theme = self.theme != nil if let __bjs_unwrapped_theme = self.theme { - __bjs_unwrapped_theme.bridgeJSLowerStackReturn() + __bjs_unwrapped_theme.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_theme ? 1 : 0) let __bjs_isSome_direction = self.direction != nil if let __bjs_unwrapped_direction = self.direction { - __bjs_unwrapped_direction.bridgeJSLowerStackReturn() + __bjs_unwrapped_direction.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_direction ? 1 : 0) self.status.bridgeJSLowerStackReturn() @@ -3408,7 +3406,7 @@ extension SessionData: _BridgedSwiftStruct { self.id.bridgeJSLowerStackReturn() let __bjs_isSome_owner = self.owner != nil if let __bjs_unwrapped_owner = self.owner { - __bjs_unwrapped_owner.bridgeJSLowerStackReturn() + __bjs_unwrapped_owner.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_owner ? 1 : 0) } @@ -3460,12 +3458,12 @@ extension ValidationReport: _BridgedSwiftStruct { self.result.bridgeJSLowerReturn() let __bjs_isSome_status = self.status != nil if let __bjs_unwrapped_status = self.status { - __bjs_unwrapped_status.bridgeJSLowerStackReturn() + __bjs_unwrapped_status.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_status ? 1 : 0) let __bjs_isSome_outcome = self.outcome != nil if let __bjs_unwrapped_outcome = self.outcome { - _swift_js_push_i32(__bjs_unwrapped_outcome.bridgeJSLowerParameter()) + _swift_js_push_i32(__bjs_unwrapped_outcome.bridgeJSLowerParameter()) } _swift_js_push_i32(__bjs_isSome_outcome ? 1 : 0) } @@ -3526,23 +3524,23 @@ extension AdvancedConfig: _BridgedSwiftStruct { self.status.bridgeJSLowerStackReturn() let __bjs_isSome_result = self.result != nil if let __bjs_unwrapped_result = self.result { - _swift_js_push_i32(__bjs_unwrapped_result.bridgeJSLowerParameter()) + _swift_js_push_i32(__bjs_unwrapped_result.bridgeJSLowerParameter()) } _swift_js_push_i32(__bjs_isSome_result ? 1 : 0) let __bjs_isSome_metadata = self.metadata != nil if let __bjs_unwrapped_metadata = self.metadata { - __bjs_unwrapped_metadata.bridgeJSLowerStackReturn() + __bjs_unwrapped_metadata.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_metadata ? 1 : 0) let __bjs_isSome_location = self.location != nil if let __bjs_unwrapped_location = self.location { - __bjs_unwrapped_location.bridgeJSLowerReturn() + __bjs_unwrapped_location.bridgeJSLowerReturn() } _swift_js_push_i32(__bjs_isSome_location ? 1 : 0) self.defaults.bridgeJSLowerReturn() let __bjs_isSome_overrideDefaults = self.overrideDefaults != nil if let __bjs_unwrapped_overrideDefaults = self.overrideDefaults { - __bjs_unwrapped_overrideDefaults.bridgeJSLowerReturn() + __bjs_unwrapped_overrideDefaults.bridgeJSLowerReturn() } _swift_js_push_i32(__bjs_isSome_overrideDefaults ? 1 : 0) } @@ -3594,12 +3592,12 @@ extension MeasurementConfig: _BridgedSwiftStruct { self.ratio.bridgeJSLowerStackReturn() let __bjs_isSome_optionalPrecision = self.optionalPrecision != nil if let __bjs_unwrapped_optionalPrecision = self.optionalPrecision { - __bjs_unwrapped_optionalPrecision.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalPrecision.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optionalPrecision ? 1 : 0) let __bjs_isSome_optionalRatio = self.optionalRatio != nil if let __bjs_unwrapped_optionalRatio = self.optionalRatio { - __bjs_unwrapped_optionalRatio.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalRatio.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optionalRatio ? 1 : 0) } @@ -3735,7 +3733,7 @@ extension CopyableCart: _BridgedSwiftStruct { self.x.bridgeJSLowerStackReturn() let __bjs_isSome_note = self.note != nil if let __bjs_unwrapped_note = self.note { - __bjs_unwrapped_note.bridgeJSLowerStackReturn() + __bjs_unwrapped_note.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_note ? 1 : 0) } @@ -3842,7 +3840,7 @@ extension CopyableNestedCart: _BridgedSwiftStruct { self.item.bridgeJSLowerReturn() let __bjs_isSome_shippingAddress = self.shippingAddress != nil if let __bjs_unwrapped_shippingAddress = self.shippingAddress { - __bjs_unwrapped_shippingAddress.bridgeJSLowerReturn() + __bjs_unwrapped_shippingAddress.bridgeJSLowerReturn() } _swift_js_push_i32(__bjs_isSome_shippingAddress ? 1 : 0) } @@ -4011,7 +4009,7 @@ extension JSObjectContainer: _BridgedSwiftStruct { self.object.bridgeJSLowerStackReturn() let __bjs_isSome_optionalObject = self.optionalObject != nil if let __bjs_unwrapped_optionalObject = self.optionalObject { - __bjs_unwrapped_optionalObject.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalObject.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optionalObject ? 1 : 0) } @@ -4051,9 +4049,7 @@ fileprivate func _bjs_struct_lift_JSObjectContainer() -> Int32 { extension FooContainer: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> FooContainer { - let optionalFoo = Optional.bridgeJSLiftParameter().map { - Foo(unsafelyWrapping: $0) - } + let optionalFoo = Optional.bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) } let foo = Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter()) return FooContainer(foo: foo, optionalFoo: optionalFoo) } @@ -4062,7 +4058,7 @@ extension FooContainer: _BridgedSwiftStruct { self.foo.jsObject.bridgeJSLowerStackReturn() let __bjs_isSome_optionalFoo = self.optionalFoo != nil if let __bjs_unwrapped_optionalFoo = self.optionalFoo { - __bjs_unwrapped_optionalFoo.jsObject.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalFoo.jsObject.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_optionalFoo ? 1 : 0) } @@ -4109,7 +4105,7 @@ extension ArrayMembers: _BridgedSwiftStruct { } else { return [String].bridgeJSLiftParameter() } - }() +}() let ints = [Int].bridgeJSLiftParameter() return ArrayMembers(ints: ints, optStrings: optStrings) } @@ -4118,7 +4114,7 @@ extension ArrayMembers: _BridgedSwiftStruct { self.ints.bridgeJSLowerReturn() let __bjs_isSome_optStrings = self.optStrings != nil if let __bjs_unwrapped_optStrings = self.optStrings { - __bjs_unwrapped_optStrings.bridgeJSLowerReturn() + __bjs_unwrapped_optStrings.bridgeJSLowerReturn() } _swift_js_push_i32(__bjs_isSome_optStrings ? 1 : 0) } @@ -4396,10 +4392,11 @@ public func _bjs_roundTripOptionalJSValueArray(_ v: Int32) -> Void { } else { return [JSValue].bridgeJSLiftParameter() } - }()) + }()) let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} + __bjs_unwrapped_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -4636,7 +4633,7 @@ public func _bjs_asyncRoundTripVoid() -> Int32 { #if arch(wasm32) let ret = JSPromise.async { await asyncRoundTripVoid() - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -4649,7 +4646,7 @@ public func _bjs_asyncRoundTripInt(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripInt(v: Int.bridgeJSLiftParameter(v)).jsValue - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -4662,7 +4659,7 @@ public func _bjs_asyncRoundTripFloat(_ v: Float32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripFloat(v: Float.bridgeJSLiftParameter(v)).jsValue - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -4675,7 +4672,7 @@ public func _bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripDouble(v: Double.bridgeJSLiftParameter(v)).jsValue - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -4688,7 +4685,7 @@ public func _bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripBool(v: Bool.bridgeJSLiftParameter(v)).jsValue - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -4701,7 +4698,7 @@ public func _bjs_asyncRoundTripString(_ vBytes: Int32, _ vLength: Int32) -> Int3 #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripString(v: String.bridgeJSLiftParameter(vBytes, vLength)).jsValue - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -4714,7 +4711,7 @@ public func _bjs_asyncRoundTripSwiftHeapObject(_ v: UnsafeMutableRawPointer) -> #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripSwiftHeapObject(v: Greeter.bridgeJSLiftParameter(v)).jsValue - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -4727,7 +4724,7 @@ public func _bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { #if arch(wasm32) let ret = JSPromise.async { return await asyncRoundTripJSObject(v: JSObject.bridgeJSLiftParameter(v)).jsValue - } .jsObject + }.jsObject return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5424,7 +5421,7 @@ public func _bjs_arrayWithOptionalDefault(_ values: Int32) -> Int32 { } else { return [Int].bridgeJSLiftParameter() } - }()) + }()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5593,17 +5590,19 @@ public func _bjs_roundTripOptionalIntArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5618,17 +5617,19 @@ public func _bjs_roundTripOptionalStringArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5643,17 +5644,19 @@ public func _bjs_roundTripOptionalDataPointArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5668,17 +5671,19 @@ public func _bjs_roundTripOptionalDirectionArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5693,17 +5698,19 @@ public func _bjs_roundTripOptionalStatusArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5720,10 +5727,11 @@ public func _bjs_roundTripOptionalIntArrayType(_ values: Int32) -> Void { } else { return [Int].bridgeJSLiftParameter() } - }()) + }()) let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} + __bjs_unwrapped_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -5740,10 +5748,11 @@ public func _bjs_roundTripOptionalStringArrayType(_ values: Int32) -> Void { } else { return [String].bridgeJSLiftParameter() } - }()) + }()) let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} + __bjs_unwrapped_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -5760,10 +5769,11 @@ public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { } else { return [Greeter].bridgeJSLiftParameter() } - }()) + }()) let __bjs_isSome_ret = ret != nil if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn()} + __bjs_unwrapped_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) #else fatalError("Only available on WebAssembly") @@ -5778,14 +5788,15 @@ public func _bjs_roundTripNestedIntArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [[Int]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([Int].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5800,14 +5811,15 @@ public func _bjs_roundTripNestedStringArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [[String]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([String].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5822,14 +5834,15 @@ public func _bjs_roundTripNestedDoubleArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [[Double]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([Double].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5844,14 +5857,15 @@ public func _bjs_roundTripNestedBoolArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [[Bool]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([Bool].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5866,14 +5880,15 @@ public func _bjs_roundTripNestedDataPointArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [[DataPoint]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([DataPoint].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5888,14 +5903,15 @@ public func _bjs_roundTripNestedDirectionArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [[Direction]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([Direction].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5910,14 +5926,15 @@ public func _bjs_roundTripNestedGreeterArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [[Greeter]] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append([Greeter].bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn()} + __bjs_elem_ret.bridgeJSLowerReturn() + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -5995,9 +6012,7 @@ public func _bjs_consumeDataProcessorArrayType() -> Int32 { public func _bjs_roundTripDataProcessorArrayType() -> Void { #if arch(wasm32) let ret = roundTripDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSLiftParameter()) - ret.map { - $0 as! AnyDataProcessor - } .bridgeJSLowerReturn() + ret.map { $0 as! AnyDataProcessor }.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -6022,17 +6037,19 @@ public func _bjs_roundTripOptionalJSObjectArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Optional.bridgeJSLiftParameter()) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -6047,15 +6064,13 @@ public func _bjs_roundTripFooArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Foo] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { + for _ in 0..<__count { __result.append(Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter())) } __result.reverse() return __result - }()) - ret.map { - $0.jsObject - } .bridgeJSLowerReturn() + }()) + ret.map { $0.jsObject }.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -6069,19 +6084,19 @@ public func _bjs_roundTripOptionalFooArray() -> Void { let __count = Int(_swift_js_pop_i32()) var __result: [Optional] = [] __result.reserveCapacity(__count) - for _ in 0 ..< __count { - __result.append(Optional.bridgeJSLiftParameter().map { - Foo(unsafelyWrapping: $0) - }) + for _ in 0..<__count { + __result.append(Optional.bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) }) } __result.reverse() return __result - }()) + }()) for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.jsObject.bridgeJSLowerStackReturn()} - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0)} + __bjs_unwrapped_ret_elem.jsObject.bridgeJSLowerStackReturn() + } + _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + } _swift_js_push_i32(Int32(ret.count)) #else fatalError("Only available on WebAssembly") @@ -8160,9 +8175,7 @@ public func _bjs_DataProcessorManager_processor_set(_ _self: UnsafeMutableRawPoi @_cdecl("bjs_DataProcessorManager_backupProcessor_get") public func _bjs_DataProcessorManager_backupProcessor_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).backupProcessor.flatMap { - $0 as? AnyDataProcessor - } + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).backupProcessor.flatMap { $0 as? AnyDataProcessor } return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") From bed117819acf36b3068efc3c93d8e63c4c536560 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 11 Feb 2026 19:13:16 +0100 Subject: [PATCH 200/252] NCF: BridgeJS: Generalize Optional stack ABI for Array, Dictionary, and Struct types --- Benchmarks/Sources/Generated/BridgeJS.swift | 50 +----- .../Sources/BridgeJSCore/ExportSwift.swift | 79 ++------- .../Sources/BridgeJSLink/JSGlueGen.swift | 9 +- .../BridgeJSCodegenTests/ArrayTypes.swift | 22 +-- .../DefaultParameters.swift | 8 +- .../DictionaryTypes.swift | 4 +- .../EnumAssociatedValue.swift | 33 +--- .../BridgeJSCodegenTests/JSValue.swift | 16 +- .../BridgeJSLinkTests/ArrayTypes.js | 3 +- .../BridgeJSLinkTests/DefaultParameters.js | 6 +- .../BridgeJSLinkTests/DictionaryTypes.js | 3 +- .../BridgeJSLinkTests/JSValue.js | 3 +- .../JavaScriptKit/BridgeJSIntrinsics.swift | 81 ++++----- .../Generated/BridgeJS.swift | 164 ++++-------------- 14 files changed, 127 insertions(+), 354 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 515d3a531..e4e147f5b 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -1762,11 +1762,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalPointArray(_ _self: UnsafeMutableRaw #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalPointArray() for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + __bjs_elem_ret.bridgeJSLowerReturn() } _swift_js_push_i32(Int32(ret.count)) #else @@ -1789,11 +1785,7 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalPointArray(_ _self: UnsafeMutab return __result }()) for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + __bjs_elem_ret.bridgeJSLowerReturn() } _swift_js_push_i32(Int32(ret.count)) #else @@ -1803,15 +1795,9 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalPointArray(_ _self: UnsafeMutab @_expose(wasm, "bjs_ArrayRoundtrip_takeOptionalArray") @_cdecl("bjs_ArrayRoundtrip_takeOptionalArray") -public func _bjs_ArrayRoundtrip_takeOptionalArray(_ _self: UnsafeMutableRawPointer, _ values: Int32) -> Void { +public func _bjs_ArrayRoundtrip_takeOptionalArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - ArrayRoundtrip.bridgeJSLiftParameter(_self).takeOptionalArray(_: { - if values == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() - } - }()) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeOptionalArray(_: Optional<[Int]>.bridgeJSLiftParameter()) #else fatalError("Only available on WebAssembly") #endif @@ -1822,11 +1808,7 @@ public func _bjs_ArrayRoundtrip_takeOptionalArray(_ _self: UnsafeMutableRawPoint public func _bjs_ArrayRoundtrip_makeOptionalArraySome(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalArraySome() - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1837,11 +1819,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalArraySome(_ _self: UnsafeMutableRawP public func _bjs_ArrayRoundtrip_makeOptionalArrayNone(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalArrayNone() - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1849,20 +1827,10 @@ public func _bjs_ArrayRoundtrip_makeOptionalArrayNone(_ _self: UnsafeMutableRawP @_expose(wasm, "bjs_ArrayRoundtrip_roundtripOptionalArray") @_cdecl("bjs_ArrayRoundtrip_roundtripOptionalArray") -public func _bjs_ArrayRoundtrip_roundtripOptionalArray(_ _self: UnsafeMutableRawPointer, _ values: Int32) -> Void { +public func _bjs_ArrayRoundtrip_roundtripOptionalArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripOptionalArray(_: { - if values == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() - } - }()) - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripOptionalArray(_: Optional<[Int]>.bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 2d31cd212..b75f9535d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -147,27 +147,7 @@ public class ExportSwift { } else { optionalSwiftType = "JSUndefinedOr" } - if case .array(let elementType) = wrappedType { - let arrayLift = StackCodegen().liftArrayExpression(elementType: elementType) - let isSomeParam = argumentsToLift[0] - let swiftTypeName = elementType.swiftType - typeNameForIntrinsic = "\(optionalSwiftType)<[\(swiftTypeName)]>" - let absentExpr = - kind == .null - ? "\(optionalSwiftType)<[\(swiftTypeName)]>.none" - : "\(optionalSwiftType)<[\(swiftTypeName)]>.undefined" - liftingExpr = ExprSyntax( - """ - { - if \(raw: isSomeParam) == 0 { - return \(raw: absentExpr) - } else { - return \(arrayLift) - } - }() - """ - ) - } else if case .swiftProtocol(let protocolName) = wrappedType { + if case .swiftProtocol(let protocolName) = wrappedType { let wrapperName = "Any\(protocolName)" typeNameForIntrinsic = "\(optionalSwiftType)<\(wrapperName)>" liftingExpr = ExprSyntax( @@ -919,43 +899,11 @@ struct StackCodegen { let typeName = kind == .null ? "Optional" : "JSUndefinedOr" switch wrappedType { case .string, .int, .uint, .bool, .float, .double, .jsObject(nil), .jsValue, - .swiftStruct, .swiftHeapObject, .caseEnum, .associatedValueEnum, .rawValueEnum: + .swiftStruct, .swiftHeapObject, .caseEnum, .associatedValueEnum, .rawValueEnum, + .array, .dictionary: return "\(raw: typeName)<\(raw: wrappedType.swiftType)>.bridgeJSLiftParameter()" case .jsObject(let className?): return "\(raw: typeName).bridgeJSLiftParameter().map { \(raw: className)(unsafelyWrapping: $0) }" - case .array(let elementType): - let arrayLift = liftArrayExpression(elementType: elementType) - let swiftTypeName = elementType.swiftType - let absentExpr = - kind == .null - ? "\(typeName)<[\(swiftTypeName)]>.none" : "\(typeName)<[\(swiftTypeName)]>.undefined" - return """ - { - let __isSome = _swift_js_pop_i32() - if __isSome == 0 { - return \(raw: absentExpr) - } else { - return \(arrayLift) - } - }() - """ - case .dictionary(let valueType): - let dictionaryLift = liftDictionaryExpression(valueType: valueType) - let swiftTypeName = valueType.swiftType - let absentExpr = - kind == .null - ? "\(typeName)<[String: \(swiftTypeName)]>.none" - : "\(typeName)<[String: \(swiftTypeName)]>.undefined" - return """ - { - let __isSome = _swift_js_pop_i32() - if __isSome == 0 { - return \(raw: absentExpr) - } else { - return \(dictionaryLift) - } - }() - """ case .nullable, .void, .namespaceEnum, .closure, .unsafePointer, .swiftProtocol: fatalError("Invalid nullable wrapped type: \(wrappedType)") } @@ -1112,6 +1060,13 @@ struct StackCodegen { accessor: String, varPrefix: String ) -> [CodeBlockItemSyntax] { + switch wrappedType { + case .array, .dictionary, .swiftStruct: + return ["\(raw: accessor).bridgeJSLowerReturn()"] + default: + break + } + var statements: [String] = [] statements.append("let __bjs_isSome_\(varPrefix) = \(accessor) != nil") statements.append("if let __bjs_unwrapped_\(varPrefix) = \(accessor) {") @@ -1140,23 +1095,15 @@ struct StackCodegen { case .string, .int, .uint, .bool, .float, .double, .jsValue: return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] case .caseEnum, .rawValueEnum: - // Enums conform to _BridgedSwiftStackType return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] - case .swiftStruct: - return ["\(raw: unwrappedVar).bridgeJSLowerReturn()"] case .swiftHeapObject: return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] case .associatedValueEnum: - // Push payloads via bridgeJSLowerParameter(), then push the returned case ID return ["_swift_js_push_i32(\(raw: unwrappedVar).bridgeJSLowerParameter())"] case .jsObject(nil): return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] case .jsObject(_?): return ["\(raw: unwrappedVar).jsObject.bridgeJSLowerStackReturn()"] - case .array(let elementType): - return lowerArrayStatements(elementType: elementType, accessor: unwrappedVar, varPrefix: varPrefix) - case .dictionary(let valueType): - return lowerDictionaryStatements(valueType: valueType, accessor: unwrappedVar, varPrefix: varPrefix) default: return ["preconditionFailure(\"BridgeJS: unsupported optional wrapped type\")"] } @@ -1834,8 +1781,12 @@ extension BridgeType { case .swiftProtocol: return .jsObject case .void: return .void case .nullable(let wrappedType, _): + let wrappedInfo = try wrappedType.liftParameterInfo() + if wrappedInfo.parameters.isEmpty { + return LiftingIntrinsicInfo(parameters: []) + } var optionalParams: [(name: String, type: WasmCoreType)] = [("isSome", .i32)] - optionalParams.append(contentsOf: try wrappedType.liftParameterInfo().parameters) + optionalParams.append(contentsOf: wrappedInfo.parameters) return LiftingIntrinsicInfo(parameters: optionalParams) case .caseEnum: return .caseEnum case .rawValueEnum(_, let rawType): diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 9f1eddfdd..1e384d833 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -832,7 +832,8 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") - return ["+\(isSomeVar)"] + printer.write("\(JSGlueVariableScope.reservedI32Stack).push(+\(isSomeVar));") + return [] case .string, .rawValueEnum(_, .string): let bytesVar = scope.variable("\(value)Bytes") let idVar = scope.variable("\(value)Id") @@ -895,7 +896,8 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") - return ["+\(isSomeVar)"] + printer.write("\(JSGlueVariableScope.reservedI32Stack).push(+\(isSomeVar));") + return [] case .dictionary(let valueType): let cleanupArrayVar = scope.variable("\(value)Cleanups") printer.write("const \(cleanupArrayVar) = [];") @@ -915,7 +917,8 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") - return ["+\(isSomeVar)"] + printer.write("\(JSGlueVariableScope.reservedI32Stack).push(+\(isSomeVar));") + return [] default: switch wrappedType { case .swiftHeapObject: diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift index 261c0b066..243c99b7c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift @@ -277,20 +277,10 @@ public func _bjs_processOptionalStringArray() -> Void { @_expose(wasm, "bjs_processOptionalArray") @_cdecl("bjs_processOptionalArray") -public func _bjs_processOptionalArray(_ values: Int32) -> Void { +public func _bjs_processOptionalArray() -> Void { #if arch(wasm32) - let ret = processOptionalArray(_: { - if values == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() - } - }()) - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + let ret = processOptionalArray(_: Optional<[Int]>.bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -311,11 +301,7 @@ public func _bjs_processOptionalPointArray() -> Void { return __result }()) for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + __bjs_elem_ret.bridgeJSLowerReturn() } _swift_js_push_i32(Int32(ret.count)) #else diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift index 4c4c69c99..16cae49e8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift @@ -294,9 +294,9 @@ public func _bjs_testEmptyInit(_ greeter: UnsafeMutableRawPointer) -> UnsafeMuta @_expose(wasm, "bjs_testOptionalStructDefault") @_cdecl("bjs_testOptionalStructDefault") -public func _bjs_testOptionalStructDefault(_ point: Int32) -> Void { +public func _bjs_testOptionalStructDefault() -> Void { #if arch(wasm32) - let ret = testOptionalStructDefault(point: Optional.bridgeJSLiftParameter(point)) + let ret = testOptionalStructDefault(point: Optional.bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -305,9 +305,9 @@ public func _bjs_testOptionalStructDefault(_ point: Int32) -> Void { @_expose(wasm, "bjs_testOptionalStructWithValueDefault") @_cdecl("bjs_testOptionalStructWithValueDefault") -public func _bjs_testOptionalStructWithValueDefault(_ point: Int32) -> Void { +public func _bjs_testOptionalStructWithValueDefault() -> Void { #if arch(wasm32) - let ret = testOptionalStructWithValueDefault(point: Optional.bridgeJSLiftParameter(point)) + let ret = testOptionalStructWithValueDefault(point: Optional.bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.swift index 2a41c35a7..016a5f814 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.swift @@ -11,9 +11,9 @@ public func _bjs_mirrorDictionary() -> Void { @_expose(wasm, "bjs_optionalDictionary") @_cdecl("bjs_optionalDictionary") -public func _bjs_optionalDictionary(_ values: Int32) -> Void { +public func _bjs_optionalDictionary() -> Void { #if arch(wasm32) - let ret = optionalDictionary(_: Optional<[String: String]>.bridgeJSLiftParameter(values)) + let ret = optionalDictionary(_: Optional<[String: String]>.bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift index f2029749c..a21c766c0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift @@ -617,14 +617,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { case 3: return .optNestedEnum(Optional.bridgeJSLiftParameter()) case 4: - return .optArray({ - let __isSome = _swift_js_pop_i32() - if __isSome == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() - } -}()) + return .optArray(Optional<[Int]>.bridgeJSLiftParameter()) case 5: return .empty default: @@ -637,11 +630,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .optStruct(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + param0.bridgeJSLowerReturn() return Int32(0) case .optClass(let param0): let __bjs_isSome_param0 = param0 != nil @@ -665,11 +654,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) case .optArray(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + param0.bridgeJSLowerReturn() return Int32(4) case .empty: return Int32(5) @@ -689,11 +674,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .optStruct(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + param0.bridgeJSLowerReturn() _swift_js_push_tag(Int32(0)) case .optClass(let param0): let __bjs_isSome_param0 = param0 != nil @@ -717,11 +698,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(3)) case .optArray(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + param0.bridgeJSLowerReturn() _swift_js_push_tag(Int32(4)) case .empty: _swift_js_push_tag(Int32(5)) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift index b4e45bbc9..931605a50 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift @@ -33,20 +33,10 @@ public func _bjs_roundTripJSValueArray() -> Void { @_expose(wasm, "bjs_roundTripOptionalJSValueArray") @_cdecl("bjs_roundTripOptionalJSValueArray") -public func _bjs_roundTripOptionalJSValueArray(_ values: Int32) -> Void { +public func _bjs_roundTripOptionalJSValueArray() -> Void { #if arch(wasm32) - let ret = roundTripOptionalJSValueArray(_: { - if values == 0 { - return Optional<[JSValue]>.none - } else { - return [JSValue].bridgeJSLiftParameter() - } - }()) - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + let ret = roundTripOptionalJSValueArray(_: Optional<[JSValue]>.bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index d858d8e38..a381f5569 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -673,7 +673,8 @@ export async function createInstantiator(options, swift) { i32Stack.push(values.length); valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); } - instance.exports.bjs_processOptionalArray(+isSome); + i32Stack.push(+isSome); + instance.exports.bjs_processOptionalArray(); const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 079618bbf..04335c58c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -521,7 +521,8 @@ export async function createInstantiator(options, swift) { const structResult = structHelpers.Config.lower(point); pointCleanup = structResult.cleanup; } - instance.exports.bjs_testOptionalStructDefault(+isSome); + i32Stack.push(+isSome); + instance.exports.bjs_testOptionalStructDefault(); const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { @@ -539,7 +540,8 @@ export async function createInstantiator(options, swift) { const structResult = structHelpers.Config.lower(point); pointCleanup = structResult.cleanup; } - instance.exports.bjs_testOptionalStructWithValueDefault(+isSome); + i32Stack.push(+isSome); + instance.exports.bjs_testOptionalStructWithValueDefault(); const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index 54f00021d..a77407eca 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -327,7 +327,8 @@ export async function createInstantiator(options, swift) { i32Stack.push(entries.length); valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); } - instance.exports.bjs_optionalDictionary(+isSome); + i32Stack.push(+isSome); + instance.exports.bjs_optionalDictionary(); const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index 888a11a4c..f6e4bf8aa 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -507,7 +507,8 @@ export async function createInstantiator(options, swift) { i32Stack.push(values.length); valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); } - instance.exports.bjs_roundTripOptionalJSValueArray(+isSome); + i32Stack.push(+isSome); + instance.exports.bjs_roundTripOptionalJSValueArray(); const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 496b515c9..d1390a610 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -623,7 +623,7 @@ extension _BridgedSwiftAssociatedValueEnum { /// A protocol that Swift struct types conform to. /// /// The conformance is automatically synthesized by the BridgeJS code generator. -public protocol _BridgedSwiftStruct: _BridgedSwiftTypeLoweredIntoVoidType, _BridgedSwiftStackType { +public protocol _BridgedSwiftStruct: _BridgedSwiftTypeLoweredIntoVoidType, _BridgedSwiftGenericOptionalStackType { // MARK: ExportSwift @_spi(BridgeJS) static func bridgeJSLiftParameter() -> Self @_spi(BridgeJS) consuming func bridgeJSLowerReturn() -> Void @@ -1463,11 +1463,6 @@ extension Optional where Wrapped == [JSValue] { return [JSValue].bridgeJSLiftParameter() } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> [JSValue]? { - let isSome = _swift_js_pop_i32() - return bridgeJSLiftParameter(isSome) - } - @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> [JSValue]? { let isSome = _swift_js_pop_i32() if isSome == 0 { @@ -1741,17 +1736,6 @@ public protocol _BridgedSwiftTypeLoweredIntoVoidType { consuming func bridgeJSLowerReturn() -> Void } -extension Optional where Wrapped: _BridgedSwiftTypeLoweredIntoVoidType { - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - switch consume self { - case .none: - () - case .some(let value): - value.bridgeJSLowerReturn() - } - } -} - // MARK: Optional Raw Value Enum Support extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == String { @@ -1989,8 +1973,6 @@ extension Optional where Wrapped: _BridgedSwiftAssociatedValueEnum { // MARK: Optional Struct Support extension Optional where Wrapped: _BridgedSwiftStruct { - // MARK: ExportSwift - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32) -> Wrapped? { if isSome == 0 { return nil @@ -1998,19 +1980,40 @@ extension Optional where Wrapped: _BridgedSwiftStruct { return Wrapped.bridgeJSLiftParameter() } } +} + +// MARK: - Generic Optional Stack Support + +/// Marker protocol for types whose Optional wrapper should use the generic +/// stack-based ABI (`_BridgedSwiftStackType`). Only Array, Dictionary, and +/// `_BridgedSwiftStruct` conform. Primitives and other types keep their +/// own type-specific Optional extensions. +public protocol _BridgedSwiftGenericOptionalStackType: _BridgedSwiftStackType +where StackLiftResult == Self {} + +extension Optional: _BridgedSwiftStackType +where Wrapped: _BridgedSwiftGenericOptionalStackType { + public typealias StackLiftResult = Wrapped? @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { let isSome = _swift_js_pop_i32() - return bridgeJSLiftParameter(isSome) + if isSome == 0 { + return nil + } + return Wrapped.bridgeJSLiftParameter() + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + bridgeJSLowerReturn() } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { switch consume self { case .none: - _swift_js_push_i32(0) // Push only isSome=0 (no struct fields) + _swift_js_push_i32(0) case .some(let value): - value.bridgeJSLowerReturn() // Push all struct fields FIRST - _swift_js_push_i32(1) // Then push isSome=1 LAST (so it's popped FIRST by JS) + value.bridgeJSLowerStackReturn() + _swift_js_push_i32(1) } } } @@ -2235,12 +2238,6 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftCaseEnum { } } -extension _BridgedAsOptional where Wrapped: _BridgedSwiftTypeLoweredIntoVoidType { - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - asOptional.bridgeJSLowerReturn() - } -} - extension _BridgedAsOptional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == String { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { @@ -2390,6 +2387,8 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftStruct { // MARK: - Array Support +extension Array: _BridgedSwiftGenericOptionalStackType +where Element: _BridgedSwiftStackType, Element.StackLiftResult == Element {} extension Array: _BridgedSwiftStackType where Element: _BridgedSwiftStackType, Element.StackLiftResult == Element { public typealias StackLiftResult = [Element] @@ -2427,11 +2426,15 @@ extension Array: _BridgedSwiftStackType where Element: _BridgedSwiftStackType, E // MARK: - Dictionary Support -public protocol _BridgedSwiftDictionaryStackType: _BridgedSwiftTypeLoweredIntoVoidType { +public protocol _BridgedSwiftDictionaryStackType: _BridgedSwiftTypeLoweredIntoVoidType, + _BridgedSwiftGenericOptionalStackType +{ associatedtype DictionaryValue: _BridgedSwiftStackType where DictionaryValue.StackLiftResult == DictionaryValue } +extension Dictionary: _BridgedSwiftGenericOptionalStackType +where Key == String, Value: _BridgedSwiftStackType, Value.StackLiftResult == Value {} extension Dictionary: _BridgedSwiftStackType where Key == String, Value: _BridgedSwiftStackType, Value.StackLiftResult == Value { public typealias StackLiftResult = [String: Value] @@ -2492,16 +2495,6 @@ extension Optional where Wrapped: _BridgedSwiftDictionaryStackType { } } - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { - switch consume self { - case .none: - _swift_js_push_i32(0) - case .some(let dict): - dict.bridgeJSLowerReturn() - _swift_js_push_i32(1) - } - } - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32) -> [String: Wrapped.DictionaryValue]? { if isSome == 0 { return nil @@ -2509,10 +2502,6 @@ extension Optional where Wrapped: _BridgedSwiftDictionaryStackType { return Dictionary.bridgeJSLiftParameter() } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> [String: Wrapped.DictionaryValue]? { - bridgeJSLiftParameter(_swift_js_pop_i32()) - } - @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> [String: Wrapped.DictionaryValue]? { let isSome = _swift_js_pop_i32() if isSome == 0 { @@ -2542,4 +2531,8 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftDictionaryStackType { let value = Dictionary.bridgeJSLiftParameter() as! Wrapped return Self(optional: value) } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + asOptional.bridgeJSLowerReturn() + } } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index af9f15dbc..9465040a9 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2814,14 +2814,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { case 3: return .optNestedEnum(Optional.bridgeJSLiftParameter()) case 4: - return .optArray({ - let __isSome = _swift_js_pop_i32() - if __isSome == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() - } -}()) + return .optArray(Optional<[Int]>.bridgeJSLiftParameter()) case 5: return .optJsClass(Optional.bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) }) case 6: @@ -2836,11 +2829,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { switch self { case .optStruct(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + param0.bridgeJSLowerReturn() return Int32(0) case .optClass(let param0): let __bjs_isSome_param0 = param0 != nil @@ -2864,11 +2853,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) case .optArray(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + param0.bridgeJSLowerReturn() return Int32(4) case .optJsClass(let param0): let __bjs_isSome_param0 = param0 != nil @@ -2895,11 +2880,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { switch self { case .optStruct(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + param0.bridgeJSLowerReturn() _swift_js_push_tag(Int32(0)) case .optClass(let param0): let __bjs_isSome_param0 = param0 != nil @@ -2923,11 +2904,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) _swift_js_push_tag(Int32(3)) case .optArray(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) + param0.bridgeJSLowerReturn() _swift_js_push_tag(Int32(4)) case .optJsClass(let param0): let __bjs_isSome_param0 = param0 != nil @@ -3298,11 +3275,7 @@ extension Contact: _BridgedSwiftStruct { __bjs_unwrapped_email.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_email ? 1 : 0) - let __bjs_isSome_secondaryAddress = self.secondaryAddress != nil - if let __bjs_unwrapped_secondaryAddress = self.secondaryAddress { - __bjs_unwrapped_secondaryAddress.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_secondaryAddress ? 1 : 0) + self.secondaryAddress.bridgeJSLowerReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -3532,17 +3505,9 @@ extension AdvancedConfig: _BridgedSwiftStruct { __bjs_unwrapped_metadata.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_metadata ? 1 : 0) - let __bjs_isSome_location = self.location != nil - if let __bjs_unwrapped_location = self.location { - __bjs_unwrapped_location.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_location ? 1 : 0) + self.location.bridgeJSLowerReturn() self.defaults.bridgeJSLowerReturn() - let __bjs_isSome_overrideDefaults = self.overrideDefaults != nil - if let __bjs_unwrapped_overrideDefaults = self.overrideDefaults { - __bjs_unwrapped_overrideDefaults.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_overrideDefaults ? 1 : 0) + self.overrideDefaults.bridgeJSLowerReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -3838,11 +3803,7 @@ extension CopyableNestedCart: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { self.id.bridgeJSLowerStackReturn() self.item.bridgeJSLowerReturn() - let __bjs_isSome_shippingAddress = self.shippingAddress != nil - if let __bjs_unwrapped_shippingAddress = self.shippingAddress { - __bjs_unwrapped_shippingAddress.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_shippingAddress ? 1 : 0) + self.shippingAddress.bridgeJSLowerReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -4098,25 +4059,14 @@ fileprivate func _bjs_struct_lift_FooContainer() -> Int32 { extension ArrayMembers: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ArrayMembers { - let optStrings = { - let __isSome = _swift_js_pop_i32() - if __isSome == 0 { - return Optional<[String]>.none - } else { - return [String].bridgeJSLiftParameter() - } -}() + let optStrings = Optional<[String]>.bridgeJSLiftParameter() let ints = [Int].bridgeJSLiftParameter() return ArrayMembers(ints: ints, optStrings: optStrings) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { self.ints.bridgeJSLowerReturn() - let __bjs_isSome_optStrings = self.optStrings != nil - if let __bjs_unwrapped_optStrings = self.optStrings { - __bjs_unwrapped_optStrings.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_optStrings ? 1 : 0) + self.optStrings.bridgeJSLowerReturn() } init(unsafelyCopying jsObject: JSObject) { @@ -4340,9 +4290,9 @@ public func _bjs_roundTripDictionaryExport() -> Void { @_expose(wasm, "bjs_roundTripOptionalDictionaryExport") @_cdecl("bjs_roundTripOptionalDictionaryExport") -public func _bjs_roundTripOptionalDictionaryExport(_ v: Int32) -> Void { +public func _bjs_roundTripOptionalDictionaryExport() -> Void { #if arch(wasm32) - let ret = roundTripOptionalDictionaryExport(v: Optional<[String: String]>.bridgeJSLiftParameter(v)) + let ret = roundTripOptionalDictionaryExport(v: Optional<[String: String]>.bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -4384,20 +4334,10 @@ public func _bjs_roundTripJSValueArray() -> Void { @_expose(wasm, "bjs_roundTripOptionalJSValueArray") @_cdecl("bjs_roundTripOptionalJSValueArray") -public func _bjs_roundTripOptionalJSValueArray(_ v: Int32) -> Void { +public func _bjs_roundTripOptionalJSValueArray() -> Void { #if arch(wasm32) - let ret = roundTripOptionalJSValueArray(v: { - if v == 0 { - return Optional<[JSValue]>.none - } else { - return [JSValue].bridgeJSLiftParameter() - } - }()) - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + let ret = roundTripOptionalJSValueArray(v: Optional<[JSValue]>.bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -5413,15 +5353,9 @@ public func _bjs_arrayWithDefault() -> Int32 { @_expose(wasm, "bjs_arrayWithOptionalDefault") @_cdecl("bjs_arrayWithOptionalDefault") -public func _bjs_arrayWithOptionalDefault(_ values: Int32) -> Int32 { +public func _bjs_arrayWithOptionalDefault() -> Int32 { #if arch(wasm32) - let ret = arrayWithOptionalDefault(_: { - if values == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() - } - }()) + let ret = arrayWithOptionalDefault(_: Optional<[Int]>.bridgeJSLiftParameter()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5651,11 +5585,7 @@ public func _bjs_roundTripOptionalDataPointArray() -> Void { return __result }()) for __bjs_elem_ret in ret { - let __bjs_isSome_ret_elem = __bjs_elem_ret != nil - if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) + __bjs_elem_ret.bridgeJSLowerReturn() } _swift_js_push_i32(Int32(ret.count)) #else @@ -5719,20 +5649,10 @@ public func _bjs_roundTripOptionalStatusArray() -> Void { @_expose(wasm, "bjs_roundTripOptionalIntArrayType") @_cdecl("bjs_roundTripOptionalIntArrayType") -public func _bjs_roundTripOptionalIntArrayType(_ values: Int32) -> Void { +public func _bjs_roundTripOptionalIntArrayType() -> Void { #if arch(wasm32) - let ret = roundTripOptionalIntArrayType(_: { - if values == 0 { - return Optional<[Int]>.none - } else { - return [Int].bridgeJSLiftParameter() - } - }()) - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + let ret = roundTripOptionalIntArrayType(_: Optional<[Int]>.bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -5740,20 +5660,10 @@ public func _bjs_roundTripOptionalIntArrayType(_ values: Int32) -> Void { @_expose(wasm, "bjs_roundTripOptionalStringArrayType") @_cdecl("bjs_roundTripOptionalStringArrayType") -public func _bjs_roundTripOptionalStringArrayType(_ values: Int32) -> Void { +public func _bjs_roundTripOptionalStringArrayType() -> Void { #if arch(wasm32) - let ret = roundTripOptionalStringArrayType(_: { - if values == 0 { - return Optional<[String]>.none - } else { - return [String].bridgeJSLiftParameter() - } - }()) - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + let ret = roundTripOptionalStringArrayType(_: Optional<[String]>.bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -5761,20 +5671,10 @@ public func _bjs_roundTripOptionalStringArrayType(_ values: Int32) -> Void { @_expose(wasm, "bjs_roundTripOptionalGreeterArrayType") @_cdecl("bjs_roundTripOptionalGreeterArrayType") -public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { +public func _bjs_roundTripOptionalGreeterArrayType() -> Void { #if arch(wasm32) - let ret = roundTripOptionalGreeterArrayType(_: { - if greeters == 0 { - return Optional<[Greeter]>.none - } else { - return [Greeter].bridgeJSLiftParameter() - } - }()) - let __bjs_isSome_ret = ret != nil - if let __bjs_unwrapped_ret = ret { - __bjs_unwrapped_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(__bjs_isSome_ret ? 1 : 0) + let ret = roundTripOptionalGreeterArrayType(_: Optional<[Greeter]>.bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -9006,9 +8906,9 @@ fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPoi @_expose(wasm, "bjs_Container_init") @_cdecl("bjs_Container_init") -public func _bjs_Container_init(_ config: Int32) -> UnsafeMutableRawPointer { +public func _bjs_Container_init() -> UnsafeMutableRawPointer { #if arch(wasm32) - let _tmp_config = Optional.bridgeJSLiftParameter(config) + let _tmp_config = Optional.bridgeJSLiftParameter() let _tmp_location = DataPoint.bridgeJSLiftParameter() let ret = Container(location: _tmp_location, config: _tmp_config) return ret.bridgeJSLowerReturn() @@ -9051,9 +8951,9 @@ public func _bjs_Container_config_get(_ _self: UnsafeMutableRawPointer) -> Void @_expose(wasm, "bjs_Container_config_set") @_cdecl("bjs_Container_config_set") -public func _bjs_Container_config_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { +public func _bjs_Container_config_set(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - Container.bridgeJSLiftParameter(_self).config = Optional.bridgeJSLiftParameter(value) + Container.bridgeJSLiftParameter(_self).config = Optional.bridgeJSLiftParameter() #else fatalError("Only available on WebAssembly") #endif From 38af37b56002e9185834905f4494b34da25518f2 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 11 Feb 2026 21:12:39 +0100 Subject: [PATCH 201/252] BridgeJS: Delegate nested container codegen to generic runtime conformances --- Benchmarks/Sources/Generated/BridgeJS.swift | 64 ++-------- .../Sources/BridgeJSCore/ExportSwift.swift | 40 +++---- .../BridgeJSCodegenTests/ArrayTypes.swift | 80 ++----------- .../Generated/BridgeJS.swift | 112 +++--------------- 4 files changed, 48 insertions(+), 248 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 515d3a531..da7d155e1 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -1565,16 +1565,7 @@ public func _bjs_ArrayRoundtrip_makePointArrayLarge(_ _self: UnsafeMutableRawPoi @_cdecl("bjs_ArrayRoundtrip_takeNestedIntArray") public func _bjs_ArrayRoundtrip_takeNestedIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedIntArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Int]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([Int].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedIntArray(_: [[Int]].bridgeJSLiftParameter()) #else fatalError("Only available on WebAssembly") #endif @@ -1585,10 +1576,7 @@ public func _bjs_ArrayRoundtrip_takeNestedIntArray(_ _self: UnsafeMutableRawPoin public func _bjs_ArrayRoundtrip_makeNestedIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeNestedIntArray() - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1598,20 +1586,8 @@ public func _bjs_ArrayRoundtrip_makeNestedIntArray(_ _self: UnsafeMutableRawPoin @_cdecl("bjs_ArrayRoundtrip_roundtripNestedIntArray") public func _bjs_ArrayRoundtrip_roundtripNestedIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedIntArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Int]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([Int].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedIntArray(_: [[Int]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1621,16 +1597,7 @@ public func _bjs_ArrayRoundtrip_roundtripNestedIntArray(_ _self: UnsafeMutableRa @_cdecl("bjs_ArrayRoundtrip_takeNestedPointArray") public func _bjs_ArrayRoundtrip_takeNestedPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedPointArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Point]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([Point].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedPointArray(_: [[Point]].bridgeJSLiftParameter()) #else fatalError("Only available on WebAssembly") #endif @@ -1641,10 +1608,7 @@ public func _bjs_ArrayRoundtrip_takeNestedPointArray(_ _self: UnsafeMutableRawPo public func _bjs_ArrayRoundtrip_makeNestedPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeNestedPointArray() - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -1654,20 +1618,8 @@ public func _bjs_ArrayRoundtrip_makeNestedPointArray(_ _self: UnsafeMutableRawPo @_cdecl("bjs_ArrayRoundtrip_roundtripNestedPointArray") public func _bjs_ArrayRoundtrip_roundtripNestedPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedPointArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Point]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([Point].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedPointArray(_: [[Point]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 2d31cd212..ca9689607 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -838,18 +838,16 @@ struct StackCodegen { func liftArrayExpression(elementType: BridgeType) -> ExprSyntax { switch elementType { - case .int, .uint, .float, .double, .string, .bool, .jsValue, - .jsObject(nil), .swiftStruct, .caseEnum, .swiftHeapObject, - .unsafePointer, .rawValueEnum, .associatedValueEnum: - return "[\(raw: elementType.swiftType)].bridgeJSLiftParameter()" - case .jsObject(_?): + case .jsObject(let className?) where className != "JSObject": return liftArrayExpressionInline(elementType: elementType) case .swiftProtocol(let protocolName): return "[Any\(raw: protocolName)].bridgeJSLiftParameter()" - case .nullable, .array, .closure, .dictionary: + case .nullable, .closure: return liftArrayExpressionInline(elementType: elementType) case .void, .namespaceEnum: fatalError("Invalid array element type: \(elementType)") + default: + return "[\(raw: elementType.swiftType)].bridgeJSLiftParameter()" } } @@ -872,11 +870,7 @@ struct StackCodegen { func liftDictionaryExpression(valueType: BridgeType) -> ExprSyntax { switch valueType { - case .int, .uint, .float, .double, .string, .bool, .jsValue, - .jsObject(nil), .swiftStruct, .caseEnum, .swiftHeapObject, - .unsafePointer, .rawValueEnum, .associatedValueEnum: - return "[String: \(raw: valueType.swiftType)].bridgeJSLiftParameter()" - case .jsObject(let className?): + case .jsObject(let className?) where className != "JSObject": return """ { let __dict = [String: JSObject].bridgeJSLiftParameter() @@ -890,10 +884,12 @@ struct StackCodegen { return __dict.mapValues { $0 as! Any\(raw: protocolName) } }() """ - case .nullable, .array, .dictionary, .closure: + case .nullable, .closure: return liftDictionaryExpressionInline(valueType: valueType) case .void, .namespaceEnum: fatalError("Invalid dictionary value type: \(valueType)") + default: + return "[String: \(raw: valueType.swiftType)].bridgeJSLiftParameter()" } } @@ -1005,15 +1001,11 @@ struct StackCodegen { varPrefix: String ) -> [CodeBlockItemSyntax] { switch elementType { - case .int, .uint, .float, .double, .string, .bool, .jsValue, - .jsObject(nil), .swiftStruct, .caseEnum, .swiftHeapObject, - .unsafePointer, .rawValueEnum, .associatedValueEnum: - return ["\(raw: accessor).bridgeJSLowerReturn()"] - case .jsObject(_?): + case .jsObject(let className?) where className != "JSObject": return ["\(raw: accessor).map { $0.jsObject }.bridgeJSLowerReturn()"] case .swiftProtocol(let protocolName): return ["\(raw: accessor).map { $0 as! Any\(raw: protocolName) }.bridgeJSLowerReturn()"] - case .nullable, .array, .closure, .dictionary: + case .nullable, .closure: return lowerArrayStatementsInline( elementType: elementType, accessor: accessor, @@ -1021,6 +1013,8 @@ struct StackCodegen { ) case .void, .namespaceEnum: fatalError("Invalid array element type: \(elementType)") + default: + return ["\(raw: accessor).bridgeJSLowerReturn()"] } } @@ -1054,15 +1048,11 @@ struct StackCodegen { varPrefix: String ) -> [CodeBlockItemSyntax] { switch valueType { - case .int, .uint, .float, .double, .string, .bool, .jsValue, - .jsObject(nil), .swiftStruct, .caseEnum, .swiftHeapObject, - .unsafePointer, .rawValueEnum, .associatedValueEnum: - return ["\(raw: accessor).bridgeJSLowerReturn()"] - case .jsObject(_?): + case .jsObject(let className?) where className != "JSObject": return ["\(raw: accessor).mapValues { $0.jsObject }.bridgeJSLowerReturn()"] case .swiftProtocol(let protocolName): return ["\(raw: accessor).mapValues { $0 as! Any\(raw: protocolName) }.bridgeJSLowerReturn()"] - case .nullable, .array, .dictionary, .closure: + case .nullable, .closure: return lowerDictionaryStatementsInline( valueType: valueType, accessor: accessor, @@ -1070,6 +1060,8 @@ struct StackCodegen { ) case .void, .namespaceEnum: fatalError("Invalid dictionary value type: \(valueType)") + default: + return ["\(raw: accessor).bridgeJSLowerReturn()"] } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift index 261c0b066..6b10c0fe7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift @@ -381,20 +381,8 @@ public func _bjs_processOptionalStatusArray() -> Void { @_cdecl("bjs_processNestedIntArray") public func _bjs_processNestedIntArray() -> Void { #if arch(wasm32) - let ret = processNestedIntArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Int]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([Int].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = processNestedIntArray(_: [[Int]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -404,20 +392,8 @@ public func _bjs_processNestedIntArray() -> Void { @_cdecl("bjs_processNestedStringArray") public func _bjs_processNestedStringArray() -> Void { #if arch(wasm32) - let ret = processNestedStringArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[String]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([String].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = processNestedStringArray(_: [[String]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -427,20 +403,8 @@ public func _bjs_processNestedStringArray() -> Void { @_cdecl("bjs_processNestedPointArray") public func _bjs_processNestedPointArray() -> Void { #if arch(wasm32) - let ret = processNestedPointArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Point]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([Point].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = processNestedPointArray(_: [[Point]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -461,20 +425,8 @@ public func _bjs_processItemArray() -> Void { @_cdecl("bjs_processNestedItemArray") public func _bjs_processNestedItemArray() -> Void { #if arch(wasm32) - let ret = processNestedItemArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Item]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([Item].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = processNestedItemArray(_: [[Item]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -522,20 +474,8 @@ public func _bjs_processOptionalJSObjectArray() -> Void { @_cdecl("bjs_processNestedJSObjectArray") public func _bjs_processNestedJSObjectArray() -> Void { #if arch(wasm32) - let ret = processNestedJSObjectArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[JSObject]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([JSObject].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = processNestedJSObjectArray(_: [[JSObject]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index af9f15dbc..c37bce3c9 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -5784,20 +5784,8 @@ public func _bjs_roundTripOptionalGreeterArrayType(_ greeters: Int32) -> Void { @_cdecl("bjs_roundTripNestedIntArray") public func _bjs_roundTripNestedIntArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedIntArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Int]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([Int].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripNestedIntArray(_: [[Int]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -5807,20 +5795,8 @@ public func _bjs_roundTripNestedIntArray() -> Void { @_cdecl("bjs_roundTripNestedStringArray") public func _bjs_roundTripNestedStringArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedStringArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[String]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([String].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripNestedStringArray(_: [[String]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -5830,20 +5806,8 @@ public func _bjs_roundTripNestedStringArray() -> Void { @_cdecl("bjs_roundTripNestedDoubleArray") public func _bjs_roundTripNestedDoubleArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedDoubleArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Double]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([Double].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripNestedDoubleArray(_: [[Double]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -5853,20 +5817,8 @@ public func _bjs_roundTripNestedDoubleArray() -> Void { @_cdecl("bjs_roundTripNestedBoolArray") public func _bjs_roundTripNestedBoolArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedBoolArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Bool]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([Bool].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripNestedBoolArray(_: [[Bool]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -5876,20 +5828,8 @@ public func _bjs_roundTripNestedBoolArray() -> Void { @_cdecl("bjs_roundTripNestedDataPointArray") public func _bjs_roundTripNestedDataPointArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedDataPointArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[DataPoint]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([DataPoint].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripNestedDataPointArray(_: [[DataPoint]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -5899,20 +5839,8 @@ public func _bjs_roundTripNestedDataPointArray() -> Void { @_cdecl("bjs_roundTripNestedDirectionArray") public func _bjs_roundTripNestedDirectionArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedDirectionArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Direction]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([Direction].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripNestedDirectionArray(_: [[Direction]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif @@ -5922,20 +5850,8 @@ public func _bjs_roundTripNestedDirectionArray() -> Void { @_cdecl("bjs_roundTripNestedGreeterArray") public func _bjs_roundTripNestedGreeterArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedGreeterArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [[Greeter]] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append([Greeter].bridgeJSLiftParameter()) - } - __result.reverse() - return __result - }()) - for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() - } - _swift_js_push_i32(Int32(ret.count)) + let ret = roundTripNestedGreeterArray(_: [[Greeter]].bridgeJSLiftParameter()) + ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif From 6716dfc931fa826fe0c7c8163759157453f2ec59 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 12 Feb 2026 14:10:53 +0900 Subject: [PATCH 202/252] [NFC] BridgeJS: Remove tag stack and use i32 stack for enum case tags --- Benchmarks/Sources/Generated/BridgeJS.swift | 26 +++--- .../Sources/BridgeJSCore/ExportSwift.swift | 4 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 6 -- .../Sources/BridgeJSLink/JSGlueGen.swift | 13 +-- .../EnumAssociatedValue.swift | 74 ++++++++--------- .../BridgeJSCodegenTests/Protocol.swift | 4 +- .../StaticFunctions.Global.swift | 4 +- .../StaticFunctions.swift | 4 +- .../BridgeJSCodegenTests/SwiftClosure.swift | 12 +-- .../BridgeJSLinkTests/ArrayTypes.js | 4 - .../__Snapshots__/BridgeJSLinkTests/Async.js | 4 - .../BridgeJSLinkTests/DefaultParameters.js | 4 - .../BridgeJSLinkTests/DictionaryTypes.js | 4 - .../BridgeJSLinkTests/EnumAssociatedValue.js | 38 ++++----- .../BridgeJSLinkTests/EnumCase.js | 4 - .../BridgeJSLinkTests/EnumNamespace.Global.js | 4 - .../BridgeJSLinkTests/EnumNamespace.js | 4 - .../BridgeJSLinkTests/EnumRawType.js | 4 - .../BridgeJSLinkTests/GlobalGetter.js | 4 - .../BridgeJSLinkTests/GlobalThisImports.js | 4 - .../BridgeJSLinkTests/ImportArray.js | 4 - .../ImportedTypeInExportedInterface.js | 4 - .../BridgeJSLinkTests/InvalidPropertyNames.js | 4 - .../BridgeJSLinkTests/JSClass.js | 4 - .../JSClassStaticFunctions.js | 4 - .../BridgeJSLinkTests/JSValue.js | 4 - .../BridgeJSLinkTests/MixedGlobal.js | 4 - .../BridgeJSLinkTests/MixedModules.js | 4 - .../BridgeJSLinkTests/MixedPrivate.js | 4 - .../BridgeJSLinkTests/Namespaces.Global.js | 4 - .../BridgeJSLinkTests/Namespaces.js | 4 - .../BridgeJSLinkTests/Optionals.js | 4 - .../BridgeJSLinkTests/PrimitiveParameters.js | 4 - .../BridgeJSLinkTests/PrimitiveReturn.js | 4 - .../BridgeJSLinkTests/PropertyTypes.js | 4 - .../BridgeJSLinkTests/Protocol.js | 4 - .../StaticFunctions.Global.js | 6 +- .../BridgeJSLinkTests/StaticFunctions.js | 6 +- .../StaticProperties.Global.js | 4 - .../BridgeJSLinkTests/StaticProperties.js | 4 - .../BridgeJSLinkTests/StringParameter.js | 4 - .../BridgeJSLinkTests/StringReturn.js | 4 - .../BridgeJSLinkTests/SwiftClass.js | 4 - .../BridgeJSLinkTests/SwiftClosure.js | 8 +- .../BridgeJSLinkTests/SwiftClosureImports.js | 4 - .../BridgeJSLinkTests/SwiftStruct.js | 4 - .../BridgeJSLinkTests/SwiftStructImports.js | 4 - .../__Snapshots__/BridgeJSLinkTests/Throws.js | 4 - .../BridgeJSLinkTests/UnsafePointer.js | 4 - .../VoidParameterVoidReturn.js | 4 - Plugins/PackageToJS/Templates/instantiate.js | 1 - .../JavaScriptKit/BridgeJSIntrinsics.swift | 11 +-- .../Generated/BridgeJS.swift | 80 +++++++++---------- 53 files changed, 130 insertions(+), 315 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index fe655a96f..cdd3aa775 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -65,21 +65,21 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .failure(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .flag(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) case .rate(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(3)) + _swift_js_push_i32(Int32(3)) case .precise(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(4)) + _swift_js_push_i32(Int32(4)) case .info: - _swift_js_push_tag(Int32(5)) + _swift_js_push_i32(Int32(5)) } } } @@ -162,26 +162,26 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .error(let param0, let param1): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .location(let param0, let param1, let param2): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) case .status(let param0, let param1, let param2): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(3)) + _swift_js_push_i32(Int32(3)) case .coordinates(let param0, let param1, let param2): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(4)) + _swift_js_push_i32(Int32(4)) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() @@ -192,9 +192,9 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { param6.bridgeJSLowerStackReturn() param7.bridgeJSLowerStackReturn() param8.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(5)) + _swift_js_push_i32(Int32(5)) case .info: - _swift_js_push_tag(Int32(6)) + _swift_js_push_i32(Int32(6)) } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index d44e9afbf..304ded82b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1323,7 +1323,7 @@ struct EnumCodegen { if enumCase.associatedValues.isEmpty { printer.write("case .\(enumCase.name):") printer.indent { - printer.write("_swift_js_push_tag(Int32(\(caseIndex)))") + printer.write("_swift_js_push_i32(Int32(\(caseIndex)))") } } else { let pattern = enumCase.associatedValues.enumerated() @@ -1334,7 +1334,7 @@ struct EnumCodegen { generatePayloadPushingCode(printer: printer, associatedValues: enumCase.associatedValues) // Push tag AFTER payloads so it's popped first (LIFO) by the JS lift function. // This ensures nested enum tags don't overwrite the outer tag. - printer.write("_swift_js_push_tag(Int32(\(caseIndex)))") + printer.write("_swift_js_push_i32(Int32(\(caseIndex)))") } } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index af5c94276..44b6f0c38 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -246,7 +246,6 @@ public struct BridgeJSLink { "let \(JSGlueVariableScope.reservedStorageToReturnOptionalFloat);", "let \(JSGlueVariableScope.reservedStorageToReturnOptionalDouble);", "let \(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject);", - "let \(JSGlueVariableScope.reservedTagStack) = [];", "let \(JSGlueVariableScope.reservedStringStack) = [];", "let \(JSGlueVariableScope.reservedI32Stack) = [];", "let \(JSGlueVariableScope.reservedF32Stack) = [];", @@ -342,11 +341,6 @@ public struct BridgeJSLink { printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(id);") } printer.write("}") - printer.write("bjs[\"swift_js_push_tag\"] = function(tag) {") - printer.indent { - printer.write("\(JSGlueVariableScope.reservedTagStack).push(tag);") - } - printer.write("}") printer.write("bjs[\"swift_js_push_i32\"] = function(v) {") printer.indent { printer.write("\(JSGlueVariableScope.reservedI32Stack).push(v | 0);") diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 1e384d833..36d463ab4 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -23,7 +23,6 @@ final class JSGlueVariableScope { static let reservedStorageToReturnOptionalHeapObject = "tmpRetOptionalHeapObject" static let reservedTextEncoder = "textEncoder" static let reservedTextDecoder = "textDecoder" - static let reservedTagStack = "tagStack" static let reservedStringStack = "strStack" static let reservedI32Stack = "i32Stack" static let reservedF32Stack = "f32Stack" @@ -52,7 +51,6 @@ final class JSGlueVariableScope { reservedStorageToReturnOptionalHeapObject, reservedTextEncoder, reservedTextDecoder, - reservedTagStack, reservedStringStack, reservedI32Stack, reservedF32Stack, @@ -122,9 +120,6 @@ extension JSGlueVariableScope { func emitPushPointerReturn(_ value: String, printer: CodeFragmentPrinter) { printer.write("\(JSGlueVariableScope.reservedPointerStack).push(\(value));") } - func popTag() -> String { - return "\(JSGlueVariableScope.reservedTagStack).pop()" - } func popString() -> String { return "\(JSGlueVariableScope.reservedStringStack).pop()" } @@ -661,7 +656,7 @@ struct IntrinsicJSFragment: Sendable { let (scope, printer) = (context.scope, context.printer) let retName = scope.variable("ret") printer.write( - "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lift(\(scope.popTag()));" + "const \(retName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lift(\(scope.popI32()));" ) return [retName] } @@ -1022,7 +1017,7 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName let tagVar = scope.variable("tag") - printer.write("const \(tagVar) = \(scope.popTag());") + printer.write("const \(tagVar) = \(scope.popI32());") let isNullVar = scope.variable("isNull") printer.write("const \(isNullVar) = (\(tagVar) === -1);") printer.write("let \(resultVar);") @@ -2112,7 +2107,7 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") try printer.indent { // For optional associated value enums, Swift uses bridgeJSLowerParameter() - // which pushes caseId to i32Stack (not tagStack like bridgeJSLowerReturn()). + // which pushes caseId to i32Stack (same as bridgeJSLowerReturn()). if case .associatedValueEnum(let fullName) = wrappedType { let base = fullName.components(separatedBy: ".").last ?? fullName let caseIdVar = scope.variable("caseId") @@ -2486,7 +2481,7 @@ struct IntrinsicJSFragment: Sendable { let (scope, printer) = (context.scope, context.printer) let resultVar = scope.variable("enumValue") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popTag()), );" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popI32()), );" ) return [resultVar] } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift index a21c766c0..9787865f2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift @@ -56,21 +56,21 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .failure(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .flag(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) case .rate(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(3)) + _swift_js_push_i32(Int32(3)) case .precise(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(4)) + _swift_js_push_i32(Int32(4)) case .info: - _swift_js_push_tag(Int32(5)) + _swift_js_push_i32(Int32(5)) } } } @@ -146,21 +146,21 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .error(let param0, let param1): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .status(let param0, let param1, let param2): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) case .coordinates(let param0, let param1, let param2): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(3)) + _swift_js_push_i32(Int32(3)) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() @@ -171,9 +171,9 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { param6.bridgeJSLowerStackReturn() param7.bridgeJSLowerStackReturn() param8.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(4)) + _swift_js_push_i32(Int32(4)) case .info: - _swift_js_push_tag(Int32(5)) + _swift_js_push_i32(Int32(5)) } } } @@ -225,16 +225,16 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .failure(let param0, let param1): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .status(let param0, let param1, let param2): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) } } } @@ -279,11 +279,11 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .failure(let param0, let param1): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) } } } @@ -363,7 +363,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .failure(let param0, let param1): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { @@ -375,7 +375,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .status(let param0, let param1, let param2): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { @@ -392,7 +392,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { __bjs_unwrapped_param2.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) } } } @@ -504,26 +504,26 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { switch self { case .precision(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .direction(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .optPrecision(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) case .optDirection(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(3)) + _swift_js_push_i32(Int32(3)) case .empty: - _swift_js_push_tag(Int32(4)) + _swift_js_push_i32(Int32(4)) } } } @@ -586,21 +586,21 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { switch self { case .structPayload(let param0): param0.bridgeJSLowerReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .classPayload(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .jsObjectPayload(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) case .nestedEnum(let param0): param0.bridgeJSLowerReturn() - _swift_js_push_tag(Int32(3)) + _swift_js_push_i32(Int32(3)) case .arrayPayload(let param0): param0.bridgeJSLowerReturn() - _swift_js_push_tag(Int32(4)) + _swift_js_push_i32(Int32(4)) case .empty: - _swift_js_push_tag(Int32(5)) + _swift_js_push_i32(Int32(5)) } } } @@ -675,33 +675,33 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { switch self { case .optStruct(let param0): param0.bridgeJSLowerReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .optClass(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .optJSObject(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) case .optNestedEnum(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(3)) + _swift_js_push_i32(Int32(3)) case .optArray(let param0): param0.bridgeJSLowerReturn() - _swift_js_push_tag(Int32(4)) + _swift_js_push_i32(Int32(4)) case .empty: - _swift_js_push_tag(Int32(5)) + _swift_js_push_i32(Int32(5)) } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift index 55521dbaf..9b68b96ed 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift @@ -401,10 +401,10 @@ extension Result: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .failure(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift index 3e5b40def..a7b0578a9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift @@ -83,10 +83,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .failure(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift index 3e5b40def..a7b0578a9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift @@ -83,10 +83,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .failure(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift index 8aa9efd65..d8b3c9bb8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift @@ -1245,21 +1245,21 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .failure(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .flag(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) case .rate(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(3)) + _swift_js_push_i32(Int32(3)) case .precise(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(4)) + _swift_js_push_i32(Int32(4)) case .info: - _swift_js_push_tag(Int32(5)) + _swift_js_push_i32(Int32(5)) } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index a381f5569..97531d378 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -31,7 +31,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -93,9 +92,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js index 0f4dce413..b215b3691 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -65,9 +64,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 04335c58c..fba9f9c6b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -24,7 +24,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -118,9 +117,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index a77407eca..1f7fe91e1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -66,9 +65,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 18c6999c1..3a4818463 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -99,7 +99,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -698,7 +697,7 @@ export async function createInstantiator(options, swift) { return { tag: AllTypesResultValues.Tag.JsObjectPayload, param0: obj }; } case AllTypesResultValues.Tag.NestedEnum: { - const enumValue = enumHelpers.APIResult.lift(tagStack.pop(), ); + const enumValue = enumHelpers.APIResult.lift(i32Stack.pop(), ); return { tag: AllTypesResultValues.Tag.NestedEnum, param0: enumValue }; } case AllTypesResultValues.Tag.ArrayPayload: { @@ -911,9 +910,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } @@ -1136,13 +1132,13 @@ export async function createInstantiator(options, swift) { }, getResult: function bjs_getResult() { instance.exports.bjs_getResult(); - const ret = enumHelpers.APIResult.lift(tagStack.pop()); + const ret = enumHelpers.APIResult.lift(i32Stack.pop()); return ret; }, roundtripAPIResult: function bjs_roundtripAPIResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.APIResult.lower(result); instance.exports.bjs_roundtripAPIResult(resultCaseId); - const ret = enumHelpers.APIResult.lift(tagStack.pop()); + const ret = enumHelpers.APIResult.lift(i32Stack.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1155,7 +1151,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalAPIResult(+isSome, isSome ? resultCaseId : 0); - const tag = tagStack.pop(); + const tag = i32Stack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1173,13 +1169,13 @@ export async function createInstantiator(options, swift) { }, getComplexResult: function bjs_getComplexResult() { instance.exports.bjs_getComplexResult(); - const ret = enumHelpers.ComplexResult.lift(tagStack.pop()); + const ret = enumHelpers.ComplexResult.lift(i32Stack.pop()); return ret; }, roundtripComplexResult: function bjs_roundtripComplexResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.ComplexResult.lower(result); instance.exports.bjs_roundtripComplexResult(resultCaseId); - const ret = enumHelpers.ComplexResult.lift(tagStack.pop()); + const ret = enumHelpers.ComplexResult.lift(i32Stack.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1192,7 +1188,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalComplexResult(+isSome, isSome ? resultCaseId : 0); - const tag = tagStack.pop(); + const tag = i32Stack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1212,7 +1208,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalUtilitiesResult(+isSome, isSome ? resultCaseId : 0); - const tag = tagStack.pop(); + const tag = i32Stack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1232,7 +1228,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalNetworkingResult(+isSome, isSome ? resultCaseId : 0); - const tag = tagStack.pop(); + const tag = i32Stack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1252,7 +1248,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalAPIOptionalResult(+isSome, isSome ? resultCaseId : 0); - const tag = tagStack.pop(); + const tag = i32Stack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1279,7 +1275,7 @@ export async function createInstantiator(options, swift) { result2Cleanup = enumResult1.cleanup; } instance.exports.bjs_compareAPIResults(+isSome, isSome ? result1CaseId : 0, +isSome1, isSome1 ? result2CaseId : 0); - const tag = tagStack.pop(); + const tag = i32Stack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1294,7 +1290,7 @@ export async function createInstantiator(options, swift) { roundTripTypedPayloadResult: function bjs_roundTripTypedPayloadResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.TypedPayloadResult.lower(result); instance.exports.bjs_roundTripTypedPayloadResult(resultCaseId); - const ret = enumHelpers.TypedPayloadResult.lift(tagStack.pop()); + const ret = enumHelpers.TypedPayloadResult.lift(i32Stack.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1307,7 +1303,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalTypedPayloadResult(+isSome, isSome ? resultCaseId : 0); - const tag = tagStack.pop(); + const tag = i32Stack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1321,7 +1317,7 @@ export async function createInstantiator(options, swift) { roundTripAllTypesResult: function bjs_roundTripAllTypesResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.AllTypesResult.lower(result); instance.exports.bjs_roundTripAllTypesResult(resultCaseId); - const ret = enumHelpers.AllTypesResult.lift(tagStack.pop()); + const ret = enumHelpers.AllTypesResult.lift(i32Stack.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1334,7 +1330,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalAllTypesResult(+isSome, isSome ? resultCaseId : 0); - const tag = tagStack.pop(); + const tag = i32Stack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { @@ -1348,7 +1344,7 @@ export async function createInstantiator(options, swift) { roundTripOptionalPayloadResult: function bjs_roundTripOptionalPayloadResult(result) { const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.OptionalAllTypesResult.lower(result); instance.exports.bjs_roundTripOptionalPayloadResult(resultCaseId); - const ret = enumHelpers.OptionalAllTypesResult.lift(tagStack.pop()); + const ret = enumHelpers.OptionalAllTypesResult.lift(i32Stack.pop()); if (resultCleanup) { resultCleanup(); } return ret; }, @@ -1361,7 +1357,7 @@ export async function createInstantiator(options, swift) { resultCleanup = enumResult.cleanup; } instance.exports.bjs_roundTripOptionalPayloadResultOpt(+isSome, isSome ? resultCaseId : 0); - const tag = tagStack.pop(); + const tag = i32Stack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js index 6ed445811..341ffb260 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js @@ -42,7 +42,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -89,9 +88,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index 55f995024..fa4586a2d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -62,7 +62,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -109,9 +108,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index 179712fef..5d85347ee 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -43,7 +43,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -90,9 +89,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index 0855f11ec..04d667b8e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -93,7 +93,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -141,9 +140,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js index c9ccf98fe..a60d5377f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -66,9 +65,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js index 947ee4d11..e0b4f8f94 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -65,9 +64,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js index 6c56cce6f..80ff1cead 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -66,9 +65,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index b0674f388..7e2f48981 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -130,9 +129,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js index 9ac03ee73..3f5d49f35 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -66,9 +65,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js index 6e9100b11..66abcf418 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -66,9 +65,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index b466d0900..138bef6a1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -66,9 +65,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index f6e4bf8aa..426fd8c1a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -155,9 +154,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index 7bb3c14d6..590e84cc3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -65,9 +64,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index ac2270b9f..18fb5af6c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -65,9 +64,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index 3205ef5d0..27bad9aea 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -65,9 +64,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index ed8f6db8b..9e6782d12 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -65,9 +64,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index c148f0761..94a4b73fb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -65,9 +64,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index b69033543..f637af601 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -66,9 +65,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js index 11a199b71..dd59941f7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -66,9 +65,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js index bb1e7ad40..a67637e58 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -66,9 +65,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index 4e8e86821..35bc1d028 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -65,9 +64,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index fd37c7178..d783e8968 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -42,7 +42,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -128,9 +127,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index fcf19c54f..892110aca 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -115,9 +114,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } @@ -332,7 +328,7 @@ export async function createInstantiator(options, swift) { roundtrip: function(value) { const { caseId: valueCaseId, cleanup: valueCleanup } = enumHelpers.APIResult.lower(value); instance.exports.bjs_APIResult_static_roundtrip(valueCaseId); - const ret = enumHelpers.APIResult.lift(tagStack.pop()); + const ret = enumHelpers.APIResult.lift(i32Stack.pop()); if (valueCleanup) { valueCleanup(); } return ret; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index 5e82061d9..f2c93adae 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -115,9 +114,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } @@ -326,7 +322,7 @@ export async function createInstantiator(options, swift) { roundtrip: function(value) { const { caseId: valueCaseId, cleanup: valueCleanup } = enumHelpers.APIResult.lower(value); instance.exports.bjs_APIResult_static_roundtrip(valueCaseId); - const ret = enumHelpers.APIResult.lift(tagStack.pop()); + const ret = enumHelpers.APIResult.lift(i32Stack.pop()); if (valueCleanup) { valueCleanup(); } return ret; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index ad44e80fa..adb809f6f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -70,9 +69,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index fb43d426b..f1273821a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -70,9 +69,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js index 1ee9f519e..b81a4990b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -66,9 +65,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js index 02833d1c6..112f853d4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -66,9 +65,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index 13ea6ba75..fc2fc58c6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -66,9 +65,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 2ef9aaf5a..4df3d5018 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -48,7 +48,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -191,9 +190,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } @@ -419,7 +415,7 @@ export async function createInstantiator(options, swift) { const lower_closure_TestModule_10TestModule9APIResultO_9APIResultO = function(param0) { const { caseId: param0CaseId, cleanup: param0Cleanup } = enumHelpers.APIResult.lower(param0); instance.exports.invoke_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO(boxPtr, param0CaseId); - const ret = enumHelpers.APIResult.lift(tagStack.pop()); + const ret = enumHelpers.APIResult.lift(i32Stack.pop()); if (param0Cleanup) { param0Cleanup(); } if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); @@ -701,7 +697,7 @@ export async function createInstantiator(options, swift) { param0Cleanup = enumResult.cleanup; } instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(boxPtr, +isSome, isSome ? param0CaseId : 0); - const tag = tagStack.pop(); + const tag = i32Stack.pop(); const isNull = (tag === -1); let optResult; if (isNull) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index 98899d4df..8744f5e45 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -91,9 +90,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index 3f42f3103..ff8c8f8b0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -323,9 +322,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index 751b28959..a33914d89 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -80,9 +79,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js index 50276543c..e81050bf6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -65,9 +64,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index 29474892f..cdcd6db3a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -85,9 +84,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js index de17f5edc..05a16a3eb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js @@ -18,7 +18,6 @@ export async function createInstantiator(options, swift) { let tmpRetOptionalFloat; let tmpRetOptionalDouble; let tmpRetOptionalHeapObject; - let tagStack = []; let strStack = []; let i32Stack = []; let f32Stack = []; @@ -66,9 +65,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_release"] = function(id) { swift.memory.release(id); } - bjs["swift_js_push_tag"] = function(tag) { - tagStack.push(tag); - } bjs["swift_js_push_i32"] = function(v) { i32Stack.push(v | 0); } diff --git a/Plugins/PackageToJS/Templates/instantiate.js b/Plugins/PackageToJS/Templates/instantiate.js index a0920964b..955c2928c 100644 --- a/Plugins/PackageToJS/Templates/instantiate.js +++ b/Plugins/PackageToJS/Templates/instantiate.js @@ -39,7 +39,6 @@ async function createInstantiator(options, swift) { swift_js_throw: unexpectedBjsCall, swift_js_retain: unexpectedBjsCall, swift_js_release: unexpectedBjsCall, - swift_js_push_tag: unexpectedBjsCall, swift_js_push_i32: unexpectedBjsCall, swift_js_push_f32: unexpectedBjsCall, swift_js_push_f64: unexpectedBjsCall, diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index d1390a610..feca05b3b 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -694,15 +694,6 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo } #endif -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_push_tag") -@_spi(BridgeJS) public func _swift_js_push_tag(_ tag: Int32) -#else -@_spi(BridgeJS) public func _swift_js_push_tag(_ tag: Int32) { - _onlyAvailableOnWasm() -} -#endif - #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_push_string") @_spi(BridgeJS) public func _swift_js_push_string(_ ptr: UnsafePointer?, _ len: Int32) @@ -1963,7 +1954,7 @@ extension Optional where Wrapped: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { switch consume self { case .none: - _swift_js_push_tag(-1) // Use -1 as sentinel for null + _swift_js_push_i32(-1) // Use -1 as sentinel for null case .some(let value): value.bridgeJSLowerReturn() } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 90a0dbddf..745c56472 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2083,21 +2083,21 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .failure(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .flag(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) case .rate(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(3)) + _swift_js_push_i32(Int32(3)) case .precise(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(4)) + _swift_js_push_i32(Int32(4)) case .info: - _swift_js_push_tag(Int32(5)) + _swift_js_push_i32(Int32(5)) } } } @@ -2180,26 +2180,26 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .error(let param0, let param1): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .location(let param0, let param1, let param2): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) case .status(let param0, let param1, let param2): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(3)) + _swift_js_push_i32(Int32(3)) case .coordinates(let param0, let param1, let param2): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(4)) + _swift_js_push_i32(Int32(4)) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() @@ -2210,9 +2210,9 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { param6.bridgeJSLowerStackReturn() param7.bridgeJSLowerStackReturn() param8.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(5)) + _swift_js_push_i32(Int32(5)) case .info: - _swift_js_push_tag(Int32(6)) + _swift_js_push_i32(Int32(6)) } } } @@ -2264,16 +2264,16 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .failure(let param0, let param1): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .status(let param0, let param1, let param2): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() param2.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) } } } @@ -2318,11 +2318,11 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .failure(let param0, let param1): param0.bridgeJSLowerStackReturn() param1.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) } } } @@ -2390,24 +2390,24 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { switch self { case .structPayload(let param0): param0.bridgeJSLowerReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .classPayload(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .jsObjectPayload(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) case .nestedEnum(let param0): param0.bridgeJSLowerReturn() - _swift_js_push_tag(Int32(3)) + _swift_js_push_i32(Int32(3)) case .arrayPayload(let param0): param0.bridgeJSLowerReturn() - _swift_js_push_tag(Int32(4)) + _swift_js_push_i32(Int32(4)) case .jsClassPayload(let param0): param0.jsObject.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(5)) + _swift_js_push_i32(Int32(5)) case .empty: - _swift_js_push_tag(Int32(6)) + _swift_js_push_i32(Int32(6)) } } } @@ -2473,26 +2473,26 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { switch self { case .precision(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .direction(let param0): param0.bridgeJSLowerStackReturn() - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .optPrecision(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) case .optDirection(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(3)) + _swift_js_push_i32(Int32(3)) case .empty: - _swift_js_push_tag(Int32(4)) + _swift_js_push_i32(Int32(4)) } } } @@ -2881,40 +2881,40 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { switch self { case .optStruct(let param0): param0.bridgeJSLowerReturn() - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .optClass(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .optJSObject(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) case .optNestedEnum(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(3)) + _swift_js_push_i32(Int32(3)) case .optArray(let param0): param0.bridgeJSLowerReturn() - _swift_js_push_tag(Int32(4)) + _swift_js_push_i32(Int32(4)) case .optJsClass(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(5)) + _swift_js_push_i32(Int32(5)) case .empty: - _swift_js_push_tag(Int32(6)) + _swift_js_push_i32(Int32(6)) } } } @@ -2994,7 +2994,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_tag(Int32(0)) + _swift_js_push_i32(Int32(0)) case .failure(let param0, let param1): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { @@ -3006,7 +3006,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { __bjs_unwrapped_param1.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - _swift_js_push_tag(Int32(1)) + _swift_js_push_i32(Int32(1)) case .status(let param0, let param1, let param2): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { @@ -3023,7 +3023,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { __bjs_unwrapped_param2.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) - _swift_js_push_tag(Int32(2)) + _swift_js_push_i32(Int32(2)) } } } From e129b41a23d407b8b0f77cf1375e13674031b0d9 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 12 Feb 2026 15:28:49 +0900 Subject: [PATCH 203/252] [NFC] BridgeJS: Minimize enum with assoc values code generation --- Benchmarks/Sources/Generated/BridgeJS.swift | 94 +---- .../Sources/BridgeJSCore/ExportSwift.swift | 63 +--- .../EnumAssociatedValue.swift | 338 +---------------- .../BridgeJSCodegenTests/Protocol.swift | 27 +- .../StaticFunctions.Global.swift | 27 +- .../StaticFunctions.swift | 27 +- .../BridgeJSCodegenTests/SwiftClosure.swift | 38 +- .../JavaScriptKit/BridgeJSIntrinsics.swift | 33 +- .../Generated/BridgeJS.swift | 353 +----------------- 9 files changed, 76 insertions(+), 924 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index cdd3aa775..9a1b30dc4 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -8,7 +8,7 @@ @_spi(BridgeJS) import JavaScriptKit extension APIResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -27,9 +27,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -50,42 +48,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { return Int32(5) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .failure(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - case .flag(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(2)) - case .rate(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(3)) - case .precise(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(4)) - case .info: - _swift_js_push_i32(Int32(5)) - } - } } extension ComplexResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> ComplexResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -106,9 +72,7 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -147,56 +111,6 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { return Int32(6) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> ComplexResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> ComplexResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .error(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - case .location(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(2)) - case .status(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(3)) - case .coordinates(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(4)) - case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - param3.bridgeJSLowerStackReturn() - param4.bridgeJSLowerStackReturn() - param5.bridgeJSLowerStackReturn() - param6.bridgeJSLowerStackReturn() - param7.bridgeJSLowerStackReturn() - param8.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(5)) - case .info: - _swift_js_push_i32(Int32(6)) - } - } } extension SimpleStruct: _BridgedSwiftStruct { diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 304ded82b..5fb6f103f 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1199,7 +1199,9 @@ struct EnumCodegen { let printer = CodeFragmentPrinter() printer.write("extension \(typeName): _BridgedSwiftAssociatedValueEnum {") printer.indent { - printer.write("private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> \(typeName) {") + printer.write( + "@_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> \(typeName) {" + ) printer.indent { printer.write("switch caseId {") generateStackLiftSwitchCases(printer: printer, enumDef: enumDef) @@ -1212,40 +1214,7 @@ struct EnumCodegen { printer.write("}") printer.nextLine() - printer.write("// MARK: Protocol Export") - printer.nextLine() - - printer.write("@_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 {") - printer.indent { - printer.write("switch self {") - generateLowerParameterSwitchCases(printer: printer, enumDef: enumDef) - printer.write("}") - } - printer.write("}") - printer.nextLine() - - printer.write( - multilineString: """ - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> \(typeName) { - return _bridgeJSLiftFromCaseId(caseId) - } - """ - ) - printer.nextLine() - - printer.write("// MARK: ExportSwift") - printer.nextLine() - - printer.write( - multilineString: """ - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> \(typeName) { - return _bridgeJSLiftFromCaseId(caseId) - } - """ - ) - printer.nextLine() - - printer.write("@_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() {") + printer.write("@_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 {") printer.indent { printer.write("switch self {") generateReturnSwitchCases(printer: printer, enumDef: enumDef) @@ -1298,32 +1267,12 @@ struct EnumCodegen { } } - private func generateLowerParameterSwitchCases(printer: CodeFragmentPrinter, enumDef: ExportedEnum) { - for (caseIndex, enumCase) in enumDef.cases.enumerated() { - if enumCase.associatedValues.isEmpty { - printer.write("case .\(enumCase.name):") - printer.indent { - printer.write("return Int32(\(caseIndex))") - } - } else { - let pattern = enumCase.associatedValues.enumerated() - .map { index, associatedValue in "let \(associatedValue.label ?? "param\(index)")" } - .joined(separator: ", ") - printer.write("case .\(enumCase.name)(\(pattern)):") - printer.indent { - generatePayloadPushingCode(printer: printer, associatedValues: enumCase.associatedValues) - printer.write("return Int32(\(caseIndex))") - } - } - } - } - private func generateReturnSwitchCases(printer: CodeFragmentPrinter, enumDef: ExportedEnum) { for (caseIndex, enumCase) in enumDef.cases.enumerated() { if enumCase.associatedValues.isEmpty { printer.write("case .\(enumCase.name):") printer.indent { - printer.write("_swift_js_push_i32(Int32(\(caseIndex)))") + printer.write("return Int32(\(caseIndex))") } } else { let pattern = enumCase.associatedValues.enumerated() @@ -1334,7 +1283,7 @@ struct EnumCodegen { generatePayloadPushingCode(printer: printer, associatedValues: enumCase.associatedValues) // Push tag AFTER payloads so it's popped first (LIFO) by the JS lift function. // This ensures nested enum tags don't overwrite the outer tag. - printer.write("_swift_js_push_i32(Int32(\(caseIndex)))") + printer.write("return Int32(\(caseIndex))") } } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift index 9787865f2..8705c929e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift @@ -1,5 +1,5 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -18,9 +18,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -41,42 +39,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { return Int32(5) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .failure(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - case .flag(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(2)) - case .rate(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(3)) - case .precise(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(4)) - case .info: - _swift_js_push_i32(Int32(5)) - } - } } extension ComplexResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> ComplexResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -95,9 +61,7 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -131,55 +95,10 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { return Int32(5) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> ComplexResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> ComplexResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .error(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - case .status(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(2)) - case .coordinates(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(3)) - case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - param3.bridgeJSLowerStackReturn() - param4.bridgeJSLowerStackReturn() - param5.bridgeJSLowerStackReturn() - param6.bridgeJSLowerStackReturn() - param7.bridgeJSLowerStackReturn() - param8.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(4)) - case .info: - _swift_js_push_i32(Int32(5)) - } - } } extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Utilities.Result { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> Utilities.Result { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -192,9 +111,7 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -210,37 +127,10 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { return Int32(2) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> Utilities.Result { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> Utilities.Result { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .failure(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - case .status(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(2)) - } - } } extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> NetworkingResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> NetworkingResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -251,9 +141,7 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -264,32 +152,10 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { return Int32(1) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> NetworkingResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> NetworkingResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .failure(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - } - } } extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIOptionalResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIOptionalResult { switch caseId { case 0: return .success(Optional.bridgeJSLiftParameter()) @@ -302,9 +168,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): let __bjs_isSome_param0 = param0 != nil @@ -344,57 +208,6 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { return Int32(2) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIOptionalResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIOptionalResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_i32(Int32(0)) - case .failure(let param0, let param1): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - let __bjs_isSome_param1 = param1 != nil - if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - _swift_js_push_i32(Int32(1)) - case .status(let param0, let param1, let param2): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - let __bjs_isSome_param1 = param1 != nil - if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - let __bjs_isSome_param2 = param2 != nil - if let __bjs_unwrapped_param2 = param2 { - __bjs_unwrapped_param2.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) - _swift_js_push_i32(Int32(2)) - } - } } extension Precision: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { @@ -444,7 +257,7 @@ extension CardinalDirection: _BridgedSwiftCaseEnum { } extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> TypedPayloadResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> TypedPayloadResult { switch caseId { case 0: return .precision(Precision.bridgeJSLiftParameter(_swift_js_pop_f32())) @@ -461,9 +274,7 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .precision(let param0): param0.bridgeJSLowerStackReturn() @@ -489,47 +300,10 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { return Int32(4) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> TypedPayloadResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> TypedPayloadResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .precision(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .direction(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - case .optPrecision(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_i32(Int32(2)) - case .optDirection(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_i32(Int32(3)) - case .empty: - _swift_js_push_i32(Int32(4)) - } - } } extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> AllTypesResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> AllTypesResult { switch caseId { case 0: return .structPayload(Point.bridgeJSLiftParameter()) @@ -548,9 +322,7 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .structPayload(let param0): param0.bridgeJSLowerReturn() @@ -571,42 +343,10 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { return Int32(5) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> AllTypesResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> AllTypesResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .structPayload(let param0): - param0.bridgeJSLowerReturn() - _swift_js_push_i32(Int32(0)) - case .classPayload(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - case .jsObjectPayload(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(2)) - case .nestedEnum(let param0): - param0.bridgeJSLowerReturn() - _swift_js_push_i32(Int32(3)) - case .arrayPayload(let param0): - param0.bridgeJSLowerReturn() - _swift_js_push_i32(Int32(4)) - case .empty: - _swift_js_push_i32(Int32(5)) - } - } } extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> OptionalAllTypesResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> OptionalAllTypesResult { switch caseId { case 0: return .optStruct(Optional.bridgeJSLiftParameter()) @@ -625,9 +365,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .optStruct(let param0): param0.bridgeJSLowerReturn() @@ -660,50 +398,6 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { return Int32(5) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> OptionalAllTypesResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> OptionalAllTypesResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .optStruct(let param0): - param0.bridgeJSLowerReturn() - _swift_js_push_i32(Int32(0)) - case .optClass(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_i32(Int32(1)) - case .optJSObject(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_i32(Int32(2)) - case .optNestedEnum(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_i32(Int32(3)) - case .optArray(let param0): - param0.bridgeJSLowerReturn() - _swift_js_push_i32(Int32(4)) - case .empty: - _swift_js_push_i32(Int32(5)) - } - } } extension Point: _BridgedSwiftStruct { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift index 9b68b96ed..fcca0aaa3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift @@ -363,7 +363,7 @@ extension ExampleEnum: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } extension Result: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Result { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> Result { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -374,9 +374,7 @@ extension Result: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -386,27 +384,6 @@ extension Result: _BridgedSwiftAssociatedValueEnum { return Int32(1) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> Result { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> Result { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .failure(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - } - } } extension Priority: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift index a7b0578a9..6622ef3da 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift @@ -45,7 +45,7 @@ public func _bjs_Calculator_static_square(_ value: Int32) -> Int32 { } extension APIResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -56,9 +56,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -68,27 +66,6 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { return Int32(1) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .failure(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - } - } } @_expose(wasm, "bjs_APIResult_static_roundtrip") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift index a7b0578a9..6622ef3da 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift @@ -45,7 +45,7 @@ public func _bjs_Calculator_static_square(_ value: Int32) -> Int32 { } extension APIResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -56,9 +56,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -68,27 +66,6 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { return Int32(1) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .failure(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - } - } } @_expose(wasm, "bjs_APIResult_static_roundtrip") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift index d8b3c9bb8..57a963637 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift @@ -1188,7 +1188,7 @@ extension HttpStatus: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } extension APIResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -1207,9 +1207,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -1230,38 +1228,6 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { return Int32(5) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .failure(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - case .flag(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(2)) - case .rate(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(3)) - case .precise(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(4)) - case .info: - _swift_js_push_i32(Int32(5)) - } - } } @_expose(wasm, "bjs_roundtripString") diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index feca05b3b..90493f773 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -601,23 +601,42 @@ extension _BridgedSwiftCaseEnum { /// /// The conformance is automatically synthesized by the BridgeJS code generator. public protocol _BridgedSwiftAssociatedValueEnum: _BridgedSwiftTypeLoweredIntoVoidType, _BridgedSwiftStackType { - // MARK: ImportTS - @_spi(BridgeJS) consuming func bridgeJSLowerParameter() -> Int32 - @_spi(BridgeJS) static func bridgeJSLiftReturn(_ caseId: Int32) -> Self + /// Pops the payload of the associated value enum from the stack. + /// + /// - Parameter caseId: The enum case ID. + /// - Returns: The associated value enum with its payload popped from the stack. + @_spi(BridgeJS) static func bridgeJSStackPopPayload(_ caseId: Int32) -> Self - // MARK: ExportSwift - @_spi(BridgeJS) static func bridgeJSLiftParameter(_ caseId: Int32) -> Self - @_spi(BridgeJS) consuming func bridgeJSLowerReturn() -> Void + /// Pushes the payload of the associated value enum onto the stack. + /// + /// - Returns: The enum case ID. + @_spi(BridgeJS) consuming func bridgeJSStackPushPayload() -> Int32 } extension _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - bridgeJSLiftParameter(_swift_js_pop_i32()) + bridgeJSStackPopPayload(_swift_js_pop_i32()) } @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { bridgeJSLowerReturn() } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ caseId: Int32) -> Self { + return bridgeJSStackPopPayload(caseId) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { + _swift_js_push_i32(bridgeJSStackPushPayload()) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSStackPushPayload() + } + + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ caseId: Int32) -> Self { + return bridgeJSStackPopPayload(caseId) + } } /// A protocol that Swift struct types conform to. diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 745c56472..400829a5d 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2026,7 +2026,7 @@ extension Internal.SupportedMethod: _BridgedSwiftCaseEnum { } extension APIResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -2045,9 +2045,7 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -2068,42 +2066,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { return Int32(5) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .failure(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - case .flag(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(2)) - case .rate(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(3)) - case .precise(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(4)) - case .info: - _swift_js_push_i32(Int32(5)) - } - } } extension ComplexResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> ComplexResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -2124,9 +2090,7 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -2165,60 +2129,10 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { return Int32(6) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> ComplexResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> ComplexResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .error(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - case .location(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(2)) - case .status(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(3)) - case .coordinates(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(4)) - case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - param3.bridgeJSLowerStackReturn() - param4.bridgeJSLowerStackReturn() - param5.bridgeJSLowerStackReturn() - param6.bridgeJSLowerStackReturn() - param7.bridgeJSLowerStackReturn() - param8.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(5)) - case .info: - _swift_js_push_i32(Int32(6)) - } - } } extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> Utilities.Result { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> Utilities.Result { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -2231,9 +2145,7 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -2249,37 +2161,10 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { return Int32(2) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> Utilities.Result { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> Utilities.Result { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .failure(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - case .status(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(2)) - } - } } extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> API.NetworkingResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> API.NetworkingResult { switch caseId { case 0: return .success(String.bridgeJSLiftParameter()) @@ -2290,9 +2175,7 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): param0.bridgeJSLowerStackReturn() @@ -2303,32 +2186,10 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { return Int32(1) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> API.NetworkingResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> API.NetworkingResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .failure(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - } - } } extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> AllTypesResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> AllTypesResult { switch caseId { case 0: return .structPayload(Address.bridgeJSLiftParameter()) @@ -2349,9 +2210,7 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .structPayload(let param0): param0.bridgeJSLowerReturn() @@ -2375,45 +2234,10 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { return Int32(6) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> AllTypesResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> AllTypesResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .structPayload(let param0): - param0.bridgeJSLowerReturn() - _swift_js_push_i32(Int32(0)) - case .classPayload(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - case .jsObjectPayload(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(2)) - case .nestedEnum(let param0): - param0.bridgeJSLowerReturn() - _swift_js_push_i32(Int32(3)) - case .arrayPayload(let param0): - param0.bridgeJSLowerReturn() - _swift_js_push_i32(Int32(4)) - case .jsClassPayload(let param0): - param0.jsObject.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(5)) - case .empty: - _swift_js_push_i32(Int32(6)) - } - } } extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> TypedPayloadResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> TypedPayloadResult { switch caseId { case 0: return .precision(Precision.bridgeJSLiftParameter(_swift_js_pop_f32())) @@ -2430,9 +2254,7 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .precision(let param0): param0.bridgeJSLowerStackReturn() @@ -2458,43 +2280,6 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { return Int32(4) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> TypedPayloadResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> TypedPayloadResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .precision(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(0)) - case .direction(let param0): - param0.bridgeJSLowerStackReturn() - _swift_js_push_i32(Int32(1)) - case .optPrecision(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_i32(Int32(2)) - case .optDirection(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_i32(Int32(3)) - case .empty: - _swift_js_push_i32(Int32(4)) - } - } } extension StaticCalculator: _BridgedSwiftCaseEnum { @@ -2803,7 +2588,7 @@ public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_se } extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> OptionalAllTypesResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> OptionalAllTypesResult { switch caseId { case 0: return .optStruct(Optional
        .bridgeJSLiftParameter()) @@ -2824,9 +2609,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .optStruct(let param0): param0.bridgeJSLowerReturn() @@ -2866,61 +2649,10 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { return Int32(6) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> OptionalAllTypesResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> OptionalAllTypesResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .optStruct(let param0): - param0.bridgeJSLowerReturn() - _swift_js_push_i32(Int32(0)) - case .optClass(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_i32(Int32(1)) - case .optJSObject(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_i32(Int32(2)) - case .optNestedEnum(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_i32(Int32(3)) - case .optArray(let param0): - param0.bridgeJSLowerReturn() - _swift_js_push_i32(Int32(4)) - case .optJsClass(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_i32(Int32(5)) - case .empty: - _swift_js_push_i32(Int32(6)) - } - } } extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { - private static func _bridgeJSLiftFromCaseId(_ caseId: Int32) -> APIOptionalResult { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIOptionalResult { switch caseId { case 0: return .success(Optional.bridgeJSLiftParameter()) @@ -2933,9 +2665,7 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { } } - // MARK: Protocol Export - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): let __bjs_isSome_param0 = param0 != nil @@ -2975,57 +2705,6 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { return Int32(2) } } - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ caseId: Int32) -> APIOptionalResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ caseId: Int32) -> APIOptionalResult { - return _bridgeJSLiftFromCaseId(caseId) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - switch self { - case .success(let param0): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - _swift_js_push_i32(Int32(0)) - case .failure(let param0, let param1): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - let __bjs_isSome_param1 = param1 != nil - if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - _swift_js_push_i32(Int32(1)) - case .status(let param0, let param1, let param2): - let __bjs_isSome_param0 = param0 != nil - if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) - let __bjs_isSome_param1 = param1 != nil - if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) - let __bjs_isSome_param2 = param2 != nil - if let __bjs_unwrapped_param2 = param2 { - __bjs_unwrapped_param2.bridgeJSLowerStackReturn() - } - _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) - _swift_js_push_i32(Int32(2)) - } - } } extension Point: _BridgedSwiftStruct { From 8970445ff4a54536d1fc45f047899dc4886e30dc Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 12 Feb 2026 10:19:49 +0100 Subject: [PATCH 204/252] NFC: BridgeJS: Simplify ExportSwift codegen by using no-arg bridgeJSLiftParameter() intrinsics --- .../Sources/BridgeJSCore/ExportSwift.swift | 55 ++++--------------- .../EnumAssociatedValue.swift | 6 +- .../BridgeJSCodegenTests/SwiftStruct.swift | 2 +- .../Generated/BridgeJS.swift | 18 +++--- 4 files changed, 24 insertions(+), 57 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 5fb6f103f..600a24e2c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -779,30 +779,11 @@ struct StackCodegen { func liftExpression(for type: BridgeType) -> ExprSyntax { switch type { case .string, .int, .uint, .bool, .float, .double, - .jsObject(nil), .jsValue, .swiftStruct, .swiftHeapObject: + .jsObject(nil), .jsValue, .swiftStruct, .swiftHeapObject, .unsafePointer, + .swiftProtocol, .caseEnum, .associatedValueEnum, .rawValueEnum: return "\(raw: type.swiftType).bridgeJSLiftParameter()" case .jsObject(let className?): return "\(raw: className)(unsafelyWrapping: JSObject.bridgeJSLiftParameter())" - case .unsafePointer: - return "\(raw: type.swiftType).bridgeJSLiftParameter()" - case .swiftProtocol(let protocolName): - return "Any\(raw: protocolName).bridgeJSLiftParameter(_swift_js_pop_i32())" - case .caseEnum: - return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_i32())" - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - return - "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32())" - case .float: - return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_f32())" - case .double: - return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_f64())" - case .bool, .int, .int32, .int64, .uint, .uint32, .uint64: - return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_i32())" - } - case .associatedValueEnum: - return "\(raw: type.swiftType).bridgeJSLiftParameter(_swift_js_pop_i32())" case .nullable(let wrappedType, let kind): return liftNullableExpression(wrappedType: wrappedType, kind: kind) case .array(let elementType): @@ -820,8 +801,6 @@ struct StackCodegen { switch elementType { case .jsObject(let className?) where className != "JSObject": return liftArrayExpressionInline(elementType: elementType) - case .swiftProtocol(let protocolName): - return "[Any\(raw: protocolName)].bridgeJSLiftParameter()" case .nullable, .closure: return liftArrayExpressionInline(elementType: elementType) case .void, .namespaceEnum: @@ -857,13 +836,6 @@ struct StackCodegen { return __dict.mapValues { \(raw: className)(unsafelyWrapping: $0) } }() """ - case .swiftProtocol(let protocolName): - return """ - { - let __dict = [String: JSObject].bridgeJSLiftParameter() - return __dict.mapValues { $0 as! Any\(raw: protocolName) } - }() - """ case .nullable, .closure: return liftDictionaryExpressionInline(valueType: valueType) case .void, .namespaceEnum: @@ -917,19 +889,14 @@ struct StackCodegen { varPrefix: String ) -> [CodeBlockItemSyntax] { switch type { - case .string, .int, .uint, .bool, .float, .double, .jsValue: - return ["\(raw: accessor).bridgeJSLowerStackReturn()"] - case .jsObject(nil): + case .string, .int, .uint, .bool, .float, .double, .jsValue, + .jsObject(nil), .swiftHeapObject, .unsafePointer, .closure, + .caseEnum, .rawValueEnum: return ["\(raw: accessor).bridgeJSLowerStackReturn()"] case .jsObject(_?): return ["\(raw: accessor).jsObject.bridgeJSLowerStackReturn()"] - case .swiftHeapObject, .unsafePointer, .closure: - return ["\(raw: accessor).bridgeJSLowerStackReturn()"] - case .swiftProtocol(let protocolName): - let wrapperName = "Any\(protocolName)" - return ["(\(raw: accessor) as! \(raw: wrapperName)).bridgeJSLowerStackReturn()"] - case .caseEnum, .rawValueEnum: - return ["\(raw: accessor).bridgeJSLowerStackReturn()"] + case .swiftProtocol: + return ["(\(raw: accessor) as! \(raw: type.swiftType)).bridgeJSLowerStackReturn()"] case .associatedValueEnum, .swiftStruct: return ["\(raw: accessor).bridgeJSLowerReturn()"] case .nullable(let wrappedType, _): @@ -951,8 +918,8 @@ struct StackCodegen { switch elementType { case .jsObject(let className?) where className != "JSObject": return ["\(raw: accessor).map { $0.jsObject }.bridgeJSLowerReturn()"] - case .swiftProtocol(let protocolName): - return ["\(raw: accessor).map { $0 as! Any\(raw: protocolName) }.bridgeJSLowerReturn()"] + case .swiftProtocol: + return ["\(raw: accessor).map { $0 as! \(raw: elementType.swiftType) }.bridgeJSLowerReturn()"] case .nullable, .closure: return lowerArrayStatementsInline( elementType: elementType, @@ -998,8 +965,8 @@ struct StackCodegen { switch valueType { case .jsObject(let className?) where className != "JSObject": return ["\(raw: accessor).mapValues { $0.jsObject }.bridgeJSLowerReturn()"] - case .swiftProtocol(let protocolName): - return ["\(raw: accessor).mapValues { $0 as! Any\(raw: protocolName) }.bridgeJSLowerReturn()"] + case .swiftProtocol: + return ["\(raw: accessor).mapValues { $0 as! \(raw: valueType.swiftType) }.bridgeJSLowerReturn()"] case .nullable, .closure: return lowerDictionaryStatementsInline( valueType: valueType, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift index 8705c929e..39582c9a9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift @@ -260,9 +260,9 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> TypedPayloadResult { switch caseId { case 0: - return .precision(Precision.bridgeJSLiftParameter(_swift_js_pop_f32())) + return .precision(Precision.bridgeJSLiftParameter()) case 1: - return .direction(CardinalDirection.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .direction(CardinalDirection.bridgeJSLiftParameter()) case 2: return .optPrecision(Optional.bridgeJSLiftParameter()) case 3: @@ -312,7 +312,7 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { case 2: return .jsObjectPayload(JSObject.bridgeJSLiftParameter()) case 3: - return .nestedEnum(APIResult.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .nestedEnum(APIResult.bridgeJSLiftParameter()) case 4: return .arrayPayload([Int].bridgeJSLiftParameter()) case 5: diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift index 1ff0a4ce8..2e551452d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift @@ -223,7 +223,7 @@ fileprivate func _bjs_struct_lift_Session() -> Int32 { extension Measurement: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Measurement { let optionalPrecision = Optional.bridgeJSLiftParameter() - let precision = Precision.bridgeJSLiftParameter(_swift_js_pop_f32()) + let precision = Precision.bridgeJSLiftParameter() let value = Double.bridgeJSLiftParameter() return Measurement(value: value, precision: precision, optionalPrecision: optionalPrecision) } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 400829a5d..07092d4bd 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2198,7 +2198,7 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { case 2: return .jsObjectPayload(JSObject.bridgeJSLiftParameter()) case 3: - return .nestedEnum(APIResult.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .nestedEnum(APIResult.bridgeJSLiftParameter()) case 4: return .arrayPayload([Int].bridgeJSLiftParameter()) case 5: @@ -2240,9 +2240,9 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> TypedPayloadResult { switch caseId { case 0: - return .precision(Precision.bridgeJSLiftParameter(_swift_js_pop_f32())) + return .precision(Precision.bridgeJSLiftParameter()) case 1: - return .direction(Direction.bridgeJSLiftParameter(_swift_js_pop_i32())) + return .direction(Direction.bridgeJSLiftParameter()) case 2: return .optPrecision(Optional.bridgeJSLiftParameter()) case 3: @@ -2992,7 +2992,7 @@ fileprivate func _bjs_struct_lift_Contact() -> Int32 { extension Config: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Config { - let status = Status.bridgeJSLiftParameter(_swift_js_pop_i32()) + let status = Status.bridgeJSLiftParameter() let direction = Optional.bridgeJSLiftParameter() let theme = Optional.bridgeJSLiftParameter() let name = String.bridgeJSLiftParameter() @@ -3100,7 +3100,7 @@ extension ValidationReport: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ValidationReport { let outcome = Optional.bridgeJSLiftParameter() let status = Optional.bridgeJSLiftParameter() - let result = APIResult.bridgeJSLiftParameter(_swift_js_pop_i32()) + let result = APIResult.bridgeJSLiftParameter() let id = Int.bridgeJSLiftParameter() return ValidationReport(id: id, result: result, status: status, outcome: outcome) } @@ -3160,8 +3160,8 @@ extension AdvancedConfig: _BridgedSwiftStruct { let location = Optional.bridgeJSLiftParameter() let metadata = Optional.bridgeJSLiftParameter() let result = Optional.bridgeJSLiftParameter() - let status = Status.bridgeJSLiftParameter(_swift_js_pop_i32()) - let theme = Theme.bridgeJSLiftParameter(_swift_js_pop_i32(), _swift_js_pop_i32()) + let status = Status.bridgeJSLiftParameter() + let theme = Theme.bridgeJSLiftParameter() let enabled = Bool.bridgeJSLiftParameter() let title = String.bridgeJSLiftParameter() let id = Int.bridgeJSLiftParameter() @@ -3226,8 +3226,8 @@ extension MeasurementConfig: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MeasurementConfig { let optionalRatio = Optional.bridgeJSLiftParameter() let optionalPrecision = Optional.bridgeJSLiftParameter() - let ratio = Ratio.bridgeJSLiftParameter(_swift_js_pop_f64()) - let precision = Precision.bridgeJSLiftParameter(_swift_js_pop_f32()) + let ratio = Ratio.bridgeJSLiftParameter() + let precision = Precision.bridgeJSLiftParameter() return MeasurementConfig(precision: precision, ratio: ratio, optionalPrecision: optionalPrecision, optionalRatio: optionalRatio) } From d5ac7fa0c04cb55d125d077d7eb490d129c4ca02 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 12 Feb 2026 11:43:16 +0100 Subject: [PATCH 205/252] NFC: BridgeJS: Simplify ExportSwift codegen by removing redundant branches and extracting helpers --- .../Sources/BridgeJSCore/ExportSwift.swift | 104 +++++------------- .../EnumAssociatedValue.swift | 2 +- .../BridgeJSCodegenTests/Protocol.swift | 2 +- .../Generated/BridgeJS.swift | 8 +- 4 files changed, 36 insertions(+), 80 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 600a24e2c..e324c866f 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -147,23 +147,9 @@ public class ExportSwift { } else { optionalSwiftType = "JSUndefinedOr" } - if case .swiftProtocol(let protocolName) = wrappedType { - let wrapperName = "Any\(protocolName)" - typeNameForIntrinsic = "\(optionalSwiftType)<\(wrapperName)>" - liftingExpr = ExprSyntax( - "\(raw: typeNameForIntrinsic).bridgeJSLiftParameter(\(raw: argumentsToLift.joined(separator: ", ")))" - ) - } else { - typeNameForIntrinsic = "\(optionalSwiftType)<\(wrappedType.swiftType)>" - liftingExpr = ExprSyntax( - "\(raw: typeNameForIntrinsic).bridgeJSLiftParameter(\(raw: argumentsToLift.joined(separator: ", ")))" - ) - } - case .swiftProtocol(let protocolName): - let wrapperName = "Any\(protocolName)" - typeNameForIntrinsic = wrapperName + typeNameForIntrinsic = "\(optionalSwiftType)<\(wrappedType.swiftType)>" liftingExpr = ExprSyntax( - "\(raw: wrapperName).bridgeJSLiftParameter(\(raw: argumentsToLift.joined(separator: ", ")))" + "\(raw: typeNameForIntrinsic).bridgeJSLiftParameter(\(raw: argumentsToLift.joined(separator: ", ")))" ) default: typeNameForIntrinsic = param.type.swiftType @@ -178,6 +164,20 @@ public class ExportSwift { } } + private func protocolCastSuffix(for returnType: BridgeType) -> (prefix: String, suffix: String) { + switch returnType { + case .swiftProtocol: + return ("", " as! \(returnType.swiftType)") + case .nullable(let wrappedType, _): + if case .swiftProtocol = wrappedType { + return ("(", ").flatMap { $0 as? \(wrappedType.swiftType) }") + } + return ("", "") + default: + return ("", "") + } + } + private func removeFirstLiftedParameter() -> (parameter: Parameter, expr: ExprSyntax) { let parameter = parameters.removeFirst() let expr = liftedParameterExprs.removeFirst() @@ -211,26 +211,10 @@ public class ExportSwift { if returnType == .void { return CodeBlockItemSyntax(item: .init(ExpressionStmtSyntax(expression: callExpr))) } else { - switch returnType { - case .swiftProtocol(let protocolName): - let wrapperName = "Any\(protocolName)" - return CodeBlockItemSyntax( - item: .init(DeclSyntax("let ret = \(raw: callExpr) as! \(raw: wrapperName)")) - ) - case .nullable(let wrappedType, _): - if case .swiftProtocol(let protocolName) = wrappedType { - let wrapperName = "Any\(protocolName)" - return CodeBlockItemSyntax( - item: .init( - DeclSyntax("let ret = (\(raw: callExpr)).flatMap { $0 as? \(raw: wrapperName) }") - ) - ) - } else { - return CodeBlockItemSyntax(item: .init(DeclSyntax("let ret = \(raw: callExpr)"))) - } - default: - return CodeBlockItemSyntax(item: .init(DeclSyntax("let ret = \(raw: callExpr)"))) - } + let (prefix, suffix) = protocolCastSuffix(for: returnType) + return CodeBlockItemSyntax( + item: .init(DeclSyntax("let ret = \(raw: prefix)\(raw: callExpr)\(raw: suffix)")) + ) } } @@ -244,20 +228,8 @@ public class ExportSwift { if returnType == .void { append("\(raw: name)") } else { - switch returnType { - case .swiftProtocol(let protocolName): - let wrapperName = "Any\(protocolName)" - append("let ret = \(raw: name) as! \(raw: wrapperName)") - case .nullable(let wrappedType, _): - if case .swiftProtocol(let protocolName) = wrappedType { - let wrapperName = "Any\(protocolName)" - append("let ret = \(raw: name).flatMap { $0 as? \(raw: wrapperName) }") - } else { - append("let ret = \(raw: name)") - } - default: - append("let ret = \(raw: name)") - } + let (prefix, suffix) = protocolCastSuffix(for: returnType) + append("let ret = \(raw: prefix)\(raw: name)\(raw: suffix)") } } @@ -301,20 +273,8 @@ public class ExportSwift { if returnType == .void { append("\(raw: selfExpr).\(raw: propertyName)") } else { - switch returnType { - case .swiftProtocol(let protocolName): - let wrapperName = "Any\(protocolName)" - append("let ret = \(raw: selfExpr).\(raw: propertyName) as! \(raw: wrapperName)") - case .nullable(let wrappedType, _): - if case .swiftProtocol(let protocolName) = wrappedType { - let wrapperName = "Any\(protocolName)" - append("let ret = \(raw: selfExpr).\(raw: propertyName).flatMap { $0 as? \(raw: wrapperName) }") - } else { - append("let ret = \(raw: selfExpr).\(raw: propertyName)") - } - default: - append("let ret = \(raw: selfExpr).\(raw: propertyName)") - } + let (prefix, suffix) = protocolCastSuffix(for: returnType) + append("let ret = \(raw: prefix)\(raw: selfExpr).\(raw: propertyName)\(raw: suffix)") } } @@ -1051,18 +1011,14 @@ struct StackCodegen { varPrefix: String ) -> [CodeBlockItemSyntax] { switch wrappedType { - case .string, .int, .uint, .bool, .float, .double, .jsValue: - return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] - case .caseEnum, .rawValueEnum: - return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] - case .swiftHeapObject: - return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] - case .associatedValueEnum: - return ["_swift_js_push_i32(\(raw: unwrappedVar).bridgeJSLowerParameter())"] - case .jsObject(nil): - return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] case .jsObject(_?): return ["\(raw: unwrappedVar).jsObject.bridgeJSLowerStackReturn()"] + case .swiftProtocol: + return ["(\(raw: unwrappedVar) as! \(raw: wrappedType.swiftType)).bridgeJSLowerStackReturn()"] + case .string, .int, .uint, .bool, .float, .double, .jsValue, + .jsObject(nil), .swiftHeapObject, .unsafePointer, .closure, + .caseEnum, .rawValueEnum, .associatedValueEnum: + return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] default: return ["preconditionFailure(\"BridgeJS: unsupported optional wrapped type\")"] } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift index 39582c9a9..fa19b481c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift @@ -387,7 +387,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { case .optNestedEnum(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift index fcca0aaa3..4051f5c9e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift @@ -565,7 +565,7 @@ public func _bjs_MyViewController_delegate_set(_ _self: UnsafeMutableRawPointer, @_cdecl("bjs_MyViewController_secondDelegate_get") public func _bjs_MyViewController_secondDelegate_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = MyViewController.bridgeJSLiftParameter(_self).secondDelegate.flatMap { $0 as? AnyMyViewControllerDelegate } + let ret = (MyViewController.bridgeJSLiftParameter(_self).secondDelegate).flatMap { $0 as? AnyMyViewControllerDelegate } return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 07092d4bd..e01c41511 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2631,7 +2631,7 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { case .optNestedEnum(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - _swift_js_push_i32(__bjs_unwrapped_param0.bridgeJSLowerParameter()) + __bjs_unwrapped_param0.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) @@ -3115,7 +3115,7 @@ extension ValidationReport: _BridgedSwiftStruct { _swift_js_push_i32(__bjs_isSome_status ? 1 : 0) let __bjs_isSome_outcome = self.outcome != nil if let __bjs_unwrapped_outcome = self.outcome { - _swift_js_push_i32(__bjs_unwrapped_outcome.bridgeJSLowerParameter()) + __bjs_unwrapped_outcome.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_outcome ? 1 : 0) } @@ -3176,7 +3176,7 @@ extension AdvancedConfig: _BridgedSwiftStruct { self.status.bridgeJSLowerStackReturn() let __bjs_isSome_result = self.result != nil if let __bjs_unwrapped_result = self.result { - _swift_js_push_i32(__bjs_unwrapped_result.bridgeJSLowerParameter()) + __bjs_unwrapped_result.bridgeJSLowerStackReturn() } _swift_js_push_i32(__bjs_isSome_result ? 1 : 0) let __bjs_isSome_metadata = self.metadata != nil @@ -7670,7 +7670,7 @@ public func _bjs_DataProcessorManager_processor_set(_ _self: UnsafeMutableRawPoi @_cdecl("bjs_DataProcessorManager_backupProcessor_get") public func _bjs_DataProcessorManager_backupProcessor_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).backupProcessor.flatMap { $0 as? AnyDataProcessor } + let ret = (DataProcessorManager.bridgeJSLiftParameter(_self).backupProcessor).flatMap { $0 as? AnyDataProcessor } return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") From 38a73c86edd302cc5dcebcdc389ec14b5b8a526f Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 12 Feb 2026 13:21:34 +0100 Subject: [PATCH 206/252] NFC: BridgeJS: Further simplify codegen and JSValue intrinsics --- .../Sources/BridgeJSCore/ClosureCodegen.swift | 37 ++-- .../Sources/BridgeJSCore/ExportSwift.swift | 158 +++++++++--------- .../ImportedTypeInExportedInterface.swift | 11 +- .../JavaScriptKit/BridgeJSIntrinsics.swift | 42 ++--- .../Generated/BridgeJS.swift | 11 +- 5 files changed, 106 insertions(+), 153 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift index eefc63a7e..cbec4ba31 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift @@ -11,17 +11,17 @@ import BridgeJSUtilities public struct ClosureCodegen { public init() {} + private func swiftClosureType(for signature: ClosureSignature) -> String { + let closureParams = signature.parameters.map { "\($0.swiftType)" }.joined(separator: ", ") + let swiftEffects = (signature.isAsync ? " async" : "") + (signature.isThrows ? " throws" : "") + let swiftReturnType = signature.returnType.swiftType + return "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)" + } + func renderClosureHelpers(_ signature: ClosureSignature) throws -> [DeclSyntax] { let mangledName = signature.mangleName let helperName = "_BJS_Closure_\(mangledName)" - - let closureParams = signature.parameters.enumerated().map { _, type in - "\(type.swiftType)" - }.joined(separator: ", ") - - let swiftEffects = (signature.isAsync ? " async" : "") + (signature.isThrows ? " throws" : "") - let swiftReturnType = signature.returnType.swiftType - let swiftClosureType = "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)" + let swiftClosureType = swiftClosureType(for: signature) let externName = "invoke_js_callback_\(signature.moduleName)_\(mangledName)" @@ -72,7 +72,7 @@ public struct ClosureCodegen { } else { parameters = " (" - + signature.parameters.enumerated().map { index, param in + + signature.parameters.enumerated().map { index, _ in "param\(index)" }.joined(separator: ", ") + ")" } @@ -113,12 +113,7 @@ public struct ClosureCodegen { } func renderClosureInvokeHandler(_ signature: ClosureSignature) throws -> DeclSyntax { - let closureParams = signature.parameters.enumerated().map { _, type in - "\(type.swiftType)" - }.joined(separator: ", ") - let swiftEffects = (signature.isAsync ? " async" : "") + (signature.isThrows ? " throws" : "") - let swiftReturnType = signature.returnType.swiftType - let swiftClosureType = "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)" + let swiftClosureType = swiftClosureType(for: signature) let boxType = "_BridgeJSTypedClosureBox<\(swiftClosureType)>" let abiName = "invoke_swift_closure_\(signature.moduleName)_\(signature.mangleName)" @@ -144,17 +139,7 @@ public struct ClosureCodegen { let closureCallExpr = ExprSyntax("closure(\(raw: liftedParams.joined(separator: ", ")))") - // Determine return type - let abiReturnWasmType: WasmCoreType? - if signature.returnType == .void { - abiReturnWasmType = nil - } else if let wasmType = try signature.returnType.loweringReturnInfo().returnType { - abiReturnWasmType = wasmType - } else { - abiReturnWasmType = nil - } - - let throwReturn = abiReturnWasmType?.swiftReturnPlaceholderStmt ?? "return" + let abiReturnWasmType = try signature.returnType.loweringReturnInfo().returnType // Build signature using SwiftSignatureBuilder let funcSignature = SwiftSignatureBuilder.buildABIFunctionSignature( diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index e324c866f..bb42e9d1e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -482,12 +482,7 @@ public class ExportSwift { } if function.effects.isStatic, let staticContext = function.staticContext { - let callName: String - switch staticContext { - case .className(let baseName), .enumName(let baseName), .structName(let baseName), - .namespaceEnum(let baseName): - callName = "\(baseName).\(function.name)" - } + let callName = "\(staticContextBaseName(staticContext)).\(function.name)" builder.call(name: callName, returnType: function.returnType) } else { builder.call(name: function.name, returnType: function.returnType) @@ -497,17 +492,61 @@ public class ExportSwift { return builder.render(abiName: function.abiName) } + private func staticContextBaseName(_ staticContext: StaticContext) -> String { + switch staticContext { + case .className(let baseName), .enumName(let baseName), .structName(let baseName), + .namespaceEnum(let baseName): + return baseName + } + } + + private func renderSingleExportedConstructor( + constructor: ExportedConstructor, + callName: String, + returnType: BridgeType + ) throws -> DeclSyntax { + let builder = ExportedThunkBuilder(effects: constructor.effects) + for param in constructor.parameters { + try builder.liftParameter(param: param) + } + builder.call(name: callName, returnType: returnType) + try builder.lowerReturnValue(returnType: returnType) + return builder.render(abiName: constructor.abiName) + } + + private func renderSingleExportedMethod( + method: ExportedFunction, + ownerTypeName: String, + instanceSelfType: BridgeType + ) throws -> DeclSyntax { + let builder = ExportedThunkBuilder(effects: method.effects) + if !method.effects.isStatic { + try builder.liftParameter(param: Parameter(label: nil, name: "_self", type: instanceSelfType)) + } + for param in method.parameters { + try builder.liftParameter(param: param) + } + + if method.effects.isStatic { + builder.call(name: "\(ownerTypeName).\(method.name)", returnType: method.returnType) + } else { + builder.callMethod(methodName: method.name, returnType: method.returnType) + } + try builder.lowerReturnValue(returnType: method.returnType) + return builder.render(abiName: method.abiName) + } + func renderSingleExportedStruct(struct structDef: ExportedStruct) throws -> [DeclSyntax] { var decls: [DeclSyntax] = [] if let constructor = structDef.constructor { - let builder = ExportedThunkBuilder(effects: constructor.effects) - for param in constructor.parameters { - try builder.liftParameter(param: param) - } - builder.call(name: structDef.swiftCallName, returnType: .swiftStruct(structDef.swiftCallName)) - try builder.lowerReturnValue(returnType: .swiftStruct(structDef.swiftCallName)) - decls.append(builder.render(abiName: constructor.abiName)) + decls.append( + try renderSingleExportedConstructor( + constructor: constructor, + callName: structDef.swiftCallName, + returnType: .swiftStruct(structDef.swiftCallName) + ) + ) } for property in structDef.properties where property.isStatic { @@ -520,28 +559,13 @@ public class ExportSwift { } for method in structDef.methods { - let builder = ExportedThunkBuilder(effects: method.effects) - - if method.effects.isStatic { - for param in method.parameters { - try builder.liftParameter(param: param) - } - builder.call(name: "\(structDef.swiftCallName).\(method.name)", returnType: method.returnType) - } else { - try builder.liftParameter( - param: Parameter(label: nil, name: "_self", type: .swiftStruct(structDef.swiftCallName)) - ) - for param in method.parameters { - try builder.liftParameter(param: param) - } - builder.callMethod( - methodName: method.name, - returnType: method.returnType + decls.append( + try renderSingleExportedMethod( + method: method, + ownerTypeName: structDef.swiftCallName, + instanceSelfType: .swiftStruct(structDef.swiftCallName) ) - } - - try builder.lowerReturnValue(returnType: method.returnType) - decls.append(builder.render(abiName: method.abiName)) + ) } return decls @@ -598,55 +622,29 @@ public class ExportSwift { var decls: [DeclSyntax] = [] if let constructor = klass.constructor { - let builder = ExportedThunkBuilder(effects: constructor.effects) - for param in constructor.parameters { - try builder.liftParameter(param: param) - } - builder.call(name: klass.swiftCallName, returnType: BridgeType.swiftHeapObject(klass.name)) - try builder.lowerReturnValue(returnType: BridgeType.swiftHeapObject(klass.name)) - decls.append(builder.render(abiName: constructor.abiName)) + decls.append( + try renderSingleExportedConstructor( + constructor: constructor, + callName: klass.swiftCallName, + returnType: .swiftHeapObject(klass.name) + ) + ) } for method in klass.methods { - let builder = ExportedThunkBuilder(effects: method.effects) - - if method.effects.isStatic { - for param in method.parameters { - try builder.liftParameter(param: param) - } - builder.call(name: "\(klass.swiftCallName).\(method.name)", returnType: method.returnType) - } else { - try builder.liftParameter( - param: Parameter(label: nil, name: "_self", type: BridgeType.swiftHeapObject(klass.swiftCallName)) - ) - for param in method.parameters { - try builder.liftParameter(param: param) - } - builder.callMethod( - methodName: method.name, - returnType: method.returnType + decls.append( + try renderSingleExportedMethod( + method: method, + ownerTypeName: klass.swiftCallName, + instanceSelfType: .swiftHeapObject(klass.swiftCallName) ) - } - try builder.lowerReturnValue(returnType: method.returnType) - decls.append(builder.render(abiName: method.abiName)) + ) } // Generate property getters and setters for property in klass.properties { - if property.isStatic { - decls.append( - contentsOf: try renderSingleExportedProperty( - property: property, - context: .classStatic(klass: klass) - ) - ) - } else { - decls.append( - contentsOf: try renderSingleExportedProperty( - property: property, - context: .classInstance(klass: klass) - ) - ) - } + let context: PropertyRenderingContext = + property.isStatic ? .classStatic(klass: klass) : .classInstance(klass: klass) + decls.append(contentsOf: try renderSingleExportedProperty(property: property, context: context)) } do { @@ -760,7 +758,7 @@ struct StackCodegen { func liftArrayExpression(elementType: BridgeType) -> ExprSyntax { switch elementType { case .jsObject(let className?) where className != "JSObject": - return liftArrayExpressionInline(elementType: elementType) + return "[JSObject].bridgeJSLiftParameter().map { \(raw: className)(unsafelyWrapping: $0) }" case .nullable, .closure: return liftArrayExpressionInline(elementType: elementType) case .void, .namespaceEnum: @@ -992,8 +990,7 @@ struct StackCodegen { let innerStatements = lowerUnwrappedOptionalStatements( wrappedType: wrappedType, - unwrappedVar: "__bjs_unwrapped_\(varPrefix)", - varPrefix: varPrefix + unwrappedVar: "__bjs_unwrapped_\(varPrefix)" ) for stmt in innerStatements { statements.append(stmt.description) @@ -1007,8 +1004,7 @@ struct StackCodegen { private func lowerUnwrappedOptionalStatements( wrappedType: BridgeType, - unwrappedVar: String, - varPrefix: String + unwrappedVar: String ) -> [CodeBlockItemSyntax] { switch wrappedType { case .jsObject(_?): diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift index cd0f56694..5708e7de9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift @@ -76,16 +76,7 @@ public func _bjs_makeFoo() -> Int32 { @_cdecl("bjs_processFooArray") public func _bjs_processFooArray() -> Void { #if arch(wasm32) - let ret = processFooArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Foo] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append(Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter())) - } - __result.reverse() - return __result - }()) + let ret = processFooArray(_: [JSObject].bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) }) ret.map { $0.jsObject }.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 90493f773..ff219531d 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -386,6 +386,19 @@ extension JSObject: _BridgedSwiftStackType { extension JSValue: _BridgedSwiftStackType { public typealias StackLiftResult = JSValue + @_transparent + private static func bridgeJSRetainPayloadIfNeeded(kind: Int32, payload1: Int32) -> Int32 { + guard let kindEnum = JavaScriptValueKind(rawValue: UInt32(kind)) else { + return payload1 + } + switch kindEnum { + case .string, .object, .symbol, .bigInt: + return _swift_js_retain(payload1) + default: + return payload1 + } + } + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (kind: Int32, payload1: Int32, payload2: Double) { return withRawJSValue { raw in ( @@ -409,17 +422,7 @@ extension JSValue: _BridgedSwiftStackType { _ payload1: Int32, _ payload2: Double ) -> JSValue { - let retainedPayload1: Int32 - if let kindEnum = JavaScriptValueKind(rawValue: UInt32(kind)) { - switch kindEnum { - case .string, .object, .symbol, .bigInt: - retainedPayload1 = _swift_js_retain(payload1) - default: - retainedPayload1 = payload1 - } - } else { - retainedPayload1 = payload1 - } + let retainedPayload1 = bridgeJSRetainPayloadIfNeeded(kind: kind, payload1: payload1) guard let kindEnum = JavaScriptValueKind(rawValue: UInt32(kind)) else { fatalError("Invalid JSValue kind: \(kind)") @@ -440,25 +443,12 @@ extension JSValue: _BridgedSwiftStackType { } @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> JSValue { - let payload2 = _swift_js_pop_f64() - let payload1 = _swift_js_pop_i32() - let kind = _swift_js_pop_i32() - return bridgeJSLiftParameter(kind, payload1, payload2) + bridgeJSLiftParameter() } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { let lowered = bridgeJSLowerParameter() - let retainedPayload1: Int32 - if let kind = JavaScriptValueKind(rawValue: UInt32(lowered.kind)) { - switch kind { - case .string, .object, .symbol, .bigInt: - retainedPayload1 = _swift_js_retain(lowered.payload1) - default: - retainedPayload1 = lowered.payload1 - } - } else { - retainedPayload1 = lowered.payload1 - } + let retainedPayload1 = Self.bridgeJSRetainPayloadIfNeeded(kind: lowered.kind, payload1: lowered.payload1) _swift_js_push_i32(lowered.kind) _swift_js_push_i32(retainedPayload1) _swift_js_push_f64(lowered.payload2) diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index e01c41511..a606ad741 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -5555,16 +5555,7 @@ public func _bjs_roundTripOptionalJSObjectArray() -> Void { @_cdecl("bjs_roundTripFooArray") public func _bjs_roundTripFooArray() -> Void { #if arch(wasm32) - let ret = roundTripFooArray(_: { - let __count = Int(_swift_js_pop_i32()) - var __result: [Foo] = [] - __result.reserveCapacity(__count) - for _ in 0..<__count { - __result.append(Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter())) - } - __result.reverse() - return __result - }()) + let ret = roundTripFooArray(_: [JSObject].bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) }) ret.map { $0.jsObject }.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") From e68262d70c9c8448d8dd21a50ca3157bb082f237 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 12 Feb 2026 16:31:12 +0100 Subject: [PATCH 207/252] BridgeJS: Consolidate optional and pointer runtime intrinsics --- .../JavaScriptKit/BridgeJSIntrinsics.swift | 641 ++++++------------ 1 file changed, 199 insertions(+), 442 deletions(-) diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 90493f773..713088adf 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -520,7 +520,13 @@ extension _JSBridgedClass { @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ id: Int32) -> Self { Self(unsafelyWrapping: JSObject.bridgeJSLiftParameter(id)) } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + bridgeJSLiftParameter(_swift_js_pop_i32()) + } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Int32 { jsObject.bridgeJSLowerReturn() } + @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + _swift_js_push_i32(bridgeJSLowerReturn()) + } } /// A protocol that Swift protocol wrappers exposed from JavaScript must conform to. @@ -996,160 +1002,86 @@ private func _swift_js_pop_pointer_extern() -> UnsafeMutableRawPointer { // MARK: - UnsafePointer family -extension UnsafeMutableRawPointer: _BridgedSwiftStackType { - // MARK: ImportTS - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { self } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn( - _ pointer: UnsafeMutableRawPointer - ) - -> UnsafeMutableRawPointer - { - pointer - } - - // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter( - _ pointer: UnsafeMutableRawPointer - ) - -> UnsafeMutableRawPointer - { - pointer - } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UnsafeMutableRawPointer { - bridgeJSLiftParameter(_swift_js_pop_pointer()) - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { self } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { - _swift_js_push_pointer(self) - } +public protocol _BridgedSwiftUnsafePointerLike: _BridgedSwiftStackType { + @_spi(BridgeJS) func bridgeJSToUnsafeMutableRawPointer() -> UnsafeMutableRawPointer + @_spi(BridgeJS) static func bridgeJSFromUnsafeMutableRawPointer(_ pointer: UnsafeMutableRawPointer) -> Self } -extension UnsafeRawPointer: _BridgedSwiftStackType { +extension _BridgedSwiftUnsafePointerLike { // MARK: ImportTS @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { - UnsafeMutableRawPointer(mutating: self) + bridgeJSToUnsafeMutableRawPointer() } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn( - _ pointer: UnsafeMutableRawPointer - ) - -> UnsafeRawPointer - { - UnsafeRawPointer(pointer) + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ pointer: UnsafeMutableRawPointer) -> Self { + bridgeJSFromUnsafeMutableRawPointer(pointer) } // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter( - _ pointer: UnsafeMutableRawPointer - ) - -> UnsafeRawPointer - { - UnsafeRawPointer(pointer) + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ pointer: UnsafeMutableRawPointer) -> Self { + bridgeJSFromUnsafeMutableRawPointer(pointer) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UnsafeRawPointer { + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { bridgeJSLiftParameter(_swift_js_pop_pointer()) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { - bridgeJSLowerParameter() + bridgeJSToUnsafeMutableRawPointer() } @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { - _swift_js_push_pointer(UnsafeMutableRawPointer(mutating: self)) + _swift_js_push_pointer(bridgeJSToUnsafeMutableRawPointer()) } } -extension OpaquePointer: _BridgedSwiftStackType { - // MARK: ImportTS - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { - UnsafeMutableRawPointer(mutating: UnsafeRawPointer(self)) - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn( +extension UnsafeMutableRawPointer: _BridgedSwiftUnsafePointerLike { + @_spi(BridgeJS) @_transparent public func bridgeJSToUnsafeMutableRawPointer() -> UnsafeMutableRawPointer { self } + @_spi(BridgeJS) @_transparent public static func bridgeJSFromUnsafeMutableRawPointer( _ pointer: UnsafeMutableRawPointer - ) - -> OpaquePointer - { - OpaquePointer(UnsafeRawPointer(pointer)) + ) -> UnsafeMutableRawPointer { + pointer } +} - // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter( - _ pointer: UnsafeMutableRawPointer - ) - -> OpaquePointer - { - OpaquePointer(UnsafeRawPointer(pointer)) - } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> OpaquePointer { - bridgeJSLiftParameter(_swift_js_pop_pointer()) - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { - bridgeJSLowerParameter() +extension UnsafeRawPointer: _BridgedSwiftUnsafePointerLike { + @_spi(BridgeJS) @_transparent public func bridgeJSToUnsafeMutableRawPointer() -> UnsafeMutableRawPointer { + UnsafeMutableRawPointer(mutating: self) } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { - _swift_js_push_pointer(UnsafeMutableRawPointer(mutating: UnsafeRawPointer(self))) + @_spi(BridgeJS) @_transparent public static func bridgeJSFromUnsafeMutableRawPointer( + _ pointer: UnsafeMutableRawPointer + ) -> UnsafeRawPointer { + UnsafeRawPointer(pointer) } } -extension UnsafePointer: _BridgedSwiftStackType { - // MARK: ImportTS - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { +extension OpaquePointer: _BridgedSwiftUnsafePointerLike { + @_spi(BridgeJS) @_transparent public func bridgeJSToUnsafeMutableRawPointer() -> UnsafeMutableRawPointer { UnsafeMutableRawPointer(mutating: UnsafeRawPointer(self)) } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn( + @_spi(BridgeJS) @_transparent public static func bridgeJSFromUnsafeMutableRawPointer( _ pointer: UnsafeMutableRawPointer - ) - -> UnsafePointer - { - UnsafeRawPointer(pointer).assumingMemoryBound(to: Pointee.self) + ) -> OpaquePointer { + OpaquePointer(UnsafeRawPointer(pointer)) } +} - // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter( +extension UnsafePointer: _BridgedSwiftUnsafePointerLike { + @_spi(BridgeJS) @_transparent public func bridgeJSToUnsafeMutableRawPointer() -> UnsafeMutableRawPointer { + UnsafeMutableRawPointer(mutating: UnsafeRawPointer(self)) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSFromUnsafeMutableRawPointer( _ pointer: UnsafeMutableRawPointer - ) - -> UnsafePointer - { + ) -> UnsafePointer { UnsafeRawPointer(pointer).assumingMemoryBound(to: Pointee.self) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UnsafePointer { - bridgeJSLiftParameter(_swift_js_pop_pointer()) - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { - bridgeJSLowerParameter() - } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { - _swift_js_push_pointer(bridgeJSLowerParameter()) - } } -extension UnsafeMutablePointer: _BridgedSwiftStackType { - // MARK: ImportTS - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> UnsafeMutableRawPointer { +extension UnsafeMutablePointer: _BridgedSwiftUnsafePointerLike { + @_spi(BridgeJS) @_transparent public func bridgeJSToUnsafeMutableRawPointer() -> UnsafeMutableRawPointer { UnsafeMutableRawPointer(self) } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn( - _ pointer: UnsafeMutableRawPointer - ) - -> UnsafeMutablePointer - { - pointer.assumingMemoryBound(to: Pointee.self) - } - - // MARK: ExportSwift - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter( + @_spi(BridgeJS) @_transparent public static func bridgeJSFromUnsafeMutableRawPointer( _ pointer: UnsafeMutableRawPointer - ) - -> UnsafeMutablePointer - { + ) -> UnsafeMutablePointer { pointer.assumingMemoryBound(to: Pointee.self) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UnsafeMutablePointer { - bridgeJSLiftParameter(_swift_js_pop_pointer()) - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { - bridgeJSLowerParameter() - } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { - _swift_js_push_pointer(bridgeJSLowerParameter()) - } } // Optional support for JSTypedClosure @@ -1167,145 +1099,178 @@ extension Optional { } } -extension Optional where Wrapped == Bool { - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( - isSome: Int32, value: Int32 - ) { - switch consume self { +extension Optional { + @usableFromInline @_transparent func _bridgeJSLowerParameter( + noneValue: Payload, + lowerWrapped: (Wrapped) -> Payload + ) -> (isSome: Int32, value: Payload) { + switch self { case .none: - return (isSome: 0, value: 0) + return (isSome: 0, value: noneValue) case .some(let wrapped): - return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) + return (isSome: 1, value: lowerWrapped(wrapped)) } } - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Bool? { + @usableFromInline @_transparent static func _bridgeJSLiftParameter( + _ isSome: Int32, + _ payload: Payload, + liftWrapped: (Payload) -> Wrapped + ) -> Wrapped? { if isSome == 0 { return nil - } else { - return Bool.bridgeJSLiftParameter(wrappedValue) - } - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Bool? { - let isSome = _swift_js_pop_i32() - let wrappedValue = _swift_js_pop_i32() - return bridgeJSLiftParameter(isSome, wrappedValue) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Bool? { - switch value { - case -1: - return nil - case 0: - return false - case 1: - return true - default: - return nil // Treat invalid values as null } + return liftWrapped(payload) } - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - switch consume self { + @usableFromInline @_transparent func _bridgeJSLowerReturn( + noneValue: Payload, + lowerWrapped: (Wrapped) -> Payload, + write: (Int32, Payload) -> Void + ) { + switch self { case .none: - _swift_js_return_optional_bool(0, 0) - case .some(let value): - _swift_js_return_optional_bool(1, value.bridgeJSLowerReturn()) + write(0, noneValue) + case .some(let wrapped): + write(1, lowerWrapped(wrapped)) } } } -extension Optional where Wrapped == Int { - // MARK: ExportSwift +public protocol _BridgedSwiftOptionalScalarBridge: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { + @_spi(BridgeJS) static func bridgeJSPopOptionalScalarPayload() -> WasmCoreType + @_spi(BridgeJS) static var bridgeJSOptionalScalarNonePayload: WasmCoreType { get } + @_spi(BridgeJS) static func bridgeJSWriteOptionalReturn(_ isSome: Int32, _ value: WasmCoreType) +} - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( - isSome: Int32, value: Int32 - ) { - switch consume self { - case .none: - return (isSome: 0, value: 0) - case .some(let wrapped): - return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) - } +public protocol _BridgedSwiftOptionalScalarSideChannelBridge: _BridgedSwiftOptionalScalarBridge { + @_spi(BridgeJS) static func bridgeJSReadOptionalSideChannelPresence() -> Int32 + @_spi(BridgeJS) static func bridgeJSReadOptionalSideChannelPayload() -> WasmCoreType +} + +extension Bool: _BridgedSwiftOptionalScalarBridge { + @_spi(BridgeJS) public static func bridgeJSPopOptionalScalarPayload() -> Int32 { _swift_js_pop_i32() } + @_spi(BridgeJS) public static var bridgeJSOptionalScalarNonePayload: Int32 { 0 } + @_spi(BridgeJS) public static func bridgeJSWriteOptionalReturn(_ isSome: Int32, _ value: Int32) { + _swift_js_return_optional_bool(isSome, value) } +} - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Int? { - if isSome == 0 { - return nil - } else { - return Int.bridgeJSLiftParameter(wrappedValue) - } +extension Int: _BridgedSwiftOptionalScalarSideChannelBridge { + @_spi(BridgeJS) public static func bridgeJSPopOptionalScalarPayload() -> Int32 { _swift_js_pop_i32() } + @_spi(BridgeJS) public static var bridgeJSOptionalScalarNonePayload: Int32 { 0 } + @_spi(BridgeJS) public static func bridgeJSWriteOptionalReturn(_ isSome: Int32, _ value: Int32) { + _swift_js_return_optional_int(isSome, value) + } + @_spi(BridgeJS) public static func bridgeJSReadOptionalSideChannelPresence() -> Int32 { + _swift_js_get_optional_int_presence() + } + @_spi(BridgeJS) public static func bridgeJSReadOptionalSideChannelPayload() -> Int32 { + _swift_js_get_optional_int_value() } +} - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Int? { - let isSome = _swift_js_pop_i32() - let wrappedValue = _swift_js_pop_i32() - return bridgeJSLiftParameter(isSome, wrappedValue) +extension UInt: _BridgedSwiftOptionalScalarSideChannelBridge { + @_spi(BridgeJS) public static func bridgeJSPopOptionalScalarPayload() -> Int32 { _swift_js_pop_i32() } + @_spi(BridgeJS) public static var bridgeJSOptionalScalarNonePayload: Int32 { 0 } + @_spi(BridgeJS) public static func bridgeJSWriteOptionalReturn(_ isSome: Int32, _ value: Int32) { + _swift_js_return_optional_int(isSome, value) } + @_spi(BridgeJS) public static func bridgeJSReadOptionalSideChannelPresence() -> Int32 { + _swift_js_get_optional_int_presence() + } + @_spi(BridgeJS) public static func bridgeJSReadOptionalSideChannelPayload() -> Int32 { + _swift_js_get_optional_int_value() + } +} - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Int? { - let isSome = _swift_js_get_optional_int_presence() - if isSome == 0 { - return nil - } else { - return Int.bridgeJSLiftReturn(_swift_js_get_optional_int_value()) - } +extension Float: _BridgedSwiftOptionalScalarSideChannelBridge { + @_spi(BridgeJS) public static func bridgeJSPopOptionalScalarPayload() -> Float32 { _swift_js_pop_f32() } + @_spi(BridgeJS) public static var bridgeJSOptionalScalarNonePayload: Float32 { 0.0 } + @_spi(BridgeJS) public static func bridgeJSWriteOptionalReturn(_ isSome: Int32, _ value: Float32) { + _swift_js_return_optional_float(isSome, value) + } + @_spi(BridgeJS) public static func bridgeJSReadOptionalSideChannelPresence() -> Int32 { + _swift_js_get_optional_float_presence() } + @_spi(BridgeJS) public static func bridgeJSReadOptionalSideChannelPayload() -> Float32 { + _swift_js_get_optional_float_value() + } +} - @_spi(BridgeJS) public func bridgeJSLowerReturn() -> Void { - switch self { - case .none: - _swift_js_return_optional_int(0, 0) - case .some(let value): - _swift_js_return_optional_int(1, value.bridgeJSLowerReturn()) - } +extension Double: _BridgedSwiftOptionalScalarSideChannelBridge { + @_spi(BridgeJS) public static func bridgeJSPopOptionalScalarPayload() -> Float64 { _swift_js_pop_f64() } + @_spi(BridgeJS) public static var bridgeJSOptionalScalarNonePayload: Float64 { 0.0 } + @_spi(BridgeJS) public static func bridgeJSWriteOptionalReturn(_ isSome: Int32, _ value: Float64) { + _swift_js_return_optional_double(isSome, value) + } + @_spi(BridgeJS) public static func bridgeJSReadOptionalSideChannelPresence() -> Int32 { + _swift_js_get_optional_double_presence() + } + @_spi(BridgeJS) public static func bridgeJSReadOptionalSideChannelPayload() -> Float64 { + _swift_js_get_optional_double_value() } } -extension Optional where Wrapped == UInt { +extension Optional where Wrapped: _BridgedSwiftOptionalScalarBridge { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( - isSome: Int32, value: Int32 + isSome: Int32, value: Wrapped.WasmCoreType ) { switch consume self { case .none: - return (isSome: 0, value: 0) + return (isSome: 0, value: Wrapped.bridgeJSOptionalScalarNonePayload) case .some(let wrapped): return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) } } - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> UInt? { + @_spi(BridgeJS) public static func bridgeJSLiftParameter( + _ isSome: Int32, + _ wrappedValue: Wrapped.WasmCoreType + ) -> Wrapped? { if isSome == 0 { return nil - } else { - return UInt.bridgeJSLiftParameter(wrappedValue) } + return Wrapped.bridgeJSLiftParameter(wrappedValue) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UInt? { + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { let isSome = _swift_js_pop_i32() - let wrappedValue = _swift_js_pop_i32() + let wrappedValue = Wrapped.bridgeJSPopOptionalScalarPayload() return bridgeJSLiftParameter(isSome, wrappedValue) } - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> UInt? { - let isSome = _swift_js_get_optional_int_presence() + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + switch consume self { + case .none: + Wrapped.bridgeJSWriteOptionalReturn(0, Wrapped.bridgeJSOptionalScalarNonePayload) + case .some(let value): + Wrapped.bridgeJSWriteOptionalReturn(1, value.bridgeJSLowerReturn()) + } + } +} + +extension Optional where Wrapped: _BridgedSwiftOptionalScalarSideChannelBridge { + @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { + let isSome = Wrapped.bridgeJSReadOptionalSideChannelPresence() if isSome == 0 { return nil - } else { - return UInt.bridgeJSLiftReturn(_swift_js_get_optional_int_value()) } + return Wrapped.bridgeJSLiftReturn(Wrapped.bridgeJSReadOptionalSideChannelPayload()) } +} - @_spi(BridgeJS) public func bridgeJSLowerReturn() -> Void { - switch self { - case .none: - _swift_js_return_optional_int(0, 0) - case .some(let value): - _swift_js_return_optional_int(1, value.bridgeJSLowerReturn()) +extension Optional where Wrapped == Bool { + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Bool? { + switch value { + case -1: + return nil + case 0: + return false + case 1: + return true + default: + return nil // Treat invalid values as null } } } @@ -1315,21 +1280,12 @@ extension Optional where Wrapped == String { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( isSome: Int32, value: Int32 ) { - switch consume self { - case .none: - return (isSome: 0, value: 0) - case .some(let wrapped): - return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) - } + _bridgeJSLowerParameter(noneValue: 0, lowerWrapped: { $0.bridgeJSLowerParameter() }) } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ bytes: Int32, _ count: Int32) -> String? { - if isSome == 0 { - return nil - } else { - return String.bridgeJSLiftParameter(bytes, count) - } + _bridgeJSLiftParameter(isSome, (bytes, count), liftWrapped: { String.bridgeJSLiftParameter($0.0, $0.1) }) } @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> String? { @@ -1365,20 +1321,11 @@ extension Optional where Wrapped == JSObject { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( isSome: Int32, value: Int32 ) { - switch consume self { - case .none: - return (isSome: 0, value: 0) - case .some(let wrapped): - return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) - } + _bridgeJSLowerParameter(noneValue: 0, lowerWrapped: { $0.bridgeJSLowerParameter() }) } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ objectId: Int32) -> JSObject? { - if isSome == 0 { - return nil - } else { - return JSObject.bridgeJSLiftParameter(objectId) - } + _bridgeJSLiftParameter(isSome, objectId, liftWrapped: JSObject.bridgeJSLiftParameter) } @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> JSObject? { @@ -1388,13 +1335,11 @@ extension Optional where Wrapped == JSObject { } @_spi(BridgeJS) public func bridgeJSLowerReturn() -> Void { - switch self { - case .none: - _swift_js_return_optional_object(0, 0) - case .some(let value): - let retainedId = value.bridgeJSLowerReturn() - _swift_js_return_optional_object(1, retainedId) - } + _bridgeJSLowerReturn( + noneValue: 0, + lowerWrapped: { $0.bridgeJSLowerReturn() }, + write: _swift_js_return_optional_object + ) } } @@ -1496,11 +1441,7 @@ extension Optional where Wrapped: _BridgedSwiftProtocolWrapper { // MARK: ExportSwift @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ objectId: Int32) -> Wrapped? { - if isSome == 0 { - return nil - } else { - return Wrapped.bridgeJSLiftParameter(objectId) - } + _bridgeJSLiftParameter(isSome, objectId, liftWrapped: Wrapped.bridgeJSLiftParameter) } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { @@ -1569,11 +1510,7 @@ extension Optional where Wrapped: _BridgedSwiftHeapObject { _ isSome: Int32, _ pointer: UnsafeMutableRawPointer ) -> Optional { - if isSome == 0 { - return nil - } else { - return Wrapped.bridgeJSLiftParameter(pointer) - } + _bridgeJSLiftParameter(isSome, pointer, liftWrapped: Wrapped.bridgeJSLiftParameter) } @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { @@ -1601,120 +1538,16 @@ extension Optional where Wrapped: _BridgedSwiftHeapObject { } } } -extension Optional where Wrapped == Float { - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( - isSome: Int32, value: Float32 - ) { - switch consume self { - case .none: - return (isSome: 0, value: 0.0) - case .some(let wrapped): - return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) - } - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Float? { - if isSome == 0 { - return nil - } else { - return Float.bridgeJSLiftParameter(wrappedValue) - } - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Float? { - let isSome = _swift_js_pop_i32() - let wrappedValue = _swift_js_pop_f32() - return bridgeJSLiftParameter(isSome, wrappedValue) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Float? { - let isSome = _swift_js_get_optional_float_presence() - if isSome == 0 { - return nil - } else { - return Float.bridgeJSLiftReturn(_swift_js_get_optional_float_value()) - } - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - switch consume self { - case .none: - _swift_js_return_optional_float(0, 0.0) - case .some(let value): - _swift_js_return_optional_float(1, value.bridgeJSLowerReturn()) - } - } -} - -/// Optional support for Double -extension Optional where Wrapped == Double { - // MARK: ExportSwift - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> ( - isSome: Int32, value: Float64 - ) { - switch consume self { - case .none: - return (isSome: 0, value: 0.0) - case .some(let wrapped): - return (isSome: 1, value: wrapped.bridgeJSLowerParameter()) - } - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float64) -> Double? { - if isSome == 0 { - return nil - } else { - return Double.bridgeJSLiftParameter(wrappedValue) - } - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Double? { - let isSome = _swift_js_pop_i32() - let wrappedValue = _swift_js_pop_f64() - return bridgeJSLiftParameter(isSome, wrappedValue) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Double? { - let isSome = _swift_js_get_optional_double_presence() - if isSome == 0 { - return nil - } else { - return Double.bridgeJSLiftReturn(_swift_js_get_optional_double_value()) - } - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - switch consume self { - case .none: - _swift_js_return_optional_double(0, 0.0) - case .some(let value): - _swift_js_return_optional_double(1, value.bridgeJSLowerReturn()) - } - } -} - /// Optional support for case enums extension Optional where Wrapped: _BridgedSwiftCaseEnum { // MARK: ExportSwift @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - switch consume self { - case .none: - return (isSome: 0, value: 0) - case .some(let value): - return (isSome: 1, value: value.bridgeJSLowerParameter()) - } + _bridgeJSLowerParameter(noneValue: 0, lowerWrapped: { $0.bridgeJSLowerParameter() }) } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Wrapped? { - if isSome == 0 { - return nil - } else { - return Wrapped.bridgeJSLiftParameter(wrappedValue) - } + _bridgeJSLiftParameter(isSome, wrappedValue, liftWrapped: Wrapped.bridgeJSLiftParameter) } @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { @@ -1732,12 +1565,11 @@ extension Optional where Wrapped: _BridgedSwiftCaseEnum { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - switch consume self { - case .none: - _swift_js_return_optional_int(0, 0) - case .some(let value): - _swift_js_return_optional_int(1, value.bridgeJSLowerReturn()) - } + _bridgeJSLowerReturn( + noneValue: 0, + lowerWrapped: { $0.bridgeJSLowerReturn() }, + write: _swift_js_return_optional_int + ) } } @@ -2030,12 +1862,17 @@ where Wrapped: _BridgedSwiftGenericOptionalStackType { // MARK: - _BridgedAsOptional (JSUndefinedOr) delegating to Optional -extension _BridgedAsOptional where Wrapped == Bool { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { +extension _BridgedAsOptional where Wrapped: _BridgedSwiftOptionalScalarBridge { + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> ( + isSome: Int32, value: Wrapped.WasmCoreType + ) { asOptional.bridgeJSLowerParameter() } - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { + @_spi(BridgeJS) public static func bridgeJSLiftParameter( + _ isSome: Int32, + _ wrappedValue: Wrapped.WasmCoreType + ) -> Self { Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) } @@ -2043,56 +1880,20 @@ extension _BridgedAsOptional where Wrapped == Bool { Self(optional: Optional.bridgeJSLiftParameter()) } - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftReturn(value)) - } - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { asOptional.bridgeJSLowerReturn() } } -extension _BridgedAsOptional where Wrapped == Int { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - asOptional.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - +extension _BridgedAsOptional where Wrapped: _BridgedSwiftOptionalScalarSideChannelBridge { @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - asOptional.bridgeJSLowerReturn() - } } -extension _BridgedAsOptional where Wrapped == UInt { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { - asOptional.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Int32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - asOptional.bridgeJSLowerReturn() +extension _BridgedAsOptional where Wrapped == Bool { + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ value: Int32) -> Self { + Self(optional: Optional.bridgeJSLiftReturn(value)) } } @@ -2182,50 +1983,6 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftHeapObject { } } -extension _BridgedAsOptional where Wrapped == Float { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float32) { - asOptional.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float32) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - asOptional.bridgeJSLowerReturn() - } -} - -extension _BridgedAsOptional where Wrapped == Double { - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Float64) { - asOptional.bridgeJSLowerParameter() - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32, _ wrappedValue: Float64) -> Self { - Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) - } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { - Self(optional: Optional.bridgeJSLiftReturnFromSideChannel()) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - asOptional.bridgeJSLowerReturn() - } -} - extension _BridgedAsOptional where Wrapped: _BridgedSwiftCaseEnum { @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, value: Int32) { asOptional.bridgeJSLowerParameter() From ac72422ca67aacefa94b79590ffdfc1c1ac11921 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 13 Feb 2026 02:34:05 +0900 Subject: [PATCH 208/252] Merge pull request #627 from swiftwasm/katei/bf1a-fix-ts2swift-for Fix ts2swift alias struct naming and docs --- .../TS2Swift/JavaScript/src/processor.js | 6 +++--- .../test/__snapshots__/ts2swift.test.js.snap | 19 +++++++++++++++++++ .../test/fixtures/TypeAliasObject.d.ts | 11 +++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TypeAliasObject.d.ts diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 302058036..c71ff6fe5 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -747,8 +747,8 @@ export class TypeProcessor { * @private */ visitStructuredType(type, diagnosticNode, members) { - const symbol = type.getSymbol() ?? type.aliasSymbol; - const name = symbol?.name ?? this.checker.typeToString(type); + const symbol = type.aliasSymbol ?? type.getSymbol(); + const name = type.aliasSymbol?.name ?? symbol?.name ?? this.checker.typeToString(type); if (!name) return; if (this.emittedStructuredTypeNames.has(name)) return; this.emittedStructuredTypeNames.add(name); @@ -760,7 +760,7 @@ export class TypeProcessor { if (jsNameArg) args.push(jsNameArg); const annotation = this.renderMacroAnnotation("JSClass", args); const typeName = this.renderIdentifier(swiftName); - const docNode = symbol?.getDeclarations()?.[0] ?? diagnosticNode; + const docNode = type.aliasSymbol?.getDeclarations()?.[0] ?? symbol?.getDeclarations()?.[0] ?? diagnosticNode; if (docNode) { this.emitDocComment(docNode, { indent: "" }); } diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index 343f8795b..49814a996 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -426,6 +426,25 @@ exports[`ts2swift > snapshots Swift output for TypeAlias.d.ts > TypeAlias 1`] = " `; +exports[`ts2swift > snapshots Swift output for TypeAliasObject.d.ts > TypeAliasObject 1`] = ` +"// 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(Experimental) @_spi(BridgeJS) import JavaScriptKit + +@JSFunction func console() throws(JSException) -> Console + +/// Console from the environment. +@JSClass struct Console { + /// Log a message. + @JSFunction func log(_ message: String) throws(JSException) -> Void +} +" +`; + exports[`ts2swift > snapshots Swift output for TypeScriptClass.d.ts > TypeScriptClass 1`] = ` "// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TypeAliasObject.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TypeAliasObject.d.ts new file mode 100644 index 000000000..55ffdfa3a --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/TypeAliasObject.d.ts @@ -0,0 +1,11 @@ +/** + * Console from the environment. + */ +export type Console = { + /** + * Log a message. + */ + log(message: string): void; +}; + +export function console(): Console; From b3ddd88f6565ed9e5fa173350712e15e97cb7ac9 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 12 Feb 2026 18:40:34 +0100 Subject: [PATCH 209/252] Prevent cross-module inlining of f32/f64 @_extern(wasm) functions --- .../JavaScriptKit/BridgeJSIntrinsics.swift | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index ff219531d..0715703a3 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -723,22 +723,30 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_push_f32") -@_spi(BridgeJS) public func _swift_js_push_f32(_ value: Float32) +private func _swift_js_push_f32_extern(_ value: Float32) #else -@_spi(BridgeJS) public func _swift_js_push_f32(_ value: Float32) { +private func _swift_js_push_f32_extern(_ value: Float32) { _onlyAvailableOnWasm() } #endif +@_spi(BridgeJS) @inline(never) public func _swift_js_push_f32(_ value: Float32) { + _swift_js_push_f32_extern(value) +} + #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_push_f64") -@_spi(BridgeJS) public func _swift_js_push_f64(_ value: Float64) +private func _swift_js_push_f64_extern(_ value: Float64) #else -@_spi(BridgeJS) public func _swift_js_push_f64(_ value: Float64) { +private func _swift_js_push_f64_extern(_ value: Float64) { _onlyAvailableOnWasm() } #endif +@_spi(BridgeJS) @inline(never) public func _swift_js_push_f64(_ value: Float64) { + _swift_js_push_f64_extern(value) +} + #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_pop_i32") @_spi(BridgeJS) public func _swift_js_pop_i32() -> Int32 @@ -750,22 +758,30 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_pop_f32") -@_spi(BridgeJS) public func _swift_js_pop_f32() -> Float32 +private func _swift_js_pop_f32_extern() -> Float32 #else -@_spi(BridgeJS) public func _swift_js_pop_f32() -> Float32 { +private func _swift_js_pop_f32_extern() -> Float32 { _onlyAvailableOnWasm() } #endif +@_spi(BridgeJS) @inline(never) public func _swift_js_pop_f32() -> Float32 { + _swift_js_pop_f32_extern() +} + #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_pop_f64") -@_spi(BridgeJS) public func _swift_js_pop_f64() -> Float64 +private func _swift_js_pop_f64_extern() -> Float64 #else -@_spi(BridgeJS) public func _swift_js_pop_f64() -> Float64 { +private func _swift_js_pop_f64_extern() -> Float64 { _onlyAvailableOnWasm() } #endif +@_spi(BridgeJS) @inline(never) public func _swift_js_pop_f64() -> Float64 { + _swift_js_pop_f64_extern() +} + // MARK: Struct bridging helpers (JS-side lowering/raising) #if arch(wasm32) From e34f3824edcb9d08f2f127162f3c4a33bf318ca5 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 13 Feb 2026 10:21:24 +0900 Subject: [PATCH 210/252] BridgeJS: add runtime coverage for `public @JS struct` (#629) BridgeJS: add runtime coverage for public JS structs --- .../Generated/BridgeJS.swift | 67 +++++++++++++++ .../Generated/JavaScript/BridgeJS.json | 83 +++++++++++++++++++ Tests/BridgeJSRuntimeTests/StructAPIs.swift | 14 ++++ Tests/prelude.mjs | 3 + 4 files changed, 167 insertions(+) diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index a606ad741..e24775f43 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2884,6 +2884,62 @@ public func _bjs_DataPoint_init(_ x: Float64, _ y: Float64, _ labelBytes: Int32, #endif } +extension PublicPoint: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PublicPoint { + let y = Int.bridgeJSLiftParameter() + let x = Int.bridgeJSLiftParameter() + return PublicPoint(x: x, y: y) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + self.x.bridgeJSLowerStackReturn() + self.y.bridgeJSLowerStackReturn() + } + + public init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_PublicPoint(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSLiftParameter() + } + + public func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSLowerReturn() + 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(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_PublicPoint(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PublicPoint") +fileprivate func _bjs_struct_lift_PublicPoint() -> Int32 +#else +fileprivate func _bjs_struct_lift_PublicPoint() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_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 bridgeJSLiftParameter() -> Address { let zipCode = Optional.bridgeJSLiftParameter() @@ -5954,6 +6010,17 @@ public func _bjs_roundTripDataPoint() -> Void { #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 { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 7e2d4d855..fc650b37d 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -11131,6 +11131,31 @@ } } }, + { + "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" : { @@ -12196,6 +12221,64 @@ ], "swiftCallName" : "DataPoint" }, + { + "constructor" : { + "abiName" : "bjs_PublicPoint_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "x", + "name" : "x", + "type" : { + "int" : { + + } + } + }, + { + "label" : "y", + "name" : "y", + "type" : { + "int" : { + + } + } + } + ] + }, + "explicitAccessControl" : "public", + "methods" : [ + + ], + "name" : "PublicPoint", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "x", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "y", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "PublicPoint" + }, { "methods" : [ diff --git a/Tests/BridgeJSRuntimeTests/StructAPIs.swift b/Tests/BridgeJSRuntimeTests/StructAPIs.swift index 49869e0f5..38e7b12e6 100644 --- a/Tests/BridgeJSRuntimeTests/StructAPIs.swift +++ b/Tests/BridgeJSRuntimeTests/StructAPIs.swift @@ -40,6 +40,16 @@ } } +@JS public struct PublicPoint { + public var x: Int + public var y: Int + + @JS public init(x: Int, y: Int) { + self.x = x + self.y = y + } +} + @JS struct Address { var street: String var city: String @@ -168,6 +178,10 @@ return data } +@JS public func roundTripPublicPoint(_ point: PublicPoint) -> PublicPoint { + point +} + @JS func roundTripContact(_ contact: Contact) -> Contact { return contact } diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index efb168a6d..ec37bdbc4 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -890,6 +890,9 @@ function testStructSupport(exports) { const data2 = { x: 0.0, y: 0.0, label: "", optCount: null, optFlag: null }; assert.deepEqual(exports.roundTripDataPoint(data2), data2); + const publicPoint = { x: 9, y: -3 }; + assert.deepEqual(exports.roundTripPublicPoint(publicPoint), publicPoint); + const pointerFields1 = { raw: 1, mutRaw: 4, opaque: 1024, ptr: 65536, mutPtr: 2 }; assert.deepEqual(exports.roundTripPointerFields(pointerFields1), pointerFields1); From 6682a2e7e70ba1744da1e0896b7f54a2c98e8c42 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 13 Feb 2026 13:47:04 +0900 Subject: [PATCH 211/252] BridgeJS: Prepare for MVP release for documentation and relaxing feature gates (#630) * BridgeJS: Make `@JSClass`, `@JSFunction`, etc generally available without @_spi(Experimental) * BridgeJS: Remove JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS feature gate * BridgeJS: Update documentation for MVP release * [skip ci] Update READMEs --- Benchmarks/README.md | 2 +- .../Sources/Generated/BridgeJS.Macros.swift | 2 +- Examples/ExportSwift/README.md | 2 +- .../Generated/BridgeJS.Macros.swift | 2 +- Examples/PlayBridgeJS/build.sh | 2 +- Makefile | 2 +- Plugins/BridgeJS/README.md | 10 +- .../Sources/TS2Swift/JavaScript/src/cli.js | 2 +- .../test/__snapshots__/ts2swift.test.js.snap | 42 +- Plugins/PackageToJS/Sources/PackageToJS.swift | 5 - README.md | 44 +- .../BridgeJS/Ahead-of-Time-Code-Generation.md | 17 +- .../BridgeJS/BridgeJS-Configuration.md | 2 +- .../BridgeJS-Internals/BridgeJS-Internals.md | 11 + .../BridgeJS-Internals/Design-Rationale.md | 38 ++ .../Bringing-Swift-Closures-to-JavaScript.md | 80 ++++ .../BridgeJS/Exporting-Swift-to-JavaScript.md | 59 +-- .../Exporting-Swift/Exporting-Swift-Array.md | 2 +- .../Exporting-Swift/Exporting-Swift-Class.md | 5 +- .../Exporting-Swift-Closure.md | 9 +- .../Exporting-Swift-Default-Parameters.md | 4 +- .../Exporting-Swift/Exporting-Swift-Enum.md | 2 +- .../Exporting-Swift-Function.md | 2 +- .../Exporting-Swift-Optional.md | 10 +- .../Exporting-Swift-Protocols.md | 20 +- .../Exporting-Swift-Static-Functions.md | 12 +- .../Exporting-Swift-Static-Properties.md | 10 +- .../Exporting-Swift/Exporting-Swift-Struct.md | 4 +- .../Exporting-Swift/Using-Namespace.md | 6 +- .../BridgeJS/Generating-from-TypeScript.md | 419 ++++++++++++++++++ .../Importing-JavaScript-into-Swift.md | 98 ++++ .../Importing-JS-Class.md | 54 +++ .../Importing-JS-Function.md | 51 +++ .../Importing-JS-Variable.md | 59 +++ .../Importing-TypeScript-into-Swift.md | 185 -------- .../Importing-TS-Class.md | 64 --- .../Importing-TS-Function.md | 60 --- .../Importing-TS-Interface.md | 34 -- .../Importing-TS-TypeAlias.md | 47 -- .../Articles/BridgeJS/Introducing-BridgeJS.md | 32 ++ .../Articles/BridgeJS/Setting-up-BridgeJS.md | 60 +++ .../Articles/BridgeJS/Supported-Types.md | 34 +- .../Documentation.docc/Articles/FAQ.md | 28 ++ .../Documentation.docc/Documentation.md | 13 +- Sources/JavaScriptKit/Macros.swift | 12 +- .../ClosureSupportTests.swift | 2 +- .../DictionaryTests.swift | 2 +- .../BridgeJSRuntimeTests/ExportAPITests.swift | 2 +- .../Generated/BridgeJS.Macros.swift | 2 +- .../ImportArrayAPIs.swift | 2 +- .../ImportStructAPIs.swift | 2 +- .../OptionalSupportTests.swift | 2 +- Tests/BridgeJSRuntimeTests/StructAPIs.swift | 2 +- .../SwiftClassSupportTests.swift | 2 +- 54 files changed, 1091 insertions(+), 585 deletions(-) create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Internals/BridgeJS-Internals.md create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Internals/Design-Rationale.md create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Bringing-Swift-Closures-to-JavaScript.md create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Generating-from-TypeScript.md create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript-into-Swift.md create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript/Importing-JS-Class.md create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript/Importing-JS-Function.md create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript/Importing-JS-Variable.md delete mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript-into-Swift.md delete mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-Class.md delete mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-Function.md delete mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-Interface.md delete mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-TypeAlias.md create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Introducing-BridgeJS.md create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Setting-up-BridgeJS.md create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/FAQ.md diff --git a/Benchmarks/README.md b/Benchmarks/README.md index f7264b6b7..65d867eba 100644 --- a/Benchmarks/README.md +++ b/Benchmarks/README.md @@ -7,7 +7,7 @@ This directory contains performance benchmarks for JavaScriptKit. Before running the benchmarks, you need to build the test suite: ```bash -JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --swift-sdk $SWIFT_SDK_ID js -c release +swift package --swift-sdk $SWIFT_SDK_ID js -c release ``` ## Running Benchmarks diff --git a/Benchmarks/Sources/Generated/BridgeJS.Macros.swift b/Benchmarks/Sources/Generated/BridgeJS.Macros.swift index 39a46d22c..40fc29e91 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.Macros.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func benchmarkHelperNoop() throws(JSException) -> Void diff --git a/Examples/ExportSwift/README.md b/Examples/ExportSwift/README.md index 57d419295..39c66f0a6 100644 --- a/Examples/ExportSwift/README.md +++ b/Examples/ExportSwift/README.md @@ -5,7 +5,7 @@ This example demonstrates how to export Swift functions to JavaScript. 1. Build the project: ```sh - env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --swift-sdk $SWIFT_SDK_ID js --use-cdn + swift package --swift-sdk $SWIFT_SDK_ID js --use-cdn ``` 2. Serve the files: diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift index c619a8883..4a87a6d38 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func createTS2Swift() throws(JSException) -> TS2Swift diff --git a/Examples/PlayBridgeJS/build.sh b/Examples/PlayBridgeJS/build.sh index d2589f798..31c07896c 100755 --- a/Examples/PlayBridgeJS/build.sh +++ b/Examples/PlayBridgeJS/build.sh @@ -1,5 +1,5 @@ #!/bin/bash set -euxo pipefail -env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1}}" \ +swift package --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1}}" \ plugin --allow-writing-to-package-directory \ js --use-cdn --output ./Bundle -c "${1:-debug}" diff --git a/Makefile b/Makefile index 135465a73..270eb9b36 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ unittest: echo "SWIFT_SDK_ID is not set. Run 'swift sdk list' and pass a matching SDK, e.g. 'make unittest SWIFT_SDK_ID='."; \ exit 2; \ } - env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --swift-sdk "$(SWIFT_SDK_ID)" \ + swift package --swift-sdk "$(SWIFT_SDK_ID)" \ $(TRACING_ARGS) \ --disable-sandbox \ js test --prelude ./Tests/prelude.mjs -Xnode --expose-gc diff --git a/Plugins/BridgeJS/README.md b/Plugins/BridgeJS/README.md index 0559dc3fb..0b6ad121e 100644 --- a/Plugins/BridgeJS/README.md +++ b/Plugins/BridgeJS/README.md @@ -1,17 +1,17 @@ # BridgeJS > [!IMPORTANT] -> This feature is still experimental, and the API may change frequently. Use at your own risk with `JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1` environment variable. +> This feature is still experimental, and the API may change frequently. Use at your own risk. > [!NOTE] -> This documentation is intended for JavaScriptKit developers, not JavaScriptKit users. For user documentation, see [Exporting Swift to JavaScript](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/exporting-swift-to-javascript) and [Importing TypeScript into Swift](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/importing-typescript-into-swift). +> This documentation is intended for JavaScriptKit developers, not JavaScriptKit users. For user documentation, see [Introducing BridgeJS](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/introducing-bridgejs), [Setting up BridgeJS](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/setting-up-bridgejs), [Exporting Swift to JavaScript](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/exporting-swift-to-javascript), [Importing JavaScript into Swift](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/importing-javascript-into-swift), and [Generating bindings from TypeScript](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/generating-from-typescript). ## Overview BridgeJS provides easy interoperability between Swift and JavaScript/TypeScript. It enables: -1. **Importing TypeScript APIs into Swift**: Use TypeScript/JavaScript APIs directly from Swift code -2. **Exporting Swift APIs to JavaScript**: Make your Swift APIs available to JavaScript code +1. **Export Swift to JavaScript** – Expose Swift functions, classes, and types to JavaScript; the plugin generates TypeScript definitions (`.d.ts`) for the exported API. +2. **Import JavaScript into Swift** – Make JavaScript/TypeScript APIs callable from Swift with macro-annotated bindings or bindings generated from a TypeScript declaration file (`bridge-js.d.ts`). The workflow is: @@ -161,7 +161,7 @@ Return values use direct Wasm returns for primitives, and imported intrinsic fun - **Structs/Arrays/Enums**: Copy semantics - data serialized across boundary. No cleanup needed. - **Closures**: Boxed on source side, released when GC'd on either side. -For detailed semantics, see the [How It Works sections](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/exporting-swift-class#How-It-Works) in the user documentation. +For detailed semantics, see the [How It Works sections](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/exporting-swift-class#how-it-works) in the user documentation. ## Testing diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js index 766cd0432..98453ebf1 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js @@ -123,7 +123,7 @@ export function run(filePath, options) { "// To update this file, just rebuild your project or run", "// `swift package bridge-js`.", "", - "@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit", + "@_spi(BridgeJS) import JavaScriptKit", "", "", ].join("\n"); diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index 49814a996..85d1da0de 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -7,7 +7,7 @@ exports[`ts2swift > snapshots Swift output for ArrayParameter.d.ts > ArrayParame // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func processNumbers(_ values: [Double]) throws(JSException) -> Void @@ -30,7 +30,7 @@ exports[`ts2swift > snapshots Swift output for Async.d.ts > Async 1`] = ` // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func asyncReturnVoid() throws(JSException) -> JSPromise @@ -55,7 +55,7 @@ exports[`ts2swift > snapshots Swift output for Documentation.d.ts > Documentatio // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit /// Return a greeting for a user. /// @@ -112,7 +112,7 @@ exports[`ts2swift > snapshots Swift output for Interface.d.ts > Interface 1`] = // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func returnAnimatable() throws(JSException) -> Animatable @@ -130,7 +130,7 @@ exports[`ts2swift > snapshots Swift output for InvalidPropertyNames.d.ts > Inval // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func createArrayBuffer() throws(JSException) -> ArrayBufferLike @@ -178,7 +178,7 @@ exports[`ts2swift > snapshots Swift output for MultipleImportedTypes.d.ts > Mult // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func createDatabaseConnection(_ config: JSValue) throws(JSException) -> DatabaseConnection @@ -215,7 +215,7 @@ exports[`ts2swift > snapshots Swift output for ObjectLikeTypes.d.ts > ObjectLike // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func acceptObject(_ v: JSObject) throws(JSException) -> Void " @@ -228,7 +228,7 @@ exports[`ts2swift > snapshots Swift output for OptionalNullUndefined.d.ts > Opti // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func roundTripNumberNull(_ value: Optional) throws(JSException) -> Optional @@ -269,7 +269,7 @@ exports[`ts2swift > snapshots Swift output for PrimitiveParameters.d.ts > Primit // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func check(_ a: Double, _ b: Bool) throws(JSException) -> Void " @@ -282,7 +282,7 @@ exports[`ts2swift > snapshots Swift output for PrimitiveReturn.d.ts > PrimitiveR // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func checkNumber() throws(JSException) -> Double @@ -297,7 +297,7 @@ exports[`ts2swift > snapshots Swift output for ReExportFrom.d.ts > ReExportFrom // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func jsRoundTripNumber(_ v: Double) throws(JSException) -> Double @@ -315,7 +315,7 @@ exports[`ts2swift > snapshots Swift output for RecordDictionary.d.ts > RecordDic // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func takeRecord(_ value: [String: Double]) throws(JSException) -> Void @@ -345,7 +345,7 @@ exports[`ts2swift > snapshots Swift output for StringEnum.d.ts > StringEnum 1`] // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit enum FeatureFlag: String { case foo = "foo" @@ -366,7 +366,7 @@ exports[`ts2swift > snapshots Swift output for StringParameter.d.ts > StringPara // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func checkString(_ a: String) throws(JSException) -> Void @@ -381,7 +381,7 @@ exports[`ts2swift > snapshots Swift output for StringReturn.d.ts > StringReturn // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func checkString() throws(JSException) -> String " @@ -394,7 +394,7 @@ exports[`ts2swift > snapshots Swift output for TS2SkeletonLike.d.ts > TS2Skeleto // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func createTS2Skeleton() throws(JSException) -> TypeScriptProcessor @@ -420,7 +420,7 @@ exports[`ts2swift > snapshots Swift output for TypeAlias.d.ts > TypeAlias 1`] = // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func checkSimple(_ a: Double) throws(JSException) -> Void " @@ -433,7 +433,7 @@ exports[`ts2swift > snapshots Swift output for TypeAliasObject.d.ts > TypeAliasO // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func console() throws(JSException) -> Console @@ -452,7 +452,7 @@ exports[`ts2swift > snapshots Swift output for TypeScriptClass.d.ts > TypeScript // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSClass struct Greeter { @JSGetter var name: String @@ -473,7 +473,7 @@ exports[`ts2swift > snapshots Swift output for VoidParameterVoidReturn.d.ts > Vo // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func check() throws(JSException) -> Void " @@ -486,7 +486,7 @@ exports[`ts2swift > snapshots Swift output for WebIDLDOMDocs.d.ts > WebIDLDOMDoc // To update this file, just rebuild your project or run // \`swift package bridge-js\`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit /// [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document) @JSGetter var document: Document diff --git a/Plugins/PackageToJS/Sources/PackageToJS.swift b/Plugins/PackageToJS/Sources/PackageToJS.swift index 268f3f200..2e47dcf71 100644 --- a/Plugins/PackageToJS/Sources/PackageToJS.swift +++ b/Plugins/PackageToJS/Sources/PackageToJS.swift @@ -589,11 +589,6 @@ struct PackagingPlanner { packageInputs.append(packageJsonTask) if skeletons.count > 0 { - if ProcessInfo.processInfo.environment["JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS"] == nil { - fatalError( - "BridgeJS is still an experimental feature. Set the environment variable JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 to enable." - ) - } let bridgeJs = outputDir.appending(path: "bridge-js.js") let bridgeDts = outputDir.appending(path: "bridge-js.d.ts") packageInputs.append( diff --git a/README.md b/README.md index 6a0acaa27..b5cb04801 100644 --- a/README.md +++ b/README.md @@ -48,14 +48,14 @@ _ = document.body.appendChild(button) BridgeJS provides easy interoperability between Swift and JavaScript/TypeScript. It enables: -- **Exporting Swift APIs to JavaScript**: Make your Swift code callable from JavaScript -- **Importing TypeScript APIs into Swift**: Use JavaScript APIs with type safety in Swift +- **Export Swift to JavaScript** – Expose Swift functions, classes, and types to JavaScript; the plugin also generates TypeScript definitions (`.d.ts`) for the exported API. +- **Import JavaScript into Swift** – Make JavaScript/TypeScript APIs (functions, classes, globals like `document` or `console`) callable from Swift with type-safe bindings. You can declare bindings with macros in Swift or generate them from a TypeScript declaration file (`bridge-js.d.ts`). -For architecture details, see the [BridgeJS Plugin README](Plugins/BridgeJS/README.md). +For architecture details, see the [BridgeJS Plugin README](Plugins/BridgeJS/README.md). For package and build setup, see [Setting up BridgeJS](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/setting-up-bridgejs) in the documentation. ### Exporting Swift to JavaScript -Mark Swift code with `@JS` to make it callable from JavaScript: +Mark Swift code with `@JS` (the ``JS(namespace:enumStyle:)`` attribute) to make it callable from JavaScript: ```swift import JavaScriptKit @@ -81,32 +81,36 @@ console.log(greeter.greet()); // "Hello, World!" **Learn more:** [Exporting Swift to JavaScript](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/exporting-swift-to-javascript) -### Importing TypeScript into Swift +### Importing JavaScript into Swift -Define TypeScript interfaces and BridgeJS generates type-safe Swift bindings: +Declare bindings in Swift with macros such as `@JSFunction`, `@JSClass`, `@JSGetter`, and `@JSSetter`: -```typescript -// bridge-js.d.ts -interface Document { - title: string; - getElementById(id: string): HTMLElement; - createElement(tagName: string): HTMLElement; +```swift +import JavaScriptKit + +@JSClass struct Document { + @JSFunction func getElementById(_ id: String) throws(JSException) -> HTMLElement + @JSFunction func createElement(_ tagName: String) throws(JSException) -> HTMLElement } +@JSGetter(from: .global) var document: Document -export function getDocument(): Document; -``` +@JSClass struct HTMLElement { + @JSGetter var innerText: String + @JSSetter func setInnerText(_ newValue: String) throws(JSException) + @JSFunction func appendChild(_ child: HTMLElement) throws(JSException) +} -**Swift usage:** -```swift @JS func run() throws(JSException) { - let document = try getDocument() - try document.setTitle("My Swift App") - let button = try document.createElement("button") + let button = document.createElement("button")! try button.setInnerText("Click Me") + let container = document.getElementById("app")! + container.appendChild(button) } ``` -**Learn more:** [Importing TypeScript into Swift](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/importing-typescript-into-swift) +You can also generate the same macro-annotated Swift from a TypeScript file (`bridge-js.d.ts`). See [Generating bindings from TypeScript](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/generating-from-typescript) in the documentation. + +**Learn more:** [Importing JavaScript into Swift](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/importing-javascript-into-swift) ### Try It Online diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Ahead-of-Time-Code-Generation.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Ahead-of-Time-Code-Generation.md index ee6ac3047..776f6f577 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Ahead-of-Time-Code-Generation.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Ahead-of-Time-Code-Generation.md @@ -6,7 +6,7 @@ Learn how to improve build times by generating BridgeJS code ahead of time. > Important: This feature is still experimental. No API stability is guaranteed, and the API may change in future releases. -The BridgeJS build plugin automatically processes `@JS` annotations and TypeScript definitions during each build. While convenient, this can significantly increase build times for larger projects. To address this, JavaScriptKit provides a command plugin that lets you generate the bridge code ahead of time. +The BridgeJS build plugin automatically processes macro annotations and TypeScript definitions during each build. While convenient, this can significantly increase build times for larger projects. To address this, JavaScriptKit provides a command plugin that lets you generate the bridge code ahead of time. ## Using the Command Plugin @@ -54,7 +54,7 @@ $ echo "{}" > Sources/MyApp/bridge-js.config.json ### Step 3: Create Your Swift Code with @JS Annotations -Write your Swift code with `@JS` annotations as usual: +Write your Swift code with macro annotations as usual: ```swift import JavaScriptKit @@ -65,13 +65,13 @@ import JavaScriptKit @JS class Counter { private var count = 0 - + @JS init() {} - + @JS func increment() { count += 1 } - + @JS func getValue() -> Int { return count } @@ -104,14 +104,15 @@ swift package plugin bridge-js This command will: -1. Process all Swift files with `@JS` annotations +1. Process all Swift files with macro annotations 2. Process any TypeScript definition files 3. Generate Swift binding code in a `Generated` directory within your source folder For example, with a target named "MyApp", it will create: ``` -Sources/MyApp/Generated/BridgeJS.swift # Generated code for both exports and imports +Sources/MyApp/Generated/BridgeJS.swift # Glue code for both exports and imports +Sources/MyApp/Generated/BridgeJS.Macros.swift # Bridging interface generated from bridge-js.d.ts Sources/MyApp/Generated/JavaScript/BridgeJS.json # Unified skeleton JSON ``` @@ -173,4 +174,4 @@ git commit -m "Update generated BridgeJS code" 2. **Version Control**: Always commit the generated files if using the command plugin 3. **API Boundaries**: Try to stabilize your API boundaries to minimize regeneration 4. **Documentation**: Document your approach in your project README -5. **CI/CD**: If using the command plugin, consider verifying that generated code is up-to-date in CI +5. **CI/CD**: If using the command plugin, consider verifying that generated code is up-to-date in CI diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Configuration.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Configuration.md index 78b5d2d37..604017aad 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Configuration.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Configuration.md @@ -42,7 +42,7 @@ Later files override settings from earlier files. This allows teams to commit a Controls whether exported Swift APIs are exposed to the JavaScript global namespace (`globalThis`). -When `true`, exported functions, classes, and namespaces are available via `globalThis` in JavaScript. When `false`, they are only available through the exports object returned by `createExports()`. +When `true`, exported functions, classes, and namespaces are available via `globalThis` in JavaScript. When `false`, they are only available through the exports object returned by `createExports()`. Using Exports provides better module isolation and support multiple WebAssembly instances in the same JavaScript context. Example: diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Internals/BridgeJS-Internals.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Internals/BridgeJS-Internals.md new file mode 100644 index 000000000..b8589b49e --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Internals/BridgeJS-Internals.md @@ -0,0 +1,11 @@ +# BridgeJS Internals + +Internal design, performance rationale, and low-level details for BridgeJS. + +## Overview + +This section is for maintainers and contributors who want to understand how BridgeJS works under the hood, why it is designed the way it is, and how it interacts with the JavaScript engine and ABI. + +## Topics + +- diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Internals/Design-Rationale.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Internals/Design-Rationale.md new file mode 100644 index 000000000..8bfc5d302 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/BridgeJS-Internals/Design-Rationale.md @@ -0,0 +1,38 @@ +# BridgeJS Design Rationale + +Why BridgeJS is faster than dynamic `JSObject`/`JSValue` APIs and how engine optimizations influence the design. + +## Overview + +BridgeJS generates **specialized** bridge code per exported or imported interface. That specialization, combined with stable call and property access patterns, allows JavaScript engines to optimize the boundary crossing much better than with generic dynamic code. This page explains the main performance rationale. + +## Why generated code is faster + +1. **Specialized code per interface** - Each bridged function or property gets its own glue path with known types. The engine does not need to handle arbitrary shapes or types at the call site. + +2. **Use of static type information** - The generator knows parameter and return types at compile time. It can avoid dynamic type checks and boxing where the dynamic API would require them. + +3. **IC-friendly access patterns** - Property and method accesses use stable, predictable shapes instead of a single generic subscript path. That keeps engine **inline caches (ICs)** effective instead of turning them **megamorphic**. + +## Inline caches (ICs) and megamorphic penalty + +JavaScript engines (and many other dynamic-language VMs) use **inline caches** at property and method access sites: they remember the object shape (e.g. “this property is at offset X”) so the next access with the same shape can take a fast path. + +- **Monomorphic** - One shape seen at a site → very fast, offset cached. +- **Polymorphic** - A few shapes → still fast, small dispatch in the IC. +- **Megamorphic** - Too many different shapes at the same site → the IC gives up and falls back to a generic property lookup, which is much slower. + +Engines typically allow only a small number of shapes per IC (e.g. on the order of a few) before marking the site megamorphic. + +## Why `JSObject` subscript is problematic + +`JSObject.subscript` (and similar dynamic property access) shares **one** code path for all property names and all object shapes. Every access goes through the same call site with varying keys and receiver shapes. That site therefore sees many different shapes and quickly becomes **megamorphic**, so the engine cannot cache property offsets and must do a generic lookup every time. + +So even if you cache the property name (e.g. with `CachedJSStrings`), you are still using the same generic subscript path; the call site stays megamorphic and pays the slow-path cost. + +BridgeJS avoids this by generating **separate** access paths per property or method. Each generated getter/setter or function call has a stable shape at the engine level, so the IC can stay monomorphic or polymorphic and the fast path is used. + +## What to read next + +- ABI and binary interface details will be documented in this section as they stabilize. +- For using BridgeJS in your app, see , , and . diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Bringing-Swift-Closures-to-JavaScript.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Bringing-Swift-Closures-to-JavaScript.md new file mode 100644 index 000000000..ce1d9d555 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Bringing-Swift-Closures-to-JavaScript.md @@ -0,0 +1,80 @@ +# Bringing Swift Closures to JavaScript + +Use ``JSTypedClosure`` to pass or return Swift closures to the JavaScript world with BridgeJS-with type safety and explicit lifetime management. + +## Overview + +``JSTypedClosure`` wraps a **Swift closure** so you can **pass it or return it to JavaScript** through BridgeJS. The closure lives in Swift; JavaScript receives a function that calls back into that closure when invoked. Use it when: + +- You **pass** a Swift closure as an argument to a JavaScript API (e.g. an ``JSFunction(jsName:from:)`` that takes a callback parameter). +- You **return** a Swift closure from Swift exported by ``JS(namespace:enumStyle:)`` so JavaScript can call it later. + +Unlike ``JSClosure``, which uses untyped ``JSValue`` arguments and return values, ``JSTypedClosure`` has a concrete **signature** (e.g. `(Int) -> Int` or `(String) -> Void`). BridgeJS generates the glue code for that signature, so you get compile-time type safety when crossing into the JS world. + +You **must call** ``JSTypedClosure/release()`` when the closure is no longer needed by JavaScript. After release, any attempt to invoke the closure from JavaScript throws an explicit JS exception. + +## Creating a JSTypedClosure + +BridgeJS generates an initializer for each closure signature used in your module. Wrap your Swift closure and pass or return it to JavaScript: + +```swift +import JavaScriptKit + +// Pass a Swift closure to a JS function that expects a callback (Int) -> Int +@JSFunction static func applyTransform(_ value: Int, _ transform: JSTypedClosure<(Int) -> Int>) throws(JSException) -> Int + +let double = JSTypedClosure<(Int) -> Int> { $0 * 2 } +defer { double.release() } +let result = try applyTransform(10, double) // 20 - JS calls back into Swift +``` + +You can pass or return typed closures with other signatures the same way: + +```swift +let sum = JSTypedClosure<(Int, Int) -> Int> { $0 + $1 } +defer { sum.release() } + +let log = JSTypedClosure<(String) -> Void> { print($0) } +defer { log.release() } +``` + +## Lifetime and release() + +A ``JSTypedClosure`` keeps the Swift closure alive and exposes a JavaScript function that calls into it. To avoid leaks and use-after-free: + +1. **Call `release()` exactly once** when the closure is no longer needed by JavaScript (e.g. when the callback is unregistered or the object that held it is released). +2. Prefer **`defer { closure.release() }`** right after creating the closure so cleanup runs when the current scope exits. +3. After `release()`, calling the closure from JavaScript throws an exception with a message that includes the file and line where the ``JSTypedClosure`` was created. + +A **FinalizationRegistry** on the JavaScript side may eventually release the Swift storage if you never call `release()`, but that is non-deterministic. Do not rely on it for timely cleanup. + +## Getting the underlying JavaScript function + +When you need to store or pass the function on the JavaScript side (e.g. to compare identity or attach to a DOM node), use the ``JSTypedClosure/jsObject`` property to get the ``JSObject`` that represents the JavaScript function. + +## JSTypedClosure vs JSClosure + +Both let you pass or return a Swift closure to the JavaScript world. The difference is how they are typed and which API you use: + +| | JSTypedClosure | JSClosure | +|:--|:--|:--| +| **API** | BridgeJS (macros, generated code) | Dynamic ``JSObject`` / ``JSValue`` | +| **Types** | Typed signature, e.g. `(Int) -> Int` | Untyped `([JSValue]) -> JSValue` | +| **Lifetime** | Explicit `release()` required | Explicit `release()` required | +| **Use case** | Passing/returning closures at the BridgeJS boundary with a fixed signature | Passing Swift functions to JS via dynamic APIs (e.g. DOM events) | + +Use ``JSTypedClosure`` when you pass or return closures through BridgeJS-declared APIs. Use ``JSClosure`` when you pass a Swift function to JavaScript using the dynamic APIs (e.g. ``JSObject``, ``JSValue``) without generated glue. + +## JSTypedClosure vs auto-managed closures + +BridgeJS can also expose **plain** Swift closure types (e.g. `(String) -> String`) as parameters and return values; lifetime is then managed automatically via ``FinalizationRegistry`` and no `release()` is required. See . + +**When returning** a closure from Swift to JavaScript, we **recommend** using ``JSTypedClosure`` and managing lifetime explicitly with `release()`, rather than returning a plain closure type. Explicit release makes cleanup predictable and avoids relying solely on JavaScript GC. + +## See also + +- ``JSTypedClosure`` +- ``JSClosure`` +- +- +- diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md index 75f0fcca5..b14d2eebe 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift-to-JavaScript.md @@ -6,60 +6,11 @@ Learn how to make your Swift code callable from JavaScript. > Important: This feature is still experimental. No API stability is guaranteed, and the API may change in future releases. -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). - -BridgeJS allows you to expose Swift functions, classes, and methods to JavaScript by using the `@JS` attribute. This enables JavaScript code to call into Swift code running in WebAssembly. - -## Configuring the BridgeJS plugin - -To use the BridgeJS feature, you need to enable the experimental `Extern` feature and add the BridgeJS plugin to your package. Here's an example of a `Package.swift` file: - -```swift -// swift-tools-version:6.0 - -import PackageDescription - -let package = Package( - name: "MyApp", - dependencies: [ - .package(url: "https://github.com/swiftwasm/JavaScriptKit.git", branch: "main") - ], - targets: [ - .executableTarget( - name: "MyApp", - dependencies: ["JavaScriptKit"], - swiftSettings: [ - // This is required because the generated code depends on @_extern(wasm) - .enableExperimentalFeature("Extern") - ], - plugins: [ - // Add build plugin for processing @JS and generate Swift glue code - .plugin(name: "BridgeJS", package: "JavaScriptKit") - ] - ) - ] -) -``` - -The `BridgeJS` plugin will process your Swift code to find declarations marked with `@JS` and generate the necessary bridge code to make them accessible from JavaScript. - -### Building your package for JavaScript - -After configuring your `Package.swift`, you can build your package for JavaScript using the following command: - -```bash -swift package --swift-sdk $SWIFT_SDK_ID js -``` - -This command will: - -1. Process all Swift files with `@JS` annotations -2. Generate JavaScript bindings and TypeScript type definitions (`.d.ts`) for your exported Swift code -3. Output everything to the `.build/plugins/PackageToJS/outputs/` directory - -> Note: For larger projects, you may want to generate the BridgeJS code ahead of time to improve build performance. See for more information. +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). +BridgeJS allows you to expose Swift functions, classes, and methods to JavaScript by using the ``JS(namespace:enumStyle:)`` attribute. This enables JavaScript code to call into Swift code running in WebAssembly. +Configure your package and build for JavaScript as described in . Then use the topics below to expose Swift types and functions to JavaScript. ## Topics @@ -75,3 +26,7 @@ This command will: - - - + +## See Also + +- ``JS(namespace:enumStyle:)`` diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Array.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Array.md index 53d008068..e97bceefa 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Array.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Array.md @@ -4,7 +4,7 @@ Learn how to pass Swift arrays to and from JavaScript. ## Overview -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). BridgeJS allows you to pass Swift arrays as function parameters and return values. diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Class.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Class.md index 3e44581fa..9cd4a2224 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Class.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Class.md @@ -4,7 +4,7 @@ Learn how to export Swift classes to JavaScript. ## Overview -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). To export a Swift class, mark both the class and any members you want to expose: @@ -51,6 +51,7 @@ cart.addItem("Laptop", 999.99, 1); cart.addItem("Mouse", 24.99, 2); console.log(`Items in cart: ${cart.getItemCount()}`); console.log(`Total: $${cart.getTotal().toFixed(2)}`); +cart.release(); // Call release() when done; don't rely on FinalizationRegistry as much as possible ``` The generated TypeScript declarations for this class would look like: @@ -83,7 +84,7 @@ Classes use **reference semantics** when crossing the Swift/JavaScript boundary: 1. **Object Creation**: When you create a class instance (via `new` in JS), the object lives on the Swift heap 2. **Reference Passing**: JavaScript receives a reference (handle) to the Swift object, not a copy 3. **Shared State**: Changes made through either Swift or JavaScript affect the same object -4. **Memory Management**: `FinalizationRegistry` automatically releases Swift objects when they're garbage collected in JavaScript. You can optionally call `release()` for deterministic cleanup. +4. **Memory Management**: `FinalizationRegistry` can release Swift objects when they're garbage collected in JavaScript, but you should **not rely on it** for cleanup. Call `release()` when an instance is no longer needed so that Swift memory is reclaimed deterministically. This is especially important for **short-lived instances**: GC may run late or not at all for objects that become unreachable quickly, so relying on `FinalizationRegistry` can delay or leak Swift-side resources. This differs from structs, which use copy semantics and transfer data by value. diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md index fe934ddba..adb9ab33b 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Closure.md @@ -4,9 +4,11 @@ Learn how to use closure/function types as parameters and return values in Bridg ## Overview -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). -BridgeJS supports typed closure parameters and return values, allowing you to pass functions between Swift and JavaScript with full type safety. This enables functional programming patterns like callbacks, higher-order functions, and function composition across the language boundary. +BridgeJS supports typed closure parameters and return values, allowing you to pass or return Swift closures to JavaScript with full type safety. **Lifetime is automatic**: you use plain Swift closure types (e.g. `(String) -> String`); the runtime releases them when no longer needed-no manual `release()` required. This enables callbacks, higher-order functions, and function composition across the boundary. + +**Recommendation:** When **returning** a closure from Swift to JavaScript, prefer returning a ``JSTypedClosure`` and managing its lifetime explicitly (see ). Explicit `release()` makes cleanup predictable and avoids relying solely on JavaScript garbage collection. Use plain closure types (this article) when you want fully automatic lifetime or when passing closures only as parameters into your exported API. ## Example @@ -99,6 +101,8 @@ Closures use **reference semantics** when crossing the Swift/JavaScript boundary This differs from structs and arrays, which use copy semantics and transfer data by value. +When you **return** a closure to JavaScript, we recommend using ``JSTypedClosure`` and calling `release()` when the closure is no longer needed, instead of returning a plain closure type. See . + ## Supported Features | Swift Feature | Status | @@ -113,4 +117,5 @@ This differs from structs and arrays, which use copy semantics and transfer data ## See Also +- - passing or returning closures with ``JSTypedClosure`` and explicit `release()` - diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md index f6115f063..e6f4b8e9a 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Default-Parameters.md @@ -4,7 +4,7 @@ Learn how to use default parameter values in Swift functions and constructors ex ## Overview -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). BridgeJS supports default parameter values for Swift functions and class constructors exported to JavaScript. When you specify default values in your Swift code, they are automatically applied in the generated JavaScript bindings. @@ -64,7 +64,7 @@ Constructor parameters also support default values, making it easy to create ins @JS var name: String @JS var timeout: Int @JS var retries: Int - + @JS init(name: String = "default", timeout: Int = 30, retries: Int = 3) { self.name = name self.timeout = timeout diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Enum.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Enum.md index 6fb3afeda..2220d457c 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Enum.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Enum.md @@ -4,7 +4,7 @@ Learn how to export Swift enums to JavaScript. ## Overview -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). BridgeJS supports two output styles for enums, controlled by the `enumStyle` parameter: diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Function.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Function.md index ebc8037c4..c26841041 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Function.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Function.md @@ -4,7 +4,7 @@ Learn how to export Swift functions to JavaScript. ## Overview -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). To export a Swift function to JavaScript, mark it with the `@JS` attribute and make it `public`: diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Optional.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Optional.md index 91fdc3472..be15b762f 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Optional.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Optional.md @@ -4,14 +4,12 @@ Learn how to use Swift optionals in functions, classes, and enums exported to Ja ## Overview -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). BridgeJS provides comprehensive support for Swift optionals across all bridged types. When you use `Optional` or `T?` in Swift, it automatically maps to `T | null` in TypeScript/JavaScript. Swift optionals are translated to union types with `null` (not `undefined`) because `null` represents an explicit "no value" state that aligns semantically with Swift's `nil`. This design choice ensures consistent null handling across the Swift-JavaScript bridge and avoids the ambiguity that comes with JavaScript's `undefined`. -> Important: BridgeJS optional support is **Swift → JavaScript only**. TypeScript → Swift optional imports are not currently supported. - ## Supported Optional Syntax BridgeJS recognizes all Swift optional syntax variants: @@ -35,7 +33,7 @@ All parameter types can be made optional, including primitives, objects, and enu ```swift @JS public func processOptionalData( text: String?, // Optional string - count: Int?, // Optional integer + count: Int?, // Optional integer flag: Bool?, // Optional boolean rate: Double?, // Optional double user: User? // Optional Swift class @@ -85,7 +83,7 @@ Constructors can accept optional parameters. @JS public var email: String? @JS public var age: Int? @JS public var avatar: User? - + @JS public init(name: String?) @JS public func updateProfile(email: String?, age: Int?) } @@ -100,7 +98,7 @@ export interface UserProfile extends SwiftHeapObject { email: string | null; age: number | null; avatar: User | null; - + updateProfile(email: string | null, age: number | null): void; } export type UserProfile = { diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md index 111b1f052..3b2ec1526 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md @@ -4,7 +4,7 @@ Learn how to expose Swift protocols to JavaScript as TypeScript interfaces. ## Overview -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). BridgeJS allows you to export Swift protocols as TypeScript interfaces. JavaScript objects implementing these interfaces can be passed to Swift code, enabling protocol-oriented design across the Swift-JavaScript boundary. @@ -31,28 +31,28 @@ import JavaScriptKit @JS class CounterManager { var delegate: Counter - + @JS init(delegate: Counter) { self.delegate = delegate } - + @JS func incrementTwice() { delegate.increment(by: 1) delegate.increment(by: 1) } - + @JS func getCurrentValue() -> Int { return delegate.getValue() } - + @JS func getCounterName() -> String { return delegate.name } - + @JS func setCountValue(_ value: Int) { delegate.count = value } - + @JS func updateLabel(_ newLabel: String?) { delegate.label = newLabel } @@ -130,15 +130,15 @@ You can also implement protocols in Swift and use them from JavaScript: final class SwiftCounter: Counter { var count = 0 let name = "SwiftCounter" - + func increment(by amount: Int) { count += amount } - + func reset() { count = 0 } - + func getValue() -> Int { return count } diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Functions.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Functions.md index b6f680d1f..1c4b22abe 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Functions.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Functions.md @@ -4,7 +4,7 @@ Learn how to export Swift static and class functions as JavaScript static method ## Overview -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). BridgeJS supports exporting Swift `static func` and `class func` to JavaScript static methods. Both generate identical JavaScript output but differ in Swift inheritance behavior. @@ -17,15 +17,15 @@ Classes can export both `static` and `class` functions: ```swift @JS class MathUtils { @JS init() {} - + @JS static func add(a: Int, b: Int) -> Int { return a + b } - + @JS class func subtract(a: Int, b: Int) -> Int { return a - b } - + @JS func multiply(x: Int, y: Int) -> Int { return x * y } @@ -79,11 +79,11 @@ Enums can contain static functions that are exported as properties: @JS enum Calculator { case scientific case basic - + @JS static func square(value: Int) -> Int { return value * value } - + @JS static func cube(value: Int) -> Int { return value * value * value } diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Properties.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Properties.md index 4110e6166..4898535c8 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Properties.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Static-Properties.md @@ -4,7 +4,7 @@ Learn how to export Swift static and class properties as JavaScript static prope ## Overview -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). BridgeJS supports exporting Swift `static var`, `static let`, and `class var` properties to JavaScript static properties. Both stored and computed properties are supported. @@ -15,16 +15,16 @@ Classes can export both stored and computed static properties: ```swift @JS class Configuration { @JS init() {} - + @JS static let version = "1.0.0" @JS static var debugMode = false @JS class var defaultTimeout = 30 - + @JS static var timestamp: Double { get { return Date().timeIntervalSince1970 } set { /* custom setter logic */ } } - + @JS static var buildNumber: Int { return 12345 } @@ -81,7 +81,7 @@ Enums can contain static properties that are exported alongside enum cases: @JS enum PropertyEnum { case value1 case value2 - + @JS static var enumProperty = "mutable" @JS static let enumConstant = 42 @JS static var computedEnum: String { diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md index 10babd9b6..32bb79ed3 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Struct.md @@ -4,7 +4,7 @@ Learn how to export Swift structs to JavaScript. ## Overview -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). To export a Swift struct, mark it with `@JS`: @@ -91,7 +91,7 @@ export type Exports = { ```swift @JS struct Config { var name: String - + @JS nonisolated(unsafe) static var defaultTimeout: Double = 30.0 @JS static let maxRetries: Int = 3 } diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md index 057b5f030..1aff82f65 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Using-Namespace.md @@ -4,7 +4,7 @@ Learn how to organize exported Swift code into JavaScript namespaces. ## Overview -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). The `@JS` macro supports organizing your exported Swift code into namespaces using dot-separated strings. This allows you to create hierarchical structures in JavaScript that mirror your Swift code organization. @@ -121,7 +121,3 @@ export interface Greeter extends SwiftHeapObject { ``` Using namespaces can be preferable for projects with many global functions, as they help prevent naming collisions. Namespaces also provide intuitive hierarchies for organizing your exported Swift code, and they do not affect the code generated by `@JS` declarations without namespaces. - -## See Also - -- - Namespace enums section diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Generating-from-TypeScript.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Generating-from-TypeScript.md new file mode 100644 index 000000000..9c0a80dc1 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Generating-from-TypeScript.md @@ -0,0 +1,419 @@ +# Generating bindings from TypeScript + +How to generate macro-annotated Swift bindings from a TypeScript declaration file (`bridge-js.d.ts`) so you don't have to write the Swift by hand. + +## Overview + +The BridgeJS plugin can read a `bridge-js.d.ts` file in your target and generate Swift code that uses the same macros as hand-written bindings (see ). + +The output is macro-annotated Swift; you can inspect the generated file at the following path to see exactly what was produced: + +``` +./build/plugins/outputs///destination/BridgeJS/BridgeJS.Macros.swift +``` + +Use this workflow when you have existing TypeScript definitions or many APIs to bind. + +> Important: This feature is still experimental. No API stability is guaranteed, and the API may change in future releases. + +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). + +## How to generate bindings from TypeScript + +### Step 1: Configure your package + +Add the BridgeJS plugin and enable the Extern feature as described in . + +### Step 2: Create TypeScript definitions + +Create a file named `bridge-js.d.ts` in your target source directory (e.g. `Sources//bridge-js.d.ts`). Declare the JavaScript APIs you want to use in Swift: + +```typescript +export function consoleLog(message: string): void; +``` + +### Step 3: Build your package + +Run: + +```bash +swift package --swift-sdk $SWIFT_SDK_ID js +``` + +The plugin processes `bridge-js.d.ts`, generates Swift bindings (using the same macros as in ), compiles to WebAssembly, and produces JavaScript glue in `.build/plugins/PackageToJS/outputs/`. + +> Note: For larger projects, see . + +## Declaration mappings + +### Functions + +Each exported function becomes a top-level Swift function with `@JSFunction` and `throws(JSException)`. + +@Row { + @Column { + ```typescript + // TypeScript (bridge-js.d.ts) + + /** Returns the sum of two numbers. */ + export function sum(a: number, b: number): number; + /** + * Sets the document title. + * @param title - The new title string + */ + export function setDocumentTitle(title: string): void; + ``` + } + @Column { + ```swift + // Generated Swift + + /// Returns the sum of two numbers. + @JSFunction func sum(a: Double, b: Double) throws(JSException) -> Double + + + /// Sets the document title. + /// - Parameter title: The new title string + @JSFunction func setDocumentTitle(title: String) throws(JSException) + ``` + } +} + +### Global getters + +Module-level `declare const` or top-level readonly bindings that reference a bridged type become a Swift global property with `@JSGetter`. + +@Row { + @Column { + ```typescript + // TypeScript (bridge-js.d.ts) + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document) */ + export const document: Document; + ``` + } + @Column { + ```swift + // Generated Swift + /// [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document) + @JSGetter var document: Document + ``` + } +} + +### Classes + +A class becomes a Swift struct with `@JSClass`. The constructor becomes `init(...)` with `@JSFunction`. Properties become `@JSGetter`; writable properties also get `@JSSetter` as `set(_:)`. Methods become `@JSFunction`. Static methods become `static func` on the struct. All thunks throw `JSException` if the underlying JavaScript throws. + +@Row { + @Column { + ```typescript + // TypeScript (bridge-js.d.ts) + export class Greeter { + /** A readonly field is translated with `@JSGetter` */ + readonly id: number; + + /** A read-writable field is translated with `@JSGetter` and `@JSSetter` */ + message: string; + + /** A constructor */ + constructor(id: string, name: string); + /** A method */ + greet(): string; + /** A static method */ + static createDefault(greetingId: number, locale: string): string; + } + ``` + } + @Column { + ```swift + // Generated Swift + @JSClass struct Greeter { + /// A readonly field is translated with `@JSGetter` + @JSGetter var id: Double + + /// A read-writable field is translated with `@JSGetter` and `@JSSetter` + @JSGetter var message: String + @JSSetter func setMessage(_ newValue: String) throws(JSException) + + /// A constructor + @JSFunction init(id: String, name: String) throws(JSException) + /// A method + @JSFunction func greet() throws(JSException) -> String + @JSFunction static func createDefault(_ greetingId: Double, _ locale: String) throws(JSException) -> String + } + ``` + } +} + +### Interfaces + +An interface becomes a Swift struct with `@JSClass`. No constructor. Properties and methods are bridged the same way as for classes (`@JSGetter`, `@JSSetter`, `@JSFunction`). Instances are obtained from other calls (e.g. a function that returns the interface type). + +@Row { + @Column { + ```typescript + // TypeScript (bridge-js.d.ts) + export interface HTMLElement { + readonly innerText: string; + className: string; + + appendChild(child: HTMLElement): void; + } + ``` + } + @Column { + ```swift + // Generated Swift + @JSClass struct HTMLElement { + @JSGetter var innerText: String + @JSGetter var className: String + @JSSetter func setClassName(_ newValue: String) throws(JSException) + @JSFunction func appendChild(_ child: HTMLElement) throws(JSException) + } + ``` + } +} + +### Type aliases + +Type aliases are resolved when generating Swift; the resolved shape is emitted, not a separate alias type. + +- **Primitive alias** (e.g. `type UserId = string`): Replaced by the underlying Swift type (e.g. `String`) everywhere it is used. +- **Object-shaped alias** (e.g. `type User = { id: string; name: string }`): The generator emits a named Swift struct with that name and the corresponding `@JSClass` / getters / setters. No constructor; use is the same as for interfaces. + +@Row { + @Column { + ```typescript + // TypeScript (bridge-js.d.ts) + export type UserId = string; + export type User = { + readonly id: UserId; + name: string; + }; + export function getUser(): User; + ``` + } + @Column { + ```swift + // Generated Swift (UserId inlined as String) + @JSClass struct User { + @JSGetter var id: String + @JSGetter var name: String + @JSSetter func setName(_ newValue: String) throws(JSException) + } + @JSFunction func getUser() throws(JSException) -> User + ``` + } +} + +### String enums + +TypeScript enums with string literal values become Swift enums with `String` raw value and the appropriate BridgeJS protocol conformances. Usable as parameter and return types. + +@Row { + @Column { + ```typescript + // TypeScript (bridge-js.d.ts) + export enum Theme { + light = "light", + dark = "dark", + } + + + export function setTheme(theme: Theme): void; + export function getTheme(): Theme; + ``` + } + @Column { + ```swift + // Generated Swift + enum Theme: String { + case light = "light" + case dark = "dark" + } + extension Theme: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} + + @JSFunction func setTheme(_ theme: Theme) throws(JSException) -> Void + @JSFunction func getTheme() throws(JSException) -> Theme + ``` + } +} + +## Type mappings + +The following mappings apply to function parameters, return types, and class/interface properties. + +### Primitives + +| TypeScript | Swift | +|------------|-------| +| `number` | `Double` | +| `string` | `String` | +| `boolean` | `Bool` | + +These appear in the function and class examples above. + +### Arrays + +`T[]` and `Array` → `[T]`. + +@Row { + @Column { + ```typescript + // TypeScript (bridge-js.d.ts) + export function sumAll(values: number[]): number; + export function getScores(): number[]; + export function getLabels(): string[]; + export function normalize(values: Array): Array; + ``` + } + @Column { + ```swift + // Generated Swift + @JSFunction func sumAll(_ values: [Double]) throws(JSException) -> Double + @JSFunction func getScores() throws(JSException) -> [Double] + @JSFunction func getLabels() throws(JSException) -> [String] + @JSFunction func normalize(_ values: [Double]) throws(JSException) -> [Double] + ``` + } +} + +### Optional and undefined + +- **`T | null`** → Swift `Optional` (e.g. `Optional`, `Optional`, `Optional`). +- **`T | undefined`** or optional parameters → Swift `JSUndefinedOr`. + +@Row { + @Column { + ```typescript + // TypeScript (bridge-js.d.ts) + export function parseCount(value: number | null): number | null; + export function parseLimit(value: number | undefined): number | undefined; + export function scale(factor: number, offset: number | null): number; + + export interface Payload {} + export class RequestOptions { + body: Payload | null; + + headers: Payload | undefined; + + } + ``` + } + @Column { + ```swift + // Generated Swift + @JSFunction func parseCount(_ value: Optional) throws(JSException) -> Optional + @JSFunction func parseLimit(_ value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr + @JSFunction func scale(_ factor: Double, _ offset: Optional) throws(JSException) -> Double + + @JSClass struct Payload {} + @JSClass struct RequestOptions { + @JSGetter var body: Optional + @JSSetter func setBody(_ value: Optional) throws(JSException) + @JSGetter var headers: JSUndefinedOr + @JSSetter func setHeaders(_ value: JSUndefinedOr) throws(JSException) + } + ``` + } +} + +### Records (dictionaries) + +`Record` → Swift `[String: V]`. Supported value types: primitives, arrays, nested records, optional object types. Keys other than `string` (e.g. `Record`) are unsupported; such parameters become `JSObject`. + +@Row { + @Column { + ```typescript + // TypeScript (bridge-js.d.ts) + export function applyScores(scores: Record): void; + export function getMetadata(): Record; + export function getMatrix(value: Record>): Record>; + export function getSeries(values: Record): Record; + export function lookupByIndex(values: Record): void; + ``` + } + @Column { + ```swift + // Generated Swift + @JSFunction func applyScores(_ scores: [String: Double]) throws(JSException) -> Void + @JSFunction func getMetadata() throws(JSException) -> [String: String] + @JSFunction func getMatrix(_ value: [String: [String: Double]]) throws(JSException) -> [String: [String: Double]] + @JSFunction func getSeries(_ values: [String: [Double]]) throws(JSException) -> [String: [Double]] + @JSFunction func lookupByIndex(_ values: JSObject) throws(JSException) -> Void + ``` + } +} + +### Unbridged types (JSValue, JSObject) + +Types that cannot be expressed in the bridge (e.g. `any`, unsupported generics, or `Record`) are emitted as `JSValue` or `JSObject`. + +@Row { + @Column { + ```typescript + // TypeScript (bridge-js.d.ts) + interface Animatable { + animate(keyframes: any, options: any): any; + } + export function getAnimatable(): Animatable; + ``` + } + @Column { + ```swift + // Generated Swift + @JSClass struct Animatable { + @JSFunction func animate(_ keyframes: JSValue, _ options: JSValue) throws(JSException) -> JSValue + } + @JSFunction func getAnimatable() throws(JSException) -> Animatable + ``` + } +} + +## Name mapping + +### Invalid or special property and type names + +When a TypeScript name is not a valid Swift identifier (e.g. contains dashes, spaces, or starts with a number), or is a Swift keyword, the generator emits a Swift-safe name and uses `jsName` so the JavaScript binding remains correct. Classes whose names start with `$` are prefixed with `_` in Swift and get `@JSClass(jsName: "...")`. + +@Row { + @Column { + ```typescript + // TypeScript (bridge-js.d.ts) + interface DOMTokenList { + "data-attrib": number; + + "0": boolean; + + for: string; + + as(): void; + } + export class $jQuery { + "call-plugin"(): void; + } + ``` + } + @Column { + ```swift + // Generated Swift + @JSClass struct DOMTokenList { + @JSGetter(jsName: "data-attrib") var data_attrib: Double + @JSSetter(jsName: "data-attrib") func setData_attrib(_ value: Double) throws(JSException) + @JSGetter(jsName: "0") var _0: Bool + @JSSetter(jsName: "0") func set_0(_ value: Bool) throws(JSException) + @JSGetter var `for`: String + @JSSetter func setFor(_ value: String) throws(JSException) + @JSFunction func `as`() throws(JSException) -> Void + } + @JSClass(jsName: "$jQuery") struct _jQuery { + @JSFunction(jsName: "call-plugin") func call_plugin() throws(JSException) -> Void + } + ``` + } +} + +## Limitations + +- No first-class support for async/Promise-returning functions;. +- No generic type parameter can appear on a bridged function signature. \ No newline at end of file diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript-into-Swift.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript-into-Swift.md new file mode 100644 index 000000000..14fccbfc1 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript-into-Swift.md @@ -0,0 +1,98 @@ +# Importing JavaScript into Swift + +Learn how to make JavaScript APIs callable from your Swift code using macro-annotated bindings. + +## Overview + +> Important: This feature is still experimental. No API stability is guaranteed, and the API may change in future releases. + +> Tip: You can quickly preview what interfaces will be exposed on the Swift/JavaScript/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). + +You can import JavaScript APIs into Swift in two ways: + +1. **Annotate Swift with macros** - Use `@JSFunction`, `@JSClass`, `@JSGetter`, and `@JSSetter` to declare bindings directly in Swift. No TypeScript required. Prefer this to get started. +2. **Generate bindings from TypeScript** - Use a `bridge-js.d.ts` file; the BridgeJS plugin generates the same macro-annotated Swift. See when you have existing `.d.ts` definitions or many APIs to bind. + +This guide covers the macro-based path. + +## How to import JavaScript APIs (macro path) + +### Step 1: Configure your package + +Add the BridgeJS plugin and enable the Extern feature as described in . + +### Step 2: Declare bindings in Swift with macros + +Create Swift declarations that mirror the JavaScript API you want to call. + +You can bring JavaScript into Swift in two ways: + +- **Inject at initialization**: Declare in Swift and supply the implementation in `getImports()` (e.g. a `today()` function). +- **Import from `globalThis`**: For APIs on the JavaScript global object (e.g. `console`, `document`), use `@JSGetter(from: .global)` so they are read from `globalThis` and you don't pass them in `getImports()`. + +```swift +import JavaScriptKit + +@JSFunction func today() -> String + +@JSClass struct JSConsole { + @JSFunction func log(_ message: String) throws(JSException) +} +@JSGetter(from: .global) var console: JSConsole + +@JSClass struct Document { + @JSFunction func getElementById(_ id: String) throws(JSException) -> HTMLElement + @JSFunction func createElement(_ tagName: String) throws(JSException) -> HTMLElement +} +@JSGetter(from: .global) var document: Document + +@JSClass struct HTMLElement { + @JSGetter var innerText: String + @JSSetter func setInnerText(_ newValue: String) throws(JSException) + @JSFunction func appendChild(_ child: HTMLElement) throws(JSException) +} +``` + +For full details, see , , and . + +### Step 3: Use the bindings in Swift + +Call the bound APIs from Swift: + +```swift +import JavaScriptKit + +@JS func run() { + try console.log("Hello from Swift! (\(today()))") + + let button = document.createElement("button")! + try button.setInnerText("Click Me") + let container = document.getElementById("app")! + container.appendChild(button) +} +``` + +### Step 5: Inject JavaScript implementations (if needed) + +Bindings imported from globalThis (e.g. `console`, `document`) are read at runtime and do not go in `getImports()`. Only APIs you inject at initialization must be supplied there: + +```javascript +// index.js +import { init } from "./.build/plugins/PackageToJS/outputs/Package/index.js"; + +const { exports } = await init({ + getImports() { + return { + today: () => new Date().toString() + }; + } +}); + +exports.run(); +``` + +## Topics + +- +- +- \ No newline at end of file diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript/Importing-JS-Class.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript/Importing-JS-Class.md new file mode 100644 index 000000000..4302e0e49 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript/Importing-JS-Class.md @@ -0,0 +1,54 @@ +# Importing a JavaScript class or object into Swift + +This guide shows how to bind a JavaScript class (or object shape) so you can construct and use it from Swift with `@JSClass`. + +## Steps + +### 1. Declare a Swift struct with `@JSClass` + +Add a struct that mirrors the JavaScript class. Use `@JSFunction` for the initializer and for methods, and `@JSGetter` / `@JSSetter` for properties. Property setters are exposed as functions (e.g. `setMessage(_:)`) because Swift property setters cannot `throw`. + +```swift +import JavaScriptKit + +@JSClass struct Greeter { + @JSFunction init(id: String, name: String) throws(JSException) + + @JSGetter var id: String + @JSGetter var message: String + @JSSetter func setMessage(_ newValue: String) throws(JSException) + + @JSFunction func greet() throws(JSException) -> String +} +``` + +If the class is on `globalThis`, add `from: .global` to `@JSClass` and omit the type from `getImports()` in the next step. + +### 2. Wire the JavaScript side + +**If you chose injection:** Implement the class in JavaScript and pass it in `getImports()`. + +```javascript +// index.js +import { init } from "./.build/plugins/PackageToJS/outputs/Package/index.js"; + +class Greeter { + constructor(id, name) { /* ... */ } + get id() { /* ... */ } + get message() { /* ... */ } + set message(value) { /* ... */ } + greet() { /* ... */ } +} + +const { exports } = await init({ + getImports() { + return { Greeter }; + } +}); +``` + +**If you chose global:** Do not pass the class in `getImports()`; the runtime will resolve it from `globalThis`. + +## Macro options + +For optional parameters (`jsName`, `from`, etc.), see the API reference: ``JSClass(jsName:from:)``, ``JSFunction(jsName:from:)``, ``JSGetter(jsName:from:)``, and ``JSSetter(jsName:from:)``. diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript/Importing-JS-Function.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript/Importing-JS-Function.md new file mode 100644 index 000000000..64475acfa --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript/Importing-JS-Function.md @@ -0,0 +1,51 @@ +# Importing a JavaScript function into Swift + +This guide shows how to bind a JavaScript function so it is callable from Swift using `@JSFunction`. + +## Steps + +### 1. Declare the function in Swift with `@JSFunction` + +Match the JavaScript name and signature. Use Swift types that bridge to the JS types you need (see ). + +```swift +import JavaScriptKit + +@JSFunction func add(_ a: Double, _ b: Double) throws(JSException) -> Double +@JSFunction func setTitle(_ title: String) throws(JSException) +``` + +To bind a function that lives on the JavaScript global object (e.g. `parseInt`, `setTimeout`), add `from: .global`. Use `jsName` when the Swift name differs from the JavaScript name - see the ``JSFunction(jsName:from:)`` API reference for options. + +### 2. Provide the implementation at initialization + +Return the corresponding function(s) in the object passed to `getImports()` when initializing the WebAssembly module. + +```javascript +// index.js +import { init } from "./.build/plugins/PackageToJS/outputs/Package/index.js"; + +const { exports } = await init({ + getImports() { + return { + add: (a, b) => a + b, + setTitle: (title) => { document.title = title }, + }; + } +}); +``` + +If you used `from: .global`, do not pass the function in `getImports()`; the runtime resolves it from `globalThis`. + +### 3. Handle errors + +Bound functions are `throws(JSException)`. Call them with `try` or `try?`; they throw when the JavaScript implementation throws. + +## Supported features + +| Feature | Status | +|:--|:--| +| Primitive parameter/result types (e.g. `Double`, `Bool`) | ✅ | +| `String` parameter/result type | ✅ | +| Async function | ❌ | +| Generics | ❌ | diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript/Importing-JS-Variable.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript/Importing-JS-Variable.md new file mode 100644 index 000000000..044ebbe52 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-JavaScript/Importing-JS-Variable.md @@ -0,0 +1,59 @@ +# Importing a global JavaScript variable into Swift + +This guide shows how to bind a JavaScript global variable (or any property you provide at initialization) so you can read and optionally write it from Swift using `@JSGetter` and `@JSSetter`. + +## Steps + +### 1. Declare the variable in Swift with `@JSGetter` + +Use a type that bridges to the JavaScript value (see ). For object-shaped values, use a struct conforming to the bridged type (e.g. a `@JSClass` struct). + +```swift +import JavaScriptKit + +@JSGetter(from: .global) var document: Document +@JSGetter(from: .global) var myConfig: String +``` + +To bind a variable that is not on `globalThis`, omit `from: .global` and supply the value in `getImports()` in the next step. Use `jsName` when the Swift name differs from the JavaScript property name - see the ``JSGetter(jsName:from:)`` API reference. + +### 2. Add a setter for writable variables (optional) + +If the JavaScript property is writable and you need to set it from Swift, add a corresponding `@JSSetter` function. Property setters are exposed as functions (e.g. `setMyConfig(_:)`) because Swift property setters cannot `throw`. + +```swift +@JSGetter(from: .global) var myConfig: String +@JSSetter(from: .global) func setMyConfig(_ newValue: String) throws(JSException) +``` + +### 3. Provide the value at initialization (injected only) + +If you did **not** use `from: .global`, pass the value in the object returned by `getImports()` when initializing the WebAssembly module. + +```javascript +// index.js +import { init } from "./.build/plugins/PackageToJS/outputs/Package/index.js"; + +const { exports } = await init({ + getImports() { + return { + myConfig: "production", + }; + } +}); +``` + +If you used `from: .global`, do not pass the variable in `getImports()`; the runtime reads it from `globalThis`. + +## Supported features + +| Feature | Status | +|:--|:--| +| Read-only global (e.g. `document`, `console`) | ✅ | +| Writable global | ✅ (`@JSSetter`) | +| Injected variable (via `getImports()`) | ✅ | + +## See also + +- ``JSGetter(jsName:from:)`` +- ``JSSetter(jsName:from:)`` diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript-into-Swift.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript-into-Swift.md deleted file mode 100644 index b091f714b..000000000 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript-into-Swift.md +++ /dev/null @@ -1,185 +0,0 @@ -# Importing TypeScript into Swift - -Learn how to leverage TypeScript definitions to create type-safe bindings for JavaScript APIs in your Swift code. - -## Overview - -> Important: This feature is still experimental. No API stability is guaranteed, and the API may change in future releases. - -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). - -BridgeJS enables seamless integration between Swift and JavaScript by automatically generating Swift bindings from TypeScript declaration files (`.d.ts`). This provides type-safe access to JavaScript APIs directly from your Swift code. - -The key benefits of this approach over `@dynamicMemberLookup`-based APIs include: - -- **Type Safety**: Catch errors at compile-time rather than runtime -- **IDE Support**: Get autocompletion and documentation in your Swift editor -- **Performance**: Eliminating dynamism allows us to optimize the glue code - -If you prefer keeping your project simple, you can continue using `@dynamicMemberLookup`-based APIs. - -## Getting Started - -### Step 1: Configure Your Package - -First, add the BridgeJS plugin to your Swift package by modifying your `Package.swift` file: - -```swift -// swift-tools-version:6.0 - -import PackageDescription - -let package = Package( - name: "MyApp", - dependencies: [ - .package(url: "https://github.com/swiftwasm/JavaScriptKit.git", branch: "main") - ], - targets: [ - .executableTarget( - name: "MyApp", - dependencies: ["JavaScriptKit"], - swiftSettings: [ - // This is required because the generated code depends on @_extern(wasm) - .enableExperimentalFeature("Extern") - ], - plugins: [ - // Add build plugin for processing @JS and generate Swift glue code - .plugin(name: "BridgeJS", package: "JavaScriptKit") - ] - ) - ] -) -``` - -### Step 2: Create TypeScript Definitions - -Create a file named `bridge-js.d.ts` in your target source directory (e.g. `Sources//bridge-js.d.ts`). This file defines the JavaScript APIs you want to use in Swift: - -```typescript -// Simple function -export function consoleLog(message: string): void; - -// Define a subset of DOM API you want to use -interface Document { - // Properties - title: string; - readonly body: HTMLElement; - - // Methods - getElementById(id: string): HTMLElement; - createElement(tagName: string): HTMLElement; -} - -// You can use type-level operations like `Pick` to reuse -// type definitions provided by `lib.dom.d.ts`. -interface HTMLElement extends Pick { - appendChild(child: HTMLElement): void; - // TODO: Function types on function signatures are not supported yet. - // addEventListener(event: string, handler: (event: any) => void): void; -} - -// Provide access to `document` -export function getDocument(): Document; -``` - -BridgeJS will generate Swift code that matches these TypeScript declarations. For example: - -```swift -func consoleLog(message: String) - -struct Document { - var title: String { get set } - var body: HTMLElement { get } - - func getElementById(_ id: String) -> HTMLElement - func createElement(_ tagName: String) -> HTMLElement -} - -struct HTMLElement { - var innerText: String { get set } - var className: String { get set } - - func appendChild(_ child: HTMLElement) -} - -func getDocument() -> Document -``` - -### Step 3: Build Your Package - -Build your package with the following command: - -```bash -swift package --swift-sdk $SWIFT_SDK_ID js -``` - -This command: -1. Processes your TypeScript definition files -2. Generates corresponding Swift bindings -3. Compiles your Swift code to WebAssembly -4. Produces JavaScript glue code in `.build/plugins/PackageToJS/outputs/` - -> Note: For larger projects, you may want to generate the BridgeJS code ahead of time to improve build performance. See for more information. - -### Step 4: Use the Generated Swift Bindings - -The BridgeJS plugin automatically generates Swift bindings that match your TypeScript definitions. You can now use these APIs directly in your Swift code: - -```swift -import JavaScriptKit - -@JS func run() { - // Simple function call - consoleLog("Hello from Swift!") - - // Get `document` - let document = getDocument() - - // Property access - document.title = "My Swift App" - - // Method calls - let button = document.createElement("button") - button.innerText = "Click Me" - - // TODO: Function types on function signatures are not supported yet. - // buttion.addEventListener("click") { _ in - // print("On click!") - // } - - // DOM manipulation - let container = document.getElementById("app") - container.appendChild(button) -} -``` - -### Step 5: Inject JavaScript Implementations - -The final step is to provide the actual JavaScript implementations for the TypeScript declarations you defined. You need to create a JavaScript file that initializes your WebAssembly module with the appropriate implementations: - -```javascript -// index.js -import { init } from "./.build/plugins/PackageToJS/outputs/Package/index.js"; - -// Initialize the WebAssembly module with JavaScript implementations -const { exports } = await init({ - getImports() { - return { - consoleLog: (message) => { - console.log(message); - }, - getDocument: () => document, - } - } -}); - -// Call the entry point of your Swift application -exports.run(); -``` - -## Topics - -- -- -- -- diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-Class.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-Class.md deleted file mode 100644 index e04bb9e75..000000000 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-Class.md +++ /dev/null @@ -1,64 +0,0 @@ -# Importing TypeScript Classes into Swift - -Learn how TypeScript classes map to Swift when importing APIs. - -## Overview - -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). - -BridgeJS reads class declarations in your `bridge-js.d.ts` and generates Swift structs that represent JS objects. Constructors, methods, and properties are bridged via thunks that call into your JavaScript implementations at runtime. - -## Example - -TypeScript definition (`bridge-js.d.ts`): - -```typescript -export class Greeter { - readonly id: string; - message: string; - constructor(id: string, name: string); - greet(): string; -} -``` - -Generated Swift API: - -```swift -struct Greeter { - init(id: String, name: String) throws(JSException) - - // Properties - // Readonly property - var id: String { get throws(JSException) } - // Writable property - var message: String { get throws(JSException) } - func setMessage(_ newValue: String) throws(JSException) - - // Methods - func greet() throws(JSException) -> String -} -``` - -Notes: -- Property setters are emitted as `set(_:)` functions, not Swift `set` accessors since `set` accessors can't have `throws` -- All thunks throw `JSException` if the underlying JS throws. - -JavaScript implementation wiring (provided by your app): - -```javascript -// index.js -import { init } from "./.build/plugins/PackageToJS/outputs/Package/index.js"; - -class Greeter { - readonly id: string; - message: string; - constructor(id: string, name: string) { ... } - greet(): string { ... } -} - -const { exports } = await init({ - getImports() { - return { Greeter }; - } -}); -``` diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-Function.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-Function.md deleted file mode 100644 index 060ac390f..000000000 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-Function.md +++ /dev/null @@ -1,60 +0,0 @@ -# Importing TypeScript Functions into Swift - -Learn how functions declared in TypeScript become callable Swift functions. - -## Overview - -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). - -BridgeJS reads your `bridge-js.d.ts` and generates Swift thunks that call into JavaScript implementations provided at runtime. Each imported function becomes a top-level Swift function with the same name and a throwing signature. - -### Example - -TypeScript definition (`bridge-js.d.ts`): - -```typescript -export function add(a: number, b: number): number; -export function setTitle(title: string): void; -export function fetchUser(id: string): Promise; -``` - -Generated Swift signatures: - -```swift -func add(a: Double, b: Double) throws(JSException) -> Double -func setTitle(title: String) throws(JSException) -func fetchUser(id: String) throws(JSException) -> JSPromise -``` - -JavaScript implementation wiring (provided by your app): - -```javascript -// index.js -import { init } from "./.build/plugins/PackageToJS/outputs/Package/index.js"; - -const { exports } = await init({ - getImports() { - return { - add: (a, b) => a + b, - setTitle: (title) => { document.title = title }, - fetchUser: (id) => fetch(`/api/users/${id}`).then(r => r.json()), - }; - } -}); -``` - -### Error handling - -- All imported Swift functions are generated as `throws(JSException)` and will throw if the underlying JS implementation throws. - -## Supported features - -| Feature | Status | -|:--|:--| -| Primitive parameter/result types: (e.g. `boolean`, `number`) | ✅ | -| `string` parameter/result type | ✅ | -| Enums in signatures | ❌ | -| Async function | ✅ | -| Generics | ❌ | - - diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-Interface.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-Interface.md deleted file mode 100644 index 0e0aed0de..000000000 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-Interface.md +++ /dev/null @@ -1,34 +0,0 @@ -# Importing TypeScript Interfaces into Swift - -Learn how TypeScript interfaces become Swift value types with methods and properties. - -## Overview - -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). - -BridgeJS converts TS interfaces to Swift structs conforming to an internal bridging protocol and provides thunks for methods and properties that call into your JavaScript implementations. - -> Note: Interfaces are bridged very similarly to classes. Methods and properties map the same way. See for more details. - -### Example - -TypeScript definition (`bridge-js.d.ts`): - -```typescript -export interface HTMLElement { - readonly innerText: string; - className: string; - appendChild(child: HTMLElement): void; -} -``` - -Generated Swift API: - -```swift -struct HTMLElement { - var innerText: String { get throws(JSException) } - var className: String { get throws(JSException) } - func setClassName(_ newValue: String) throws(JSException) - func appendChild(_ child: HTMLElement) throws(JSException) -} -``` diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-TypeAlias.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-TypeAlias.md deleted file mode 100644 index b5242ee33..000000000 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Importing-TypeScript/Importing-TS-TypeAlias.md +++ /dev/null @@ -1,47 +0,0 @@ -# Importing TypeScript Type Aliases into Swift - -Understand how TypeScript type aliases are handled when generating Swift bindings. - -## Overview - -> Tip: You can quickly preview what interfaces will be exposed on the Swift/TypeScript sides using the [BridgeJS Playground](https://swiftwasm.org/JavaScriptKit/PlayBridgeJS/). - -BridgeJS resolves TypeScript aliases while importing. If an alias names an anonymous object type, Swift will generate a corresponding bridged struct using that name. - -> Note: When a type alias names an anonymous object type, its bridging behavior (constructors not applicable, but methods/properties if referenced) mirrors class/interface importing. See for more details. - -### Examples - -```typescript -// Primitive alias → maps to the underlying primitive -export type Price = number; - -// Object-shaped alias with a name → becomes a named bridged type when referenced -export type User = { - readonly id: string; - name: string; - age: Price; -} - -export function getUser(): User; -``` - -Generated Swift (simplified): - -```swift -// Price → Double - -struct User { - // Readonly property - var id: String { get throws(JSException) } - - // Writable properties - var name: String { get throws(JSException) } - func setName(_ newValue: String) throws(JSException) - - var age: Double { get throws(JSException) } - func setAge(_ newValue: Double) throws(JSException) -} - -func getUser() throws(JSException) -> User -``` diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Introducing-BridgeJS.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Introducing-BridgeJS.md new file mode 100644 index 000000000..da4ae0a06 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Introducing-BridgeJS.md @@ -0,0 +1,32 @@ +# Introducing BridgeJS + +Faster, easier Swift–JavaScript bridging for WebAssembly. + +## Overview + +**BridgeJS** is a layer underneath JavaScriptKit that makes Swift–JavaScript interop **faster and easier**: you declare the shape of the API in Swift (or in TypeScript, which generates Swift), and the tool generates glue code. + +Benefits over the dynamic `JSObject` / `JSValue` APIs include: + +- **Performance** - Generated code is specialized per interface, so crossing the bridge typically costs less than using generic dynamic APIs. +- **Type safety** - Mistakes are caught at compile time instead of at runtime. +- **Easier integration** - Declarative annotations and optional TypeScript input replace manual boilerplate (closures, serializers, cached strings). + +You can still use the dynamic APIs when you need them; BridgeJS is an additional option for boundaries where you want strong typing and better performance. + +## Two directions + +BridgeJS supports both directions of the bridge: + +1. **Export Swift to JavaScript** - Expose Swift functions, classes, and types to JavaScript using the ``JS(namespace:enumStyle:)`` macro. JavaScript can then call into your Swift code. See . +2. **Import JavaScript into Swift** - Make JavaScript APIs (functions, classes, globals like `document` or `console`) callable from Swift with macros such as ``JSClass(jsName:from:)``. Start with . You can also generate the same bindings from a TypeScript file; see . + +Many apps use both: import DOM or host APIs into Swift, and export an entry point or callbacks to JavaScript. + +## Getting started + +- To **call Swift from JavaScript**: +- To **call JavaScript from Swift**: +- To **generate bindings from TypeScript**: + +All require the same package and build setup; see for configuration. diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Setting-up-BridgeJS.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Setting-up-BridgeJS.md new file mode 100644 index 000000000..99a3d5b1c --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Setting-up-BridgeJS.md @@ -0,0 +1,60 @@ +# Setting up BridgeJS + +Package and build setup required for all BridgeJS workflows + +## Overview + +BridgeJS requires the JavaScriptKit package dependency, the experimental `Extern` Swift feature, and the BridgeJS build plugin. The same configuration applies whether you are exporting Swift to JavaScript, importing JavaScript into Swift with macros, and generating bindings from a TypeScript file. + +## Package.swift + +Add the JavaScriptKit dependency, enable the Extern feature on the target that uses BridgeJS, and register the BridgeJS plugin: + +```swift +// swift-tools-version:6.0 + +import PackageDescription + +let package = Package( + name: "MyApp", + dependencies: [ + .package(url: "https://github.com/swiftwasm/JavaScriptKit.git", branch: "main") + ], + targets: [ + .executableTarget( + name: "MyApp", + dependencies: ["JavaScriptKit"], + swiftSettings: [ + .enableExperimentalFeature("Extern") + ], + plugins: [ + .plugin(name: "BridgeJS", package: "JavaScriptKit") + ] + ) + ] +) +``` + +- **Dependency**: The target must depend on `"JavaScriptKit"`. +- **Extern feature**: Required because the generated bridge code uses `@_extern(wasm)`. +- **BridgeJS plugin**: Processes macro annotations to generate glue code and, [when present, `bridge-js.d.ts`; generates JS binding Swift code](). + +## Build command + +Build the package for the JavaScript/WebAssembly SDK: + +```bash +swift package --swift-sdk $SWIFT_SDK_ID js +``` + +This command: + +1. Runs the BridgeJS plugin +2. Compiles Swift to WebAssembly and generates JavaScript glue and TypeScript type definitions. +3. Writes output to `.build/plugins/PackageToJS/outputs/Package/`. + +For package layout and how to consume the output from JavaScript, see . + +## Larger projects + +The build plugin runs on every build. For larger projects, generating bridge code ahead of time can improve build performance. See . diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Supported-Types.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Supported-Types.md index c872c0dda..81a135af3 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Supported-Types.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Supported-Types.md @@ -1,18 +1,22 @@ -# TypeScript and Swift Type Mapping +# Supported Types -Use this page as a quick reference for how common TypeScript types appear in Swift when importing, and how exported Swift types surface on the TypeScript side. +Swift types and their JavaScript/TypeScript equivalents at the BridgeJS boundary. -## Type mapping +## Swift and JavaScript type mapping -| TypeScript type | Swift type | -|:--|:--| -| `number` | `Double` | -| `string` | `String` | -| `boolean` | `Bool` | -| `T[]` | `[T]` | -| TODO | `Dictionary` | -| `T \| undefined` | TODO | -| `T \| null` | `Optional` | -| `Promise` | `JSPromise` | -| `any` / `unknown` / `object` | `JSObject` | -| Other types | `JSObject` | +| Swift type | JavaScript | TypeScript | +|:--|:--|:--| +| `Int`, `UInt`, `Double`, `Float` | number | `number` | +| `String` | string | `string` | +| `Bool` | boolean | `boolean` | +| `Void` | - | `void` | +| `[T]` | array | `T[]` | +| `[String: T]` | object | `Record` | +| `Optional` | `null` or `T` | `T \| null` | +| ``JSUndefinedOr`` `` | `undefined` or `T` | `T \| undefined` | +| ``JSObject`` | object | `object` | +| ``JSValue`` | any | `any` | + +## See Also + +- diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/FAQ.md b/Sources/JavaScriptKit/Documentation.docc/Articles/FAQ.md new file mode 100644 index 000000000..aabd2f008 --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/FAQ.md @@ -0,0 +1,28 @@ +# FAQ + +Common questions about JavaScriptKit and BridgeJS. + +## Why does the initialization need to be async? Why must I await it? + +Initialization is asynchronous because the runtime must **fetch and instantiate the WebAssembly module** before your Swift code can run. That means: + +1. **Fetching** the `.wasm` binary (e.g. over the network or from disk). +2. **Instantiating** it with `WebAssembly.instantiate()` (or `instantiateStreaming()`), which compiles the module and allocates the linear memory and table. + +Until that completes, there is no WebAssembly instance to call into, so the entry point that sets up the Swift–JavaScript bridge has to be `async` and must be `await`ed from the JavaScript host (e.g. in your `index.js` or HTML script). This matches the standard WebAssembly JavaScript API, which is promise-based. + +## Why does every imported JavaScript interface via BridgeJS declare `throws(JSException)`? + +This is a conservative, safety-oriented design. Calling into JavaScript can throw at any time. If the Swift call site does not expect errors (i.e. the call is not in a `throws` context and the compiler does not force handling), then when JavaScript throws: + +- Control leaves the WebAssembly call frames **without running function epilogues**. +- Even a `do { } catch { }` in Swift does not run its `catch` block in the way you might expect, because unwinding crosses the WASM/JS boundary. +- **`defer` blocks are not executed** in those frames. + +That can lead to **inconsistent memory state** and **resource leaks**. To avoid that, every call that might invoke JavaScript is modeled as throwing: all imported JS functions, property accessors, and related operations are marked with `throws(JSException)`. That way: + +- The compiler requires you to handle or propagate errors. +- You explicitly decide how to react to JavaScript exceptions (e.g. `try`/`catch`, or propagating `throws`). +- Epilogues and cleanup run in a well-defined way when you handle the error in Swift. + +So the “everything throws” rule is there to keep behavior predictable and safe when crossing the Swift–JavaScript boundary. diff --git a/Sources/JavaScriptKit/Documentation.docc/Documentation.md b/Sources/JavaScriptKit/Documentation.docc/Documentation.md index 51ee62539..75fd24d44 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Documentation.md +++ b/Sources/JavaScriptKit/Documentation.docc/Documentation.md @@ -59,14 +59,25 @@ Check out the [examples](https://github.com/swiftwasm/JavaScriptKit/tree/main/Ex - - - +- ### BridgeJS -- +- +- - +- +- +- - - - +- +- ``JS(namespace:enumStyle:)`` +- ``JSFunction(jsName:from:)`` +- ``JSClass(jsName:from:)`` +- ``JSGetter(jsName:from:)`` +- ``JSSetter(jsName:from:)`` ### Core APIs diff --git a/Sources/JavaScriptKit/Macros.swift b/Sources/JavaScriptKit/Macros.swift index 8decf1a76..67b3488bf 100644 --- a/Sources/JavaScriptKit/Macros.swift +++ b/Sources/JavaScriptKit/Macros.swift @@ -125,7 +125,7 @@ public macro JS(namespace: String? = nil, enumStyle: JSEnumStyle = .const) = Bui /// Example: /// /// ```swift -/// @_spi(Experimental) import JavaScriptKit +/// import JavaScriptKit /// /// @JSGetter var count: Int /// @@ -137,7 +137,6 @@ public macro JS(namespace: String? = nil, enumStyle: JSEnumStyle = .const) = Bui /// - Parameter from: Selects where the property is read from. /// Use `.global` to read from `globalThis` (e.g. `console`, `document`). @attached(accessor) -@_spi(Experimental) public macro JSGetter(jsName: String? = nil, from: JSImportFrom? = nil) = #externalMacro(module: "BridgeJSMacros", type: "JSGetterMacro") @@ -151,12 +150,11 @@ public macro JSGetter(jsName: String? = nil, from: JSImportFrom? = nil) = /// Example: /// /// ```swift -/// @_spi(Experimental) import JavaScriptKit +/// import JavaScriptKit /// /// @JSSetter func setName(_ value: String) throws (JSException) /// ``` @attached(body) -@_spi(Experimental) public macro JSSetter(jsName: String? = nil, from: JSImportFrom? = nil) = #externalMacro(module: "BridgeJSMacros", type: "JSSetterMacro") @@ -167,7 +165,7 @@ public macro JSSetter(jsName: String? = nil, from: JSImportFrom? = nil) = /// Example: /// /// ```swift -/// @_spi(Experimental) import JavaScriptKit +/// import JavaScriptKit /// /// @JSFunction func greet() throws (JSException) -> String /// @JSFunction init(_ name: String) throws (JSException) @@ -178,7 +176,6 @@ public macro JSSetter(jsName: String? = nil, from: JSImportFrom? = nil) = /// - Parameter from: Selects where the function is looked up from. /// Use `.global` to call a function on `globalThis` (e.g. `setTimeout`). @attached(body) -@_spi(Experimental) public macro JSFunction(jsName: String? = nil, from: JSImportFrom? = nil) = #externalMacro(module: "BridgeJSMacros", type: "JSFunctionMacro") @@ -189,7 +186,7 @@ public macro JSFunction(jsName: String? = nil, from: JSImportFrom? = nil) = /// Example: /// /// ```swift -/// @_spi(Experimental) import JavaScriptKit +/// import JavaScriptKit /// /// @JSClass /// struct JsGreeter { @@ -204,6 +201,5 @@ public macro JSFunction(jsName: String? = nil, from: JSImportFrom? = nil) = /// Use `.global` to construct globals like `WebSocket` via `globalThis`. @attached(member, names: named(jsObject), named(init(unsafelyWrapping:))) @attached(extension, conformances: _JSBridgedClass) -@_spi(Experimental) public macro JSClass(jsName: String? = nil, from: JSImportFrom? = nil) = #externalMacro(module: "BridgeJSMacros", type: "JSClassMacro") diff --git a/Tests/BridgeJSRuntimeTests/ClosureSupportTests.swift b/Tests/BridgeJSRuntimeTests/ClosureSupportTests.swift index 320fec526..8078ed777 100644 --- a/Tests/BridgeJSRuntimeTests/ClosureSupportTests.swift +++ b/Tests/BridgeJSRuntimeTests/ClosureSupportTests.swift @@ -1,5 +1,5 @@ import XCTest -@_spi(Experimental) import JavaScriptKit +import JavaScriptKit @JSClass struct ClosureSupportImports { diff --git a/Tests/BridgeJSRuntimeTests/DictionaryTests.swift b/Tests/BridgeJSRuntimeTests/DictionaryTests.swift index ba702205d..95f2706e6 100644 --- a/Tests/BridgeJSRuntimeTests/DictionaryTests.swift +++ b/Tests/BridgeJSRuntimeTests/DictionaryTests.swift @@ -1,4 +1,4 @@ -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit import XCTest final class DictionaryTests: XCTestCase { diff --git a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift index 7f9a20586..97c2d5fbf 100644 --- a/Tests/BridgeJSRuntimeTests/ExportAPITests.swift +++ b/Tests/BridgeJSRuntimeTests/ExportAPITests.swift @@ -1,5 +1,5 @@ import XCTest -@_spi(Experimental) import JavaScriptKit +import JavaScriptKit import JavaScriptEventLoop @_extern(wasm, module: "BridgeJSRuntimeTests", name: "runJsWorks") diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift index 9f500f4a4..c63a421e0 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -4,7 +4,7 @@ // To update this file, just rebuild your project or run // `swift package bridge-js`. -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func jsRoundTripVoid() throws(JSException) -> Void diff --git a/Tests/BridgeJSRuntimeTests/ImportArrayAPIs.swift b/Tests/BridgeJSRuntimeTests/ImportArrayAPIs.swift index 3f33de86a..104304d5b 100644 --- a/Tests/BridgeJSRuntimeTests/ImportArrayAPIs.swift +++ b/Tests/BridgeJSRuntimeTests/ImportArrayAPIs.swift @@ -1,4 +1,4 @@ -@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit +@_spi(BridgeJS) import JavaScriptKit @JSFunction func jsRoundTripIntArray(_ items: [Int]) throws(JSException) -> [Int] @JSFunction func jsArrayLength(_ items: [Int]) throws(JSException) -> Int diff --git a/Tests/BridgeJSRuntimeTests/ImportStructAPIs.swift b/Tests/BridgeJSRuntimeTests/ImportStructAPIs.swift index 82908701c..41929772e 100644 --- a/Tests/BridgeJSRuntimeTests/ImportStructAPIs.swift +++ b/Tests/BridgeJSRuntimeTests/ImportStructAPIs.swift @@ -1,4 +1,4 @@ -@_spi(Experimental) import JavaScriptKit +import JavaScriptKit @JS struct Point { diff --git a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift index 454f5011d..998f8b90f 100644 --- a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift +++ b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift @@ -1,5 +1,5 @@ import XCTest -@_spi(Experimental) import JavaScriptKit +import JavaScriptKit import JavaScriptEventLoop @JSFunction func runJsOptionalSupportTests() throws diff --git a/Tests/BridgeJSRuntimeTests/StructAPIs.swift b/Tests/BridgeJSRuntimeTests/StructAPIs.swift index 38e7b12e6..6c0079dd1 100644 --- a/Tests/BridgeJSRuntimeTests/StructAPIs.swift +++ b/Tests/BridgeJSRuntimeTests/StructAPIs.swift @@ -1,4 +1,4 @@ -@_spi(Experimental) import JavaScriptKit +import JavaScriptKit @JS struct PointerFields { var raw: UnsafeRawPointer diff --git a/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift b/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift index 1a3dd0a4f..7eefbad56 100644 --- a/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift +++ b/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift @@ -1,5 +1,5 @@ import XCTest -@_spi(Experimental) import JavaScriptKit +import JavaScriptKit @JSClass struct SwiftClassSupportImports { @JSFunction static func jsRoundTripGreeter(_ greeter: Greeter) throws(JSException) -> Greeter From a931787ea6fd3fb9c92a97ad4bb51a3ddc743a42 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 13 Feb 2026 14:47:01 +0900 Subject: [PATCH 212/252] Documentation tweaks --- Plugins/BridgeJS/README.md | 6 ++-- README.md | 6 ++-- .../Articles/BridgeJS/Introducing-BridgeJS.md | 4 +-- .../Articles/BridgeJS/Unsupported-Features.md | 28 +++++++++++++++++++ .../Documentation.docc/Articles/FAQ.md | 4 +-- .../Documentation.docc/Documentation.md | 1 + 6 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Unsupported-Features.md diff --git a/Plugins/BridgeJS/README.md b/Plugins/BridgeJS/README.md index 0b6ad121e..9e1e0aa08 100644 --- a/Plugins/BridgeJS/README.md +++ b/Plugins/BridgeJS/README.md @@ -10,8 +10,8 @@ BridgeJS provides easy interoperability between Swift and JavaScript/TypeScript. It enables: -1. **Export Swift to JavaScript** – Expose Swift functions, classes, and types to JavaScript; the plugin generates TypeScript definitions (`.d.ts`) for the exported API. -2. **Import JavaScript into Swift** – Make JavaScript/TypeScript APIs callable from Swift with macro-annotated bindings or bindings generated from a TypeScript declaration file (`bridge-js.d.ts`). +1. **Export Swift to JavaScript** - Expose Swift functions, classes, and types to JavaScript; the plugin generates TypeScript definitions (`.d.ts`) for the exported API. +2. **Import JavaScript into Swift** - Make JavaScript/TypeScript APIs callable from Swift with macro-annotated bindings or bindings generated from a TypeScript declaration file (`bridge-js.d.ts`). The workflow is: @@ -174,7 +174,7 @@ For detailed semantics, see the [How It Works sections](https://swiftpackageinde `BridgeJSToolInternal` exposes pipeline stages for debugging: - `emit-skeleton` - Parse Swift files (or `-` for stdin) and print the BridgeJS skeleton as JSON. -- `emit-swift-thunks` — Read skeleton JSON (from a file or `-` for stdin) and print the generated Swift glue (export and import thunks). +- `emit-swift-thunks` - Read skeleton JSON (from a file or `-` for stdin) and print the generated Swift glue (export and import thunks). - `emit-js` / `emit-dts` - Read skeleton JSON files (or `-` for stdin) and print the .js/.d.ts Use these to inspect parser output and generated code without running the full generate/link pipeline. diff --git a/README.md b/README.md index b5cb04801..ffb029298 100644 --- a/README.md +++ b/README.md @@ -48,14 +48,14 @@ _ = document.body.appendChild(button) BridgeJS provides easy interoperability between Swift and JavaScript/TypeScript. It enables: -- **Export Swift to JavaScript** – Expose Swift functions, classes, and types to JavaScript; the plugin also generates TypeScript definitions (`.d.ts`) for the exported API. -- **Import JavaScript into Swift** – Make JavaScript/TypeScript APIs (functions, classes, globals like `document` or `console`) callable from Swift with type-safe bindings. You can declare bindings with macros in Swift or generate them from a TypeScript declaration file (`bridge-js.d.ts`). +- **Export Swift to JavaScript** - Expose Swift functions, classes, and types to JavaScript; the plugin also generates TypeScript definitions (`.d.ts`) for the exported API. +- **Import JavaScript into Swift** - Make JavaScript/TypeScript APIs (functions, classes, globals like `document` or `console`) callable from Swift with type-safe bindings. You can declare bindings with macros in Swift or generate them from a TypeScript declaration file (`bridge-js.d.ts`). For architecture details, see the [BridgeJS Plugin README](Plugins/BridgeJS/README.md). For package and build setup, see [Setting up BridgeJS](https://swiftpackageindex.com/swiftwasm/JavaScriptKit/documentation/javascriptkit/setting-up-bridgejs) in the documentation. ### Exporting Swift to JavaScript -Mark Swift code with `@JS` (the ``JS(namespace:enumStyle:)`` attribute) to make it callable from JavaScript: +Mark Swift code with `@JS` to make it callable from JavaScript: ```swift import JavaScriptKit diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Introducing-BridgeJS.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Introducing-BridgeJS.md index da4ae0a06..43f778f0c 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Introducing-BridgeJS.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Introducing-BridgeJS.md @@ -1,10 +1,10 @@ # Introducing BridgeJS -Faster, easier Swift–JavaScript bridging for WebAssembly. +Faster, easier Swift-JavaScript bridging for WebAssembly. ## Overview -**BridgeJS** is a layer underneath JavaScriptKit that makes Swift–JavaScript interop **faster and easier**: you declare the shape of the API in Swift (or in TypeScript, which generates Swift), and the tool generates glue code. +**BridgeJS** is a layer underneath JavaScriptKit that makes Swift-JavaScript interop **faster and easier**: you declare the shape of the API in Swift (or in TypeScript, which generates Swift), and the tool generates glue code. Benefits over the dynamic `JSObject` / `JSValue` APIs include: diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Unsupported-Features.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Unsupported-Features.md new file mode 100644 index 000000000..7ba25f7ae --- /dev/null +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Unsupported-Features.md @@ -0,0 +1,28 @@ +# Unsupported Features in BridgeJS + +Limitations and unsupported patterns when using BridgeJS. + +## Overview + +BridgeJS generates glue code per Swift target (module). Some patterns that are valid in Swift or TypeScript are not supported across the bridge today. This article summarizes the main limitations so you can design your APIs accordingly. + +## Type usage crossing module boundary + +BridgeJS does **not** support using a type across module boundaries in the following situations. + +### Exporting Swift: types from another Swift module + +If you have multiple Swift targets (e.g. a library and an app), you **cannot** use a type defined in one target in an exported API of another target. + +**Unsupported example:** Module `App` exports a function that takes or returns a type defined in module `Lib`: + +```swift +// In module Lib +@JS public struct LibPoint { + let x: Double + let y: Double +} + +// In module App (depends on Lib) - unsupported +@JS public func transform(_ p: LibPoint) -> LibPoint { ... } +``` diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/FAQ.md b/Sources/JavaScriptKit/Documentation.docc/Articles/FAQ.md index aabd2f008..c4f22a437 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/FAQ.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/FAQ.md @@ -9,7 +9,7 @@ Initialization is asynchronous because the runtime must **fetch and instantiate 1. **Fetching** the `.wasm` binary (e.g. over the network or from disk). 2. **Instantiating** it with `WebAssembly.instantiate()` (or `instantiateStreaming()`), which compiles the module and allocates the linear memory and table. -Until that completes, there is no WebAssembly instance to call into, so the entry point that sets up the Swift–JavaScript bridge has to be `async` and must be `await`ed from the JavaScript host (e.g. in your `index.js` or HTML script). This matches the standard WebAssembly JavaScript API, which is promise-based. +Until that completes, there is no WebAssembly instance to call into, so the entry point that sets up the Swift-JavaScript bridge has to be `async` and must be `await`ed from the JavaScript host (e.g. in your `index.js` or HTML script). This matches the standard WebAssembly JavaScript API, which is promise-based. ## Why does every imported JavaScript interface via BridgeJS declare `throws(JSException)`? @@ -25,4 +25,4 @@ That can lead to **inconsistent memory state** and **resource leaks**. To avoid - You explicitly decide how to react to JavaScript exceptions (e.g. `try`/`catch`, or propagating `throws`). - Epilogues and cleanup run in a well-defined way when you handle the error in Swift. -So the “everything throws” rule is there to keep behavior predictable and safe when crossing the Swift–JavaScript boundary. +So the “everything throws” rule is there to keep behavior predictable and safe when crossing the Swift-JavaScript boundary. diff --git a/Sources/JavaScriptKit/Documentation.docc/Documentation.md b/Sources/JavaScriptKit/Documentation.docc/Documentation.md index 75fd24d44..097203f50 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Documentation.md +++ b/Sources/JavaScriptKit/Documentation.docc/Documentation.md @@ -72,6 +72,7 @@ Check out the [examples](https://github.com/swiftwasm/JavaScriptKit/tree/main/Ex - - - +- - - ``JS(namespace:enumStyle:)`` - ``JSFunction(jsName:from:)`` From bab0adb534dee552dbd99bd14b2ac8fb5bff18e1 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Fri, 13 Feb 2026 12:17:59 +0100 Subject: [PATCH 213/252] Prevent cross-module inlining of remaining @_extern(wasm) functions (#631) Extends the fix from b3ddd88f (which addressed f32/f64) to all remaining public @_extern(wasm) BridgeJS intrinsics: i32, string, pointer, throw, init_memory, and struct_cleanup. Without @inline(never) wrappers, the Swift compiler can inline these functions across module boundaries, causing the wasm import module attribute to change from "bjs" to "env". This results in a wasm-ld linker error when a downstream module (e.g. via BridgeJS codegen) references the same symbol with a different import module. Co-authored-by: Claude Opus 4.6 --- .../JavaScriptKit/BridgeJSIntrinsics.swift | 61 ++++++++++++++----- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 52a8d8298..edb41b9fa 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -15,8 +15,13 @@ import _CJavaScriptKit #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_throw") -@_spi(BridgeJS) public func _swift_js_throw(_ id: Int32) +private func _swift_js_throw_extern(_ id: Int32) #else +private func _swift_js_throw_extern(_ id: Int32) { + _onlyAvailableOnWasm() +} +#endif + /// Throws a JavaScript exception from Swift code. /// /// This function is called by the BridgeJS code generator when a Swift function throws @@ -24,10 +29,9 @@ import _CJavaScriptKit /// JavaScript-side runtime code. /// /// - Parameter id: The ID of the JavaScript exception object to throw -@_spi(BridgeJS) public func _swift_js_throw(_ id: Int32) { - _onlyAvailableOnWasm() +@_spi(BridgeJS) @inline(never) public func _swift_js_throw(_ id: Int32) { + _swift_js_throw_extern(id) } -#endif /// Retrieves and clears any pending JavaScript exception. /// @@ -702,31 +706,44 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_init_memory") -@_spi(BridgeJS) public func _swift_js_init_memory(_ sourceId: Int32, _ ptr: UnsafeMutablePointer) +private func _swift_js_init_memory_extern(_ sourceId: Int32, _ ptr: UnsafeMutablePointer) #else -@_spi(BridgeJS) public func _swift_js_init_memory(_ sourceId: Int32, _ ptr: UnsafeMutablePointer) { +private func _swift_js_init_memory_extern(_ sourceId: Int32, _ ptr: UnsafeMutablePointer) { _onlyAvailableOnWasm() } #endif +@_spi(BridgeJS) @inline(never) public func _swift_js_init_memory(_ sourceId: Int32, _ ptr: UnsafeMutablePointer) +{ + _swift_js_init_memory_extern(sourceId, ptr) +} + #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_push_string") -@_spi(BridgeJS) public func _swift_js_push_string(_ ptr: UnsafePointer?, _ len: Int32) +private func _swift_js_push_string_extern(_ ptr: UnsafePointer?, _ len: Int32) #else -@_spi(BridgeJS) public func _swift_js_push_string(_ ptr: UnsafePointer?, _ len: Int32) { +private func _swift_js_push_string_extern(_ ptr: UnsafePointer?, _ len: Int32) { _onlyAvailableOnWasm() } #endif +@_spi(BridgeJS) @inline(never) public func _swift_js_push_string(_ ptr: UnsafePointer?, _ len: Int32) { + _swift_js_push_string_extern(ptr, len) +} + #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_push_i32") -@_spi(BridgeJS) public func _swift_js_push_i32(_ value: Int32) +private func _swift_js_push_i32_extern(_ value: Int32) #else -@_spi(BridgeJS) public func _swift_js_push_i32(_ value: Int32) { +private func _swift_js_push_i32_extern(_ value: Int32) { _onlyAvailableOnWasm() } #endif +@_spi(BridgeJS) @inline(never) public func _swift_js_push_i32(_ value: Int32) { + _swift_js_push_i32_extern(value) +} + #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_push_f32") private func _swift_js_push_f32_extern(_ value: Float32) @@ -755,13 +772,17 @@ private func _swift_js_push_f64_extern(_ value: Float64) { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_pop_i32") -@_spi(BridgeJS) public func _swift_js_pop_i32() -> Int32 +private func _swift_js_pop_i32_extern() -> Int32 #else -@_spi(BridgeJS) public func _swift_js_pop_i32() -> Int32 { +private func _swift_js_pop_i32_extern() -> Int32 { _onlyAvailableOnWasm() } #endif +@_spi(BridgeJS) @inline(never) public func _swift_js_pop_i32() -> Int32 { + _swift_js_pop_i32_extern() +} + #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_pop_f32") private func _swift_js_pop_f32_extern() -> Float32 @@ -792,13 +813,17 @@ private func _swift_js_pop_f64_extern() -> Float64 { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_cleanup") -@_spi(BridgeJS) public func _swift_js_struct_cleanup(_ cleanupId: Int32) +private func _swift_js_struct_cleanup_extern(_ cleanupId: Int32) #else -@_spi(BridgeJS) public func _swift_js_struct_cleanup(_ cleanupId: Int32) { +private func _swift_js_struct_cleanup_extern(_ cleanupId: Int32) { _onlyAvailableOnWasm() } #endif +@_spi(BridgeJS) @inline(never) public func _swift_js_struct_cleanup(_ cleanupId: Int32) { + _swift_js_struct_cleanup_extern(cleanupId) +} + // MARK: Wasm externs used by type lowering/lifting #if arch(wasm32) @@ -986,13 +1011,17 @@ func _swift_js_return_optional_double(_ isSome: Int32, _ value: Float64) { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_push_pointer") -@_spi(BridgeJS) public func _swift_js_push_pointer(_ pointer: UnsafeMutableRawPointer) +private func _swift_js_push_pointer_extern(_ pointer: UnsafeMutableRawPointer) #else -@_spi(BridgeJS) public func _swift_js_push_pointer(_ pointer: UnsafeMutableRawPointer) { +private func _swift_js_push_pointer_extern(_ pointer: UnsafeMutableRawPointer) { _onlyAvailableOnWasm() } #endif +@_spi(BridgeJS) @inline(never) public func _swift_js_push_pointer(_ pointer: UnsafeMutableRawPointer) { + _swift_js_push_pointer_extern(pointer) +} + #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_pop_pointer") private func _swift_js_pop_pointer_extern() -> UnsafeMutableRawPointer From d0c02822ab7e9750273c6e7ae2255cbc3fcfa936 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 13 Feb 2026 20:23:59 +0900 Subject: [PATCH 214/252] CI: Use debug builds for SwiftSyntax in ./Examples/Embedded (#632) --- Examples/Embedded/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Embedded/build.sh b/Examples/Embedded/build.sh index 2d035493a..d756d8d1e 100755 --- a/Examples/Embedded/build.sh +++ b/Examples/Embedded/build.sh @@ -2,4 +2,4 @@ set -euxo pipefail package_dir="$(cd "$(dirname "$0")" && pwd)" swift package --package-path "$package_dir" \ - -c release --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1}}-embedded" js + --swift-sdk "${SWIFT_SDK_ID_wasm32_unknown_wasip1:-${SWIFT_SDK_ID:-wasm32-unknown-wasip1}}-embedded" js -c release From 83995af7fd97ba980f62ca69bc894176862eaa22 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 13 Feb 2026 22:05:15 +0900 Subject: [PATCH 215/252] [skip ci] Fix BridgeJS code snippet on README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ffb029298..03129c3e2 100644 --- a/README.md +++ b/README.md @@ -101,10 +101,10 @@ import JavaScriptKit } @JS func run() throws(JSException) { - let button = document.createElement("button")! + let button = try document.createElement("button") try button.setInnerText("Click Me") - let container = document.getElementById("app")! - container.appendChild(button) + let container = try document.getElementById("app") + try container.appendChild(button) } ``` From dadff8bbb0d402a641f2015f29951f32df774080 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Sat, 14 Feb 2026 15:01:35 +0100 Subject: [PATCH 216/252] NFC: BridgeJS: Reduce retained object cleanup warning noise in BridgeJS glue (#633) --- .../Sources/BridgeJSLink/JSGlueGen.swift | 22 +------------------ .../ImportedTypeInExportedInterface.js | 16 +------------- .../BridgeJSLinkTests/SwiftStruct.js | 16 +------------- 3 files changed, 3 insertions(+), 51 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 36d463ab4..ffb50c7a8 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -3026,7 +3026,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let idVar = scope.variable("id") printer.write("let \(idVar);") @@ -3040,16 +3040,6 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") scope.emitPushI32Parameter("\(idVar) !== undefined ? \(idVar) : 0", printer: printer) - cleanup.write("if(\(idVar) !== undefined && \(idVar) !== 0) {") - cleanup.indent { - cleanup.write("try {") - cleanup.indent { - cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.getObject(\(idVar));") - cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") - } - cleanup.write("} catch(e) {}") - } - cleanup.write("}") return [idVar] } ) @@ -3208,16 +3198,6 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - cleanup.write("if(\(idVar) !== undefined && \(idVar) !== 0) {") - cleanup.indent { - cleanup.write("try {") - cleanup.indent { - cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.getObject(\(idVar));") - cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") - } - cleanup.write("} catch(e) {}") - } - cleanup.write("}") return [idVar] } else { switch wrappedType { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index 7e2f48981..48aab8fbb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -49,21 +49,7 @@ export async function createInstantiator(options, swift) { i32Stack.push(0); } i32Stack.push(isSome ? 1 : 0); - const cleanup = () => { - if(id !== undefined && id !== 0) { - try { - swift.memory.getObject(id); - swift.memory.release(id); - } catch(e) {} - } - if(id1 !== undefined && id1 !== 0) { - try { - swift.memory.getObject(id1); - swift.memory.release(id1); - } catch(e) {} - } - }; - return { cleanup }; + return { cleanup: undefined }; }, lift: () => { const isSome = i32Stack.pop(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index ff8c8f8b0..dca01b33c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -243,21 +243,7 @@ export async function createInstantiator(options, swift) { i32Stack.push(0); } i32Stack.push(isSome ? 1 : 0); - const cleanup = () => { - if(id !== undefined && id !== 0) { - try { - swift.memory.getObject(id); - swift.memory.release(id); - } catch(e) {} - } - if(id1 !== undefined && id1 !== 0) { - try { - swift.memory.getObject(id1); - swift.memory.release(id1); - } catch(e) {} - } - }; - return { cleanup }; + return { cleanup: undefined }; }, lift: () => { const isSome = i32Stack.pop(); From a8b249c0c671f2b8ce03b1a9bcc90796eeb7b3de Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sun, 15 Feb 2026 12:58:18 +0900 Subject: [PATCH 217/252] [NFC] BridgeJS: Rename Stack ABI operation methods (#634) To make push/pop operations agnostic to import/export contexts, rename the following methods: - `bridgeJSLiftParameter()` -> `bridgeJSStackPop()` - `bridgeJSLowerStackReturn()` -> `bridgeJSStackPush()` --- Benchmarks/Sources/Generated/BridgeJS.swift | 268 +++---- .../Sources/BridgeJSCore/ExportSwift.swift | 56 +- .../BridgeJSCodegenTests/ArrayTypes.swift | 114 +-- .../DefaultParameters.swift | 54 +- .../EnumAssociatedValue.swift | 184 ++--- .../ImportedTypeInExportedInterface.swift | 24 +- .../BridgeJSCodegenTests/JSValue.swift | 6 +- .../BridgeJSCodegenTests/Protocol.swift | 18 +- .../StaticFunctions.Global.swift | 8 +- .../StaticFunctions.swift | 8 +- .../BridgeJSCodegenTests/SwiftClosure.swift | 20 +- .../BridgeJSCodegenTests/SwiftStruct.swift | 132 ++-- .../SwiftStructImports.swift | 16 +- .../BridgeJSCodegenTests/UnsafePointer.swift | 28 +- .../JavaScriptKit/BridgeJSIntrinsics.swift | 401 +++++----- .../Generated/BridgeJS.swift | 738 +++++++++--------- 16 files changed, 1055 insertions(+), 1020 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 9a1b30dc4..6ec87dca8 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -11,15 +11,15 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .failure(Int.bridgeJSLiftParameter()) + return .failure(Int.bridgeJSStackPop()) case 2: - return .flag(Bool.bridgeJSLiftParameter()) + return .flag(Bool.bridgeJSStackPop()) case 3: - return .rate(Float.bridgeJSLiftParameter()) + return .rate(Float.bridgeJSStackPop()) case 4: - return .precise(Double.bridgeJSLiftParameter()) + return .precise(Double.bridgeJSStackPop()) case 5: return .info default: @@ -30,19 +30,19 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .failure(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(1) case .flag(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(2) case .rate(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(3) case .precise(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(4) case .info: return Int32(5) @@ -54,17 +54,17 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .error(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) + return .error(String.bridgeJSStackPop(), Int.bridgeJSStackPop()) case 2: - return .location(Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) + return .location(Double.bridgeJSStackPop(), Double.bridgeJSStackPop(), String.bridgeJSStackPop()) case 3: - return .status(Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) + return .status(Bool.bridgeJSStackPop(), Int.bridgeJSStackPop(), String.bridgeJSStackPop()) case 4: - return .coordinates(Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter()) + return .coordinates(Double.bridgeJSStackPop(), Double.bridgeJSStackPop(), Double.bridgeJSStackPop()) case 5: - return .comprehensive(Bool.bridgeJSLiftParameter(), Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), String.bridgeJSLiftParameter(), String.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) + 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: @@ -75,37 +75,37 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .error(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() return Int32(1) case .location(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() return Int32(2) case .status(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() return Int32(3) case .coordinates(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() + 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.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - param3.bridgeJSLowerStackReturn() - param4.bridgeJSLowerStackReturn() - param5.bridgeJSLowerStackReturn() - param6.bridgeJSLowerStackReturn() - param7.bridgeJSLowerStackReturn() - param8.bridgeJSLowerStackReturn() + 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) @@ -114,21 +114,21 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { } extension SimpleStruct: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> SimpleStruct { - let precise = Double.bridgeJSLiftParameter() - let rate = Float.bridgeJSLiftParameter() - let flag = Bool.bridgeJSLiftParameter() - let count = Int.bridgeJSLiftParameter() - let name = String.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> SimpleStruct { + let precise = Double.bridgeJSStackPop() + let rate = Float.bridgeJSStackPop() + let flag = Bool.bridgeJSStackPop() + let count = Int.bridgeJSStackPop() + let name = String.bridgeJSStackPop() return SimpleStruct(name: name, count: count, flag: flag, rate: rate, precise: precise) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.name.bridgeJSLowerStackReturn() - self.count.bridgeJSLowerStackReturn() - self.flag.bridgeJSLowerStackReturn() - self.rate.bridgeJSLowerStackReturn() - self.precise.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.name.bridgeJSStackPush() + self.count.bridgeJSStackPush() + self.flag.bridgeJSStackPush() + self.rate.bridgeJSStackPush() + self.precise.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -136,12 +136,12 @@ extension SimpleStruct: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_SimpleStruct())) } } @@ -165,17 +165,17 @@ fileprivate func _bjs_struct_lift_SimpleStruct() -> Int32 { #endif extension Address: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Address { - let zipCode = Int.bridgeJSLiftParameter() - let city = String.bridgeJSLiftParameter() - let street = String.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Address { + let zipCode = Int.bridgeJSStackPop() + let city = String.bridgeJSStackPop() + let street = String.bridgeJSStackPop() return Address(street: street, city: city, zipCode: zipCode) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.street.bridgeJSLowerStackReturn() - self.city.bridgeJSLowerStackReturn() - self.zipCode.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.street.bridgeJSStackPush() + self.city.bridgeJSStackPush() + self.zipCode.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -183,12 +183,12 @@ extension Address: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Address())) } } @@ -212,21 +212,21 @@ fileprivate func _bjs_struct_lift_Address() -> Int32 { #endif extension Person: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Person { - let email = Optional.bridgeJSLiftParameter() - let address = Address.bridgeJSLiftParameter() - let age = Int.bridgeJSLiftParameter() - let name = String.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Person { + let email = Optional.bridgeJSStackPop() + let address = Address.bridgeJSStackPop() + let age = Int.bridgeJSStackPop() + let name = String.bridgeJSStackPop() return Person(name: name, age: age, address: address, email: email) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.name.bridgeJSLowerStackReturn() - self.age.bridgeJSLowerStackReturn() - self.address.bridgeJSLowerReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.name.bridgeJSStackPush() + self.age.bridgeJSStackPush() + self.address.bridgeJSStackPush() let __bjs_isSome_email = self.email != nil if let __bjs_unwrapped_email = self.email { - __bjs_unwrapped_email.bridgeJSLowerStackReturn() + __bjs_unwrapped_email.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_email ? 1 : 0) } @@ -236,12 +236,12 @@ extension Person: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Person())) } } @@ -265,23 +265,23 @@ fileprivate func _bjs_struct_lift_Person() -> Int32 { #endif extension ComplexStruct: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ComplexStruct { - let metadata = String.bridgeJSLiftParameter() - let tags = String.bridgeJSLiftParameter() - let score = Double.bridgeJSLiftParameter() - let active = Bool.bridgeJSLiftParameter() - let title = String.bridgeJSLiftParameter() - let id = Int.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> ComplexStruct { + let metadata = String.bridgeJSStackPop() + let tags = String.bridgeJSStackPop() + let score = Double.bridgeJSStackPop() + let active = Bool.bridgeJSStackPop() + let title = String.bridgeJSStackPop() + let id = Int.bridgeJSStackPop() return ComplexStruct(id: id, title: title, active: active, score: score, tags: tags, metadata: metadata) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.id.bridgeJSLowerStackReturn() - self.title.bridgeJSLowerStackReturn() - self.active.bridgeJSLowerStackReturn() - self.score.bridgeJSLowerStackReturn() - self.tags.bridgeJSLowerStackReturn() - self.metadata.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.id.bridgeJSStackPush() + self.title.bridgeJSStackPush() + self.active.bridgeJSStackPush() + self.score.bridgeJSStackPush() + self.tags.bridgeJSStackPush() + self.metadata.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -289,12 +289,12 @@ extension ComplexStruct: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ComplexStruct())) } } @@ -318,15 +318,15 @@ fileprivate func _bjs_struct_lift_ComplexStruct() -> Int32 { #endif extension Point: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { - let y = Double.bridgeJSLiftParameter() - let x = Double.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Point { + let y = Double.bridgeJSStackPop() + let x = Double.bridgeJSStackPop() return Point(x: x, y: y) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.x.bridgeJSLowerStackReturn() - self.y.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.x.bridgeJSStackPush() + self.y.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -334,12 +334,12 @@ extension Point: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Point())) } } @@ -1329,7 +1329,7 @@ public func _bjs_ArrayRoundtrip_init() -> UnsafeMutableRawPointer { @_cdecl("bjs_ArrayRoundtrip_takeIntArray") public func _bjs_ArrayRoundtrip_takeIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - ArrayRoundtrip.bridgeJSLiftParameter(_self).takeIntArray(_: [Int].bridgeJSLiftParameter()) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeIntArray(_: [Int].bridgeJSStackPop()) #else fatalError("Only available on WebAssembly") #endif @@ -1340,7 +1340,7 @@ public func _bjs_ArrayRoundtrip_takeIntArray(_ _self: UnsafeMutableRawPointer) - public func _bjs_ArrayRoundtrip_makeIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeIntArray() - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1350,8 +1350,8 @@ public func _bjs_ArrayRoundtrip_makeIntArray(_ _self: UnsafeMutableRawPointer) - @_cdecl("bjs_ArrayRoundtrip_roundtripIntArray") public func _bjs_ArrayRoundtrip_roundtripIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripIntArray(_: [Int].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripIntArray(_: [Int].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1362,7 +1362,7 @@ public func _bjs_ArrayRoundtrip_roundtripIntArray(_ _self: UnsafeMutableRawPoint public func _bjs_ArrayRoundtrip_makeIntArrayLarge(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeIntArrayLarge() - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1372,7 +1372,7 @@ public func _bjs_ArrayRoundtrip_makeIntArrayLarge(_ _self: UnsafeMutableRawPoint @_cdecl("bjs_ArrayRoundtrip_takeDoubleArray") public func _bjs_ArrayRoundtrip_takeDoubleArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - ArrayRoundtrip.bridgeJSLiftParameter(_self).takeDoubleArray(_: [Double].bridgeJSLiftParameter()) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeDoubleArray(_: [Double].bridgeJSStackPop()) #else fatalError("Only available on WebAssembly") #endif @@ -1383,7 +1383,7 @@ public func _bjs_ArrayRoundtrip_takeDoubleArray(_ _self: UnsafeMutableRawPointer public func _bjs_ArrayRoundtrip_makeDoubleArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeDoubleArray() - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1393,8 +1393,8 @@ public func _bjs_ArrayRoundtrip_makeDoubleArray(_ _self: UnsafeMutableRawPointer @_cdecl("bjs_ArrayRoundtrip_roundtripDoubleArray") public func _bjs_ArrayRoundtrip_roundtripDoubleArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripDoubleArray(_: [Double].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripDoubleArray(_: [Double].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1404,7 +1404,7 @@ public func _bjs_ArrayRoundtrip_roundtripDoubleArray(_ _self: UnsafeMutableRawPo @_cdecl("bjs_ArrayRoundtrip_takeStringArray") public func _bjs_ArrayRoundtrip_takeStringArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - ArrayRoundtrip.bridgeJSLiftParameter(_self).takeStringArray(_: [String].bridgeJSLiftParameter()) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeStringArray(_: [String].bridgeJSStackPop()) #else fatalError("Only available on WebAssembly") #endif @@ -1415,7 +1415,7 @@ public func _bjs_ArrayRoundtrip_takeStringArray(_ _self: UnsafeMutableRawPointer public func _bjs_ArrayRoundtrip_makeStringArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeStringArray() - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1425,8 +1425,8 @@ public func _bjs_ArrayRoundtrip_makeStringArray(_ _self: UnsafeMutableRawPointer @_cdecl("bjs_ArrayRoundtrip_roundtripStringArray") public func _bjs_ArrayRoundtrip_roundtripStringArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripStringArray(_: [String].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripStringArray(_: [String].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1436,7 +1436,7 @@ public func _bjs_ArrayRoundtrip_roundtripStringArray(_ _self: UnsafeMutableRawPo @_cdecl("bjs_ArrayRoundtrip_takePointArray") public func _bjs_ArrayRoundtrip_takePointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - ArrayRoundtrip.bridgeJSLiftParameter(_self).takePointArray(_: [Point].bridgeJSLiftParameter()) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takePointArray(_: [Point].bridgeJSStackPop()) #else fatalError("Only available on WebAssembly") #endif @@ -1447,7 +1447,7 @@ public func _bjs_ArrayRoundtrip_takePointArray(_ _self: UnsafeMutableRawPointer) public func _bjs_ArrayRoundtrip_makePointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makePointArray() - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1457,8 +1457,8 @@ public func _bjs_ArrayRoundtrip_makePointArray(_ _self: UnsafeMutableRawPointer) @_cdecl("bjs_ArrayRoundtrip_roundtripPointArray") public func _bjs_ArrayRoundtrip_roundtripPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripPointArray(_: [Point].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripPointArray(_: [Point].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1469,7 +1469,7 @@ public func _bjs_ArrayRoundtrip_roundtripPointArray(_ _self: UnsafeMutableRawPoi public func _bjs_ArrayRoundtrip_makePointArrayLarge(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makePointArrayLarge() - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1479,7 +1479,7 @@ public func _bjs_ArrayRoundtrip_makePointArrayLarge(_ _self: UnsafeMutableRawPoi @_cdecl("bjs_ArrayRoundtrip_takeNestedIntArray") public func _bjs_ArrayRoundtrip_takeNestedIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedIntArray(_: [[Int]].bridgeJSLiftParameter()) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedIntArray(_: [[Int]].bridgeJSStackPop()) #else fatalError("Only available on WebAssembly") #endif @@ -1490,7 +1490,7 @@ public func _bjs_ArrayRoundtrip_takeNestedIntArray(_ _self: UnsafeMutableRawPoin public func _bjs_ArrayRoundtrip_makeNestedIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeNestedIntArray() - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1500,8 +1500,8 @@ public func _bjs_ArrayRoundtrip_makeNestedIntArray(_ _self: UnsafeMutableRawPoin @_cdecl("bjs_ArrayRoundtrip_roundtripNestedIntArray") public func _bjs_ArrayRoundtrip_roundtripNestedIntArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedIntArray(_: [[Int]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedIntArray(_: [[Int]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1511,7 +1511,7 @@ public func _bjs_ArrayRoundtrip_roundtripNestedIntArray(_ _self: UnsafeMutableRa @_cdecl("bjs_ArrayRoundtrip_takeNestedPointArray") public func _bjs_ArrayRoundtrip_takeNestedPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedPointArray(_: [[Point]].bridgeJSLiftParameter()) + ArrayRoundtrip.bridgeJSLiftParameter(_self).takeNestedPointArray(_: [[Point]].bridgeJSStackPop()) #else fatalError("Only available on WebAssembly") #endif @@ -1522,7 +1522,7 @@ public func _bjs_ArrayRoundtrip_takeNestedPointArray(_ _self: UnsafeMutableRawPo public func _bjs_ArrayRoundtrip_makeNestedPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeNestedPointArray() - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1532,8 +1532,8 @@ public func _bjs_ArrayRoundtrip_makeNestedPointArray(_ _self: UnsafeMutableRawPo @_cdecl("bjs_ArrayRoundtrip_roundtripNestedPointArray") public func _bjs_ArrayRoundtrip_roundtripNestedPointArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedPointArray(_: [[Point]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripNestedPointArray(_: [[Point]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1548,7 +1548,7 @@ public func _bjs_ArrayRoundtrip_takeOptionalIntArray(_ _self: UnsafeMutableRawPo var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result @@ -1566,7 +1566,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalIntArray(_ _self: UnsafeMutableRawPo for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } @@ -1585,7 +1585,7 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalIntArray(_ _self: UnsafeMutable var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result @@ -1593,7 +1593,7 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalIntArray(_ _self: UnsafeMutable for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } @@ -1612,7 +1612,7 @@ public func _bjs_ArrayRoundtrip_takeOptionalPointArray(_ _self: UnsafeMutableRaw var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result @@ -1628,7 +1628,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalPointArray(_ _self: UnsafeMutableRaw #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalPointArray() for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() + __bjs_elem_ret.bridgeJSStackPush() } _swift_js_push_i32(Int32(ret.count)) #else @@ -1645,13 +1645,13 @@ public func _bjs_ArrayRoundtrip_roundtripOptionalPointArray(_ _self: UnsafeMutab var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() + __bjs_elem_ret.bridgeJSStackPush() } _swift_js_push_i32(Int32(ret.count)) #else @@ -1674,7 +1674,7 @@ public func _bjs_ArrayRoundtrip_takeOptionalArray(_ _self: UnsafeMutableRawPoint public func _bjs_ArrayRoundtrip_makeOptionalArraySome(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalArraySome() - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1685,7 +1685,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalArraySome(_ _self: UnsafeMutableRawP public func _bjs_ArrayRoundtrip_makeOptionalArrayNone(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).makeOptionalArrayNone() - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -1696,7 +1696,7 @@ public func _bjs_ArrayRoundtrip_makeOptionalArrayNone(_ _self: UnsafeMutableRawP public func _bjs_ArrayRoundtrip_roundtripOptionalArray(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = ArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripOptionalArray(_: Optional<[Int]>.bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index bb42e9d1e..207f6ee69 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -739,9 +739,9 @@ struct StackCodegen { case .string, .int, .uint, .bool, .float, .double, .jsObject(nil), .jsValue, .swiftStruct, .swiftHeapObject, .unsafePointer, .swiftProtocol, .caseEnum, .associatedValueEnum, .rawValueEnum: - return "\(raw: type.swiftType).bridgeJSLiftParameter()" + return "\(raw: type.swiftType).bridgeJSStackPop()" case .jsObject(let className?): - return "\(raw: className)(unsafelyWrapping: JSObject.bridgeJSLiftParameter())" + return "\(raw: className)(unsafelyWrapping: JSObject.bridgeJSStackPop())" case .nullable(let wrappedType, let kind): return liftNullableExpression(wrappedType: wrappedType, kind: kind) case .array(let elementType): @@ -749,7 +749,7 @@ struct StackCodegen { case .dictionary(let valueType): return liftDictionaryExpression(valueType: valueType) case .closure: - return "JSObject.bridgeJSLiftParameter()" + return "JSObject.bridgeJSStackPop()" case .void, .namespaceEnum: return "()" } @@ -758,13 +758,13 @@ struct StackCodegen { func liftArrayExpression(elementType: BridgeType) -> ExprSyntax { switch elementType { case .jsObject(let className?) where className != "JSObject": - return "[JSObject].bridgeJSLiftParameter().map { \(raw: className)(unsafelyWrapping: $0) }" + return "[JSObject].bridgeJSStackPop().map { \(raw: className)(unsafelyWrapping: $0) }" case .nullable, .closure: return liftArrayExpressionInline(elementType: elementType) case .void, .namespaceEnum: fatalError("Invalid array element type: \(elementType)") default: - return "[\(raw: elementType.swiftType)].bridgeJSLiftParameter()" + return "[\(raw: elementType.swiftType)].bridgeJSStackPop()" } } @@ -790,7 +790,7 @@ struct StackCodegen { case .jsObject(let className?) where className != "JSObject": return """ { - let __dict = [String: JSObject].bridgeJSLiftParameter() + let __dict = [String: JSObject].bridgeJSStackPop() return __dict.mapValues { \(raw: className)(unsafelyWrapping: $0) } }() """ @@ -799,7 +799,7 @@ struct StackCodegen { case .void, .namespaceEnum: fatalError("Invalid dictionary value type: \(valueType)") default: - return "[String: \(raw: valueType.swiftType)].bridgeJSLiftParameter()" + return "[String: \(raw: valueType.swiftType)].bridgeJSStackPop()" } } @@ -813,7 +813,7 @@ struct StackCodegen { __result.reserveCapacity(__count) for _ in 0..<__count { let __value = \(valueLift) - let __key = String.bridgeJSLiftParameter() + let __key = String.bridgeJSStackPop() __result[__key] = __value } return __result @@ -827,9 +827,9 @@ struct StackCodegen { case .string, .int, .uint, .bool, .float, .double, .jsObject(nil), .jsValue, .swiftStruct, .swiftHeapObject, .caseEnum, .associatedValueEnum, .rawValueEnum, .array, .dictionary: - return "\(raw: typeName)<\(raw: wrappedType.swiftType)>.bridgeJSLiftParameter()" + return "\(raw: typeName)<\(raw: wrappedType.swiftType)>.bridgeJSStackPop()" case .jsObject(let className?): - return "\(raw: typeName).bridgeJSLiftParameter().map { \(raw: className)(unsafelyWrapping: $0) }" + return "\(raw: typeName).bridgeJSStackPop().map { \(raw: className)(unsafelyWrapping: $0) }" case .nullable, .void, .namespaceEnum, .closure, .unsafePointer, .swiftProtocol: fatalError("Invalid nullable wrapped type: \(wrappedType)") } @@ -850,13 +850,13 @@ struct StackCodegen { case .string, .int, .uint, .bool, .float, .double, .jsValue, .jsObject(nil), .swiftHeapObject, .unsafePointer, .closure, .caseEnum, .rawValueEnum: - return ["\(raw: accessor).bridgeJSLowerStackReturn()"] + return ["\(raw: accessor).bridgeJSStackPush()"] case .jsObject(_?): - return ["\(raw: accessor).jsObject.bridgeJSLowerStackReturn()"] + return ["\(raw: accessor).jsObject.bridgeJSStackPush()"] case .swiftProtocol: - return ["(\(raw: accessor) as! \(raw: type.swiftType)).bridgeJSLowerStackReturn()"] + return ["(\(raw: accessor) as! \(raw: type.swiftType)).bridgeJSStackPush()"] case .associatedValueEnum, .swiftStruct: - return ["\(raw: accessor).bridgeJSLowerReturn()"] + return ["\(raw: accessor).bridgeJSStackPush()"] case .nullable(let wrappedType, _): return lowerOptionalStatements(wrappedType: wrappedType, accessor: accessor, varPrefix: varPrefix) case .void, .namespaceEnum: @@ -875,9 +875,9 @@ struct StackCodegen { ) -> [CodeBlockItemSyntax] { switch elementType { case .jsObject(let className?) where className != "JSObject": - return ["\(raw: accessor).map { $0.jsObject }.bridgeJSLowerReturn()"] + return ["\(raw: accessor).map { $0.jsObject }.bridgeJSStackPush()"] case .swiftProtocol: - return ["\(raw: accessor).map { $0 as! \(raw: elementType.swiftType) }.bridgeJSLowerReturn()"] + return ["\(raw: accessor).map { $0 as! \(raw: elementType.swiftType) }.bridgeJSStackPush()"] case .nullable, .closure: return lowerArrayStatementsInline( elementType: elementType, @@ -887,7 +887,7 @@ struct StackCodegen { case .void, .namespaceEnum: fatalError("Invalid array element type: \(elementType)") default: - return ["\(raw: accessor).bridgeJSLowerReturn()"] + return ["\(raw: accessor).bridgeJSStackPush()"] } } @@ -922,9 +922,9 @@ struct StackCodegen { ) -> [CodeBlockItemSyntax] { switch valueType { case .jsObject(let className?) where className != "JSObject": - return ["\(raw: accessor).mapValues { $0.jsObject }.bridgeJSLowerReturn()"] + return ["\(raw: accessor).mapValues { $0.jsObject }.bridgeJSStackPush()"] case .swiftProtocol: - return ["\(raw: accessor).mapValues { $0 as! \(raw: valueType.swiftType) }.bridgeJSLowerReturn()"] + return ["\(raw: accessor).mapValues { $0 as! \(raw: valueType.swiftType) }.bridgeJSStackPush()"] case .nullable, .closure: return lowerDictionaryStatementsInline( valueType: valueType, @@ -934,7 +934,7 @@ struct StackCodegen { case .void, .namespaceEnum: fatalError("Invalid dictionary value type: \(valueType)") default: - return ["\(raw: accessor).bridgeJSLowerReturn()"] + return ["\(raw: accessor).bridgeJSStackPush()"] } } @@ -979,7 +979,7 @@ struct StackCodegen { ) -> [CodeBlockItemSyntax] { switch wrappedType { case .array, .dictionary, .swiftStruct: - return ["\(raw: accessor).bridgeJSLowerReturn()"] + return ["\(raw: accessor).bridgeJSStackPush()"] default: break } @@ -1008,13 +1008,13 @@ struct StackCodegen { ) -> [CodeBlockItemSyntax] { switch wrappedType { case .jsObject(_?): - return ["\(raw: unwrappedVar).jsObject.bridgeJSLowerStackReturn()"] + return ["\(raw: unwrappedVar).jsObject.bridgeJSStackPush()"] case .swiftProtocol: - return ["(\(raw: unwrappedVar) as! \(raw: wrappedType.swiftType)).bridgeJSLowerStackReturn()"] + return ["(\(raw: unwrappedVar) as! \(raw: wrappedType.swiftType)).bridgeJSStackPush()"] case .string, .int, .uint, .bool, .float, .double, .jsValue, .jsObject(nil), .swiftHeapObject, .unsafePointer, .closure, .caseEnum, .rawValueEnum, .associatedValueEnum: - return ["\(raw: unwrappedVar).bridgeJSLowerStackReturn()"] + return ["\(raw: unwrappedVar).bridgeJSStackPush()"] default: return ["preconditionFailure(\"BridgeJS: unsupported optional wrapped type\")"] } @@ -1225,14 +1225,14 @@ struct StructCodegen { let printer = CodeFragmentPrinter() printer.write("extension \(typeName): _BridgedSwiftStruct {") printer.indent { - printer.write("@_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> \(typeName) {") + printer.write("@_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> \(typeName) {") printer.indent { printer.write(lines: generateStructLiftCode(structDef: structDef)) } printer.write("}") printer.nextLine() - printer.write("@_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() {") + printer.write("@_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() {") printer.indent { printer.write(lines: generateStructLowerCode(structDef: structDef)) } @@ -1247,7 +1247,7 @@ struct StructCodegen { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } """ ) @@ -1257,7 +1257,7 @@ struct StructCodegen { multilineString: """ \(accessControl)func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: \(liftFunctionName)())) } """ diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift index 3eedb418d..3141139ca 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift @@ -45,15 +45,15 @@ extension Status: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } extension Point: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { - let y = Double.bridgeJSLiftParameter() - let x = Double.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Point { + let y = Double.bridgeJSStackPop() + let x = Double.bridgeJSStackPop() return Point(x: x, y: y) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.x.bridgeJSLowerStackReturn() - self.y.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.x.bridgeJSStackPush() + self.y.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -61,12 +61,12 @@ extension Point: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Point())) } } @@ -93,8 +93,8 @@ fileprivate func _bjs_struct_lift_Point() -> Int32 { @_cdecl("bjs_processIntArray") public func _bjs_processIntArray() -> Void { #if arch(wasm32) - let ret = processIntArray(_: [Int].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processIntArray(_: [Int].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -104,8 +104,8 @@ public func _bjs_processIntArray() -> Void { @_cdecl("bjs_processStringArray") public func _bjs_processStringArray() -> Void { #if arch(wasm32) - let ret = processStringArray(_: [String].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processStringArray(_: [String].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -115,8 +115,8 @@ public func _bjs_processStringArray() -> Void { @_cdecl("bjs_processDoubleArray") public func _bjs_processDoubleArray() -> Void { #if arch(wasm32) - let ret = processDoubleArray(_: [Double].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processDoubleArray(_: [Double].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -126,8 +126,8 @@ public func _bjs_processDoubleArray() -> Void { @_cdecl("bjs_processBoolArray") public func _bjs_processBoolArray() -> Void { #if arch(wasm32) - let ret = processBoolArray(_: [Bool].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processBoolArray(_: [Bool].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -137,8 +137,8 @@ public func _bjs_processBoolArray() -> Void { @_cdecl("bjs_processPointArray") public func _bjs_processPointArray() -> Void { #if arch(wasm32) - let ret = processPointArray(_: [Point].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processPointArray(_: [Point].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -148,8 +148,8 @@ public func _bjs_processPointArray() -> Void { @_cdecl("bjs_processDirectionArray") public func _bjs_processDirectionArray() -> Void { #if arch(wasm32) - let ret = processDirectionArray(_: [Direction].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processDirectionArray(_: [Direction].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -159,8 +159,8 @@ public func _bjs_processDirectionArray() -> Void { @_cdecl("bjs_processStatusArray") public func _bjs_processStatusArray() -> Void { #if arch(wasm32) - let ret = processStatusArray(_: [Status].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processStatusArray(_: [Status].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -170,7 +170,7 @@ public func _bjs_processStatusArray() -> Void { @_cdecl("bjs_sumIntArray") public func _bjs_sumIntArray() -> Int32 { #if arch(wasm32) - let ret = sumIntArray(_: [Int].bridgeJSLiftParameter()) + let ret = sumIntArray(_: [Int].bridgeJSStackPop()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -181,7 +181,7 @@ public func _bjs_sumIntArray() -> Int32 { @_cdecl("bjs_findFirstPoint") public func _bjs_findFirstPoint(_ matchingBytes: Int32, _ matchingLength: Int32) -> Void { #if arch(wasm32) - let ret = findFirstPoint(_: [Point].bridgeJSLiftParameter(), matching: String.bridgeJSLiftParameter(matchingBytes, matchingLength)) + let ret = findFirstPoint(_: [Point].bridgeJSStackPop(), matching: String.bridgeJSLiftParameter(matchingBytes, matchingLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -192,8 +192,8 @@ public func _bjs_findFirstPoint(_ matchingBytes: Int32, _ matchingLength: Int32) @_cdecl("bjs_processUnsafeRawPointerArray") public func _bjs_processUnsafeRawPointerArray() -> Void { #if arch(wasm32) - let ret = processUnsafeRawPointerArray(_: [UnsafeRawPointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processUnsafeRawPointerArray(_: [UnsafeRawPointer].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -203,8 +203,8 @@ public func _bjs_processUnsafeRawPointerArray() -> Void { @_cdecl("bjs_processUnsafeMutableRawPointerArray") public func _bjs_processUnsafeMutableRawPointerArray() -> Void { #if arch(wasm32) - let ret = processUnsafeMutableRawPointerArray(_: [UnsafeMutableRawPointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processUnsafeMutableRawPointerArray(_: [UnsafeMutableRawPointer].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -214,8 +214,8 @@ public func _bjs_processUnsafeMutableRawPointerArray() -> Void { @_cdecl("bjs_processOpaquePointerArray") public func _bjs_processOpaquePointerArray() -> Void { #if arch(wasm32) - let ret = processOpaquePointerArray(_: [OpaquePointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processOpaquePointerArray(_: [OpaquePointer].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -230,7 +230,7 @@ public func _bjs_processOptionalIntArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result @@ -238,7 +238,7 @@ public func _bjs_processOptionalIntArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } @@ -257,7 +257,7 @@ public func _bjs_processOptionalStringArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result @@ -265,7 +265,7 @@ public func _bjs_processOptionalStringArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } @@ -280,7 +280,7 @@ public func _bjs_processOptionalStringArray() -> Void { public func _bjs_processOptionalArray() -> Void { #if arch(wasm32) let ret = processOptionalArray(_: Optional<[Int]>.bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -295,13 +295,13 @@ public func _bjs_processOptionalPointArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() + __bjs_elem_ret.bridgeJSStackPush() } _swift_js_push_i32(Int32(ret.count)) #else @@ -318,7 +318,7 @@ public func _bjs_processOptionalDirectionArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result @@ -326,7 +326,7 @@ public func _bjs_processOptionalDirectionArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } @@ -345,7 +345,7 @@ public func _bjs_processOptionalStatusArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result @@ -353,7 +353,7 @@ public func _bjs_processOptionalStatusArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } @@ -367,8 +367,8 @@ public func _bjs_processOptionalStatusArray() -> Void { @_cdecl("bjs_processNestedIntArray") public func _bjs_processNestedIntArray() -> Void { #if arch(wasm32) - let ret = processNestedIntArray(_: [[Int]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processNestedIntArray(_: [[Int]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -378,8 +378,8 @@ public func _bjs_processNestedIntArray() -> Void { @_cdecl("bjs_processNestedStringArray") public func _bjs_processNestedStringArray() -> Void { #if arch(wasm32) - let ret = processNestedStringArray(_: [[String]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processNestedStringArray(_: [[String]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -389,8 +389,8 @@ public func _bjs_processNestedStringArray() -> Void { @_cdecl("bjs_processNestedPointArray") public func _bjs_processNestedPointArray() -> Void { #if arch(wasm32) - let ret = processNestedPointArray(_: [[Point]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processNestedPointArray(_: [[Point]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -400,8 +400,8 @@ public func _bjs_processNestedPointArray() -> Void { @_cdecl("bjs_processItemArray") public func _bjs_processItemArray() -> Void { #if arch(wasm32) - let ret = processItemArray(_: [Item].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processItemArray(_: [Item].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -411,8 +411,8 @@ public func _bjs_processItemArray() -> Void { @_cdecl("bjs_processNestedItemArray") public func _bjs_processNestedItemArray() -> Void { #if arch(wasm32) - let ret = processNestedItemArray(_: [[Item]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processNestedItemArray(_: [[Item]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -422,8 +422,8 @@ public func _bjs_processNestedItemArray() -> Void { @_cdecl("bjs_processJSObjectArray") public func _bjs_processJSObjectArray() -> Void { #if arch(wasm32) - let ret = processJSObjectArray(_: [JSObject].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processJSObjectArray(_: [JSObject].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -438,7 +438,7 @@ public func _bjs_processOptionalJSObjectArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result @@ -446,7 +446,7 @@ public func _bjs_processOptionalJSObjectArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } @@ -460,8 +460,8 @@ public func _bjs_processOptionalJSObjectArray() -> Void { @_cdecl("bjs_processNestedJSObjectArray") public func _bjs_processNestedJSObjectArray() -> Void { #if arch(wasm32) - let ret = processNestedJSObjectArray(_: [[JSObject]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = processNestedJSObjectArray(_: [[JSObject]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift index 16cae49e8..e8f367f1c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift @@ -38,17 +38,17 @@ extension Status: _BridgedSwiftCaseEnum { } extension Config: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Config { - let enabled = Bool.bridgeJSLiftParameter() - let value = Int.bridgeJSLiftParameter() - let name = String.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Config { + let enabled = Bool.bridgeJSStackPop() + let value = Int.bridgeJSStackPop() + let name = String.bridgeJSStackPop() return Config(name: name, value: value, enabled: enabled) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.name.bridgeJSLowerStackReturn() - self.value.bridgeJSLowerStackReturn() - self.enabled.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.name.bridgeJSStackPush() + self.value.bridgeJSStackPush() + self.enabled.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -56,12 +56,12 @@ extension Config: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Config())) } } @@ -85,13 +85,13 @@ fileprivate func _bjs_struct_lift_Config() -> Int32 { #endif extension MathOperations: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MathOperations { - let baseValue = Double.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> MathOperations { + let baseValue = Double.bridgeJSStackPop() return MathOperations(baseValue: baseValue) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.baseValue.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.baseValue.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -99,12 +99,12 @@ extension MathOperations: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_MathOperations())) } } @@ -318,8 +318,8 @@ public func _bjs_testOptionalStructWithValueDefault() -> Void { @_cdecl("bjs_testIntArrayDefault") public func _bjs_testIntArrayDefault() -> Void { #if arch(wasm32) - let ret = testIntArrayDefault(values: [Int].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = testIntArrayDefault(values: [Int].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -329,8 +329,8 @@ public func _bjs_testIntArrayDefault() -> Void { @_cdecl("bjs_testStringArrayDefault") public func _bjs_testStringArrayDefault() -> Void { #if arch(wasm32) - let ret = testStringArrayDefault(names: [String].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = testStringArrayDefault(names: [String].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -340,8 +340,8 @@ public func _bjs_testStringArrayDefault() -> Void { @_cdecl("bjs_testDoubleArrayDefault") public func _bjs_testDoubleArrayDefault() -> Void { #if arch(wasm32) - let ret = testDoubleArrayDefault(values: [Double].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = testDoubleArrayDefault(values: [Double].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -351,8 +351,8 @@ public func _bjs_testDoubleArrayDefault() -> Void { @_cdecl("bjs_testBoolArrayDefault") public func _bjs_testBoolArrayDefault() -> Void { #if arch(wasm32) - let ret = testBoolArrayDefault(flags: [Bool].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = testBoolArrayDefault(flags: [Bool].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -362,8 +362,8 @@ public func _bjs_testBoolArrayDefault() -> Void { @_cdecl("bjs_testEmptyArrayDefault") public func _bjs_testEmptyArrayDefault() -> Void { #if arch(wasm32) - let ret = testEmptyArrayDefault(items: [Int].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = testEmptyArrayDefault(items: [Int].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -373,7 +373,7 @@ public func _bjs_testEmptyArrayDefault() -> Void { @_cdecl("bjs_testMixedWithArrayDefault") public func _bjs_testMixedWithArrayDefault(_ nameBytes: Int32, _ nameLength: Int32, _ enabled: Int32) -> Void { #if arch(wasm32) - let ret = testMixedWithArrayDefault(name: String.bridgeJSLiftParameter(nameBytes, nameLength), values: [Int].bridgeJSLiftParameter(), enabled: Bool.bridgeJSLiftParameter(enabled)) + let ret = testMixedWithArrayDefault(name: String.bridgeJSLiftParameter(nameBytes, nameLength), values: [Int].bridgeJSStackPop(), enabled: Bool.bridgeJSLiftParameter(enabled)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift index fa19b481c..3d23c6bff 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift @@ -2,15 +2,15 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .failure(Int.bridgeJSLiftParameter()) + return .failure(Int.bridgeJSStackPop()) case 2: - return .flag(Bool.bridgeJSLiftParameter()) + return .flag(Bool.bridgeJSStackPop()) case 3: - return .rate(Float.bridgeJSLiftParameter()) + return .rate(Float.bridgeJSStackPop()) case 4: - return .precise(Double.bridgeJSLiftParameter()) + return .precise(Double.bridgeJSStackPop()) case 5: return .info default: @@ -21,19 +21,19 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .failure(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(1) case .flag(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(2) case .rate(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(3) case .precise(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(4) case .info: return Int32(5) @@ -45,15 +45,15 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .error(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) + return .error(String.bridgeJSStackPop(), Int.bridgeJSStackPop()) case 2: - return .status(Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) + return .status(Bool.bridgeJSStackPop(), Int.bridgeJSStackPop(), String.bridgeJSStackPop()) case 3: - return .coordinates(Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter()) + return .coordinates(Double.bridgeJSStackPop(), Double.bridgeJSStackPop(), Double.bridgeJSStackPop()) case 4: - return .comprehensive(Bool.bridgeJSLiftParameter(), Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), String.bridgeJSLiftParameter(), String.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) + return .comprehensive(Bool.bridgeJSStackPop(), Bool.bridgeJSStackPop(), Int.bridgeJSStackPop(), Int.bridgeJSStackPop(), Double.bridgeJSStackPop(), Double.bridgeJSStackPop(), String.bridgeJSStackPop(), String.bridgeJSStackPop(), String.bridgeJSStackPop()) case 5: return .info default: @@ -64,32 +64,32 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .error(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() return Int32(1) case .status(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() return Int32(2) case .coordinates(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() return Int32(3) case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - param3.bridgeJSLowerStackReturn() - param4.bridgeJSLowerStackReturn() - param5.bridgeJSLowerStackReturn() - param6.bridgeJSLowerStackReturn() - param7.bridgeJSLowerStackReturn() - param8.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() + param3.bridgeJSStackPush() + param4.bridgeJSStackPush() + param5.bridgeJSStackPush() + param6.bridgeJSStackPush() + param7.bridgeJSStackPush() + param8.bridgeJSStackPush() return Int32(4) case .info: return Int32(5) @@ -101,11 +101,11 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> Utilities.Result { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .failure(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) + return .failure(String.bridgeJSStackPop(), Int.bridgeJSStackPop()) case 2: - return .status(Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) + return .status(Bool.bridgeJSStackPop(), Int.bridgeJSStackPop(), String.bridgeJSStackPop()) default: fatalError("Unknown Utilities.Result case ID: \(caseId)") } @@ -114,16 +114,16 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .failure(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() return Int32(1) case .status(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() return Int32(2) } } @@ -133,9 +133,9 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> NetworkingResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .failure(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) + return .failure(String.bridgeJSStackPop(), Int.bridgeJSStackPop()) default: fatalError("Unknown NetworkingResult case ID: \(caseId)") } @@ -144,11 +144,11 @@ extension NetworkingResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .failure(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() return Int32(1) } } @@ -158,11 +158,11 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIOptionalResult { switch caseId { case 0: - return .success(Optional.bridgeJSLiftParameter()) + return .success(Optional.bridgeJSStackPop()) case 1: - return .failure(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) + return .failure(Optional.bridgeJSStackPop(), Optional.bridgeJSStackPop()) case 2: - return .status(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) + return .status(Optional.bridgeJSStackPop(), Optional.bridgeJSStackPop(), Optional.bridgeJSStackPop()) default: fatalError("Unknown APIOptionalResult case ID: \(caseId)") } @@ -173,36 +173,36 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { case .success(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(0) case .failure(let param0, let param1): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + __bjs_unwrapped_param1.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) return Int32(1) case .status(let param0, let param1, let param2): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + __bjs_unwrapped_param1.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { - __bjs_unwrapped_param2.bridgeJSLowerStackReturn() + __bjs_unwrapped_param2.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) return Int32(2) @@ -260,13 +260,13 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> TypedPayloadResult { switch caseId { case 0: - return .precision(Precision.bridgeJSLiftParameter()) + return .precision(Precision.bridgeJSStackPop()) case 1: - return .direction(CardinalDirection.bridgeJSLiftParameter()) + return .direction(CardinalDirection.bridgeJSStackPop()) case 2: - return .optPrecision(Optional.bridgeJSLiftParameter()) + return .optPrecision(Optional.bridgeJSStackPop()) case 3: - return .optDirection(Optional.bridgeJSLiftParameter()) + return .optDirection(Optional.bridgeJSStackPop()) case 4: return .empty default: @@ -277,22 +277,22 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .precision(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .direction(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(1) case .optPrecision(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(2) case .optDirection(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) @@ -306,15 +306,15 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> AllTypesResult { switch caseId { case 0: - return .structPayload(Point.bridgeJSLiftParameter()) + return .structPayload(Point.bridgeJSStackPop()) case 1: - return .classPayload(User.bridgeJSLiftParameter()) + return .classPayload(User.bridgeJSStackPop()) case 2: - return .jsObjectPayload(JSObject.bridgeJSLiftParameter()) + return .jsObjectPayload(JSObject.bridgeJSStackPop()) case 3: - return .nestedEnum(APIResult.bridgeJSLiftParameter()) + return .nestedEnum(APIResult.bridgeJSStackPop()) case 4: - return .arrayPayload([Int].bridgeJSLiftParameter()) + return .arrayPayload([Int].bridgeJSStackPop()) case 5: return .empty default: @@ -325,19 +325,19 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .structPayload(let param0): - param0.bridgeJSLowerReturn() + param0.bridgeJSStackPush() return Int32(0) case .classPayload(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(1) case .jsObjectPayload(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(2) case .nestedEnum(let param0): - param0.bridgeJSLowerReturn() + param0.bridgeJSStackPush() return Int32(3) case .arrayPayload(let param0): - param0.bridgeJSLowerReturn() + param0.bridgeJSStackPush() return Int32(4) case .empty: return Int32(5) @@ -349,15 +349,15 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> OptionalAllTypesResult { switch caseId { case 0: - return .optStruct(Optional.bridgeJSLiftParameter()) + return .optStruct(Optional.bridgeJSStackPop()) case 1: - return .optClass(Optional.bridgeJSLiftParameter()) + return .optClass(Optional.bridgeJSStackPop()) case 2: - return .optJSObject(Optional.bridgeJSLiftParameter()) + return .optJSObject(Optional.bridgeJSStackPop()) case 3: - return .optNestedEnum(Optional.bridgeJSLiftParameter()) + return .optNestedEnum(Optional.bridgeJSStackPop()) case 4: - return .optArray(Optional<[Int]>.bridgeJSLiftParameter()) + return .optArray(Optional<[Int]>.bridgeJSStackPop()) case 5: return .empty default: @@ -368,31 +368,31 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .optStruct(let param0): - param0.bridgeJSLowerReturn() + param0.bridgeJSStackPush() return Int32(0) case .optClass(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(1) case .optJSObject(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(2) case .optNestedEnum(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) case .optArray(let param0): - param0.bridgeJSLowerReturn() + param0.bridgeJSStackPush() return Int32(4) case .empty: return Int32(5) @@ -401,15 +401,15 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { } extension Point: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { - let y = Double.bridgeJSLiftParameter() - let x = Double.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Point { + let y = Double.bridgeJSStackPop() + let x = Double.bridgeJSStackPop() return Point(x: x, y: y) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.x.bridgeJSLowerStackReturn() - self.y.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.x.bridgeJSStackPush() + self.y.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -417,12 +417,12 @@ extension Point: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Point())) } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift index 5708e7de9..7fcc4d3c7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift @@ -1,15 +1,15 @@ extension FooContainer: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> FooContainer { - let optionalFoo = Optional.bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) } - let foo = Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter()) + @_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 bridgeJSLowerReturn() { - self.foo.jsObject.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.foo.jsObject.bridgeJSStackPush() let __bjs_isSome_optionalFoo = self.optionalFoo != nil if let __bjs_unwrapped_optionalFoo = self.optionalFoo { - __bjs_unwrapped_optionalFoo.jsObject.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalFoo.jsObject.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_optionalFoo ? 1 : 0) } @@ -19,12 +19,12 @@ extension FooContainer: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_FooContainer())) } } @@ -76,8 +76,8 @@ public func _bjs_makeFoo() -> Int32 { @_cdecl("bjs_processFooArray") public func _bjs_processFooArray() -> Void { #if arch(wasm32) - let ret = processFooArray(_: [JSObject].bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) }) - ret.map { $0.jsObject }.bridgeJSLowerReturn() + let ret = processFooArray(_: [JSObject].bridgeJSStackPop().map { Foo(unsafelyWrapping: $0) }) + ret.map { $0.jsObject }.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -92,7 +92,7 @@ public func _bjs_processOptionalFooArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) }) + __result.append(Optional.bridgeJSStackPop().map { Foo(unsafelyWrapping: $0) }) } __result.reverse() return __result @@ -100,7 +100,7 @@ public func _bjs_processOptionalFooArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.jsObject.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.jsObject.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift index 931605a50..41d04ebab 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift @@ -24,8 +24,8 @@ public func _bjs_roundTripOptionalJSValue(_ valueIsSome: Int32, _ valueKind: Int @_cdecl("bjs_roundTripJSValueArray") public func _bjs_roundTripJSValueArray() -> Void { #if arch(wasm32) - let ret = roundTripJSValueArray(_: [JSValue].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripJSValueArray(_: [JSValue].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -36,7 +36,7 @@ public func _bjs_roundTripJSValueArray() -> Void { public func _bjs_roundTripOptionalJSValueArray() -> Void { #if arch(wasm32) let ret = roundTripOptionalJSValueArray(_: Optional<[JSValue]>.bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift index 4051f5c9e..65ff9e67c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift @@ -366,9 +366,9 @@ extension Result: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> Result { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .failure(Int.bridgeJSLiftParameter()) + return .failure(Int.bridgeJSStackPop()) default: fatalError("Unknown Result case ID: \(caseId)") } @@ -377,10 +377,10 @@ extension Result: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .failure(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(1) } } @@ -393,8 +393,8 @@ extension Priority: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { @_cdecl("bjs_processDelegates") public func _bjs_processDelegates() -> Void { #if arch(wasm32) - let ret = processDelegates(_: [AnyMyViewControllerDelegate].bridgeJSLiftParameter()) - ret.map { $0 as! AnyMyViewControllerDelegate }.bridgeJSLowerReturn() + let ret = processDelegates(_: [AnyMyViewControllerDelegate].bridgeJSStackPop()) + ret.map { $0 as! AnyMyViewControllerDelegate }.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -611,7 +611,7 @@ fileprivate func _bjs_MyViewController_wrap(_ pointer: UnsafeMutableRawPointer) @_cdecl("bjs_DelegateManager_init") public func _bjs_DelegateManager_init() -> UnsafeMutableRawPointer { #if arch(wasm32) - let ret = DelegateManager(delegates: [AnyMyViewControllerDelegate].bridgeJSLiftParameter()) + let ret = DelegateManager(delegates: [AnyMyViewControllerDelegate].bridgeJSStackPop()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -633,7 +633,7 @@ public func _bjs_DelegateManager_notifyAll(_ _self: UnsafeMutableRawPointer) -> public func _bjs_DelegateManager_delegates_get(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) let ret = DelegateManager.bridgeJSLiftParameter(_self).delegates - ret.map { $0 as! AnyMyViewControllerDelegate }.bridgeJSLowerReturn() + ret.map { $0 as! AnyMyViewControllerDelegate }.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -643,7 +643,7 @@ public func _bjs_DelegateManager_delegates_get(_ _self: UnsafeMutableRawPointer) @_cdecl("bjs_DelegateManager_delegates_set") public func _bjs_DelegateManager_delegates_set(_ _self: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - DelegateManager.bridgeJSLiftParameter(_self).delegates = [AnyMyViewControllerDelegate].bridgeJSLiftParameter() + DelegateManager.bridgeJSLiftParameter(_self).delegates = [AnyMyViewControllerDelegate].bridgeJSStackPop() #else fatalError("Only available on WebAssembly") #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift index 6622ef3da..8ad34d283 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift @@ -48,9 +48,9 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .failure(Int.bridgeJSLiftParameter()) + return .failure(Int.bridgeJSStackPop()) default: fatalError("Unknown APIResult case ID: \(caseId)") } @@ -59,10 +59,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .failure(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(1) } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift index 6622ef3da..8ad34d283 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift @@ -48,9 +48,9 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .failure(Int.bridgeJSLiftParameter()) + return .failure(Int.bridgeJSStackPop()) default: fatalError("Unknown APIResult case ID: \(caseId)") } @@ -59,10 +59,10 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .failure(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(1) } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift index 57a963637..925ab5937 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift @@ -1191,15 +1191,15 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .failure(Int.bridgeJSLiftParameter()) + return .failure(Int.bridgeJSStackPop()) case 2: - return .flag(Bool.bridgeJSLiftParameter()) + return .flag(Bool.bridgeJSStackPop()) case 3: - return .rate(Float.bridgeJSLiftParameter()) + return .rate(Float.bridgeJSStackPop()) case 4: - return .precise(Double.bridgeJSLiftParameter()) + return .precise(Double.bridgeJSStackPop()) case 5: return .info default: @@ -1210,19 +1210,19 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .failure(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(1) case .flag(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(2) case .rate(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(3) case .precise(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(4) case .info: return Int32(5) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift index 2e551452d..fb78c3fd0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift @@ -2,27 +2,27 @@ extension Precision: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { } extension DataPoint: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> DataPoint { - let optFlag = Optional.bridgeJSLiftParameter() - let optCount = Optional.bridgeJSLiftParameter() - let label = String.bridgeJSLiftParameter() - let y = Double.bridgeJSLiftParameter() - let x = Double.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.x.bridgeJSLowerStackReturn() - self.y.bridgeJSLowerStackReturn() - self.label.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.x.bridgeJSStackPush() + self.y.bridgeJSStackPush() + self.label.bridgeJSStackPush() let __bjs_isSome_optCount = self.optCount != nil if let __bjs_unwrapped_optCount = self.optCount { - __bjs_unwrapped_optCount.bridgeJSLowerStackReturn() + __bjs_unwrapped_optCount.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_optCount ? 1 : 0) let __bjs_isSome_optFlag = self.optFlag != nil if let __bjs_unwrapped_optFlag = self.optFlag { - __bjs_unwrapped_optFlag.bridgeJSLowerStackReturn() + __bjs_unwrapped_optFlag.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_optFlag ? 1 : 0) } @@ -32,12 +32,12 @@ extension DataPoint: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_DataPoint())) } } @@ -72,19 +72,19 @@ public func _bjs_DataPoint_init(_ x: Float64, _ y: Float64, _ labelBytes: Int32, } extension Address: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Address { - let zipCode = Optional.bridgeJSLiftParameter() - let city = String.bridgeJSLiftParameter() - let street = String.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.street.bridgeJSLowerStackReturn() - self.city.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.street.bridgeJSStackPush() + self.city.bridgeJSStackPush() let __bjs_isSome_zipCode = self.zipCode != nil if let __bjs_unwrapped_zipCode = self.zipCode { - __bjs_unwrapped_zipCode.bridgeJSLowerStackReturn() + __bjs_unwrapped_zipCode.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_zipCode ? 1 : 0) } @@ -94,12 +94,12 @@ extension Address: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Address())) } } @@ -123,21 +123,21 @@ fileprivate func _bjs_struct_lift_Address() -> Int32 { #endif extension Person: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Person { - let email = Optional.bridgeJSLiftParameter() - let address = Address.bridgeJSLiftParameter() - let age = Int.bridgeJSLiftParameter() - let name = String.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Person { + let email = Optional.bridgeJSStackPop() + let address = Address.bridgeJSStackPop() + let age = Int.bridgeJSStackPop() + let name = String.bridgeJSStackPop() return Person(name: name, age: age, address: address, email: email) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.name.bridgeJSLowerStackReturn() - self.age.bridgeJSLowerStackReturn() - self.address.bridgeJSLowerReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.name.bridgeJSStackPush() + self.age.bridgeJSStackPush() + self.address.bridgeJSStackPush() let __bjs_isSome_email = self.email != nil if let __bjs_unwrapped_email = self.email { - __bjs_unwrapped_email.bridgeJSLowerStackReturn() + __bjs_unwrapped_email.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_email ? 1 : 0) } @@ -147,12 +147,12 @@ extension Person: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Person())) } } @@ -176,15 +176,15 @@ fileprivate func _bjs_struct_lift_Person() -> Int32 { #endif extension Session: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Session { - let owner = Greeter.bridgeJSLiftParameter() - let id = Int.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Session { + let owner = Greeter.bridgeJSStackPop() + let id = Int.bridgeJSStackPop() return Session(id: id, owner: owner) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.id.bridgeJSLowerStackReturn() - self.owner.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.id.bridgeJSStackPush() + self.owner.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -192,12 +192,12 @@ extension Session: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Session())) } } @@ -221,19 +221,19 @@ fileprivate func _bjs_struct_lift_Session() -> Int32 { #endif extension Measurement: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Measurement { - let optionalPrecision = Optional.bridgeJSLiftParameter() - let precision = Precision.bridgeJSLiftParameter() - let value = Double.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Measurement { + let optionalPrecision = Optional.bridgeJSStackPop() + let precision = Precision.bridgeJSStackPop() + let value = Double.bridgeJSStackPop() return Measurement(value: value, precision: precision, optionalPrecision: optionalPrecision) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.value.bridgeJSLowerStackReturn() - self.precision.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.value.bridgeJSStackPush() + self.precision.bridgeJSStackPush() let __bjs_isSome_optionalPrecision = self.optionalPrecision != nil if let __bjs_unwrapped_optionalPrecision = self.optionalPrecision { - __bjs_unwrapped_optionalPrecision.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalPrecision.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_optionalPrecision ? 1 : 0) } @@ -243,12 +243,12 @@ extension Measurement: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Measurement())) } } @@ -272,11 +272,11 @@ fileprivate func _bjs_struct_lift_Measurement() -> Int32 { #endif extension ConfigStruct: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ConfigStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> ConfigStruct { return ConfigStruct() } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { } init(unsafelyCopying jsObject: JSObject) { @@ -284,12 +284,12 @@ extension ConfigStruct: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ConfigStruct())) } } @@ -388,17 +388,17 @@ public func _bjs_ConfigStruct_static_update(_ timeout: Float64) -> Float64 { } extension Container: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Container { - let optionalObject = Optional.bridgeJSLiftParameter() - let object = JSObject.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Container { + let optionalObject = Optional.bridgeJSStackPop() + let object = JSObject.bridgeJSStackPop() return Container(object: object, optionalObject: optionalObject) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.object.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.object.bridgeJSStackPush() let __bjs_isSome_optionalObject = self.optionalObject != nil if let __bjs_unwrapped_optionalObject = self.optionalObject { - __bjs_unwrapped_optionalObject.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalObject.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_optionalObject ? 1 : 0) } @@ -408,12 +408,12 @@ extension Container: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Container())) } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift index 187f3369a..089912afe 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift @@ -1,13 +1,13 @@ extension Point: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { - let y = Int.bridgeJSLiftParameter() - let x = Int.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.x.bridgeJSLowerStackReturn() - self.y.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.x.bridgeJSStackPush() + self.y.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -15,12 +15,12 @@ extension Point: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Point())) } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift index 752cc6bc3..a4f372e9b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift @@ -1,19 +1,19 @@ extension PointerFields: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PointerFields { - let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter() - let ptr = UnsafePointer.bridgeJSLiftParameter() - let opaque = OpaquePointer.bridgeJSLiftParameter() - let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter() - let raw = UnsafeRawPointer.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.raw.bridgeJSLowerStackReturn() - self.mutRaw.bridgeJSLowerStackReturn() - self.opaque.bridgeJSLowerStackReturn() - self.ptr.bridgeJSLowerStackReturn() - self.mutPtr.bridgeJSLowerStackReturn() + @_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) { @@ -21,12 +21,12 @@ extension PointerFields: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PointerFields())) } } diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index edb41b9fa..d761e7576 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -102,10 +102,13 @@ internal func _swift_js_closure_unregister(_ id: Int32) { // // MARK: ExportSwift // @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ ...) -> <#Self#> { // } -// @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> <#Self#> { -// } // @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> <#WasmCoreType#> { // } +// // MARK: Stack ABI +// @_spi(BridgeJS) public static func bridgeJSStackPop() -> <#Self#> { +// } +// @_spi(BridgeJS) public consuming func bridgeJSStackPush() { +// } // } // ``` // @@ -115,10 +118,10 @@ internal func _swift_js_closure_unregister(_ id: Int32) { // - `func bridgeJSLowerParameter()`: lower the given higher-level parameter to a WebAssembly core type // - `func bridgeJSLiftReturn(_ ...) -> <#TargetType#>`: lift the given Wasm core type return value to a higher-level type // - `func bridgeJSLiftParameter(_ ...) -> <#TargetType#>`: lift the given Wasm core type parameters to a higher-level type -// - `func bridgeJSLiftParameter() -> <#TargetType#>`: no-arg overload that pops parameters from the param stack internally. -// Note: Pop order must match Swift's left-to-right argument evaluation order. // - `func bridgeJSLowerReturn() -> <#WasmCoreType#>`: lower the given higher-level return value to a Wasm core type -// - `func bridgeJSLowerStackReturn()`: push the value onto the return stack (used by _BridgedSwiftStackType for array elements) +// - `func bridgeJSStackPop() -> <#TargetType#>`: no-arg overload that pops parameters from the param stack internally. +// Note: Pop order must match Swift's left-to-right argument evaluation order. +// - `func bridgeJSStackPush()`: push the value onto the return stack (used by _BridgedSwiftStackType for array elements) // // Optional types (ExportSwift only) additionally define: // - `func bridgeJSLowerParameterWithRetain()`: lower optional heap object with ownership transfer for escaping closures @@ -139,8 +142,8 @@ public protocol _BridgedSwiftTypeLoweredIntoSingleWasmCoreType { public protocol _BridgedSwiftStackType { associatedtype StackLiftResult = Self - static func bridgeJSLiftParameter() -> StackLiftResult - consuming func bridgeJSLowerStackReturn() + static func bridgeJSStackPop() -> StackLiftResult + consuming func bridgeJSStackPush() } /// Types that bridge with the same (isSome, value) ABI as Optional. @@ -163,13 +166,13 @@ extension Bool: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftSta @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Bool { value == 1 } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Bool { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Bool { bridgeJSLiftParameter(_swift_js_pop_i32()) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { self ? 1 : 0 } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(self ? 1 : 0) } } @@ -186,13 +189,13 @@ extension Int: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftStac @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Int { Int(value) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Int { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Int { bridgeJSLiftParameter(_swift_js_pop_i32()) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { Int32(self) } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(Int32(self)) } } @@ -209,49 +212,49 @@ extension UInt: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftSta @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> UInt { UInt(UInt32(bitPattern: value)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UInt { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> UInt { bridgeJSLiftParameter(_swift_js_pop_i32()) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { Int32(bitPattern: UInt32(self)) } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(Int32(bitPattern: UInt32(self))) } } extension Int32: _BridgedSwiftStackType { - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Int32 { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Int32 { _swift_js_pop_i32() } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(self) } } extension Int64: _BridgedSwiftStackType { - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Int64 { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Int64 { Int64(_swift_js_pop_i32()) } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(Int32(self)) } } extension UInt32: _BridgedSwiftStackType { - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UInt32 { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> UInt32 { UInt32(bitPattern: _swift_js_pop_i32()) } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(Int32(bitPattern: self)) } } extension UInt64: _BridgedSwiftStackType { - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> UInt64 { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> UInt64 { UInt64(UInt32(bitPattern: _swift_js_pop_i32())) } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(Int32(bitPattern: UInt32(self))) } } @@ -268,13 +271,13 @@ extension Float: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftSt @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Float32) -> Float { Float(value) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Float { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Float { bridgeJSLiftParameter(_swift_js_pop_f32()) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Float32 { Float32(self) } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_f32(Float32(self)) } } @@ -291,13 +294,13 @@ extension Double: _BridgedSwiftTypeLoweredIntoSingleWasmCoreType, _BridgedSwiftS @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Float64) -> Double { Double(value) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Double { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Double { bridgeJSLiftParameter(_swift_js_pop_f64()) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Float64 { Float64(self) } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_f64(Float64(self)) } } @@ -335,7 +338,7 @@ extension String: _BridgedSwiftStackType { } } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> String { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> String { let bytes = _swift_js_pop_i32() let count = _swift_js_pop_i32() return bridgeJSLiftParameter(bytes, count) @@ -347,7 +350,7 @@ extension String: _BridgedSwiftStackType { } } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { self.withUTF8 { ptr in _swift_js_push_string(ptr.baseAddress, Int32(ptr.count)) } @@ -374,7 +377,7 @@ extension JSObject: _BridgedSwiftStackType { JSObject(id: JavaScriptObjectRef(bitPattern: id)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> JSObject { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> JSObject { bridgeJSLiftParameter(_swift_js_pop_i32()) } @@ -382,7 +385,7 @@ extension JSObject: _BridgedSwiftStackType { return _swift_js_retain(Int32(bitPattern: self.id)) } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(bridgeJSLowerReturn()) } } @@ -403,6 +406,21 @@ extension JSValue: _BridgedSwiftStackType { } } + @_spi(BridgeJS) public static func bridgeJSStackPop() -> JSValue { + let payload2 = _swift_js_pop_f64() + let payload1 = _swift_js_pop_i32() + let kind = _swift_js_pop_i32() + return bridgeJSLiftParameter(kind, payload1, payload2) + } + + @_spi(BridgeJS) public consuming func bridgeJSStackPush() -> Void { + let lowered = bridgeJSLowerParameter() + let retainedPayload1 = Self.bridgeJSRetainPayloadIfNeeded(kind: lowered.kind, payload1: lowered.payload1) + _swift_js_push_i32(lowered.kind) + _swift_js_push_i32(retainedPayload1) + _swift_js_push_f64(lowered.payload2) + } + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (kind: Int32, payload1: Int32, payload2: Double) { return withRawJSValue { raw in ( @@ -413,14 +431,6 @@ extension JSValue: _BridgedSwiftStackType { } } - @_spi(BridgeJS) public static func bridgeJSLiftReturn( - _ kind: Int32, - _ payload1: Int32, - _ payload2: Double - ) -> JSValue { - return bridgeJSLiftParameter(kind, payload1, payload2) - } - @_spi(BridgeJS) public static func bridgeJSLiftParameter( _ kind: Int32, _ payload1: Int32, @@ -439,27 +449,12 @@ extension JSValue: _BridgedSwiftStackType { return rawValue.jsValue } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> JSValue { - let payload2 = _swift_js_pop_f64() - let payload1 = _swift_js_pop_i32() - let kind = _swift_js_pop_i32() - return bridgeJSLiftParameter(kind, payload1, payload2) - } - @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> JSValue { - bridgeJSLiftParameter() + bridgeJSStackPop() } - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { - let lowered = bridgeJSLowerParameter() - let retainedPayload1 = Self.bridgeJSRetainPayloadIfNeeded(kind: lowered.kind, payload1: lowered.payload1) - _swift_js_push_i32(lowered.kind) - _swift_js_push_i32(retainedPayload1) - _swift_js_push_f64(lowered.payload2) - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { - bridgeJSLowerReturn() + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { + bridgeJSStackPush() } } @@ -485,14 +480,15 @@ extension _BridgedSwiftHeapObject { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ pointer: UnsafeMutableRawPointer) -> Self { Unmanaged.fromOpaque(pointer).takeUnretainedValue() } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - bridgeJSLiftParameter(_swift_js_pop_pointer()) - } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { // Perform a manual retain on the object, which will be balanced by a release called via FinalizationRegistry return Unmanaged.passRetained(self).toOpaque() } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + bridgeJSLiftParameter(_swift_js_pop_pointer()) + } + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_pointer(Unmanaged.passRetained(self).toOpaque()) } } @@ -514,11 +510,11 @@ extension _JSBridgedClass { @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ id: Int32) -> Self { Self(unsafelyWrapping: JSObject.bridgeJSLiftParameter(id)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { bridgeJSLiftParameter(_swift_js_pop_i32()) } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Int32 { jsObject.bridgeJSLowerReturn() } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(bridgeJSLowerReturn()) } } @@ -534,20 +530,24 @@ public protocol _BridgedSwiftProtocolWrapper: _BridgedSwiftStackType { extension _BridgedSwiftProtocolWrapper { // MARK: ExportSwift @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - bridgeJSLiftParameter(_swift_js_pop_i32()) + bridgeJSStackPop() } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Int32 { jsObject.bridgeJSLowerReturn() } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { - _swift_js_push_i32(jsObject.bridgeJSLowerReturn()) - } - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { jsObject.bridgeJSLowerParameter() } + + // MARK: Stack ABI + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + bridgeJSLiftParameter(_swift_js_pop_i32()) + } + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { + _swift_js_push_i32(jsObject.bridgeJSLowerReturn()) + } } /// A protocol that Swift enum types that do not have a payload can conform to. @@ -566,11 +566,11 @@ public protocol _BridgedSwiftRawValueEnum: _BridgedSwiftStackType, RawRepresenta where RawValue: _BridgedSwiftStackType, RawValue.StackLiftResult == RawValue {} extension _BridgedSwiftRawValueEnum { - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(rawValue: RawValue.bridgeJSLiftParameter())! + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + Self(rawValue: RawValue.bridgeJSStackPop())! } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { - rawValue.bridgeJSLowerStackReturn() + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { + rawValue.bridgeJSStackPush() } } @@ -588,11 +588,11 @@ public protocol _BridgedSwiftCaseEnum: _BridgedSwiftStackType { } extension _BridgedSwiftCaseEnum { - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { bridgeJSLiftParameter(_swift_js_pop_i32()) } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_i32(bridgeJSLowerReturn()) } } @@ -614,12 +614,12 @@ public protocol _BridgedSwiftAssociatedValueEnum: _BridgedSwiftTypeLoweredIntoVo } extension _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { bridgeJSStackPopPayload(_swift_js_pop_i32()) } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { - bridgeJSLowerReturn() + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { + _swift_js_push_i32(bridgeJSStackPushPayload()) } @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ caseId: Int32) -> Self { @@ -627,7 +627,7 @@ extension _BridgedSwiftAssociatedValueEnum { } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { - _swift_js_push_i32(bridgeJSStackPushPayload()) + bridgeJSStackPush() } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { @@ -644,8 +644,8 @@ extension _BridgedSwiftAssociatedValueEnum { /// The conformance is automatically synthesized by the BridgeJS code generator. public protocol _BridgedSwiftStruct: _BridgedSwiftTypeLoweredIntoVoidType, _BridgedSwiftGenericOptionalStackType { // MARK: ExportSwift - @_spi(BridgeJS) static func bridgeJSLiftParameter() -> Self - @_spi(BridgeJS) consuming func bridgeJSLowerReturn() -> Void + @_spi(BridgeJS) static func bridgeJSStackPop() -> Self + @_spi(BridgeJS) consuming func bridgeJSStackPush() -> Void /// Initializes a Swift struct by copying the fields from a bridged JS object. init(unsafelyCopying jsObject: JSObject) @@ -663,8 +663,11 @@ extension _BridgedSwiftStruct { return Self(unsafelyCopying: jsObject) } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { - bridgeJSLowerReturn() + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + bridgeJSStackPop() + } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { + bridgeJSStackPush() } } @@ -1055,13 +1058,13 @@ extension _BridgedSwiftUnsafePointerLike { @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ pointer: UnsafeMutableRawPointer) -> Self { bridgeJSFromUnsafeMutableRawPointer(pointer) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { bridgeJSLiftParameter(_swift_js_pop_pointer()) } @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> UnsafeMutableRawPointer { bridgeJSToUnsafeMutableRawPointer() } - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { _swift_js_push_pointer(bridgeJSToUnsafeMutableRawPointer()) } } @@ -1269,7 +1272,7 @@ extension Optional where Wrapped: _BridgedSwiftOptionalScalarBridge { return Wrapped.bridgeJSLiftParameter(wrappedValue) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Wrapped? { let isSome = _swift_js_pop_i32() let wrappedValue = Wrapped.bridgeJSPopOptionalScalarPayload() return bridgeJSLiftParameter(isSome, wrappedValue) @@ -1323,7 +1326,7 @@ extension Optional where Wrapped == String { _bridgeJSLiftParameter(isSome, (bytes, count), liftWrapped: { String.bridgeJSLiftParameter($0.0, $0.1) }) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> String? { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> String? { let isSome = _swift_js_pop_i32() let bytes = _swift_js_pop_i32() let count = _swift_js_pop_i32() @@ -1363,7 +1366,7 @@ extension Optional where Wrapped == JSObject { _bridgeJSLiftParameter(isSome, objectId, liftWrapped: JSObject.bridgeJSLiftParameter) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> JSObject? { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> JSObject? { let isSome = _swift_js_pop_i32() let objectId = _swift_js_pop_i32() return bridgeJSLiftParameter(isSome, objectId) @@ -1548,7 +1551,7 @@ extension Optional where Wrapped: _BridgedSwiftHeapObject { _bridgeJSLiftParameter(isSome, pointer, liftWrapped: Wrapped.bridgeJSLiftParameter) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Wrapped? { let isSome = _swift_js_pop_i32() let pointer = _swift_js_pop_pointer() return bridgeJSLiftParameter(isSome, pointer) @@ -1585,7 +1588,7 @@ extension Optional where Wrapped: _BridgedSwiftCaseEnum { _bridgeJSLiftParameter(isSome, wrappedValue, liftWrapped: Wrapped.bridgeJSLiftParameter) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Wrapped? { let isSome = _swift_js_pop_i32() let wrappedValue = _swift_js_pop_i32() return bridgeJSLiftParameter(isSome, wrappedValue) @@ -1638,13 +1641,6 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { - let isSome = _swift_js_pop_i32() - let bytes = _swift_js_pop_i32() - let count = _swift_js_pop_i32() - return bridgeJSLiftParameter(isSome, bytes, count) - } - @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Wrapped? { let length = _swift_js_get_optional_string() if length < 0 { @@ -1659,6 +1655,12 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres let optionalRawValue: String? = self?.rawValue optionalRawValue.bridgeJSLowerReturn() } + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Wrapped? { + let isSome = _swift_js_pop_i32() + let bytes = _swift_js_pop_i32() + let count = _swift_js_pop_i32() + return bridgeJSLiftParameter(isSome, bytes, count) + } } extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.RawValue == Int { @@ -1677,7 +1679,7 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Wrapped? { let isSome = _swift_js_pop_i32() let wrappedValue = _swift_js_pop_i32() return bridgeJSLiftParameter(isSome, wrappedValue) @@ -1707,7 +1709,7 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Wrapped? { let isSome = _swift_js_pop_i32() let wrappedValue = _swift_js_pop_i32() return bridgeJSLiftParameter(isSome, wrappedValue) @@ -1738,7 +1740,7 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Wrapped? { let isSome = _swift_js_pop_i32() let wrappedValue = _swift_js_pop_f32() return bridgeJSLiftParameter(isSome, wrappedValue) @@ -1779,7 +1781,7 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres return optionalRawValue.flatMap { Wrapped(rawValue: $0) } } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Wrapped? { let isSome = _swift_js_pop_i32() let wrappedValue = _swift_js_pop_f64() return bridgeJSLiftParameter(isSome, wrappedValue) @@ -1804,6 +1806,22 @@ extension Optional where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepres // MARK: Optional Associated Value Enum Support extension Optional where Wrapped: _BridgedSwiftAssociatedValueEnum { + private static func bridgeJSStackPopPayload(_ discriminant: Int32) -> Wrapped? { + if discriminant == -1 { + return nil + } else { + return Wrapped.bridgeJSStackPopPayload(discriminant) + } + } + private consuming func bridgeJSStackPushPayload() -> Int32 { + switch consume self { + case .none: + return -1 + case .some(let value): + return value.bridgeJSStackPushPayload() + } + } + // MARK: ExportSwift @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> (isSome: Int32, caseId: Int32) { @@ -1823,26 +1841,26 @@ extension Optional where Wrapped: _BridgedSwiftAssociatedValueEnum { } } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ caseId: Int32) -> Wrapped? { + return bridgeJSStackPopPayload(caseId) + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { + bridgeJSStackPush() + } + + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Wrapped? { let isSome = _swift_js_pop_i32() let caseId = _swift_js_pop_i32() return bridgeJSLiftParameter(isSome, caseId) } - @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ caseId: Int32) -> Wrapped? { - if caseId == -1 { - return nil - } else { - return Wrapped.bridgeJSLiftReturn(caseId) - } - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() -> Void { switch consume self { case .none: _swift_js_push_i32(-1) // Use -1 as sentinel for null case .some(let value): - value.bridgeJSLowerReturn() + value.bridgeJSStackPush() } } } @@ -1854,9 +1872,12 @@ extension Optional where Wrapped: _BridgedSwiftStruct { if isSome == 0 { return nil } else { - return Wrapped.bridgeJSLiftParameter() + return Wrapped.bridgeJSStackPop() } } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + return bridgeJSStackPop() + } } // MARK: - Generic Optional Stack Support @@ -1872,27 +1893,31 @@ extension Optional: _BridgedSwiftStackType where Wrapped: _BridgedSwiftGenericOptionalStackType { public typealias StackLiftResult = Wrapped? - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Wrapped? { let isSome = _swift_js_pop_i32() if isSome == 0 { return nil } - return Wrapped.bridgeJSLiftParameter() - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { - bridgeJSLowerReturn() + return Wrapped.bridgeJSStackPop() } - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { switch consume self { case .none: _swift_js_push_i32(0) case .some(let value): - value.bridgeJSLowerStackReturn() + value.bridgeJSStackPush() _swift_js_push_i32(1) } } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Wrapped? { + return bridgeJSStackPop() + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + bridgeJSStackPush() + } } // MARK: - _BridgedAsOptional (JSUndefinedOr) delegating to Optional @@ -1911,8 +1936,8 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftOptionalScalarBridge { Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + Self(optional: Optional.bridgeJSStackPop()) } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { @@ -1945,8 +1970,8 @@ extension _BridgedAsOptional where Wrapped == String { Self(optional: Optional.bridgeJSLiftParameter(isSome, bytes, count)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + Self(optional: Optional.bridgeJSStackPop()) } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { @@ -1967,8 +1992,8 @@ extension _BridgedAsOptional where Wrapped == JSObject { Self(optional: Optional.bridgeJSLiftParameter(isSome, objectId)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + Self(optional: Optional.bridgeJSStackPop()) } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { @@ -2005,8 +2030,8 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftHeapObject { Self(optional: Optional.bridgeJSLiftParameter(isSome, pointer)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + Self(optional: Optional.bridgeJSStackPop()) } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { @@ -2027,8 +2052,8 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftCaseEnum { Self(optional: Optional.bridgeJSLiftParameter(isSome, caseId)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + Self(optional: Optional.bridgeJSStackPop()) } @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ caseId: Int32) -> Self { @@ -2054,8 +2079,8 @@ where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.Ra Self(optional: Optional.bridgeJSLiftParameter(isSome, bytes, count)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + Self(optional: Optional.bridgeJSStackPop()) } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { @@ -2077,8 +2102,8 @@ where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.Ra Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + Self(optional: Optional.bridgeJSStackPop()) } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { @@ -2096,8 +2121,8 @@ where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.Ra Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + Self(optional: Optional.bridgeJSStackPop()) } @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { @@ -2115,8 +2140,8 @@ where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.Ra Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + Self(optional: Optional.bridgeJSStackPop()) } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { @@ -2138,8 +2163,8 @@ where Wrapped: _BridgedSwiftEnumNoPayload, Wrapped: RawRepresentable, Wrapped.Ra Self(optional: Optional.bridgeJSLiftParameter(isSome, wrappedValue)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + Self(optional: Optional.bridgeJSStackPop()) } @_spi(BridgeJS) public static func bridgeJSLiftReturnFromSideChannel() -> Self { @@ -2160,15 +2185,15 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftAssociatedValueEnum { Self(optional: Optional.bridgeJSLiftParameter(isSome, caseId)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + Self(optional: Optional.bridgeJSStackPop()) } @_spi(BridgeJS) public static func bridgeJSLiftReturn(_ caseId: Int32) -> Self { Self(optional: Optional.bridgeJSLiftReturn(caseId)) } - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { asOptional.bridgeJSLowerReturn() } } @@ -2178,13 +2203,17 @@ extension _BridgedAsOptional where Wrapped: _BridgedSwiftStruct { Self(optional: Optional.bridgeJSLiftParameter(isSome)) } - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> Self { - Self(optional: Optional.bridgeJSLiftParameter()) - } - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() -> Void { asOptional.bridgeJSLowerReturn() } + + // MARK: Stack ABI + @_spi(BridgeJS) public static func bridgeJSStackPop() -> Self { + Self(optional: Optional.bridgeJSStackPop()) + } + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { + asOptional.bridgeJSStackPush() + } } // MARK: - Array Support @@ -2194,35 +2223,37 @@ where Element: _BridgedSwiftStackType, Element.StackLiftResult == Element {} extension Array: _BridgedSwiftStackType where Element: _BridgedSwiftStackType, Element.StackLiftResult == Element { public typealias StackLiftResult = [Element] - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> [Element] { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> [Element] { let count = Int(_swift_js_pop_i32()) var result: [Element] = [] result.reserveCapacity(count) for _ in 0.. [Element] { - bridgeJSLiftParameter() - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { - bridgeJSLowerReturn() - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { let array = self for elem in array { - elem.bridgeJSLowerStackReturn() + elem.bridgeJSStackPush() } _swift_js_push_i32(Int32(array.count)) } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> [Element] { + bridgeJSStackPop() + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { + self.bridgeJSStackPush() + } @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() { - bridgeJSLowerReturn() + self.bridgeJSStackPush() + } + @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> [Element] { + bridgeJSStackPop() } } @@ -2250,66 +2281,70 @@ extension Dictionary: _BridgedSwiftTypeLoweredIntoVoidType, _BridgedSwiftDiction where Key == String, Value: _BridgedSwiftStackType, Value.StackLiftResult == Value { public typealias DictionaryValue = Value - @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> [String: Value] { + @_spi(BridgeJS) public static func bridgeJSStackPop() -> [String: Value] { let count = Int(_swift_js_pop_i32()) var result: [String: Value] = [:] result.reserveCapacity(count) for _ in 0.. [String: Value] { - bridgeJSLiftParameter() - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerStackReturn() { - bridgeJSLowerReturn() - } - - @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { + @_spi(BridgeJS) public consuming func bridgeJSStackPush() { let count = Int32(self.count) for (key, value) in self { - key.bridgeJSLowerStackReturn() - value.bridgeJSLowerStackReturn() + key.bridgeJSStackPush() + value.bridgeJSStackPush() } _swift_js_push_i32(count) } + @_spi(BridgeJS) public static func bridgeJSLiftParameter() -> [String: Value] { + bridgeJSStackPop() + } + @_spi(BridgeJS) public consuming func bridgeJSLowerReturn() { + self.bridgeJSStackPush() + } @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() { - bridgeJSLowerReturn() + self.bridgeJSStackPush() + } + @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> [String: Value] { + bridgeJSStackPop() } } extension Optional where Wrapped: _BridgedSwiftDictionaryStackType { typealias DictionaryValue = Wrapped.DictionaryValue - @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + private consuming func bridgeJSStackPushPayload() -> Int32 { switch consume self { case .none: return 0 case .some(let dict): - dict.bridgeJSLowerReturn() + dict.bridgeJSStackPush() return 1 } } - - @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32) -> [String: Wrapped.DictionaryValue]? { + private static func bridgeJSStackPopPayload(_ isSome: Int32) -> [String: Wrapped.DictionaryValue]? { if isSome == 0 { return nil } - return Dictionary.bridgeJSLiftParameter() + return Dictionary.bridgeJSStackPop() + } + + @_spi(BridgeJS) public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSStackPushPayload() + } + + @_spi(BridgeJS) public static func bridgeJSLiftParameter(_ isSome: Int32) -> [String: Wrapped.DictionaryValue]? { + return bridgeJSStackPopPayload(isSome) } @_spi(BridgeJS) public static func bridgeJSLiftReturn() -> [String: Wrapped.DictionaryValue]? { - let isSome = _swift_js_pop_i32() - if isSome == 0 { - return nil - } - return Dictionary.bridgeJSLiftParameter() + return bridgeJSStackPopPayload(_swift_js_pop_i32()) } } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index e24775f43..91dd822c1 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2029,15 +2029,15 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .failure(Int.bridgeJSLiftParameter()) + return .failure(Int.bridgeJSStackPop()) case 2: - return .flag(Bool.bridgeJSLiftParameter()) + return .flag(Bool.bridgeJSStackPop()) case 3: - return .rate(Float.bridgeJSLiftParameter()) + return .rate(Float.bridgeJSStackPop()) case 4: - return .precise(Double.bridgeJSLiftParameter()) + return .precise(Double.bridgeJSStackPop()) case 5: return .info default: @@ -2048,19 +2048,19 @@ extension APIResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .failure(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(1) case .flag(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(2) case .rate(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(3) case .precise(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(4) case .info: return Int32(5) @@ -2072,17 +2072,17 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> ComplexResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .error(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) + return .error(String.bridgeJSStackPop(), Int.bridgeJSStackPop()) case 2: - return .location(Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) + return .location(Double.bridgeJSStackPop(), Double.bridgeJSStackPop(), String.bridgeJSStackPop()) case 3: - return .status(Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) + return .status(Bool.bridgeJSStackPop(), Int.bridgeJSStackPop(), String.bridgeJSStackPop()) case 4: - return .coordinates(Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter()) + return .coordinates(Double.bridgeJSStackPop(), Double.bridgeJSStackPop(), Double.bridgeJSStackPop()) case 5: - return .comprehensive(Bool.bridgeJSLiftParameter(), Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), Double.bridgeJSLiftParameter(), String.bridgeJSLiftParameter(), String.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) + 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: @@ -2093,37 +2093,37 @@ extension ComplexResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .error(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() return Int32(1) case .location(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() return Int32(2) case .status(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() return Int32(3) case .coordinates(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() + 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.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() - param3.bridgeJSLowerStackReturn() - param4.bridgeJSLowerStackReturn() - param5.bridgeJSLowerStackReturn() - param6.bridgeJSLowerStackReturn() - param7.bridgeJSLowerStackReturn() - param8.bridgeJSLowerStackReturn() + 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) @@ -2135,11 +2135,11 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> Utilities.Result { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .failure(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) + return .failure(String.bridgeJSStackPop(), Int.bridgeJSStackPop()) case 2: - return .status(Bool.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter(), String.bridgeJSLiftParameter()) + return .status(Bool.bridgeJSStackPop(), Int.bridgeJSStackPop(), String.bridgeJSStackPop()) default: fatalError("Unknown Utilities.Result case ID: \(caseId)") } @@ -2148,16 +2148,16 @@ extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .failure(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() return Int32(1) case .status(let param0, let param1, let param2): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() - param2.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() return Int32(2) } } @@ -2167,9 +2167,9 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> API.NetworkingResult { switch caseId { case 0: - return .success(String.bridgeJSLiftParameter()) + return .success(String.bridgeJSStackPop()) case 1: - return .failure(String.bridgeJSLiftParameter(), Int.bridgeJSLiftParameter()) + return .failure(String.bridgeJSStackPop(), Int.bridgeJSStackPop()) default: fatalError("Unknown API.NetworkingResult case ID: \(caseId)") } @@ -2178,11 +2178,11 @@ extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .success(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .failure(let param0, let param1): - param0.bridgeJSLowerStackReturn() - param1.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() return Int32(1) } } @@ -2192,17 +2192,17 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> AllTypesResult { switch caseId { case 0: - return .structPayload(Address.bridgeJSLiftParameter()) + return .structPayload(Address.bridgeJSStackPop()) case 1: - return .classPayload(Greeter.bridgeJSLiftParameter()) + return .classPayload(Greeter.bridgeJSStackPop()) case 2: - return .jsObjectPayload(JSObject.bridgeJSLiftParameter()) + return .jsObjectPayload(JSObject.bridgeJSStackPop()) case 3: - return .nestedEnum(APIResult.bridgeJSLiftParameter()) + return .nestedEnum(APIResult.bridgeJSStackPop()) case 4: - return .arrayPayload([Int].bridgeJSLiftParameter()) + return .arrayPayload([Int].bridgeJSStackPop()) case 5: - return .jsClassPayload(Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter())) + return .jsClassPayload(Foo(unsafelyWrapping: JSObject.bridgeJSStackPop())) case 6: return .empty default: @@ -2213,22 +2213,22 @@ extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .structPayload(let param0): - param0.bridgeJSLowerReturn() + param0.bridgeJSStackPush() return Int32(0) case .classPayload(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(1) case .jsObjectPayload(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(2) case .nestedEnum(let param0): - param0.bridgeJSLowerReturn() + param0.bridgeJSStackPush() return Int32(3) case .arrayPayload(let param0): - param0.bridgeJSLowerReturn() + param0.bridgeJSStackPush() return Int32(4) case .jsClassPayload(let param0): - param0.jsObject.bridgeJSLowerStackReturn() + param0.jsObject.bridgeJSStackPush() return Int32(5) case .empty: return Int32(6) @@ -2240,13 +2240,13 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> TypedPayloadResult { switch caseId { case 0: - return .precision(Precision.bridgeJSLiftParameter()) + return .precision(Precision.bridgeJSStackPop()) case 1: - return .direction(Direction.bridgeJSLiftParameter()) + return .direction(Direction.bridgeJSStackPop()) case 2: - return .optPrecision(Optional.bridgeJSLiftParameter()) + return .optPrecision(Optional.bridgeJSStackPop()) case 3: - return .optDirection(Optional.bridgeJSLiftParameter()) + return .optDirection(Optional.bridgeJSStackPop()) case 4: return .empty default: @@ -2257,22 +2257,22 @@ extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .precision(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(0) case .direction(let param0): - param0.bridgeJSLowerStackReturn() + param0.bridgeJSStackPush() return Int32(1) case .optPrecision(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(2) case .optDirection(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) @@ -2591,17 +2591,17 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> OptionalAllTypesResult { switch caseId { case 0: - return .optStruct(Optional
        .bridgeJSLiftParameter()) + return .optStruct(Optional
        .bridgeJSStackPop()) case 1: - return .optClass(Optional.bridgeJSLiftParameter()) + return .optClass(Optional.bridgeJSStackPop()) case 2: - return .optJSObject(Optional.bridgeJSLiftParameter()) + return .optJSObject(Optional.bridgeJSStackPop()) case 3: - return .optNestedEnum(Optional.bridgeJSLiftParameter()) + return .optNestedEnum(Optional.bridgeJSStackPop()) case 4: - return .optArray(Optional<[Int]>.bridgeJSLiftParameter()) + return .optArray(Optional<[Int]>.bridgeJSStackPop()) case 5: - return .optJsClass(Optional.bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) }) + return .optJsClass(Optional.bridgeJSStackPop().map { Foo(unsafelyWrapping: $0) }) case 6: return .empty default: @@ -2612,36 +2612,36 @@ extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { switch self { case .optStruct(let param0): - param0.bridgeJSLowerReturn() + param0.bridgeJSStackPush() return Int32(0) case .optClass(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(1) case .optJSObject(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(2) case .optNestedEnum(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(3) case .optArray(let param0): - param0.bridgeJSLowerReturn() + param0.bridgeJSStackPush() return Int32(4) case .optJsClass(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.jsObject.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.jsObject.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(5) @@ -2655,11 +2655,11 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIOptionalResult { switch caseId { case 0: - return .success(Optional.bridgeJSLiftParameter()) + return .success(Optional.bridgeJSStackPop()) case 1: - return .failure(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) + return .failure(Optional.bridgeJSStackPop(), Optional.bridgeJSStackPop()) case 2: - return .status(Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter(), Optional.bridgeJSLiftParameter()) + return .status(Optional.bridgeJSStackPop(), Optional.bridgeJSStackPop(), Optional.bridgeJSStackPop()) default: fatalError("Unknown APIOptionalResult case ID: \(caseId)") } @@ -2670,36 +2670,36 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { case .success(let param0): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) return Int32(0) case .failure(let param0, let param1): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + __bjs_unwrapped_param1.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) return Int32(1) case .status(let param0, let param1, let param2): let __bjs_isSome_param0 = param0 != nil if let __bjs_unwrapped_param0 = param0 { - __bjs_unwrapped_param0.bridgeJSLowerStackReturn() + __bjs_unwrapped_param0.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param0 ? 1 : 0) let __bjs_isSome_param1 = param1 != nil if let __bjs_unwrapped_param1 = param1 { - __bjs_unwrapped_param1.bridgeJSLowerStackReturn() + __bjs_unwrapped_param1.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param1 ? 1 : 0) let __bjs_isSome_param2 = param2 != nil if let __bjs_unwrapped_param2 = param2 { - __bjs_unwrapped_param2.bridgeJSLowerStackReturn() + __bjs_unwrapped_param2.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_param2 ? 1 : 0) return Int32(2) @@ -2708,15 +2708,15 @@ extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { } extension Point: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Point { - let y = Int.bridgeJSLiftParameter() - let x = Int.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.x.bridgeJSLowerStackReturn() - self.y.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.x.bridgeJSStackPush() + self.y.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -2724,12 +2724,12 @@ extension Point: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Point())) } } @@ -2753,21 +2753,21 @@ fileprivate func _bjs_struct_lift_Point() -> Int32 { #endif extension PointerFields: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PointerFields { - let mutPtr = UnsafeMutablePointer.bridgeJSLiftParameter() - let ptr = UnsafePointer.bridgeJSLiftParameter() - let opaque = OpaquePointer.bridgeJSLiftParameter() - let mutRaw = UnsafeMutableRawPointer.bridgeJSLiftParameter() - let raw = UnsafeRawPointer.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.raw.bridgeJSLowerStackReturn() - self.mutRaw.bridgeJSLowerStackReturn() - self.opaque.bridgeJSLowerStackReturn() - self.ptr.bridgeJSLowerStackReturn() - self.mutPtr.bridgeJSLowerStackReturn() + @_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) { @@ -2775,12 +2775,12 @@ extension PointerFields: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PointerFields())) } } @@ -2815,27 +2815,27 @@ public func _bjs_PointerFields_init(_ raw: UnsafeMutableRawPointer, _ mutRaw: Un } extension DataPoint: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> DataPoint { - let optFlag = Optional.bridgeJSLiftParameter() - let optCount = Optional.bridgeJSLiftParameter() - let label = String.bridgeJSLiftParameter() - let y = Double.bridgeJSLiftParameter() - let x = Double.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.x.bridgeJSLowerStackReturn() - self.y.bridgeJSLowerStackReturn() - self.label.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.x.bridgeJSStackPush() + self.y.bridgeJSStackPush() + self.label.bridgeJSStackPush() let __bjs_isSome_optCount = self.optCount != nil if let __bjs_unwrapped_optCount = self.optCount { - __bjs_unwrapped_optCount.bridgeJSLowerStackReturn() + __bjs_unwrapped_optCount.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_optCount ? 1 : 0) let __bjs_isSome_optFlag = self.optFlag != nil if let __bjs_unwrapped_optFlag = self.optFlag { - __bjs_unwrapped_optFlag.bridgeJSLowerStackReturn() + __bjs_unwrapped_optFlag.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_optFlag ? 1 : 0) } @@ -2845,12 +2845,12 @@ extension DataPoint: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_DataPoint())) } } @@ -2885,15 +2885,15 @@ public func _bjs_DataPoint_init(_ x: Float64, _ y: Float64, _ labelBytes: Int32, } extension PublicPoint: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> PublicPoint { - let y = Int.bridgeJSLiftParameter() - let x = Int.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.x.bridgeJSLowerStackReturn() - self.y.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.x.bridgeJSStackPush() + self.y.bridgeJSStackPush() } public init(unsafelyCopying jsObject: JSObject) { @@ -2901,12 +2901,12 @@ extension PublicPoint: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } public func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PublicPoint())) } } @@ -2941,19 +2941,19 @@ public func _bjs_PublicPoint_init(_ x: Int32, _ y: Int32) -> Void { } extension Address: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Address { - let zipCode = Optional.bridgeJSLiftParameter() - let city = String.bridgeJSLiftParameter() - let street = String.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.street.bridgeJSLowerStackReturn() - self.city.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.street.bridgeJSStackPush() + self.city.bridgeJSStackPush() let __bjs_isSome_zipCode = self.zipCode != nil if let __bjs_unwrapped_zipCode = self.zipCode { - __bjs_unwrapped_zipCode.bridgeJSLowerStackReturn() + __bjs_unwrapped_zipCode.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_zipCode ? 1 : 0) } @@ -2963,12 +2963,12 @@ extension Address: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Address())) } } @@ -2992,25 +2992,25 @@ fileprivate func _bjs_struct_lift_Address() -> Int32 { #endif extension Contact: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Contact { - let secondaryAddress = Optional
        .bridgeJSLiftParameter() - let email = Optional.bridgeJSLiftParameter() - let address = Address.bridgeJSLiftParameter() - let age = Int.bridgeJSLiftParameter() - let name = String.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.name.bridgeJSLowerStackReturn() - self.age.bridgeJSLowerStackReturn() - self.address.bridgeJSLowerReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.name.bridgeJSStackPush() + self.age.bridgeJSStackPush() + self.address.bridgeJSStackPush() let __bjs_isSome_email = self.email != nil if let __bjs_unwrapped_email = self.email { - __bjs_unwrapped_email.bridgeJSLowerStackReturn() + __bjs_unwrapped_email.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_email ? 1 : 0) - self.secondaryAddress.bridgeJSLowerReturn() + self.secondaryAddress.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -3018,12 +3018,12 @@ extension Contact: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Contact())) } } @@ -3047,27 +3047,27 @@ fileprivate func _bjs_struct_lift_Contact() -> Int32 { #endif extension Config: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> Config { - let status = Status.bridgeJSLiftParameter() - let direction = Optional.bridgeJSLiftParameter() - let theme = Optional.bridgeJSLiftParameter() - let name = String.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.name.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.name.bridgeJSStackPush() let __bjs_isSome_theme = self.theme != nil if let __bjs_unwrapped_theme = self.theme { - __bjs_unwrapped_theme.bridgeJSLowerStackReturn() + __bjs_unwrapped_theme.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_theme ? 1 : 0) let __bjs_isSome_direction = self.direction != nil if let __bjs_unwrapped_direction = self.direction { - __bjs_unwrapped_direction.bridgeJSLowerStackReturn() + __bjs_unwrapped_direction.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_direction ? 1 : 0) - self.status.bridgeJSLowerStackReturn() + self.status.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -3075,12 +3075,12 @@ extension Config: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Config())) } } @@ -3104,17 +3104,17 @@ fileprivate func _bjs_struct_lift_Config() -> Int32 { #endif extension SessionData: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> SessionData { - let owner = Optional.bridgeJSLiftParameter() - let id = Int.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.id.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.id.bridgeJSStackPush() let __bjs_isSome_owner = self.owner != nil if let __bjs_unwrapped_owner = self.owner { - __bjs_unwrapped_owner.bridgeJSLowerStackReturn() + __bjs_unwrapped_owner.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_owner ? 1 : 0) } @@ -3124,12 +3124,12 @@ extension SessionData: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_SessionData())) } } @@ -3153,25 +3153,25 @@ fileprivate func _bjs_struct_lift_SessionData() -> Int32 { #endif extension ValidationReport: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ValidationReport { - let outcome = Optional.bridgeJSLiftParameter() - let status = Optional.bridgeJSLiftParameter() - let result = APIResult.bridgeJSLiftParameter() - let id = Int.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.id.bridgeJSLowerStackReturn() - self.result.bridgeJSLowerReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.id.bridgeJSStackPush() + self.result.bridgeJSStackPush() let __bjs_isSome_status = self.status != nil if let __bjs_unwrapped_status = self.status { - __bjs_unwrapped_status.bridgeJSLowerStackReturn() + __bjs_unwrapped_status.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_status ? 1 : 0) let __bjs_isSome_outcome = self.outcome != nil if let __bjs_unwrapped_outcome = self.outcome { - __bjs_unwrapped_outcome.bridgeJSLowerStackReturn() + __bjs_unwrapped_outcome.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_outcome ? 1 : 0) } @@ -3181,12 +3181,12 @@ extension ValidationReport: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ValidationReport())) } } @@ -3210,39 +3210,39 @@ fileprivate func _bjs_struct_lift_ValidationReport() -> Int32 { #endif extension AdvancedConfig: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> AdvancedConfig { - let overrideDefaults = Optional.bridgeJSLiftParameter() - let defaults = ConfigStruct.bridgeJSLiftParameter() - let location = Optional.bridgeJSLiftParameter() - let metadata = Optional.bridgeJSLiftParameter() - let result = Optional.bridgeJSLiftParameter() - let status = Status.bridgeJSLiftParameter() - let theme = Theme.bridgeJSLiftParameter() - let enabled = Bool.bridgeJSLiftParameter() - let title = String.bridgeJSLiftParameter() - let id = Int.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.id.bridgeJSLowerStackReturn() - self.title.bridgeJSLowerStackReturn() - self.enabled.bridgeJSLowerStackReturn() - self.theme.bridgeJSLowerStackReturn() - self.status.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.id.bridgeJSStackPush() + self.title.bridgeJSStackPush() + self.enabled.bridgeJSStackPush() + self.theme.bridgeJSStackPush() + self.status.bridgeJSStackPush() let __bjs_isSome_result = self.result != nil if let __bjs_unwrapped_result = self.result { - __bjs_unwrapped_result.bridgeJSLowerStackReturn() + __bjs_unwrapped_result.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_result ? 1 : 0) let __bjs_isSome_metadata = self.metadata != nil if let __bjs_unwrapped_metadata = self.metadata { - __bjs_unwrapped_metadata.bridgeJSLowerStackReturn() + __bjs_unwrapped_metadata.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_metadata ? 1 : 0) - self.location.bridgeJSLowerReturn() - self.defaults.bridgeJSLowerReturn() - self.overrideDefaults.bridgeJSLowerReturn() + self.location.bridgeJSStackPush() + self.defaults.bridgeJSStackPush() + self.overrideDefaults.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -3250,12 +3250,12 @@ extension AdvancedConfig: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_AdvancedConfig())) } } @@ -3279,25 +3279,25 @@ fileprivate func _bjs_struct_lift_AdvancedConfig() -> Int32 { #endif extension MeasurementConfig: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MeasurementConfig { - let optionalRatio = Optional.bridgeJSLiftParameter() - let optionalPrecision = Optional.bridgeJSLiftParameter() - let ratio = Ratio.bridgeJSLiftParameter() - let precision = Precision.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.precision.bridgeJSLowerStackReturn() - self.ratio.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.precision.bridgeJSStackPush() + self.ratio.bridgeJSStackPush() let __bjs_isSome_optionalPrecision = self.optionalPrecision != nil if let __bjs_unwrapped_optionalPrecision = self.optionalPrecision { - __bjs_unwrapped_optionalPrecision.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalPrecision.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_optionalPrecision ? 1 : 0) let __bjs_isSome_optionalRatio = self.optionalRatio != nil if let __bjs_unwrapped_optionalRatio = self.optionalRatio { - __bjs_unwrapped_optionalRatio.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalRatio.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_optionalRatio ? 1 : 0) } @@ -3307,12 +3307,12 @@ extension MeasurementConfig: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_MeasurementConfig())) } } @@ -3336,13 +3336,13 @@ fileprivate func _bjs_struct_lift_MeasurementConfig() -> Int32 { #endif extension MathOperations: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> MathOperations { - let baseValue = Double.bridgeJSLiftParameter() + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> MathOperations { + let baseValue = Double.bridgeJSStackPop() return MathOperations(baseValue: baseValue) } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() { - self.baseValue.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.baseValue.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -3350,12 +3350,12 @@ extension MathOperations: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_MathOperations())) } } @@ -3423,17 +3423,17 @@ public func _bjs_MathOperations_static_subtract(_ a: Float64, _ b: Float64) -> F } extension CopyableCart: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> CopyableCart { - let note = Optional.bridgeJSLiftParameter() - let x = Int.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.x.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.x.bridgeJSStackPush() let __bjs_isSome_note = self.note != nil if let __bjs_unwrapped_note = self.note { - __bjs_unwrapped_note.bridgeJSLowerStackReturn() + __bjs_unwrapped_note.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_note ? 1 : 0) } @@ -3443,12 +3443,12 @@ extension CopyableCart: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_CopyableCart())) } } @@ -3483,15 +3483,15 @@ public func _bjs_CopyableCart_static_fromJSObject(_ object: Int32) -> Void { } extension CopyableCartItem: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> CopyableCartItem { - let quantity = Int.bridgeJSLiftParameter() - let sku = String.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.sku.bridgeJSLowerStackReturn() - self.quantity.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.sku.bridgeJSStackPush() + self.quantity.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -3499,12 +3499,12 @@ extension CopyableCartItem: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_CopyableCartItem())) } } @@ -3528,17 +3528,17 @@ fileprivate func _bjs_struct_lift_CopyableCartItem() -> Int32 { #endif extension CopyableNestedCart: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> CopyableNestedCart { - let shippingAddress = Optional
        .bridgeJSLiftParameter() - let item = CopyableCartItem.bridgeJSLiftParameter() - let id = Int.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.id.bridgeJSLowerStackReturn() - self.item.bridgeJSLowerReturn() - self.shippingAddress.bridgeJSLowerReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.id.bridgeJSStackPush() + self.item.bridgeJSStackPush() + self.shippingAddress.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -3546,12 +3546,12 @@ extension CopyableNestedCart: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_CopyableNestedCart())) } } @@ -3586,15 +3586,15 @@ public func _bjs_CopyableNestedCart_static_fromJSObject(_ object: Int32) -> Void } extension ConfigStruct: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ConfigStruct { - let value = Int.bridgeJSLiftParameter() - let name = String.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.name.bridgeJSLowerStackReturn() - self.value.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.name.bridgeJSStackPush() + self.value.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -3602,12 +3602,12 @@ extension ConfigStruct: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ConfigStruct())) } } @@ -3695,17 +3695,17 @@ public func _bjs_ConfigStruct_static_computedSetting_get() -> Void { } extension JSObjectContainer: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> JSObjectContainer { - let optionalObject = Optional.bridgeJSLiftParameter() - let object = JSObject.bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.object.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.object.bridgeJSStackPush() let __bjs_isSome_optionalObject = self.optionalObject != nil if let __bjs_unwrapped_optionalObject = self.optionalObject { - __bjs_unwrapped_optionalObject.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalObject.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_optionalObject ? 1 : 0) } @@ -3715,12 +3715,12 @@ extension JSObjectContainer: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_JSObjectContainer())) } } @@ -3744,17 +3744,17 @@ fileprivate func _bjs_struct_lift_JSObjectContainer() -> Int32 { #endif extension FooContainer: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> FooContainer { - let optionalFoo = Optional.bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) } - let foo = Foo(unsafelyWrapping: JSObject.bridgeJSLiftParameter()) + @_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 bridgeJSLowerReturn() { - self.foo.jsObject.bridgeJSLowerStackReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.foo.jsObject.bridgeJSStackPush() let __bjs_isSome_optionalFoo = self.optionalFoo != nil if let __bjs_unwrapped_optionalFoo = self.optionalFoo { - __bjs_unwrapped_optionalFoo.jsObject.bridgeJSLowerStackReturn() + __bjs_unwrapped_optionalFoo.jsObject.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_optionalFoo ? 1 : 0) } @@ -3764,12 +3764,12 @@ extension FooContainer: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_FooContainer())) } } @@ -3793,15 +3793,15 @@ fileprivate func _bjs_struct_lift_FooContainer() -> Int32 { #endif extension ArrayMembers: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter() -> ArrayMembers { - let optStrings = Optional<[String]>.bridgeJSLiftParameter() - let ints = [Int].bridgeJSLiftParameter() + @_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 bridgeJSLowerReturn() { - self.ints.bridgeJSLowerReturn() - self.optStrings.bridgeJSLowerReturn() + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.ints.bridgeJSStackPush() + self.optStrings.bridgeJSStackPush() } init(unsafelyCopying jsObject: JSObject) { @@ -3809,12 +3809,12 @@ extension ArrayMembers: _BridgedSwiftStruct { defer { _swift_js_struct_cleanup(__bjs_cleanupId) } - self = Self.bridgeJSLiftParameter() + self = Self.bridgeJSStackPop() } func toJSObject() -> JSObject { let __bjs_self = self - __bjs_self.bridgeJSLowerReturn() + __bjs_self.bridgeJSStackPush() return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ArrayMembers())) } } @@ -3841,7 +3841,7 @@ fileprivate func _bjs_struct_lift_ArrayMembers() -> Int32 { @_cdecl("bjs_ArrayMembers_sumValues") public func _bjs_ArrayMembers_sumValues() -> Int32 { #if arch(wasm32) - let ret = ArrayMembers.bridgeJSLiftParameter().sumValues(_: [Int].bridgeJSLiftParameter()) + let ret = ArrayMembers.bridgeJSLiftParameter().sumValues(_: [Int].bridgeJSStackPop()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -3852,7 +3852,7 @@ public func _bjs_ArrayMembers_sumValues() -> Int32 { @_cdecl("bjs_ArrayMembers_firstString") public func _bjs_ArrayMembers_firstString() -> Void { #if arch(wasm32) - let ret = ArrayMembers.bridgeJSLiftParameter().firstString(_: [String].bridgeJSLiftParameter()) + let ret = ArrayMembers.bridgeJSLiftParameter().firstString(_: [String].bridgeJSStackPop()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -4060,8 +4060,8 @@ public func _bjs_roundTripOptionalJSValue(_ vIsSome: Int32, _ vKind: Int32, _ vP @_cdecl("bjs_roundTripJSValueArray") public func _bjs_roundTripJSValueArray() -> Void { #if arch(wasm32) - let ret = roundTripJSValueArray(v: [JSValue].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripJSValueArray(v: [JSValue].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -4072,7 +4072,7 @@ public func _bjs_roundTripJSValueArray() -> Void { public func _bjs_roundTripOptionalJSValueArray() -> Void { #if arch(wasm32) let ret = roundTripOptionalJSValueArray(v: Optional<[JSValue]>.bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5079,7 +5079,7 @@ public func _bjs_testEmptyInit(_ object: UnsafeMutableRawPointer) -> UnsafeMutab @_cdecl("bjs_arrayWithDefault") public func _bjs_arrayWithDefault() -> Int32 { #if arch(wasm32) - let ret = arrayWithDefault(_: [Int].bridgeJSLiftParameter()) + let ret = arrayWithDefault(_: [Int].bridgeJSStackPop()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5101,7 +5101,7 @@ public func _bjs_arrayWithOptionalDefault() -> Int32 { @_cdecl("bjs_arrayMixedDefaults") public func _bjs_arrayMixedDefaults(_ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { #if arch(wasm32) - let ret = arrayMixedDefaults(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength), values: [Int].bridgeJSLiftParameter(), suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) + let ret = arrayMixedDefaults(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength), values: [Int].bridgeJSStackPop(), suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5145,8 +5145,8 @@ public func _bjs_makeAdder(_ base: Int32) -> Int32 { @_cdecl("bjs_roundTripIntArray") public func _bjs_roundTripIntArray() -> Void { #if arch(wasm32) - let ret = roundTripIntArray(_: [Int].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripIntArray(_: [Int].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5156,8 +5156,8 @@ public func _bjs_roundTripIntArray() -> Void { @_cdecl("bjs_roundTripStringArray") public func _bjs_roundTripStringArray() -> Void { #if arch(wasm32) - let ret = roundTripStringArray(_: [String].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripStringArray(_: [String].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5167,8 +5167,8 @@ public func _bjs_roundTripStringArray() -> Void { @_cdecl("bjs_roundTripDoubleArray") public func _bjs_roundTripDoubleArray() -> Void { #if arch(wasm32) - let ret = roundTripDoubleArray(_: [Double].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripDoubleArray(_: [Double].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5178,8 +5178,8 @@ public func _bjs_roundTripDoubleArray() -> Void { @_cdecl("bjs_roundTripBoolArray") public func _bjs_roundTripBoolArray() -> Void { #if arch(wasm32) - let ret = roundTripBoolArray(_: [Bool].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripBoolArray(_: [Bool].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5189,8 +5189,8 @@ public func _bjs_roundTripBoolArray() -> Void { @_cdecl("bjs_roundTripDirectionArray") public func _bjs_roundTripDirectionArray() -> Void { #if arch(wasm32) - let ret = roundTripDirectionArray(_: [Direction].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripDirectionArray(_: [Direction].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5200,8 +5200,8 @@ public func _bjs_roundTripDirectionArray() -> Void { @_cdecl("bjs_roundTripStatusArray") public func _bjs_roundTripStatusArray() -> Void { #if arch(wasm32) - let ret = roundTripStatusArray(_: [Status].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripStatusArray(_: [Status].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5211,8 +5211,8 @@ public func _bjs_roundTripStatusArray() -> Void { @_cdecl("bjs_roundTripThemeArray") public func _bjs_roundTripThemeArray() -> Void { #if arch(wasm32) - let ret = roundTripThemeArray(_: [Theme].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripThemeArray(_: [Theme].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5222,8 +5222,8 @@ public func _bjs_roundTripThemeArray() -> Void { @_cdecl("bjs_roundTripHttpStatusArray") public func _bjs_roundTripHttpStatusArray() -> Void { #if arch(wasm32) - let ret = roundTripHttpStatusArray(_: [HttpStatus].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripHttpStatusArray(_: [HttpStatus].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5233,8 +5233,8 @@ public func _bjs_roundTripHttpStatusArray() -> Void { @_cdecl("bjs_roundTripDataPointArray") public func _bjs_roundTripDataPointArray() -> Void { #if arch(wasm32) - let ret = roundTripDataPointArray(_: [DataPoint].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripDataPointArray(_: [DataPoint].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5244,8 +5244,8 @@ public func _bjs_roundTripDataPointArray() -> Void { @_cdecl("bjs_roundTripGreeterArray") public func _bjs_roundTripGreeterArray() -> Void { #if arch(wasm32) - let ret = roundTripGreeterArray(_: [Greeter].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripGreeterArray(_: [Greeter].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5260,7 +5260,7 @@ public func _bjs_roundTripOptionalIntArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result @@ -5268,7 +5268,7 @@ public func _bjs_roundTripOptionalIntArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } @@ -5287,7 +5287,7 @@ public func _bjs_roundTripOptionalStringArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result @@ -5295,7 +5295,7 @@ public func _bjs_roundTripOptionalStringArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } @@ -5314,13 +5314,13 @@ public func _bjs_roundTripOptionalDataPointArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result }()) for __bjs_elem_ret in ret { - __bjs_elem_ret.bridgeJSLowerReturn() + __bjs_elem_ret.bridgeJSStackPush() } _swift_js_push_i32(Int32(ret.count)) #else @@ -5337,7 +5337,7 @@ public func _bjs_roundTripOptionalDirectionArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result @@ -5345,7 +5345,7 @@ public func _bjs_roundTripOptionalDirectionArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } @@ -5364,7 +5364,7 @@ public func _bjs_roundTripOptionalStatusArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result @@ -5372,7 +5372,7 @@ public func _bjs_roundTripOptionalStatusArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } @@ -5387,7 +5387,7 @@ public func _bjs_roundTripOptionalStatusArray() -> Void { public func _bjs_roundTripOptionalIntArrayType() -> Void { #if arch(wasm32) let ret = roundTripOptionalIntArrayType(_: Optional<[Int]>.bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5398,7 +5398,7 @@ public func _bjs_roundTripOptionalIntArrayType() -> Void { public func _bjs_roundTripOptionalStringArrayType() -> Void { #if arch(wasm32) let ret = roundTripOptionalStringArrayType(_: Optional<[String]>.bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5409,7 +5409,7 @@ public func _bjs_roundTripOptionalStringArrayType() -> Void { public func _bjs_roundTripOptionalGreeterArrayType() -> Void { #if arch(wasm32) let ret = roundTripOptionalGreeterArrayType(_: Optional<[Greeter]>.bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5419,8 +5419,8 @@ public func _bjs_roundTripOptionalGreeterArrayType() -> Void { @_cdecl("bjs_roundTripNestedIntArray") public func _bjs_roundTripNestedIntArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedIntArray(_: [[Int]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripNestedIntArray(_: [[Int]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5430,8 +5430,8 @@ public func _bjs_roundTripNestedIntArray() -> Void { @_cdecl("bjs_roundTripNestedStringArray") public func _bjs_roundTripNestedStringArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedStringArray(_: [[String]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripNestedStringArray(_: [[String]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5441,8 +5441,8 @@ public func _bjs_roundTripNestedStringArray() -> Void { @_cdecl("bjs_roundTripNestedDoubleArray") public func _bjs_roundTripNestedDoubleArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedDoubleArray(_: [[Double]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripNestedDoubleArray(_: [[Double]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5452,8 +5452,8 @@ public func _bjs_roundTripNestedDoubleArray() -> Void { @_cdecl("bjs_roundTripNestedBoolArray") public func _bjs_roundTripNestedBoolArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedBoolArray(_: [[Bool]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripNestedBoolArray(_: [[Bool]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5463,8 +5463,8 @@ public func _bjs_roundTripNestedBoolArray() -> Void { @_cdecl("bjs_roundTripNestedDataPointArray") public func _bjs_roundTripNestedDataPointArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedDataPointArray(_: [[DataPoint]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripNestedDataPointArray(_: [[DataPoint]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5474,8 +5474,8 @@ public func _bjs_roundTripNestedDataPointArray() -> Void { @_cdecl("bjs_roundTripNestedDirectionArray") public func _bjs_roundTripNestedDirectionArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedDirectionArray(_: [[Direction]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripNestedDirectionArray(_: [[Direction]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5485,8 +5485,8 @@ public func _bjs_roundTripNestedDirectionArray() -> Void { @_cdecl("bjs_roundTripNestedGreeterArray") public func _bjs_roundTripNestedGreeterArray() -> Void { #if arch(wasm32) - let ret = roundTripNestedGreeterArray(_: [[Greeter]].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripNestedGreeterArray(_: [[Greeter]].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5496,8 +5496,8 @@ public func _bjs_roundTripNestedGreeterArray() -> Void { @_cdecl("bjs_roundTripUnsafeRawPointerArray") public func _bjs_roundTripUnsafeRawPointerArray() -> Void { #if arch(wasm32) - let ret = roundTripUnsafeRawPointerArray(_: [UnsafeRawPointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripUnsafeRawPointerArray(_: [UnsafeRawPointer].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5507,8 +5507,8 @@ public func _bjs_roundTripUnsafeRawPointerArray() -> Void { @_cdecl("bjs_roundTripUnsafeMutableRawPointerArray") public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { #if arch(wasm32) - let ret = roundTripUnsafeMutableRawPointerArray(_: [UnsafeMutableRawPointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripUnsafeMutableRawPointerArray(_: [UnsafeMutableRawPointer].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5518,8 +5518,8 @@ public func _bjs_roundTripUnsafeMutableRawPointerArray() -> Void { @_cdecl("bjs_roundTripOpaquePointerArray") public func _bjs_roundTripOpaquePointerArray() -> Void { #if arch(wasm32) - let ret = roundTripOpaquePointerArray(_: [OpaquePointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripOpaquePointerArray(_: [OpaquePointer].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5529,8 +5529,8 @@ public func _bjs_roundTripOpaquePointerArray() -> Void { @_cdecl("bjs_roundTripUnsafePointerArray") public func _bjs_roundTripUnsafePointerArray() -> Void { #if arch(wasm32) - let ret = roundTripUnsafePointerArray(_: [UnsafePointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripUnsafePointerArray(_: [UnsafePointer].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5540,8 +5540,8 @@ public func _bjs_roundTripUnsafePointerArray() -> Void { @_cdecl("bjs_roundTripUnsafeMutablePointerArray") public func _bjs_roundTripUnsafeMutablePointerArray() -> Void { #if arch(wasm32) - let ret = roundTripUnsafeMutablePointerArray(_: [UnsafeMutablePointer].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripUnsafeMutablePointerArray(_: [UnsafeMutablePointer].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5551,7 +5551,7 @@ public func _bjs_roundTripUnsafeMutablePointerArray() -> Void { @_cdecl("bjs_consumeDataProcessorArrayType") public func _bjs_consumeDataProcessorArrayType() -> Int32 { #if arch(wasm32) - let ret = consumeDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSLiftParameter()) + let ret = consumeDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSStackPop()) return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") @@ -5562,8 +5562,8 @@ public func _bjs_consumeDataProcessorArrayType() -> Int32 { @_cdecl("bjs_roundTripDataProcessorArrayType") public func _bjs_roundTripDataProcessorArrayType() -> Void { #if arch(wasm32) - let ret = roundTripDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSLiftParameter()) - ret.map { $0 as! AnyDataProcessor }.bridgeJSLowerReturn() + let ret = roundTripDataProcessorArrayType(_: [AnyDataProcessor].bridgeJSStackPop()) + ret.map { $0 as! AnyDataProcessor }.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5573,8 +5573,8 @@ public func _bjs_roundTripDataProcessorArrayType() -> Void { @_cdecl("bjs_roundTripJSObjectArray") public func _bjs_roundTripJSObjectArray() -> Void { #if arch(wasm32) - let ret = roundTripJSObjectArray(_: [JSObject].bridgeJSLiftParameter()) - ret.bridgeJSLowerReturn() + let ret = roundTripJSObjectArray(_: [JSObject].bridgeJSStackPop()) + ret.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5589,7 +5589,7 @@ public func _bjs_roundTripOptionalJSObjectArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter()) + __result.append(Optional.bridgeJSStackPop()) } __result.reverse() return __result @@ -5597,7 +5597,7 @@ public func _bjs_roundTripOptionalJSObjectArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } @@ -5611,8 +5611,8 @@ public func _bjs_roundTripOptionalJSObjectArray() -> Void { @_cdecl("bjs_roundTripFooArray") public func _bjs_roundTripFooArray() -> Void { #if arch(wasm32) - let ret = roundTripFooArray(_: [JSObject].bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) }) - ret.map { $0.jsObject }.bridgeJSLowerReturn() + let ret = roundTripFooArray(_: [JSObject].bridgeJSStackPop().map { Foo(unsafelyWrapping: $0) }) + ret.map { $0.jsObject }.bridgeJSStackPush() #else fatalError("Only available on WebAssembly") #endif @@ -5627,7 +5627,7 @@ public func _bjs_roundTripOptionalFooArray() -> Void { var __result: [Optional] = [] __result.reserveCapacity(__count) for _ in 0..<__count { - __result.append(Optional.bridgeJSLiftParameter().map { Foo(unsafelyWrapping: $0) }) + __result.append(Optional.bridgeJSStackPop().map { Foo(unsafelyWrapping: $0) }) } __result.reverse() return __result @@ -5635,7 +5635,7 @@ public func _bjs_roundTripOptionalFooArray() -> Void { for __bjs_elem_ret in ret { let __bjs_isSome_ret_elem = __bjs_elem_ret != nil if let __bjs_unwrapped_ret_elem = __bjs_elem_ret { - __bjs_unwrapped_ret_elem.jsObject.bridgeJSLowerStackReturn() + __bjs_unwrapped_ret_elem.jsObject.bridgeJSStackPush() } _swift_js_push_i32(__bjs_isSome_ret_elem ? 1 : 0) } @@ -6148,7 +6148,7 @@ public func _bjs_roundTripArrayMembers() -> Void { @_cdecl("bjs_arrayMembersSum") public func _bjs_arrayMembersSum() -> Int32 { #if arch(wasm32) - let _tmp_values = [Int].bridgeJSLiftParameter() + let _tmp_values = [Int].bridgeJSStackPop() let _tmp_value = ArrayMembers.bridgeJSLiftParameter() let ret = arrayMembersSum(_: _tmp_value, _: _tmp_values) return ret.bridgeJSLowerReturn() @@ -6161,7 +6161,7 @@ public func _bjs_arrayMembersSum() -> Int32 { @_cdecl("bjs_arrayMembersFirst") public func _bjs_arrayMembersFirst() -> Void { #if arch(wasm32) - let _tmp_values = [String].bridgeJSLiftParameter() + let _tmp_values = [String].bridgeJSStackPop() let _tmp_value = ArrayMembers.bridgeJSLiftParameter() let ret = arrayMembersFirst(_: _tmp_value, _: _tmp_values) return ret.bridgeJSLowerReturn() From e9855d1f63682acdd049243b544fb7daeb779553 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 16 Feb 2026 11:01:22 +0900 Subject: [PATCH 218/252] BridgeJS: Fix double-release of JSObject when passing a `JSObject?` JS->Swift --- Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index ffb50c7a8..99afffd73 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -931,11 +931,6 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") } printer.write("}") - cleanupCode.write("if (\(idVar) !== undefined) {") - cleanupCode.indent { - cleanupCode.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") - } - cleanupCode.write("}") return ["+\(isSomeVar)", "\(isSomeVar) ? \(idVar) : 0"] default: return ["+\(isSomeVar)", "\(isSomeVar) ? \(value) : 0"] From 18d56d8071510844d479afd809daaedc70edd81d Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 16 Feb 2026 11:06:40 +0900 Subject: [PATCH 219/252] [NFC] BridgeJS: Move optional support test imports to their own JS class --- .../Generated/BridgeJS.swift | 88 +++++----- .../Generated/JavaScript/BridgeJS.json | 164 ++++++++++-------- .../JavaScript/OptionalSupportTests.mjs | 25 +++ .../OptionalSupportTests.swift | 63 ++++--- Tests/prelude.mjs | 14 +- 5 files changed, 190 insertions(+), 164 deletions(-) diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 91dd822c1..de56d7306 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -10147,93 +10147,93 @@ func _$jsTranslatePoint(_ point: Point, _ dx: Int, _ dy: Int) throws(JSException } #if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_runJsOptionalSupportTests") -fileprivate func bjs_runJsOptionalSupportTests() -> Void +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static") +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static(_ valueIsSome: Int32, _ valueValue: Int32) -> Void #else -fileprivate func bjs_runJsOptionalSupportTests() -> Void { +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif -func _$runJsOptionalSupportTests() throws(JSException) -> Void { - bjs_runJsOptionalSupportTests() - if let error = _swift_js_take_exception() { - throw error - } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static") +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static(_ valueIsSome: Int32, _ valueValue: Int32) -> Void +#else +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") } +#endif #if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalNumberNull") -fileprivate func bjs_jsRoundTripOptionalNumberNull(_ valueIsSome: Int32, _ valueValue: Int32) -> Void +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static") +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static(_ nameIsSome: Int32, _ nameValue: Int32) -> Void #else -fileprivate func bjs_jsRoundTripOptionalNumberNull(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif -func _$jsRoundTripOptionalNumberNull(_ value: Optional) throws(JSException) -> Optional { - let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() - bjs_jsRoundTripOptionalNumberNull(valueIsSome, valueValue) - if let error = _swift_js_take_exception() { - throw error - } - return Optional.bridgeJSLiftReturnFromSideChannel() +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static") +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static(_ nameIsSome: Int32, _ nameValue: Int32) -> Void +#else +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { + fatalError("Only available on WebAssembly") } +#endif #if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalNumberUndefined") -fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ valueIsSome: Int32, _ valueValue: Int32) -> Void +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_runJsOptionalSupportTests_static") +fileprivate func bjs_OptionalSupportImports_runJsOptionalSupportTests_static() -> Void #else -fileprivate func bjs_jsRoundTripOptionalNumberUndefined(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { +fileprivate func bjs_OptionalSupportImports_runJsOptionalSupportTests_static() -> Void { fatalError("Only available on WebAssembly") } #endif -func _$jsRoundTripOptionalNumberUndefined(_ value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { +func _$OptionalSupportImports_jsRoundTripOptionalNumberNull(_ value: Optional) throws(JSException) -> Optional { let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() - bjs_jsRoundTripOptionalNumberUndefined(valueIsSome, valueValue) + bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static(valueIsSome, valueValue) if let error = _swift_js_take_exception() { throw error } - return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() + return Optional.bridgeJSLiftReturnFromSideChannel() } -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalStringNull") -fileprivate func bjs_jsRoundTripOptionalStringNull(_ nameIsSome: Int32, _ nameValue: Int32) -> Void -#else -fileprivate func bjs_jsRoundTripOptionalStringNull(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { - fatalError("Only available on WebAssembly") +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() } -#endif -func _$jsRoundTripOptionalStringNull(_ name: Optional) throws(JSException) -> Optional { +func _$OptionalSupportImports_jsRoundTripOptionalStringNull(_ name: Optional) throws(JSException) -> Optional { let (nameIsSome, nameValue) = name.bridgeJSLowerParameter() - bjs_jsRoundTripOptionalStringNull(nameIsSome, nameValue) + bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static(nameIsSome, nameValue) if let error = _swift_js_take_exception() { throw error } return Optional.bridgeJSLiftReturnFromSideChannel() } -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalStringUndefined") -fileprivate func bjs_jsRoundTripOptionalStringUndefined(_ nameIsSome: Int32, _ nameValue: Int32) -> Void -#else -fileprivate func bjs_jsRoundTripOptionalStringUndefined(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func _$jsRoundTripOptionalStringUndefined(_ name: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { +func _$OptionalSupportImports_jsRoundTripOptionalStringUndefined(_ name: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { let (nameIsSome, nameValue) = name.bridgeJSLowerParameter() - bjs_jsRoundTripOptionalStringUndefined(nameIsSome, nameValue) + bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static(nameIsSome, nameValue) if let error = _swift_js_take_exception() { throw error } return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() } +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_SwiftClassSupportImports_jsRoundTripGreeter_static") fileprivate func bjs_SwiftClassSupportImports_jsRoundTripGreeter_static(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index fc650b37d..4cc153013 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -15266,23 +15266,39 @@ }, { "functions" : [ + + ], + "types" : [ { - "name" : "runJsOptionalSupportTests", - "parameters" : [ + "getters" : [ ], - "returnType" : { - "void" : { + "methods" : [ - } - } - }, - { - "name" : "jsRoundTripOptionalNumberNull", - "parameters" : [ + ], + "name" : "OptionalSupportImports", + "setters" : [ + + ], + "staticMethods" : [ { - "name" : "value", - "type" : { + "name" : "jsRoundTripOptionalNumberNull", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "int" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { "nullable" : { "_0" : { "int" : { @@ -15292,25 +15308,25 @@ "_1" : "null" } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "int" : { + }, + { + "name" : "jsRoundTripOptionalNumberUndefined", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "int" : { + } + }, + "_1" : "undefined" + } + } } - }, - "_1" : "null" - } - } - }, - { - "name" : "jsRoundTripOptionalNumberUndefined", - "parameters" : [ - { - "name" : "value", - "type" : { + ], + "returnType" : { "nullable" : { "_0" : { "int" : { @@ -15320,25 +15336,25 @@ "_1" : "undefined" } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "int" : { + }, + { + "name" : "jsRoundTripOptionalStringNull", + "parameters" : [ + { + "name" : "name", + "type" : { + "nullable" : { + "_0" : { + "string" : { + } + }, + "_1" : "null" + } + } } - }, - "_1" : "undefined" - } - } - }, - { - "name" : "jsRoundTripOptionalStringNull", - "parameters" : [ - { - "name" : "name", - "type" : { + ], + "returnType" : { "nullable" : { "_0" : { "string" : { @@ -15348,25 +15364,25 @@ "_1" : "null" } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "string" : { + }, + { + "name" : "jsRoundTripOptionalStringUndefined", + "parameters" : [ + { + "name" : "name", + "type" : { + "nullable" : { + "_0" : { + "string" : { + } + }, + "_1" : "undefined" + } + } } - }, - "_1" : "null" - } - } - }, - { - "name" : "jsRoundTripOptionalStringUndefined", - "parameters" : [ - { - "name" : "name", - "type" : { + ], + "returnType" : { "nullable" : { "_0" : { "string" : { @@ -15376,22 +15392,20 @@ "_1" : "undefined" } } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "string" : { + }, + { + "name" : "runJsOptionalSupportTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { } - }, - "_1" : "undefined" + } } - } + ] } - ], - "types" : [ - ] }, { diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs index 8a856582d..518e4d79a 100644 --- a/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs +++ b/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs @@ -15,6 +15,31 @@ import { import { ImportedFoo } from './Types.mjs'; +/** + * @returns {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Imports["OptionalSupportImports"]} + */ +export function getImports(importsContext) { + return { + jsRoundTripOptionalNumberNull: (v) => { + return v ?? null; + }, + jsRoundTripOptionalNumberUndefined: (v) => { + return v === undefined ? undefined : v; + }, + jsRoundTripOptionalStringNull: (v) => { + return v ?? null; + }, + jsRoundTripOptionalStringUndefined: (v) => { + return v === undefined ? undefined : v; + }, + runJsOptionalSupportTests: () => { + const exports = importsContext.getExports(); + if (!exports) { throw new Error("No exports!?"); } + runJsOptionalSupportTests(exports); + }, + }; +} + /** * Optional value bridging coverage for BridgeJS runtime tests. * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports diff --git a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift index 998f8b90f..d0b5afad0 100644 --- a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift +++ b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift @@ -2,61 +2,58 @@ import XCTest import JavaScriptKit import JavaScriptEventLoop -@JSFunction func runJsOptionalSupportTests() throws + +@JSClass struct OptionalSupportImports { + @JSFunction static func jsRoundTripOptionalNumberNull(_ value: Int?) throws -> Int? + @JSFunction static func jsRoundTripOptionalNumberUndefined(_ value: JSUndefinedOr) throws -> JSUndefinedOr + @JSFunction static func jsRoundTripOptionalStringNull(_ name: String?) throws -> String? + @JSFunction static func jsRoundTripOptionalStringUndefined(_ name: JSUndefinedOr) throws -> JSUndefinedOr + + @JSFunction static func runJsOptionalSupportTests() throws(JSException) +} final class OptionalSupportTests: XCTestCase { func testRunJsOptionalSupportTests() throws { - try runJsOptionalSupportTests() + try OptionalSupportImports.runJsOptionalSupportTests() } - func testRoundTripOptionalStringNull() throws { - try XCTAssertEqual(jsRoundTripOptionalStringNull("hello"), "hello") - try XCTAssertNil(jsRoundTripOptionalStringNull(nil)) + private func roundTripTest(_ fn: (T?) throws -> T?, _ some: T) throws { + try XCTAssertNil(fn(nil)) + try XCTAssertEqual(fn(some), some) } - - func testRoundTripOptionalStringUndefined() throws { - let some = try jsRoundTripOptionalStringUndefined(.value("hi")) - switch some { + private func roundTripTest(_ fn: (JSUndefinedOr) throws -> JSUndefinedOr, _ some: T) throws { + let undefined = try fn(.undefined) + if case .value = undefined { + XCTFail("Expected undefined") + } + let value = try fn(.value(some)) + switch value { case .value(let value): - XCTAssertEqual(value, "hi") + XCTAssertEqual(value, some) case .undefined: XCTFail("Expected defined value") } + } - let undefined = try jsRoundTripOptionalStringUndefined(.undefined) - if case .value = undefined { - XCTFail("Expected undefined") - } + func testRoundTripOptionalStringNull() throws { + try roundTripTest(OptionalSupportImports.jsRoundTripOptionalStringNull, "hello") + } + + func testRoundTripOptionalStringUndefined() throws { + try roundTripTest(OptionalSupportImports.jsRoundTripOptionalStringUndefined, "hi") } func testRoundTripOptionalNumberNull() throws { - try XCTAssertEqual(jsRoundTripOptionalNumberNull(42), 42) - try XCTAssertNil(jsRoundTripOptionalNumberNull(nil)) + try roundTripTest(OptionalSupportImports.jsRoundTripOptionalNumberNull, 42) } func testRoundTripOptionalNumberUndefined() throws { - let some = try jsRoundTripOptionalNumberUndefined(.value(42)) - switch some { - case .value(let value): - XCTAssertEqual(value, 42) - case .undefined: - XCTFail("Expected defined value") - } - - let undefined = try jsRoundTripOptionalNumberUndefined(.undefined) - if case .value = undefined { - XCTFail("Expected undefined") - } + try roundTripTest(OptionalSupportImports.jsRoundTripOptionalNumberUndefined, 42) } } // MARK: - Optional Bridging -@JSFunction func jsRoundTripOptionalNumberNull(_ value: Int?) throws -> Int? -@JSFunction func jsRoundTripOptionalNumberUndefined(_ value: JSUndefinedOr) throws -> JSUndefinedOr -@JSFunction func jsRoundTripOptionalStringNull(_ name: String?) throws -> String? -@JSFunction func jsRoundTripOptionalStringUndefined(_ name: JSUndefinedOr) throws -> JSUndefinedOr - @JS func roundTripOptionalString(name: String?) -> String? { name } diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index ec37bdbc4..d40a2845c 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -7,6 +7,7 @@ import { ImportedFoo } from './BridgeJSRuntimeTests/JavaScript/Types.mjs'; import { runJsOptionalSupportTests } from './BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs'; import { getImports as getClosureSupportImports } from './BridgeJSRuntimeTests/JavaScript/ClosureSupportTests.mjs'; import { getImports as getSwiftClassSupportImports } from './BridgeJSRuntimeTests/JavaScript/SwiftClassSupportTests.mjs'; +import { getImports as getOptionalSupportImports } from './BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs'; /** @type {import('../.build/plugins/PackageToJS/outputs/PackageTests/test.d.ts').SetupOptionsFn} */ export async function setupOptions(options, context) { @@ -90,18 +91,6 @@ export async function setupOptions(options, context) { "jsRoundTripUndefinedDictionary": (dict) => { return dict; }, - "jsRoundTripOptionalNumberNull": (v) => { - return v ?? null; - }, - "jsRoundTripOptionalNumberUndefined": (v) => { - return v === undefined ? undefined : v; - }, - "jsRoundTripOptionalStringNull": (v) => { - return v ?? null; - }, - "jsRoundTripOptionalStringUndefined": (v) => { - return v === undefined ? undefined : v; - }, "jsRoundTripJSValue": (v) => { return v; }, @@ -215,6 +204,7 @@ export async function setupOptions(options, context) { }, ClosureSupportImports: getClosureSupportImports(importsContext), SwiftClassSupportImports: getSwiftClassSupportImports(importsContext), + OptionalSupportImports: getOptionalSupportImports(importsContext), }; }, addToCoreImports(importObject, importsContext) { From 072b0d0f41ed39664212f2966e1d7f50c6dd2611 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 16 Feb 2026 11:13:22 +0900 Subject: [PATCH 220/252] Tests: Cover a test case to kill JSObject? double-release --- .../Generated/BridgeJS.swift | 10 +++++++ .../Generated/JavaScript/BridgeJS.json | 30 +++++++++++++++++++ .../JavaScript/OptionalSupportTests.mjs | 2 ++ .../OptionalSupportTests.swift | 7 +++-- 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index de56d7306..96ca9be2e 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -5843,6 +5843,16 @@ public func _bjs_roundTripOptionalTypedPayloadResult(_ resultIsSome: Int32, _ re #endif } +@_expose(wasm, "bjs_takeOptionalJSObject") +@_cdecl("bjs_takeOptionalJSObject") +public func _bjs_takeOptionalJSObject(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + takeOptionalJSObject(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_compareAPIResults") @_cdecl("bjs_compareAPIResults") public func _bjs_compareAPIResults(_ r1IsSome: Int32, _ r1CaseId: Int32, _ r2IsSome: Int32, _ r2CaseId: Int32) -> Void { diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 4cc153013..9c086c808 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -10564,6 +10564,36 @@ } } }, + { + "abiName" : "bjs_takeOptionalJSObject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeOptionalJSObject", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, { "abiName" : "bjs_compareAPIResults", "effects" : { diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs index 518e4d79a..58215560c 100644 --- a/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs +++ b/Tests/BridgeJSRuntimeTests/JavaScript/OptionalSupportTests.mjs @@ -241,4 +241,6 @@ export function runJsOptionalSupportTests(exports) { assert.deepEqual(exports.roundTripOptionalPayloadResultOpt(oatr_empty), oatr_empty); assert.equal(exports.roundTripOptionalPayloadResultOpt(null), null); + exports.takeOptionalJSObject(null); + assert.doesNotThrow(() => exports.takeOptionalJSObject({ key: "value" })); } diff --git a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift index d0b5afad0..a99bb0bb1 100644 --- a/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift +++ b/Tests/BridgeJSRuntimeTests/OptionalSupportTests.swift @@ -2,12 +2,13 @@ import XCTest import JavaScriptKit import JavaScriptEventLoop - @JSClass struct OptionalSupportImports { @JSFunction static func jsRoundTripOptionalNumberNull(_ value: Int?) throws -> Int? @JSFunction static func jsRoundTripOptionalNumberUndefined(_ value: JSUndefinedOr) throws -> JSUndefinedOr @JSFunction static func jsRoundTripOptionalStringNull(_ name: String?) throws -> String? - @JSFunction static func jsRoundTripOptionalStringUndefined(_ name: JSUndefinedOr) throws -> JSUndefinedOr + @JSFunction static func jsRoundTripOptionalStringUndefined( + _ name: JSUndefinedOr + ) throws -> JSUndefinedOr @JSFunction static func runJsOptionalSupportTests() throws(JSException) } @@ -127,6 +128,8 @@ typealias OptionalAge = Int? result } +@JS func takeOptionalJSObject(_ value: JSObject?) {} + @JS func compareAPIResults(_ r1: APIResult?, _ r2: APIResult?) -> String { let r1Str: String switch r1 { From 118db02a09ed0791204ddaea14a44519ed191d80 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 16 Feb 2026 11:37:54 +0900 Subject: [PATCH 221/252] BridgeJS: Take ownership of source Uint8Array id in `swift_js_init_memory` (#635) This allows us to insert cleanup code for String parameter passing for JS -> Swift. --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 3 + .../Sources/BridgeJSLink/JSGlueGen.swift | 33 +---------- .../BridgeJSLinkTests/ArrayTypes.js | 12 +--- .../__Snapshots__/BridgeJSLinkTests/Async.js | 2 +- .../BridgeJSLinkTests/DefaultParameters.js | 28 +--------- .../BridgeJSLinkTests/DictionaryTypes.js | 22 +------- .../BridgeJSLinkTests/EnumAssociatedValue.js | 55 +++++-------------- .../BridgeJSLinkTests/EnumCase.js | 1 + .../BridgeJSLinkTests/EnumNamespace.Global.js | 1 + .../BridgeJSLinkTests/EnumNamespace.js | 1 + .../BridgeJSLinkTests/EnumRawType.js | 14 +---- .../BridgeJSLinkTests/GlobalGetter.js | 1 + .../BridgeJSLinkTests/GlobalThisImports.js | 1 + .../BridgeJSLinkTests/ImportArray.js | 1 + .../ImportedTypeInExportedInterface.js | 1 + .../BridgeJSLinkTests/InvalidPropertyNames.js | 1 + .../BridgeJSLinkTests/JSClass.js | 1 + .../JSClassStaticFunctions.js | 1 + .../BridgeJSLinkTests/JSValue.js | 1 + .../BridgeJSLinkTests/MixedGlobal.js | 1 + .../BridgeJSLinkTests/MixedModules.js | 1 + .../BridgeJSLinkTests/MixedPrivate.js | 1 + .../BridgeJSLinkTests/Namespaces.Global.js | 2 +- .../BridgeJSLinkTests/Namespaces.js | 2 +- .../BridgeJSLinkTests/Optionals.js | 37 +------------ .../BridgeJSLinkTests/PrimitiveParameters.js | 1 + .../BridgeJSLinkTests/PrimitiveReturn.js | 1 + .../BridgeJSLinkTests/PropertyTypes.js | 6 +- .../BridgeJSLinkTests/Protocol.js | 8 +-- .../StaticFunctions.Global.js | 6 +- .../BridgeJSLinkTests/StaticFunctions.js | 6 +- .../StaticProperties.Global.js | 9 +-- .../BridgeJSLinkTests/StaticProperties.js | 9 +-- .../BridgeJSLinkTests/StringParameter.js | 3 +- .../BridgeJSLinkTests/StringReturn.js | 1 + .../BridgeJSLinkTests/SwiftClass.js | 4 +- .../BridgeJSLinkTests/SwiftClosure.js | 14 +---- .../BridgeJSLinkTests/SwiftClosureImports.js | 1 + .../BridgeJSLinkTests/SwiftStruct.js | 18 +----- .../BridgeJSLinkTests/SwiftStructImports.js | 1 + .../__Snapshots__/BridgeJSLinkTests/Throws.js | 1 + .../BridgeJSLinkTests/UnsafePointer.js | 1 + .../VoidParameterVoidReturn.js | 1 + .../JavaScriptKit/BridgeJSIntrinsics.swift | 6 ++ 44 files changed, 72 insertions(+), 249 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 44b6f0c38..b779e0171 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -297,6 +297,9 @@ public struct BridgeJSLink { printer.write( "const source = \(JSGlueVariableScope.reservedSwift).\(JSGlueVariableScope.reservedMemory).getObject(sourceId);" ) + printer.write( + "\(JSGlueVariableScope.reservedSwift).\(JSGlueVariableScope.reservedMemory).release(sourceId);" + ) printer.write( "const bytes = new Uint8Array(\(JSGlueVariableScope.reservedMemory).buffer, bytesPtr);" ) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index ffb50c7a8..8082ea6c3 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -238,13 +238,12 @@ struct IntrinsicJSFragment: Sendable { static let stringLowerParameter = IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let argument = arguments[0] let bytesLabel = scope.variable("\(argument)Bytes") let bytesIdLabel = scope.variable("\(argument)Id") printer.write("const \(bytesLabel) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(argument));") printer.write("const \(bytesIdLabel) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesLabel));") - cleanupCode.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(bytesIdLabel));") return [bytesIdLabel, "\(bytesLabel).length"] } ) @@ -840,12 +839,6 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") } printer.write("}") - cleanupCode.write("if (\(idVar) != undefined) {") - cleanupCode.indent { - cleanupCode.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") - } - cleanupCode.write("}") - return ["+\(isSomeVar)", "\(isSomeVar) ? \(idVar) : 0", "\(isSomeVar) ? \(bytesVar).length : 0"] case .jsValue: let lowered = try jsValueLower.printCode([value], context) @@ -1920,11 +1913,6 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - cleanup.write("if(\(idVar)) {") - cleanup.indent { - cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") - } - cleanup.write("}") case .int, .uint: scope.emitPushI32Parameter("\(isSomeVar) ? (\(value) | 0) : 0", printer: printer) scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) @@ -1964,13 +1952,6 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - cleanup.write("if(\(idVar)) {") - cleanup.indent { - cleanup.write( - "\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));" - ) - } - cleanup.write("}") case .float: scope.emitPushF32Parameter("\(isSomeVar) ? Math.fround(\(value)) : 0.0", printer: printer) scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) @@ -2554,7 +2535,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let bytesVar = scope.variable("bytes") let idVar = scope.variable("id") @@ -2562,7 +2543,6 @@ struct IntrinsicJSFragment: Sendable { printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) scope.emitPushI32Parameter(idVar, printer: printer) - cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") return [] } ) @@ -2632,7 +2612,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let bytesVar = scope.variable("bytes") let idVar = scope.variable("id") @@ -2644,7 +2624,6 @@ struct IntrinsicJSFragment: Sendable { ) scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) scope.emitPushI32Parameter(idVar, printer: printer) - cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") return [] } ) @@ -3088,9 +3067,6 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - cleanup.write( - "if(\(idVar) !== undefined) { \(JSGlueVariableScope.reservedSwift).memory.release(\(idVar)); }" - ) return [idVar] case .float: printer.write("if (\(isSomeVar)) {") @@ -3179,9 +3155,6 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - cleanup.write( - "if(\(idVar) !== undefined) { \(JSGlueVariableScope.reservedSwift).memory.release(\(idVar)); }" - ) return [idVar] } else if case .jsObject = wrappedType { let idVar = scope.variable("id") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 97531d378..52438d27d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -71,6 +71,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -317,9 +318,6 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - arrayCleanups.push(() => { - swift.memory.release(id); - }); } i32Stack.push(ret.length); } catch (error) { @@ -411,9 +409,6 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - arrayCleanups.push(() => { - swift.memory.release(id); - }); } i32Stack.push(values.length); instance.exports.bjs_processStringArray(); @@ -539,7 +534,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_findFirstPoint(matchingId, matchingBytes.length); const structValue = structHelpers.Point.lift(); for (const cleanup of arrayCleanups) { cleanup(); } - swift.memory.release(matchingId); return structValue; }, processUnsafeRawPointerArray: function bjs_processUnsafeRawPointerArray(values) { @@ -632,7 +626,6 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - arrayCleanups.push(() => { swift.memory.release(id); }); } else { i32Stack.push(0); i32Stack.push(0); @@ -817,9 +810,6 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - arrayCleanups1.push(() => { - swift.memory.release(id); - }); } i32Stack.push(elem.length); arrayCleanups.push(() => { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js index b215b3691..bd57f0fd4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js @@ -43,6 +43,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -225,7 +226,6 @@ export async function createInstantiator(options, swift) { const ret = instance.exports.bjs_asyncRoundTripString(vId, vBytes.length); const ret1 = swift.memory.getObject(ret); swift.memory.release(ret); - swift.memory.release(vId); return ret1; }, asyncRoundTripBool: function bjs_asyncRoundTripBool(v) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index fba9f9c6b..6182298a1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -44,10 +44,7 @@ export async function createInstantiator(options, swift) { i32Stack.push(id); i32Stack.push((value.value | 0)); i32Stack.push(value.enabled ? 1 : 0); - const cleanup = () => { - swift.memory.release(id); - }; - return { cleanup }; + return { cleanup: undefined }; }, lift: () => { const bool = i32Stack.pop() !== 0; @@ -96,6 +93,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -325,7 +323,6 @@ export async function createInstantiator(options, swift) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); const ret = instance.exports.bjs_DefaultGreeter_init(nameId, nameBytes.length); - swift.memory.release(nameId); return DefaultGreeter.__construct(ret); } get name() { @@ -338,7 +335,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_DefaultGreeter_name_set(this.pointer, valueId, valueBytes.length); - swift.memory.release(valueId); } } class EmptyGreeter extends SwiftHeapObject { @@ -366,10 +362,6 @@ export async function createInstantiator(options, swift) { tagId = swift.memory.retain(tagBytes); } const ret = instance.exports.bjs_ConstructorDefaults_init(nameId, nameBytes.length, count, enabled, status, +isSome, isSome ? tagId : 0, isSome ? tagBytes.length : 0); - swift.memory.release(nameId); - if (tagId != undefined) { - swift.memory.release(tagId); - } return ConstructorDefaults.__construct(ret); } get name() { @@ -382,7 +374,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_ConstructorDefaults_name_set(this.pointer, valueId, valueBytes.length); - swift.memory.release(valueId); } get count() { const ret = instance.exports.bjs_ConstructorDefaults_count_get(this.pointer); @@ -419,9 +410,6 @@ export async function createInstantiator(options, swift) { valueId = swift.memory.retain(valueBytes); } instance.exports.bjs_ConstructorDefaults_tag_set(this.pointer, +isSome, isSome ? valueId : 0, isSome ? valueBytes.length : 0); - if (valueId != undefined) { - swift.memory.release(valueId); - } } } const ConfigHelpers = __bjs_createConfigHelpers()(); @@ -440,7 +428,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_testStringDefault(messageId, messageBytes.length); const ret = tmpRetString; tmpRetString = undefined; - swift.memory.release(messageId); return ret; }, testNegativeIntDefault: function bjs_testNegativeIntDefault(value = -42) { @@ -469,9 +456,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_testOptionalDefault(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); const optResult = tmpRetString; tmpRetString = undefined; - if (nameId != undefined) { - swift.memory.release(nameId); - } return optResult; }, testOptionalStringDefault: function bjs_testOptionalStringDefault(greeting = "Hi") { @@ -484,9 +468,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_testOptionalStringDefault(+isSome, isSome ? greetingId : 0, isSome ? greetingBytes.length : 0); const optResult = tmpRetString; tmpRetString = undefined; - if (greetingId != undefined) { - swift.memory.release(greetingId); - } return optResult; }, testMultipleDefaults: function bjs_testMultipleDefaults(title = "Default Title", count = 10, enabled = false) { @@ -495,7 +476,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_testMultipleDefaults(titleId, titleBytes.length, count, enabled); const ret = tmpRetString; tmpRetString = undefined; - swift.memory.release(titleId); return ret; }, testEnumDefault: function bjs_testEnumDefault(status = StatusValues.Active) { @@ -572,9 +552,6 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - arrayCleanups.push(() => { - swift.memory.release(id); - }); } i32Stack.push(names.length); instance.exports.bjs_testStringArrayDefault(); @@ -650,7 +627,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_testMixedWithArrayDefault(nameId, nameBytes.length, enabled); const ret = tmpRetString; tmpRetString = undefined; - swift.memory.release(nameId); for (const cleanup of arrayCleanups) { cleanup(); } return ret; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index 1f7fe91e1..4f71aa76e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -44,6 +44,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -222,9 +223,6 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - arrayCleanups.push(() => { - swift.memory.release(id); - }); f64Stack.push(value); } i32Stack.push(entries.length); @@ -280,9 +278,6 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - arrayCleanups.push(() => { - swift.memory.release(id); - }); i32Stack.push((value | 0)); } i32Stack.push(entries.length); @@ -309,16 +304,10 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - arrayCleanups.push(() => { - swift.memory.release(id); - }); const bytes1 = textEncoder.encode(value); const id1 = swift.memory.retain(bytes1); i32Stack.push(bytes1.length); i32Stack.push(id1); - arrayCleanups.push(() => { - swift.memory.release(id1); - }); } i32Stack.push(entries.length); valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); @@ -351,9 +340,6 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - arrayCleanups.push(() => { - swift.memory.release(id); - }); const arrayCleanups1 = []; for (const elem of value) { i32Stack.push((elem | 0)); @@ -390,9 +376,6 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - arrayCleanups.push(() => { - swift.memory.release(id); - }); ptrStack.push(value.pointer); } i32Stack.push(entries.length); @@ -417,9 +400,6 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - arrayCleanups.push(() => { - swift.memory.release(id); - }); const isSome = value != null ? 1 : 0; if (isSome) { ptrStack.push(value.pointer); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 3a4818463..af81d52fe 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -134,9 +134,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = () => { - swift.memory.release(id); - }; + const cleanup = undefined; return { caseId: APIResultValues.Tag.Success, cleanup }; } case APIResultValues.Tag.Failure: { @@ -205,9 +203,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = () => { - swift.memory.release(id); - }; + const cleanup = undefined; return { caseId: ComplexResultValues.Tag.Success, cleanup }; } case ComplexResultValues.Tag.Error: { @@ -216,9 +212,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = () => { - swift.memory.release(id); - }; + const cleanup = undefined; return { caseId: ComplexResultValues.Tag.Error, cleanup }; } case ComplexResultValues.Tag.Status: { @@ -228,9 +222,7 @@ export async function createInstantiator(options, swift) { i32Stack.push(id); i32Stack.push((value.param1 | 0)); i32Stack.push(value.param0 ? 1 : 0); - const cleanup = () => { - swift.memory.release(id); - }; + const cleanup = undefined; return { caseId: ComplexResultValues.Tag.Status, cleanup }; } case ComplexResultValues.Tag.Coordinates: { @@ -259,11 +251,7 @@ export async function createInstantiator(options, swift) { i32Stack.push((value.param2 | 0)); i32Stack.push(value.param1 ? 1 : 0); i32Stack.push(value.param0 ? 1 : 0); - const cleanup = () => { - swift.memory.release(id); - swift.memory.release(id1); - swift.memory.release(id2); - }; + const cleanup = undefined; return { caseId: ComplexResultValues.Tag.Comprehensive, cleanup }; } case ComplexResultValues.Tag.Info: { @@ -325,9 +313,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = () => { - swift.memory.release(id); - }; + const cleanup = undefined; return { caseId: ResultValues.Tag.Success, cleanup }; } case ResultValues.Tag.Failure: { @@ -336,9 +322,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = () => { - swift.memory.release(id); - }; + const cleanup = undefined; return { caseId: ResultValues.Tag.Failure, cleanup }; } case ResultValues.Tag.Status: { @@ -348,9 +332,7 @@ export async function createInstantiator(options, swift) { i32Stack.push(id); i32Stack.push((value.param1 | 0)); i32Stack.push(value.param0 ? 1 : 0); - const cleanup = () => { - swift.memory.release(id); - }; + const cleanup = undefined; return { caseId: ResultValues.Tag.Status, cleanup }; } default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); @@ -389,9 +371,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = () => { - swift.memory.release(id); - }; + const cleanup = undefined; return { caseId: NetworkingResultValues.Tag.Success, cleanup }; } case NetworkingResultValues.Tag.Failure: { @@ -400,9 +380,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = () => { - swift.memory.release(id); - }; + const cleanup = undefined; return { caseId: NetworkingResultValues.Tag.Failure, cleanup }; } default: throw new Error("Unknown NetworkingResultValues tag: " + String(enumTag)); @@ -443,11 +421,7 @@ export async function createInstantiator(options, swift) { i32Stack.push(0); } i32Stack.push(isSome ? 1 : 0); - const cleanup = () => { - if(id) { - swift.memory.release(id); - } - }; + const cleanup = undefined; return { caseId: APIOptionalResultValues.Tag.Success, cleanup }; } case APIOptionalResultValues.Tag.Failure: { @@ -479,11 +453,7 @@ export async function createInstantiator(options, swift) { const isSome2 = value.param0 != null; i32Stack.push(isSome2 ? (value.param0 ? 1 : 0) : 0); i32Stack.push(isSome2 ? 1 : 0); - const cleanup = () => { - if(id) { - swift.memory.release(id); - } - }; + const cleanup = undefined; return { caseId: APIOptionalResultValues.Tag.Status, cleanup }; } default: throw new Error("Unknown APIOptionalResultValues tag: " + String(enumTag)); @@ -889,6 +859,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js index 341ffb260..72d78dbe0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js @@ -67,6 +67,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index fa4586a2d..392788ef6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -87,6 +87,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index 5d85347ee..0a2826a5e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -68,6 +68,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index 04d667b8e..b1ee0538f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -119,6 +119,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -306,7 +307,6 @@ export async function createInstantiator(options, swift) { const themeBytes = textEncoder.encode(theme); const themeId = swift.memory.retain(themeBytes); instance.exports.bjs_setTheme(themeId, themeBytes.length); - swift.memory.release(themeId); }, getTheme: function bjs_getTheme() { instance.exports.bjs_getTheme(); @@ -324,16 +324,12 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_roundTripOptionalTheme(+isSome, isSome ? inputId : 0, isSome ? inputBytes.length : 0); const optResult = tmpRetString; tmpRetString = undefined; - if (inputId != undefined) { - swift.memory.release(inputId); - } return optResult; }, setTSTheme: function bjs_setTSTheme(theme) { const themeBytes = textEncoder.encode(theme); const themeId = swift.memory.retain(themeBytes); instance.exports.bjs_setTSTheme(themeId, themeBytes.length); - swift.memory.release(themeId); }, getTSTheme: function bjs_getTSTheme() { instance.exports.bjs_getTSTheme(); @@ -351,16 +347,12 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_roundTripOptionalTSTheme(+isSome, isSome ? inputId : 0, isSome ? inputBytes.length : 0); const optResult = tmpRetString; tmpRetString = undefined; - if (inputId != undefined) { - swift.memory.release(inputId); - } return optResult; }, setFeatureFlag: function bjs_setFeatureFlag(flag) { const flagBytes = textEncoder.encode(flag); const flagId = swift.memory.retain(flagBytes); instance.exports.bjs_setFeatureFlag(flagId, flagBytes.length); - swift.memory.release(flagId); }, getFeatureFlag: function bjs_getFeatureFlag() { instance.exports.bjs_getFeatureFlag(); @@ -378,9 +370,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_roundTripOptionalFeatureFlag(+isSome, isSome ? inputId : 0, isSome ? inputBytes.length : 0); const optResult = tmpRetString; tmpRetString = undefined; - if (inputId != undefined) { - swift.memory.release(inputId); - } return optResult; }, setHttpStatus: function bjs_setHttpStatus(status) { @@ -513,7 +502,6 @@ export async function createInstantiator(options, swift) { const themeBytes = textEncoder.encode(theme); const themeId = swift.memory.retain(themeBytes); const ret = instance.exports.bjs_processTheme(themeId, themeBytes.length); - swift.memory.release(themeId); return ret; }, convertPriority: function bjs_convertPriority(status) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js index a60d5377f..6f6bf9531 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js @@ -44,6 +44,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js index e0b4f8f94..9d57a04d3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js @@ -43,6 +43,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js index 80ff1cead..7c946a716 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js @@ -44,6 +44,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index 48aab8fbb..5d724202b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -94,6 +94,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js index 3f5d49f35..54a0f2018 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js @@ -44,6 +44,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js index 66abcf418..a192a1a8b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js @@ -44,6 +44,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index 138bef6a1..1166d1f62 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -44,6 +44,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index 426fd8c1a..d45efc771 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -133,6 +133,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index 590e84cc3..675aa3798 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -43,6 +43,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index 18fb5af6c..6a6c75ef4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -43,6 +43,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index 27bad9aea..f36211310 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -43,6 +43,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index 9e6782d12..09ad002a1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -43,6 +43,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -250,7 +251,6 @@ export async function createInstantiator(options, swift) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); const ret = instance.exports.bjs_Greeter_init(nameId, nameBytes.length); - swift.memory.release(nameId); return Greeter.__construct(ret); } greet() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index 94a4b73fb..7368e52fa 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -43,6 +43,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -250,7 +251,6 @@ export async function createInstantiator(options, swift) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); const ret = instance.exports.bjs_Greeter_init(nameId, nameBytes.length); - swift.memory.release(nameId); return Greeter.__construct(ret); } greet() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index f637af601..c4f99c84b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -44,6 +44,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -506,9 +507,6 @@ export async function createInstantiator(options, swift) { nameId = swift.memory.retain(nameBytes); } const ret = instance.exports.bjs_Greeter_init(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); - if (nameId != undefined) { - swift.memory.release(nameId); - } return Greeter.__construct(ret); } greet() { @@ -525,9 +523,6 @@ export async function createInstantiator(options, swift) { nameId = swift.memory.retain(nameBytes); } instance.exports.bjs_Greeter_changeName(this.pointer, +isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); - if (nameId != undefined) { - swift.memory.release(nameId); - } } get name() { instance.exports.bjs_Greeter_name_get(this.pointer); @@ -543,9 +538,6 @@ export async function createInstantiator(options, swift) { valueId = swift.memory.retain(valueBytes); } instance.exports.bjs_Greeter_name_set(this.pointer, +isSome, isSome ? valueId : 0, isSome ? valueBytes.length : 0); - if (valueId != undefined) { - swift.memory.release(valueId); - } } } class OptionalPropertyHolder extends SwiftHeapObject { @@ -571,9 +563,6 @@ export async function createInstantiator(options, swift) { valueId = swift.memory.retain(valueBytes); } instance.exports.bjs_OptionalPropertyHolder_optionalName_set(this.pointer, +isSome, isSome ? valueId : 0, isSome ? valueBytes.length : 0); - if (valueId != undefined) { - swift.memory.release(valueId); - } } get optionalAge() { instance.exports.bjs_OptionalPropertyHolder_optionalAge_get(this.pointer); @@ -626,9 +615,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_roundTripString(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); const optResult = tmpRetString; tmpRetString = undefined; - if (nameId != undefined) { - swift.memory.release(nameId); - } return optResult; }, roundTripInt: function bjs_roundTripInt(value) { @@ -669,9 +655,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_roundTripSyntax(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); const optResult = tmpRetString; tmpRetString = undefined; - if (nameId != undefined) { - swift.memory.release(nameId); - } return optResult; }, roundTripMixSyntax: function bjs_roundTripMixSyntax(name) { @@ -684,9 +667,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_roundTripMixSyntax(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); const optResult = tmpRetString; tmpRetString = undefined; - if (nameId != undefined) { - swift.memory.release(nameId); - } return optResult; }, roundTripSwiftSyntax: function bjs_roundTripSwiftSyntax(name) { @@ -699,9 +679,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_roundTripSwiftSyntax(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); const optResult = tmpRetString; tmpRetString = undefined; - if (nameId != undefined) { - swift.memory.release(nameId); - } return optResult; }, roundTripMixedSwiftSyntax: function bjs_roundTripMixedSwiftSyntax(name) { @@ -714,9 +691,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_roundTripMixedSwiftSyntax(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); const optResult = tmpRetString; tmpRetString = undefined; - if (nameId != undefined) { - swift.memory.release(nameId); - } return optResult; }, roundTripWithSpaces: function bjs_roundTripWithSpaces(value) { @@ -743,9 +717,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_roundTripOptionalAlias(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); const optResult = tmpRetString; tmpRetString = undefined; - if (nameId != undefined) { - swift.memory.release(nameId); - } return optResult; }, testMixedOptionals: function bjs_testMixedOptionals(firstName, lastName, age, active) { @@ -765,12 +736,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_testMixedOptionals(+isSome, isSome ? firstNameId : 0, isSome ? firstNameBytes.length : 0, +isSome1, isSome1 ? lastNameId : 0, isSome1 ? lastNameBytes.length : 0, +isSome2, isSome2 ? age : 0, active); const optResult = tmpRetString; tmpRetString = undefined; - if (firstNameId != undefined) { - swift.memory.release(firstNameId); - } - if (lastNameId != undefined) { - swift.memory.release(lastNameId); - } return optResult; }, }; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js index dd59941f7..83c77397a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js @@ -44,6 +44,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js index a67637e58..f1fda2cb7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js @@ -44,6 +44,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index 35bc1d028..b39362233 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -43,6 +43,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -242,7 +243,6 @@ export async function createInstantiator(options, swift) { const stringValueBytes = textEncoder.encode(stringValue); const stringValueId = swift.memory.retain(stringValueBytes); const ret = instance.exports.bjs_PropertyHolder_init(intValue, floatValue, doubleValue, boolValue, stringValueId, stringValueBytes.length, swift.memory.retain(jsObject)); - swift.memory.release(stringValueId); return PropertyHolder.__construct(ret); } getAllValues() { @@ -289,7 +289,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_PropertyHolder_stringValue_set(this.pointer, valueId, valueBytes.length); - swift.memory.release(valueId); } get readonlyInt() { const ret = instance.exports.bjs_PropertyHolder_readonlyInt_get(this.pointer); @@ -339,7 +338,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_PropertyHolder_lazyValue_set(this.pointer, valueId, valueBytes.length); - swift.memory.release(valueId); } get computedReadonly() { const ret = instance.exports.bjs_PropertyHolder_computedReadonly_get(this.pointer); @@ -355,7 +353,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_PropertyHolder_computedReadWrite_set(this.pointer, valueId, valueBytes.length); - swift.memory.release(valueId); } get observedProperty() { const ret = instance.exports.bjs_PropertyHolder_observedProperty_get(this.pointer); @@ -371,7 +368,6 @@ export async function createInstantiator(options, swift) { const stringValueBytes = textEncoder.encode(stringValue); const stringValueId = swift.memory.retain(stringValueBytes); const ret = instance.exports.bjs_createPropertyHolder(intValue, floatValue, doubleValue, boolValue, stringValueId, stringValueBytes.length, swift.memory.retain(jsObject)); - swift.memory.release(stringValueId); return PropertyHolder.__construct(ret); }, testPropertyHolder: function bjs_testPropertyHolder(holder) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index d783e8968..1d413db20 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -63,9 +63,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = () => { - swift.memory.release(id); - }; + const cleanup = undefined; return { caseId: ResultValues.Tag.Success, cleanup }; } case ResultValues.Tag.Failure: { @@ -106,6 +104,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -632,7 +631,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_MyViewController_updateValue(this.pointer, valueId, valueBytes.length); - swift.memory.release(valueId); } updateCount(count) { const ret = instance.exports.bjs_MyViewController_updateCount(this.pointer, count); @@ -644,8 +642,6 @@ export async function createInstantiator(options, swift) { const suffixBytes = textEncoder.encode(suffix); const suffixId = swift.memory.retain(suffixBytes); instance.exports.bjs_MyViewController_updateLabel(this.pointer, prefixId, prefixBytes.length, suffixId, suffixBytes.length); - swift.memory.release(prefixId); - swift.memory.release(suffixId); } checkEvenCount() { const ret = instance.exports.bjs_MyViewController_checkEvenCount(this.pointer); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 892110aca..07f7a3c77 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -50,9 +50,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = () => { - swift.memory.release(id); - }; + const cleanup = undefined; return { caseId: APIResultValues.Tag.Success, cleanup }; } case APIResultValues.Tag.Failure: { @@ -93,6 +91,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -341,7 +340,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_Utils_String_static_uppercase(textId, textBytes.length); const ret = tmpRetString; tmpRetString = undefined; - swift.memory.release(textId); return ret; }, }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index f2c93adae..c2c3f9a70 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -50,9 +50,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = () => { - swift.memory.release(id); - }; + const cleanup = undefined; return { caseId: APIResultValues.Tag.Success, cleanup }; } case APIResultValues.Tag.Failure: { @@ -93,6 +91,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -335,7 +334,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_Utils_String_static_uppercase(textId, textBytes.length); const ret = tmpRetString; tmpRetString = undefined; - swift.memory.release(textId); return ret; }, }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index adb809f6f..3784b5a7e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -48,6 +48,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -279,7 +280,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_PropertyClass_static_classVariable_set(valueId, valueBytes.length); - swift.memory.release(valueId); } static get computedProperty() { instance.exports.bjs_PropertyClass_static_computedProperty_get(); @@ -291,7 +291,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_PropertyClass_static_computedProperty_set(valueId, valueBytes.length); - swift.memory.release(valueId); } static get readOnlyComputed() { const ret = instance.exports.bjs_PropertyClass_static_readOnlyComputed_get(); @@ -311,9 +310,6 @@ export async function createInstantiator(options, swift) { valueId = swift.memory.retain(valueBytes); } instance.exports.bjs_PropertyClass_static_optionalProperty_set(+isSome, isSome ? valueId : 0, isSome ? valueBytes.length : 0); - if (valueId != undefined) { - swift.memory.release(valueId); - } } } if (typeof globalThis.PropertyNamespace === 'undefined') { @@ -336,7 +332,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_PropertyEnum_static_enumProperty_set(valueId, valueBytes.length); - swift.memory.release(valueId); }, get enumConstant() { const ret = instance.exports.bjs_PropertyEnum_static_enumConstant_get(); @@ -352,7 +347,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_PropertyEnum_static_computedEnum_set(valueId, valueBytes.length); - swift.memory.release(valueId); } }, PropertyNamespace: { @@ -366,7 +360,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_PropertyNamespace_static_namespaceProperty_set(valueId, valueBytes.length); - swift.memory.release(valueId); }, get namespaceConstant() { instance.exports.bjs_PropertyNamespace_static_namespaceConstant_get(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index f1273821a..47f0092af 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -48,6 +48,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -279,7 +280,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_PropertyClass_static_classVariable_set(valueId, valueBytes.length); - swift.memory.release(valueId); } static get computedProperty() { instance.exports.bjs_PropertyClass_static_computedProperty_get(); @@ -291,7 +291,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_PropertyClass_static_computedProperty_set(valueId, valueBytes.length); - swift.memory.release(valueId); } static get readOnlyComputed() { const ret = instance.exports.bjs_PropertyClass_static_readOnlyComputed_get(); @@ -311,9 +310,6 @@ export async function createInstantiator(options, swift) { valueId = swift.memory.retain(valueBytes); } instance.exports.bjs_PropertyClass_static_optionalProperty_set(+isSome, isSome ? valueId : 0, isSome ? valueBytes.length : 0); - if (valueId != undefined) { - swift.memory.release(valueId); - } } } const exports = { @@ -330,7 +326,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_PropertyEnum_static_enumProperty_set(valueId, valueBytes.length); - swift.memory.release(valueId); }, get enumConstant() { const ret = instance.exports.bjs_PropertyEnum_static_enumConstant_get(); @@ -346,7 +341,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_PropertyEnum_static_computedEnum_set(valueId, valueBytes.length); - swift.memory.release(valueId); } }, PropertyNamespace: { @@ -360,7 +354,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_PropertyNamespace_static_namespaceProperty_set(valueId, valueBytes.length); - swift.memory.release(valueId); }, get namespaceConstant() { instance.exports.bjs_PropertyNamespace_static_namespaceConstant_get(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js index b81a4990b..0f92074d4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js @@ -44,6 +44,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -231,7 +232,6 @@ export async function createInstantiator(options, swift) { const aBytes = textEncoder.encode(a); const aId = swift.memory.retain(aBytes); instance.exports.bjs_checkString(aId, aBytes.length); - swift.memory.release(aId); }, roundtripString: function bjs_roundtripString(a) { const aBytes = textEncoder.encode(a); @@ -239,7 +239,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_roundtripString(aId, aBytes.length); const ret = tmpRetString; tmpRetString = undefined; - swift.memory.release(aId); return ret; }, }; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js index 112f853d4..f86fce218 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js @@ -44,6 +44,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index fc2fc58c6..9f8f93c5b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -44,6 +44,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -270,7 +271,6 @@ export async function createInstantiator(options, swift) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); const ret = instance.exports.bjs_Greeter_init(nameId, nameBytes.length); - swift.memory.release(nameId); return Greeter.__construct(ret); } greet() { @@ -283,7 +283,6 @@ export async function createInstantiator(options, swift) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); instance.exports.bjs_Greeter_changeName(this.pointer, nameId, nameBytes.length); - swift.memory.release(nameId); } get name() { instance.exports.bjs_Greeter_name_get(this.pointer); @@ -295,7 +294,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_Greeter_name_set(this.pointer, valueId, valueBytes.length); - swift.memory.release(valueId); } } class PublicGreeter extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 4df3d5018..3371cf1b3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -94,9 +94,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = () => { - swift.memory.release(id); - }; + const cleanup = undefined; return { caseId: APIResultValues.Tag.Success, cleanup }; } case APIResultValues.Tag.Failure: { @@ -169,6 +167,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -366,7 +365,6 @@ export async function createInstantiator(options, swift) { instance.exports.invoke_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO(boxPtr, param0Id, param0Bytes.length); const ret = tmpRetString; tmpRetString = undefined; - swift.memory.release(param0Id); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); @@ -469,7 +467,6 @@ export async function createInstantiator(options, swift) { instance.exports.invoke_swift_closure_TestModule_10TestModuleSS_SS(boxPtr, param0Id, param0Bytes.length); const ret = tmpRetString; tmpRetString = undefined; - swift.memory.release(param0Id); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); @@ -628,9 +625,6 @@ export async function createInstantiator(options, swift) { instance.exports.invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(boxPtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); const optResult = tmpRetString; tmpRetString = undefined; - if (param0Id != undefined) { - swift.memory.release(param0Id); - } if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); @@ -772,9 +766,6 @@ export async function createInstantiator(options, swift) { instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSS_SqSS(boxPtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); const optResult = tmpRetString; tmpRetString = undefined; - if (param0Id != undefined) { - swift.memory.release(param0Id); - } if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); @@ -941,7 +932,6 @@ export async function createInstantiator(options, swift) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); const ret = instance.exports.bjs_Person_init(nameId, nameBytes.length); - swift.memory.release(nameId); return Person.__construct(ret); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index 8744f5e45..61347e817 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -69,6 +69,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index dca01b33c..316dfb709 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -57,10 +57,7 @@ export async function createInstantiator(options, swift) { i32Stack.push(0); } i32Stack.push(isSome1 ? 1 : 0); - const cleanup = () => { - swift.memory.release(id); - }; - return { cleanup }; + return { cleanup: undefined }; }, lift: () => { const isSome = i32Stack.pop(); @@ -104,11 +101,7 @@ export async function createInstantiator(options, swift) { i32Stack.push(0); } i32Stack.push(isSome ? 1 : 0); - const cleanup = () => { - swift.memory.release(id); - swift.memory.release(id1); - }; - return { cleanup }; + return { cleanup: undefined }; }, lift: () => { const isSome = i32Stack.pop(); @@ -147,9 +140,7 @@ export async function createInstantiator(options, swift) { } i32Stack.push(isSome ? 1 : 0); const cleanup = () => { - swift.memory.release(id); if (structResult.cleanup) { structResult.cleanup(); } - if(id1 !== undefined) { swift.memory.release(id1); } }; return { cleanup }; }, @@ -287,6 +278,7 @@ export async function createInstantiator(options, swift) { } 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); } @@ -563,7 +555,6 @@ export async function createInstantiator(options, swift) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); const ret = instance.exports.bjs_Greeter_init(nameId, nameBytes.length); - swift.memory.release(nameId); return Greeter.__construct(ret); } greet() { @@ -582,7 +573,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_Greeter_name_set(this.pointer, valueId, valueBytes.length); - swift.memory.release(valueId); } } const DataPointHelpers = __bjs_createDataPointHelpers()(); @@ -631,7 +621,6 @@ export async function createInstantiator(options, swift) { const isSome1 = optFlag != null; instance.exports.bjs_DataPoint_init(x, y, labelId, labelBytes.length, +isSome, isSome ? optCount : 0, +isSome1, isSome1 ? optFlag : 0); const structValue = structHelpers.DataPoint.lift(); - swift.memory.release(labelId); return structValue; }, }, @@ -650,7 +639,6 @@ export async function createInstantiator(options, swift) { const valueBytes = textEncoder.encode(value); const valueId = swift.memory.retain(valueBytes); instance.exports.bjs_ConfigStruct_static_defaultConfig_set(valueId, valueBytes.length); - swift.memory.release(valueId); }, get timeout() { const ret = instance.exports.bjs_ConfigStruct_static_timeout_get(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index a33914d89..4962e659b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -58,6 +58,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js index e81050bf6..3726a48ae 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js @@ -43,6 +43,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index cdcd6db3a..7c3627d13 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -63,6 +63,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js index 05a16a3eb..e338c840d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js @@ -44,6 +44,7 @@ export async function createInstantiator(options, swift) { } 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); } diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index d761e7576..28bdaa6db 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -716,6 +716,12 @@ private func _swift_js_init_memory_extern(_ sourceId: Int32, _ ptr: UnsafeMutabl } #endif +/// Initializes WebAssembly memory with a Uint8Array referenced by `sourceId` at `ptr`. +/// Note that the ownership of the source Uint8Array id is taken by the callee, so callers +/// must not release the source Uint8Array id by themselves. +/// +/// - Parameter sourceId: The object ID of the source Uint8Array. +/// - Parameter ptr: The pointer to the WebAssembly memory to initialize. @_spi(BridgeJS) @inline(never) public func _swift_js_init_memory(_ sourceId: Int32, _ ptr: UnsafeMutablePointer) { _swift_js_init_memory_extern(sourceId, ptr) From 3fffd36d17a5c77648caf534aeb0bbf64d764648 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 16 Feb 2026 13:07:00 +0900 Subject: [PATCH 222/252] TS2Swift: Make it easier to use ts2swift directly --- .../Sources/TS2Swift/JavaScript/package.json | 3 +- .../Sources/TS2Swift/JavaScript/src/cli.js | 61 +++++++++++-------- .../TS2Swift/JavaScript/src/processor.js | 34 +++++------ .../TS2Swift/JavaScript/test/ts2swift.test.js | 2 +- .../Sources/TS2Swift/JavaScript/tsconfig.json | 14 +++++ 5 files changed, 70 insertions(+), 44 deletions(-) create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/tsconfig.json diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json index de3af1ab8..0c8a50c48 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json @@ -7,6 +7,7 @@ "ts2swift": "./bin/ts2swift.js" }, "scripts": { - "test": "vitest run" + "test": "vitest run", + "tsc": "tsc --noEmit" } } diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js index 98453ebf1..89f35d0ea 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js @@ -7,7 +7,7 @@ import path from 'path'; class DiagnosticEngine { /** - * @param {string} level + * @param {keyof typeof DiagnosticEngine.LEVELS} level */ constructor(level) { const levelInfo = DiagnosticEngine.LEVELS[level]; @@ -73,20 +73,18 @@ class DiagnosticEngine { } function printUsage() { - console.error('Usage: ts2swift -p [--global ]... [-o output.swift]'); + console.error('Usage: ts2swift ... [-p ] [--global ]... [-o output.swift]'); } /** * Run ts2swift for a single input file (programmatic API, no process I/O). - * @param {string} filePath - Path to the .d.ts file - * @param {{ tsconfigPath: string, logLevel?: string, globalFiles?: string[] }} options + * @param {string[]} filePaths - Paths to the .d.ts files + * @param {{ tsconfigPath: string, logLevel?: keyof typeof DiagnosticEngine.LEVELS, globalFiles?: string[] }} options * @returns {string} Generated Swift source * @throws {Error} on parse/type-check errors (diagnostics are included in the message) */ -export function run(filePath, options) { - const { tsconfigPath, logLevel = 'info', globalFiles: globalFilesOpt = [] } = options; - const globalFiles = Array.isArray(globalFilesOpt) ? globalFilesOpt : (globalFilesOpt ? [globalFilesOpt] : []); - +export function run(filePaths, options) { + const { tsconfigPath, logLevel = 'info', globalFiles = [] } = options; const diagnosticEngine = new DiagnosticEngine(logLevel); const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile); @@ -105,7 +103,7 @@ export function run(filePath, options) { throw new Error(`TypeScript config/parse errors:\n${message}`); } - const program = TypeProcessor.createProgram([filePath, ...globalFiles], configParseResult.options); + const program = TypeProcessor.createProgram([...filePaths, ...globalFiles], configParseResult.options); const diagnostics = program.getSemanticDiagnostics(); if (diagnostics.length > 0) { const message = ts.formatDiagnosticsWithColorAndContext(diagnostics, { @@ -131,7 +129,7 @@ export function run(filePath, options) { /** @type {string[]} */ const bodies = []; const globalFileSet = new Set(globalFiles); - for (const inputPath of [filePath, ...globalFiles]) { + for (const inputPath of [...filePaths, ...globalFiles]) { const processor = new TypeProcessor(program.getTypeChecker(), diagnosticEngine, { defaultImportFromGlobal: globalFileSet.has(inputPath), }); @@ -169,39 +167,52 @@ export function main(args) { type: 'string', default: 'info', }, + help: { + type: 'boolean', + short: 'h', + }, }, allowPositionals: true }) - if (options.positionals.length !== 1) { + if (options.values.help) { printUsage(); - process.exit(1); + process.exit(0); } - const tsconfigPath = options.values.project; - if (!tsconfigPath) { + if (options.positionals.length !== 1) { printUsage(); process.exit(1); } - const filePath = options.positionals[0]; - const logLevel = options.values["log-level"] || "info"; - /** @type {string[]} */ - const globalFiles = Array.isArray(options.values.global) - ? options.values.global - : (options.values.global ? [options.values.global] : []); + const filePaths = options.positionals; + const logLevel = /** @type {keyof typeof DiagnosticEngine.LEVELS} */ ((() => { + const logLevel = options.values["log-level"] || "info"; + if (!Object.keys(DiagnosticEngine.LEVELS).includes(logLevel)) { + console.error(`Invalid log level: ${logLevel}. Valid levels are: ${Object.keys(DiagnosticEngine.LEVELS).join(", ")}`); + process.exit(1); + } + return logLevel; + })()); + const globalFiles = options.values.global || []; + const tsconfigPath = options.values.project || "tsconfig.json"; const diagnosticEngine = new DiagnosticEngine(logLevel); - diagnosticEngine.print("verbose", `Processing ${filePath}...`); + diagnosticEngine.print("verbose", `Processing ${filePaths.join(", ")}`); let swiftOutput; try { - swiftOutput = run(filePath, { tsconfigPath, logLevel, globalFiles }); - } catch (err) { - console.error(err.message); + swiftOutput = run(filePaths, { tsconfigPath, logLevel, globalFiles }); + } catch (/** @type {unknown} */ err) { + if (err instanceof Error) { + diagnosticEngine.print("error", err.message); + } else { + diagnosticEngine.print("error", String(err)); + } process.exit(1); } - if (options.values.output) { + // Write to file or stdout + if (options.values.output && options.values.output !== "-") { if (swiftOutput.length > 0) { fs.mkdirSync(path.dirname(options.values.output), { recursive: true }); fs.writeFileSync(options.values.output, swiftOutput); diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index c71ff6fe5..53216a78c 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -20,14 +20,13 @@ import ts from 'typescript'; export class TypeProcessor { /** * Create a TypeScript program from a d.ts file - * @param {string} filePath - Path to the d.ts file + * @param {string[]} filePaths - Paths to the d.ts file * @param {ts.CompilerOptions} options - Compiler options * @returns {ts.Program} TypeScript program object */ static createProgram(filePaths, options) { const host = ts.createCompilerHost(options); - const roots = Array.isArray(filePaths) ? filePaths : [filePaths]; - return ts.createProgram(roots, { + return ts.createProgram(filePaths, { ...options, noCheck: true, skipLibCheck: true, @@ -39,14 +38,7 @@ export class TypeProcessor { * @param {DiagnosticEngine} diagnosticEngine - Diagnostic engine */ constructor(checker, diagnosticEngine, options = { - inheritIterable: true, - inheritArraylike: true, - inheritPromiselike: true, - addAllParentMembersToClass: true, - replaceAliasToFunction: true, - replaceRankNFunction: true, - replaceNewableFunction: true, - noExtendsInTyprm: false, + defaultImportFromGlobal: false, }) { this.checker = checker; this.diagnosticEngine = diagnosticEngine; @@ -163,8 +155,12 @@ export class TypeProcessor { } } }); - } catch (error) { - this.diagnosticEngine.print("error", `Error processing ${sourceFile.fileName}: ${error.message}`); + } catch (/** @type {unknown} */ error) { + if (error instanceof Error) { + this.diagnosticEngine.print("error", `Error processing ${sourceFile.fileName}: ${error.message}`); + } else { + this.diagnosticEngine.print("error", `Error processing ${sourceFile.fileName}: ${String(error)}`); + } } } @@ -388,7 +384,7 @@ export class TypeProcessor { canBeIntEnum = false; } const swiftEnumName = this.renderTypeIdentifier(enumName); - const dedupeNames = (items) => { + const dedupeNames = (/** @type {{ name: string, raw: string | number }[]} */ items) => { const seen = new Map(); return items.map(item => { const count = seen.get(item.name) ?? 0; @@ -401,6 +397,10 @@ export class TypeProcessor { if (canBeStringEnum && stringMembers.length > 0) { this.swiftLines.push(`enum ${swiftEnumName}: String {`); for (const { name, raw } of dedupeNames(stringMembers)) { + if (typeof raw !== "string") { + this.diagnosticEngine.print("warning", `Invalid string literal: ${raw}`, diagnosticNode); + continue; + } this.swiftLines.push(` case ${this.renderIdentifier(name)} = "${raw.replaceAll("\"", "\\\\\"")}"`); } this.swiftLines.push("}"); @@ -815,7 +815,7 @@ export class TypeProcessor { visitType(type, node) { const typeArguments = this.getTypeArguments(type); if (this.checker.isArrayType(type)) { - const typeArgs = this.checker.getTypeArguments(type); + const typeArgs = this.checker.getTypeArguments(/** @type {ts.TypeReference} */ (type)); if (typeArgs && typeArgs.length > 0) { const elementType = this.visitType(typeArgs[0], node); return `[${elementType}]`; @@ -920,7 +920,7 @@ export class TypeProcessor { * Convert a `Record` TypeScript type into a Swift dictionary type. * Falls back to `JSObject` when keys are not string-compatible or type arguments are missing. * @param {ts.Type} type - * @param {ts.Type[]} typeArguments + * @param {readonly ts.Type[]} typeArguments * @param {ts.Node} node * @returns {string | null} * @private @@ -952,7 +952,7 @@ export class TypeProcessor { /** * Retrieve type arguments for a given type, including type alias instantiations. * @param {ts.Type} type - * @returns {ts.Type[]} + * @returns {readonly ts.Type[]} * @private */ getTypeArguments(type) { diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js index a65386924..8ca1df7c9 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js @@ -12,7 +12,7 @@ const inputsDir = path.resolve(__dirname, 'fixtures'); const tsconfigPath = path.join(inputsDir, 'tsconfig.json'); function runTs2Swift(dtsPath) { - return run(dtsPath, { tsconfigPath, logLevel: 'error' }); + return run([dtsPath], { tsconfigPath, logLevel: 'error' }); } function collectDtsInputs() { diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/tsconfig.json b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/tsconfig.json new file mode 100644 index 000000000..ed3dcf4bf --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "strict": true, + "allowJs": true, + "skipLibCheck": true, + "noEmit": true, + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "nodenext" + }, + "include": [ + "src/*.js" + ] +} From 8abb79d13e10139ac45963cb0e3d1f5a023ef117 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 16 Feb 2026 13:16:47 +0900 Subject: [PATCH 223/252] TS2Swift: Support reading from stdin --- .../Sources/TS2Swift/JavaScript/src/cli.js | 41 +++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js index 89f35d0ea..25d88b828 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js @@ -1,9 +1,10 @@ // @ts-check import * as fs from 'fs'; -import { TypeProcessor } from './processor.js'; +import os from 'os'; +import path from 'path'; import { parseArgs } from 'util'; import ts from 'typescript'; -import path from 'path'; +import { TypeProcessor } from './processor.js'; class DiagnosticEngine { /** @@ -73,7 +74,24 @@ class DiagnosticEngine { } function printUsage() { - console.error('Usage: ts2swift ... [-p ] [--global ]... [-o output.swift]'); + console.error(`Usage: ts2swift [options] + + Path to a .d.ts file, or "-" to read from stdin + +Options: + -o, --output Write Swift to . Use "-" for stdout (default). + -p, --project Path to tsconfig.json (default: tsconfig.json). + --global Add a .d.ts as a global declaration file (repeatable). + --log-level One of: verbose, info, warning, error (default: info). + -h, --help Show this help. + +Examples: + ts2swift lib.d.ts + ts2swift lib.d.ts -o Generated.swift + ts2swift lib.d.ts -p ./tsconfig.build.json -o Sources/Bridge/API.swift + cat lib.d.ts | ts2swift - -o Generated.swift + ts2swift lib.d.ts --global dom.d.ts --global lib.d.ts +`); } /** @@ -185,7 +203,18 @@ export function main(args) { process.exit(1); } - const filePaths = options.positionals; + /** @type {string[]} */ + let filePaths = options.positionals; + /** @type {(() => void)[]} cleanup functions to run after completion */ + const cleanups = []; + + if (filePaths[0] === '-') { + const content = fs.readFileSync(0, 'utf-8'); + const stdinTempPath = path.join(os.tmpdir(), `ts2swift-stdin-${process.pid}-${Date.now()}.d.ts`); + fs.writeFileSync(stdinTempPath, content); + cleanups.push(() => fs.unlinkSync(stdinTempPath)); + filePaths = [stdinTempPath]; + } const logLevel = /** @type {keyof typeof DiagnosticEngine.LEVELS} */ ((() => { const logLevel = options.values["log-level"] || "info"; if (!Object.keys(DiagnosticEngine.LEVELS).includes(logLevel)) { @@ -210,6 +239,10 @@ export function main(args) { diagnosticEngine.print("error", String(err)); } process.exit(1); + } finally { + for (const cleanup of cleanups) { + cleanup(); + } } // Write to file or stdout if (options.values.output && options.values.output !== "-") { From 9589496efabbc294678183be55f176460d0b8d8b Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Mon, 16 Feb 2026 11:49:07 +0100 Subject: [PATCH 224/252] BridgeJS: Add additionalSourceDirs config for cross-plugin file discovery --- .../BridgeJSBuildPlugin.swift | 58 ++++++++++++++++++- .../BridgeJS/Sources/BridgeJSCore/Misc.swift | 43 +++++++++++++- .../Sources/BridgeJSTool/BridgeJSTool.swift | 11 ++++ 3 files changed, 109 insertions(+), 3 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift b/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift index aec9f3bca..55015d41b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift @@ -32,6 +32,11 @@ struct BridgeJSBuildPlugin: BuildToolPlugin { inputFiles.append(configFile) } + let additionalDirs = resolveAdditionalSourceDirs(targetDirectory: target.directoryURL) + for dir in additionalDirs { + inputFiles.append(contentsOf: recursivelyCollectSwiftFiles(from: dir)) + } + let inputTSFile = target.directoryURL.appending(path: "bridge-js.d.ts") let tsconfigPath = context.package.directoryURL.appending(path: "tsconfig.json") @@ -47,7 +52,6 @@ struct BridgeJSBuildPlugin: BuildToolPlugin { ] if FileManager.default.fileExists(atPath: inputTSFile.path) { - // Add .d.ts file and tsconfig.json as inputs inputFiles.append(contentsOf: [inputTSFile, tsconfigPath]) arguments.append(contentsOf: [ "--project", @@ -66,4 +70,56 @@ struct BridgeJSBuildPlugin: BuildToolPlugin { ) } } + +private struct PluginConfig: Decodable { + var additionalSourceDirs: [String]? +} + +private func resolveAdditionalSourceDirs(targetDirectory: URL) -> [URL] { + let configFiles = [ + targetDirectory.appending(path: "bridge-js.config.json"), + targetDirectory.appending(path: "bridge-js.config.local.json"), + ] + var dirs: [String] = [] + for file in configFiles { + guard FileManager.default.fileExists(atPath: file.path), + let data = try? Data(contentsOf: file), + let config = try? JSONDecoder().decode(PluginConfig.self, from: data), + let additional = config.additionalSourceDirs + else { continue } + dirs.append(contentsOf: additional) + } + return dirs.compactMap { dir in + let resolved = targetDirectory.appending(path: dir).standardized + var isDirectory: ObjCBool = false + guard FileManager.default.fileExists(atPath: resolved.path, isDirectory: &isDirectory), + isDirectory.boolValue + else { + return nil + } + return resolved + } +} + +private func recursivelyCollectSwiftFiles(from directory: URL) -> [URL] { + var swiftFiles: [URL] = [] + guard + let enumerator = FileManager.default.enumerator( + at: directory, + includingPropertiesForKeys: [.isRegularFileKey], + options: [.skipsHiddenFiles] + ) + else { + return [] + } + for case let fileURL as URL in enumerator { + if fileURL.pathExtension == "swift" { + let resourceValues = try? fileURL.resourceValues(forKeys: [.isRegularFileKey]) + if resourceValues?.isRegularFile == true { + swiftFiles.append(fileURL) + } + } + } + return swiftFiles.sorted { $0.path < $1.path } +} #endif diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift index 9db11b14d..2b166d1be 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift @@ -309,6 +309,7 @@ public struct BridgeJSCoreError: Swift.Error, CustomStringConvertible { import struct Foundation.URL import struct Foundation.Data +import struct Foundation.ObjCBool import class Foundation.FileManager import class Foundation.JSONDecoder @@ -328,20 +329,33 @@ public struct BridgeJSConfig: Codable { /// Default: `false` public var exposeToGlobal: Bool - public init(tools: [String: String]? = nil, exposeToGlobal: Bool = false) { + /// Additional directories containing Swift source files to scan for + /// `@JS` annotations. + /// + /// Paths are resolved relative to the target directory. This is useful + /// when Swift files with `@JS` annotations are generated by another + /// build plugin whose outputs aren't included in `target.sourceFiles`. + /// + /// Default: `nil` (no additional directories) + public var additionalSourceDirs: [String]? + + public init(tools: [String: String]? = nil, exposeToGlobal: Bool = false, additionalSourceDirs: [String]? = nil) { self.tools = tools self.exposeToGlobal = exposeToGlobal + self.additionalSourceDirs = additionalSourceDirs } enum CodingKeys: String, CodingKey { case tools case exposeToGlobal + case additionalSourceDirs } 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 + additionalSourceDirs = try container.decodeIfPresent([String].self, forKey: .additionalSourceDirs) } /// Load the configuration file from the SwiftPM package target directory. @@ -380,11 +394,36 @@ public struct BridgeJSConfig: Codable { return try JSONDecoder().decode(BridgeJSConfig.self, from: data) } + /// Resolve additional source directories relative to a base URL. + /// + /// Returns absolute URLs for each configured additional source directory. + /// Directories that don't exist are silently skipped. + public func resolveAdditionalSourceDirs(relativeTo baseURL: URL) -> [URL] { + guard let dirs = additionalSourceDirs else { return [] } + return dirs.compactMap { dir in + let resolved = baseURL.appending(path: dir).standardized + var isDirectory: ObjCBool = false + guard FileManager.default.fileExists(atPath: resolved.path, isDirectory: &isDirectory), + isDirectory.boolValue + else { + return nil + } + return resolved + } + } + /// Merge the current configuration with the overrides. func merging(overrides: BridgeJSConfig) -> BridgeJSConfig { + let mergedDirs: [String]? = { + let base = self.additionalSourceDirs ?? [] + let extra = overrides.additionalSourceDirs ?? [] + let combined = base + extra + return combined.isEmpty ? nil : combined + }() return BridgeJSConfig( tools: (tools ?? [:]).merging(overrides.tools ?? [:], uniquingKeysWith: { $1 }), - exposeToGlobal: overrides.exposeToGlobal + exposeToGlobal: overrides.exposeToGlobal, + additionalSourceDirs: mergedDirs ) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index 3b784b732..a699dc9c8 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -146,6 +146,17 @@ import BridgeJSUtilities var inputFiles = withSpan("Collecting Swift files") { return inputSwiftFiles(targetDirectory: targetDirectory, positionalArguments: positionalArguments) } + + let additionalDirs = config.resolveAdditionalSourceDirs(relativeTo: targetDirectory) + for dir in additionalDirs { + let additionalFiles = recursivelyCollectSwiftFiles(from: dir).map(\.path) + .filter { !inputFiles.contains($0) } + if !additionalFiles.isEmpty { + progress.print("Found \(additionalFiles.count) additional Swift files in \(dir.lastPathComponent)") + } + inputFiles.append(contentsOf: additionalFiles) + } + // BridgeJS.Macros.swift contains imported declarations (@JSFunction, @JSClass, etc.) that need // to be processed by SwiftToSkeleton to populate the imported skeleton. The command plugin // filters out Generated/ files, so we explicitly add it here after generation. From 53f69d4522c0aa971aeef9e901607b48a3a92441 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Mon, 16 Feb 2026 12:57:43 +0100 Subject: [PATCH 225/252] BridgeJS: Test different approach for cross-plugin file discovery --- .../BridgeJSBuildPlugin.swift | 65 +++---------------- .../BridgeJS/Sources/BridgeJSCore/Misc.swift | 43 +----------- .../Sources/BridgeJSTool/BridgeJSTool.swift | 10 --- 3 files changed, 11 insertions(+), 107 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift b/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift index 55015d41b..3cb6dc860 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift @@ -32,10 +32,14 @@ struct BridgeJSBuildPlugin: BuildToolPlugin { inputFiles.append(configFile) } - let additionalDirs = resolveAdditionalSourceDirs(targetDirectory: target.directoryURL) - for dir in additionalDirs { - inputFiles.append(contentsOf: recursivelyCollectSwiftFiles(from: dir)) + // Include Swift files generated by other plugins applied to this + // target (available in tools-version 6.0+). This lets BridgeJS + // process @JS annotations in files produced by earlier plugins + // without requiring any extra configuration. + let pluginGeneratedSwiftFiles = target.pluginGeneratedSources.filter { + $0.pathExtension == "swift" } + inputFiles.append(contentsOf: pluginGeneratedSwiftFiles) let inputTSFile = target.directoryURL.appending(path: "bridge-js.d.ts") let tsconfigPath = context.package.directoryURL.appending(path: "tsconfig.json") @@ -59,7 +63,8 @@ struct BridgeJSBuildPlugin: BuildToolPlugin { ]) } - arguments.append(contentsOf: inputSwiftFiles.map(\.path)) + let allSwiftFiles = inputSwiftFiles + pluginGeneratedSwiftFiles + arguments.append(contentsOf: allSwiftFiles.map(\.path)) return .buildCommand( displayName: "Generate BridgeJS code", @@ -70,56 +75,4 @@ struct BridgeJSBuildPlugin: BuildToolPlugin { ) } } - -private struct PluginConfig: Decodable { - var additionalSourceDirs: [String]? -} - -private func resolveAdditionalSourceDirs(targetDirectory: URL) -> [URL] { - let configFiles = [ - targetDirectory.appending(path: "bridge-js.config.json"), - targetDirectory.appending(path: "bridge-js.config.local.json"), - ] - var dirs: [String] = [] - for file in configFiles { - guard FileManager.default.fileExists(atPath: file.path), - let data = try? Data(contentsOf: file), - let config = try? JSONDecoder().decode(PluginConfig.self, from: data), - let additional = config.additionalSourceDirs - else { continue } - dirs.append(contentsOf: additional) - } - return dirs.compactMap { dir in - let resolved = targetDirectory.appending(path: dir).standardized - var isDirectory: ObjCBool = false - guard FileManager.default.fileExists(atPath: resolved.path, isDirectory: &isDirectory), - isDirectory.boolValue - else { - return nil - } - return resolved - } -} - -private func recursivelyCollectSwiftFiles(from directory: URL) -> [URL] { - var swiftFiles: [URL] = [] - guard - let enumerator = FileManager.default.enumerator( - at: directory, - includingPropertiesForKeys: [.isRegularFileKey], - options: [.skipsHiddenFiles] - ) - else { - return [] - } - for case let fileURL as URL in enumerator { - if fileURL.pathExtension == "swift" { - let resourceValues = try? fileURL.resourceValues(forKeys: [.isRegularFileKey]) - if resourceValues?.isRegularFile == true { - swiftFiles.append(fileURL) - } - } - } - return swiftFiles.sorted { $0.path < $1.path } -} #endif diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift index 2b166d1be..9db11b14d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift @@ -309,7 +309,6 @@ public struct BridgeJSCoreError: Swift.Error, CustomStringConvertible { import struct Foundation.URL import struct Foundation.Data -import struct Foundation.ObjCBool import class Foundation.FileManager import class Foundation.JSONDecoder @@ -329,33 +328,20 @@ public struct BridgeJSConfig: Codable { /// Default: `false` public var exposeToGlobal: Bool - /// Additional directories containing Swift source files to scan for - /// `@JS` annotations. - /// - /// Paths are resolved relative to the target directory. This is useful - /// when Swift files with `@JS` annotations are generated by another - /// build plugin whose outputs aren't included in `target.sourceFiles`. - /// - /// Default: `nil` (no additional directories) - public var additionalSourceDirs: [String]? - - public init(tools: [String: String]? = nil, exposeToGlobal: Bool = false, additionalSourceDirs: [String]? = nil) { + public init(tools: [String: String]? = nil, exposeToGlobal: Bool = false) { self.tools = tools self.exposeToGlobal = exposeToGlobal - self.additionalSourceDirs = additionalSourceDirs } enum CodingKeys: String, CodingKey { case tools case exposeToGlobal - case additionalSourceDirs } 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 - additionalSourceDirs = try container.decodeIfPresent([String].self, forKey: .additionalSourceDirs) } /// Load the configuration file from the SwiftPM package target directory. @@ -394,36 +380,11 @@ public struct BridgeJSConfig: Codable { return try JSONDecoder().decode(BridgeJSConfig.self, from: data) } - /// Resolve additional source directories relative to a base URL. - /// - /// Returns absolute URLs for each configured additional source directory. - /// Directories that don't exist are silently skipped. - public func resolveAdditionalSourceDirs(relativeTo baseURL: URL) -> [URL] { - guard let dirs = additionalSourceDirs else { return [] } - return dirs.compactMap { dir in - let resolved = baseURL.appending(path: dir).standardized - var isDirectory: ObjCBool = false - guard FileManager.default.fileExists(atPath: resolved.path, isDirectory: &isDirectory), - isDirectory.boolValue - else { - return nil - } - return resolved - } - } - /// Merge the current configuration with the overrides. func merging(overrides: BridgeJSConfig) -> BridgeJSConfig { - let mergedDirs: [String]? = { - let base = self.additionalSourceDirs ?? [] - let extra = overrides.additionalSourceDirs ?? [] - let combined = base + extra - return combined.isEmpty ? nil : combined - }() return BridgeJSConfig( tools: (tools ?? [:]).merging(overrides.tools ?? [:], uniquingKeysWith: { $1 }), - exposeToGlobal: overrides.exposeToGlobal, - additionalSourceDirs: mergedDirs + exposeToGlobal: overrides.exposeToGlobal ) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index a699dc9c8..f7adbfb8e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -147,16 +147,6 @@ import BridgeJSUtilities return inputSwiftFiles(targetDirectory: targetDirectory, positionalArguments: positionalArguments) } - let additionalDirs = config.resolveAdditionalSourceDirs(relativeTo: targetDirectory) - for dir in additionalDirs { - let additionalFiles = recursivelyCollectSwiftFiles(from: dir).map(\.path) - .filter { !inputFiles.contains($0) } - if !additionalFiles.isEmpty { - progress.print("Found \(additionalFiles.count) additional Swift files in \(dir.lastPathComponent)") - } - inputFiles.append(contentsOf: additionalFiles) - } - // BridgeJS.Macros.swift contains imported declarations (@JSFunction, @JSClass, etc.) that need // to be processed by SwiftToSkeleton to populate the imported skeleton. The command plugin // filters out Generated/ files, so we explicitly add it here after generation. From 96c691b84d6721043049364e54e31196fd1111b8 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Mon, 16 Feb 2026 13:31:37 +0100 Subject: [PATCH 226/252] BridgeJS: Skip writing output files when content is unchanged --- .../Sources/BridgeJSTool/BridgeJSTool.swift | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index 3b784b732..2f742318b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -225,7 +225,7 @@ import BridgeJSUtilities withIntermediateDirectories: true, attributes: nil ) - try outputSwift.write(to: outputSwiftURL, atomically: true, encoding: .utf8) + try writeIfChanged(outputSwift, to: outputSwiftURL) } } @@ -240,7 +240,7 @@ import BridgeJSUtilities let encoder = JSONEncoder() encoder.outputFormatting = [.prettyPrinted, .sortedKeys] let skeletonData = try encoder.encode(skeleton) - try skeletonData.write(to: outputSkeletonURL) + try writeIfChanged(skeletonData, to: outputSkeletonURL) } if skeleton.exported != nil || skeleton.imported != nil { @@ -282,6 +282,18 @@ private func hasBridgeJSSkipComment(_ content: String) -> Bool { BridgeJSGeneratedFile.hasSkipComment(content) } +private func writeIfChanged(_ content: String, to url: URL) throws { + let existing = try? String(contentsOf: url, encoding: .utf8) + guard existing != content else { return } + try content.write(to: url, atomically: true, encoding: .utf8) +} + +private func writeIfChanged(_ data: Data, to url: URL) throws { + let existing = try? Data(contentsOf: url) + guard existing != data else { return } + try data.write(to: url) +} + private func combineGeneratedSwift(_ pieces: [String]) -> String { let trimmedPieces = pieces From 4d7b7733a6e63328b0174627ad0a0c25a96e4b0c Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 17 Feb 2026 16:10:46 +0900 Subject: [PATCH 227/252] BridgeJS: Fix `@JSClass` on public/package access level struct Also cover more access levels in `@JSFunction` tests. --- .../Sources/BridgeJSMacros/JSClassMacro.swift | 57 +++++++- .../BridgeJSMacros/JSMacroSupport.swift | 4 + .../JSClassMacroTests.swift | 98 +++++++++++++ .../Generated/BridgeJS.swift | 131 +++++++++++++++++ .../Generated/JavaScript/BridgeJS.json | 132 ++++++++++++++++++ .../JSClassCompileTests.swift | 11 ++ .../JSFunctionCompileTests.swift | 7 + 7 files changed, 438 insertions(+), 2 deletions(-) create mode 100644 Tests/BridgeJSRuntimeTests/MacroCompileTests/JSClassCompileTests.swift create mode 100644 Tests/BridgeJSRuntimeTests/MacroCompileTests/JSFunctionCompileTests.swift diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift index 79c3105ee..c44655c7e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift @@ -47,6 +47,21 @@ extension JSClassMacro: MemberMacro { } var members: [DeclSyntax] = [] + guard let structDecl = declaration.as(StructDeclSyntax.self) else { return members } + + if let accessLevel = accessLevel(from: structDecl.modifiers), + accessLevel == .private || accessLevel == .fileprivate + { + context.diagnose( + Diagnostic( + node: Syntax(structDecl), + message: JSMacroMessage.jsClassRequiresAtLeastInternal + ) + ) + return [] + } + + let memberAccessModifier = synthesizedMemberAccessModifier(for: declaration).map { "\($0) " } ?? "" let existingMembers = declaration.memberBlock.members let hasJSObjectProperty = existingMembers.contains { member in @@ -57,7 +72,7 @@ extension JSClassMacro: MemberMacro { } if !hasJSObjectProperty { - members.append(DeclSyntax("let jsObject: JSObject")) + members.append(DeclSyntax("\(raw: memberAccessModifier)let jsObject: JSObject")) } let hasUnsafelyWrappingInit = existingMembers.contains { member in @@ -73,7 +88,7 @@ extension JSClassMacro: MemberMacro { members.append( DeclSyntax( """ - init(unsafelyWrapping jsObject: JSObject) { + \(raw: memberAccessModifier)init(unsafelyWrapping jsObject: JSObject) { self.jsObject = jsObject } """ @@ -95,6 +110,11 @@ extension JSClassMacro: ExtensionMacro { ) throws -> [ExtensionDeclSyntax] { guard let structDecl = declaration.as(StructDeclSyntax.self) else { return [] } guard !protocols.isEmpty else { return [] } + if let accessLevel = accessLevel(from: structDecl.modifiers), + accessLevel == .private || accessLevel == .fileprivate + { + return [] + } // Do not add extension if the struct already conforms to _JSBridgedClass if let clause = structDecl.inheritanceClause, @@ -108,4 +128,37 @@ extension JSClassMacro: ExtensionMacro { try ExtensionDeclSyntax("extension \(type.trimmed): \(raw: conformanceList) {}") ] } + + private static func synthesizedMemberAccessModifier(for declaration: some DeclGroupSyntax) -> String? { + guard let structDecl = declaration.as(StructDeclSyntax.self) else { return nil } + switch accessLevel(from: structDecl.modifiers) { + case .public: return "public" + case .package: return "package" + case .internal: return "internal" + case .fileprivate, .private, .none: return nil + } + } + + private enum AccessLevel { + case `public` + case package + case `internal` + case `fileprivate` + case `private` + } + + private static func accessLevel(from modifiers: DeclModifierListSyntax?) -> AccessLevel? { + guard let modifiers else { return nil } + for modifier in modifiers { + switch modifier.name.tokenKind { + case .keyword(.public): return .public + case .keyword(.package): return .package + case .keyword(.internal): return .internal + case .keyword(.fileprivate): return .fileprivate + case .keyword(.private): return .private + default: continue + } + } + return nil + } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift index c30d91dd1..224462ddb 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift @@ -14,6 +14,10 @@ enum JSMacroMessage: String, DiagnosticMessage { case setterRequiresThrows = "@JSSetter function must declare throws(JSException)." case jsFunctionRequiresThrows = "@JSFunction throws must be declared as throws(JSException)." case requiresJSClass = "JavaScript members must be declared inside a @JSClass struct." + case jsClassRequiresAtLeastInternal = + "@JSClass does not support private/fileprivate access level. Use internal, package, or public." + case jsClassMemberRequiresAtLeastInternal = + "@JSClass requires jsObject and init(unsafelyWrapping:) to be at least internal." var message: String { rawValue } var diagnosticID: MessageID { MessageID(domain: "JavaScriptKitMacros", id: rawValue) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift index 86a1f6b7c..77dc814eb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift @@ -370,4 +370,102 @@ import BridgeJSMacros indentationWidth: indentationWidth ) } + + @Test func publicStructSynthesizesPublicMembers() { + TestSupport.assertMacroExpansion( + """ + @JSClass + public struct MyClass { + } + """, + expandedSource: """ + public struct MyClass { + + public let jsObject: JSObject + + public init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + + extension MyClass: _JSBridgedClass { + } + """, + macroSpecs: macroSpecs, + indentationWidth: indentationWidth + ) + } + + @Test func packageStructSynthesizesPackageMembers() { + TestSupport.assertMacroExpansion( + """ + @JSClass + package struct MyClass { + } + """, + expandedSource: """ + package struct MyClass { + + package let jsObject: JSObject + + package init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + + extension MyClass: _JSBridgedClass { + } + """, + macroSpecs: macroSpecs, + indentationWidth: indentationWidth + ) + } + + @Test func privateStructIsRejected() { + TestSupport.assertMacroExpansion( + """ + @JSClass + private struct MyClass { + } + """, + expandedSource: """ + private struct MyClass { + } + """, + diagnostics: [ + DiagnosticSpec( + message: + "@JSClass does not support private/fileprivate access level. Use internal, package, or public.", + line: 1, + column: 1 + ) + ], + macroSpecs: macroSpecs, + indentationWidth: indentationWidth + ) + } + + @Test func fileprivateStructIsRejected() { + TestSupport.assertMacroExpansion( + """ + @JSClass + fileprivate struct MyClass { + } + """, + expandedSource: """ + fileprivate struct MyClass { + } + """, + diagnostics: [ + DiagnosticSpec( + message: + "@JSClass does not support private/fileprivate access level. Use internal, package, or public.", + line: 1, + column: 1 + ) + ], + macroSpecs: macroSpecs, + indentationWidth: indentationWidth + ) + } } diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 96ca9be2e..78c9014d7 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -10156,6 +10156,137 @@ func _$jsTranslatePoint(_ point: Point, _ dx: Int, _ dy: Int) throws(JSException return Point.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MyJSClassInternal_init") +fileprivate func bjs_MyJSClassInternal_init() -> Int32 +#else +fileprivate func bjs_MyJSClassInternal_init() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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() -> Int32 +#else +fileprivate func bjs_MyJSClassPublic_init() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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() -> Int32 +#else +fileprivate func bjs_MyJSClassPackage_init() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +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() -> Void +#else +fileprivate func bjs_jsFunctionWithPackageAccess() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +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() -> Void +#else +fileprivate func bjs_jsFunctionWithPublicAccess() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +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() -> Void +#else +fileprivate func bjs_jsFunctionWithInternalAccess() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +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() -> Void +#else +fileprivate func bjs_jsFunctionWithFilePrivateAccess() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +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() -> Void +#else +fileprivate func bjs_jsFunctionWithPrivateAccess() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +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(_ valueIsSome: Int32, _ valueValue: Int32) -> Void diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 9c086c808..2cd992ea4 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -15297,6 +15297,138 @@ { "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" : [ + { + "name" : "jsFunctionWithPackageAccess", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "jsFunctionWithPublicAccess", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "jsFunctionWithInternalAccess", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "jsFunctionWithFilePrivateAccess", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "jsFunctionWithPrivateAccess", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "types" : [ + + ] + }, + { + "functions" : [ + ], "types" : [ { diff --git a/Tests/BridgeJSRuntimeTests/MacroCompileTests/JSClassCompileTests.swift b/Tests/BridgeJSRuntimeTests/MacroCompileTests/JSClassCompileTests.swift new file mode 100644 index 000000000..05a23d9de --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/MacroCompileTests/JSClassCompileTests.swift @@ -0,0 +1,11 @@ +import JavaScriptKit + +@JSClass(from: .global) internal struct MyJSClassInternal { + @JSFunction init() throws(JSException) +} +@JSClass(from: .global) public struct MyJSClassPublic { + @JSFunction init() throws(JSException) +} +@JSClass(from: .global) package struct MyJSClassPackage { + @JSFunction init() throws(JSException) +} diff --git a/Tests/BridgeJSRuntimeTests/MacroCompileTests/JSFunctionCompileTests.swift b/Tests/BridgeJSRuntimeTests/MacroCompileTests/JSFunctionCompileTests.swift new file mode 100644 index 000000000..e74c84d51 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/MacroCompileTests/JSFunctionCompileTests.swift @@ -0,0 +1,7 @@ +import JavaScriptKit + +@JSFunction package func jsFunctionWithPackageAccess() throws(JSException) +@JSFunction public func jsFunctionWithPublicAccess() throws(JSException) +@JSFunction internal func jsFunctionWithInternalAccess() throws(JSException) +@JSFunction fileprivate func jsFunctionWithFilePrivateAccess() throws(JSException) +@JSFunction private func jsFunctionWithPrivateAccess() throws(JSException) From 312e7157907dc416a19b452487ffb14f358c16d1 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 17 Feb 2026 14:51:53 +0900 Subject: [PATCH 228/252] PlayBridgeJS: Surface BridgeJS diagnostics inside editors --- .../PlayBridgeJS/Sources/JavaScript/app.js | 31 ++- .../PlayBridgeJS/Sources/JavaScript/editor.js | 67 +++++- .../PlayBridgeJS/Generated/BridgeJS.swift | 226 ++++++++++++------ .../Generated/JavaScript/BridgeJS.json | 194 ++++++++++----- .../Sources/PlayBridgeJS/main.swift | 63 +++-- .../BridgeJS/Sources/BridgeJSCore/Misc.swift | 28 ++- .../BridgeJSCore/SwiftToSkeleton.swift | 6 +- .../Sources/BridgeJSTool/BridgeJSTool.swift | 8 +- 8 files changed, 452 insertions(+), 171 deletions(-) diff --git a/Examples/PlayBridgeJS/Sources/JavaScript/app.js b/Examples/PlayBridgeJS/Sources/JavaScript/app.js index 7da78e038..5580c802d 100644 --- a/Examples/PlayBridgeJS/Sources/JavaScript/app.js +++ b/Examples/PlayBridgeJS/Sources/JavaScript/app.js @@ -268,19 +268,38 @@ export class BridgeJSPlayground { try { this.hideError(); + this.editorSystem.clearDiagnostics(); const inputs = this.editorSystem.getInputs(); const swiftCode = inputs.swift; const dtsCode = inputs.dts; // Process the code and get PlayBridgeJSOutput - const result = this.playBridgeJS.update(swiftCode, dtsCode); - - // Update outputs using the PlayBridgeJSOutput object - this.editorSystem.updateOutputs(result); - - console.log('Code generated successfully'); + const result = this.playBridgeJS.updateDetailed(swiftCode, dtsCode); + + const diagnostics = result.diagnostics; + if (diagnostics && diagnostics.length > 0) { + const mapped = diagnostics.map(d => ({ + file: d.file, + startLineNumber: d.startLine, + startColumn: d.startColumn, + endLineNumber: d.endLine, + endColumn: d.endColumn, + message: d.message + })); + this.editorSystem.showDiagnostics(mapped); + return; + } + const output = result.output; + if (output) { + // Update outputs using the PlayBridgeJSOutput object + this.editorSystem.updateOutputs(output); + this.hideError(); + console.log('Code generated successfully'); + } else { + this.showError('No output produced.'); + } } catch (error) { console.error('Error generating code:', error); this.showError('Error generating code: ' + error.message); diff --git a/Examples/PlayBridgeJS/Sources/JavaScript/editor.js b/Examples/PlayBridgeJS/Sources/JavaScript/editor.js index dc3d362eb..c894598a4 100644 --- a/Examples/PlayBridgeJS/Sources/JavaScript/editor.js +++ b/Examples/PlayBridgeJS/Sources/JavaScript/editor.js @@ -43,7 +43,7 @@ export class EditorSystem { language: 'swift', placeholder: '// Import Swift Macros will appear here...', readOnly: true, - modelUri: 'BridgeJS.Macros.swift' + modelUri: 'Playground.Macros.swift' }, { key: 'swift-glue', @@ -206,10 +206,10 @@ export class EditorSystem { updateOutputs(result) { const outputMap = { - 'swift-glue': () => result.swiftGlue(), - 'swift-import-macros': () => result.importSwiftMacroDecls(), - 'js-generated': () => result.outputJs(), - 'dts-generated': () => result.outputDts() + 'swift-glue': () => result.swiftGlue, + 'swift-import-macros': () => result.importSwiftMacroDecls, + 'js-generated': () => result.outputJs, + 'dts-generated': () => result.outputDts }; Object.entries(outputMap).forEach(([key, getContent]) => { @@ -230,6 +230,63 @@ export class EditorSystem { }); } + clearDiagnostics() { + // Remove all diagnostics owned by the playground. + this.editors.forEach(editor => { + const model = editor.getModel(); + if (!model || typeof monaco === 'undefined') return; + monaco.editor.setModelMarkers(model, 'bridgejs', []); + }); + } + + /** + * @param {{file: string, startLineNumber: number, startColumn: number, endLineNumber?: number, endColumn?: number, message: string}[]} diagnostics + */ + showDiagnostics(diagnostics) { + if (typeof monaco === 'undefined') return; + + // Group diagnostics per model so we can set markers in batches. + const markersByModel = new Map(); + + diagnostics.forEach(diag => { + const model = this.findModelForFile(diag.file); + if (!model) return; + + const markers = markersByModel.get(model) ?? []; + const lineLength = model.getLineMaxColumn(diag.startLineNumber); + const endLine = diag.endLineNumber ?? diag.startLineNumber; + const endColumn = Math.min(lineLength, diag.endColumn ?? diag.startColumn + 1); + + markers.push({ + severity: monaco.MarkerSeverity.Error, + message: diag.message, + startLineNumber: diag.startLineNumber, + startColumn: diag.startColumn, + endLineNumber: endLine, + endColumn + }); + + markersByModel.set(model, markers); + }); + + markersByModel.forEach((markers, model) => { + monaco.editor.setModelMarkers(model, 'bridgejs', markers); + }); + } + + findModelForFile(fileName) { + const normalized = fileName.startsWith('/') ? fileName.slice(1) : fileName; + for (const editor of this.editors.values()) { + const model = editor.getModel(); + if (!model) continue; + const uriPath = model.uri.path.startsWith('/') ? model.uri.path.slice(1) : model.uri.path; + if (uriPath === normalized || uriPath.endsWith('/' + normalized)) { + return model; + } + } + return null; + } + // Utility methods getConfigByKey(key) { return [...this.config.input, ...this.config.output].find(c => c.key === key); diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift index f97c181d9..6e146dbc3 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift @@ -7,6 +7,153 @@ @_spi(BridgeJS) import JavaScriptKit +extension PlayBridgeJSOutput: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> PlayBridgeJSOutput { + let swiftGlue = String.bridgeJSStackPop() + let importSwiftMacroDecls = String.bridgeJSStackPop() + let outputDts = String.bridgeJSStackPop() + let outputJs = String.bridgeJSStackPop() + return PlayBridgeJSOutput(outputJs: outputJs, outputDts: outputDts, importSwiftMacroDecls: importSwiftMacroDecls, swiftGlue: swiftGlue) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.outputJs.bridgeJSStackPush() + self.outputDts.bridgeJSStackPush() + self.importSwiftMacroDecls.bridgeJSStackPush() + self.swiftGlue.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_PlayBridgeJSOutput(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PlayBridgeJSOutput())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PlayBridgeJSOutput") +fileprivate func _bjs_struct_lower_PlayBridgeJSOutput(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_PlayBridgeJSOutput(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PlayBridgeJSOutput") +fileprivate func _bjs_struct_lift_PlayBridgeJSOutput() -> Int32 +#else +fileprivate func _bjs_struct_lift_PlayBridgeJSOutput() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +extension PlayBridgeJSDiagnostic: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> PlayBridgeJSDiagnostic { + let endColumn = Int.bridgeJSStackPop() + let endLine = Int.bridgeJSStackPop() + let startColumn = Int.bridgeJSStackPop() + let startLine = Int.bridgeJSStackPop() + let message = String.bridgeJSStackPop() + let file = String.bridgeJSStackPop() + return PlayBridgeJSDiagnostic(file: file, message: message, startLine: startLine, startColumn: startColumn, endLine: endLine, endColumn: endColumn) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.file.bridgeJSStackPush() + self.message.bridgeJSStackPush() + self.startLine.bridgeJSStackPush() + self.startColumn.bridgeJSStackPush() + self.endLine.bridgeJSStackPush() + self.endColumn.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_PlayBridgeJSDiagnostic(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PlayBridgeJSDiagnostic())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PlayBridgeJSDiagnostic") +fileprivate func _bjs_struct_lower_PlayBridgeJSDiagnostic(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_PlayBridgeJSDiagnostic(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PlayBridgeJSDiagnostic") +fileprivate func _bjs_struct_lift_PlayBridgeJSDiagnostic() -> Int32 +#else +fileprivate func _bjs_struct_lift_PlayBridgeJSDiagnostic() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +extension PlayBridgeJSResult: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> PlayBridgeJSResult { + let diagnostics = [PlayBridgeJSDiagnostic].bridgeJSStackPop() + let output = Optional.bridgeJSStackPop() + return PlayBridgeJSResult(output: output, diagnostics: diagnostics) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.output.bridgeJSStackPush() + self.diagnostics.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + let __bjs_cleanupId = _bjs_struct_lower_PlayBridgeJSResult(jsObject.bridgeJSLowerParameter()) + defer { + _swift_js_struct_cleanup(__bjs_cleanupId) + } + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PlayBridgeJSResult())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PlayBridgeJSResult") +fileprivate func _bjs_struct_lower_PlayBridgeJSResult(_ objectId: Int32) -> Int32 +#else +fileprivate func _bjs_struct_lower_PlayBridgeJSResult(_ objectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PlayBridgeJSResult") +fileprivate func _bjs_struct_lift_PlayBridgeJSResult() -> Int32 +#else +fileprivate func _bjs_struct_lift_PlayBridgeJSResult() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + @_expose(wasm, "bjs_PlayBridgeJS_init") @_cdecl("bjs_PlayBridgeJS_init") public func _bjs_PlayBridgeJS_init() -> UnsafeMutableRawPointer { @@ -18,12 +165,12 @@ public func _bjs_PlayBridgeJS_init() -> UnsafeMutableRawPointer { #endif } -@_expose(wasm, "bjs_PlayBridgeJS_update") -@_cdecl("bjs_PlayBridgeJS_update") -public func _bjs_PlayBridgeJS_update(_ _self: UnsafeMutableRawPointer, _ swiftSourceBytes: Int32, _ swiftSourceLength: Int32, _ dtsSourceBytes: Int32, _ dtsSourceLength: Int32) -> UnsafeMutableRawPointer { +@_expose(wasm, "bjs_PlayBridgeJS_updateDetailed") +@_cdecl("bjs_PlayBridgeJS_updateDetailed") +public func _bjs_PlayBridgeJS_updateDetailed(_ _self: UnsafeMutableRawPointer, _ swiftSourceBytes: Int32, _ swiftSourceLength: Int32, _ dtsSourceBytes: Int32, _ dtsSourceLength: Int32) -> Void { #if arch(wasm32) do { - let ret = try PlayBridgeJS.bridgeJSLiftParameter(_self).update(swiftSource: String.bridgeJSLiftParameter(swiftSourceBytes, swiftSourceLength), dtsSource: String.bridgeJSLiftParameter(dtsSourceBytes, dtsSourceLength)) + let ret = try PlayBridgeJS.bridgeJSLiftParameter(_self).updateDetailed(swiftSource: String.bridgeJSLiftParameter(swiftSourceBytes, swiftSourceLength), dtsSource: String.bridgeJSLiftParameter(dtsSourceBytes, dtsSourceLength)) return ret.bridgeJSLowerReturn() } catch let error { if let error = error.thrownValue.object { @@ -36,7 +183,7 @@ public func _bjs_PlayBridgeJS_update(_ _self: UnsafeMutableRawPointer, _ swiftSo _swift_js_throw(Int32(bitPattern: $0.id)) } } - return UnsafeMutableRawPointer(bitPattern: -1).unsafelyUnwrapped + return } #else fatalError("Only available on WebAssembly") @@ -68,75 +215,6 @@ fileprivate func _bjs_PlayBridgeJS_wrap(_ pointer: UnsafeMutableRawPointer) -> I } #endif -@_expose(wasm, "bjs_PlayBridgeJSOutput_outputJs") -@_cdecl("bjs_PlayBridgeJSOutput_outputJs") -public func _bjs_PlayBridgeJSOutput_outputJs(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).outputJs() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PlayBridgeJSOutput_outputDts") -@_cdecl("bjs_PlayBridgeJSOutput_outputDts") -public func _bjs_PlayBridgeJSOutput_outputDts(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).outputDts() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PlayBridgeJSOutput_importSwiftMacroDecls") -@_cdecl("bjs_PlayBridgeJSOutput_importSwiftMacroDecls") -public func _bjs_PlayBridgeJSOutput_importSwiftMacroDecls(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).importSwiftMacroDecls() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PlayBridgeJSOutput_swiftGlue") -@_cdecl("bjs_PlayBridgeJSOutput_swiftGlue") -public func _bjs_PlayBridgeJSOutput_swiftGlue(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).swiftGlue() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PlayBridgeJSOutput_deinit") -@_cdecl("bjs_PlayBridgeJSOutput_deinit") -public func _bjs_PlayBridgeJSOutput_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension PlayBridgeJSOutput: ConvertibleToJSValue, _BridgedSwiftHeapObject { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_PlayBridgeJSOutput_wrap(Unmanaged.passRetained(self).toOpaque())))) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJSOutput_wrap") -fileprivate func _bjs_PlayBridgeJSOutput_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_PlayBridgeJSOutput_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - #if arch(wasm32) @_extern(wasm, module: "PlayBridgeJS", name: "bjs_createTS2Swift") fileprivate func bjs_createTS2Swift() -> Int32 diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json index 743925c5f..3046e1f01 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json @@ -15,13 +15,13 @@ }, "methods" : [ { - "abiName" : "bjs_PlayBridgeJS_update", + "abiName" : "bjs_PlayBridgeJS_updateDetailed", "effects" : { "isAsync" : false, "isStatic" : false, "isThrows" : true }, - "name" : "update", + "name" : "updateDetailed", "parameters" : [ { "label" : "swiftSource", @@ -43,8 +43,8 @@ } ], "returnType" : { - "swiftHeapObject" : { - "_0" : "PlayBridgeJSOutput" + "swiftStruct" : { + "_0" : "PlayBridgeJSResult" } } } @@ -54,97 +54,175 @@ ], "swiftCallName" : "PlayBridgeJS" - }, + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ { "methods" : [ + + ], + "name" : "PlayBridgeJSOutput", + "properties" : [ { - "abiName" : "bjs_PlayBridgeJSOutput_outputJs", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, + "isReadonly" : true, + "isStatic" : false, "name" : "outputJs", - "parameters" : [ - - ], - "returnType" : { + "type" : { "string" : { } } }, { - "abiName" : "bjs_PlayBridgeJSOutput_outputDts", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, + "isReadonly" : true, + "isStatic" : false, "name" : "outputDts", - "parameters" : [ - - ], - "returnType" : { + "type" : { "string" : { } } }, { - "abiName" : "bjs_PlayBridgeJSOutput_importSwiftMacroDecls", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, + "isReadonly" : true, + "isStatic" : false, "name" : "importSwiftMacroDecls", - "parameters" : [ - - ], - "returnType" : { + "type" : { "string" : { } } }, { - "abiName" : "bjs_PlayBridgeJSOutput_swiftGlue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, + "isReadonly" : true, + "isStatic" : false, "name" : "swiftGlue", - "parameters" : [ - - ], - "returnType" : { + "type" : { "string" : { } } } ], - "name" : "PlayBridgeJSOutput", - "properties" : [ + "swiftCallName" : "PlayBridgeJSOutput" + }, + { + "methods" : [ ], - "swiftCallName" : "PlayBridgeJSOutput" - } - ], - "enums" : [ + "name" : "PlayBridgeJSDiagnostic", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "file", + "type" : { + "string" : { - ], - "exposeToGlobal" : false, - "functions" : [ + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "message", + "type" : { + "string" : { - ], - "protocols" : [ + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "startLine", + "type" : { + "int" : { - ], - "structs" : [ + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "startColumn", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "endLine", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "endColumn", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "PlayBridgeJSDiagnostic" + }, + { + "methods" : [ + ], + "name" : "PlayBridgeJSResult", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "output", + "type" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "PlayBridgeJSOutput" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "diagnostics", + "type" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "PlayBridgeJSDiagnostic" + } + } + } + } + } + ], + "swiftCallName" : "PlayBridgeJSResult" + } ] }, "imported" : { diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift index 80572962a..ec9eda774 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift @@ -1,14 +1,40 @@ import JavaScriptEventLoop import JavaScriptKit import SwiftParser +import SwiftSyntax import class Foundation.JSONDecoder @JS class PlayBridgeJS { @JS init() {} - @JS func update(swiftSource: String, dtsSource: String) throws(JSException) -> PlayBridgeJSOutput { + /// Structured entry point used by the playground so JS doesn't need to parse diagnostics. + @JS func updateDetailed(swiftSource: String, dtsSource: String) throws(JSException) -> PlayBridgeJSResult { do { - return try _update(swiftSource: swiftSource, dtsSource: dtsSource) + let output = try _update(swiftSource: swiftSource, dtsSource: dtsSource) + return PlayBridgeJSResult(output: output, diagnostics: []) + } catch let error as BridgeJSCoreDiagnosticError { + let diagnostics = error.diagnostics.map { diag -> PlayBridgeJSDiagnostic in + let converter = SourceLocationConverter(fileName: diag.file, tree: diag.diagnostic.node.root) + let start = converter.location(for: diag.diagnostic.node.positionAfterSkippingLeadingTrivia) + let end = converter.location(for: diag.diagnostic.node.endPositionBeforeTrailingTrivia) + + let startLine = start.line + let startColumn = start.column + let endLine = end.line + let endColumn = max(startColumn + 1, end.column) + + return PlayBridgeJSDiagnostic( + file: diag.file, + message: diag.diagnostic.message, + startLine: startLine, + startColumn: startColumn, + endLine: endLine, + endColumn: endColumn + ) + } + return PlayBridgeJSResult(output: nil, diagnostics: diagnostics) + } catch let error as BridgeJSCoreError { + throw JSException(message: error.description) } catch let error as JSException { throw error } catch { @@ -49,23 +75,26 @@ import class Foundation.JSONDecoder swiftGlue: (importResult ?? "") + "\n\n" + (exportResult ?? "") ) } + } -@JS class PlayBridgeJSOutput { - let _outputJs: String - let _outputDts: String - let _importSwiftMacroDecls: String - let _swiftGlue: String +@JS struct PlayBridgeJSOutput { + let outputJs: String + let outputDts: String + let importSwiftMacroDecls: String + let swiftGlue: String +} - init(outputJs: String, outputDts: String, importSwiftMacroDecls: String, swiftGlue: String) { - self._outputJs = outputJs - self._outputDts = outputDts - self._importSwiftMacroDecls = importSwiftMacroDecls - self._swiftGlue = swiftGlue - } +@JS struct PlayBridgeJSDiagnostic { + let file: String + let message: String + let startLine: Int + let startColumn: Int + let endLine: Int + let endColumn: Int +} - @JS func outputJs() -> String { self._outputJs } - @JS func outputDts() -> String { self._outputDts } - @JS func importSwiftMacroDecls() -> String { self._importSwiftMacroDecls } - @JS func swiftGlue() -> String { self._swiftGlue } +@JS struct PlayBridgeJSResult { + let output: PlayBridgeJSOutput? + let diagnostics: [PlayBridgeJSDiagnostic] } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift index 9db11b14d..06fb422a9 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift @@ -136,12 +136,12 @@ private enum JSON { import SwiftSyntax import class Foundation.ProcessInfo -struct DiagnosticError: Error { - let node: Syntax - let message: String - let hint: String? +public struct DiagnosticError: Error { + public let node: Syntax + public let message: String + public let hint: String? - init(node: some SyntaxProtocol, message: String, hint: String? = nil) { + public init(node: some SyntaxProtocol, message: String, hint: String? = nil) { self.node = Syntax(node) self.message = message self.hint = hint @@ -153,7 +153,7 @@ struct DiagnosticError: Error { /// - fileName: The name of the file to display in the output. /// - colorize: Whether to colorize the output with ANSI escape sequences. /// - Returns: The formatted diagnostic error string. - func formattedDescription(fileName: String, colorize: Bool = Self.shouldColorize) -> String { + public func formattedDescription(fileName: String, colorize: Bool = Self.shouldColorize) -> String { let displayFileName = fileName == "-" ? "" : fileName let converter = SourceLocationConverter(fileName: displayFileName, tree: node.root) let startLocation = converter.location(for: node.positionAfterSkippingLeadingTrivia) @@ -273,7 +273,7 @@ struct DiagnosticError: Error { return "\(gutter) | \(text)" } - private static var shouldColorize: Bool { + public static var shouldColorize: Bool { let env = ProcessInfo.processInfo.environment let termIsDumb = env["TERM"] == "dumb" return env["NO_COLOR"] == nil && !termIsDumb @@ -286,6 +286,20 @@ struct DiagnosticError: Error { return String.Index(utf8Index, within: line)! } } +/// Carries the diagnostics produced during SwiftToSkeleton. +public struct BridgeJSCoreDiagnosticError: Swift.Error, CustomStringConvertible { + public let diagnostics: [(file: String, diagnostic: DiagnosticError)] + + public init(diagnostics: [(file: String, diagnostic: DiagnosticError)]) { + self.diagnostics = diagnostics + } + + public var description: String { + diagnostics + .map { (file, diag) in diag.formattedDescription(fileName: file, colorize: false) } + .joined(separator: "\n") + } +} private enum ANSI { static let reset = "\u{001B}[0;0m" diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index 1d775fbc6..0cf5a567f 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -78,10 +78,10 @@ public final class SwiftToSkeleton { } if !perSourceErrors.isEmpty { - let allErrors = perSourceErrors.flatMap { inputFilePath, errors in - errors.map { $0.formattedDescription(fileName: inputFilePath) } + let diagnostics = perSourceErrors.flatMap { inputFilePath, errors in + errors.map { (file: inputFilePath, diagnostic: $0) } } - throw BridgeJSCoreError(allErrors.joined(separator: "\n")) + throw BridgeJSCoreDiagnosticError(diagnostics: diagnostics) } let importedSkeleton: ImportedModuleSkeleton? = { let module = ImportedModuleSkeleton(children: importedFiles) diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index 9410b2909..a71aaee44 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -61,7 +61,13 @@ import BridgeJSUtilities try run() } } catch { - printStderr("error: \(error)") + if let diagError = error as? BridgeJSCoreDiagnosticError { + diagError.diagnostics.forEach { file, diagnostic in + printStderr(diagnostic.formattedDescription(fileName: file)) + } + } else { + printStderr("error: \(error)") + } exit(1) } } From 76e03622e26984689ca7ac0a98e5c58c37174436 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 17 Feb 2026 16:57:50 +0900 Subject: [PATCH 229/252] Make PlayBridgeJS tabs scroll when overflow --- Examples/PlayBridgeJS/Sources/JavaScript/styles.css | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Examples/PlayBridgeJS/Sources/JavaScript/styles.css b/Examples/PlayBridgeJS/Sources/JavaScript/styles.css index ab943c6e0..f8eafbec9 100644 --- a/Examples/PlayBridgeJS/Sources/JavaScript/styles.css +++ b/Examples/PlayBridgeJS/Sources/JavaScript/styles.css @@ -306,6 +306,10 @@ body { margin: 0; background-color: var(--color-fill-secondary); border-bottom: 1px solid var(--color-border); + overflow-x: auto; + overflow-y: hidden; + scrollbar-gutter: stable; + -webkit-overflow-scrolling: touch; } .tab-button { @@ -319,6 +323,8 @@ body { transition: all 0.2s ease; position: relative; border-bottom: 2px solid transparent; + flex: 0 0 auto; + white-space: nowrap; } .tab-button:hover { @@ -411,12 +417,10 @@ body { } .tab-group { - flex-wrap: wrap; + scroll-padding-inline: 12px; } .tab-button { - flex: 1; - min-width: 0; text-align: center; } @@ -447,4 +451,4 @@ body { .share-url-input { font-size: 12px; } -} \ No newline at end of file +} From 487cf7911307c60efbb6c3613cf61915d721be20 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 17 Feb 2026 12:14:57 +0100 Subject: [PATCH 230/252] BridgeJS: Use indirect _exports lookup in wrap functions --- Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift | 2 +- .../__Snapshots__/BridgeJSLinkTests/ArrayTypes.js | 2 +- .../__Snapshots__/BridgeJSLinkTests/DefaultParameters.js | 6 +++--- .../__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js | 2 +- .../__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js | 2 +- .../__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js | 6 +++--- .../__Snapshots__/BridgeJSLinkTests/EnumNamespace.js | 6 +++--- .../__Snapshots__/BridgeJSLinkTests/JSValue.js | 2 +- .../__Snapshots__/BridgeJSLinkTests/MixedGlobal.js | 2 +- .../__Snapshots__/BridgeJSLinkTests/MixedModules.js | 4 ++-- .../__Snapshots__/BridgeJSLinkTests/MixedPrivate.js | 2 +- .../__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js | 6 +++--- .../__Snapshots__/BridgeJSLinkTests/Namespaces.js | 6 +++--- .../__Snapshots__/BridgeJSLinkTests/Optionals.js | 4 ++-- .../__Snapshots__/BridgeJSLinkTests/PropertyTypes.js | 2 +- .../__Snapshots__/BridgeJSLinkTests/Protocol.js | 6 +++--- .../BridgeJSLinkTests/StaticFunctions.Global.js | 2 +- .../__Snapshots__/BridgeJSLinkTests/StaticFunctions.js | 2 +- .../BridgeJSLinkTests/StaticProperties.Global.js | 2 +- .../__Snapshots__/BridgeJSLinkTests/StaticProperties.js | 2 +- .../__Snapshots__/BridgeJSLinkTests/SwiftClass.js | 6 +++--- .../__Snapshots__/BridgeJSLinkTests/SwiftClosure.js | 4 ++-- .../__Snapshots__/BridgeJSLinkTests/SwiftStruct.js | 2 +- 23 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index b779e0171..625b82b6e 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -1122,7 +1122,7 @@ public struct BridgeJSLink { for klass in classes.sorted(by: { $0.name < $1.name }) { let wrapperFunctionName = "bjs_\(klass.name)_wrap" wrapperLines.append("importObject[\"\(moduleName)\"][\"\(wrapperFunctionName)\"] = function(pointer) {") - wrapperLines.append(" const obj = \(klass.name).__construct(pointer);") + wrapperLines.append(" const obj = _exports['\(klass.name)'].__construct(pointer);") wrapperLines.append(" return \(JSGlueVariableScope.reservedSwift).memory.retain(obj);") wrapperLines.append("};") } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 52438d27d..5944dc257 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -239,7 +239,7 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_Item_wrap"] = function(pointer) { - const obj = Item.__construct(pointer); + const obj = _exports['Item'].__construct(pointer); return swift.memory.retain(obj); }; const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 6182298a1..adb9143cf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -272,15 +272,15 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_ConstructorDefaults_wrap"] = function(pointer) { - const obj = ConstructorDefaults.__construct(pointer); + const obj = _exports['ConstructorDefaults'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_DefaultGreeter_wrap"] = function(pointer) { - const obj = DefaultGreeter.__construct(pointer); + const obj = _exports['DefaultGreeter'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_EmptyGreeter_wrap"] = function(pointer) { - const obj = EmptyGreeter.__construct(pointer); + const obj = _exports['EmptyGreeter'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index 4f71aa76e..41a6074ea 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -201,7 +201,7 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_Box_wrap"] = function(pointer) { - const obj = Box.__construct(pointer); + const obj = _exports['Box'].__construct(pointer); return swift.memory.retain(obj); }; const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index af81d52fe..a5ead8a1c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -1027,7 +1027,7 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_User_wrap"] = function(pointer) { - const obj = User.__construct(pointer); + const obj = _exports['User'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index 392788ef6..887f5ff3f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -244,15 +244,15 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_Converter_wrap"] = function(pointer) { - const obj = Converter.__construct(pointer); + const obj = _exports['Converter'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_HTTPServer_wrap"] = function(pointer) { - const obj = HTTPServer.__construct(pointer); + const obj = _exports['HTTPServer'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_TestServer_wrap"] = function(pointer) { - const obj = TestServer.__construct(pointer); + const obj = _exports['TestServer'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index 0a2826a5e..a9470aad7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -225,15 +225,15 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_Converter_wrap"] = function(pointer) { - const obj = Converter.__construct(pointer); + const obj = _exports['Converter'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_HTTPServer_wrap"] = function(pointer) { - const obj = HTTPServer.__construct(pointer); + const obj = _exports['HTTPServer'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_TestServer_wrap"] = function(pointer) { - const obj = TestServer.__construct(pointer); + const obj = _exports['TestServer'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index d45efc771..ab59944ce 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -290,7 +290,7 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_JSValueHolder_wrap"] = function(pointer) { - const obj = JSValueHolder.__construct(pointer); + const obj = _exports['JSValueHolder'].__construct(pointer); return swift.memory.retain(obj); }; const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index 675aa3798..ee89f5e5f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -200,7 +200,7 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_GlobalClass_wrap"] = function(pointer) { - const obj = GlobalClass.__construct(pointer); + const obj = _exports['GlobalClass'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index 6a6c75ef4..ab54a88c3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -200,7 +200,7 @@ export async function createInstantiator(options, swift) { importObject["GlobalModule"] = {}; } importObject["GlobalModule"]["bjs_GlobalClass_wrap"] = function(pointer) { - const obj = GlobalClass.__construct(pointer); + const obj = _exports['GlobalClass'].__construct(pointer); return swift.memory.retain(obj); }; // Wrapper functions for module: PrivateModule @@ -208,7 +208,7 @@ export async function createInstantiator(options, swift) { importObject["PrivateModule"] = {}; } importObject["PrivateModule"]["bjs_PrivateClass_wrap"] = function(pointer) { - const obj = PrivateClass.__construct(pointer); + const obj = _exports['PrivateClass'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index f36211310..24dac8d27 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -200,7 +200,7 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_PrivateClass_wrap"] = function(pointer) { - const obj = PrivateClass.__construct(pointer); + const obj = _exports['PrivateClass'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index 09ad002a1..3ce2779e1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -200,15 +200,15 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_Converter_wrap"] = function(pointer) { - const obj = Converter.__construct(pointer); + const obj = _exports['Converter'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_Greeter_wrap"] = function(pointer) { - const obj = Greeter.__construct(pointer); + const obj = _exports['Greeter'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_UUID_wrap"] = function(pointer) { - const obj = UUID.__construct(pointer); + const obj = _exports['UUID'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index 7368e52fa..d4437f0c1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -200,15 +200,15 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_Converter_wrap"] = function(pointer) { - const obj = Converter.__construct(pointer); + const obj = _exports['Converter'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_Greeter_wrap"] = function(pointer) { - const obj = Greeter.__construct(pointer); + const obj = _exports['Greeter'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_UUID_wrap"] = function(pointer) { - const obj = UUID.__construct(pointer); + const obj = _exports['UUID'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index c4f99c84b..349921a25 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -201,11 +201,11 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_Greeter_wrap"] = function(pointer) { - const obj = Greeter.__construct(pointer); + const obj = _exports['Greeter'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_OptionalPropertyHolder_wrap"] = function(pointer) { - const obj = OptionalPropertyHolder.__construct(pointer); + const obj = _exports['OptionalPropertyHolder'].__construct(pointer); return swift.memory.retain(obj); }; const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index b39362233..024523591 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -200,7 +200,7 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_PropertyHolder_wrap"] = function(pointer) { - const obj = PropertyHolder.__construct(pointer); + const obj = _exports['PropertyHolder'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 1d413db20..0ff740ad1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -261,15 +261,15 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_DelegateManager_wrap"] = function(pointer) { - const obj = DelegateManager.__construct(pointer); + const obj = _exports['DelegateManager'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_Helper_wrap"] = function(pointer) { - const obj = Helper.__construct(pointer); + const obj = _exports['Helper'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_MyViewController_wrap"] = function(pointer) { - const obj = MyViewController.__construct(pointer); + const obj = _exports['MyViewController'].__construct(pointer); return swift.memory.retain(obj); }; const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 07f7a3c77..370ca98b4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -248,7 +248,7 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_MathUtils_wrap"] = function(pointer) { - const obj = MathUtils.__construct(pointer); + const obj = _exports['MathUtils'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index c2c3f9a70..bd7964c85 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -248,7 +248,7 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_MathUtils_wrap"] = function(pointer) { - const obj = MathUtils.__construct(pointer); + const obj = _exports['MathUtils'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index 3784b5a7e..b5155bddf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -205,7 +205,7 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_PropertyClass_wrap"] = function(pointer) { - const obj = PropertyClass.__construct(pointer); + const obj = _exports['PropertyClass'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index 47f0092af..47918485d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -205,7 +205,7 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_PropertyClass_wrap"] = function(pointer) { - const obj = PropertyClass.__construct(pointer); + const obj = _exports['PropertyClass'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index 9f8f93c5b..7dce46d8e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -201,15 +201,15 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_Greeter_wrap"] = function(pointer) { - const obj = Greeter.__construct(pointer); + const obj = _exports['Greeter'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_PackageGreeter_wrap"] = function(pointer) { - const obj = PackageGreeter.__construct(pointer); + const obj = _exports['PackageGreeter'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_PublicGreeter_wrap"] = function(pointer) { - const obj = PublicGreeter.__construct(pointer); + const obj = _exports['PublicGreeter'].__construct(pointer); return swift.memory.retain(obj); }; const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 3371cf1b3..d701e93d7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -885,11 +885,11 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_Person_wrap"] = function(pointer) { - const obj = Person.__construct(pointer); + const obj = _exports['Person'].__construct(pointer); return swift.memory.retain(obj); }; importObject["TestModule"]["bjs_TestProcessor_wrap"] = function(pointer) { - const obj = TestProcessor.__construct(pointer); + const obj = _exports['TestProcessor'].__construct(pointer); return swift.memory.retain(obj); }; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index 316dfb709..f3c0810c1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -512,7 +512,7 @@ export async function createInstantiator(options, swift) { importObject["TestModule"] = {}; } importObject["TestModule"]["bjs_Greeter_wrap"] = function(pointer) { - const obj = Greeter.__construct(pointer); + const obj = _exports['Greeter'].__construct(pointer); return swift.memory.retain(obj); }; }, From 40790973697a41e510127761c1681c7985e64f56 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 17 Feb 2026 12:15:53 +0100 Subject: [PATCH 231/252] PackageToJS: Replace @ts-ignore with @ts-expect-error in templates --- Plugins/PackageToJS/Templates/instantiate.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Plugins/PackageToJS/Templates/instantiate.js b/Plugins/PackageToJS/Templates/instantiate.js index 955c2928c..c9bc9efb4 100644 --- a/Plugins/PackageToJS/Templates/instantiate.js +++ b/Plugins/PackageToJS/Templates/instantiate.js @@ -4,17 +4,17 @@ import { SwiftRuntime } from "./runtime.js" export const MODULE_PATH = "@PACKAGE_TO_JS_MODULE_PATH@"; /* #if USE_SHARED_MEMORY */ export const MEMORY_TYPE = { - // @ts-ignore + // @ts-expect-error Substituted by PackageToJS preprocessor initial: import.meta.PACKAGE_TO_JS_MEMORY_INITIAL, - // @ts-ignore + // @ts-expect-error Substituted by PackageToJS preprocessor maximum: import.meta.PACKAGE_TO_JS_MEMORY_MAXIMUM, - // @ts-ignore + // @ts-expect-error Substituted by PackageToJS preprocessor shared: import.meta.PACKAGE_TO_JS_MEMORY_SHARED, } /* #endif */ /* #if HAS_BRIDGE */ -// @ts-ignore +// @ts-expect-error Substituted by PackageToJS preprocessor import { createInstantiator } from "./bridge-js.js" /* #else */ /** From a4206f2828e610954c40486a9e491d33edfc77d5 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 17 Feb 2026 12:33:39 +0100 Subject: [PATCH 232/252] Runtime: Simplify find-global.ts to just globalThis --- Runtime/src/find-global.ts | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Runtime/src/find-global.ts b/Runtime/src/find-global.ts index f20afbf34..1530f446e 100644 --- a/Runtime/src/find-global.ts +++ b/Runtime/src/find-global.ts @@ -1,13 +1 @@ -interface GlobalVariable {} -declare const global: GlobalVariable; - -export let globalVariable: any; -if (typeof globalThis !== "undefined") { - globalVariable = globalThis; -} else if (typeof window !== "undefined") { - globalVariable = window; -} else if (typeof global !== "undefined") { - globalVariable = global; -} else if (typeof self !== "undefined") { - globalVariable = self; -} +export const globalVariable: any = globalThis; From 504ae31f438e5bb80637911a1dd6fab8b73ae6af Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 17 Feb 2026 12:33:44 +0100 Subject: [PATCH 233/252] Runtime: Apply prettier formatting and enforce in CI --- .github/workflows/test.yml | 10 + Plugins/PackageToJS/Templates/runtime.mjs | 114 +++--- Runtime/src/closure-heap.ts | 2 +- Runtime/src/index.ts | 403 +++++++++++++++------- Runtime/src/itc.ts | 173 ++++++---- Runtime/src/js-value.ts | 28 +- Runtime/src/object-heap.ts | 2 +- Runtime/src/types.ts | 2 +- 8 files changed, 494 insertions(+), 240 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1e9060f19..69f63a27c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -119,6 +119,16 @@ jobs: env: DEVELOPER_DIR: /Applications/${{ matrix.xcode }}.app/Contents/Developer/ + prettier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-node@v6 + with: + node-version: '20' + - run: npm install + - run: npx prettier --check Runtime/src + format: runs-on: ubuntu-latest container: diff --git a/Plugins/PackageToJS/Templates/runtime.mjs b/Plugins/PackageToJS/Templates/runtime.mjs index a40fc3df6..e0bcf3e05 100644 --- a/Plugins/PackageToJS/Templates/runtime.mjs +++ b/Plugins/PackageToJS/Templates/runtime.mjs @@ -1,6 +1,6 @@ /// Memory lifetime of closures in Swift are managed by Swift side class SwiftClosureDeallocator { - constructor(exports) { + constructor(exports$1) { if (typeof FinalizationRegistry === "undefined") { throw new Error("The Swift part of JavaScriptKit was configured to require " + "the availability of JavaScript WeakRefs. Please build " + @@ -8,7 +8,7 @@ class SwiftClosureDeallocator { "disable features that use WeakRefs."); } this.functionRegistry = new FinalizationRegistry((id) => { - exports.swjs_free_host_function(id); + exports$1.swjs_free_host_function(id); }); } track(func, func_ref) { @@ -126,12 +126,12 @@ class ITCInterface { } send(sendingObject, transferringObjects, sendingContext) { const object = this.memory.getObject(sendingObject); - const transfer = transferringObjects.map(ref => this.memory.getObject(ref)); + const transfer = transferringObjects.map((ref) => this.memory.getObject(ref)); return { object, sendingContext, transfer }; } sendObjects(sendingObjects, transferringObjects, sendingContext) { - const objects = sendingObjects.map(ref => this.memory.getObject(ref)); - const transfer = transferringObjects.map(ref => this.memory.getObject(ref)); + const objects = sendingObjects.map((ref) => this.memory.getObject(ref)); + const transfer = transferringObjects.map((ref) => this.memory.getObject(ref)); return { object: objects, sendingContext, transfer }; } release(objectRef) { @@ -168,7 +168,9 @@ class MessageBroker { this.handlers.onResponse(message); return; } - const transfer = message.data.response.ok ? message.data.response.value.transfer : []; + const transfer = message.data.response.ok + ? message.data.response.value.transfer + : []; if ("postMessageToWorkerThread" in this.threadChannel) { // The response is for another worker thread sent from the main thread this.threadChannel.postMessageToWorkerThread(message.data.sourceTid, message, transfer); @@ -186,7 +188,7 @@ class MessageBroker { this.handlers.onRequest(message); } else if ("postMessageToWorkerThread" in this.threadChannel) { - // Receive a request from a worker thread to other worker on main thread. + // Receive a request from a worker thread to other worker on main thread. // Proxy the request to the target worker thread. this.threadChannel.postMessageToWorkerThread(message.data.targetTid, message, []); } @@ -202,7 +204,9 @@ class MessageBroker { else if ("postMessageToWorkerThread" in this.threadChannel) { // Receive a response from a worker thread to other worker on main thread. // Proxy the response to the target worker thread. - const transfer = message.data.response.ok ? message.data.response.value.transfer : []; + const transfer = message.data.response.ok + ? message.data.response.value.transfer + : []; this.threadChannel.postMessageToWorkerThread(message.data.sourceTid, message, transfer); } else if ("postMessageToMainThread" in this.threadChannel) { @@ -213,7 +217,14 @@ class MessageBroker { } function serializeError(error) { if (error instanceof Error) { - return { isError: true, value: { message: error.message, name: error.name, stack: error.stack } }; + return { + isError: true, + value: { + message: error.message, + name: error.name, + stack: error.stack, + }, + }; } return { isError: false, value: error }; } @@ -224,19 +235,7 @@ function deserializeError(error) { return error.value; } -let globalVariable; -if (typeof globalThis !== "undefined") { - globalVariable = globalThis; -} -else if (typeof window !== "undefined") { - globalVariable = window; -} -else if (typeof global !== "undefined") { - globalVariable = global; -} -else if (typeof self !== "undefined") { - globalVariable = self; -} +const globalVariable = globalThis; class JSObjectSpace { constructor() { @@ -312,7 +311,8 @@ class SwiftRuntime { // 1. It may not be available in the global scope if the context is not cross-origin isolated. // 2. The underlying buffer may be still backed by SAB even if the context is not cross-origin // isolated (e.g. localhost on Chrome on Android). - if (Object.getPrototypeOf(wasmMemory.buffer).constructor.name === "SharedArrayBuffer") { + if (Object.getPrototypeOf(wasmMemory.buffer).constructor.name === + "SharedArrayBuffer") { // When the wasm memory is backed by a SharedArrayBuffer, growing the memory // doesn't invalidate the data view by setting the byte length to 0. Instead, // the data view points to an old buffer after growing the memory. So we have @@ -463,7 +463,10 @@ class SwiftRuntime { returnValue = { ok: true, value: result }; } catch (error) { - returnValue = { ok: false, error: serializeError(error) }; + returnValue = { + ok: false, + error: serializeError(error), + }; } const responseMessage = { type: "response", @@ -479,7 +482,7 @@ class SwiftRuntime { catch (error) { responseMessage.data.response = { ok: false, - error: serializeError(new TypeError(`Failed to serialize message: ${error}`)) + error: serializeError(new TypeError(`Failed to serialize message: ${error}`)), }; newBroker.reply(responseMessage); } @@ -494,7 +497,7 @@ class SwiftRuntime { const errorObject = this.memory.retain(error); this.exports.swjs_receive_error(errorObject, message.data.context); } - } + }, }); broker = newBroker; return newBroker; @@ -532,21 +535,19 @@ class SwiftRuntime { this.getDataView().setUint32(bytes_ptr_result, bytes_ptr, true); return bytes.length; }, - swjs_decode_string: ( + swjs_decode_string: // NOTE: TextDecoder can't decode typed arrays backed by SharedArrayBuffer this.options.sharedMemory == true - ? ((bytes_ptr, length) => { - const bytes = this.getUint8Array() - .slice(bytes_ptr, bytes_ptr + length); + ? (bytes_ptr, length) => { + const bytes = this.getUint8Array().slice(bytes_ptr, bytes_ptr + length); const string = this.textDecoder.decode(bytes); return this.memory.retain(string); - }) - : ((bytes_ptr, length) => { - const bytes = this.getUint8Array() - .subarray(bytes_ptr, bytes_ptr + length); + } + : (bytes_ptr, length) => { + const bytes = this.getUint8Array().subarray(bytes_ptr, bytes_ptr + length); const string = this.textDecoder.decode(bytes); return this.memory.retain(string); - })), + }, swjs_load_string: (ref, buffer) => { const bytes = this.memory.getObject(ref); this.getUint8Array().set(bytes, buffer); @@ -658,7 +659,9 @@ class SwiftRuntime { // Call `.slice()` to copy the memory return this.memory.retain(array.slice()); }, - swjs_create_object: () => { return this.memory.retain({}); }, + swjs_create_object: () => { + return this.memory.retain({}); + }, swjs_load_typed_array: (ref, buffer) => { const memory = this.memory; const typedArray = memory.getObject(ref); @@ -683,8 +686,8 @@ class SwiftRuntime { request: { method: "release", parameters: [ref], - } - } + }, + }, }); }, swjs_i64_to_bigint: (value, signed) => { @@ -708,17 +711,23 @@ class SwiftRuntime { swjs_i64_to_bigint_slow: (lower, upper, signed) => { const value = BigInt.asUintN(32, BigInt(lower)) + (BigInt.asUintN(32, BigInt(upper)) << BigInt(32)); - return this.memory.retain(signed ? BigInt.asIntN(64, value) : BigInt.asUintN(64, value)); + return this.memory.retain(signed + ? BigInt.asIntN(64, value) + : BigInt.asUintN(64, value)); }, swjs_unsafe_event_loop_yield: () => { throw new UnsafeEventLoopYield(); }, swjs_send_job_to_main_thread: (unowned_job) => { - this.postMessageToMainThread({ type: "job", data: unowned_job }); + this.postMessageToMainThread({ + type: "job", + data: unowned_job, + }); }, swjs_listen_message_from_main_thread: () => { const threadChannel = this.options.threadChannel; - if (!(threadChannel && "listenMessageFromMainThread" in threadChannel)) { + if (!(threadChannel && + "listenMessageFromMainThread" in threadChannel)) { throw new Error("listenMessageFromMainThread is not set in options given to SwiftRuntime. Please set it to listen to wake events from the main thread."); } const broker = getMessageBroker(threadChannel); @@ -746,7 +755,8 @@ class SwiftRuntime { }, swjs_listen_message_from_worker_thread: (tid) => { const threadChannel = this.options.threadChannel; - if (!(threadChannel && "listenMessageFromWorkerThread" in threadChannel)) { + if (!(threadChannel && + "listenMessageFromWorkerThread" in threadChannel)) { throw new Error("listenMessageFromWorkerThread is not set in options given to SwiftRuntime. Please set it to listen to jobs from worker threads."); } const broker = getMessageBroker(threadChannel); @@ -795,9 +805,13 @@ class SwiftRuntime { context: sending_context, request: { method: "send", - parameters: [sending_object, transferringObjects, sending_context], - } - } + parameters: [ + sending_object, + transferringObjects, + sending_context, + ], + }, + }, }); }, swjs_request_sending_objects: (sending_objects, sending_objects_count, transferring_objects, transferring_objects_count, object_source_tid, sending_context) => { @@ -817,9 +831,13 @@ class SwiftRuntime { context: sending_context, request: { method: "sendObjects", - parameters: [sendingObjects, transferringObjects, sending_context], - } - } + parameters: [ + sendingObjects, + transferringObjects, + sending_context, + ], + }, + }, }); }, }; diff --git a/Runtime/src/closure-heap.ts b/Runtime/src/closure-heap.ts index 269934390..0ec0ba9ac 100644 --- a/Runtime/src/closure-heap.ts +++ b/Runtime/src/closure-heap.ts @@ -10,7 +10,7 @@ export class SwiftClosureDeallocator { "The Swift part of JavaScriptKit was configured to require " + "the availability of JavaScript WeakRefs. Please build " + "with `-Xswiftc -DJAVASCRIPTKIT_WITHOUT_WEAKREFS` to " + - "disable features that use WeakRefs." + "disable features that use WeakRefs.", ); } diff --git a/Runtime/src/index.ts b/Runtime/src/index.ts index 27b52c7da..1d36c95d1 100644 --- a/Runtime/src/index.ts +++ b/Runtime/src/index.ts @@ -7,7 +7,16 @@ import { MAIN_THREAD_TID, } from "./types.js"; import * as JSValue from "./js-value.js"; -import { deserializeError, MainToWorkerMessage, MessageBroker, ResponseMessage, ITCInterface, serializeError, SwiftRuntimeThreadChannel, WorkerToMainMessage } from "./itc.js"; +import { + deserializeError, + MainToWorkerMessage, + MessageBroker, + ResponseMessage, + ITCInterface, + serializeError, + SwiftRuntimeThreadChannel, + WorkerToMainMessage, +} from "./itc.js"; import { decodeObjectRefs } from "./js-value.js"; import { JSObjectSpace } from "./object-heap.js"; export { SwiftRuntimeThreadChannel }; @@ -36,8 +45,8 @@ export class SwiftRuntime { private textEncoder = new TextEncoder(); // Only support utf-8 /** The thread ID of the current thread. */ private tid: number | null; - private getDataView: (() => DataView); - private getUint8Array: (() => Uint8Array); + private getDataView: () => DataView; + private getUint8Array: () => Uint8Array; private wasmMemory: WebAssembly.Memory | null; UnsafeEventLoopYield = UnsafeEventLoopYield; @@ -49,10 +58,14 @@ export class SwiftRuntime { this.tid = null; this.options = options || {}; this.getDataView = () => { - throw new Error("Please call setInstance() before using any JavaScriptKit APIs from Swift."); + throw new Error( + "Please call setInstance() before using any JavaScriptKit APIs from Swift.", + ); }; this.getUint8Array = () => { - throw new Error("Please call setInstance() before using any JavaScriptKit APIs from Swift."); + throw new Error( + "Please call setInstance() before using any JavaScriptKit APIs from Swift.", + ); }; this.wasmMemory = null; } @@ -70,7 +83,10 @@ export class SwiftRuntime { // 1. It may not be available in the global scope if the context is not cross-origin isolated. // 2. The underlying buffer may be still backed by SAB even if the context is not cross-origin // isolated (e.g. localhost on Chrome on Android). - if (Object.getPrototypeOf(wasmMemory.buffer).constructor.name === "SharedArrayBuffer") { + if ( + Object.getPrototypeOf(wasmMemory.buffer).constructor.name === + "SharedArrayBuffer" + ) { // When the wasm memory is backed by a SharedArrayBuffer, growing the memory // doesn't invalidate the data view by setting the byte length to 0. Instead, // the data view points to an old buffer after growing the memory. So we have @@ -105,14 +121,16 @@ export class SwiftRuntime { } this.wasmMemory = wasmMemory; } else { - throw new Error("instance.exports.memory is not a WebAssembly.Memory!?"); + throw new Error( + "instance.exports.memory is not a WebAssembly.Memory!?", + ); } if (typeof (this.exports as any)._start === "function") { throw new Error( `JavaScriptKit supports only WASI reactor ABI. Please make sure you are building with: -Xswiftc -Xclang-linker -Xswiftc -mexec-model=reactor - ` + `, ); } if (this.exports.swjs_library_version() != this.version) { @@ -120,7 +138,7 @@ export class SwiftRuntime { `The versions of JavaScriptKit are incompatible. WebAssembly runtime ${this.exports.swjs_library_version()} != JS runtime ${ this.version - }` + }`, ); } } @@ -159,7 +177,7 @@ export class SwiftRuntime { instance.exports.wasi_thread_start(tid, startArg); } else { throw new Error( - `The WebAssembly module is not built for wasm32-unknown-wasip1-threads target.` + `The WebAssembly module is not built for wasm32-unknown-wasip1-threads target.`, ); } } catch (error) { @@ -190,7 +208,7 @@ export class SwiftRuntime { (features & LibraryFeatures.WeakRefs) != 0; if (librarySupportsWeakRef) { this._closureDeallocator = new SwiftClosureDeallocator( - this.exports + this.exports, ); } return this._closureDeallocator; @@ -200,7 +218,7 @@ export class SwiftRuntime { host_func_id: number, line: number, file: string, - args: any[] + args: any[], ) { const argc = args.length; const argv = this.exports.swjs_prepare_host_function_call(argc); @@ -209,7 +227,15 @@ export class SwiftRuntime { for (let index = 0; index < args.length; index++) { const argument = args[index]; const base = argv + 16 * index; - JSValue.write(argument, base, base + 4, base + 8, false, dataView, memory); + JSValue.write( + argument, + base, + base + 4, + base + 8, + false, + dataView, + memory, + ); } let output: any; // This ref is released by the swjs_call_host_function implementation @@ -220,11 +246,11 @@ export class SwiftRuntime { host_func_id, argv, argc, - callback_func_ref + callback_func_ref, ); if (alreadyReleased) { throw new Error( - `The JSClosure has been already released by Swift side. The closure is created at ${file}:${line} @${host_func_id}` + `The JSClosure has been already released by Swift side. The closure is created at ${file}:${line} @${host_func_id}`, ); } this.exports.swjs_cleanup_host_function_call(argv); @@ -244,10 +270,15 @@ export class SwiftRuntime { let returnValue: ResponseMessage["data"]["response"]; try { // @ts-ignore - const result = itcInterface[message.data.request.method](...message.data.request.parameters); + const result = itcInterface[ + message.data.request.method + ](...message.data.request.parameters); returnValue = { ok: true, value: result }; } catch (error) { - returnValue = { ok: false, error: serializeError(error) }; + returnValue = { + ok: false, + error: serializeError(error), + }; } const responseMessage: ResponseMessage = { type: "response", @@ -256,38 +287,52 @@ export class SwiftRuntime { context: message.data.context, response: returnValue, }, - } + }; try { newBroker.reply(responseMessage); } catch (error) { responseMessage.data.response = { ok: false, - error: serializeError(new TypeError(`Failed to serialize message: ${error}`)) + error: serializeError( + new TypeError( + `Failed to serialize message: ${error}`, + ), + ), }; newBroker.reply(responseMessage); } }, onResponse: (message) => { if (message.data.response.ok) { - const object = this.memory.retain(message.data.response.value.object); - this.exports.swjs_receive_response(object, message.data.context); + const object = this.memory.retain( + message.data.response.value.object, + ); + this.exports.swjs_receive_response( + object, + message.data.context, + ); } else { - const error = deserializeError(message.data.response.error); + const error = deserializeError( + message.data.response.error, + ); const errorObject = this.memory.retain(error); - this.exports.swjs_receive_error(errorObject, message.data.context); + this.exports.swjs_receive_error( + errorObject, + message.data.context, + ); } - } - }) + }, + }); broker = newBroker; return newBroker; - } + }; return { swjs_set_prop: ( ref: ref, name: ref, kind: JSValue.Kind, payload1: number, - payload2: number + payload2: number, ) => { const memory = this.memory; const obj = memory.getObject(ref); @@ -299,7 +344,7 @@ export class SwiftRuntime { ref: ref, name: ref, payload1_ptr: pointer, - payload2_ptr: pointer + payload2_ptr: pointer, ) => { const memory = this.memory; const obj = memory.getObject(ref); @@ -311,7 +356,7 @@ export class SwiftRuntime { payload2_ptr, false, this.getDataView(), - this.memory + this.memory, ); }, @@ -320,7 +365,7 @@ export class SwiftRuntime { index: number, kind: JSValue.Kind, payload1: number, - payload2: number + payload2: number, ) => { const memory = this.memory; const obj = memory.getObject(ref); @@ -331,7 +376,7 @@ export class SwiftRuntime { ref: ref, index: number, payload1_ptr: pointer, - payload2_ptr: pointer + payload2_ptr: pointer, ) => { const obj = this.memory.getObject(ref); const result = obj[index]; @@ -341,7 +386,7 @@ export class SwiftRuntime { payload2_ptr, false, this.getDataView(), - this.memory + this.memory, ); }, @@ -352,22 +397,25 @@ export class SwiftRuntime { this.getDataView().setUint32(bytes_ptr_result, bytes_ptr, true); return bytes.length; }, - swjs_decode_string: ( + swjs_decode_string: // NOTE: TextDecoder can't decode typed arrays backed by SharedArrayBuffer this.options.sharedMemory == true - ? ((bytes_ptr: pointer, length: number) => { - const bytes = this.getUint8Array() - .slice(bytes_ptr, bytes_ptr + length); - const string = this.textDecoder.decode(bytes); - return this.memory.retain(string); - }) - : ((bytes_ptr: pointer, length: number) => { - const bytes = this.getUint8Array() - .subarray(bytes_ptr, bytes_ptr + length); - const string = this.textDecoder.decode(bytes); - return this.memory.retain(string); - }) - ), + ? (bytes_ptr: pointer, length: number) => { + const bytes = this.getUint8Array().slice( + bytes_ptr, + bytes_ptr + length, + ); + const string = this.textDecoder.decode(bytes); + return this.memory.retain(string); + } + : (bytes_ptr: pointer, length: number) => { + const bytes = this.getUint8Array().subarray( + bytes_ptr, + bytes_ptr + length, + ); + const string = this.textDecoder.decode(bytes); + return this.memory.retain(string); + }, swjs_load_string: (ref: ref, buffer: pointer) => { const bytes = this.memory.getObject(ref); this.getUint8Array().set(bytes, buffer); @@ -378,13 +426,18 @@ export class SwiftRuntime { argv: pointer, argc: number, payload1_ptr: pointer, - payload2_ptr: pointer + payload2_ptr: pointer, ) => { const memory = this.memory; const func = memory.getObject(ref); let result = undefined; try { - const args = JSValue.decodeArray(argv, argc, this.getDataView(), memory); + const args = JSValue.decodeArray( + argv, + argc, + this.getDataView(), + memory, + ); result = func(...args); } catch (error) { return JSValue.writeAndReturnKindBits( @@ -393,7 +446,7 @@ export class SwiftRuntime { payload2_ptr, true, this.getDataView(), - this.memory + this.memory, ); } return JSValue.writeAndReturnKindBits( @@ -402,7 +455,7 @@ export class SwiftRuntime { payload2_ptr, false, this.getDataView(), - this.memory + this.memory, ); }, swjs_call_function_no_catch: ( @@ -410,11 +463,16 @@ export class SwiftRuntime { argv: pointer, argc: number, payload1_ptr: pointer, - payload2_ptr: pointer + payload2_ptr: pointer, ) => { const memory = this.memory; const func = memory.getObject(ref); - const args = JSValue.decodeArray(argv, argc, this.getDataView(), memory); + const args = JSValue.decodeArray( + argv, + argc, + this.getDataView(), + memory, + ); const result = func(...args); return JSValue.writeAndReturnKindBits( result, @@ -422,7 +480,7 @@ export class SwiftRuntime { payload2_ptr, false, this.getDataView(), - this.memory + this.memory, ); }, @@ -432,14 +490,19 @@ export class SwiftRuntime { argv: pointer, argc: number, payload1_ptr: pointer, - payload2_ptr: pointer + payload2_ptr: pointer, ) => { const memory = this.memory; const obj = memory.getObject(obj_ref); const func = memory.getObject(func_ref); let result: any; try { - const args = JSValue.decodeArray(argv, argc, this.getDataView(), memory); + const args = JSValue.decodeArray( + argv, + argc, + this.getDataView(), + memory, + ); result = func.apply(obj, args); } catch (error) { return JSValue.writeAndReturnKindBits( @@ -448,7 +511,7 @@ export class SwiftRuntime { payload2_ptr, true, this.getDataView(), - this.memory + this.memory, ); } return JSValue.writeAndReturnKindBits( @@ -457,7 +520,7 @@ export class SwiftRuntime { payload2_ptr, false, this.getDataView(), - this.memory + this.memory, ); }, swjs_call_function_with_this_no_catch: ( @@ -466,13 +529,18 @@ export class SwiftRuntime { argv: pointer, argc: number, payload1_ptr: pointer, - payload2_ptr: pointer + payload2_ptr: pointer, ) => { const memory = this.memory; const obj = memory.getObject(obj_ref); const func = memory.getObject(func_ref); let result = undefined; - const args = JSValue.decodeArray(argv, argc, this.getDataView(), memory); + const args = JSValue.decodeArray( + argv, + argc, + this.getDataView(), + memory, + ); result = func.apply(obj, args); return JSValue.writeAndReturnKindBits( result, @@ -480,14 +548,19 @@ export class SwiftRuntime { payload2_ptr, false, this.getDataView(), - this.memory + this.memory, ); }, swjs_call_new: (ref: ref, argv: pointer, argc: number) => { const memory = this.memory; const constructor = memory.getObject(ref); - const args = JSValue.decodeArray(argv, argc, this.getDataView(), memory); + const args = JSValue.decodeArray( + argv, + argc, + this.getDataView(), + memory, + ); const instance = new constructor(...args); return this.memory.retain(instance); }, @@ -497,13 +570,18 @@ export class SwiftRuntime { argc: number, exception_kind_ptr: pointer, exception_payload1_ptr: pointer, - exception_payload2_ptr: pointer + exception_payload2_ptr: pointer, ) => { let memory = this.memory; const constructor = memory.getObject(ref); let result: any; try { - const args = JSValue.decodeArray(argv, argc, this.getDataView(), memory); + const args = JSValue.decodeArray( + argv, + argc, + this.getDataView(), + memory, + ); result = new constructor(...args); } catch (error) { JSValue.write( @@ -513,7 +591,7 @@ export class SwiftRuntime { exception_payload2_ptr, true, this.getDataView(), - this.memory + this.memory, ); return -1; } @@ -525,7 +603,7 @@ export class SwiftRuntime { exception_payload2_ptr, false, this.getDataView(), - memory + memory, ); return memory.retain(result); }, @@ -547,7 +625,7 @@ export class SwiftRuntime { swjs_create_function: ( host_func_id: number, line: number, - file: ref + file: ref, ) => { const fileString = this.memory.getObject(file) as string; const func = (...args: any[]) => @@ -560,7 +638,7 @@ export class SwiftRuntime { swjs_create_oneshot_function: ( host_func_id: number, line: number, - file: ref + file: ref, ) => { const fileString = this.memory.getObject(file) as string; const func = (...args: any[]) => @@ -569,13 +647,30 @@ export class SwiftRuntime { return func_ref; }, - swjs_create_typed_array: ( + swjs_create_typed_array: < + T extends + | Int8Array + | Uint8Array + | Int16Array + | Uint16Array + | Int32Array + | Uint32Array + | BigInt64Array + | BigUint64Array + | Float32Array + | Float64Array + | Uint8ClampedArray, + >( constructor_ref: ref, elementsPtr: pointer, - length: number + length: number, ) => { type TypedArrayConstructor = { - new (buffer: ArrayBuffer, byteOffset: number, length: number): T; + new ( + buffer: ArrayBuffer, + byteOffset: number, + length: number, + ): T; new (): T; }; const ArrayType: TypedArrayConstructor = @@ -592,13 +687,15 @@ export class SwiftRuntime { const array = new ArrayType( this.wasmMemory!.buffer, elementsPtr, - length + length, ); // Call `.slice()` to copy the memory return this.memory.retain(array.slice()); }, - swjs_create_object: () => { return this.memory.retain({}); }, + swjs_create_object: () => { + return this.memory.retain({}); + }, swjs_load_typed_array: (ref: ref, buffer: pointer) => { const memory = this.memory; @@ -613,7 +710,9 @@ export class SwiftRuntime { swjs_release_remote: (tid: number, ref: ref) => { if (!this.options.threadChannel) { - throw new Error("threadChannel is not set in options given to SwiftRuntime. Please set it to release objects on remote threads."); + throw new Error( + "threadChannel is not set in options given to SwiftRuntime. Please set it to release objects on remote threads.", + ); } const broker = getMessageBroker(this.options.threadChannel); broker.request({ @@ -625,20 +724,22 @@ export class SwiftRuntime { request: { method: "release", parameters: [ref], - } - } - }) + }, + }, + }); }, swjs_i64_to_bigint: (value: bigint, signed: number) => { return this.memory.retain( - signed ? value : BigInt.asUintN(64, value) + signed ? value : BigInt.asUintN(64, value), ); }, swjs_bigint_to_i64: (ref: ref, signed: number) => { const object = this.memory.getObject(ref); if (typeof object !== "bigint") { - throw new Error(`Expected a BigInt, but got ${typeof object}`); + throw new Error( + `Expected a BigInt, but got ${typeof object}`, + ); } if (signed) { return object; @@ -649,44 +750,60 @@ export class SwiftRuntime { return BigInt.asIntN(64, object); } }, - swjs_i64_to_bigint_slow: (lower: number, upper: number, signed: number) => { + swjs_i64_to_bigint_slow: ( + lower: number, + upper: number, + signed: number, + ) => { const value = BigInt.asUintN(32, BigInt(lower)) + (BigInt.asUintN(32, BigInt(upper)) << BigInt(32)); return this.memory.retain( - signed ? BigInt.asIntN(64, value) : BigInt.asUintN(64, value) + signed + ? BigInt.asIntN(64, value) + : BigInt.asUintN(64, value), ); }, swjs_unsafe_event_loop_yield: () => { throw new UnsafeEventLoopYield(); }, swjs_send_job_to_main_thread: (unowned_job: number) => { - this.postMessageToMainThread({ type: "job", data: unowned_job }); + this.postMessageToMainThread({ + type: "job", + data: unowned_job, + }); }, swjs_listen_message_from_main_thread: () => { const threadChannel = this.options.threadChannel; - if (!(threadChannel && "listenMessageFromMainThread" in threadChannel)) { + if ( + !( + threadChannel && + "listenMessageFromMainThread" in threadChannel + ) + ) { throw new Error( - "listenMessageFromMainThread is not set in options given to SwiftRuntime. Please set it to listen to wake events from the main thread." + "listenMessageFromMainThread is not set in options given to SwiftRuntime. Please set it to listen to wake events from the main thread.", ); } const broker = getMessageBroker(threadChannel); threadChannel.listenMessageFromMainThread((message) => { switch (message.type) { - case "wake": - this.exports.swjs_wake_worker_thread(); - break; - case "request": { - broker.onReceivingRequest(message); - break; - } - case "response": { - broker.onReceivingResponse(message); - break; - } - default: - const unknownMessage: never = message; - throw new Error(`Unknown message type: ${unknownMessage}`); + case "wake": + this.exports.swjs_wake_worker_thread(); + break; + case "request": { + broker.onReceivingRequest(message); + break; + } + case "response": { + broker.onReceivingResponse(message); + break; + } + default: + const unknownMessage: never = message; + throw new Error( + `Unknown message type: ${unknownMessage}`, + ); } }); }, @@ -695,17 +812,23 @@ export class SwiftRuntime { }, swjs_listen_message_from_worker_thread: (tid: number) => { const threadChannel = this.options.threadChannel; - if (!(threadChannel && "listenMessageFromWorkerThread" in threadChannel)) { + if ( + !( + threadChannel && + "listenMessageFromWorkerThread" in threadChannel + ) + ) { throw new Error( - "listenMessageFromWorkerThread is not set in options given to SwiftRuntime. Please set it to listen to jobs from worker threads." + "listenMessageFromWorkerThread is not set in options given to SwiftRuntime. Please set it to listen to jobs from worker threads.", ); } const broker = getMessageBroker(threadChannel); - threadChannel.listenMessageFromWorkerThread( - tid, (message) => { - switch (message.type) { + threadChannel.listenMessageFromWorkerThread(tid, (message) => { + switch (message.type) { case "job": - this.exports.swjs_enqueue_main_job_from_worker(message.data); + this.exports.swjs_enqueue_main_job_from_worker( + message.data, + ); break; case "request": { broker.onReceivingRequest(message); @@ -717,10 +840,11 @@ export class SwiftRuntime { } default: const unknownMessage: never = message; - throw new Error(`Unknown message type: ${unknownMessage}`); - } - }, - ); + throw new Error( + `Unknown message type: ${unknownMessage}`, + ); + } + }); }, swjs_terminate_worker_thread: (tid: number) => { const threadChannel = this.options.threadChannel; @@ -740,10 +864,16 @@ export class SwiftRuntime { sending_context: pointer, ) => { if (!this.options.threadChannel) { - throw new Error("threadChannel is not set in options given to SwiftRuntime. Please set it to request transferring objects."); + throw new Error( + "threadChannel is not set in options given to SwiftRuntime. Please set it to request transferring objects.", + ); } const broker = getMessageBroker(this.options.threadChannel); - const transferringObjects = decodeObjectRefs(transferring_objects, transferring_objects_count, this.getDataView()); + const transferringObjects = decodeObjectRefs( + transferring_objects, + transferring_objects_count, + this.getDataView(), + ); broker.request({ type: "request", data: { @@ -752,10 +882,14 @@ export class SwiftRuntime { context: sending_context, request: { method: "send", - parameters: [sending_object, transferringObjects, sending_context], - } - } - }) + parameters: [ + sending_object, + transferringObjects, + sending_context, + ], + }, + }, + }); }, swjs_request_sending_objects: ( sending_objects: pointer, @@ -766,12 +900,22 @@ export class SwiftRuntime { sending_context: pointer, ) => { if (!this.options.threadChannel) { - throw new Error("threadChannel is not set in options given to SwiftRuntime. Please set it to request transferring objects."); + throw new Error( + "threadChannel is not set in options given to SwiftRuntime. Please set it to request transferring objects.", + ); } const broker = getMessageBroker(this.options.threadChannel); const dataView = this.getDataView(); - const sendingObjects = decodeObjectRefs(sending_objects, sending_objects_count, dataView); - const transferringObjects = decodeObjectRefs(transferring_objects, transferring_objects_count, dataView); + const sendingObjects = decodeObjectRefs( + sending_objects, + sending_objects_count, + dataView, + ); + const transferringObjects = decodeObjectRefs( + transferring_objects, + transferring_objects_count, + dataView, + ); broker.request({ type: "request", data: { @@ -780,29 +924,40 @@ export class SwiftRuntime { context: sending_context, request: { method: "sendObjects", - parameters: [sendingObjects, transferringObjects, sending_context], - } - } - }) + parameters: [ + sendingObjects, + transferringObjects, + sending_context, + ], + }, + }, + }); }, }; } - private postMessageToMainThread(message: WorkerToMainMessage, transfer: any[] = []) { + private postMessageToMainThread( + message: WorkerToMainMessage, + transfer: any[] = [], + ) { const threadChannel = this.options.threadChannel; if (!(threadChannel && "postMessageToMainThread" in threadChannel)) { throw new Error( - "postMessageToMainThread is not set in options given to SwiftRuntime. Please set it to send messages to the main thread." + "postMessageToMainThread is not set in options given to SwiftRuntime. Please set it to send messages to the main thread.", ); } threadChannel.postMessageToMainThread(message, transfer); } - private postMessageToWorkerThread(tid: number, message: MainToWorkerMessage, transfer: any[] = []) { + private postMessageToWorkerThread( + tid: number, + message: MainToWorkerMessage, + transfer: any[] = [], + ) { const threadChannel = this.options.threadChannel; if (!(threadChannel && "postMessageToWorkerThread" in threadChannel)) { throw new Error( - "postMessageToWorkerThread is not set in options given to SwiftRuntime. Please set it to send messages to worker threads." + "postMessageToWorkerThread is not set in options given to SwiftRuntime. Please set it to send messages to worker threads.", ); } threadChannel.postMessageToWorkerThread(tid, message, transfer); diff --git a/Runtime/src/itc.ts b/Runtime/src/itc.ts index 08b420640..9fadff54a 100644 --- a/Runtime/src/itc.ts +++ b/Runtime/src/itc.ts @@ -39,19 +39,24 @@ import { JSObjectSpace as JSObjectSpace } from "./object-heap.js"; */ export type SwiftRuntimeThreadChannel = | { - /** - * This function is used to send messages from the worker thread to the main thread. - * The message submitted by this function is expected to be listened by `listenMessageFromWorkerThread`. - * @param message The message to be sent to the main thread. - * @param transfer The array of objects to be transferred to the main thread. - */ - postMessageToMainThread: (message: WorkerToMainMessage, transfer: any[]) => void; + /** + * This function is used to send messages from the worker thread to the main thread. + * The message submitted by this function is expected to be listened by `listenMessageFromWorkerThread`. + * @param message The message to be sent to the main thread. + * @param transfer The array of objects to be transferred to the main thread. + */ + postMessageToMainThread: ( + message: WorkerToMainMessage, + transfer: any[], + ) => void; /** * This function is expected to be set in the worker thread and should listen * to messages from the main thread sent by `postMessageToWorkerThread`. * @param listener The listener function to be called when a message is received from the main thread. */ - listenMessageFromMainThread: (listener: (message: MainToWorkerMessage) => void) => void; + listenMessageFromMainThread: ( + listener: (message: MainToWorkerMessage) => void, + ) => void; } | { /** @@ -61,7 +66,11 @@ export type SwiftRuntimeThreadChannel = * @param message The message to be sent to the worker thread. * @param transfer The array of objects to be transferred to the worker thread. */ - postMessageToWorkerThread: (tid: number, message: MainToWorkerMessage, transfer: any[]) => void; + postMessageToWorkerThread: ( + tid: number, + message: MainToWorkerMessage, + transfer: any[], + ) => void; /** * This function is expected to be set in the main thread and should listen * to messages sent by `postMessageToMainThread` from the worker thread. @@ -70,7 +79,7 @@ export type SwiftRuntimeThreadChannel = */ listenMessageFromWorkerThread: ( tid: number, - listener: (message: WorkerToMainMessage) => void + listener: (message: WorkerToMainMessage) => void, ) => void; /** @@ -81,23 +90,34 @@ export type SwiftRuntimeThreadChannel = terminateWorkerThread?: (tid: number) => void; }; - export class ITCInterface { constructor(private memory: JSObjectSpace) {} - send(sendingObject: ref, transferringObjects: ref[], sendingContext: pointer): { object: any, sendingContext: pointer, transfer: Transferable[] } { + send( + sendingObject: ref, + transferringObjects: ref[], + sendingContext: pointer, + ): { object: any; sendingContext: pointer; transfer: Transferable[] } { const object = this.memory.getObject(sendingObject); - const transfer = transferringObjects.map(ref => this.memory.getObject(ref)); + const transfer = transferringObjects.map((ref) => + this.memory.getObject(ref), + ); return { object, sendingContext, transfer }; } - sendObjects(sendingObjects: ref[], transferringObjects: ref[], sendingContext: pointer): { object: any[], sendingContext: pointer, transfer: Transferable[] } { - const objects = sendingObjects.map(ref => this.memory.getObject(ref)); - const transfer = transferringObjects.map(ref => this.memory.getObject(ref)); + sendObjects( + sendingObjects: ref[], + transferringObjects: ref[], + sendingContext: pointer, + ): { object: any[]; sendingContext: pointer; transfer: Transferable[] } { + const objects = sendingObjects.map((ref) => this.memory.getObject(ref)); + const transfer = transferringObjects.map((ref) => + this.memory.getObject(ref), + ); return { object: objects, sendingContext, transfer }; } - release(objectRef: ref): { object: undefined, transfer: Transferable[] } { + release(objectRef: ref): { object: undefined; transfer: Transferable[] } { this.memory.release(objectRef); return { object: undefined, transfer: [] }; } @@ -105,16 +125,18 @@ export class ITCInterface { type AllRequests> = { [K in keyof Interface]: { - method: K, - parameters: Parameters, - } -} + method: K; + parameters: Parameters; + }; +}; -type ITCRequest> = AllRequests[keyof AllRequests]; +type ITCRequest> = + AllRequests[keyof AllRequests]; type AllResponses> = { - [K in keyof Interface]: ReturnType -} -type ITCResponse> = AllResponses[keyof AllResponses]; + [K in keyof Interface]: ReturnType; +}; +type ITCResponse> = + AllResponses[keyof AllResponses]; export type RequestMessage = { type: "request"; @@ -127,10 +149,12 @@ export type RequestMessage = { context: pointer; /** The request content */ request: ITCRequest; - } -} + }; +}; -type SerializedError = { isError: true; value: Error } | { isError: false; value: unknown } +type SerializedError = + | { isError: true; value: Error } + | { isError: false; value: unknown }; export type ResponseMessage = { type: "response"; @@ -140,36 +164,42 @@ export type ResponseMessage = { /** The context pointer of the request */ context: pointer; /** The response content */ - response: { - ok: true, - value: ITCResponse; - } | { - ok: false, - error: SerializedError; - }; - } -} + response: + | { + ok: true; + value: ITCResponse; + } + | { + ok: false; + error: SerializedError; + }; + }; +}; -export type MainToWorkerMessage = { - type: "wake"; -} | RequestMessage | ResponseMessage; - -export type WorkerToMainMessage = { - type: "job"; - data: number; -} | RequestMessage | ResponseMessage; +export type MainToWorkerMessage = + | { + type: "wake"; + } + | RequestMessage + | ResponseMessage; +export type WorkerToMainMessage = + | { + type: "job"; + data: number; + } + | RequestMessage + | ResponseMessage; export class MessageBroker { constructor( private selfTid: number, private threadChannel: SwiftRuntimeThreadChannel, private handlers: { - onRequest: (message: RequestMessage) => void, - onResponse: (message: ResponseMessage) => void, - } - ) { - } + onRequest: (message: RequestMessage) => void; + onResponse: (message: ResponseMessage) => void; + }, + ) {} request(message: RequestMessage) { if (message.data.targetTid == this.selfTid) { @@ -177,7 +207,11 @@ export class MessageBroker { this.handlers.onRequest(message); } else if ("postMessageToWorkerThread" in this.threadChannel) { // The request is for another worker thread sent from the main thread - this.threadChannel.postMessageToWorkerThread(message.data.targetTid, message, []); + this.threadChannel.postMessageToWorkerThread( + message.data.targetTid, + message, + [], + ); } else if ("postMessageToMainThread" in this.threadChannel) { // The request is for other worker threads or the main thread sent from a worker thread this.threadChannel.postMessageToMainThread(message, []); @@ -192,10 +226,16 @@ export class MessageBroker { this.handlers.onResponse(message); return; } - const transfer = message.data.response.ok ? message.data.response.value.transfer : []; + const transfer = message.data.response.ok + ? message.data.response.value.transfer + : []; if ("postMessageToWorkerThread" in this.threadChannel) { // The response is for another worker thread sent from the main thread - this.threadChannel.postMessageToWorkerThread(message.data.sourceTid, message, transfer); + this.threadChannel.postMessageToWorkerThread( + message.data.sourceTid, + message, + transfer, + ); } else if ("postMessageToMainThread" in this.threadChannel) { // The response is for other worker threads or the main thread sent from a worker thread this.threadChannel.postMessageToMainThread(message, transfer); @@ -208,9 +248,13 @@ export class MessageBroker { if (message.data.targetTid == this.selfTid) { this.handlers.onRequest(message); } else if ("postMessageToWorkerThread" in this.threadChannel) { - // Receive a request from a worker thread to other worker on main thread. + // Receive a request from a worker thread to other worker on main thread. // Proxy the request to the target worker thread. - this.threadChannel.postMessageToWorkerThread(message.data.targetTid, message, []); + this.threadChannel.postMessageToWorkerThread( + message.data.targetTid, + message, + [], + ); } else if ("postMessageToMainThread" in this.threadChannel) { // A worker thread won't receive a request for other worker threads throw new Error("unreachable"); @@ -223,8 +267,14 @@ export class MessageBroker { } else if ("postMessageToWorkerThread" in this.threadChannel) { // Receive a response from a worker thread to other worker on main thread. // Proxy the response to the target worker thread. - const transfer = message.data.response.ok ? message.data.response.value.transfer : []; - this.threadChannel.postMessageToWorkerThread(message.data.sourceTid, message, transfer); + const transfer = message.data.response.ok + ? message.data.response.value.transfer + : []; + this.threadChannel.postMessageToWorkerThread( + message.data.sourceTid, + message, + transfer, + ); } else if ("postMessageToMainThread" in this.threadChannel) { // A worker thread won't receive a response for other worker threads throw new Error("unreachable"); @@ -234,7 +284,14 @@ export class MessageBroker { export function serializeError(error: unknown): SerializedError { if (error instanceof Error) { - return { isError: true, value: { message: error.message, name: error.name, stack: error.stack } }; + return { + isError: true, + value: { + message: error.message, + name: error.name, + stack: error.stack, + }, + }; } return { isError: false, value: error }; } diff --git a/Runtime/src/js-value.ts b/Runtime/src/js-value.ts index a188808bb..26574b532 100644 --- a/Runtime/src/js-value.ts +++ b/Runtime/src/js-value.ts @@ -1,5 +1,10 @@ import { JSObjectSpace } from "./object-heap.js"; -import { assertNever, JavaScriptValueKindAndFlags, pointer, ref } from "./types.js"; +import { + assertNever, + JavaScriptValueKindAndFlags, + pointer, + ref, +} from "./types.js"; export const enum Kind { Boolean = 0, @@ -16,7 +21,7 @@ export const decode = ( kind: Kind, payload1: number, payload2: number, - objectSpace: JSObjectSpace + objectSpace: JSObjectSpace, ) => { switch (kind) { case Kind.Boolean: @@ -48,7 +53,12 @@ export const decode = ( // Note: // `decodeValues` assumes that the size of RawJSValue is 16. -export const decodeArray = (ptr: pointer, length: number, memory: DataView, objectSpace: JSObjectSpace) => { +export const decodeArray = ( + ptr: pointer, + length: number, + memory: DataView, + objectSpace: JSObjectSpace, +) => { // fast path for empty array if (length === 0) { return []; @@ -76,7 +86,7 @@ export const write = ( payload2_ptr: pointer, is_exception: boolean, memory: DataView, - objectSpace: JSObjectSpace + objectSpace: JSObjectSpace, ) => { const kind = writeAndReturnKindBits( value, @@ -84,7 +94,7 @@ export const write = ( payload2_ptr, is_exception, memory, - objectSpace + objectSpace, ); memory.setUint32(kind_ptr, kind, true); }; @@ -95,7 +105,7 @@ export const writeAndReturnKindBits = ( payload2_ptr: pointer, is_exception: boolean, memory: DataView, - objectSpace: JSObjectSpace + objectSpace: JSObjectSpace, ): JavaScriptValueKindAndFlags => { const exceptionBit = (is_exception ? 1 : 0) << 31; if (value === null) { @@ -141,7 +151,11 @@ export const writeAndReturnKindBits = ( throw new Error("Unreachable"); }; -export function decodeObjectRefs(ptr: pointer, length: number, memory: DataView): ref[] { +export function decodeObjectRefs( + ptr: pointer, + length: number, + memory: DataView, +): ref[] { const result: ref[] = new Array(length); for (let i = 0; i < length; i++) { result[i] = memory.getUint32(ptr + 4 * i, true); diff --git a/Runtime/src/object-heap.ts b/Runtime/src/object-heap.ts index b90fc4eff..ba9cf8021 100644 --- a/Runtime/src/object-heap.ts +++ b/Runtime/src/object-heap.ts @@ -51,7 +51,7 @@ export class JSObjectSpace { const value = this._heapValueById.get(ref); if (value === undefined) { throw new ReferenceError( - "Attempted to read invalid reference " + ref + "Attempted to read invalid reference " + ref, ); } return value; diff --git a/Runtime/src/types.ts b/Runtime/src/types.ts index b8345cdfa..b39e949b2 100644 --- a/Runtime/src/types.ts +++ b/Runtime/src/types.ts @@ -13,7 +13,7 @@ export interface ExportedFunctions { host_func_id: number, argv: pointer, argc: number, - callback_func_ref: ref + callback_func_ref: ref, ): bool; swjs_free_host_function(host_func_id: number): void; From 116b6d94425afa951cace0578e181c6f3509cbeb Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 18 Feb 2026 09:52:27 +0900 Subject: [PATCH 234/252] PlayBridgeJS: Stop wrapping lines in the editor --- Examples/PlayBridgeJS/Sources/JavaScript/editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/PlayBridgeJS/Sources/JavaScript/editor.js b/Examples/PlayBridgeJS/Sources/JavaScript/editor.js index c894598a4..97e78a1f8 100644 --- a/Examples/PlayBridgeJS/Sources/JavaScript/editor.js +++ b/Examples/PlayBridgeJS/Sources/JavaScript/editor.js @@ -97,7 +97,7 @@ export class EditorSystem { scrollbar: { vertical: 'visible', horizontal: 'visible' }, fixedOverflowWidgets: true, renderWhitespace: 'none', - wordWrap: 'on' + wordWrap: 'off' }; // Create all editors from config From 1b35993919fce1f8f3aa24b5b333782c55c484aa Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 18 Feb 2026 09:50:33 +0900 Subject: [PATCH 235/252] BridgeJS: Add runtime tests for `@JS class` to JSObject conversion --- Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift b/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift index 7eefbad56..64eaeafd4 100644 --- a/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift +++ b/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift @@ -19,4 +19,10 @@ final class SwiftClassSupportTests: XCTestCase { let greeter2 = try SwiftClassSupportImports.jsRoundTripOptionalGreeter(Greeter(name: "Hello")) XCTAssertEqual(greeter2?.name, "Hello") } + + func testSwiftClassToJSObject() throws { + let greeter = Greeter(name: "BridgeJS") + let jsGreeter = try XCTUnwrap(greeter.jsValue.object) + XCTAssertEqual(jsGreeter["name"].string, "BridgeJS") + } } From 969e696af3ebb4084586e36cca838b2ba576efdb Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 18 Feb 2026 14:13:50 +0900 Subject: [PATCH 236/252] PackageToJS: Rebuild bridge-js.js when BridgeJSLink is changed Also use `ProcessInfo.processInfo.arguments[0]` instead of `#filePath` to detect changes to the plugin executable, which is more robust to changes in the source file location. --- Plugins/PackageToJS/Sources/PackageToJS.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Plugins/PackageToJS/Sources/PackageToJS.swift b/Plugins/PackageToJS/Sources/PackageToJS.swift index 2e47dcf71..3e22736be 100644 --- a/Plugins/PackageToJS/Sources/PackageToJS.swift +++ b/Plugins/PackageToJS/Sources/PackageToJS.swift @@ -422,7 +422,10 @@ struct PackagingPlanner { wasmFilename: String, configuration: String, triple: String, - selfPath: BuildPath = BuildPath(absolute: #filePath), + // NOTE: We should use `ProcessInfo.processInfo.arguments[0]` instead of `CommandLine.arguments[0]` + // because the latter may not always be the full executable path (e.g. when invoked through PATH lookup). + // https://github.com/swiftlang/swift-foundation/blob/f5143f96d01cdb6d280665de8221b75fc8631d95/Sources/FoundationEssentials/ProcessInfo/ProcessInfo.swift#L47 + selfPath: BuildPath = BuildPath(absolute: ProcessInfo.processInfo.arguments[0]), system: any PackagingSystem ) { self.options = options @@ -592,7 +595,7 @@ struct PackagingPlanner { let bridgeJs = outputDir.appending(path: "bridge-js.js") let bridgeDts = outputDir.appending(path: "bridge-js.d.ts") packageInputs.append( - make.addTask(inputFiles: skeletons, output: bridgeJs) { _, scope in + make.addTask(inputFiles: skeletons + [selfPath], output: bridgeJs) { _, scope in var link = BridgeJSLink( sharedMemory: Self.isSharedMemoryEnabled(triple: triple) ) From 012fb6b101ea8a9c5e9637ee29ecea29c7133a0e Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 18 Feb 2026 14:45:08 +0900 Subject: [PATCH 237/252] BridgeJS: Fix SwiftHeapObject finalization registry leaks and double release --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 26 ++++++++++----- .../BridgeJSLinkTests/ArrayTypes.js | 26 ++++++++++----- .../BridgeJSLinkTests/DefaultParameters.js | 26 ++++++++++----- .../BridgeJSLinkTests/DictionaryTypes.js | 26 ++++++++++----- .../BridgeJSLinkTests/EnumAssociatedValue.js | 26 ++++++++++----- .../BridgeJSLinkTests/EnumNamespace.Global.js | 26 ++++++++++----- .../BridgeJSLinkTests/EnumNamespace.js | 26 ++++++++++----- .../BridgeJSLinkTests/JSValue.js | 26 ++++++++++----- .../BridgeJSLinkTests/MixedGlobal.js | 26 ++++++++++----- .../BridgeJSLinkTests/MixedModules.js | 26 ++++++++++----- .../BridgeJSLinkTests/MixedPrivate.js | 26 ++++++++++----- .../BridgeJSLinkTests/Namespaces.Global.js | 26 ++++++++++----- .../BridgeJSLinkTests/Namespaces.js | 26 ++++++++++----- .../BridgeJSLinkTests/Optionals.js | 26 ++++++++++----- .../BridgeJSLinkTests/PropertyTypes.js | 26 ++++++++++----- .../BridgeJSLinkTests/Protocol.js | 26 ++++++++++----- .../StaticFunctions.Global.js | 26 ++++++++++----- .../BridgeJSLinkTests/StaticFunctions.js | 26 ++++++++++----- .../StaticProperties.Global.js | 26 ++++++++++----- .../BridgeJSLinkTests/StaticProperties.js | 26 ++++++++++----- .../BridgeJSLinkTests/SwiftClass.js | 26 ++++++++++----- .../BridgeJSLinkTests/SwiftClosure.js | 26 ++++++++++----- .../BridgeJSLinkTests/SwiftStruct.js | 26 ++++++++++----- .../Generated/BridgeJS.swift | 16 ++++++++++ .../Generated/JavaScript/BridgeJS.json | 11 +++++++ .../SwiftClassSupportTests.swift | 32 +++++++++++++++++++ Tests/prelude.mjs | 5 +++ 27 files changed, 478 insertions(+), 184 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 625b82b6e..5bf17256d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -51,23 +51,33 @@ public struct BridgeJSLink { """ let swiftHeapObjectClassJs = """ + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + 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 5944dc257..7db995321 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -355,23 +355,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class Item extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index adb9143cf..a89b07fc3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -295,23 +295,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class DefaultGreeter extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index 41a6074ea..d42fd4b2b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -242,23 +242,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class Box extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index a5ead8a1c..2d2c6924b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -1042,23 +1042,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class User extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index 887f5ff3f..ee93a950a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -267,23 +267,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class Converter extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index a9470aad7..099ef0576 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -248,23 +248,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class Converter extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index ab59944ce..8151ea913 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -343,23 +343,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class JSValueHolder extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index ee89f5e5f..900d9b19c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -215,23 +215,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class GlobalClass extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index ab54a88c3..9b5f9267e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -223,23 +223,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class GlobalClass extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index 24dac8d27..1ab3809cc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -215,23 +215,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class PrivateClass extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index 3ce2779e1..ea5902783 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -223,23 +223,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class Greeter extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index d4437f0c1..5930b6914 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -223,23 +223,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class Greeter extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 349921a25..4c0bd0d13 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -475,23 +475,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class Greeter extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index 024523591..e7d80bb4d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -215,23 +215,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class PropertyHolder extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 0ff740ad1..58928211e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -576,23 +576,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class Helper extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 370ca98b4..247374a3b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -263,23 +263,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class MathUtils extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index bd7964c85..a3bfb8a24 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -263,23 +263,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class MathUtils extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index b5155bddf..05127cd14 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -220,23 +220,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class PropertyClass extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index 47918485d..5e89f1bb4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -220,23 +220,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class PropertyClass extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index 7dce46d8e..8f0552b64 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -243,23 +243,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class Greeter extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index d701e93d7..5fbde8c82 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -904,23 +904,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class Person extends SwiftHeapObject { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index f3c0810c1..6f704013b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -527,23 +527,33 @@ 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) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.deinit(state.pointer); + }); + /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype) { const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false }; obj.pointer = pointer; - obj.hasReleased = false; - obj.deinit = deinit; - obj.registry = new FinalizationRegistry((pointer) => { - deinit(pointer); - }); - obj.registry.register(this, obj.pointer); + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); return obj; } release() { - this.registry.unregister(this); - this.deinit(this.pointer); + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.deinit(state.pointer); } } class Greeter extends SwiftHeapObject { diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 78c9014d7..8c1d63854 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -10375,6 +10375,22 @@ func _$OptionalSupportImports_runJsOptionalSupportTests() throws(JSException) -> } } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_gc") +fileprivate func bjs_gc() -> Void +#else +fileprivate func bjs_gc() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +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(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 2cd992ea4..45acc8a9c 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -15572,7 +15572,18 @@ }, { "functions" : [ + { + "from" : "global", + "name" : "gc", + "parameters" : [ + + ], + "returnType" : { + "void" : { + } + } + } ], "types" : [ { diff --git a/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift b/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift index 64eaeafd4..d9a68b1cc 100644 --- a/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift +++ b/Tests/BridgeJSRuntimeTests/SwiftClassSupportTests.swift @@ -6,6 +6,8 @@ import JavaScriptKit @JSFunction static func jsRoundTripOptionalGreeter(_ greeter: Greeter?) throws(JSException) -> Greeter? } +@JSFunction(from: .global) func gc() throws(JSException) -> Void + final class SwiftClassSupportTests: XCTestCase { func testRoundTripGreeter() throws { let greeter = try SwiftClassSupportImports.jsRoundTripGreeter(Greeter(name: "Hello")) @@ -25,4 +27,34 @@ final class SwiftClassSupportTests: XCTestCase { let jsGreeter = try XCTUnwrap(greeter.jsValue.object) XCTAssertEqual(jsGreeter["name"].string, "BridgeJS") } + + func testJSWrapperIsDeallocatedAfterFinalization() async throws { + weak var weakGreeter: Greeter? + var wrapperObject: JSObject? + do { + let greeter: Greeter = Greeter(name: "Hello") + weakGreeter = greeter + // Create a JS wrapper object but don't keep a reference to it + wrapperObject = try XCTUnwrap(greeter.jsValue.object) + } + // Here, the wrapper object is still alive so the greeter should still be alive + XCTAssertNotNil(weakGreeter) + + // Release the strong reference to the greeter + wrapperObject = nil + _ = wrapperObject + + // Trigger garbage collection to call the finalizer of the JS wrapper object + for _ in 0..<100 { + try gc() + // Tick the event loop to allow the garbage collector to run finalizers + // registered by FinalizationRegistry. + try await Task.sleep(for: .milliseconds(0)) + if weakGreeter == nil { + break + } + } + // Here, the greeter should be deallocated + XCTAssertNil(weakGreeter) + } } diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index d40a2845c..e55266e9c 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -337,6 +337,11 @@ function BridgeJSRuntimeTests_runJsWorks(instance, exports) { assert.equal(g2.prefix, "Hello"); g2.release(); + // release should be idempotent + const g3 = new exports.Greeter("Idempotent"); + g3.release(); + g3.release(); + g.release(); const foo = exports.makeImportedFoo("hello"); From 0387eef7b050e474ab1749d4dcef67405154b012 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 18 Feb 2026 08:23:42 +0100 Subject: [PATCH 238/252] Add AI coding agent config files to gitignore --- .gitignore | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.gitignore b/.gitignore index c34d4dfe2..61397cf5b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,19 @@ Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package-lock.json Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/**/*.actual bridge-js.config.local.json _site/ + +# AI coding agent config files +AGENTS.md +CLAUDE.md +GEMINI.md +.claude/ +.opencode/ +.cursor/ +.cursorrules +.codex/ +.aider* +.cline/ +.clinerules +.windsurf/ +.windsurfrules +.codeiumignore From 7fbf3e171b3be6d1f5b92793eca6ff95767b1d7a Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 18 Feb 2026 08:26:19 +0100 Subject: [PATCH 239/252] Runtime: Fix lint issues in compiled output --- Plugins/PackageToJS/Templates/runtime.mjs | 12 +++++++----- Runtime/src/index.ts | 11 ++++++----- Runtime/src/js-value.ts | 1 + 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Plugins/PackageToJS/Templates/runtime.mjs b/Plugins/PackageToJS/Templates/runtime.mjs index e0bcf3e05..d79275476 100644 --- a/Plugins/PackageToJS/Templates/runtime.mjs +++ b/Plugins/PackageToJS/Templates/runtime.mjs @@ -30,6 +30,7 @@ const decode = (kind, payload1, payload2, objectSpace) => { case 1: return true; } + // falls through case 2 /* Kind.Number */: return payload2; case 1 /* Kind.String */: @@ -555,7 +556,7 @@ class SwiftRuntime { swjs_call_function: (ref, argv, argc, payload1_ptr, payload2_ptr) => { const memory = this.memory; const func = memory.getObject(ref); - let result = undefined; + let result; try { const args = decodeArray(argv, argc, this.getDataView(), memory); result = func(...args); @@ -590,9 +591,8 @@ class SwiftRuntime { const memory = this.memory; const obj = memory.getObject(obj_ref); const func = memory.getObject(func_ref); - let result = undefined; const args = decodeArray(argv, argc, this.getDataView(), memory); - result = func.apply(obj, args); + const result = func.apply(obj, args); return writeAndReturnKindBits(result, payload1_ptr, payload2_ptr, false, this.getDataView(), this.memory); }, swjs_call_new: (ref, argv, argc) => { @@ -744,9 +744,10 @@ class SwiftRuntime { broker.onReceivingResponse(message); break; } - default: + default: { const unknownMessage = message; throw new Error(`Unknown message type: ${unknownMessage}`); + } } }); }, @@ -773,9 +774,10 @@ class SwiftRuntime { broker.onReceivingResponse(message); break; } - default: + default: { const unknownMessage = message; throw new Error(`Unknown message type: ${unknownMessage}`); + } } }); }, diff --git a/Runtime/src/index.ts b/Runtime/src/index.ts index 1d36c95d1..5d6fe258f 100644 --- a/Runtime/src/index.ts +++ b/Runtime/src/index.ts @@ -430,7 +430,7 @@ export class SwiftRuntime { ) => { const memory = this.memory; const func = memory.getObject(ref); - let result = undefined; + let result: any; try { const args = JSValue.decodeArray( argv, @@ -534,14 +534,13 @@ export class SwiftRuntime { const memory = this.memory; const obj = memory.getObject(obj_ref); const func = memory.getObject(func_ref); - let result = undefined; const args = JSValue.decodeArray( argv, argc, this.getDataView(), memory, ); - result = func.apply(obj, args); + const result = func.apply(obj, args); return JSValue.writeAndReturnKindBits( result, payload1_ptr, @@ -799,11 +798,12 @@ export class SwiftRuntime { broker.onReceivingResponse(message); break; } - default: + default: { const unknownMessage: never = message; throw new Error( `Unknown message type: ${unknownMessage}`, ); + } } }); }, @@ -838,11 +838,12 @@ export class SwiftRuntime { broker.onReceivingResponse(message); break; } - default: + default: { const unknownMessage: never = message; throw new Error( `Unknown message type: ${unknownMessage}`, ); + } } }); }, diff --git a/Runtime/src/js-value.ts b/Runtime/src/js-value.ts index 26574b532..b044e5cbe 100644 --- a/Runtime/src/js-value.ts +++ b/Runtime/src/js-value.ts @@ -31,6 +31,7 @@ export const decode = ( case 1: return true; } + // falls through case Kind.Number: return payload2; From 67a3104fc7bd6e0fd5c001cccef4cb9004048ec3 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 18 Feb 2026 19:01:53 +0900 Subject: [PATCH 240/252] BridgeJS: Improve ts2swift diagnostics on invalid definitions ``` $ cat /tmp/tmp.UUlUCtSa64/foo.d.ts export function x(): ; $ node Plugins/BridgeJS/Sources/TS2Swift/JavaScript/bin/ts2swift.js /tmp/tmp.UUlUCtSa64/foo.d.ts error: TypeScript syntax errors: /tmp/tmp.UUlUCtSa64/foo.d.ts:1:22 - error TS1110: Type expected. 1 export function x(): ; ``` --- .../Sources/TS2Swift/JavaScript/src/cli.js | 29 +++++++++++++++++-- .../TS2Swift/JavaScript/test/ts2swift.test.js | 14 ++++++++- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js index 25d88b828..c7ac79051 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js @@ -122,14 +122,30 @@ export function run(filePaths, options) { } const program = TypeProcessor.createProgram([...filePaths, ...globalFiles], configParseResult.options); - const diagnostics = program.getSemanticDiagnostics(); - if (diagnostics.length > 0) { + + const formatDiagnostics = (diagnostics, kind) => { + if (diagnostics.length === 0) return null; const message = ts.formatDiagnosticsWithColorAndContext(diagnostics, { getCanonicalFileName: (fileName) => fileName, getNewLine: () => ts.sys.newLine, getCurrentDirectory: () => ts.sys.getCurrentDirectory(), }); - throw new Error(`TypeScript semantic errors:\n${message}`); + return `${kind} errors:\n${message}`; + }; + + const syntaxErrors = formatDiagnostics(program.getSyntacticDiagnostics(), "TypeScript syntax"); + if (syntaxErrors) { + throw new Error(syntaxErrors); + } + + const optionErrors = formatDiagnostics(program.getOptionsDiagnostics(), "TypeScript option"); + if (optionErrors) { + throw new Error(optionErrors); + } + + const semanticErrors = formatDiagnostics(program.getSemanticDiagnostics(), "TypeScript semantic"); + if (semanticErrors) { + throw new Error(semanticErrors); } const prelude = [ @@ -244,6 +260,13 @@ export function main(args) { cleanup(); } } + + if (swiftOutput.length === 0) { + diagnosticEngine.print( + "warning", + "No Swift declarations were generated. This usually means the .d.ts contained constructs that BridgeJS cannot import." + ); + } // Write to file or stdout if (options.values.output && options.values.output !== "-") { if (swiftOutput.length > 0) { diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js index 8ca1df7c9..d0ccf220a 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js @@ -1,8 +1,9 @@ // @ts-check import { describe, it, expect } from 'vitest'; -import { readdirSync } from 'fs'; +import { readdirSync, mkdtempSync, writeFileSync, rmSync } from 'fs'; import { fileURLToPath } from 'url'; import path from 'path'; +import os from 'os'; import { run } from '../src/cli.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -38,4 +39,15 @@ describe('ts2swift', () => { expect(swiftOutput).toMatchSnapshot(name); }); } + + it('reports TypeScript syntax errors via thrown message', () => { + const tmpDir = mkdtempSync(path.join(os.tmpdir(), 'ts2swift-invalid-')); + const invalidPath = path.join(tmpDir, 'invalid.d.ts'); + writeFileSync(invalidPath, 'function foo(x'); + try { + expect(() => runTs2Swift(invalidPath)).toThrowError(/TypeScript syntax errors/); + } finally { + rmSync(tmpDir, { recursive: true, force: true }); + } + }); }); From 9527aa5801643ad7389b41cd28940b06cc1fc906 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 18 Feb 2026 20:50:24 +0900 Subject: [PATCH 241/252] TS2Swift: emit enums for string literal unions --- .../TS2Swift/JavaScript/src/processor.js | 92 +++++++++++++++++++ .../test/__snapshots__/ts2swift.test.js.snap | 27 ++++++ .../test/fixtures/StringLiteralUnion.d.ts | 3 + 3 files changed, 122 insertions(+) create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StringLiteralUnion.d.ts diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 53216a78c..fd4873752 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -54,6 +54,10 @@ export class TypeProcessor { this.emittedEnumNames = new Set(); /** @type {Set} */ this.emittedStructuredTypeNames = new Set(); + /** @type {Set} */ + this.emittedStringLiteralUnionNames = new Set(); + /** @type {Set} */ + this.emittedStringLiteralUnionNames = new Set(); /** @type {Set} */ this.visitedDeclarationKeys = new Set(); @@ -145,6 +149,11 @@ export class TypeProcessor { for (const [type, node] of this.seenTypes) { this.seenTypes.delete(type); + const stringLiteralUnion = this.getStringLiteralUnionLiterals(type); + if (stringLiteralUnion && stringLiteralUnion.length > 0) { + this.emitStringLiteralUnion(type, node); + continue; + } if (this.isEnumType(type)) { this.visitEnumType(type, node); continue; @@ -296,6 +305,73 @@ export class TypeProcessor { return (symbol.flags & ts.SymbolFlags.Enum) !== 0; } + dedupeSwiftEnumCaseNames(items) { + const seen = new Map(); + return items.map(item => { + const count = seen.get(item.name) ?? 0; + seen.set(item.name, count + 1); + if (count === 0) return item; + return { ...item, name: `${item.name}_${count + 1}` }; + }); + } + + /** + * Extract string literal values if the type is a union containing only string literals. + * Returns null when any member is not a string literal. + * @param {ts.Type} type + * @returns {string[] | null} + * @private + */ + getStringLiteralUnionLiterals(type) { + if ((type.flags & ts.TypeFlags.Union) === 0) return null; + /** @type {ts.UnionType} */ + // @ts-ignore + const unionType = type; + /** @type {string[]} */ + const literals = []; + const seen = new Set(); + for (const member of unionType.types) { + if ((member.flags & ts.TypeFlags.StringLiteral) === 0) { + return null; + } + // @ts-ignore value exists for string literal types + const value = String(member.value); + if (seen.has(value)) continue; + seen.add(value); + literals.push(value); + } + return literals; + } + + /** + * @param {ts.Type} type + * @param {ts.Node} diagnosticNode + * @private + */ + emitStringLiteralUnion(type, diagnosticNode) { + const typeName = this.deriveTypeName(type); + if (!typeName) return; + if (this.emittedStringLiteralUnionNames.has(typeName)) return; + this.emittedStringLiteralUnionNames.add(typeName); + + const literals = this.getStringLiteralUnionLiterals(type); + if (!literals || literals.length === 0) return; + + const swiftEnumName = this.renderTypeIdentifier(typeName); + /** @type {{ name: string, raw: string }[]} */ + const members = literals.map(raw => ({ name: makeValidSwiftIdentifier(String(raw), { emptyFallback: "_case" }), raw: String(raw) })); + const deduped = this.dedupeSwiftEnumCaseNames(members); + + this.emitDocComment(diagnosticNode, { indent: "" }); + this.swiftLines.push(`enum ${swiftEnumName}: String {`); + for (const { name, raw } of deduped) { + this.swiftLines.push(` case ${this.renderIdentifier(name)} = "${raw.replaceAll("\"", "\\\"")}"`); + } + this.swiftLines.push("}"); + this.swiftLines.push(`extension ${swiftEnumName}: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {}`); + this.swiftLines.push(""); + } + /** * @param {ts.EnumDeclaration} node * @private @@ -841,6 +917,7 @@ export class TypeProcessor { * @returns {string} */ const convert = (type) => { + const originalType = type; // Handle nullable/undefined unions (e.g. T | null, T | undefined) const isUnionType = (type.flags & ts.TypeFlags.Union) !== 0; if (isUnionType) { @@ -863,6 +940,15 @@ export class TypeProcessor { } return `JSUndefinedOr<${wrapped}>`; } + + const stringLiteralUnion = this.getStringLiteralUnionLiterals(type); + if (stringLiteralUnion && stringLiteralUnion.length > 0) { + const typeName = this.deriveTypeName(originalType) ?? this.deriveTypeName(type); + if (typeName) { + this.seenTypes.set(originalType, node); + return this.renderTypeIdentifier(typeName); + } + } } /** @type {Record} */ @@ -892,6 +978,12 @@ export class TypeProcessor { return this.renderTypeIdentifier(typeName); } + const stringLiteralUnion = this.getStringLiteralUnionLiterals(type); + if (stringLiteralUnion && stringLiteralUnion.length > 0) { + this.seenTypes.set(type, node); + return this.renderTypeIdentifier(this.deriveTypeName(type) ?? this.checker.typeToString(type)); + } + if (this.checker.isTupleType(type) || type.getCallSignatures().length > 0) { return "JSObject"; } diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index 85d1da0de..a13540993 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -355,10 +355,37 @@ extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} @JSFunction func takesFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> Void +enum FeatureFlag: String { + case foo = "foo" + case bar = "bar" +} +extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} + @JSFunction func returnsFeatureFlag() throws(JSException) -> FeatureFlag " `; +exports[`ts2swift > snapshots Swift output for StringLiteralUnion.d.ts > StringLiteralUnion 1`] = ` +"// 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 + +@JSFunction func move(_ direction: Direction) throws(JSException) -> Void + +enum Direction: String { + case up = "up" + case down = "down" + case left = "left" + case right = "right" +} +extension Direction: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} +" +`; + exports[`ts2swift > snapshots Swift output for StringParameter.d.ts > StringParameter 1`] = ` "// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StringLiteralUnion.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StringLiteralUnion.d.ts new file mode 100644 index 000000000..2c01a23fa --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StringLiteralUnion.d.ts @@ -0,0 +1,3 @@ +export type Direction = "up" | "down" | "left" | "right"; + +export function move(direction: Direction): void; From 30cf39abf9687924b7523d17cfa27da976cc704b Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 18 Feb 2026 21:02:09 +0900 Subject: [PATCH 242/252] Merge pull request #652 from swiftwasm/katei/32f9-ts2swift-treat-c TS2Swift: treat callable exported consts as functions --- .../TS2Swift/JavaScript/src/processor.js | 20 ++++++++++++++++++- .../test/__snapshots__/ts2swift.test.js.snap | 16 +++++++++++++++ .../test/fixtures/CallableConst.d.ts | 2 ++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/CallableConst.d.ts diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 53216a78c..ed332dd3c 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -261,6 +261,7 @@ export class TypeProcessor { if (!isExported) return; const fromArg = this.renderDefaultJSImportFromArgument(); + const isConst = (node.declarationList.flags & ts.NodeFlags.Const) !== 0; for (const decl of node.declarationList.declarations) { if (!ts.isIdentifier(decl.name)) continue; @@ -270,13 +271,30 @@ export class TypeProcessor { const swiftVarName = this.renderIdentifier(swiftName); const type = this.checker.getTypeAtLocation(decl); - const swiftType = this.visitType(type, decl); /** @type {string[]} */ const args = []; const jsNameArg = this.renderOptionalJSNameArg(jsName, swiftName); if (jsNameArg) args.push(jsNameArg); if (fromArg) args.push(fromArg); + const callSignatures = type.getCallSignatures(); + + if (isConst && callSignatures.length > 0) { + const signature = callSignatures[0]; + const parameters = signature.getParameters(); + const parameterNameMap = this.buildParameterNameMap(parameters); + const params = this.renderParameters(parameters, decl); + const returnType = this.visitType(signature.getReturnType(), decl); + const effects = this.renderEffects({ isAsync: false }); + const annotation = this.renderMacroAnnotation("JSFunction", args); + + this.emitDocComment(decl, { indent: "", parameterNameMap }); + this.swiftLines.push(`${annotation} func ${swiftVarName}(${params}) ${effects} -> ${returnType}`); + this.swiftLines.push(""); + continue; + } + + const swiftType = this.visitType(type, decl); const annotation = this.renderMacroAnnotation("JSGetter", args); this.emitDocComment(decl, { indent: "" }); diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index 85d1da0de..223927700 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -48,6 +48,22 @@ exports[`ts2swift > snapshots Swift output for Async.d.ts > Async 1`] = ` " `; +exports[`ts2swift > snapshots Swift output for CallableConst.d.ts > CallableConst 1`] = ` +"// 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 + +@JSFunction func fetch(_ url: String) throws(JSException) -> Response + +@JSClass struct Response { +} +" +`; + exports[`ts2swift > snapshots Swift output for Documentation.d.ts > Documentation 1`] = ` "// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/CallableConst.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/CallableConst.d.ts new file mode 100644 index 000000000..3df79d597 --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/CallableConst.d.ts @@ -0,0 +1,2 @@ +export interface Response {} +export const fetch: (url: string) => Response; From 9c092f6d79b225228832e117582e936d90ce2070 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 18 Feb 2026 21:05:04 +0900 Subject: [PATCH 243/252] TS2Swift: emit static properties as static members (#653) --- .../Sources/TS2Swift/JavaScript/src/processor.js | 11 +++++++---- .../test/__snapshots__/ts2swift.test.js.snap | 16 ++++++++++++++++ .../JavaScript/test/fixtures/StaticProperty.d.ts | 3 +++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StaticProperty.d.ts diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index ed332dd3c..8287a0561 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -654,7 +654,7 @@ export class TypeProcessor { /** * Visit a property declaration and extract metadata * @param {ts.PropertyDeclaration | ts.PropertySignature} node - * @returns {{ jsName: string, swiftName: string, type: string, isReadonly: boolean } | null} + * @returns {{ jsName: string, swiftName: string, type: string, isReadonly: boolean, isStatic: boolean } | null} */ visitPropertyDecl(node) { if (!node.name) return null; @@ -674,7 +674,8 @@ export class TypeProcessor { const type = this.checker.getTypeAtLocation(node) const swiftType = this.visitType(type, node); const isReadonly = node.modifiers?.some(m => m.kind === ts.SyntaxKind.ReadonlyKeyword) ?? false; - return { jsName, swiftName, type: swiftType, isReadonly }; + const isStatic = node.modifiers?.some(m => m.kind === ts.SyntaxKind.StaticKeyword) ?? false; + return { jsName, swiftName, type: swiftType, isReadonly, isStatic }; } /** @@ -1011,6 +1012,7 @@ export class TypeProcessor { const type = property.type; const swiftName = this.renderIdentifier(property.swiftName); + const isStatic = property.isStatic; const needsJSGetterName = property.jsName !== property.swiftName; // Note: `from: .global` is only meaningful for top-level imports and constructors. // Instance member access always comes from the JS object itself. @@ -1020,10 +1022,11 @@ export class TypeProcessor { if (needsJSGetterName) getterArgs.push(`jsName: "${this.escapeForSwiftStringLiteral(property.jsName)}"`); if (fromArg) getterArgs.push(fromArg); const getterAnnotation = this.renderMacroAnnotation("JSGetter", getterArgs); + const staticKeyword = isStatic ? "static " : ""; // Always render getter this.emitDocComment(node, { indent: " " }); - this.swiftLines.push(` ${getterAnnotation} var ${swiftName}: ${type}`); + this.swiftLines.push(` ${getterAnnotation} ${staticKeyword}var ${swiftName}: ${type}`); // Render setter if not readonly if (!property.isReadonly) { @@ -1036,7 +1039,7 @@ export class TypeProcessor { if (needsJSNameField) setterArgs.push(`jsName: "${this.escapeForSwiftStringLiteral(property.jsName)}"`); if (fromArg) setterArgs.push(fromArg); const annotation = this.renderMacroAnnotation("JSSetter", setterArgs); - this.swiftLines.push(` ${annotation} func ${this.renderIdentifier(setterName)}(_ value: ${type}) ${this.renderEffects({ isAsync: false })}`); + this.swiftLines.push(` ${annotation} ${staticKeyword}func ${this.renderIdentifier(setterName)}(_ value: ${type}) ${this.renderEffects({ isAsync: false })}`); } } diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index 223927700..a83014e8c 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -354,6 +354,22 @@ exports[`ts2swift > snapshots Swift output for RecordDictionary.d.ts > RecordDic " `; +exports[`ts2swift > snapshots Swift output for StaticProperty.d.ts > StaticProperty 1`] = ` +"// 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 + +@JSClass struct Library { + @JSGetter static var version: String + @JSSetter static func setVersion(_ value: String) throws(JSException) +} +" +`; + exports[`ts2swift > snapshots Swift output for StringEnum.d.ts > StringEnum 1`] = ` "// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StaticProperty.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StaticProperty.d.ts new file mode 100644 index 000000000..afef26b5c --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/StaticProperty.d.ts @@ -0,0 +1,3 @@ +export class Library { + static version: string; +} From 002ffd9e95e15b7e72b410fa4c3e38a22ce261fa Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 18 Feb 2026 20:57:15 +0900 Subject: [PATCH 244/252] TS2Swift: skip enum types when emitting string literal unions --- .../BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js | 7 +++++-- .../JavaScript/test/__snapshots__/ts2swift.test.js.snap | 6 ------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index fd4873752..7d929486d 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -56,8 +56,6 @@ export class TypeProcessor { this.emittedStructuredTypeNames = new Set(); /** @type {Set} */ this.emittedStringLiteralUnionNames = new Set(); - /** @type {Set} */ - this.emittedStringLiteralUnionNames = new Set(); /** @type {Set} */ this.visitedDeclarationKeys = new Set(); @@ -324,6 +322,11 @@ export class TypeProcessor { */ getStringLiteralUnionLiterals(type) { if ((type.flags & ts.TypeFlags.Union) === 0) return null; + const symbol = type.getSymbol() ?? type.aliasSymbol; + // Skip enums so we don't double-generate real enum declarations. + if (symbol && (symbol.flags & ts.SymbolFlags.Enum) !== 0) { + return null; + } /** @type {ts.UnionType} */ // @ts-ignore const unionType = type; diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index a13540993..9415728a2 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -355,12 +355,6 @@ extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} @JSFunction func takesFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> Void -enum FeatureFlag: String { - case foo = "foo" - case bar = "bar" -} -extension FeatureFlag: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum {} - @JSFunction func returnsFeatureFlag() throws(JSException) -> FeatureFlag " `; From b643c475a85329d492798a64382163a79bf3a913 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 18 Feb 2026 14:03:25 +0100 Subject: [PATCH 245/252] NFC: BridgeJS: Remove dead cleanup infrastructure --- Benchmarks/Sources/Generated/BridgeJS.swift | 45 +-- .../PlayBridgeJS/Generated/BridgeJS.swift | 27 +- .../Sources/BridgeJSCore/ExportSwift.swift | 7 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 52 +-- .../Sources/BridgeJSLink/JSGlueGen.swift | 318 ++++-------------- .../BridgeJSCodegenTests/ArrayTypes.swift | 9 +- .../DefaultParameters.swift | 18 +- .../EnumAssociatedValue.swift | 9 +- .../ImportedTypeInExportedInterface.swift | 9 +- .../BridgeJSCodegenTests/SwiftStruct.swift | 63 ++-- .../SwiftStructImports.swift | 9 +- .../BridgeJSCodegenTests/UnsafePointer.swift | 9 +- .../BridgeJSLinkTests/ArrayTypes.js | 114 +------ .../__Snapshots__/BridgeJSLinkTests/Async.js | 11 - .../BridgeJSLinkTests/DefaultParameters.js | 53 +-- .../BridgeJSLinkTests/DictionaryTypes.js | 28 -- .../BridgeJSLinkTests/EnumAssociatedValue.js | 252 ++++---------- .../BridgeJSLinkTests/EnumCase.js | 11 - .../BridgeJSLinkTests/EnumNamespace.Global.js | 11 - .../BridgeJSLinkTests/EnumNamespace.js | 11 - .../BridgeJSLinkTests/EnumRawType.js | 11 - .../BridgeJSLinkTests/GlobalGetter.js | 11 - .../BridgeJSLinkTests/GlobalThisImports.js | 11 - .../BridgeJSLinkTests/ImportArray.js | 12 - .../ImportedTypeInExportedInterface.js | 25 +- .../BridgeJSLinkTests/InvalidPropertyNames.js | 11 - .../BridgeJSLinkTests/JSClass.js | 11 - .../JSClassStaticFunctions.js | 11 - .../BridgeJSLinkTests/JSValue.js | 18 - .../BridgeJSLinkTests/MixedGlobal.js | 11 - .../BridgeJSLinkTests/MixedModules.js | 11 - .../BridgeJSLinkTests/MixedPrivate.js | 11 - .../BridgeJSLinkTests/Namespaces.Global.js | 11 - .../BridgeJSLinkTests/Namespaces.js | 11 - .../BridgeJSLinkTests/Optionals.js | 11 - .../BridgeJSLinkTests/PrimitiveParameters.js | 11 - .../BridgeJSLinkTests/PrimitiveReturn.js | 11 - .../BridgeJSLinkTests/PropertyTypes.js | 11 - .../BridgeJSLinkTests/Protocol.js | 29 +- .../StaticFunctions.Global.js | 20 +- .../BridgeJSLinkTests/StaticFunctions.js | 20 +- .../StaticProperties.Global.js | 11 - .../BridgeJSLinkTests/StaticProperties.js | 11 - .../BridgeJSLinkTests/StringParameter.js | 11 - .../BridgeJSLinkTests/StringReturn.js | 11 - .../BridgeJSLinkTests/SwiftClass.js | 11 - .../BridgeJSLinkTests/SwiftClosure.js | 43 +-- .../BridgeJSLinkTests/SwiftClosureImports.js | 11 - .../BridgeJSLinkTests/SwiftStruct.js | 71 +--- .../BridgeJSLinkTests/SwiftStructImports.js | 18 +- .../__Snapshots__/BridgeJSLinkTests/Throws.js | 11 - .../BridgeJSLinkTests/UnsafePointer.js | 21 +- .../VoidParameterVoidReturn.js | 11 - Plugins/PackageToJS/Templates/instantiate.js | 78 +++-- .../JavaScriptKit/BridgeJSIntrinsics.swift | 15 - .../Generated/BridgeJS.swift | 171 ++++------ 56 files changed, 348 insertions(+), 1512 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 6ec87dca8..65e57bdf9 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -132,10 +132,7 @@ extension SimpleStruct: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_SimpleStruct(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_SimpleStruct(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -148,9 +145,9 @@ extension SimpleStruct: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_SimpleStruct") -fileprivate func _bjs_struct_lower_SimpleStruct(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_SimpleStruct(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_SimpleStruct(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_SimpleStruct(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -179,10 +176,7 @@ extension Address: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -195,9 +189,9 @@ extension Address: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Address") -fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -232,10 +226,7 @@ extension Person: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Person(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Person(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -248,9 +239,9 @@ extension Person: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Person") -fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -285,10 +276,7 @@ extension ComplexStruct: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_ComplexStruct(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_ComplexStruct(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -301,9 +289,9 @@ extension ComplexStruct: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ComplexStruct") -fileprivate func _bjs_struct_lower_ComplexStruct(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_ComplexStruct(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_ComplexStruct(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_ComplexStruct(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -330,10 +318,7 @@ extension Point: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -346,9 +331,9 @@ extension Point: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift index 6e146dbc3..f2aaa9794 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift @@ -24,10 +24,7 @@ extension PlayBridgeJSOutput: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_PlayBridgeJSOutput(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_PlayBridgeJSOutput(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -40,9 +37,9 @@ extension PlayBridgeJSOutput: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PlayBridgeJSOutput") -fileprivate func _bjs_struct_lower_PlayBridgeJSOutput(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_PlayBridgeJSOutput(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_PlayBridgeJSOutput(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_PlayBridgeJSOutput(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -77,10 +74,7 @@ extension PlayBridgeJSDiagnostic: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_PlayBridgeJSDiagnostic(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_PlayBridgeJSDiagnostic(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -93,9 +87,9 @@ extension PlayBridgeJSDiagnostic: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PlayBridgeJSDiagnostic") -fileprivate func _bjs_struct_lower_PlayBridgeJSDiagnostic(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_PlayBridgeJSDiagnostic(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_PlayBridgeJSDiagnostic(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_PlayBridgeJSDiagnostic(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -122,10 +116,7 @@ extension PlayBridgeJSResult: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_PlayBridgeJSResult(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_PlayBridgeJSResult(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -138,9 +129,9 @@ extension PlayBridgeJSResult: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PlayBridgeJSResult") -fileprivate func _bjs_struct_lower_PlayBridgeJSResult(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_PlayBridgeJSResult(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_PlayBridgeJSResult(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_PlayBridgeJSResult(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 207f6ee69..525f6b73b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1243,10 +1243,7 @@ struct StructCodegen { printer.write( multilineString: """ \(accessControl)init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = \(lowerFunctionName)(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + \(lowerFunctionName)(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } """ @@ -1274,7 +1271,7 @@ struct StructCodegen { functionName: lowerFunctionName, signature: SwiftSignatureBuilder.buildABIFunctionSignature( abiParameters: [("objectId", .i32)], - returnType: .i32 + returnType: nil ) ) let liftExternDeclPrinter = CodeFragmentPrinter() diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 5bf17256d..61ffc7781 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -261,7 +261,6 @@ public struct BridgeJSLink { "let \(JSGlueVariableScope.reservedF32Stack) = [];", "let \(JSGlueVariableScope.reservedF64Stack) = [];", "let \(JSGlueVariableScope.reservedPointerStack) = [];", - "let \(JSGlueVariableScope.reservedTmpStructCleanups) = [];", "const \(JSGlueVariableScope.reservedEnumHelpers) = {};", "const \(JSGlueVariableScope.reservedStructHelpers) = {};", "", @@ -403,38 +402,13 @@ public struct BridgeJSLink { printer.write("return \(JSGlueVariableScope.reservedPointerStack).pop();") } printer.write("}") - printer.write("bjs[\"swift_js_struct_cleanup\"] = function(cleanupId) {") - printer.indent { - printer.write("if (cleanupId === 0) { return; }") - printer.write("const index = (cleanupId | 0) - 1;") - printer.write("const cleanup = \(JSGlueVariableScope.reservedTmpStructCleanups)[index];") - printer.write("\(JSGlueVariableScope.reservedTmpStructCleanups)[index] = null;") - printer.write("if (cleanup) { cleanup(); }") - printer.write( - "while (\(JSGlueVariableScope.reservedTmpStructCleanups).length > 0 && \(JSGlueVariableScope.reservedTmpStructCleanups)[\(JSGlueVariableScope.reservedTmpStructCleanups).length - 1] == null) {" - ) - printer.indent { - printer.write("\(JSGlueVariableScope.reservedTmpStructCleanups).pop();") - } - printer.write("}") - } - printer.write("}") - if !allStructs.isEmpty { for structDef in allStructs { printer.write("bjs[\"swift_js_struct_lower_\(structDef.name)\"] = function(objectId) {") printer.indent { printer.write( - "const { cleanup: cleanup } = \(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).lower(\(JSGlueVariableScope.reservedSwift).memory.getObject(objectId));" + "\(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).lower(\(JSGlueVariableScope.reservedSwift).memory.getObject(objectId));" ) - printer.write("if (cleanup) {") - printer.indent { - printer.write( - "return \(JSGlueVariableScope.reservedTmpStructCleanups).push(cleanup);" - ) - } - printer.write("}") - printer.write("return 0;") } printer.write("}") @@ -956,14 +930,12 @@ public struct BridgeJSLink { for structDef in allStructs { let structPrinter = CodeFragmentPrinter() let structScope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) - let structCleanup = CodeFragmentPrinter() let fragment = IntrinsicJSFragment.structHelper(structDefinition: structDef, allStructs: allStructs) _ = try fragment.printCode( [structDef.name], IntrinsicJSFragment.PrintCodeContext( scope: structScope, - printer: structPrinter, - cleanupCode: structCleanup + printer: structPrinter ) ) bodyPrinter.write(lines: structPrinter.lines) @@ -975,14 +947,12 @@ public struct BridgeJSLink { for enumDef in allAssocEnums { let enumPrinter = CodeFragmentPrinter() let enumScope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) - let enumCleanup = CodeFragmentPrinter() let fragment = IntrinsicJSFragment.associatedValueEnumHelperFactory(enumDefinition: enumDef) _ = try fragment.printCode( [enumDef.valuesName], IntrinsicJSFragment.PrintCodeContext( scope: enumScope, - printer: enumPrinter, - cleanupCode: enumCleanup + printer: enumPrinter ) ) bodyPrinter.write(lines: enumPrinter.lines) @@ -1227,7 +1197,6 @@ public struct BridgeJSLink { class ExportedThunkBuilder { var body: CodeFragmentPrinter - var cleanupCode: CodeFragmentPrinter var parameterForwardings: [String] = [] let effects: Effects let scope: JSGlueVariableScope @@ -1237,11 +1206,9 @@ public struct BridgeJSLink { self.effects = effects self.scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) self.body = CodeFragmentPrinter() - self.cleanupCode = CodeFragmentPrinter() self.context = IntrinsicJSFragment.PrintCodeContext( scope: scope, printer: body, - cleanupCode: cleanupCode, hasDirectAccessToSwiftClass: hasDirectAccessToSwiftClass ) } @@ -1312,10 +1279,9 @@ public struct BridgeJSLink { ] } - /// Renders the thunk body (body code, cleanup, exception handling, and optional return) into a printer. + /// Renders the thunk body (body code, exception handling, and optional return) into a printer. func renderFunctionBody(into printer: CodeFragmentPrinter, returnExpr: String?) { printer.write(contentsOf: body) - printer.write(contentsOf: cleanupCode) printer.write(lines: checkExceptionLines()) if let returnExpr = returnExpr { printer.write("return \(returnExpr);") @@ -1541,8 +1507,7 @@ public struct BridgeJSLink { let printer = CodeFragmentPrinter() let context = IntrinsicJSFragment.PrintCodeContext( scope: scope, - printer: printer, - cleanupCode: CodeFragmentPrinter() + printer: printer ) let enumValuesName = enumDefinition.valuesName @@ -2127,7 +2092,6 @@ extension BridgeJSLink { class ImportedThunkBuilder { let body: CodeFragmentPrinter let scope: JSGlueVariableScope - let cleanupCode: CodeFragmentPrinter let context: BridgeContext var parameterNames: [String] = [] var parameterForwardings: [String] = [] @@ -2136,12 +2100,10 @@ extension BridgeJSLink { init(context: BridgeContext = .importTS, intrinsicRegistry: JSIntrinsicRegistry) { self.body = CodeFragmentPrinter() self.scope = JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) - self.cleanupCode = CodeFragmentPrinter() self.context = context self.printContext = IntrinsicJSFragment.PrintCodeContext( scope: scope, - printer: body, - cleanupCode: cleanupCode + printer: body ) } @@ -2680,7 +2642,6 @@ extension BridgeJSLink { getterPrinter.write("get \(property.name)() {") getterPrinter.indent { getterPrinter.write(contentsOf: getterThunkBuilder.body) - getterPrinter.write(contentsOf: getterThunkBuilder.cleanupCode) getterPrinter.write(lines: getterThunkBuilder.checkExceptionLines()) if let returnExpr = getterReturnExpr { getterPrinter.write("return \(returnExpr);") @@ -2708,7 +2669,6 @@ extension BridgeJSLink { setterPrinter.write("set \(property.name)(value) {") setterPrinter.indent { setterPrinter.write(contentsOf: setterThunkBuilder.body) - setterPrinter.write(contentsOf: setterThunkBuilder.cleanupCode) setterPrinter.write(lines: setterThunkBuilder.checkExceptionLines()) } setterPrinter.write("},") diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index da21a6e08..20903eef8 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -28,7 +28,6 @@ final class JSGlueVariableScope { static let reservedF32Stack = "f32Stack" static let reservedF64Stack = "f64Stack" static let reservedPointerStack = "ptrStack" - static let reservedTmpStructCleanups = "tmpStructCleanups" static let reservedEnumHelpers = "enumHelpers" static let reservedStructHelpers = "structHelpers" static let reservedSwiftClosureRegistry = "swiftClosureRegistry" @@ -56,7 +55,6 @@ final class JSGlueVariableScope { reservedF32Stack, reservedF64Stack, reservedPointerStack, - reservedTmpStructCleanups, reservedEnumHelpers, reservedStructHelpers, reservedSwiftClosureRegistry, @@ -147,8 +145,6 @@ struct IntrinsicJSFragment: Sendable { var scope: JSGlueVariableScope /// The printer to print the main fragment code. var printer: CodeFragmentPrinter - /// The printer to print the code that is expected to be executed at the end of the caller of the fragment. - var cleanupCode: CodeFragmentPrinter /// Whether the fragment has direct access to the SwiftHeapObject classes. /// If false, the fragment needs to use `_exports[""]` to access the class. var hasDirectAccessToSwiftClass: Bool = true @@ -250,7 +246,7 @@ struct IntrinsicJSFragment: Sendable { static let stringLiftReturn = IntrinsicJSFragment( parameters: [], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let resultLabel = scope.variable("ret") printer.write("const \(resultLabel) = \(JSGlueVariableScope.reservedStorageToReturnString);") printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = undefined;") @@ -260,7 +256,7 @@ struct IntrinsicJSFragment: Sendable { static let stringLiftParameter = IntrinsicJSFragment( parameters: ["objectId"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let objectId = arguments[0] let objectLabel = scope.variable("\(objectId)Object") // TODO: Implement "take" operation @@ -272,7 +268,7 @@ struct IntrinsicJSFragment: Sendable { static let stringLowerReturn = IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) printer.write( "\(JSGlueVariableScope.reservedStorageToReturnBytes) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(arguments[0]));" ) @@ -289,7 +285,7 @@ struct IntrinsicJSFragment: Sendable { static let jsObjectLiftReturn = IntrinsicJSFragment( parameters: ["retId"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) // TODO: Implement "take" operation let resultLabel = scope.variable("ret") let retId = arguments[0] @@ -301,7 +297,7 @@ struct IntrinsicJSFragment: Sendable { static let jsObjectLiftRetainedObjectId = IntrinsicJSFragment( parameters: ["objectId"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let resultLabel = scope.variable("value") let objectId = arguments[0] printer.write( @@ -446,7 +442,7 @@ struct IntrinsicJSFragment: Sendable { static let jsValueLower = IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let kindVar = scope.variable("\(value)Kind") let payload1Var = scope.variable("\(value)Payload1") @@ -572,7 +568,7 @@ struct IntrinsicJSFragment: Sendable { static let jsValueLift = IntrinsicJSFragment( parameters: [], printCode: { _, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let payload2 = scope.variable("jsValuePayload2") let payload1 = scope.variable("jsValuePayload1") let kind = scope.variable("jsValueKind") @@ -590,7 +586,7 @@ struct IntrinsicJSFragment: Sendable { static let jsValueLiftParameter = IntrinsicJSFragment( parameters: ["kind", "payload1", "payload2"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let resultVar = scope.variable("jsValue") registerJSValueHelpers(scope: scope) printer.write( @@ -635,14 +631,12 @@ struct IntrinsicJSFragment: Sendable { IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (printer, cleanup) = (context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] - let caseIdName = "\(value)CaseId" - let cleanupName = "\(value)Cleanup" + let caseIdName = scope.variable("\(value)CaseId") printer.write( - "const { caseId: \(caseIdName), cleanup: \(cleanupName) } = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lower(\(value));" + "const \(caseIdName) = \(JSGlueVariableScope.reservedEnumHelpers).\(enumBase).lower(\(value));" ) - cleanup.write("if (\(cleanupName)) { \(cleanupName)(); }") return [caseIdName] } ) @@ -806,7 +800,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let isSomeVar = scope.variable("isSome") printer.write("const \(isSomeVar) = \(value) != null;") @@ -814,18 +808,13 @@ struct IntrinsicJSFragment: Sendable { switch wrappedType { case .swiftStruct(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName - let cleanupVar = scope.variable("\(value)Cleanup") - printer.write("let \(cleanupVar);") printer.write("if (\(isSomeVar)) {") printer.indent { - let resultVar = scope.variable("structResult") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lower(\(value));" + "\(JSGlueVariableScope.reservedStructHelpers).\(base).lower(\(value));" ) - printer.write("\(cleanupVar) = \(resultVar).cleanup;") } printer.write("}") - cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") printer.write("\(JSGlueVariableScope.reservedI32Stack).push(+\(isSomeVar));") return [] case .string, .rawValueEnum(_, .string): @@ -846,65 +835,42 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName let caseIdVar = scope.variable("\(value)CaseId") - let cleanupVar = scope.variable("\(value)Cleanup") - printer.write("let \(caseIdVar), \(cleanupVar);") + printer.write("let \(caseIdVar);") printer.write("if (\(isSomeVar)) {") printer.indent { - let resultVar = scope.variable("enumResult") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" + "\(caseIdVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" ) - printer.write("\(caseIdVar) = \(resultVar).caseId;") - printer.write("\(cleanupVar) = \(resultVar).cleanup;") } printer.write("}") - cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") return ["+\(isSomeVar)", "\(isSomeVar) ? \(caseIdVar) : 0"] case .rawValueEnum: // Raw value enums with optional - falls through to handle based on raw type return ["+\(isSomeVar)", "\(isSomeVar) ? \(value) : 0"] case .array(let elementType): - let cleanupArrayVar = scope.variable("\(value)Cleanups") - printer.write("const \(cleanupArrayVar) = [];") printer.write("if (\(isSomeVar)) {") try printer.indent { let arrayLowerFragment = try arrayLower(elementType: elementType) - let arrayCleanup = CodeFragmentPrinter() let _ = try arrayLowerFragment.printCode( [value], - context.with(\.cleanupCode, arrayCleanup) + context ) - if !arrayCleanup.lines.isEmpty { - for line in arrayCleanup.lines { - printer.write("\(cleanupArrayVar).push(() => { \(line) });") - } - } } printer.write("}") - cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") printer.write("\(JSGlueVariableScope.reservedI32Stack).push(+\(isSomeVar));") return [] case .dictionary(let valueType): - let cleanupArrayVar = scope.variable("\(value)Cleanups") - printer.write("const \(cleanupArrayVar) = [];") printer.write("if (\(isSomeVar)) {") try printer.indent { let dictLowerFragment = try dictionaryLower(valueType: valueType) - let dictCleanup = CodeFragmentPrinter() let _ = try dictLowerFragment.printCode( [value], - context.with(\.cleanupCode, dictCleanup) + context ) - if !dictCleanup.lines.isEmpty { - for line in dictCleanup.lines { - printer.write("\(cleanupArrayVar).push(() => { \(line) });") - } - } } printer.write("}") - cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") printer.write("\(JSGlueVariableScope.reservedI32Stack).push(+\(isSomeVar));") return [] default: @@ -1105,7 +1071,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let isSomeVar = scope.variable("isSome") let presenceExpr = kind.presenceCheck(value: value) @@ -1166,16 +1132,10 @@ struct IntrinsicJSFragment: Sendable { printer.write("if (\(isSomeVar)) {") try printer.indent { let arrayLowerFragment = try arrayLower(elementType: elementType) - let arrayCleanup = CodeFragmentPrinter() let _ = try arrayLowerFragment.printCode( [value], - context.with(\.cleanupCode, arrayCleanup) + context ) - if !arrayCleanup.lines.isEmpty { - for line in arrayCleanup.lines { - printer.write(line) - } - } } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) @@ -1214,11 +1174,10 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName let caseIdVar = scope.variable("caseId") - let cleanupVar = scope.variable("cleanup") printer.write("if (\(isSomeVar)) {") printer.indent { printer.write( - "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" + "const \(caseIdVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" ) printer.write("return \(caseIdVar);") } @@ -1227,14 +1186,11 @@ struct IntrinsicJSFragment: Sendable { printer.write("return -1;") } printer.write("}") - cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") case .dictionary(let valueType): printer.write("if (\(isSomeVar)) {") try printer.indent { - let cleanupArrayVar = scope.variable("arrayCleanups") let entriesVar = scope.variable("entries") let entryVar = scope.variable("entry") - printer.write("const \(cleanupArrayVar) = [];") printer.write("const \(entriesVar) = Object.entries(\(value));") printer.write("for (const \(entryVar) of \(entriesVar)) {") try printer.indent { @@ -1243,40 +1199,19 @@ struct IntrinsicJSFragment: Sendable { printer.write("const [\(keyVar), \(valueVar)] = \(entryVar);") let keyFragment = try stackLowerFragment(elementType: .string) - let keyCleanup = CodeFragmentPrinter() let _ = try keyFragment.printCode( [keyVar], - context.with(\.cleanupCode, keyCleanup) + context ) - if !keyCleanup.lines.isEmpty { - printer.write("\(cleanupArrayVar).push(() => {") - printer.indent { - for line in keyCleanup.lines { - printer.write(line) - } - } - printer.write("});") - } let valueFragment = try stackLowerFragment(elementType: valueType) - let valueCleanup = CodeFragmentPrinter() let _ = try valueFragment.printCode( [valueVar], - context.with(\.cleanupCode, valueCleanup) + context ) - if !valueCleanup.lines.isEmpty { - printer.write("\(cleanupArrayVar).push(() => {") - printer.indent { - for line in valueCleanup.lines { - printer.write(line) - } - } - printer.write("});") - } } printer.write("}") scope.emitPushI32Parameter("\(entriesVar).length", printer: printer) - cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) @@ -1594,14 +1529,12 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let caseIdVar = scope.variable("caseId") - let cleanupVar = scope.variable("cleanup") printer.write( - "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" + "const \(caseIdVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" ) - cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") printer.write("return \(caseIdVar);") return [] } @@ -1662,15 +1595,10 @@ struct IntrinsicJSFragment: Sendable { for enumCase in enumDefinition.cases { let caseName = enumCase.name.capitalizedFirstLetter let caseScope = scope.makeChildScope() - let caseCleanup = CodeFragmentPrinter() - caseCleanup.indent() let fragment = IntrinsicJSFragment.associatedValuePushPayload(enumCase: enumCase) _ = try fragment.printCode( ["value", enumName, caseName], - context.with(\.scope, caseScope).with(\.printer, lowerPrinter).with( - \.cleanupCode, - caseCleanup - ) + context.with(\.scope, caseScope).with(\.printer, lowerPrinter) ) } @@ -1696,15 +1624,11 @@ struct IntrinsicJSFragment: Sendable { for enumCase in enumDefinition.cases { let caseName = enumCase.name.capitalizedFirstLetter let caseScope = scope.makeChildScope() - let caseCleanup = CodeFragmentPrinter() let fragment = IntrinsicJSFragment.associatedValuePopPayload(enumCase: enumCase) _ = try fragment.printCode( [enumName, caseName], - context.with(\.scope, caseScope).with(\.printer, liftPrinter).with( - \.cleanupCode, - caseCleanup - ) + context.with(\.scope, caseScope).with(\.printer, liftPrinter) ) } @@ -1783,7 +1707,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value", "enumName", "caseName"], printCode: { arguments, context in - let (printer, cleanup) = (context.printer, context.cleanupCode) + let printer = context.printer let enumName = arguments[1] let caseName = arguments[2] @@ -1791,8 +1715,7 @@ struct IntrinsicJSFragment: Sendable { try printer.indent { if enumCase.associatedValues.isEmpty { - printer.write("const cleanup = undefined;") - printer.write("return { caseId: \(enumName).Tag.\(caseName), cleanup };") + printer.write("return \(enumName).Tag.\(caseName);") } else { // Process associated values in reverse order (to match the order they'll be popped) let reversedValues = enumCase.associatedValues.enumerated().reversed() @@ -1806,14 +1729,7 @@ struct IntrinsicJSFragment: Sendable { _ = try fragment.printCode(["value.\(prop)"], context) } - if cleanup.lines.isEmpty { - printer.write("const cleanup = undefined;") - } else { - printer.write("const cleanup = () => {") - printer.write(contentsOf: cleanup) - printer.write("};") - } - printer.write("return { caseId: \(enumName).Tag.\(caseName), cleanup };") + printer.write("return \(enumName).Tag.\(caseName);") } } @@ -1882,7 +1798,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let isSomeVar = scope.variable("isSome") printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") @@ -1959,19 +1875,14 @@ struct IntrinsicJSFragment: Sendable { } case .swiftStruct(let structName): let structBase = structName.components(separatedBy: ".").last ?? structName - let nestedCleanupVar = scope.variable("nestedCleanup") - printer.write("let \(nestedCleanupVar);") printer.write("if (\(isSomeVar)) {") printer.indent { - let structResultVar = scope.variable("structResult") printer.write( - "const \(structResultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lower(\(value));" + "\(JSGlueVariableScope.reservedStructHelpers).\(structBase).lower(\(value));" ) - printer.write("\(nestedCleanupVar) = \(structResultVar).cleanup;") } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - cleanup.write("if (\(nestedCleanupVar)) { \(nestedCleanupVar)(); }") case .swiftHeapObject: printer.write("if (\(isSomeVar)) {") printer.indent { @@ -2001,16 +1912,12 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let enumName): let base = enumName.components(separatedBy: ".").last ?? enumName let caseIdVar = scope.variable("enumCaseId") - let enumCleanupVar = scope.variable("enumCleanup") - printer.write("let \(caseIdVar), \(enumCleanupVar);") + printer.write("let \(caseIdVar);") printer.write("if (\(isSomeVar)) {") printer.indent { - let enumResultVar = scope.variable("enumResult") printer.write( - "const \(enumResultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" + "\(caseIdVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" ) - printer.write("\(caseIdVar) = \(enumResultVar).caseId;") - printer.write("\(enumCleanupVar) = \(enumResultVar).cleanup;") scope.emitPushI32Parameter(caseIdVar, printer: printer) } printer.write("} else {") @@ -2019,36 +1926,17 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - cleanup.write("if (\(enumCleanupVar)) { \(enumCleanupVar)(); }") case .array(let elementType): - // Array cleanup references variables declared inside the if block, - // so capture cleanup into a variable declared at the outer scope. - let arrCleanupVar = scope.variable("arrCleanup") - printer.write("let \(arrCleanupVar);") printer.write("if (\(isSomeVar)) {") try printer.indent { - let localCleanup = CodeFragmentPrinter() let arrFragment = try arrayLower(elementType: elementType) _ = try arrFragment.printCode( [value], - context.with(\.cleanupCode, localCleanup) + context ) - let cleanupLines = localCleanup.lines.filter { - !$0.trimmingCharacters(in: .whitespaces).isEmpty - } - if !cleanupLines.isEmpty { - printer.write("\(arrCleanupVar) = () => {") - printer.indent { - for line in cleanupLines { - printer.write(line) - } - } - printer.write("};") - } } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - cleanup.write("if (\(arrCleanupVar)) { \(arrCleanupVar)(); }") default: scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) } @@ -2117,13 +2005,11 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let printer = context.printer let value = arguments[0] - let cleanupVar = scope.variable("cleanup") printer.write( - "const { cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedStructHelpers).\(base).lower(\(value));" + "\(JSGlueVariableScope.reservedStructHelpers).\(base).lower(\(value));" ) - cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") return [] } ) @@ -2133,13 +2019,11 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let printer = context.printer let value = arguments[0] - let cleanupVar = scope.variable("cleanup") printer.write( - "const { cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lower(\(value));" + "\(JSGlueVariableScope.reservedStructHelpers).\(structBase).lower(\(value));" ) - cleanupCode.write("if (\(cleanupVar)) { \(cleanupVar)(); }") return [] } ) @@ -2166,33 +2050,20 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["arr"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let arr = arguments[0] - let cleanupArrayVar = scope.variable("arrayCleanups") - printer.write("const \(cleanupArrayVar) = [];") let elemVar = scope.variable("elem") printer.write("for (const \(elemVar) of \(arr)) {") try printer.indent { let elementFragment = try stackLowerFragment(elementType: elementType) - let elementCleanup = CodeFragmentPrinter() let _ = try elementFragment.printCode( [elemVar], - context.with(\.cleanupCode, elementCleanup) + context ) - if !elementCleanup.lines.isEmpty { - printer.write("\(cleanupArrayVar).push(() => {") - printer.indent { - for line in elementCleanup.lines { - printer.write(line) - } - } - printer.write("});") - } } printer.write("}") scope.emitPushI32Parameter("\(arr).length", printer: printer) - cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") return [] } ) @@ -2203,11 +2074,9 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["dict"], printCode: { arguments, context in - let (scope, printer, cleanupCode) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let dict = arguments[0] - let cleanupArrayVar = scope.variable("arrayCleanups") - printer.write("const \(cleanupArrayVar) = [];") let entriesVar = scope.variable("entries") let entryVar = scope.variable("entry") printer.write("const \(entriesVar) = Object.entries(\(dict));") @@ -2218,40 +2087,19 @@ struct IntrinsicJSFragment: Sendable { printer.write("const [\(keyVar), \(valueVar)] = \(entryVar);") let keyFragment = try stackLowerFragment(elementType: .string) - let keyCleanup = CodeFragmentPrinter() let _ = try keyFragment.printCode( [keyVar], - context.with(\.cleanupCode, keyCleanup) + context ) - if !keyCleanup.lines.isEmpty { - printer.write("\(cleanupArrayVar).push(() => {") - printer.indent { - for line in keyCleanup.lines { - printer.write(line) - } - } - printer.write("});") - } let valueFragment = try stackLowerFragment(elementType: valueType) - let valueCleanup = CodeFragmentPrinter() let _ = try valueFragment.printCode( [valueVar], - context.with(\.cleanupCode, valueCleanup) + context ) - if !valueCleanup.lines.isEmpty { - printer.write("\(cleanupArrayVar).push(() => {") - printer.indent { - for line in valueCleanup.lines { - printer.write(line) - } - } - printer.write("});") - } } printer.write("}") scope.emitPushI32Parameter("\(entriesVar).length", printer: printer) - cleanupCode.write("for (const cleanup of \(cleanupArrayVar)) { cleanup(); }") return [] } ) @@ -2582,13 +2430,11 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) + let printer = context.printer let value = arguments[0] - let cleanupVar = scope.variable("structCleanup") printer.write( - "const { cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedStructHelpers).\(structBase).lower(\(value));" + "\(JSGlueVariableScope.reservedStructHelpers).\(structBase).lower(\(value));" ) - cleanup.write("if (\(cleanupVar)) { \(cleanupVar)(); }") return [] } ) @@ -2655,15 +2501,13 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let caseIdVar = scope.variable("caseId") - let cleanupVar = scope.variable("enumCleanup") printer.write( - "const { caseId: \(caseIdVar), cleanup: \(cleanupVar) } = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" + "const \(caseIdVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" ) scope.emitPushI32Parameter(caseIdVar, printer: printer) - cleanup.write("if (\(cleanupVar)) { \(cleanupVar)(); }") return [] } ) @@ -2772,22 +2616,13 @@ struct IntrinsicJSFragment: Sendable { let presenceExpr = kind.presenceCheck(value: value) printer.write("const \(isSomeVar) = \(presenceExpr) ? 1 : 0;") - // Cleanup is written inside the if block so retained id is in scope - let localCleanupWriter = CodeFragmentPrinter() printer.write("if (\(isSomeVar)) {") try printer.indent { let innerFragment = try stackLowerFragment(elementType: wrappedType) let _ = try innerFragment.printCode( [value], - context.with(\.cleanupCode, localCleanupWriter) + context ) - let localCleanupLines = localCleanupWriter.lines.filter { - !$0.trimmingCharacters(in: .whitespaces).isEmpty - } - if !localCleanupLines.isEmpty { - let localCleanupCode = localCleanupLines.joined(separator: " ") - printer.write("arrayCleanups.push(() => { \(localCleanupCode) });") - } } printer.write("} else {") printer.indent { @@ -2877,8 +2712,6 @@ struct IntrinsicJSFragment: Sendable { let (scope, printer) = (context.scope, context.printer) let lowerPrinter = CodeFragmentPrinter() let lowerScope = scope.makeChildScope() - let lowerCleanup = CodeFragmentPrinter() - lowerCleanup.indent() let instanceProps = structDef.properties.filter { !$0.isStatic } for property in instanceProps { @@ -2886,22 +2719,13 @@ struct IntrinsicJSFragment: Sendable { let fieldValue = "value.\(property.name)" _ = try fragment.printCode( [fieldValue], - context.with(\.scope, lowerScope).with(\.printer, lowerPrinter).with(\.cleanupCode, lowerCleanup) + context.with(\.scope, lowerScope).with(\.printer, lowerPrinter) ) } for line in lowerPrinter.lines { printer.write(line) } - - if !lowerCleanup.lines.isEmpty { - printer.write("const cleanup = () => {") - printer.write(contentsOf: lowerCleanup) - printer.write("};") - printer.write("return { cleanup };") - } else { - printer.write("return { cleanup: undefined };") - } } private static func generateStructLiftCode( @@ -2944,12 +2768,8 @@ struct IntrinsicJSFragment: Sendable { "\(instanceVar).\(method.name) = function(\(paramList)) {" ) try printer.indent { - let methodScope = scope.makeChildScope() - let methodCleanup = CodeFragmentPrinter() - - let structCleanupVar = methodScope.variable("structCleanup") printer.write( - "const { cleanup: \(structCleanupVar) } = \(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).lower(this);" + "\(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).lower(this);" ) var paramForwardings: [String] = [] @@ -2966,10 +2786,6 @@ struct IntrinsicJSFragment: Sendable { printer.write("const ret = \(callExpr);") } - // Cleanup - printer.write("if (\(structCleanupVar)) { \(structCleanupVar)(); }") - printer.write(contentsOf: methodCleanup) - // Lift return value if needed if method.returnType != .void { let liftFragment = try IntrinsicJSFragment.liftReturn(type: method.returnType) @@ -3021,7 +2837,7 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode) + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] let isSomeVar = scope.variable("isSome") printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") @@ -3116,19 +2932,14 @@ struct IntrinsicJSFragment: Sendable { scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) return [] } else if case .swiftStruct(let structName) = wrappedType { - let nestedCleanupVar = scope.variable("nestedCleanup") - printer.write("let \(nestedCleanupVar);") printer.write("if (\(isSomeVar)) {") printer.indent { - let structResultVar = scope.variable("structResult") printer.write( - "const \(structResultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(structName).lower(\(value));" + "\(JSGlueVariableScope.reservedStructHelpers).\(structName).lower(\(value));" ) - printer.write("\(nestedCleanupVar) = \(structResultVar).cleanup;") } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - cleanup.write("if (\(nestedCleanupVar)) { \(nestedCleanupVar)(); }") return [] } else if case .string = wrappedType { let idVar = scope.variable("id") @@ -3212,16 +3023,12 @@ struct IntrinsicJSFragment: Sendable { case .associatedValueEnum(let enumName): let base = enumName.components(separatedBy: ".").last ?? enumName let caseIdVar = scope.variable("enumCaseId") - let enumCleanupVar = scope.variable("enumCleanup") - printer.write("let \(caseIdVar), \(enumCleanupVar);") + printer.write("let \(caseIdVar);") printer.write("if (\(isSomeVar)) {") printer.indent { - let enumResultVar = scope.variable("enumResult") printer.write( - "const \(enumResultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" + "\(caseIdVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" ) - printer.write("\(caseIdVar) = \(enumResultVar).caseId;") - printer.write("\(enumCleanupVar) = \(enumResultVar).cleanup;") scope.emitPushI32Parameter(caseIdVar, printer: printer) } printer.write("} else {") @@ -3230,7 +3037,6 @@ struct IntrinsicJSFragment: Sendable { } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - cleanup.write("if (\(enumCleanupVar)) { \(enumCleanupVar)(); }") default: let wrappedFragment = try structFieldLowerFragment( field: ExportedProperty( @@ -3242,10 +3048,9 @@ struct IntrinsicJSFragment: Sendable { allStructs: allStructs ) let guardedPrinter = CodeFragmentPrinter() - let guardedCleanup = CodeFragmentPrinter() _ = try wrappedFragment.printCode( [value], - context.with(\.printer, guardedPrinter).with(\.cleanupCode, guardedCleanup) + context.with(\.printer, guardedPrinter) ) var loweredLines = guardedPrinter.lines var hoistedCleanupVar: String? @@ -3267,13 +3072,6 @@ struct IntrinsicJSFragment: Sendable { for line in loweredLines { printer.write(line) } - if !guardedCleanup.lines.isEmpty { - cleanup.write("if (\(isSomeVar)) {") - cleanup.indent { - cleanup.write(contentsOf: guardedCleanup) - } - cleanup.write("}") - } } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) @@ -3286,13 +3084,11 @@ struct IntrinsicJSFragment: Sendable { return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) + let printer = context.printer let value = arguments[0] - let structResultVar = scope.variable("structResult") printer.write( - "const \(structResultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(nestedName).lower(\(value));" + "\(JSGlueVariableScope.reservedStructHelpers).\(nestedName).lower(\(value));" ) - context.cleanupCode.write("if (\(structResultVar).cleanup) { \(structResultVar).cleanup(); }") return [] } ) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift index 3141139ca..12edb29e3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift @@ -57,10 +57,7 @@ extension Point: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -73,9 +70,9 @@ extension Point: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift index e8f367f1c..c905c4239 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift @@ -52,10 +52,7 @@ extension Config: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Config(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Config(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -68,9 +65,9 @@ extension Config: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Config") -fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -95,10 +92,7 @@ extension MathOperations: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_MathOperations(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_MathOperations(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -111,9 +105,9 @@ extension MathOperations: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MathOperations") -fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift index 3d23c6bff..588fb1cbc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift @@ -413,10 +413,7 @@ extension Point: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -429,9 +426,9 @@ extension Point: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift index 7fcc4d3c7..c142fbd04 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift @@ -15,10 +15,7 @@ extension FooContainer: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_FooContainer(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_FooContainer(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -31,9 +28,9 @@ extension FooContainer: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_FooContainer") -fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift index fb78c3fd0..29abcebca 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift @@ -28,10 +28,7 @@ extension DataPoint: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_DataPoint(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_DataPoint(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -44,9 +41,9 @@ extension DataPoint: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_DataPoint") -fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -90,10 +87,7 @@ extension Address: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -106,9 +100,9 @@ extension Address: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Address") -fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -143,10 +137,7 @@ extension Person: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Person(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Person(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -159,9 +150,9 @@ extension Person: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Person") -fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -188,10 +179,7 @@ extension Session: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Session(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Session(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -204,9 +192,9 @@ extension Session: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Session") -fileprivate func _bjs_struct_lower_Session(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Session(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Session(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Session(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -239,10 +227,7 @@ extension Measurement: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Measurement(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Measurement(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -255,9 +240,9 @@ extension Measurement: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Measurement") -fileprivate func _bjs_struct_lower_Measurement(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Measurement(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Measurement(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Measurement(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -280,10 +265,7 @@ extension ConfigStruct: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_ConfigStruct(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_ConfigStruct(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -296,9 +278,9 @@ extension ConfigStruct: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ConfigStruct") -fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -404,10 +386,7 @@ extension Container: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Container(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Container(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -420,9 +399,9 @@ extension Container: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Container") -fileprivate func _bjs_struct_lower_Container(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Container(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Container(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Container(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift index 089912afe..29386e65f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift @@ -11,10 +11,7 @@ extension Point: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -27,9 +24,9 @@ extension Point: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift index a4f372e9b..9385c0621 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift @@ -17,10 +17,7 @@ extension PointerFields: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -33,9 +30,9 @@ extension PointerFields: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PointerFields") -fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 7db995321..e7bdf975b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -36,7 +36,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -47,7 +46,6 @@ export async function createInstantiator(options, swift) { lower: (value) => { f64Stack.push(value.x); f64Stack.push(value.y); - return { cleanup: undefined }; }, lift: () => { const f64 = f64Stack.pop(); @@ -122,22 +120,8 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_struct_lower_Point"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.Point.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.Point.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_Point"] = function() { const value = structHelpers.Point.lift(); @@ -274,7 +258,6 @@ export async function createInstantiator(options, swift) { TestModule["bjs_importGetNumbers"] = function bjs_importGetNumbers() { try { let ret = imports.importGetNumbers(); - const arrayCleanups = []; for (const elem of ret) { f64Stack.push(elem); } @@ -293,7 +276,6 @@ export async function createInstantiator(options, swift) { } arrayResult.reverse(); let ret = imports.importTransformNumbers(arrayResult); - const arrayCleanups = []; for (const elem of ret) { f64Stack.push(elem); } @@ -312,7 +294,6 @@ export async function createInstantiator(options, swift) { } arrayResult.reverse(); let ret = imports.importProcessStrings(arrayResult); - const arrayCleanups = []; for (const elem of ret) { const bytes = textEncoder.encode(elem); const id = swift.memory.retain(bytes); @@ -334,7 +315,6 @@ export async function createInstantiator(options, swift) { } arrayResult.reverse(); let ret = imports.importProcessBooleans(arrayResult); - const arrayCleanups = []; for (const elem of ret) { i32Stack.push(elem ? 1 : 0); } @@ -396,7 +376,6 @@ export async function createInstantiator(options, swift) { const exports = { Item, processIntArray: function bjs_processIntArray(values) { - const arrayCleanups = []; for (const elem of values) { i32Stack.push((elem | 0)); } @@ -409,11 +388,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(int); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processStringArray: function bjs_processStringArray(values) { - const arrayCleanups = []; for (const elem of values) { const bytes = textEncoder.encode(elem); const id = swift.memory.retain(bytes); @@ -429,11 +406,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(string); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processDoubleArray: function bjs_processDoubleArray(values) { - const arrayCleanups = []; for (const elem of values) { f64Stack.push(elem); } @@ -446,11 +421,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(f64); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processBoolArray: function bjs_processBoolArray(values) { - const arrayCleanups = []; for (const elem of values) { i32Stack.push(elem ? 1 : 0); } @@ -463,16 +436,11 @@ export async function createInstantiator(options, swift) { arrayResult.push(bool); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processPointArray: function bjs_processPointArray(points) { - const arrayCleanups = []; for (const elem of points) { - const { cleanup: structCleanup } = structHelpers.Point.lower(elem); - arrayCleanups.push(() => { - if (structCleanup) { structCleanup(); } - }); + structHelpers.Point.lower(elem); } i32Stack.push(points.length); instance.exports.bjs_processPointArray(); @@ -483,11 +451,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(struct); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processDirectionArray: function bjs_processDirectionArray(directions) { - const arrayCleanups = []; for (const elem of directions) { i32Stack.push((elem | 0)); } @@ -500,11 +466,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(caseId); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processStatusArray: function bjs_processStatusArray(statuses) { - const arrayCleanups = []; for (const elem of statuses) { i32Stack.push((elem | 0)); } @@ -517,37 +481,28 @@ export async function createInstantiator(options, swift) { arrayResult.push(rawValue); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, sumIntArray: function bjs_sumIntArray(values) { - const arrayCleanups = []; for (const elem of values) { i32Stack.push((elem | 0)); } i32Stack.push(values.length); const ret = instance.exports.bjs_sumIntArray(); - for (const cleanup of arrayCleanups) { cleanup(); } return ret; }, findFirstPoint: function bjs_findFirstPoint(points, matching) { - const arrayCleanups = []; for (const elem of points) { - const { cleanup: structCleanup } = structHelpers.Point.lower(elem); - arrayCleanups.push(() => { - if (structCleanup) { structCleanup(); } - }); + structHelpers.Point.lower(elem); } i32Stack.push(points.length); const matchingBytes = textEncoder.encode(matching); const matchingId = swift.memory.retain(matchingBytes); instance.exports.bjs_findFirstPoint(matchingId, matchingBytes.length); const structValue = structHelpers.Point.lift(); - for (const cleanup of arrayCleanups) { cleanup(); } return structValue; }, processUnsafeRawPointerArray: function bjs_processUnsafeRawPointerArray(values) { - const arrayCleanups = []; for (const elem of values) { ptrStack.push((elem | 0)); } @@ -560,11 +515,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(pointer); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processUnsafeMutableRawPointerArray: function bjs_processUnsafeMutableRawPointerArray(values) { - const arrayCleanups = []; for (const elem of values) { ptrStack.push((elem | 0)); } @@ -577,11 +530,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(pointer); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processOpaquePointerArray: function bjs_processOpaquePointerArray(values) { - const arrayCleanups = []; for (const elem of values) { ptrStack.push((elem | 0)); } @@ -594,11 +545,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(pointer); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processOptionalIntArray: function bjs_processOptionalIntArray(values) { - const arrayCleanups = []; for (const elem of values) { const isSome = elem != null ? 1 : 0; if (isSome) { @@ -624,11 +573,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(optValue); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processOptionalStringArray: function bjs_processOptionalStringArray(values) { - const arrayCleanups = []; for (const elem of values) { const isSome = elem != null ? 1 : 0; if (isSome) { @@ -658,19 +605,15 @@ export async function createInstantiator(options, swift) { arrayResult.push(optValue); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processOptionalArray: function bjs_processOptionalArray(values) { const isSome = values != null; - const valuesCleanups = []; if (isSome) { - const arrayCleanups = []; for (const elem of values) { i32Stack.push((elem | 0)); } i32Stack.push(values.length); - valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); } i32Stack.push(+isSome); instance.exports.bjs_processOptionalArray(); @@ -688,16 +631,13 @@ export async function createInstantiator(options, swift) { } else { optResult = null; } - for (const cleanup of valuesCleanups) { cleanup(); } return optResult; }, processOptionalPointArray: function bjs_processOptionalPointArray(points) { - const arrayCleanups = []; for (const elem of points) { const isSome = elem != null ? 1 : 0; if (isSome) { - const { cleanup: structCleanup } = structHelpers.Point.lower(elem); - arrayCleanups.push(() => { if (structCleanup) { structCleanup(); } }); + structHelpers.Point.lower(elem); } else { } i32Stack.push(isSome); @@ -718,11 +658,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(optValue); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processOptionalDirectionArray: function bjs_processOptionalDirectionArray(directions) { - const arrayCleanups = []; for (const elem of directions) { const isSome = elem != null ? 1 : 0; if (isSome) { @@ -748,11 +686,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(optValue); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processOptionalStatusArray: function bjs_processOptionalStatusArray(statuses) { - const arrayCleanups = []; for (const elem of statuses) { const isSome = elem != null ? 1 : 0; if (isSome) { @@ -778,20 +714,14 @@ export async function createInstantiator(options, swift) { arrayResult.push(optValue); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processNestedIntArray: function bjs_processNestedIntArray(values) { - const arrayCleanups = []; for (const elem of values) { - const arrayCleanups1 = []; for (const elem1 of elem) { i32Stack.push((elem1 | 0)); } i32Stack.push(elem.length); - arrayCleanups.push(() => { - for (const cleanup of arrayCleanups1) { cleanup(); } - }); } i32Stack.push(values.length); instance.exports.bjs_processNestedIntArray(); @@ -808,13 +738,10 @@ export async function createInstantiator(options, swift) { arrayResult.push(arrayResult1); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processNestedStringArray: function bjs_processNestedStringArray(values) { - const arrayCleanups = []; for (const elem of values) { - const arrayCleanups1 = []; for (const elem1 of elem) { const bytes = textEncoder.encode(elem1); const id = swift.memory.retain(bytes); @@ -822,9 +749,6 @@ export async function createInstantiator(options, swift) { i32Stack.push(id); } i32Stack.push(elem.length); - arrayCleanups.push(() => { - for (const cleanup of arrayCleanups1) { cleanup(); } - }); } i32Stack.push(values.length); instance.exports.bjs_processNestedStringArray(); @@ -841,23 +765,14 @@ export async function createInstantiator(options, swift) { arrayResult.push(arrayResult1); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processNestedPointArray: function bjs_processNestedPointArray(points) { - const arrayCleanups = []; for (const elem of points) { - const arrayCleanups1 = []; for (const elem1 of elem) { - const { cleanup: structCleanup } = structHelpers.Point.lower(elem1); - arrayCleanups1.push(() => { - if (structCleanup) { structCleanup(); } - }); + structHelpers.Point.lower(elem1); } i32Stack.push(elem.length); - arrayCleanups.push(() => { - for (const cleanup of arrayCleanups1) { cleanup(); } - }); } i32Stack.push(points.length); instance.exports.bjs_processNestedPointArray(); @@ -874,11 +789,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(arrayResult1); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processItemArray: function bjs_processItemArray(items) { - const arrayCleanups = []; for (const elem of items) { ptrStack.push(elem.pointer); } @@ -892,20 +805,14 @@ export async function createInstantiator(options, swift) { arrayResult.push(obj); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processNestedItemArray: function bjs_processNestedItemArray(items) { - const arrayCleanups = []; for (const elem of items) { - const arrayCleanups1 = []; for (const elem1 of elem) { ptrStack.push(elem1.pointer); } i32Stack.push(elem.length); - arrayCleanups.push(() => { - for (const cleanup of arrayCleanups1) { cleanup(); } - }); } i32Stack.push(items.length); instance.exports.bjs_processNestedItemArray(); @@ -923,11 +830,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(arrayResult1); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processJSObjectArray: function bjs_processJSObjectArray(objects) { - const arrayCleanups = []; for (const elem of objects) { const objId = swift.memory.retain(elem); i32Stack.push(objId); @@ -943,11 +848,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(obj); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processOptionalJSObjectArray: function bjs_processOptionalJSObjectArray(objects) { - const arrayCleanups = []; for (const elem of objects) { const isSome = elem != null ? 1 : 0; if (isSome) { @@ -976,21 +879,15 @@ export async function createInstantiator(options, swift) { arrayResult.push(optValue); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processNestedJSObjectArray: function bjs_processNestedJSObjectArray(objects) { - const arrayCleanups = []; for (const elem of objects) { - const arrayCleanups1 = []; for (const elem1 of elem) { const objId = swift.memory.retain(elem1); i32Stack.push(objId); } i32Stack.push(elem.length); - arrayCleanups.push(() => { - for (const cleanup of arrayCleanups1) { cleanup(); } - }); } i32Stack.push(objects.length); instance.exports.bjs_processNestedJSObjectArray(); @@ -1009,7 +906,6 @@ export async function createInstantiator(options, swift) { arrayResult.push(arrayResult1); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, Direction: DirectionValues, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js index bd57f0fd4..6e7e810ca 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -94,16 +93,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index a89b07fc3..0538b8078 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -29,7 +29,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -44,7 +43,6 @@ export async function createInstantiator(options, swift) { i32Stack.push(id); i32Stack.push((value.value | 0)); i32Stack.push(value.enabled ? 1 : 0); - return { cleanup: undefined }; }, lift: () => { const bool = i32Stack.pop() !== 0; @@ -58,21 +56,18 @@ export async function createInstantiator(options, swift) { return () => ({ lower: (value) => { f64Stack.push(value.baseValue); - return { cleanup: undefined }; }, lift: () => { const f64 = f64Stack.pop(); const instance1 = { baseValue: f64 }; instance1.add = function(a, b = 10.0) { - const { cleanup: structCleanup } = structHelpers.MathOperations.lower(this); + structHelpers.MathOperations.lower(this); const ret = instance.exports.bjs_MathOperations_add(a, b); - if (structCleanup) { structCleanup(); } return ret; }.bind(instance1); instance1.multiply = function(a, b) { - const { cleanup: structCleanup } = structHelpers.MathOperations.lower(this); + structHelpers.MathOperations.lower(this); const ret = instance.exports.bjs_MathOperations_multiply(a, b); - if (structCleanup) { structCleanup(); } return ret; }.bind(instance1); return instance1; @@ -144,33 +139,15 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_struct_lower_Config"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.Config.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.Config.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_Config"] = function() { const value = structHelpers.Config.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_MathOperations"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.MathOperations.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.MathOperations.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_MathOperations"] = function() { const value = structHelpers.MathOperations.lift(); @@ -502,10 +479,8 @@ export async function createInstantiator(options, swift) { }, testOptionalStructDefault: function bjs_testOptionalStructDefault(point = null) { const isSome = point != null; - let pointCleanup; if (isSome) { - const structResult = structHelpers.Config.lower(point); - pointCleanup = structResult.cleanup; + structHelpers.Config.lower(point); } i32Stack.push(+isSome); instance.exports.bjs_testOptionalStructDefault(); @@ -516,15 +491,12 @@ export async function createInstantiator(options, swift) { } else { optResult = null; } - if (pointCleanup) { pointCleanup(); } return optResult; }, testOptionalStructWithValueDefault: function bjs_testOptionalStructWithValueDefault(point = { name: "default", value: 42, enabled: true }) { const isSome = point != null; - let pointCleanup; if (isSome) { - const structResult = structHelpers.Config.lower(point); - pointCleanup = structResult.cleanup; + structHelpers.Config.lower(point); } i32Stack.push(+isSome); instance.exports.bjs_testOptionalStructWithValueDefault(); @@ -535,11 +507,9 @@ export async function createInstantiator(options, swift) { } else { optResult = null; } - if (pointCleanup) { pointCleanup(); } return optResult; }, testIntArrayDefault: function bjs_testIntArrayDefault(values = [1, 2, 3]) { - const arrayCleanups = []; for (const elem of values) { i32Stack.push((elem | 0)); } @@ -552,11 +522,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(int); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, testStringArrayDefault: function bjs_testStringArrayDefault(names = ["a", "b", "c"]) { - const arrayCleanups = []; for (const elem of names) { const bytes = textEncoder.encode(elem); const id = swift.memory.retain(bytes); @@ -572,11 +540,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(string); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, testDoubleArrayDefault: function bjs_testDoubleArrayDefault(values = [1.5, 2.5, 3.5]) { - const arrayCleanups = []; for (const elem of values) { f64Stack.push(elem); } @@ -589,11 +555,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(f64); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, testBoolArrayDefault: function bjs_testBoolArrayDefault(flags = [true, false, true]) { - const arrayCleanups = []; for (const elem of flags) { i32Stack.push(elem ? 1 : 0); } @@ -606,11 +570,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(bool); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, testEmptyArrayDefault: function bjs_testEmptyArrayDefault(items = []) { - const arrayCleanups = []; for (const elem of items) { i32Stack.push((elem | 0)); } @@ -623,13 +585,11 @@ export async function createInstantiator(options, swift) { arrayResult.push(int); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, testMixedWithArrayDefault: function bjs_testMixedWithArrayDefault(name = "test", values = [10, 20, 30], enabled = true) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); - const arrayCleanups = []; for (const elem of values) { i32Stack.push((elem | 0)); } @@ -637,7 +597,6 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_testMixedWithArrayDefault(nameId, nameBytes.length, enabled); const ret = tmpRetString; tmpRetString = undefined; - for (const cleanup of arrayCleanups) { cleanup(); } return ret; }, Status: StatusValues, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index d42fd4b2b..efbd9b09e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,16 +94,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; @@ -215,7 +204,6 @@ export async function createInstantiator(options, swift) { dictResult[string] = f64; } let ret = imports.importMirrorDictionary(dictResult); - const arrayCleanups = []; const entries = Object.entries(ret); for (const entry of entries) { const [key, value] = entry; @@ -280,7 +268,6 @@ export async function createInstantiator(options, swift) { const exports = { Box, mirrorDictionary: function bjs_mirrorDictionary(values) { - const arrayCleanups = []; const entries = Object.entries(values); for (const entry of entries) { const [key, value] = entry; @@ -299,14 +286,11 @@ export async function createInstantiator(options, swift) { const string = strStack.pop(); dictResult[string] = int; } - for (const cleanup of arrayCleanups) { cleanup(); } return dictResult; }, optionalDictionary: function bjs_optionalDictionary(values) { const isSome = values != null; - const valuesCleanups = []; if (isSome) { - const arrayCleanups = []; const entries = Object.entries(values); for (const entry of entries) { const [key, value] = entry; @@ -320,7 +304,6 @@ export async function createInstantiator(options, swift) { i32Stack.push(id1); } i32Stack.push(entries.length); - valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); } i32Stack.push(+isSome); instance.exports.bjs_optionalDictionary(); @@ -338,11 +321,9 @@ export async function createInstantiator(options, swift) { } else { optResult = null; } - for (const cleanup of valuesCleanups) { cleanup(); } return optResult; }, nestedDictionary: function bjs_nestedDictionary(values) { - const arrayCleanups = []; const entries = Object.entries(values); for (const entry of entries) { const [key, value] = entry; @@ -350,14 +331,10 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const arrayCleanups1 = []; for (const elem of value) { i32Stack.push((elem | 0)); } i32Stack.push(value.length); - arrayCleanups.push(() => { - for (const cleanup of arrayCleanups1) { cleanup(); } - }); } i32Stack.push(entries.length); instance.exports.bjs_nestedDictionary(); @@ -374,11 +351,9 @@ export async function createInstantiator(options, swift) { const string = strStack.pop(); dictResult[string] = arrayResult; } - for (const cleanup of arrayCleanups) { cleanup(); } return dictResult; }, boxDictionary: function bjs_boxDictionary(boxes) { - const arrayCleanups = []; const entries = Object.entries(boxes); for (const entry of entries) { const [key, value] = entry; @@ -398,11 +373,9 @@ export async function createInstantiator(options, swift) { const string = strStack.pop(); dictResult[string] = obj; } - for (const cleanup of arrayCleanups) { cleanup(); } return dictResult; }, optionalBoxDictionary: function bjs_optionalBoxDictionary(boxes) { - const arrayCleanups = []; const entries = Object.entries(boxes); for (const entry of entries) { const [key, value] = entry; @@ -435,7 +408,6 @@ export async function createInstantiator(options, swift) { const string = strStack.pop(); dictResult[string] = optValue; } - for (const cleanup of arrayCleanups) { cleanup(); } return dictResult; }, }; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 2d2c6924b..43cc9f964 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -104,7 +104,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -115,7 +114,6 @@ export async function createInstantiator(options, swift) { lower: (value) => { f64Stack.push(value.x); f64Stack.push(value.y); - return { cleanup: undefined }; }, lift: () => { const f64 = f64Stack.pop(); @@ -134,32 +132,26 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Success, cleanup }; + return APIResultValues.Tag.Success; } case APIResultValues.Tag.Failure: { i32Stack.push((value.param0 | 0)); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Failure, cleanup }; + return APIResultValues.Tag.Failure; } case APIResultValues.Tag.Flag: { i32Stack.push(value.param0 ? 1 : 0); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Flag, cleanup }; + return APIResultValues.Tag.Flag; } case APIResultValues.Tag.Rate: { f32Stack.push(Math.fround(value.param0)); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Rate, cleanup }; + return APIResultValues.Tag.Rate; } case APIResultValues.Tag.Precise: { f64Stack.push(value.param0); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Precise, cleanup }; + return APIResultValues.Tag.Precise; } case APIResultValues.Tag.Info: { - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Info, cleanup }; + return APIResultValues.Tag.Info; } default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } @@ -203,8 +195,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = undefined; - return { caseId: ComplexResultValues.Tag.Success, cleanup }; + return ComplexResultValues.Tag.Success; } case ComplexResultValues.Tag.Error: { i32Stack.push((value.param1 | 0)); @@ -212,8 +203,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = undefined; - return { caseId: ComplexResultValues.Tag.Error, cleanup }; + return ComplexResultValues.Tag.Error; } case ComplexResultValues.Tag.Status: { const bytes = textEncoder.encode(value.param2); @@ -222,15 +212,13 @@ export async function createInstantiator(options, swift) { i32Stack.push(id); i32Stack.push((value.param1 | 0)); i32Stack.push(value.param0 ? 1 : 0); - const cleanup = undefined; - return { caseId: ComplexResultValues.Tag.Status, cleanup }; + return ComplexResultValues.Tag.Status; } case ComplexResultValues.Tag.Coordinates: { f64Stack.push(value.param2); f64Stack.push(value.param1); f64Stack.push(value.param0); - const cleanup = undefined; - return { caseId: ComplexResultValues.Tag.Coordinates, cleanup }; + return ComplexResultValues.Tag.Coordinates; } case ComplexResultValues.Tag.Comprehensive: { const bytes = textEncoder.encode(value.param8); @@ -251,12 +239,10 @@ export async function createInstantiator(options, swift) { i32Stack.push((value.param2 | 0)); i32Stack.push(value.param1 ? 1 : 0); i32Stack.push(value.param0 ? 1 : 0); - const cleanup = undefined; - return { caseId: ComplexResultValues.Tag.Comprehensive, cleanup }; + return ComplexResultValues.Tag.Comprehensive; } case ComplexResultValues.Tag.Info: { - const cleanup = undefined; - return { caseId: ComplexResultValues.Tag.Info, cleanup }; + return ComplexResultValues.Tag.Info; } default: throw new Error("Unknown ComplexResultValues tag: " + String(enumTag)); } @@ -313,8 +299,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = undefined; - return { caseId: ResultValues.Tag.Success, cleanup }; + return ResultValues.Tag.Success; } case ResultValues.Tag.Failure: { i32Stack.push((value.param1 | 0)); @@ -322,8 +307,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = undefined; - return { caseId: ResultValues.Tag.Failure, cleanup }; + return ResultValues.Tag.Failure; } case ResultValues.Tag.Status: { const bytes = textEncoder.encode(value.param2); @@ -332,8 +316,7 @@ export async function createInstantiator(options, swift) { i32Stack.push(id); i32Stack.push((value.param1 | 0)); i32Stack.push(value.param0 ? 1 : 0); - const cleanup = undefined; - return { caseId: ResultValues.Tag.Status, cleanup }; + return ResultValues.Tag.Status; } default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); } @@ -371,8 +354,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = undefined; - return { caseId: NetworkingResultValues.Tag.Success, cleanup }; + return NetworkingResultValues.Tag.Success; } case NetworkingResultValues.Tag.Failure: { i32Stack.push((value.param1 | 0)); @@ -380,8 +362,7 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = undefined; - return { caseId: NetworkingResultValues.Tag.Failure, cleanup }; + return NetworkingResultValues.Tag.Failure; } default: throw new Error("Unknown NetworkingResultValues tag: " + String(enumTag)); } @@ -421,8 +402,7 @@ export async function createInstantiator(options, swift) { i32Stack.push(0); } i32Stack.push(isSome ? 1 : 0); - const cleanup = undefined; - return { caseId: APIOptionalResultValues.Tag.Success, cleanup }; + return APIOptionalResultValues.Tag.Success; } case APIOptionalResultValues.Tag.Failure: { const isSome = value.param1 != null; @@ -431,8 +411,7 @@ export async function createInstantiator(options, swift) { const isSome1 = value.param0 != null; i32Stack.push(isSome1 ? (value.param0 | 0) : 0); i32Stack.push(isSome1 ? 1 : 0); - const cleanup = undefined; - return { caseId: APIOptionalResultValues.Tag.Failure, cleanup }; + return APIOptionalResultValues.Tag.Failure; } case APIOptionalResultValues.Tag.Status: { const isSome = value.param2 != null; @@ -453,8 +432,7 @@ export async function createInstantiator(options, swift) { const isSome2 = value.param0 != null; i32Stack.push(isSome2 ? (value.param0 ? 1 : 0) : 0); i32Stack.push(isSome2 ? 1 : 0); - const cleanup = undefined; - return { caseId: APIOptionalResultValues.Tag.Status, cleanup }; + return APIOptionalResultValues.Tag.Status; } default: throw new Error("Unknown APIOptionalResultValues tag: " + String(enumTag)); } @@ -531,31 +509,26 @@ export async function createInstantiator(options, swift) { switch (enumTag) { case TypedPayloadResultValues.Tag.Precision: { f32Stack.push(Math.fround(value.param0)); - const cleanup = undefined; - return { caseId: TypedPayloadResultValues.Tag.Precision, cleanup }; + return TypedPayloadResultValues.Tag.Precision; } case TypedPayloadResultValues.Tag.Direction: { i32Stack.push((value.param0 | 0)); - const cleanup = undefined; - return { caseId: TypedPayloadResultValues.Tag.Direction, cleanup }; + return TypedPayloadResultValues.Tag.Direction; } case TypedPayloadResultValues.Tag.OptPrecision: { const isSome = value.param0 != null; f32Stack.push(isSome ? Math.fround(value.param0) : 0.0); i32Stack.push(isSome ? 1 : 0); - const cleanup = undefined; - return { caseId: TypedPayloadResultValues.Tag.OptPrecision, cleanup }; + return TypedPayloadResultValues.Tag.OptPrecision; } case TypedPayloadResultValues.Tag.OptDirection: { const isSome = value.param0 != null; i32Stack.push(isSome ? (value.param0 | 0) : 0); i32Stack.push(isSome ? 1 : 0); - const cleanup = undefined; - return { caseId: TypedPayloadResultValues.Tag.OptDirection, cleanup }; + return TypedPayloadResultValues.Tag.OptDirection; } case TypedPayloadResultValues.Tag.Empty: { - const cleanup = undefined; - return { caseId: TypedPayloadResultValues.Tag.Empty, cleanup }; + return TypedPayloadResultValues.Tag.Empty; } default: throw new Error("Unknown TypedPayloadResultValues tag: " + String(enumTag)); } @@ -605,45 +578,32 @@ export async function createInstantiator(options, swift) { const enumTag = value.tag; switch (enumTag) { case AllTypesResultValues.Tag.StructPayload: { - const { cleanup: structCleanup } = structHelpers.Point.lower(value.param0); - const cleanup = () => { - if (structCleanup) { structCleanup(); } - }; - return { caseId: AllTypesResultValues.Tag.StructPayload, cleanup }; + structHelpers.Point.lower(value.param0); + return AllTypesResultValues.Tag.StructPayload; } case AllTypesResultValues.Tag.ClassPayload: { ptrStack.push(value.param0.pointer); - const cleanup = undefined; - return { caseId: AllTypesResultValues.Tag.ClassPayload, cleanup }; + return AllTypesResultValues.Tag.ClassPayload; } case AllTypesResultValues.Tag.JsObjectPayload: { const objId = swift.memory.retain(value.param0); i32Stack.push(objId); - const cleanup = undefined; - return { caseId: AllTypesResultValues.Tag.JsObjectPayload, cleanup }; + return AllTypesResultValues.Tag.JsObjectPayload; } case AllTypesResultValues.Tag.NestedEnum: { - const { caseId: caseId, cleanup: enumCleanup } = enumHelpers.APIResult.lower(value.param0); + const caseId = enumHelpers.APIResult.lower(value.param0); i32Stack.push(caseId); - const cleanup = () => { - if (enumCleanup) { enumCleanup(); } - }; - return { caseId: AllTypesResultValues.Tag.NestedEnum, cleanup }; + return AllTypesResultValues.Tag.NestedEnum; } case AllTypesResultValues.Tag.ArrayPayload: { - const arrayCleanups = []; for (const elem of value.param0) { i32Stack.push((elem | 0)); } i32Stack.push(value.param0.length); - const cleanup = () => { - for (const cleanup of arrayCleanups) { cleanup(); } - }; - return { caseId: AllTypesResultValues.Tag.ArrayPayload, cleanup }; + return AllTypesResultValues.Tag.ArrayPayload; } case AllTypesResultValues.Tag.Empty: { - const cleanup = undefined; - return { caseId: AllTypesResultValues.Tag.Empty, cleanup }; + return AllTypesResultValues.Tag.Empty; } default: throw new Error("Unknown AllTypesResultValues tag: " + String(enumTag)); } @@ -693,16 +653,11 @@ export async function createInstantiator(options, swift) { switch (enumTag) { case OptionalAllTypesResultValues.Tag.OptStruct: { const isSome = value.param0 != null; - let nestedCleanup; if (isSome) { - const structResult = structHelpers.Point.lower(value.param0); - nestedCleanup = structResult.cleanup; + structHelpers.Point.lower(value.param0); } i32Stack.push(isSome ? 1 : 0); - const cleanup = () => { - if (nestedCleanup) { nestedCleanup(); } - }; - return { caseId: OptionalAllTypesResultValues.Tag.OptStruct, cleanup }; + return OptionalAllTypesResultValues.Tag.OptStruct; } case OptionalAllTypesResultValues.Tag.OptClass: { const isSome = value.param0 != null; @@ -712,8 +667,7 @@ export async function createInstantiator(options, swift) { ptrStack.push(0); } i32Stack.push(isSome ? 1 : 0); - const cleanup = undefined; - return { caseId: OptionalAllTypesResultValues.Tag.OptClass, cleanup }; + return OptionalAllTypesResultValues.Tag.OptClass; } case OptionalAllTypesResultValues.Tag.OptJSObject: { const isSome = value.param0 != null; @@ -726,48 +680,33 @@ export async function createInstantiator(options, swift) { i32Stack.push(0); } i32Stack.push(isSome ? 1 : 0); - const cleanup = undefined; - return { caseId: OptionalAllTypesResultValues.Tag.OptJSObject, cleanup }; + return OptionalAllTypesResultValues.Tag.OptJSObject; } case OptionalAllTypesResultValues.Tag.OptNestedEnum: { const isSome = value.param0 != null; - let enumCaseId, enumCleanup; + let enumCaseId; if (isSome) { - const enumResult = enumHelpers.APIResult.lower(value.param0); - enumCaseId = enumResult.caseId; - enumCleanup = enumResult.cleanup; + enumCaseId = enumHelpers.APIResult.lower(value.param0); i32Stack.push(enumCaseId); } else { i32Stack.push(0); } i32Stack.push(isSome ? 1 : 0); - const cleanup = () => { - if (enumCleanup) { enumCleanup(); } - }; - return { caseId: OptionalAllTypesResultValues.Tag.OptNestedEnum, cleanup }; + return OptionalAllTypesResultValues.Tag.OptNestedEnum; } case OptionalAllTypesResultValues.Tag.OptArray: { const isSome = value.param0 != null; - let arrCleanup; if (isSome) { - const arrayCleanups = []; for (const elem of value.param0) { i32Stack.push((elem | 0)); } i32Stack.push(value.param0.length); - arrCleanup = () => { - for (const cleanup of arrayCleanups) { cleanup(); } - }; } i32Stack.push(isSome ? 1 : 0); - const cleanup = () => { - if (arrCleanup) { arrCleanup(); } - }; - return { caseId: OptionalAllTypesResultValues.Tag.OptArray, cleanup }; + return OptionalAllTypesResultValues.Tag.OptArray; } case OptionalAllTypesResultValues.Tag.Empty: { - const cleanup = undefined; - return { caseId: OptionalAllTypesResultValues.Tag.Empty, cleanup }; + return OptionalAllTypesResultValues.Tag.Empty; } default: throw new Error("Unknown OptionalAllTypesResultValues tag: " + String(enumTag)); } @@ -910,22 +849,8 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_struct_lower_Point"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.Point.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.Point.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_Point"] = function() { const value = structHelpers.Point.lift(); @@ -1107,9 +1032,8 @@ export async function createInstantiator(options, swift) { const exports = { User, handle: function bjs_handle(result) { - const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.APIResult.lower(result); + const resultCaseId = enumHelpers.APIResult.lower(result); instance.exports.bjs_handle(resultCaseId); - if (resultCleanup) { resultCleanup(); } }, getResult: function bjs_getResult() { instance.exports.bjs_getResult(); @@ -1117,19 +1041,16 @@ export async function createInstantiator(options, swift) { return ret; }, roundtripAPIResult: function bjs_roundtripAPIResult(result) { - const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.APIResult.lower(result); + const resultCaseId = enumHelpers.APIResult.lower(result); instance.exports.bjs_roundtripAPIResult(resultCaseId); const ret = enumHelpers.APIResult.lift(i32Stack.pop()); - if (resultCleanup) { resultCleanup(); } return ret; }, roundTripOptionalAPIResult: function bjs_roundTripOptionalAPIResult(result) { const isSome = result != null; - let resultCaseId, resultCleanup; + let resultCaseId; if (isSome) { - const enumResult = enumHelpers.APIResult.lower(result); - resultCaseId = enumResult.caseId; - resultCleanup = enumResult.cleanup; + resultCaseId = enumHelpers.APIResult.lower(result); } instance.exports.bjs_roundTripOptionalAPIResult(+isSome, isSome ? resultCaseId : 0); const tag = i32Stack.pop(); @@ -1140,13 +1061,11 @@ export async function createInstantiator(options, swift) { } else { optResult = enumHelpers.APIResult.lift(tag); } - if (resultCleanup) { resultCleanup(); } return optResult; }, handleComplex: function bjs_handleComplex(result) { - const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.ComplexResult.lower(result); + const resultCaseId = enumHelpers.ComplexResult.lower(result); instance.exports.bjs_handleComplex(resultCaseId); - if (resultCleanup) { resultCleanup(); } }, getComplexResult: function bjs_getComplexResult() { instance.exports.bjs_getComplexResult(); @@ -1154,19 +1073,16 @@ export async function createInstantiator(options, swift) { return ret; }, roundtripComplexResult: function bjs_roundtripComplexResult(result) { - const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.ComplexResult.lower(result); + const resultCaseId = enumHelpers.ComplexResult.lower(result); instance.exports.bjs_roundtripComplexResult(resultCaseId); const ret = enumHelpers.ComplexResult.lift(i32Stack.pop()); - if (resultCleanup) { resultCleanup(); } return ret; }, roundTripOptionalComplexResult: function bjs_roundTripOptionalComplexResult(result) { const isSome = result != null; - let resultCaseId, resultCleanup; + let resultCaseId; if (isSome) { - const enumResult = enumHelpers.ComplexResult.lower(result); - resultCaseId = enumResult.caseId; - resultCleanup = enumResult.cleanup; + resultCaseId = enumHelpers.ComplexResult.lower(result); } instance.exports.bjs_roundTripOptionalComplexResult(+isSome, isSome ? resultCaseId : 0); const tag = i32Stack.pop(); @@ -1177,16 +1093,13 @@ export async function createInstantiator(options, swift) { } else { optResult = enumHelpers.ComplexResult.lift(tag); } - if (resultCleanup) { resultCleanup(); } return optResult; }, roundTripOptionalUtilitiesResult: function bjs_roundTripOptionalUtilitiesResult(result) { const isSome = result != null; - let resultCaseId, resultCleanup; + let resultCaseId; if (isSome) { - const enumResult = enumHelpers.Result.lower(result); - resultCaseId = enumResult.caseId; - resultCleanup = enumResult.cleanup; + resultCaseId = enumHelpers.Result.lower(result); } instance.exports.bjs_roundTripOptionalUtilitiesResult(+isSome, isSome ? resultCaseId : 0); const tag = i32Stack.pop(); @@ -1197,16 +1110,13 @@ export async function createInstantiator(options, swift) { } else { optResult = enumHelpers.Result.lift(tag); } - if (resultCleanup) { resultCleanup(); } return optResult; }, roundTripOptionalNetworkingResult: function bjs_roundTripOptionalNetworkingResult(result) { const isSome = result != null; - let resultCaseId, resultCleanup; + let resultCaseId; if (isSome) { - const enumResult = enumHelpers.NetworkingResult.lower(result); - resultCaseId = enumResult.caseId; - resultCleanup = enumResult.cleanup; + resultCaseId = enumHelpers.NetworkingResult.lower(result); } instance.exports.bjs_roundTripOptionalNetworkingResult(+isSome, isSome ? resultCaseId : 0); const tag = i32Stack.pop(); @@ -1217,16 +1127,13 @@ export async function createInstantiator(options, swift) { } else { optResult = enumHelpers.NetworkingResult.lift(tag); } - if (resultCleanup) { resultCleanup(); } return optResult; }, roundTripOptionalAPIOptionalResult: function bjs_roundTripOptionalAPIOptionalResult(result) { const isSome = result != null; - let resultCaseId, resultCleanup; + let resultCaseId; if (isSome) { - const enumResult = enumHelpers.APIOptionalResult.lower(result); - resultCaseId = enumResult.caseId; - resultCleanup = enumResult.cleanup; + resultCaseId = enumHelpers.APIOptionalResult.lower(result); } instance.exports.bjs_roundTripOptionalAPIOptionalResult(+isSome, isSome ? resultCaseId : 0); const tag = i32Stack.pop(); @@ -1237,23 +1144,18 @@ export async function createInstantiator(options, swift) { } else { optResult = enumHelpers.APIOptionalResult.lift(tag); } - if (resultCleanup) { resultCleanup(); } return optResult; }, compareAPIResults: function bjs_compareAPIResults(result1, result2) { const isSome = result1 != null; - let result1CaseId, result1Cleanup; + let result1CaseId; if (isSome) { - const enumResult = enumHelpers.APIOptionalResult.lower(result1); - result1CaseId = enumResult.caseId; - result1Cleanup = enumResult.cleanup; + result1CaseId = enumHelpers.APIOptionalResult.lower(result1); } const isSome1 = result2 != null; - let result2CaseId, result2Cleanup; + let result2CaseId; if (isSome1) { - const enumResult1 = enumHelpers.APIOptionalResult.lower(result2); - result2CaseId = enumResult1.caseId; - result2Cleanup = enumResult1.cleanup; + result2CaseId = enumHelpers.APIOptionalResult.lower(result2); } instance.exports.bjs_compareAPIResults(+isSome, isSome ? result1CaseId : 0, +isSome1, isSome1 ? result2CaseId : 0); const tag = i32Stack.pop(); @@ -1264,24 +1166,19 @@ export async function createInstantiator(options, swift) { } else { optResult = enumHelpers.APIOptionalResult.lift(tag); } - if (result1Cleanup) { result1Cleanup(); } - if (result2Cleanup) { result2Cleanup(); } return optResult; }, roundTripTypedPayloadResult: function bjs_roundTripTypedPayloadResult(result) { - const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.TypedPayloadResult.lower(result); + const resultCaseId = enumHelpers.TypedPayloadResult.lower(result); instance.exports.bjs_roundTripTypedPayloadResult(resultCaseId); const ret = enumHelpers.TypedPayloadResult.lift(i32Stack.pop()); - if (resultCleanup) { resultCleanup(); } return ret; }, roundTripOptionalTypedPayloadResult: function bjs_roundTripOptionalTypedPayloadResult(result) { const isSome = result != null; - let resultCaseId, resultCleanup; + let resultCaseId; if (isSome) { - const enumResult = enumHelpers.TypedPayloadResult.lower(result); - resultCaseId = enumResult.caseId; - resultCleanup = enumResult.cleanup; + resultCaseId = enumHelpers.TypedPayloadResult.lower(result); } instance.exports.bjs_roundTripOptionalTypedPayloadResult(+isSome, isSome ? resultCaseId : 0); const tag = i32Stack.pop(); @@ -1292,23 +1189,19 @@ export async function createInstantiator(options, swift) { } else { optResult = enumHelpers.TypedPayloadResult.lift(tag); } - if (resultCleanup) { resultCleanup(); } return optResult; }, roundTripAllTypesResult: function bjs_roundTripAllTypesResult(result) { - const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.AllTypesResult.lower(result); + const resultCaseId = enumHelpers.AllTypesResult.lower(result); instance.exports.bjs_roundTripAllTypesResult(resultCaseId); const ret = enumHelpers.AllTypesResult.lift(i32Stack.pop()); - if (resultCleanup) { resultCleanup(); } return ret; }, roundTripOptionalAllTypesResult: function bjs_roundTripOptionalAllTypesResult(result) { const isSome = result != null; - let resultCaseId, resultCleanup; + let resultCaseId; if (isSome) { - const enumResult = enumHelpers.AllTypesResult.lower(result); - resultCaseId = enumResult.caseId; - resultCleanup = enumResult.cleanup; + resultCaseId = enumHelpers.AllTypesResult.lower(result); } instance.exports.bjs_roundTripOptionalAllTypesResult(+isSome, isSome ? resultCaseId : 0); const tag = i32Stack.pop(); @@ -1319,23 +1212,19 @@ export async function createInstantiator(options, swift) { } else { optResult = enumHelpers.AllTypesResult.lift(tag); } - if (resultCleanup) { resultCleanup(); } return optResult; }, roundTripOptionalPayloadResult: function bjs_roundTripOptionalPayloadResult(result) { - const { caseId: resultCaseId, cleanup: resultCleanup } = enumHelpers.OptionalAllTypesResult.lower(result); + const resultCaseId = enumHelpers.OptionalAllTypesResult.lower(result); instance.exports.bjs_roundTripOptionalPayloadResult(resultCaseId); const ret = enumHelpers.OptionalAllTypesResult.lift(i32Stack.pop()); - if (resultCleanup) { resultCleanup(); } return ret; }, roundTripOptionalPayloadResultOpt: function bjs_roundTripOptionalPayloadResultOpt(result) { const isSome = result != null; - let resultCaseId, resultCleanup; + let resultCaseId; if (isSome) { - const enumResult = enumHelpers.OptionalAllTypesResult.lower(result); - resultCaseId = enumResult.caseId; - resultCleanup = enumResult.cleanup; + resultCaseId = enumHelpers.OptionalAllTypesResult.lower(result); } instance.exports.bjs_roundTripOptionalPayloadResultOpt(+isSome, isSome ? resultCaseId : 0); const tag = i32Stack.pop(); @@ -1346,7 +1235,6 @@ export async function createInstantiator(options, swift) { } else { optResult = enumHelpers.OptionalAllTypesResult.lift(tag); } - if (resultCleanup) { resultCleanup(); } return optResult; }, APIResult: APIResultValues, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js index 72d78dbe0..0ea2b0a53 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js @@ -47,7 +47,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -118,16 +117,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index ee93a950a..a5f97641c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -67,7 +67,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -138,16 +137,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index 099ef0576..a30709cbb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -48,7 +48,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -119,16 +118,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index b1ee0538f..77d106b57 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -98,7 +98,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -170,16 +169,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js index 6f6bf9531..21613733e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,16 +94,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js index 9d57a04d3..21296b88a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -94,16 +93,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js index 7c946a716..2a2fd3d50 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,16 +94,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; @@ -207,7 +196,6 @@ export async function createInstantiator(options, swift) { } arrayResult.reverse(); let ret = imports.roundtrip(arrayResult); - const arrayCleanups = []; for (const elem of ret) { i32Stack.push((elem | 0)); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index 5d724202b..92230667c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -49,7 +48,6 @@ export async function createInstantiator(options, swift) { i32Stack.push(0); } i32Stack.push(isSome ? 1 : 0); - return { cleanup: undefined }; }, lift: () => { const isSome = i32Stack.pop(); @@ -145,22 +143,8 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_struct_lower_FooContainer"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.FooContainer.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.FooContainer.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_FooContainer"] = function() { const value = structHelpers.FooContainer.lift(); @@ -295,7 +279,6 @@ export async function createInstantiator(options, swift) { return ret1; }, processFooArray: function bjs_processFooArray(foos) { - const arrayCleanups = []; for (const elem of foos) { const objId = swift.memory.retain(elem); i32Stack.push(objId); @@ -311,11 +294,9 @@ export async function createInstantiator(options, swift) { arrayResult.push(obj); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, processOptionalFooArray: function bjs_processOptionalFooArray(foos) { - const arrayCleanups = []; for (const elem of foos) { const isSome = elem != null ? 1 : 0; if (isSome) { @@ -344,14 +325,12 @@ export async function createInstantiator(options, swift) { arrayResult.push(optValue); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, roundtripFooContainer: function bjs_roundtripFooContainer(container) { - const { cleanup: cleanup } = structHelpers.FooContainer.lower(container); + structHelpers.FooContainer.lower(container); instance.exports.bjs_roundtripFooContainer(); const structValue = structHelpers.FooContainer.lift(); - if (cleanup) { cleanup(); } return structValue; }, }; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js index 54a0f2018..eabfe8c13 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,16 +94,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js index a192a1a8b..d84c77d45 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,16 +94,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index 1166d1f62..6912af0f3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,16 +94,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index 8151ea913..0a4d37845 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -184,16 +183,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; @@ -319,7 +308,6 @@ export async function createInstantiator(options, swift) { } arrayResult.reverse(); let ret = imports.jsEchoJSValueArray(arrayResult); - const arrayCleanups = []; for (const elem of ret) { const [elemKind, elemPayload1, elemPayload2] = __bjs_jsValueLower(elem); i32Stack.push(elemKind); @@ -478,7 +466,6 @@ export async function createInstantiator(options, swift) { return optResult; }, roundTripJSValueArray: function bjs_roundTripJSValueArray(values) { - const arrayCleanups = []; for (const elem of values) { const [elemKind, elemPayload1, elemPayload2] = __bjs_jsValueLower(elem); i32Stack.push(elemKind); @@ -497,14 +484,11 @@ export async function createInstantiator(options, swift) { arrayResult.push(jsValue); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, roundTripOptionalJSValueArray: function bjs_roundTripOptionalJSValueArray(values) { const isSome = values != null; - const valuesCleanups = []; if (isSome) { - const arrayCleanups = []; for (const elem of values) { const [elemKind, elemPayload1, elemPayload2] = __bjs_jsValueLower(elem); i32Stack.push(elemKind); @@ -512,7 +496,6 @@ export async function createInstantiator(options, swift) { f64Stack.push(elemPayload2); } i32Stack.push(values.length); - valuesCleanups.push(() => { for (const cleanup of arrayCleanups) { cleanup(); } }); } i32Stack.push(+isSome); instance.exports.bjs_roundTripOptionalJSValueArray(); @@ -533,7 +516,6 @@ export async function createInstantiator(options, swift) { } else { optResult = null; } - for (const cleanup of valuesCleanups) { cleanup(); } return optResult; }, }; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index 900d9b19c..457661b6c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -94,16 +93,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index 9b5f9267e..6c0c5ad9c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -94,16 +93,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index 1ab3809cc..a576e82b6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -94,16 +93,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index ea5902783..806697af2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -94,16 +93,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index 5930b6914..1f5366828 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -94,16 +93,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 4c0bd0d13..03a3cf565 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,16 +94,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js index 83c77397a..8999ae8b6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,16 +94,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js index f1fda2cb7..c8372362d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,16 +94,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index e7d80bb4d..dbdd030b6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -94,16 +93,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 58928211e..9043d19ef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -47,7 +47,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -63,13 +62,11 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = undefined; - return { caseId: ResultValues.Tag.Success, cleanup }; + return ResultValues.Tag.Success; } case ResultValues.Tag.Failure: { i32Stack.push((value.param0 | 0)); - const cleanup = undefined; - return { caseId: ResultValues.Tag.Failure, cleanup }; + return ResultValues.Tag.Failure; } default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); } @@ -155,16 +152,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; @@ -359,7 +346,7 @@ export async function createInstantiator(options, swift) { TestModule["bjs_MyViewControllerDelegate_result_get"] = function bjs_MyViewControllerDelegate_result_get(self) { try { let ret = swift.memory.getObject(self).result; - const { caseId: caseId, cleanup: cleanup } = enumHelpers.Result.lower(ret); + const caseId = enumHelpers.Result.lower(ret); return caseId; } catch (error) { setException(error); @@ -378,7 +365,7 @@ export async function createInstantiator(options, swift) { let ret = swift.memory.getObject(self).optionalResult; const isSome = ret != null; if (isSome) { - const { caseId: caseId, cleanup: cleanup } = enumHelpers.Result.lower(ret); + const caseId = enumHelpers.Result.lower(ret); return caseId; } else { return -1; @@ -558,7 +545,7 @@ export async function createInstantiator(options, swift) { TestModule["bjs_MyViewControllerDelegate_getResult"] = function bjs_MyViewControllerDelegate_getResult(self) { try { let ret = swift.memory.getObject(self).getResult(); - const { caseId: caseId, cleanup: cleanup } = enumHelpers.Result.lower(ret); + const caseId = enumHelpers.Result.lower(ret); return caseId; } catch (error) { setException(error); @@ -686,14 +673,12 @@ export async function createInstantiator(options, swift) { } constructor(delegates) { - const arrayCleanups = []; for (const elem of delegates) { const objId = swift.memory.retain(elem); i32Stack.push(objId); } i32Stack.push(delegates.length); const ret = instance.exports.bjs_DelegateManager_init(); - for (const cleanup of arrayCleanups) { cleanup(); } return DelegateManager.__construct(ret); } notifyAll() { @@ -713,14 +698,12 @@ export async function createInstantiator(options, swift) { return arrayResult; } set delegates(value) { - const arrayCleanups = []; for (const elem of value) { const objId = swift.memory.retain(elem); i32Stack.push(objId); } i32Stack.push(value.length); instance.exports.bjs_DelegateManager_delegates_set(this.pointer); - for (const cleanup of arrayCleanups) { cleanup(); } } } const ResultHelpers = __bjs_createResultValuesHelpers()(); @@ -731,7 +714,6 @@ export async function createInstantiator(options, swift) { MyViewController, DelegateManager, processDelegates: function bjs_processDelegates(delegates) { - const arrayCleanups = []; for (const elem of delegates) { const objId = swift.memory.retain(elem); i32Stack.push(objId); @@ -747,7 +729,6 @@ export async function createInstantiator(options, swift) { arrayResult.push(obj); } arrayResult.reverse(); - for (const cleanup of arrayCleanups) { cleanup(); } return arrayResult; }, Direction: DirectionValues, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 247374a3b..109a403b4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -34,7 +34,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -50,13 +49,11 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Success, cleanup }; + return APIResultValues.Tag.Success; } case APIResultValues.Tag.Failure: { i32Stack.push((value.param0 | 0)); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Failure, cleanup }; + return APIResultValues.Tag.Failure; } default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } @@ -142,16 +139,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; @@ -335,10 +322,9 @@ export async function createInstantiator(options, swift) { APIResult: { ...APIResultValues, roundtrip: function(value) { - const { caseId: valueCaseId, cleanup: valueCleanup } = enumHelpers.APIResult.lower(value); + const valueCaseId = enumHelpers.APIResult.lower(value); instance.exports.bjs_APIResult_static_roundtrip(valueCaseId); const ret = enumHelpers.APIResult.lift(i32Stack.pop()); - if (valueCleanup) { valueCleanup(); } return ret; } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index a3bfb8a24..1be36c28e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -34,7 +34,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -50,13 +49,11 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Success, cleanup }; + return APIResultValues.Tag.Success; } case APIResultValues.Tag.Failure: { i32Stack.push((value.param0 | 0)); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Failure, cleanup }; + return APIResultValues.Tag.Failure; } default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } @@ -142,16 +139,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; @@ -329,10 +316,9 @@ export async function createInstantiator(options, swift) { APIResult: { ...APIResultValues, roundtrip: function(value) { - const { caseId: valueCaseId, cleanup: valueCleanup } = enumHelpers.APIResult.lower(value); + const valueCaseId = enumHelpers.APIResult.lower(value); instance.exports.bjs_APIResult_static_roundtrip(valueCaseId); const ret = enumHelpers.APIResult.lift(i32Stack.pop()); - if (valueCleanup) { valueCleanup(); } return ret; } }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index 05127cd14..12afbb82c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -28,7 +28,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -99,16 +98,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index 5e89f1bb4..e9c5d105c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -28,7 +28,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -99,16 +98,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js index 0f92074d4..480f40f92 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,16 +94,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js index f86fce218..49f07b5ef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,16 +94,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index 8f0552b64..cd6c9062b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,16 +94,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 5fbde8c82..68bcfbe93 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -53,7 +53,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -94,32 +93,26 @@ export async function createInstantiator(options, swift) { const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Success, cleanup }; + return APIResultValues.Tag.Success; } case APIResultValues.Tag.Failure: { i32Stack.push((value.param0 | 0)); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Failure, cleanup }; + return APIResultValues.Tag.Failure; } case APIResultValues.Tag.Flag: { i32Stack.push(value.param0 ? 1 : 0); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Flag, cleanup }; + return APIResultValues.Tag.Flag; } case APIResultValues.Tag.Rate: { f32Stack.push(Math.fround(value.param0)); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Rate, cleanup }; + return APIResultValues.Tag.Rate; } case APIResultValues.Tag.Precise: { f64Stack.push(value.param0); - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Precise, cleanup }; + return APIResultValues.Tag.Precise; } case APIResultValues.Tag.Info: { - const cleanup = undefined; - return { caseId: APIResultValues.Tag.Info, cleanup }; + return APIResultValues.Tag.Info; } default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } @@ -218,16 +211,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; @@ -403,7 +386,7 @@ export async function createInstantiator(options, swift) { const callback = swift.memory.getObject(callbackId); const enumValue = enumHelpers.APIResult.lift(param0); let ret = callback(enumValue); - const { caseId: caseId, cleanup: cleanup } = enumHelpers.APIResult.lower(ret); + const caseId = enumHelpers.APIResult.lower(ret); return caseId; } catch (error) { setException(error); @@ -411,10 +394,9 @@ export async function createInstantiator(options, swift) { } bjs["make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModule9APIResultO_9APIResultO = function(param0) { - const { caseId: param0CaseId, cleanup: param0Cleanup } = enumHelpers.APIResult.lower(param0); + const param0CaseId = enumHelpers.APIResult.lower(param0); instance.exports.invoke_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO(boxPtr, param0CaseId); const ret = enumHelpers.APIResult.lift(i32Stack.pop()); - if (param0Cleanup) { param0Cleanup(); } if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); @@ -672,7 +654,7 @@ export async function createInstantiator(options, swift) { let ret = callback(param0IsSome ? enumValue : null); const isSome = ret != null; if (isSome) { - const { caseId: caseId, cleanup: cleanup } = enumHelpers.APIResult.lower(ret); + const caseId = enumHelpers.APIResult.lower(ret); return caseId; } else { return -1; @@ -684,11 +666,9 @@ export async function createInstantiator(options, swift) { bjs["make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO = function(param0) { const isSome = param0 != null; - let param0CaseId, param0Cleanup; + let param0CaseId; if (isSome) { - const enumResult = enumHelpers.APIResult.lower(param0); - param0CaseId = enumResult.caseId; - param0Cleanup = enumResult.cleanup; + param0CaseId = enumHelpers.APIResult.lower(param0); } instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(boxPtr, +isSome, isSome ? param0CaseId : 0); const tag = i32Stack.pop(); @@ -699,7 +679,6 @@ export async function createInstantiator(options, swift) { } else { optResult = enumHelpers.APIResult.lift(tag); } - if (param0Cleanup) { param0Cleanup(); } if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index 61347e817..b5efd2150 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -120,16 +119,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index 6f704013b..dbbbd6bc9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -28,7 +28,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -57,7 +56,6 @@ export async function createInstantiator(options, swift) { i32Stack.push(0); } i32Stack.push(isSome1 ? 1 : 0); - return { cleanup: undefined }; }, lift: () => { const isSome = i32Stack.pop(); @@ -101,7 +99,6 @@ export async function createInstantiator(options, swift) { i32Stack.push(0); } i32Stack.push(isSome ? 1 : 0); - return { cleanup: undefined }; }, lift: () => { const isSome = i32Stack.pop(); @@ -126,7 +123,7 @@ export async function createInstantiator(options, swift) { i32Stack.push(bytes.length); i32Stack.push(id); i32Stack.push((value.age | 0)); - const structResult = structHelpers.Address.lower(value.address); + structHelpers.Address.lower(value.address); const isSome = value.email != null; let id1; if (isSome) { @@ -139,10 +136,6 @@ export async function createInstantiator(options, swift) { i32Stack.push(0); } i32Stack.push(isSome ? 1 : 0); - const cleanup = () => { - if (structResult.cleanup) { structResult.cleanup(); } - }; - return { cleanup }; }, lift: () => { const isSome = i32Stack.pop(); @@ -165,7 +158,6 @@ export async function createInstantiator(options, swift) { lower: (value) => { i32Stack.push((value.id | 0)); ptrStack.push(value.owner.pointer); - return { cleanup: undefined }; }, lift: () => { const ptr = ptrStack.pop(); @@ -187,7 +179,6 @@ export async function createInstantiator(options, swift) { f32Stack.push(0.0); } i32Stack.push(isSome ? 1 : 0); - return { cleanup: undefined }; }, lift: () => { const isSome = i32Stack.pop(); @@ -207,7 +198,6 @@ export async function createInstantiator(options, swift) { const __bjs_createConfigStructHelpers = () => { return () => ({ lower: (value) => { - return { cleanup: undefined }; }, lift: () => { return { }; @@ -234,7 +224,6 @@ export async function createInstantiator(options, swift) { i32Stack.push(0); } i32Stack.push(isSome ? 1 : 0); - return { cleanup: undefined }; }, lift: () => { const isSome = i32Stack.pop(); @@ -329,88 +318,50 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_struct_lower_DataPoint"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.DataPoint.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.DataPoint.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_DataPoint"] = function() { const value = structHelpers.DataPoint.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Address"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.Address.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.Address.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_Address"] = function() { const value = structHelpers.Address.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Person"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.Person.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.Person.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_Person"] = function() { const value = structHelpers.Person.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Session"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.Session.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.Session.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_Session"] = function() { const value = structHelpers.Session.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Measurement"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.Measurement.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.Measurement.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_Measurement"] = function() { const value = structHelpers.Measurement.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_ConfigStruct"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.ConfigStruct.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.ConfigStruct.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_ConfigStruct"] = function() { const value = structHelpers.ConfigStruct.lift(); return swift.memory.retain(value); } bjs["swift_js_struct_lower_Container"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.Container.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.Container.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_Container"] = function() { const value = structHelpers.Container.lift(); @@ -609,17 +560,15 @@ export async function createInstantiator(options, swift) { const exports = { Greeter, roundtrip: function bjs_roundtrip(session) { - const { cleanup: cleanup } = structHelpers.Person.lower(session); + structHelpers.Person.lower(session); instance.exports.bjs_roundtrip(); const structValue = structHelpers.Person.lift(); - if (cleanup) { cleanup(); } return structValue; }, roundtripContainer: function bjs_roundtripContainer(container) { - const { cleanup: cleanup } = structHelpers.Container.lower(container); + structHelpers.Container.lower(container); instance.exports.bjs_roundtripContainer(); const structValue = structHelpers.Container.lift(); - if (cleanup) { cleanup(); } return structValue; }, Precision: PrecisionValues, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index 4962e659b..cf64ab587 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -34,7 +33,6 @@ export async function createInstantiator(options, swift) { lower: (value) => { i32Stack.push((value.x | 0)); i32Stack.push((value.y | 0)); - return { cleanup: undefined }; }, lift: () => { const int = i32Stack.pop(); @@ -109,22 +107,8 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_struct_lower_Point"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.Point.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.Point.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_Point"] = function() { const value = structHelpers.Point.lift(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js index 3726a48ae..2c415fc31 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -94,16 +93,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index 7c3627d13..30c40a18c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -37,7 +36,6 @@ export async function createInstantiator(options, swift) { ptrStack.push((value.opaque | 0)); ptrStack.push((value.ptr | 0)); ptrStack.push((value.mutPtr | 0)); - return { cleanup: undefined }; }, lift: () => { const pointer = ptrStack.pop(); @@ -114,22 +112,8 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_struct_lower_PointerFields"] = function(objectId) { - const { cleanup: cleanup } = structHelpers.PointerFields.lower(swift.memory.getObject(objectId)); - if (cleanup) { - return tmpStructCleanups.push(cleanup); - } - return 0; + structHelpers.PointerFields.lower(swift.memory.getObject(objectId)); } bjs["swift_js_struct_lift_PointerFields"] = function() { const value = structHelpers.PointerFields.lift(); @@ -278,10 +262,9 @@ export async function createInstantiator(options, swift) { return ret; }, roundTripPointerFields: function bjs_roundTripPointerFields(value) { - const { cleanup: cleanup } = structHelpers.PointerFields.lower(value); + structHelpers.PointerFields.lower(value); instance.exports.bjs_roundTripPointerFields(); const structValue = structHelpers.PointerFields.lift(); - if (cleanup) { cleanup(); } return structValue; }, PointerFields: { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js index e338c840d..f8737237e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js @@ -23,7 +23,6 @@ export async function createInstantiator(options, swift) { let f32Stack = []; let f64Stack = []; let ptrStack = []; - let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; @@ -95,16 +94,6 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } - bjs["swift_js_struct_cleanup"] = function(cleanupId) { - if (cleanupId === 0) { return; } - const index = (cleanupId | 0) - 1; - const cleanup = tmpStructCleanups[index]; - tmpStructCleanups[index] = null; - if (cleanup) { cleanup(); } - while (tmpStructCleanups.length > 0 && tmpStructCleanups[tmpStructCleanups.length - 1] == null) { - tmpStructCleanups.pop(); - } - } bjs["swift_js_return_optional_bool"] = function(isSome, value) { if (isSome === 0) { tmpRetOptionalBool = null; diff --git a/Plugins/PackageToJS/Templates/instantiate.js b/Plugins/PackageToJS/Templates/instantiate.js index c9bc9efb4..fd183583b 100644 --- a/Plugins/PackageToJS/Templates/instantiate.js +++ b/Plugins/PackageToJS/Templates/instantiate.js @@ -1,5 +1,5 @@ // @ts-check -import { SwiftRuntime } from "./runtime.js" +import { SwiftRuntime } from "./runtime.js"; export const MODULE_PATH = "@PACKAGE_TO_JS_MODULE_PATH@"; /* #if USE_SHARED_MEMORY */ @@ -10,12 +10,12 @@ export const MEMORY_TYPE = { maximum: import.meta.PACKAGE_TO_JS_MEMORY_MAXIMUM, // @ts-expect-error Substituted by PackageToJS preprocessor shared: import.meta.PACKAGE_TO_JS_MEMORY_SHARED, -} +}; /* #endif */ /* #if HAS_BRIDGE */ // @ts-expect-error Substituted by PackageToJS preprocessor -import { createInstantiator } from "./bridge-js.js" +import { createInstantiator } from "./bridge-js.js"; /* #else */ /** * @param {import('./instantiate.d').InstantiateOptions} options @@ -30,7 +30,9 @@ async function createInstantiator(options, swift) { addImports: (importObject, importsContext) => { // Provide a default implementation for BridgeJS functions that are not // used at runtime without BridgeJS but required to instantiate the module. - const unexpectedBjsCall = () => { throw new Error("Unexpected call to BridgeJS function") } + const unexpectedBjsCall = () => { + throw new Error("Unexpected call to BridgeJS function"); + }; importObject["bjs"] = { swift_js_return_string: unexpectedBjsCall, swift_js_init_memory: unexpectedBjsCall, @@ -63,9 +65,8 @@ async function createInstantiator(options, swift) { swift_js_get_optional_heap_object_pointer: unexpectedBjsCall, swift_js_push_pointer: unexpectedBjsCall, swift_js_pop_pointer: unexpectedBjsCall, - swift_js_struct_cleanup: unexpectedBjsCall, swift_js_closure_unregister: unexpectedBjsCall, - } + }; }, /** @param {WebAssembly.Instance} instance */ setInstance: (instance) => {}, @@ -73,67 +74,65 @@ async function createInstantiator(options, swift) { createExports: (instance) => { return {}; }, - } + }; } /* #endif */ /** @type {import('./instantiate.d').instantiate} */ -export async function instantiate( - options -) { +export async function instantiate(options) { const result = await _instantiate(options); -/* #if IS_WASI */ + /* #if IS_WASI */ options.wasi.initialize(result.instance); -/* #endif */ + /* #endif */ result.swift.main(); return result; } /** @type {import('./instantiate.d').instantiateForThread} */ -export async function instantiateForThread( - tid, startArg, options -) { +export async function instantiateForThread(tid, startArg, options) { const result = await _instantiate(options); -/* #if IS_WASI */ + /* #if IS_WASI */ options.wasi.setInstance(result.instance); -/* #endif */ - result.swift.startThread(tid, startArg) + /* #endif */ + result.swift.startThread(tid, startArg); return result; } /** @type {import('./instantiate.d').instantiate} */ -async function _instantiate( - options -) { +async function _instantiate(options) { const _WebAssembly = options.WebAssembly || WebAssembly; const moduleSource = options.module; -/* #if IS_WASI */ + /* #if IS_WASI */ const { wasi } = options; -/* #endif */ + /* #endif */ const swift = new SwiftRuntime({ -/* #if USE_SHARED_MEMORY */ + /* #if USE_SHARED_MEMORY */ sharedMemory: true, threadChannel: options.threadChannel, -/* #endif */ + /* #endif */ }); const instantiator = await createInstantiator(options, swift); /** @type {WebAssembly.Imports} */ const importObject = { javascript_kit: swift.wasmImports, -/* #if IS_WASI */ + /* #if IS_WASI */ wasi_snapshot_preview1: wasi.wasiImport, -/* #if USE_SHARED_MEMORY */ + /* #if USE_SHARED_MEMORY */ env: { memory: options.memory, }, wasi: { "thread-spawn": (startArg) => { - return options.threadChannel.spawnThread(module, options.memory, startArg); - } - } -/* #endif */ -/* #endif */ + return options.threadChannel.spawnThread( + module, + options.memory, + startArg, + ); + }, + }, + /* #endif */ + /* #endif */ }; const importsContext = { getInstance: () => instance, @@ -149,9 +148,15 @@ async function _instantiate( if (moduleSource instanceof _WebAssembly.Module) { module = moduleSource; instance = await _WebAssembly.instantiate(module, importObject); - } else if (typeof Response === "function" && (moduleSource instanceof Response || moduleSource instanceof Promise)) { + } else if ( + typeof Response === "function" && + (moduleSource instanceof Response || moduleSource instanceof Promise) + ) { if (typeof _WebAssembly.instantiateStreaming === "function") { - const result = await _WebAssembly.instantiateStreaming(moduleSource, importObject); + const result = await _WebAssembly.instantiateStreaming( + moduleSource, + importObject, + ); module = result.module; instance = result.instance; } else { @@ -164,7 +169,8 @@ async function _instantiate( module = await _WebAssembly.compile(moduleSource); instance = await _WebAssembly.instantiate(module, importObject); } - instance = options.instrumentInstance?.(instance, { _swift: swift }) ?? instance; + instance = + options.instrumentInstance?.(instance, { _swift: swift }) ?? instance; swift.setInstance(instance); instantiator.setInstance(instance); @@ -174,5 +180,5 @@ async function _instantiate( instance, swift, exports, - } + }; } diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 28bdaa6db..15b5be9ee 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -818,21 +818,6 @@ private func _swift_js_pop_f64_extern() -> Float64 { _swift_js_pop_f64_extern() } -// MARK: Struct bridging helpers (JS-side lowering/raising) - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_cleanup") -private func _swift_js_struct_cleanup_extern(_ cleanupId: Int32) -#else -private func _swift_js_struct_cleanup_extern(_ cleanupId: Int32) { - _onlyAvailableOnWasm() -} -#endif - -@_spi(BridgeJS) @inline(never) public func _swift_js_struct_cleanup(_ cleanupId: Int32) { - _swift_js_struct_cleanup_extern(cleanupId) -} - // MARK: Wasm externs used by type lowering/lifting #if arch(wasm32) diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 8c1d63854..253087c0d 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -2720,10 +2720,7 @@ extension Point: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -2736,9 +2733,9 @@ extension Point: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -2771,10 +2768,7 @@ extension PointerFields: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -2787,9 +2781,9 @@ extension PointerFields: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PointerFields") -fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -2841,10 +2835,7 @@ extension DataPoint: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_DataPoint(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_DataPoint(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -2857,9 +2848,9 @@ extension DataPoint: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_DataPoint") -fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -2897,10 +2888,7 @@ extension PublicPoint: _BridgedSwiftStruct { } public init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_PublicPoint(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_PublicPoint(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -2913,9 +2901,9 @@ extension PublicPoint: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PublicPoint") -fileprivate func _bjs_struct_lower_PublicPoint(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_PublicPoint(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_PublicPoint(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_PublicPoint(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -2959,10 +2947,7 @@ extension Address: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -2975,9 +2960,9 @@ extension Address: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Address") -fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3014,10 +2999,7 @@ extension Contact: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Contact(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Contact(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3030,9 +3012,9 @@ extension Contact: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Contact") -fileprivate func _bjs_struct_lower_Contact(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Contact(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Contact(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Contact(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3071,10 +3053,7 @@ extension Config: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_Config(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_Config(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3087,9 +3066,9 @@ extension Config: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Config") -fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3120,10 +3099,7 @@ extension SessionData: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_SessionData(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_SessionData(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3136,9 +3112,9 @@ extension SessionData: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_SessionData") -fileprivate func _bjs_struct_lower_SessionData(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_SessionData(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_SessionData(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_SessionData(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3177,10 +3153,7 @@ extension ValidationReport: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_ValidationReport(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_ValidationReport(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3193,9 +3166,9 @@ extension ValidationReport: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ValidationReport") -fileprivate func _bjs_struct_lower_ValidationReport(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_ValidationReport(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_ValidationReport(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_ValidationReport(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3246,10 +3219,7 @@ extension AdvancedConfig: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_AdvancedConfig(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_AdvancedConfig(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3262,9 +3232,9 @@ extension AdvancedConfig: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_AdvancedConfig") -fileprivate func _bjs_struct_lower_AdvancedConfig(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_AdvancedConfig(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_AdvancedConfig(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_AdvancedConfig(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3303,10 +3273,7 @@ extension MeasurementConfig: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_MeasurementConfig(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_MeasurementConfig(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3319,9 +3286,9 @@ extension MeasurementConfig: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MeasurementConfig") -fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3346,10 +3313,7 @@ extension MathOperations: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_MathOperations(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_MathOperations(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3362,9 +3326,9 @@ extension MathOperations: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MathOperations") -fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3439,10 +3403,7 @@ extension CopyableCart: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_CopyableCart(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_CopyableCart(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3455,9 +3416,9 @@ extension CopyableCart: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableCart") -fileprivate func _bjs_struct_lower_CopyableCart(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_CopyableCart(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_CopyableCart(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_CopyableCart(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3495,10 +3456,7 @@ extension CopyableCartItem: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_CopyableCartItem(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_CopyableCartItem(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3511,9 +3469,9 @@ extension CopyableCartItem: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableCartItem") -fileprivate func _bjs_struct_lower_CopyableCartItem(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_CopyableCartItem(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_CopyableCartItem(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_CopyableCartItem(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3542,10 +3500,7 @@ extension CopyableNestedCart: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_CopyableNestedCart(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_CopyableNestedCart(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3558,9 +3513,9 @@ extension CopyableNestedCart: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableNestedCart") -fileprivate func _bjs_struct_lower_CopyableNestedCart(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_CopyableNestedCart(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_CopyableNestedCart(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_CopyableNestedCart(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3598,10 +3553,7 @@ extension ConfigStruct: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_ConfigStruct(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_ConfigStruct(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3614,9 +3566,9 @@ extension ConfigStruct: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ConfigStruct") -fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3711,10 +3663,7 @@ extension JSObjectContainer: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_JSObjectContainer(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_JSObjectContainer(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3727,9 +3676,9 @@ extension JSObjectContainer: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_JSObjectContainer") -fileprivate func _bjs_struct_lower_JSObjectContainer(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_JSObjectContainer(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_JSObjectContainer(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_JSObjectContainer(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3760,10 +3709,7 @@ extension FooContainer: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_FooContainer(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_FooContainer(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3776,9 +3722,9 @@ extension FooContainer: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_FooContainer") -fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -3805,10 +3751,7 @@ extension ArrayMembers: _BridgedSwiftStruct { } init(unsafelyCopying jsObject: JSObject) { - let __bjs_cleanupId = _bjs_struct_lower_ArrayMembers(jsObject.bridgeJSLowerParameter()) - defer { - _swift_js_struct_cleanup(__bjs_cleanupId) - } + _bjs_struct_lower_ArrayMembers(jsObject.bridgeJSLowerParameter()) self = Self.bridgeJSStackPop() } @@ -3821,9 +3764,9 @@ extension ArrayMembers: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ArrayMembers") -fileprivate func _bjs_struct_lower_ArrayMembers(_ objectId: Int32) -> Int32 +fileprivate func _bjs_struct_lower_ArrayMembers(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_ArrayMembers(_ objectId: Int32) -> Int32 { +fileprivate func _bjs_struct_lower_ArrayMembers(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif From dd164d2c1ef6f17ca149c986e7146239e08a103b Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 18 Feb 2026 23:28:00 +0900 Subject: [PATCH 246/252] TS2Swift: warn when exported declarations are skipped --- .../TS2Swift/JavaScript/src/processor.js | 67 +++++++++++++++++-- 1 file changed, 63 insertions(+), 4 deletions(-) diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index 4f2883f59..9617a5261 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -57,6 +57,9 @@ export class TypeProcessor { /** @type {Set} */ this.emittedStringLiteralUnionNames = new Set(); + /** @type {Set} */ + this.warnedExportNodes = new Set(); + /** @type {Set} */ this.visitedDeclarationKeys = new Set(); @@ -192,6 +195,8 @@ export class TypeProcessor { this.visitEnumDeclaration(node); } else if (ts.isExportDeclaration(node)) { this.visitExportDeclaration(node); + } else if (ts.isExportAssignment(node)) { + this.visitExportAssignment(node); } } @@ -239,6 +244,7 @@ export class TypeProcessor { } } else { // export * as ns from "..." is not currently supported by BridgeJS imports. + this.warnExportSkip(node, "Skipping namespace re-export (export * as ns) which is not supported"); return; } @@ -254,6 +260,19 @@ export class TypeProcessor { this.visitNode(declaration); } } + + if (targetSymbols.length === 0) { + this.warnExportSkip(node, "Export declaration resolved to no symbols; nothing was generated"); + } + } + + /** + * Handle `export default foo;` style assignments. + * @param {ts.ExportAssignment} node + */ + visitExportAssignment(node) { + // BridgeJS does not currently model default export assignments (they may point to expressions). + this.warnExportSkip(node, "Skipping export assignment (export default ...) which is not supported"); } /** @@ -271,7 +290,10 @@ export class TypeProcessor { const isConst = (node.declarationList.flags & ts.NodeFlags.Const) !== 0; for (const decl of node.declarationList.declarations) { - if (!ts.isIdentifier(decl.name)) continue; + if (!ts.isIdentifier(decl.name)) { + this.warnExportSkip(decl, "Skipping exported variable with a non-identifier name"); + continue; + } const jsName = decl.name.text; const swiftName = this.swiftTypeName(jsName); @@ -399,7 +421,12 @@ export class TypeProcessor { */ visitEnumDeclaration(node) { const name = node.name?.text; - if (!name) return; + if (!name) { + if (this.isExported(node)) { + this.warnExportSkip(node, "Skipping exported enum without a name"); + } + return; + } this.emitEnumFromDeclaration(name, node, node); } @@ -532,7 +559,12 @@ export class TypeProcessor { * @private */ visitFunctionDeclaration(node) { - if (!node.name) return; + if (!node.name) { + if (this.isExported(node)) { + this.warnExportSkip(node, "Skipping exported function without a name"); + } + return; + } const jsName = node.name.text; const swiftName = this.swiftTypeName(jsName); const fromArg = this.renderDefaultJSImportFromArgument(); @@ -774,7 +806,12 @@ export class TypeProcessor { * @private */ visitClassDecl(node) { - if (!node.name) return; + if (!node.name) { + if (this.isExported(node)) { + this.warnExportSkip(node, "Skipping exported class without a name"); + } + return; + } const jsName = node.name.text; if (this.emittedStructuredTypeNames.has(jsName)) return; @@ -1244,6 +1281,28 @@ export class TypeProcessor { return parts.join(" "); } + /** + * @param {ts.Node} node + * @returns {boolean} + */ + isExported(node) { + const hasExportModifier = /** @type {ts.ModifierLike[] | undefined} */ (node.modifiers)?.some( + (m) => m.kind === ts.SyntaxKind.ExportKeyword + ) ?? false; + return hasExportModifier || ts.isExportAssignment(node); + } + + /** + * Emit a single warning per node when an exported declaration cannot be generated. + * @param {ts.Node} node + * @param {string} reason + */ + warnExportSkip(node, reason) { + if (this.warnedExportNodes.has(node)) return; + this.warnedExportNodes.add(node); + this.diagnosticEngine.print("warning", `${reason}. Swift binding not generated`, node); + } + /** * Render identifier with backticks if needed * @param {string} name From 1ad419b27c0e7ac0f28b19c53bb0b818fa0dcd77 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 18 Feb 2026 14:59:26 +0100 Subject: [PATCH 247/252] NFC: BridgeJS: Refactor JSGlueGen with compositional optional handling and helper consolidation --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 8 +- .../Sources/BridgeJSLink/JSGlueGen.swift | 2680 +++++++---------- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 1 - .../BridgeJSLinkTests/ArrayTypes.js | 27 +- .../BridgeJSLinkTests/DefaultParameters.js | 146 +- .../BridgeJSLinkTests/EnumAssociatedValue.js | 1349 ++++----- .../BridgeJSLinkTests/EnumRawType.js | 43 +- .../ImportedTypeInExportedInterface.js | 87 +- .../BridgeJSLinkTests/JSValue.js | 70 +- .../BridgeJSLinkTests/Optionals.js | 284 +- .../BridgeJSLinkTests/Protocol.js | 117 +- .../StaticFunctions.Global.js | 64 +- .../BridgeJSLinkTests/StaticFunctions.js | 64 +- .../StaticProperties.Global.js | 13 +- .../BridgeJSLinkTests/StaticProperties.js | 13 +- .../BridgeJSLinkTests/SwiftClass.js | 4 +- .../BridgeJSLinkTests/SwiftClosure.js | 232 +- .../BridgeJSLinkTests/SwiftStruct.js | 422 ++- .../BridgeJSLinkTests/SwiftStructImports.js | 26 +- .../BridgeJSLinkTests/UnsafePointer.js | 38 +- 20 files changed, 2714 insertions(+), 2974 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 61ffc7781..0afb287ab 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -1048,7 +1048,7 @@ public struct BridgeJSLink { for skeleton in skeletons.compactMap(\.exported) { for enumDef in skeleton.enums where enumDef.enumType == .associatedValue { printer.write( - "const \(enumDef.name)Helpers = __bjs_create\(enumDef.valuesName)Helpers()();" + "const \(enumDef.name)Helpers = __bjs_create\(enumDef.valuesName)Helpers();" ) printer.write("\(JSGlueVariableScope.reservedEnumHelpers).\(enumDef.name) = \(enumDef.name)Helpers;") printer.nextLine() @@ -1064,7 +1064,7 @@ public struct BridgeJSLink { for skeleton in skeletons.compactMap(\.exported) { for structDef in skeleton.structs { printer.write( - "const \(structDef.name)Helpers = __bjs_create\(structDef.name)Helpers()();" + "const \(structDef.name)Helpers = __bjs_create\(structDef.name)Helpers();" ) printer.write( "\(JSGlueVariableScope.reservedStructHelpers).\(structDef.name) = \(structDef.name)Helpers;" @@ -1513,7 +1513,7 @@ public struct BridgeJSLink { switch enumDefinition.enumType { case .simple: - let fragment = IntrinsicJSFragment.simpleEnumHelper(enumDefinition: enumDefinition) + let fragment = IntrinsicJSFragment.caseEnumHelper(enumDefinition: enumDefinition) _ = try fragment.printCode([enumValuesName], context) jsTopLevelLines.append(contentsOf: printer.lines) case .rawValue: @@ -1521,7 +1521,7 @@ public struct BridgeJSLink { throw BridgeJSLinkError(message: "Raw value enum \(enumDefinition.name) is missing rawType") } - let fragment = IntrinsicJSFragment.rawValueEnumHelper(enumDefinition: enumDefinition) + let fragment = IntrinsicJSFragment.caseEnumHelper(enumDefinition: enumDefinition) _ = try fragment.printCode([enumValuesName], context) jsTopLevelLines.append(contentsOf: printer.lines) case .associatedValue: diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index 20903eef8..c6c37a8db 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -89,6 +89,12 @@ final class JSGlueVariableScope { func makeChildScope() -> JSGlueVariableScope { JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) } + + fileprivate func reserveNames(_ names: [String]) { + for name in names { + variables.insert(name) + } + } } extension JSGlueVariableScope { @@ -107,17 +113,7 @@ extension JSGlueVariableScope { printer.write("\(JSGlueVariableScope.reservedPointerStack).push(\(value));") } - // MARK: Return - - func emitPushI32Return(_ value: String, printer: CodeFragmentPrinter) { - printer.write("\(JSGlueVariableScope.reservedI32Stack).push(\(value));") - } - func emitPushF64Return(_ value: String, printer: CodeFragmentPrinter) { - printer.write("\(JSGlueVariableScope.reservedF64Stack).push(\(value));") - } - func emitPushPointerReturn(_ value: String, printer: CodeFragmentPrinter) { - printer.write("\(JSGlueVariableScope.reservedPointerStack).push(\(value));") - } + // MARK: Pop func popString() -> String { return "\(JSGlueVariableScope.reservedStringStack).pop()" } @@ -200,29 +196,21 @@ struct IntrinsicJSFragment: Sendable { } ) - /// NOTE: JavaScript engine itself converts booleans to integers when passing them to - /// Wasm functions, so we don't need to do anything here - static let boolLowerParameter = identity + // MARK: - Scalar Coercion Fragments + static let boolLiftReturn = IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, _ in return ["\(arguments[0]) !== 0"] } ) - static let boolLiftParameter = IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, _ in - return ["\(arguments[0]) !== 0"] - } - ) + static let boolLiftParameter = boolLiftReturn static let boolLowerReturn = IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, _ in return ["\(arguments[0]) ? 1 : 0"] } ) - - /// Convert signed Int32 to unsigned for UInt values static let uintLiftReturn = IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, _ in @@ -231,6 +219,8 @@ struct IntrinsicJSFragment: Sendable { ) static let uintLiftParameter = uintLiftReturn + // MARK: - String Fragments + static let stringLowerParameter = IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in @@ -260,7 +250,9 @@ struct IntrinsicJSFragment: Sendable { let objectId = arguments[0] let objectLabel = scope.variable("\(objectId)Object") // TODO: Implement "take" operation - printer.write("const \(objectLabel) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(objectId));") + printer.write( + "const \(objectLabel) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(objectId));" + ) printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(objectId));") return [objectLabel] } @@ -268,7 +260,7 @@ struct IntrinsicJSFragment: Sendable { static let stringLowerReturn = IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) + let printer = context.printer printer.write( "\(JSGlueVariableScope.reservedStorageToReturnBytes) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(arguments[0]));" ) @@ -276,37 +268,32 @@ struct IntrinsicJSFragment: Sendable { } ) + // MARK: - JSObject Fragments + static let jsObjectLowerParameter = IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, _ in return ["swift.memory.retain(\(arguments[0]))"] } ) - static let jsObjectLiftReturn = IntrinsicJSFragment( - parameters: ["retId"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - // TODO: Implement "take" operation - let resultLabel = scope.variable("ret") - let retId = arguments[0] - printer.write("const \(resultLabel) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(retId));") - printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(retId));") - return [resultLabel] - } - ) - static let jsObjectLiftRetainedObjectId = IntrinsicJSFragment( - parameters: ["objectId"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let resultLabel = scope.variable("value") - let objectId = arguments[0] - printer.write( - "const \(resultLabel) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(objectId));" - ) - printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(objectId));") - return [resultLabel] - } - ) + private static func jsObjectTakeRetained(hint: String = "ret") -> IntrinsicJSFragment { + IntrinsicJSFragment( + parameters: ["objectId"], + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) + // TODO: Implement "take" operation + let resultLabel = scope.variable(hint) + let objectId = arguments[0] + printer.write( + "const \(resultLabel) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(objectId));" + ) + printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(objectId));") + return [resultLabel] + } + ) + } + static let jsObjectLiftReturn = jsObjectTakeRetained(hint: "ret") + static let jsObjectLiftRetainedObjectId = jsObjectTakeRetained(hint: "value") static let jsObjectLiftParameter = IntrinsicJSFragment( parameters: ["objectId"], printCode: { arguments, _ in @@ -320,6 +307,8 @@ struct IntrinsicJSFragment: Sendable { } ) + // MARK: - JSValue Fragments + private static let jsValueLowerHelperName = "__bjs_jsValueLower" private static let jsValueLiftHelperName = "__bjs_jsValueLift" @@ -387,13 +376,18 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(payload2Var) = \(value);") printer.write("break;") } - printer.write("case \"string\":") - printer.indent { - printer.write("\(kindVar) = 1;") - printer.write("\(payload1Var) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - printer.write("\(payload2Var) = 0;") - printer.write("break;") + func emitRetainCase(_ caseName: String, kind: Int) { + printer.write("case \"\(caseName)\":") + printer.indent { + printer.write("\(kindVar) = \(kind);") + printer.write( + "\(payload1Var) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));" + ) + printer.write("\(payload2Var) = 0;") + printer.write("break;") + } } + emitRetainCase("string", kind: 1) printer.write("case \"undefined\":") printer.indent { printer.write("\(kindVar) = 5;") @@ -401,34 +395,10 @@ struct IntrinsicJSFragment: Sendable { printer.write("\(payload2Var) = 0;") printer.write("break;") } - printer.write("case \"object\":") - printer.indent { - printer.write("\(kindVar) = 3;") - printer.write("\(payload1Var) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - printer.write("\(payload2Var) = 0;") - printer.write("break;") - } - printer.write("case \"function\":") - printer.indent { - printer.write("\(kindVar) = 3;") - printer.write("\(payload1Var) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - printer.write("\(payload2Var) = 0;") - printer.write("break;") - } - printer.write("case \"symbol\":") - printer.indent { - printer.write("\(kindVar) = 7;") - printer.write("\(payload1Var) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - printer.write("\(payload2Var) = 0;") - printer.write("break;") - } - printer.write("case \"bigint\":") - printer.indent { - printer.write("\(kindVar) = 8;") - printer.write("\(payload1Var) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - printer.write("\(payload2Var) = 0;") - printer.write("break;") - } + emitRetainCase("object", kind: 3) + emitRetainCase("function", kind: 3) + emitRetainCase("symbol", kind: 7) + emitRetainCase("bigint", kind: 8) printer.write("default:") printer.indent { printer.write("throw new TypeError(\"Unsupported JSValue type\");") @@ -524,45 +494,20 @@ struct IntrinsicJSFragment: Sendable { } static func jsValueLowerReturn(context: BridgeContext) -> IntrinsicJSFragment { - switch context { - case .importTS: - // Return values from imported JS functions should be delivered to the Swift side - // via the parameter stacks that `_swift_js_pop_*` read from. - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let lowered = try jsValueLower.printCode(arguments, context) - let kindVar = lowered[0] - let payload1Var = lowered[1] - let payload2Var = lowered[2] - scope.emitPushI32Parameter(kindVar, printer: printer) - scope.emitPushI32Parameter(payload1Var, printer: printer) - scope.emitPushF64Parameter(payload2Var, printer: printer) - return [] - } - ) - case .exportSwift: - // Kept for symmetry, though JSValue return for export currently relies on Swift pushing - // to tmpRet stacks directly. - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let lowered = try jsValueLower.printCode( - arguments, - context - ) - let kindVar = lowered[0] - let payload1Var = lowered[1] - let payload2Var = lowered[2] - scope.emitPushI32Parameter(kindVar, printer: printer) - scope.emitPushI32Parameter(payload1Var, printer: printer) - scope.emitPushF64Parameter(payload2Var, printer: printer) - return [] - } - ) - } + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) + let lowered = try jsValueLower.printCode(arguments, context) + let kindVar = lowered[0] + let payload1Var = lowered[1] + let payload2Var = lowered[2] + scope.emitPushI32Parameter(kindVar, printer: printer) + scope.emitPushI32Parameter(payload1Var, printer: printer) + scope.emitPushF64Parameter(payload2Var, printer: printer) + return [] + } + ) } static let jsValueLift = IntrinsicJSFragment( @@ -596,12 +541,21 @@ struct IntrinsicJSFragment: Sendable { } ) + // MARK: - SwiftHeapObject Fragments + static let swiftHeapObjectLowerParameter = IntrinsicJSFragment( parameters: ["value"], - printCode: { arguments, context in + printCode: { arguments, _ in + return ["\(arguments[0]).pointer"] + } + ) + static let swiftHeapObjectLowerReturn = IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, _ in return ["\(arguments[0]).pointer"] } ) + static func swiftHeapObjectLiftReturn(_ name: String) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["value"], @@ -620,12 +574,8 @@ struct IntrinsicJSFragment: Sendable { } ) } - static let swiftHeapObjectLowerReturn = IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - return ["\(arguments[0]).pointer"] - } - ) + + // MARK: - Associated Enum Fragments static func associatedEnumLowerParameter(enumBase: String) -> IntrinsicJSFragment { IntrinsicJSFragment( @@ -656,407 +606,409 @@ struct IntrinsicJSFragment: Sendable { ) } - static func optionalLiftParameter(wrappedType: BridgeType, kind: JSOptionalKind) throws -> IntrinsicJSFragment { - if case .jsValue = wrappedType { + // MARK: - Optional Handling + + static func optionalLiftParameter( + wrappedType: BridgeType, + kind: JSOptionalKind, + context bridgeContext: BridgeContext = .importTS + ) throws -> IntrinsicJSFragment { + if wrappedType.isSingleParamScalar { + let coerce = wrappedType.liftCoerce return IntrinsicJSFragment( - parameters: ["isSome", "kind", "payload1", "payload2"], - printCode: { arguments, context in + parameters: ["isSome", "wrappedValue"], + printCode: { arguments, _ in let isSome = arguments[0] - let lifted = try jsValueLiftParameter.printCode( - [arguments[1], arguments[2], arguments[3]], - context - ) - let valueExpr = lifted.first ?? "undefined" - return ["\(isSome) ? \(valueExpr) : null"] + let wrappedValue = arguments[1] + let absenceLiteral = kind.absenceLiteral + if let coerce { + let coerced = coerce.replacingOccurrences(of: "$0", with: wrappedValue) + return ["\(isSome) ? \(coerced) : \(absenceLiteral)"] + } + return ["\(isSome) ? \(wrappedValue) : \(absenceLiteral)"] } ) } + let innerFragment = try liftParameter(type: wrappedType, context: bridgeContext) + return compositeOptionalLiftParameter( + wrappedType: wrappedType, + kind: kind, + innerFragment: innerFragment + ) + } + + private static func compositeOptionalLiftParameter( + wrappedType: BridgeType, + kind: JSOptionalKind, + innerFragment: IntrinsicJSFragment + ) -> IntrinsicJSFragment { + let isStackConvention = wrappedType.optionalConvention == .stackABI + let absenceLiteral = kind.absenceLiteral + + let outerParams: [String] + if isStackConvention { + outerParams = ["isSome"] + } else { + outerParams = ["isSome"] + innerFragment.parameters + } + return IntrinsicJSFragment( - parameters: ["isSome", "wrappedValue"], + parameters: outerParams, printCode: { arguments, context in let (scope, printer) = (context.scope, context.printer) let isSome = arguments[0] - let wrappedValue = arguments[1] - let resultExpr: String - let absenceLiteral = kind.absenceLiteral - - switch wrappedType { - case .int, .float, .double, .caseEnum: - resultExpr = "\(isSome) ? \(wrappedValue) : \(absenceLiteral)" - case .bool: - resultExpr = "\(isSome) ? \(wrappedValue) !== 0 : \(absenceLiteral)" - case .string: - let objectLabel = scope.variable("obj") - printer.write("let \(objectLabel);") - printer.write("if (\(isSome)) {") - printer.indent { - printer.write( - "\(objectLabel) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(wrappedValue));" - ) - printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(wrappedValue));") - } - printer.write("}") - resultExpr = "\(isSome) ? \(objectLabel) : \(absenceLiteral)" - case .closure: - resultExpr = - "\(isSome) ? \(JSGlueVariableScope.reservedSwift).memory.getObject(\(wrappedValue)) : \(absenceLiteral)" - case .swiftHeapObject(let name): - resultExpr = "\(isSome) ? _exports['\(name)'].__construct(\(wrappedValue)) : \(absenceLiteral)" - case .jsObject: - resultExpr = - "\(isSome) ? \(JSGlueVariableScope.reservedSwift).memory.getObject(\(wrappedValue)) : \(absenceLiteral)" - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - let objectLabel = scope.variable("obj") - printer.write("let \(objectLabel);") - printer.write("if (\(isSome)) {") - printer.indent { - printer.write( - "\(objectLabel) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(wrappedValue));" - ) - printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(wrappedValue));") - } - printer.write("}") - resultExpr = "\(isSome) ? \(objectLabel) : \(absenceLiteral)" - case .bool: - resultExpr = "\(isSome) ? \(wrappedValue) !== 0 : \(absenceLiteral)" - default: - resultExpr = "\(isSome) ? \(wrappedValue) : \(absenceLiteral)" - } - case .associatedValueEnum(let fullName): - let base = fullName.components(separatedBy: ".").last ?? fullName - let enumVar = scope.variable("enumValue") - printer.write("let \(enumVar);") - printer.write("if (\(isSome)) {") - printer.indent { - printer.write( - "\(enumVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(wrappedValue));" - ) - } - printer.write("}") - resultExpr = "\(isSome) ? \(enumVar) : \(absenceLiteral)" - case .swiftStruct(let fullName): - let base = fullName.components(separatedBy: ".").last ?? fullName - let structVar = scope.variable("structValue") - printer.write("let \(structVar);") + let innerArgs = isStackConvention ? [] : Array(arguments.dropFirst()) + + let bufferPrinter = CodeFragmentPrinter() + let innerResults = try innerFragment.printCode( + innerArgs, + context.with(\.printer, bufferPrinter) + ) + + let hasSideEffects = !bufferPrinter.lines.isEmpty + let innerExpr = innerResults.first ?? "undefined" + + if hasSideEffects { + let resultVar = scope.variable("optResult") + printer.write("let \(resultVar);") printer.write("if (\(isSome)) {") printer.indent { - printer.write( - "\(structVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lift();" - ) - } - printer.write("} else {") - printer.indent { - printer.write("\(structVar) = \(absenceLiteral);") - } - printer.write("}") - resultExpr = structVar - case .array(let elementType): - let arrayVar = scope.variable("arrayValue") - printer.write("let \(arrayVar);") - printer.write("if (\(isSome)) {") - try printer.indent { - let arrayLiftFragment = try arrayLift(elementType: elementType) - let liftResults = try arrayLiftFragment.printCode([], context) - if let liftResult = liftResults.first { - printer.write("\(arrayVar) = \(liftResult);") + for line in bufferPrinter.lines { + printer.write(line) } + printer.write("\(resultVar) = \(innerExpr);") } printer.write("} else {") printer.indent { - printer.write("\(arrayVar) = \(absenceLiteral);") + printer.write("\(resultVar) = \(absenceLiteral);") } printer.write("}") - resultExpr = arrayVar - case .dictionary(let valueType): - let dictVar = scope.variable("dictValue") - printer.write("let \(dictVar);") - printer.write("if (\(isSome)) {") - try printer.indent { - let dictLiftFragment = try dictionaryLift(valueType: valueType) - let liftResults = try dictLiftFragment.printCode([], context) - if let liftResult = liftResults.first { - printer.write("\(dictVar) = \(liftResult);") - } - } - printer.write("} else {") - printer.indent { - printer.write("\(dictVar) = \(absenceLiteral);") + return [resultVar] + } else { + return ["\(isSome) ? \(innerExpr) : \(absenceLiteral)"] + } + } + ) + } + + static func optionalLowerParameter( + wrappedType: BridgeType, + kind: JSOptionalKind + ) throws -> IntrinsicJSFragment { + if wrappedType.isSingleParamScalar { + let wasmType = wrappedType.wasmParams[0].type + let coerce = wrappedType.lowerCoerce + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) + let value = arguments[0] + let isSomeVar = scope.variable("isSome") + let presenceExpr = kind.presenceCheck(value: value) + printer.write("const \(isSomeVar) = \(presenceExpr);") + let coerced: String + if let coerce { + coerced = coerce.replacingOccurrences(of: "$0", with: value) + } else { + coerced = value } - printer.write("}") - resultExpr = dictVar - default: - resultExpr = "\(isSome) ? \(wrappedValue) : \(absenceLiteral)" + return ["+\(isSomeVar)", "\(isSomeVar) ? \(coerced) : \(wasmType.jsZeroLiteral)"] } + ) + } - return [resultExpr] - } + let innerFragment = try lowerParameter(type: wrappedType) + return try compositeOptionalLowerParameter( + wrappedType: wrappedType, + kind: kind, + innerFragment: innerFragment ) } - static func optionalLowerParameter(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + private static func compositeOptionalLowerParameter( + wrappedType: BridgeType, + kind: JSOptionalKind, + innerFragment: IntrinsicJSFragment + ) throws -> IntrinsicJSFragment { + let isStackConvention = wrappedType.optionalConvention == .stackABI + return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in let (scope, printer) = (context.scope, context.printer) let value = arguments[0] + scope.reserveNames(arguments) let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(value) != null;") + printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") - switch wrappedType { - case .swiftStruct(let fullName): - let base = fullName.components(separatedBy: ".").last ?? fullName - printer.write("if (\(isSomeVar)) {") - printer.indent { - printer.write( - "\(JSGlueVariableScope.reservedStructHelpers).\(base).lower(\(value));" - ) - } - printer.write("}") - printer.write("\(JSGlueVariableScope.reservedI32Stack).push(+\(isSomeVar));") - return [] - case .string, .rawValueEnum(_, .string): - let bytesVar = scope.variable("\(value)Bytes") - let idVar = scope.variable("\(value)Id") + let ifBodyPrinter = CodeFragmentPrinter() + let innerResults = try innerFragment.printCode( + [value], + context.with(\.printer, ifBodyPrinter) + ) - printer.write("let \(idVar), \(bytesVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { - printer.write("\(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));") - printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") - } - printer.write("}") - return ["+\(isSomeVar)", "\(isSomeVar) ? \(idVar) : 0", "\(isSomeVar) ? \(bytesVar).length : 0"] - case .jsValue: - let lowered = try jsValueLower.printCode([value], context) - return ["+\(isSomeVar)"] + lowered - case .associatedValueEnum(let fullName): - let base = fullName.components(separatedBy: ".").last ?? fullName - let caseIdVar = scope.variable("\(value)CaseId") - - printer.write("let \(caseIdVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { - printer.write( - "\(caseIdVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" - ) - } - printer.write("}") + let resultVars = innerResults.map { _ in scope.variable("result") } + assert( + isStackConvention || resultVars.count == wrappedType.wasmParams.count, + "Inner fragment result count (\(resultVars.count)) must match wasmParams count (\(wrappedType.wasmParams.count)) for \(wrappedType)" + ) + if !resultVars.isEmpty { + printer.write("let \(resultVars.joined(separator: ", "));") + } - return ["+\(isSomeVar)", "\(isSomeVar) ? \(caseIdVar) : 0"] - case .rawValueEnum: - // Raw value enums with optional - falls through to handle based on raw type - return ["+\(isSomeVar)", "\(isSomeVar) ? \(value) : 0"] - case .array(let elementType): - printer.write("if (\(isSomeVar)) {") - try printer.indent { - let arrayLowerFragment = try arrayLower(elementType: elementType) - let _ = try arrayLowerFragment.printCode( - [value], - context - ) + printer.write("if (\(isSomeVar)) {") + printer.indent { + for line in ifBodyPrinter.lines { + printer.write(line) } - printer.write("}") - printer.write("\(JSGlueVariableScope.reservedI32Stack).push(+\(isSomeVar));") - return [] - case .dictionary(let valueType): - printer.write("if (\(isSomeVar)) {") - try printer.indent { - let dictLowerFragment = try dictionaryLower(valueType: valueType) - let _ = try dictLowerFragment.printCode( - [value], - context - ) + for (resultVar, innerResult) in zip(resultVars, innerResults) { + printer.write("\(resultVar) = \(innerResult);") } - printer.write("}") - printer.write("\(JSGlueVariableScope.reservedI32Stack).push(+\(isSomeVar));") - return [] - default: - switch wrappedType { - case .swiftHeapObject: - return ["+\(isSomeVar)", "\(isSomeVar) ? \(value).pointer : 0"] - case .swiftProtocol: - return [ - "+\(isSomeVar)", - "\(isSomeVar) ? \(JSGlueVariableScope.reservedSwift).memory.retain(\(value)) : 0", - ] - case .jsObject: - let idVar = scope.variable("id") - printer.write("let \(idVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { - printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + } + + let hasPlaceholders = !isStackConvention && !wrappedType.wasmParams.isEmpty + if hasPlaceholders { + printer.write("} else {") + printer.indent { + for (resultVar, param) in zip(resultVars, wrappedType.wasmParams) { + printer.write("\(resultVar) = \(param.type.jsZeroLiteral);") } - printer.write("}") - return ["+\(isSomeVar)", "\(isSomeVar) ? \(idVar) : 0"] - default: - return ["+\(isSomeVar)", "\(isSomeVar) ? \(value) : 0"] } } + printer.write("}") + + if isStackConvention { + scope.emitPushI32Parameter("+\(isSomeVar)", printer: printer) + return [] + } else { + return ["+\(isSomeVar)"] + resultVars + } } ) } - static func optionalLiftReturn( - wrappedType: BridgeType, - kind: JSOptionalKind - ) -> IntrinsicJSFragment { - let absenceLiteral = kind.absenceLiteral + private static func optionalLiftReturnFromStorage(storage: String) -> IntrinsicJSFragment { + IntrinsicJSFragment( + parameters: [], + printCode: { _, context in + let (scope, printer) = (context.scope, context.printer) + let resultVar = scope.variable("optResult") + printer.write("const \(resultVar) = \(storage);") + printer.write("\(storage) = undefined;") + return [resultVar] + } + ) + } + + private static func optionalLiftReturnWithPresenceFlag( + wrappedType: BridgeType, + kind: JSOptionalKind + ) -> IntrinsicJSFragment { + let absenceLiteral = kind.absenceLiteral return IntrinsicJSFragment( parameters: [], - printCode: { arguments, context in + printCode: { _, context in let (scope, printer) = (context.scope, context.printer) + let isSomeVar = scope.variable("isSome") + printer.write("const \(isSomeVar) = \(scope.popI32());") + + let innerFragment = try liftReturn(type: wrappedType) + + let innerPrinter = CodeFragmentPrinter() + let innerResults = try innerFragment.printCode([], context.with(\.printer, innerPrinter)) + let innerExpr = innerResults.first ?? "undefined" + + if innerPrinter.lines.isEmpty { + return ["\(isSomeVar) ? \(innerExpr) : \(absenceLiteral)"] + } + let resultVar = scope.variable("optResult") - switch wrappedType { - case .bool: - printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalBool);") - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalBool) = undefined;") - case .int, .uint: - printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalInt);") - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = undefined;") - case .float: - printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalFloat);") - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalFloat) = undefined;") - case .double: - printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalDouble);") - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalDouble) = undefined;") - case .string: - printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnString);") - printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = undefined;") - case .jsObject, .swiftProtocol: - printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnString);") - printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = undefined;") - case .swiftHeapObject(let className): - let pointerVar = scope.variable("pointer") - printer.write( - "const \(pointerVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject);" - ) - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject) = undefined;") - let constructExpr = - context.hasDirectAccessToSwiftClass - ? "\(className).__construct(\(pointerVar))" - : "_exports['\(className)'].__construct(\(pointerVar))" + printer.write("let \(resultVar);") + printer.write("if (\(isSomeVar)) {") + printer.indent { + for line in innerPrinter.lines { + printer.write(line) + } + printer.write("\(resultVar) = \(innerExpr);") + } + printer.write("} else {") + printer.indent { + printer.write("\(resultVar) = \(absenceLiteral);") + } + printer.write("}") + return [resultVar] + } + ) + } + + private static func optionalLiftReturnAssociatedEnum( + fullName: String, + kind: JSOptionalKind + ) -> IntrinsicJSFragment { + let base = fullName.components(separatedBy: ".").last ?? fullName + let absenceLiteral = kind.absenceLiteral + return IntrinsicJSFragment( + parameters: [], + printCode: { _, context in + let (scope, printer) = (context.scope, context.printer) + let resultVar = scope.variable("optResult") + let tagVar = scope.variable("tag") + printer.write("const \(tagVar) = \(scope.popI32());") + printer.write( + "const \(resultVar) = \(tagVar) === -1 ? \(absenceLiteral) : \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(tagVar));" + ) + return [resultVar] + } + ) + } + + private static func optionalLiftReturnHeapObject( + className: String, + kind: JSOptionalKind + ) -> IntrinsicJSFragment { + let absenceLiteral = kind.absenceLiteral + return IntrinsicJSFragment( + parameters: [], + printCode: { _, context in + let (scope, printer) = (context.scope, context.printer) + let resultVar = scope.variable("optResult") + let pointerVar = scope.variable("pointer") + printer.write( + "const \(pointerVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject);" + ) + printer.write( + "\(JSGlueVariableScope.reservedStorageToReturnOptionalHeapObject) = undefined;" + ) + let constructExpr = + context.hasDirectAccessToSwiftClass + ? "\(className).__construct(\(pointerVar))" + : "_exports['\(className)'].__construct(\(pointerVar))" + printer.write( + "const \(resultVar) = \(pointerVar) === null ? \(absenceLiteral) : \(constructExpr);" + ) + return [resultVar] + } + ) + } + + private static func optionalLiftReturnStruct( + fullName: String, + kind: JSOptionalKind + ) -> IntrinsicJSFragment { + let base = fullName.components(separatedBy: ".").last ?? fullName + let absenceLiteral = kind.absenceLiteral + return IntrinsicJSFragment( + parameters: [], + printCode: { _, context in + let (scope, printer) = (context.scope, context.printer) + let isSomeVar = scope.variable("isSome") + let resultVar = scope.variable("optResult") + printer.write("const \(isSomeVar) = \(scope.popI32());") + printer.write( + "const \(resultVar) = \(isSomeVar) ? \(JSGlueVariableScope.reservedStructHelpers).\(base).lift() : \(absenceLiteral);" + ) + return [resultVar] + } + ) + } + + static func optionalLiftReturn( + wrappedType: BridgeType, + kind: JSOptionalKind + ) -> IntrinsicJSFragment { + if let scalarKind = wrappedType.optionalScalarKind { + return optionalLiftReturnFromStorage(storage: scalarKind.storageName) + } + if case .sideChannelReturn(let mode) = wrappedType.optionalConvention, mode != .none { + return optionalLiftReturnFromStorage(storage: JSGlueVariableScope.reservedStorageToReturnString) + } + + if case .swiftHeapObject(let className) = wrappedType { + return optionalLiftReturnHeapObject(className: className, kind: kind) + } + + if case .swiftStruct(let fullName) = wrappedType { + return optionalLiftReturnStruct(fullName: fullName, kind: kind) + } + + if wrappedType.nilSentinel.hasSentinel, case .associatedValueEnum(let fullName) = wrappedType { + return optionalLiftReturnAssociatedEnum(fullName: fullName, kind: kind) + } + + return optionalLiftReturnWithPresenceFlag(wrappedType: wrappedType, kind: kind) + } + + private static func optionalLowerReturnToSideChannel( + mode: OptionalSideChannel, + kind: JSOptionalKind + ) -> IntrinsicJSFragment { + IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) + let value = arguments[0] + let isSomeVar = scope.variable("isSome") + let presenceExpr = kind.presenceCheck(value: value) + printer.write("const \(isSomeVar) = \(presenceExpr);") + + if mode == .storage { printer.write( - "const \(resultVar) = \(pointerVar) === null ? \(absenceLiteral) : \(constructExpr);" + "\(JSGlueVariableScope.reservedStorageToReturnString) = \(isSomeVar) ? \(value) : \(kind.absenceLiteral);" ) - case .caseEnum: - printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalInt);") - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = undefined;") - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnString);") - printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = undefined;") - case .bool: - printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalBool);" - ) - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalBool) = undefined;") - case .float: - printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalFloat);" - ) - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalFloat) = undefined;") - case .double: - printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalDouble);" - ) - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalDouble) = undefined;") - default: - printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnOptionalInt);") - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = undefined;") - } - case .associatedValueEnum(let fullName): - let base = fullName.components(separatedBy: ".").last ?? fullName - let tagVar = scope.variable("tag") - printer.write("const \(tagVar) = \(scope.popI32());") - let isNullVar = scope.variable("isNull") - printer.write("const \(isNullVar) = (\(tagVar) === -1);") - printer.write("let \(resultVar);") - printer.write("if (\(isNullVar)) {") - printer.indent { - printer.write("\(resultVar) = \(absenceLiteral);") - } - printer.write("} else {") - printer.indent { - printer.write( - "\(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(tagVar));" - ) - } - printer.write("}") - case .swiftStruct(let fullName): - let base = fullName.components(separatedBy: ".").last ?? fullName - let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(scope.popI32());") - printer.write("let \(resultVar);") + } else { + let idVar = scope.variable("id") + printer.write("let \(idVar) = 0;") printer.write("if (\(isSomeVar)) {") printer.indent { printer.write( - "\(resultVar) = \(JSGlueVariableScope.reservedStructHelpers).\(base).lift();" + "\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));" ) } - printer.write("} else {") - printer.indent { - printer.write("\(resultVar) = \(absenceLiteral);") - } - printer.write("}") - case .array(let elementType): - let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(scope.popI32());") - printer.write("let \(resultVar);") - printer.write("if (\(isSomeVar)) {") - try printer.indent { - let arrayLiftFragment = try arrayLift(elementType: elementType) - let liftResults = try arrayLiftFragment.printCode([], context) - if let liftResult = liftResults.first { - printer.write("\(resultVar) = \(liftResult);") - } - } - printer.write("} else {") - printer.indent { - printer.write("\(resultVar) = \(absenceLiteral);") - } printer.write("}") - case .dictionary(let valueType): - let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(scope.popI32());") - printer.write("let \(resultVar);") - printer.write("if (\(isSomeVar)) {") - try printer.indent { - let dictLiftFragment = try dictionaryLift(valueType: valueType) - let liftResults = try dictLiftFragment.printCode([], context) - if let liftResult = liftResults.first { - printer.write("\(resultVar) = \(liftResult);") - } - } - printer.write("} else {") - printer.indent { - printer.write("\(resultVar) = \(absenceLiteral);") - } - printer.write("}") - case .jsValue: - let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(scope.popI32());") - printer.write("let \(resultVar);") - printer.write("if (\(isSomeVar)) {") - try printer.indent { - let lifted = try jsValueLift.printCode([], context) - if let liftedValue = lifted.first { - printer.write("\(resultVar) = \(liftedValue);") - } - } - printer.write("} else {") - printer.indent { - printer.write("\(resultVar) = null;") + printer.write("bjs[\"swift_js_return_optional_object\"](\(isSomeVar) ? 1 : 0, \(idVar));") + } + + return [] + } + ) + } + + private static func optionalLowerReturnWithPresenceFlag( + wrappedType: BridgeType, + kind: JSOptionalKind, + innerFragment: IntrinsicJSFragment + ) -> IntrinsicJSFragment { + IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) + let value = arguments[0] + let isSomeVar = scope.variable("isSome") + let presenceExpr = kind.presenceCheck(value: value) + printer.write("const \(isSomeVar) = \(presenceExpr);") + + let innerPrinter = CodeFragmentPrinter() + let innerResults = try innerFragment.printCode( + [value], + context.with(\.printer, innerPrinter) + ) + if !innerResults.isEmpty { + throw BridgeJSLinkError( + message: "Unsupported wrapped type for returning from JS function: \(wrappedType)" + ) + } + + printer.write("if (\(isSomeVar)) {") + printer.indent { + for line in innerPrinter.lines { + printer.write(line) } - printer.write("}") - default: - printer.write("const \(resultVar) = \(JSGlueVariableScope.reservedStorageToReturnString);") - printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = undefined;") } - return [resultVar] + printer.write("}") + + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) + return [] } ) } @@ -1068,6 +1020,70 @@ struct IntrinsicJSFragment: Sendable { default: break } + if let scalarKind = wrappedType.optionalScalarKind, + !wrappedType.nilSentinel.hasSentinel, wrappedType.wasmParams.count == 1 + { + let wasmType = wrappedType.wasmParams[0].type + let funcName = scalarKind.funcName + let stackCoerce = wrappedType.stackLowerCoerce + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) + let value = arguments[0] + let isSomeVar = scope.variable("isSome") + let presenceExpr = kind.presenceCheck(value: value) + printer.write("const \(isSomeVar) = \(presenceExpr);") + var coerced: String + if let coerce = stackCoerce { + coerced = coerce.replacingOccurrences(of: "$0", with: value) + if coerced.contains("?") && !coerced.hasPrefix("(") { + coerced = "(\(coerced))" + } + } else { + coerced = value + } + printer.write( + "bjs[\"\(funcName)\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? \(coerced) : \(wasmType.jsZeroLiteral));" + ) + return [] + } + ) + } + + if case .sideChannelReturn(let mode) = wrappedType.optionalConvention { + if mode == .none { + throw BridgeJSLinkError( + message: "Unsupported wrapped type for returning from JS function: \(wrappedType)" + ) + } + return optionalLowerReturnToSideChannel(mode: mode, kind: kind) + } + + if wrappedType.nilSentinel.hasSentinel { + let innerFragment = try lowerReturn(type: wrappedType, context: .exportSwift) + return sentinelOptionalLowerReturn( + wrappedType: wrappedType, + kind: kind, + innerFragment: innerFragment + ) + } + + let innerFragment = try lowerReturn(type: wrappedType, context: .exportSwift) + return optionalLowerReturnWithPresenceFlag( + wrappedType: wrappedType, + kind: kind, + innerFragment: innerFragment + ) + } + + private static func sentinelOptionalLowerReturn( + wrappedType: BridgeType, + kind: JSOptionalKind, + innerFragment: IntrinsicJSFragment + ) -> IntrinsicJSFragment { + let sentinelLiteral = wrappedType.nilSentinel.jsLiteral + return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in @@ -1077,197 +1093,159 @@ struct IntrinsicJSFragment: Sendable { let presenceExpr = kind.presenceCheck(value: value) printer.write("const \(isSomeVar) = \(presenceExpr);") - switch wrappedType { - case .bool: - printer.write( - "bjs[\"swift_js_return_optional_bool\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) ? 1 : 0) : 0);" - ) - case .int, .uint: - printer.write( - "bjs[\"swift_js_return_optional_int\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) | 0) : 0);" - ) - case .caseEnum: - printer.write("return \(isSomeVar) ? (\(value) | 0) : -1;") - case .float: - printer.write( - "bjs[\"swift_js_return_optional_float\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? Math.fround(\(value)) : 0.0);" - ) - case .double: - printer.write( - "bjs[\"swift_js_return_optional_double\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? \(value) : 0.0);" - ) - case .string: - printer.write("if (\(isSomeVar)) {") - printer.indent { - printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(value);") - } - printer.write("} else {") - printer.indent { - printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = null;") - } - printer.write("}") - case .jsObject, .swiftProtocol: - let idVar = scope.variable("id") - printer.write("let \(idVar) = 0;") + let bufferPrinter = CodeFragmentPrinter() + let innerResults = try innerFragment.printCode( + [value], + context.with(\.printer, bufferPrinter) + ) + + let hasSideEffects = !bufferPrinter.lines.isEmpty + let innerExpr = innerResults.first + + if hasSideEffects { printer.write("if (\(isSomeVar)) {") printer.indent { - printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - } - printer.write("}") - printer.write("bjs[\"swift_js_return_optional_object\"](\(isSomeVar) ? 1 : 0, \(idVar));") - case .jsValue: - if value != "undefined" { - let lowered = try jsValueLower.printCode([value], context) - let kindVar = lowered[0] - let payload1Var = lowered[1] - let payload2Var = lowered[2] - scope.emitPushI32Parameter(kindVar, printer: printer) - scope.emitPushI32Parameter(payload1Var, printer: printer) - scope.emitPushF64Parameter(payload2Var, printer: printer) - } - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .swiftHeapObject: - printer.write("return \(isSomeVar) ? \(value).pointer : 0;") - case .array(let elementType): - printer.write("if (\(isSomeVar)) {") - try printer.indent { - let arrayLowerFragment = try arrayLower(elementType: elementType) - let _ = try arrayLowerFragment.printCode( - [value], - context - ) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - printer.write("if (\(isSomeVar)) {") - printer.indent { - printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(value);") + for line in bufferPrinter.lines { + printer.write(line) } - printer.write("} else {") - printer.indent { - printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = null;") + if let expr = innerExpr { + printer.write("return \(expr);") } - printer.write("}") - default: - switch rawType { - case .bool: - printer.write( - "bjs[\"swift_js_return_optional_bool\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) ? 1 : 0) : 0);" - ) - case .float: - printer.write( - "bjs[\"swift_js_return_optional_float\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? Math.fround(\(value)) : 0.0);" - ) - case .double: - printer.write( - "bjs[\"swift_js_return_optional_double\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? \(value) : 0.0);" - ) - default: - printer.write( - "bjs[\"swift_js_return_optional_int\"](\(isSomeVar) ? 1 : 0, \(isSomeVar) ? (\(value) | 0) : 0);" - ) - } - } - case .associatedValueEnum(let fullName): - let base = fullName.components(separatedBy: ".").last ?? fullName - let caseIdVar = scope.variable("caseId") - printer.write("if (\(isSomeVar)) {") - printer.indent { - printer.write( - "const \(caseIdVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" - ) - printer.write("return \(caseIdVar);") } printer.write("} else {") printer.indent { - printer.write("return -1;") + printer.write("return \(sentinelLiteral);") } printer.write("}") - case .dictionary(let valueType): - printer.write("if (\(isSomeVar)) {") - try printer.indent { - let entriesVar = scope.variable("entries") - let entryVar = scope.variable("entry") - printer.write("const \(entriesVar) = Object.entries(\(value));") - printer.write("for (const \(entryVar) of \(entriesVar)) {") - try printer.indent { - let keyVar = scope.variable("key") - let valueVar = scope.variable("value") - printer.write("const [\(keyVar), \(valueVar)] = \(entryVar);") - - let keyFragment = try stackLowerFragment(elementType: .string) - let _ = try keyFragment.printCode( - [keyVar], - context - ) + } else if let expr = innerExpr { + printer.write("return \(isSomeVar) ? \(expr) : \(sentinelLiteral);") + } + + return [] + } + ) + } + + // MARK: - Protocol Support + + static func protocolPropertyOptionalToSideChannel(wrappedType: BridgeType) throws -> IntrinsicJSFragment { + if let scalarKind = wrappedType.optionalScalarKind { + let storage = scalarKind.storageName + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, context in + context.printer.write("\(storage) = \(arguments[0]);") + return [] + } + ) + } + + if case .sideChannelReturn(let mode) = wrappedType.optionalConvention, + mode != .none + { + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, context in + let printer = context.printer + let value = arguments[0] - let valueFragment = try stackLowerFragment(elementType: valueType) - let _ = try valueFragment.printCode( - [valueVar], - context - ) - } - printer.write("}") - scope.emitPushI32Parameter("\(entriesVar).length", printer: printer) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - default: - throw BridgeJSLinkError( - message: "Unsupported wrapped type for returning from JS function: \(wrappedType)" - ) + printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(value);") + + return [] } + ) + } - return [] - } + throw BridgeJSLinkError( + message: "Type \(wrappedType) does not use side channel for protocol property returns" ) } - // MARK: - Protocol Support + // MARK: - JS Glue Descriptor Helpers - static func protocolPropertyOptionalToSideChannel(wrappedType: BridgeType) throws -> IntrinsicJSFragment { - switch wrappedType { - case .string, .int, .float, .double, .jsObject, .swiftProtocol: - break - case .rawValueEnum(_, let rawType): - switch rawType { - case .string, .int, .float, .double: - break - default: - throw BridgeJSLinkError( - message: "Unsupported raw value enum type for protocol property side channel: \(rawType)" - ) - } - default: - throw BridgeJSLinkError( - message: "Type \(wrappedType) does not use side channel for protocol property returns" - ) + private static func popExpression(for wasmType: WasmCoreType, scope: JSGlueVariableScope) -> String { + switch wasmType { + case .i32: return scope.popI32() + case .f32: return scope.popF32() + case .f64: return scope.popF64() + case .pointer: return scope.popPointer() + case .i64: return scope.popI32() } + } - return IntrinsicJSFragment( + private static func emitPush( + for wasmType: WasmCoreType, + value: String, + scope: JSGlueVariableScope, + printer: CodeFragmentPrinter + ) { + switch wasmType { + case .i32: scope.emitPushI32Parameter(value, printer: printer) + case .f32: scope.emitPushF32Parameter(value, printer: printer) + case .f64: scope.emitPushF64Parameter(value, printer: printer) + case .pointer: scope.emitPushPointerParameter(value, printer: printer) + case .i64: scope.emitPushI32Parameter(value, printer: printer) + } + } + + @discardableResult + private static func emitOptionalPlaceholders( + for wrappedType: BridgeType, + scope: JSGlueVariableScope, + printer: CodeFragmentPrinter + ) -> Bool { + let params = wrappedType.wasmParams + if params.isEmpty { + return false + } + for param in params { + emitPush(for: param.type, value: param.type.jsZeroLiteral, scope: scope, printer: printer) + } + return true + } + + private static func stackOptionalLower( + wrappedType: BridgeType, + kind: JSOptionalKind, + innerFragment: IntrinsicJSFragment + ) -> IntrinsicJSFragment { + IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in - let printer = context.printer + let (scope, printer) = (context.scope, context.printer) let value = arguments[0] + let isSomeVar = scope.variable("isSome") + printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") - switch wrappedType { - case .string, .rawValueEnum(_, .string): - printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(value);") - case .int, .rawValueEnum(_, .int): - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalInt) = \(value);") - case .float, .rawValueEnum(_, .float): - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalFloat) = \(value);") - case .double, .rawValueEnum(_, .double): - printer.write("\(JSGlueVariableScope.reservedStorageToReturnOptionalDouble) = \(value);") - case .jsObject, .swiftProtocol: - printer.write("\(JSGlueVariableScope.reservedStorageToReturnString) = \(value);") - default: - fatalError("Unsupported type in protocolPropertyOptionalToSideChannel: \(wrappedType)") + let ifBodyPrinter = CodeFragmentPrinter() + try ifBodyPrinter.indent { + let _ = try innerFragment.printCode( + [value], + context.with(\.printer, ifBodyPrinter) + ) } - + printer.write("if (\(isSomeVar)) {") + for line in ifBodyPrinter.lines { + printer.write(line) + } + let placeholderPrinter = CodeFragmentPrinter() + let hasPlaceholders = emitOptionalPlaceholders( + for: wrappedType, + scope: scope, + printer: placeholderPrinter + ) + if hasPlaceholders { + printer.write("} else {") + printer.indent { + for line in placeholderPrinter.lines { + printer.write(line) + } + } + printer.write("}") + } else { + printer.write("}") + } + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) return [] } ) @@ -1278,22 +1256,19 @@ struct IntrinsicJSFragment: Sendable { /// Returns a fragment that lowers a JS value to Wasm core values for parameters static func lowerParameter(type: BridgeType) throws -> IntrinsicJSFragment { switch type { - case .int, .uint, .float, .double, .bool, .unsafePointer: return .identity + case .bool, .int, .uint, .float, .double, .unsafePointer, .caseEnum: + return .identity + case .rawValueEnum(_, let rawType) where rawType != .string: + return .identity case .string: return .stringLowerParameter case .jsObject: return .jsObjectLowerParameter case .jsValue: return .jsValueLower - case .swiftHeapObject: - return .swiftHeapObjectLowerParameter + case .swiftHeapObject: return .swiftHeapObjectLowerParameter case .swiftProtocol: return .jsObjectLowerParameter case .void: return .void - case .nullable(let wrappedType, _): - return try .optionalLowerParameter(wrappedType: wrappedType) - case .caseEnum: return .identity - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: return .stringLowerParameter - default: return .identity - } + case .nullable(let wrappedType, let kind): + return try .optionalLowerParameter(wrappedType: wrappedType, kind: kind) + case .rawValueEnum(_, .string): return .stringLowerParameter case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName return .associatedEnumLowerParameter(enumBase: base) @@ -1319,31 +1294,31 @@ struct IntrinsicJSFragment: Sendable { return try arrayLower(elementType: elementType) case .dictionary(let valueType): return try dictionaryLower(valueType: valueType) + default: + throw BridgeJSLinkError(message: "Unhandled type in lowerParameter: \(type)") } } /// Returns a fragment that lifts a Wasm core value to a JS value for return values static func liftReturn(type: BridgeType) throws -> IntrinsicJSFragment { switch type { - case .int, .float, .double: return .identity - case .uint: return .uintLiftReturn - case .bool: return .boolLiftReturn + case .bool, .rawValueEnum(_, .bool): + return .boolLiftReturn + case .uint: + return .uintLiftReturn + case .int, .float, .double, .unsafePointer, .caseEnum: + return .identity + case .rawValueEnum(_, let rawType) where rawType != .string && rawType != .bool: + return .identity case .string: return .stringLiftReturn case .jsObject: return .jsObjectLiftReturn case .jsValue: return .jsValueLift case .swiftHeapObject(let name): return .swiftHeapObjectLiftReturn(name) - case .unsafePointer: return .identity case .swiftProtocol: return .jsObjectLiftReturn case .void: return .void case .nullable(let wrappedType, let kind): return .optionalLiftReturn(wrappedType: wrappedType, kind: kind) - case .caseEnum: return .identity - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: return .stringLiftReturn - case .bool: return .boolLiftReturn - default: return .identity - } + case .rawValueEnum(_, .string): return .stringLiftReturn case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName return .associatedEnumLiftReturn(enumBase: base) @@ -1366,6 +1341,8 @@ struct IntrinsicJSFragment: Sendable { return try arrayLift(elementType: elementType) case .dictionary(let valueType): return try dictionaryLift(valueType: valueType) + default: + throw BridgeJSLinkError(message: "Unhandled type in liftReturn: \(type)") } } @@ -1374,13 +1351,17 @@ struct IntrinsicJSFragment: Sendable { /// Returns a fragment that lifts Wasm core values to JS values for parameters static func liftParameter(type: BridgeType, context: BridgeContext = .importTS) throws -> IntrinsicJSFragment { switch type { - case .int, .float, .double: return .identity - case .uint: return .uintLiftParameter - case .bool: return .boolLiftParameter + case .bool, .rawValueEnum(_, .bool): + return .boolLiftParameter + case .uint: + return .uintLiftParameter + case .int, .float, .double, .unsafePointer, .caseEnum: + return .identity + case .rawValueEnum(_, let rawType) where rawType != .string && rawType != .bool: + return .identity case .string: return .stringLiftParameter case .jsObject: return .jsObjectLiftParameter case .jsValue: return .jsValueLiftParameter - case .unsafePointer: return .identity case .swiftHeapObject(let name): return .swiftHeapObjectLiftParameter(name) case .swiftProtocol: return .jsObjectLiftParameter @@ -1389,14 +1370,8 @@ struct IntrinsicJSFragment: Sendable { message: "Void can't appear in parameters of imported JS functions" ) case .nullable(let wrappedType, let kind): - return try .optionalLiftParameter(wrappedType: wrappedType, kind: kind) - case .caseEnum: return .identity - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: return .stringLiftParameter - case .bool: return .boolLiftParameter - default: return .identity - } + return try .optionalLiftParameter(wrappedType: wrappedType, kind: kind, context: context) + case .rawValueEnum(_, .string): return .stringLiftParameter case .associatedValueEnum(let fullName): switch context { case .importTS: @@ -1454,31 +1429,29 @@ struct IntrinsicJSFragment: Sendable { return try arrayLift(elementType: elementType) case .dictionary(let valueType): return try dictionaryLift(valueType: valueType) + default: + throw BridgeJSLinkError(message: "Unhandled type in liftParameter: \(type)") } } /// Returns a fragment that lowers a JS value to Wasm core values for return values static func lowerReturn(type: BridgeType, context: BridgeContext = .importTS) throws -> IntrinsicJSFragment { switch type { - case .int, .uint, .float, .double: return .identity - case .bool: return .boolLowerReturn + case .bool, .rawValueEnum(_, .bool): + return .boolLowerReturn + case .int, .uint, .float, .double, .unsafePointer, .caseEnum: + return .identity + case .rawValueEnum(_, let rawType) where rawType != .string && rawType != .bool: + return .identity case .string: return .stringLowerReturn case .jsObject: return .jsObjectLowerReturn case .jsValue: return .jsValueLowerReturn(context: context) - case .unsafePointer: return .identity - case .swiftHeapObject: - return .swiftHeapObjectLowerReturn + case .swiftHeapObject: return .swiftHeapObjectLowerReturn case .swiftProtocol: return .jsObjectLowerReturn case .void: return .void case .nullable(let wrappedType, let kind): return try .optionalLowerReturn(wrappedType: wrappedType, kind: kind) - case .caseEnum: return .identity - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: return .stringLowerReturn - case .bool: return .boolLowerReturn - default: return .identity - } + case .rawValueEnum(_, .string): return .stringLowerReturn case .associatedValueEnum(let fullName): switch context { case .importTS: @@ -1492,7 +1465,6 @@ struct IntrinsicJSFragment: Sendable { case .swiftStruct(let fullName): switch context { case .importTS: - // ImportTS expects Swift structs to come back as a retained JS object ID. return .jsObjectLowerReturn case .exportSwift: return swiftStructLowerReturn(fullName: fullName) @@ -1519,6 +1491,8 @@ struct IntrinsicJSFragment: Sendable { return try arrayLower(elementType: elementType) case .dictionary(let valueType): return try dictionaryLower(valueType: valueType) + default: + throw BridgeJSLinkError(message: "Unhandled type in lowerReturn: \(type)") } } @@ -1578,107 +1552,77 @@ struct IntrinsicJSFragment: Sendable { let (scope, printer) = (context.scope, context.printer) let enumName = arguments[0] - printer.write("const __bjs_create\(enumName)Helpers = () => {") - printer.indent() - printer.write( - "return () => ({" - ) - printer.indent() - - // Generate lower function - printer.write("lower: (value) => {") + printer.write("const __bjs_create\(enumName)Helpers = () => ({") try printer.indent { - printer.write("const enumTag = value.tag;") - printer.write("switch (enumTag) {") + printer.write("lower: (value) => {") try printer.indent { - let lowerPrinter = CodeFragmentPrinter() - for enumCase in enumDefinition.cases { - let caseName = enumCase.name.capitalizedFirstLetter - let caseScope = scope.makeChildScope() - let fragment = IntrinsicJSFragment.associatedValuePushPayload(enumCase: enumCase) - _ = try fragment.printCode( - ["value", enumName, caseName], - context.with(\.scope, caseScope).with(\.printer, lowerPrinter) - ) - } + printer.write("const enumTag = value.tag;") + printer.write("switch (enumTag) {") + try printer.indent { + let lowerPrinter = CodeFragmentPrinter() + for enumCase in enumDefinition.cases { + let caseName = enumCase.name.capitalizedFirstLetter + let caseScope = scope.makeChildScope() + let fragment = IntrinsicJSFragment.associatedValuePushPayload( + enumCase: enumCase + ) + _ = try fragment.printCode( + ["value", enumName, caseName], + context.with(\.scope, caseScope).with(\.printer, lowerPrinter) + ) + } - for line in lowerPrinter.lines { - printer.write(line) - } + for line in lowerPrinter.lines { + printer.write(line) + } - printer.write("default: throw new Error(\"Unknown \(enumName) tag: \" + String(enumTag));") + printer.write( + "default: throw new Error(\"Unknown \(enumName) tag: \" + String(enumTag));" + ) + } + printer.write("}") } - printer.write("}") - } - printer.write("},") + printer.write("},") - // Generate lift function - printer.write( - "lift: (tag) => {" - ) - try printer.indent { - printer.write("tag = tag | 0;") - printer.write("switch (tag) {") + printer.write("lift: (tag) => {") try printer.indent { - let liftPrinter = CodeFragmentPrinter() - for enumCase in enumDefinition.cases { - let caseName = enumCase.name.capitalizedFirstLetter - let caseScope = scope.makeChildScope() + printer.write("tag = tag | 0;") + printer.write("switch (tag) {") + try printer.indent { + let liftPrinter = CodeFragmentPrinter() + for enumCase in enumDefinition.cases { + let caseName = enumCase.name.capitalizedFirstLetter + let caseScope = scope.makeChildScope() - let fragment = IntrinsicJSFragment.associatedValuePopPayload(enumCase: enumCase) - _ = try fragment.printCode( - [enumName, caseName], - context.with(\.scope, caseScope).with(\.printer, liftPrinter) - ) - } + let fragment = IntrinsicJSFragment.associatedValuePopPayload( + enumCase: enumCase + ) + _ = try fragment.printCode( + [enumName, caseName], + context.with(\.scope, caseScope).with(\.printer, liftPrinter) + ) + } - for line in liftPrinter.lines { - printer.write(line) - } + for line in liftPrinter.lines { + printer.write(line) + } - printer.write( - "default: throw new Error(\"Unknown \(enumName) tag returned from Swift: \" + String(tag));" - ) + printer.write( + "default: throw new Error(\"Unknown \(enumName) tag returned from Swift: \" + String(tag));" + ) + } + printer.write("}") } printer.write("}") } - printer.write("}") - printer.unindent() printer.write("});") - printer.unindent() - printer.write("};") - - return [] - } - ) - } - - static func simpleEnumHelper(enumDefinition: ExportedEnum) -> IntrinsicJSFragment { - return IntrinsicJSFragment( - parameters: ["enumName"], - printCode: { arguments, context in - let printer = context.printer - let enumName = arguments[0] - printer.write("const \(enumName) = {") - printer.indent { - for (index, enumCase) in enumDefinition.cases.enumerated() { - let caseName = enumCase.name.capitalizedFirstLetter - let value = enumCase.jsValue( - rawType: enumDefinition.rawType, - index: index - ) - printer.write("\(caseName): \(value),") - } - } - printer.write("};") - printer.nextLine() return [] } ) } - static func rawValueEnumHelper(enumDefinition: ExportedEnum) -> IntrinsicJSFragment { + static func caseEnumHelper(enumDefinition: ExportedEnum) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["enumName"], printCode: { arguments, context in @@ -1717,7 +1661,6 @@ struct IntrinsicJSFragment: Sendable { if enumCase.associatedValues.isEmpty { printer.write("return \(enumName).Tag.\(caseName);") } else { - // Process associated values in reverse order (to match the order they'll be popped) let reversedValues = enumCase.associatedValues.enumerated().reversed() for (associatedValueIndex, associatedValue) in reversedValues { @@ -1770,175 +1713,11 @@ struct IntrinsicJSFragment: Sendable { for line in casePrinter.lines { printer.write(line) } - printer.write( - "return { tag: \(enumName).Tag.\(caseName), \(fieldPairs.reversed().joined(separator: ", ")) };" - ) - } - printer.write("}") - } - - return [] - } - ) - } - - private static func associatedValuePushPayload(type: BridgeType) throws -> IntrinsicJSFragment { - switch type { - case .nullable(let wrappedType, let kind): - return associatedValueOptionalPushPayload(wrappedType: wrappedType, kind: kind) - default: - return try stackLowerFragment(elementType: type) - } - } - - private static func associatedValueOptionalPushPayload( - wrappedType: BridgeType, - kind: JSOptionalKind - ) -> IntrinsicJSFragment { - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let value = arguments[0] - let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") - - switch wrappedType { - case .string: - let idVar = scope.variable("id") - printer.write("let \(idVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { - let bytesVar = scope.variable("bytes") - printer.write( - "let \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" - ) - printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") - scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) - scope.emitPushI32Parameter(idVar, printer: printer) - } - printer.write("} else {") - printer.indent { - scope.emitPushI32Parameter("0", printer: printer) - scope.emitPushI32Parameter("0", printer: printer) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .int, .uint: - scope.emitPushI32Parameter("\(isSomeVar) ? (\(value) | 0) : 0", printer: printer) - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .bool: - scope.emitPushI32Parameter("\(isSomeVar) ? (\(value) ? 1 : 0) : 0", printer: printer) - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .float: - scope.emitPushF32Parameter("\(isSomeVar) ? Math.fround(\(value)) : 0.0", printer: printer) - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .double: - scope.emitPushF64Parameter("\(isSomeVar) ? \(value) : 0.0", printer: printer) - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .caseEnum: - scope.emitPushI32Parameter("\(isSomeVar) ? (\(value) | 0) : 0", printer: printer) - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - let idVar = scope.variable("id") - printer.write("let \(idVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { - let bytesVar = scope.variable("bytes") - printer.write( - "let \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" - ) - printer.write( - "\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" - ) - scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) - scope.emitPushI32Parameter(idVar, printer: printer) - } - printer.write("} else {") - printer.indent { - scope.emitPushI32Parameter("0", printer: printer) - scope.emitPushI32Parameter("0", printer: printer) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .float: - scope.emitPushF32Parameter("\(isSomeVar) ? Math.fround(\(value)) : 0.0", printer: printer) - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .double: - scope.emitPushF64Parameter("\(isSomeVar) ? \(value) : 0.0", printer: printer) - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - default: - scope.emitPushI32Parameter("\(isSomeVar) ? (\(value) | 0) : 0", printer: printer) - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - } - case .swiftStruct(let structName): - let structBase = structName.components(separatedBy: ".").last ?? structName - printer.write("if (\(isSomeVar)) {") - printer.indent { - printer.write( - "\(JSGlueVariableScope.reservedStructHelpers).\(structBase).lower(\(value));" - ) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .swiftHeapObject: - printer.write("if (\(isSomeVar)) {") - printer.indent { - scope.emitPushPointerParameter("\(value).pointer", printer: printer) - } - printer.write("} else {") - printer.indent { - scope.emitPushPointerParameter("0", printer: printer) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .jsObject: - let idVar = scope.variable("id") - printer.write("let \(idVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { - printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - scope.emitPushI32Parameter(idVar, printer: printer) - } - printer.write("} else {") - printer.indent { - printer.write("\(idVar) = undefined;") - scope.emitPushI32Parameter("0", printer: printer) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .associatedValueEnum(let enumName): - let base = enumName.components(separatedBy: ".").last ?? enumName - let caseIdVar = scope.variable("enumCaseId") - printer.write("let \(caseIdVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { - printer.write( - "\(caseIdVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" - ) - scope.emitPushI32Parameter(caseIdVar, printer: printer) - } - printer.write("} else {") - printer.indent { - scope.emitPushI32Parameter("0", printer: printer) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - case .array(let elementType): - printer.write("if (\(isSomeVar)) {") - try printer.indent { - let arrFragment = try arrayLower(elementType: elementType) - _ = try arrFragment.printCode( - [value], - context + printer.write( + "return { tag: \(enumName).Tag.\(caseName), \(fieldPairs.reversed().joined(separator: ", ")) };" ) } printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - default: - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) } return [] @@ -1946,6 +1725,58 @@ struct IntrinsicJSFragment: Sendable { ) } + private static func associatedValuePushPayload(type: BridgeType) throws -> IntrinsicJSFragment { + switch type { + case .nullable(let wrappedType, let kind): + return try associatedValueOptionalPushPayload(wrappedType: wrappedType, kind: kind) + default: + return try stackLowerFragment(elementType: type) + } + } + + private static func associatedValueOptionalPushPayload( + wrappedType: BridgeType, + kind: JSOptionalKind + ) throws -> IntrinsicJSFragment { + if wrappedType.isSingleParamScalar { + let wasmType = wrappedType.wasmParams[0].type + let stackCoerce = wrappedType.stackLowerCoerce + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) + let value = arguments[0] + let isSomeVar = scope.variable("isSome") + printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") + var coerced: String + if let coerce = stackCoerce { + coerced = coerce.replacingOccurrences(of: "$0", with: value) + if coerced.contains("?") && !coerced.hasPrefix("(") { + coerced = "(\(coerced))" + } + } else { + coerced = value + } + emitPush( + for: wasmType, + value: "\(isSomeVar) ? \(coerced) : \(wasmType.jsZeroLiteral)", + scope: scope, + printer: printer + ) + scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) + return [] + } + ) + } + + let innerFragment = try stackLowerFragment(elementType: wrappedType) + return stackOptionalLower( + wrappedType: wrappedType, + kind: kind, + innerFragment: innerFragment + ) + } + private static func associatedValuePopPayload(type: BridgeType) throws -> IntrinsicJSFragment { switch type { case .nullable(let wrappedType, let kind): @@ -2000,33 +1831,26 @@ struct IntrinsicJSFragment: Sendable { ) } - static func swiftStructLowerReturn(fullName: String) -> IntrinsicJSFragment { - let base = fullName.components(separatedBy: ".").last ?? fullName - return IntrinsicJSFragment( + private static func swiftStructLower(structBase: String) -> IntrinsicJSFragment { + IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in let printer = context.printer let value = arguments[0] printer.write( - "\(JSGlueVariableScope.reservedStructHelpers).\(base).lower(\(value));" + "\(JSGlueVariableScope.reservedStructHelpers).\(structBase).lower(\(value));" ) return [] } ) } + static func swiftStructLowerReturn(fullName: String) -> IntrinsicJSFragment { + swiftStructLower(structBase: fullName.components(separatedBy: ".").last ?? fullName) + } + static func swiftStructLowerParameter(structBase: String) -> IntrinsicJSFragment { - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let printer = context.printer - let value = arguments[0] - printer.write( - "\(JSGlueVariableScope.reservedStructHelpers).\(structBase).lower(\(value));" - ) - return [] - } - ) + swiftStructLower(structBase: structBase) } static func swiftStructLiftReturn(structBase: String) -> IntrinsicJSFragment { @@ -2161,6 +1985,29 @@ struct IntrinsicJSFragment: Sendable { } private static func stackLiftFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { + if case .nullable(let wrappedType, let kind) = elementType { + return try optionalElementRaiseFragment(wrappedType: wrappedType, kind: kind) + } + if elementType.isSingleParamScalar { + let wasmType = elementType.wasmParams[0].type + let coerce = elementType.liftCoerce + let varHint = elementType.varHint + return IntrinsicJSFragment( + parameters: [], + printCode: { _, context in + let (scope, printer) = (context.scope, context.printer) + let popExpr = popExpression(for: wasmType, scope: scope) + let varName = scope.variable(varHint) + if let transform = coerce { + let inlined = transform.replacingOccurrences(of: "$0", with: popExpr) + printer.write("const \(varName) = \(inlined);") + } else { + printer.write("const \(varName) = \(popExpr);") + } + return [varName] + } + ) + } switch elementType { case .jsValue: return IntrinsicJSFragment( @@ -2191,44 +2038,14 @@ struct IntrinsicJSFragment: Sendable { return [strVar] } ) - case .bool: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let bVar = scope.variable("bool") - printer.write("const \(bVar) = \(scope.popI32()) !== 0;") - return [bVar] - } - ) - case .int, .uint: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let iVar = scope.variable("int") - printer.write("const \(iVar) = \(scope.popI32());") - return [iVar] - } - ) - case .float: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let fVar = scope.variable("f32") - printer.write("const \(fVar) = \(scope.popF32());") - return [fVar] - } - ) - case .double: + case .rawValueEnum(_, .string): return IntrinsicJSFragment( parameters: [], printCode: { arguments, context in let (scope, printer) = (context.scope, context.printer) - let dVar = scope.variable("f64") - printer.write("const \(dVar) = \(scope.popF64());") - return [dVar] + let varName = scope.variable("rawValue") + printer.write("const \(varName) = \(scope.popString());") + return [varName] } ) case .swiftStruct(let fullName): @@ -2244,59 +2061,6 @@ struct IntrinsicJSFragment: Sendable { return [resultVar] } ) - case .caseEnum: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let varName = scope.variable("caseId") - printer.write("const \(varName) = \(scope.popI32());") - return [varName] - } - ) - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let varName = scope.variable("rawValue") - printer.write("const \(varName) = \(scope.popString());") - return [varName] - } - ) - case .float: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let varName = scope.variable("rawValue") - printer.write("const \(varName) = \(scope.popF32());") - return [varName] - } - ) - case .double: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let varName = scope.variable("rawValue") - printer.write("const \(varName) = \(scope.popF64());") - return [varName] - } - ) - default: - return IntrinsicJSFragment( - parameters: [], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let varName = scope.variable("rawValue") - printer.write("const \(varName) = \(scope.popI32());") - return [varName] - } - ) - } case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( @@ -2305,7 +2069,7 @@ struct IntrinsicJSFragment: Sendable { let (scope, printer) = (context.scope, context.printer) let resultVar = scope.variable("enumValue") printer.write( - "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popI32()), );" + "const \(resultVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(scope.popI32()));" ) return [resultVar] } @@ -2330,7 +2094,9 @@ struct IntrinsicJSFragment: Sendable { let idVar = scope.variable("objId") let objVar = scope.variable("obj") printer.write("const \(idVar) = \(scope.popI32());") - printer.write("const \(objVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(idVar));") + printer.write( + "const \(objVar) = \(JSGlueVariableScope.reservedSwift).memory.getObject(\(idVar));" + ) printer.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));") return [objVar] } @@ -2339,24 +2105,34 @@ struct IntrinsicJSFragment: Sendable { return try arrayLift(elementType: innerElementType) case .dictionary(let valueType): return try dictionaryLift(valueType: valueType) - case .nullable(let wrappedType, let kind): - return try optionalElementRaiseFragment(wrappedType: wrappedType, kind: kind) - case .unsafePointer: + default: + throw BridgeJSLinkError(message: "Unsupported array element type: \(elementType)") + } + } + + private static func stackLowerFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { + if case .nullable(let wrappedType, let kind) = elementType { + return try optionalElementLowerFragment(wrappedType: wrappedType, kind: kind) + } + if elementType.isSingleParamScalar { + let wasmType = elementType.wasmParams[0].type + let stackCoerce = elementType.stackLowerCoerce return IntrinsicJSFragment( - parameters: [], + parameters: ["value"], printCode: { arguments, context in let (scope, printer) = (context.scope, context.printer) - let pVar = scope.variable("pointer") - printer.write("const \(pVar) = \(scope.popPointer());") - return [pVar] + let value = arguments[0] + let pushExpr: String + if let coerce = stackCoerce { + pushExpr = coerce.replacingOccurrences(of: "$0", with: value) + } else { + pushExpr = value + } + emitPush(for: wasmType, value: pushExpr, scope: scope, printer: printer) + return [] } ) - case .void, .closure, .namespaceEnum: - throw BridgeJSLinkError(message: "Unsupported array element type: \(elementType)") } - } - - private static func stackLowerFragment(elementType: BridgeType) throws -> IntrinsicJSFragment { switch elementType { case .jsValue: return IntrinsicJSFragment( @@ -2374,7 +2150,7 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .string: + case .string, .rawValueEnum(_, .string): return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in @@ -2382,49 +2158,17 @@ struct IntrinsicJSFragment: Sendable { let value = arguments[0] let bytesVar = scope.variable("bytes") let idVar = scope.variable("id") - printer.write("const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));") - printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") + printer.write( + "const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" + ) + printer.write( + "const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" + ) scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) scope.emitPushI32Parameter(idVar, printer: printer) return [] } ) - case .bool: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - scope.emitPushI32Parameter("\(arguments[0]) ? 1 : 0", printer: printer) - return [] - } - ) - case .int, .uint: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - scope.emitPushI32Parameter("(\(arguments[0]) | 0)", printer: printer) - return [] - } - ) - case .float: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - scope.emitPushF32Parameter("Math.fround(\(arguments[0]))", printer: printer) - return [] - } - ) - case .double: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - scope.emitPushF64Parameter("\(arguments[0])", printer: printer) - return [] - } - ) case .swiftStruct(let fullName): let structBase = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( @@ -2438,64 +2182,7 @@ struct IntrinsicJSFragment: Sendable { return [] } ) - case .caseEnum: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - scope.emitPushI32Parameter("(\(arguments[0]) | 0)", printer: printer) - return [] - } - ) - case .rawValueEnum(_, let rawType): - switch rawType { - case .string: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let value = arguments[0] - let bytesVar = scope.variable("bytes") - let idVar = scope.variable("id") - printer.write( - "const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" - ) - printer.write( - "const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" - ) - scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) - scope.emitPushI32Parameter(idVar, printer: printer) - return [] - } - ) - case .float: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - scope.emitPushF32Parameter("Math.fround(\(arguments[0]))", printer: printer) - return [] - } - ) - case .double: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - scope.emitPushF64Parameter("\(arguments[0])", printer: printer) - return [] - } - ) - default: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - scope.emitPushI32Parameter("(\(arguments[0]) | 0)", printer: printer) - return [] - } - ) - } + case .associatedValueEnum(let fullName): let base = fullName.components(separatedBy: ".").last ?? fullName return IntrinsicJSFragment( @@ -2506,64 +2193,40 @@ struct IntrinsicJSFragment: Sendable { let caseIdVar = scope.variable("caseId") printer.write( "const \(caseIdVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" - ) - scope.emitPushI32Parameter(caseIdVar, printer: printer) - return [] - } - ) - case .swiftHeapObject: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - scope.emitPushPointerParameter("\(arguments[0]).pointer", printer: printer) - return [] - } - ) - case .jsObject: - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let value = arguments[0] - let idVar = scope.variable("objId") - printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - scope.emitPushI32Parameter(idVar, printer: printer) + ) + scope.emitPushI32Parameter(caseIdVar, printer: printer) return [] } ) - case .array(let innerElementType): - return try arrayLower(elementType: innerElementType) - case .dictionary(let valueType): - return try dictionaryLower(valueType: valueType) - case .nullable(let wrappedType, let kind): - return try optionalElementLowerFragment( - wrappedType: wrappedType, - kind: kind - ) - case .swiftProtocol: - // Same as jsObject but no cleanup — Swift's AnyProtocol wrapper releases via deinit + case .swiftHeapObject: return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in let (scope, printer) = (context.scope, context.printer) let value = arguments[0] - let idVar = scope.variable("objId") - printer.write("const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - scope.emitPushI32Parameter(idVar, printer: printer) + scope.emitPushPointerParameter("\(value).pointer", printer: printer) return [] } ) - case .unsafePointer: + case .jsObject, .swiftProtocol: return IntrinsicJSFragment( parameters: ["value"], printCode: { arguments, context in let (scope, printer) = (context.scope, context.printer) - scope.emitPushPointerParameter("(\(arguments[0]) | 0)", printer: printer) + let value = arguments[0] + let idVar = scope.variable("objId") + printer.write( + "const \(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));" + ) + scope.emitPushI32Parameter(idVar, printer: printer) return [] } ) - case .void, .closure, .namespaceEnum: + case .array(let innerElementType): + return try arrayLower(elementType: innerElementType) + case .dictionary(let valueType): + return try dictionaryLower(valueType: valueType) + default: throw BridgeJSLinkError(message: "Unsupported array element type for lowering: \(elementType)") } } @@ -2624,27 +2287,23 @@ struct IntrinsicJSFragment: Sendable { context ) } - printer.write("} else {") - printer.indent { - // Push placeholders so Swift can unconditionally pop value slots - switch wrappedType { - case .float: - scope.emitPushF32Parameter("0.0", printer: printer) - case .double: - scope.emitPushF64Parameter("0.0", printer: printer) - case .swiftStruct: - // No placeholder — Swift only pops struct fields when isSome=1 - break - case .string, .rawValueEnum(_, .string): - scope.emitPushI32Parameter("0", printer: printer) - scope.emitPushI32Parameter("0", printer: printer) - case .swiftHeapObject: - scope.emitPushPointerParameter("0", printer: printer) - default: - scope.emitPushI32Parameter("0", printer: printer) + let placeholderPrinter = CodeFragmentPrinter() + let hasPlaceholders = emitOptionalPlaceholders( + for: wrappedType, + scope: scope, + printer: placeholderPrinter + ) + if hasPlaceholders { + printer.write("} else {") + printer.indent { + for line in placeholderPrinter.lines { + printer.write(line) + } } + printer.write("}") + } else { + printer.write("}") } - printer.write("}") scope.emitPushI32Parameter(isSomeVar, printer: printer) return [] @@ -2652,6 +2311,8 @@ struct IntrinsicJSFragment: Sendable { ) } + // MARK: - Struct Helpers + static func structHelper(structDefinition: ExportedStruct, allStructs: [ExportedStruct]) -> IntrinsicJSFragment { return IntrinsicJSFragment( parameters: ["structName"], @@ -2661,49 +2322,36 @@ struct IntrinsicJSFragment: Sendable { let capturedStructDef = structDefinition let capturedAllStructs = allStructs - printer.write("const __bjs_create\(structName)Helpers = () => {") - printer.indent() - printer.write( - "return () => ({" - ) - printer.indent() - - printer.write("lower: (value) => {") + printer.write("const __bjs_create\(structName)Helpers = () => ({") try printer.indent { - try generateStructLowerCode( - structDef: capturedStructDef, - allStructs: capturedAllStructs, - context: context - ) - } - printer.write("},") + printer.write("lower: (value) => {") + try printer.indent { + try generateStructLowerCode( + structDef: capturedStructDef, + allStructs: capturedAllStructs, + context: context + ) + } + printer.write("},") - printer.write( - "lift: () => {" - ) - try printer.indent { - try generateStructLiftCode( - structDef: capturedStructDef, - allStructs: capturedAllStructs, - context: context, - attachMethods: true - ) + printer.write("lift: () => {") + try printer.indent { + try generateStructLiftCode( + structDef: capturedStructDef, + allStructs: capturedAllStructs, + context: context, + attachMethods: true + ) + } + printer.write("}") } - printer.write("}") - printer.unindent() printer.write("});") - printer.unindent() - printer.write("};") return [] } ) } - private static func findStruct(name: String, structs: [ExportedStruct]) -> ExportedStruct? { - return structs.first(where: { $0.swiftCallName == name || $0.name == name }) - } - private static func generateStructLowerCode( structDef: ExportedStruct, allStructs: [ExportedStruct], @@ -2715,7 +2363,11 @@ struct IntrinsicJSFragment: Sendable { let instanceProps = structDef.properties.filter { !$0.isStatic } for property in instanceProps { - let fragment = try structFieldLowerFragment(field: property, allStructs: allStructs) + let fragment = try structFieldLowerFragment( + type: property.type, + fieldName: property.name, + allStructs: allStructs + ) let fieldValue = "value.\(property.name)" _ = try fragment.printCode( [fieldValue], @@ -2734,7 +2386,7 @@ struct IntrinsicJSFragment: Sendable { context: IntrinsicJSFragment.PrintCodeContext, attachMethods: Bool = false ) throws { - let (scope, printer) = (context.scope, context.printer) + let printer = context.printer let liftScope = context.scope.makeChildScope() var fieldExpressions: [(name: String, expression: String)] = [] @@ -2806,10 +2458,11 @@ struct IntrinsicJSFragment: Sendable { } private static func structFieldLowerFragment( - field: ExportedProperty, + type: BridgeType, + fieldName: String, allStructs: [ExportedStruct] ) throws -> IntrinsicJSFragment { - switch field.type { + switch type { case .jsValue: preconditionFailure("Struct field of JSValue is not supported yet") case .jsObject: @@ -2822,7 +2475,9 @@ struct IntrinsicJSFragment: Sendable { printer.write("let \(idVar);") printer.write("if (\(value) != null) {") printer.indent { - printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") + printer.write( + "\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));" + ) } printer.write("} else {") printer.indent { @@ -2834,251 +2489,46 @@ struct IntrinsicJSFragment: Sendable { } ) case .nullable(let wrappedType, let kind): - return IntrinsicJSFragment( - parameters: ["value"], - printCode: { arguments, context in - let (scope, printer) = (context.scope, context.printer) - let value = arguments[0] - let isSomeVar = scope.variable("isSome") - printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") - - if case .caseEnum = wrappedType { - printer.write("if (\(isSomeVar)) {") - printer.indent { - scope.emitPushI32Parameter("\(value) | 0", printer: printer) - } - printer.write("} else {") - printer.indent { - scope.emitPushI32Parameter("0", printer: printer) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - return [] - } else if case .rawValueEnum(_, let rawType) = wrappedType { - switch rawType { - case .string: - let idVar = scope.variable("id") - printer.write("let \(idVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { - let bytesVar = scope.variable("bytes") - printer.write( - "const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" - ) - printer.write( - "\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));" - ) - scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) - scope.emitPushI32Parameter(idVar, printer: printer) - } - printer.write("} else {") - printer.indent { - scope.emitPushI32Parameter("0", printer: printer) - scope.emitPushI32Parameter("0", printer: printer) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - return [idVar] - case .float: - printer.write("if (\(isSomeVar)) {") - printer.indent { - scope.emitPushF32Parameter("Math.fround(\(value))", printer: printer) - } - printer.write("} else {") - printer.indent { - scope.emitPushF32Parameter("0.0", printer: printer) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - return [] - case .double: - printer.write("if (\(isSomeVar)) {") - printer.indent { - scope.emitPushF64Parameter("\(value)", printer: printer) - } - printer.write("} else {") - printer.indent { - scope.emitPushF64Parameter("0.0", printer: printer) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - return [] - default: - printer.write("if (\(isSomeVar)) {") - printer.indent { - scope.emitPushI32Parameter("\(value) | 0", printer: printer) - } - printer.write("} else {") - printer.indent { - scope.emitPushI32Parameter("0", printer: printer) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - return [] - } - } else if case .swiftHeapObject = wrappedType { - let ptrVar = scope.variable("ptr") - printer.write("let \(ptrVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { - printer.write("\(ptrVar) = \(value).pointer;") - scope.emitPushPointerParameter("\(ptrVar)", printer: printer) - } - printer.write("} else {") - printer.indent { - scope.emitPushPointerParameter("0", printer: printer) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - return [] - } else if case .swiftStruct(let structName) = wrappedType { - printer.write("if (\(isSomeVar)) {") - printer.indent { - printer.write( - "\(JSGlueVariableScope.reservedStructHelpers).\(structName).lower(\(value));" - ) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - return [] - } else if case .string = wrappedType { - let idVar = scope.variable("id") - printer.write("let \(idVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { - let bytesVar = scope.variable("bytes") - printer.write( - "const \(bytesVar) = \(JSGlueVariableScope.reservedTextEncoder).encode(\(value));" - ) - printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(bytesVar));") - scope.emitPushI32Parameter("\(bytesVar).length", printer: printer) - scope.emitPushI32Parameter(idVar, printer: printer) - } - printer.write("} else {") - printer.indent { - scope.emitPushI32Parameter("0", printer: printer) - scope.emitPushI32Parameter("0", printer: printer) + if wrappedType.isSingleParamScalar { + let wasmType = wrappedType.wasmParams[0].type + let stackCoerce = wrappedType.stackLowerCoerce + return IntrinsicJSFragment( + parameters: ["value"], + printCode: { arguments, context in + let (scope, printer) = (context.scope, context.printer) + let value = arguments[0] + let isSomeVar = scope.variable("isSome") + printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") + let coerced: String + if let coerce = stackCoerce { + coerced = coerce.replacingOccurrences(of: "$0", with: value) + } else { + coerced = value } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - return [idVar] - } else if case .jsObject = wrappedType { - let idVar = scope.variable("id") - printer.write("let \(idVar);") printer.write("if (\(isSomeVar)) {") printer.indent { - printer.write("\(idVar) = \(JSGlueVariableScope.reservedSwift).memory.retain(\(value));") - scope.emitPushI32Parameter(idVar, printer: printer) + emitPush(for: wasmType, value: coerced, scope: scope, printer: printer) } printer.write("} else {") printer.indent { - printer.write("\(idVar) = undefined;") - scope.emitPushI32Parameter("0", printer: printer) + emitPush(for: wasmType, value: wasmType.jsZeroLiteral, scope: scope, printer: printer) } printer.write("}") scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - return [idVar] - } else { - switch wrappedType { - case .int, .uint: - pushOptionalPrimitive( - value: value, - isSomeVar: isSomeVar, - stack: .i32Stack, - convert: "| 0", - zeroValue: "0", - printer: printer, - scope: scope - ) - case .bool: - pushOptionalPrimitive( - value: value, - isSomeVar: isSomeVar, - stack: .i32Stack, - convert: "? 1 : 0", - zeroValue: "0", - printer: printer, - scope: scope - ) - case .float: - pushOptionalPrimitive( - value: value, - isSomeVar: isSomeVar, - stack: .f32Stack, - convert: "Math.fround", - zeroValue: "0.0", - printer: printer, - scope: scope - ) - case .double: - pushOptionalPrimitive( - value: value, - isSomeVar: isSomeVar, - stack: .f64Stack, - convert: nil, - zeroValue: "0.0", - printer: printer, - scope: scope - ) - case .associatedValueEnum(let enumName): - let base = enumName.components(separatedBy: ".").last ?? enumName - let caseIdVar = scope.variable("enumCaseId") - printer.write("let \(caseIdVar);") - printer.write("if (\(isSomeVar)) {") - printer.indent { - printer.write( - "\(caseIdVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lower(\(value));" - ) - scope.emitPushI32Parameter(caseIdVar, printer: printer) - } - printer.write("} else {") - printer.indent { - scope.emitPushI32Parameter("0", printer: printer) - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - default: - let wrappedFragment = try structFieldLowerFragment( - field: ExportedProperty( - name: field.name, - type: wrappedType, - isReadonly: true, - isStatic: false - ), - allStructs: allStructs - ) - let guardedPrinter = CodeFragmentPrinter() - _ = try wrappedFragment.printCode( - [value], - context.with(\.printer, guardedPrinter) - ) - var loweredLines = guardedPrinter.lines - var hoistedCleanupVar: String? - if let first = loweredLines.first { - let trimmed = first.trimmingCharacters(in: .whitespaces) - if trimmed.hasPrefix("const "), - let namePart = trimmed.split(separator: " ").dropFirst().first, - trimmed.contains("= []") - { - hoistedCleanupVar = String(namePart) - loweredLines[0] = "\(hoistedCleanupVar!) = [];" - } - } - if let hoistedName = hoistedCleanupVar { - printer.write("let \(hoistedName);") - } - printer.write("if (\(isSomeVar)) {") - printer.indent { - for line in loweredLines { - printer.write(line) - } - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - } return [] } - } + ) + } + + let innerFragment = try structFieldLowerFragment( + type: wrappedType, + fieldName: fieldName, + allStructs: allStructs + ) + return stackOptionalLower( + wrappedType: wrappedType, + kind: kind, + innerFragment: innerFragment ) case .swiftStruct(let nestedName): return IntrinsicJSFragment( @@ -3098,61 +2548,17 @@ struct IntrinsicJSFragment: Sendable { parameters: ["value"], printCode: { arguments, context in context.printer.write( - "throw new Error(\"Unsupported struct field type for lowering: \(field.type)\");" + "throw new Error(\"Unsupported struct field type for lowering: \(type)\");" ) return [] } ) default: - return try stackLowerFragment(elementType: field.type) + return try stackLowerFragment(elementType: type) } } /// Helper to push optional primitive values to stack-based parameters - private static func pushOptionalPrimitive( - value: String, - isSomeVar: String, - stack: StackType, - convert: String?, - zeroValue: String, - printer: CodeFragmentPrinter, - scope: JSGlueVariableScope - ) { - let stackName: String - switch stack { - case .i32Stack: stackName = JSGlueVariableScope.reservedI32Stack - case .f32Stack: stackName = JSGlueVariableScope.reservedF32Stack - case .f64Stack: stackName = JSGlueVariableScope.reservedF64Stack - } - - printer.write("if (\(isSomeVar)) {") - printer.indent { - let converted: String - if let convert = convert { - if convert.starts(with: "Math.") { - converted = "\(convert)(\(value))" - } else { - converted = "\(value) \(convert)" - } - } else { - converted = value - } - printer.write("\(stackName).push(\(converted));") - } - printer.write("} else {") - printer.indent { - printer.write("\(stackName).push(\(zeroValue));") - } - printer.write("}") - scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer) - } - - private enum StackType { - case i32Stack - case f32Stack - case f64Stack - } - private static func structFieldLiftFragment( field: ExportedProperty, allStructs: [ExportedStruct] @@ -3177,7 +2583,7 @@ struct IntrinsicJSFragment: Sendable { let caseIdVar = scope.variable("enumCaseId") printer.write("const \(caseIdVar) = \(scope.popI32());") printer.write( - "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar), );" + "\(optVar) = \(JSGlueVariableScope.reservedEnumHelpers).\(base).lift(\(caseIdVar));" ) } else { let wrappedFragment = try structFieldLiftFragment( @@ -3255,3 +2661,221 @@ struct IntrinsicJSFragment: Sendable { } } } + +// MARK: - Local type helpers + +fileprivate extension WasmCoreType { + var jsZeroLiteral: String { + switch self { + case .f32, .f64: return "0.0" + case .i32, .i64, .pointer: return "0" + } + } +} + +private enum OptionalConvention: Equatable { + case stackABI + case inlineFlag + case sideChannelReturn(OptionalSideChannel) +} + +private enum OptionalSideChannel: Equatable { + case none + case storage + case retainedObject +} + +private enum NilSentinel: Equatable { + case none + case i32(Int32) + case pointer + + var jsLiteral: String { + switch self { + case .none: fatalError("No sentinel value for .none") + case .i32(let value): return "\(value)" + case .pointer: return "0" + } + } + + var hasSentinel: Bool { + self != .none + } +} + +private enum OptionalScalarKind: String { + case bool, int, float, double + + var storageName: String { "tmpRetOptional\(rawValue.prefix(1).uppercased())\(rawValue.dropFirst())" } + var funcName: String { "swift_js_return_optional_\(rawValue)" } +} + +private extension BridgeType { + var optionalConvention: OptionalConvention { + switch self { + case .bool: + return .inlineFlag + case .int, .uint: + return .sideChannelReturn(.none) + case .float: + return .sideChannelReturn(.none) + case .double: + return .sideChannelReturn(.none) + case .string: + return .sideChannelReturn(.storage) + case .jsObject: + return .sideChannelReturn(.retainedObject) + case .jsValue: + return .inlineFlag + case .swiftHeapObject: + return .inlineFlag + case .unsafePointer: + return .inlineFlag + case .swiftProtocol: + return .sideChannelReturn(.retainedObject) + case .caseEnum: + return .inlineFlag + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + return .sideChannelReturn(.storage) + case .float, .double: + return .sideChannelReturn(.none) + case .bool: + return .inlineFlag + case .int, .int32, .int64, .uint, .uint32, .uint64: + return .sideChannelReturn(.none) + } + case .associatedValueEnum: + return .inlineFlag + case .closure: + return .inlineFlag + case .swiftStruct, .array, .dictionary, .void, .namespaceEnum: + return .stackABI + case .nullable(let wrapped, _): + return wrapped.optionalConvention + } + } + + var nilSentinel: NilSentinel { + switch self { + case .jsObject, .swiftProtocol: + return .i32(0) + case .swiftHeapObject: + return .pointer + case .caseEnum, .associatedValueEnum: + return .i32(-1) + case .nullable(let wrapped, _): + return wrapped.nilSentinel + default: + return .none + } + } + + var optionalScalarKind: OptionalScalarKind? { + switch self { + case .bool, .rawValueEnum(_, .bool): return .bool + case .int, .uint, .caseEnum, + .rawValueEnum(_, .int), .rawValueEnum(_, .int32), .rawValueEnum(_, .int64), + .rawValueEnum(_, .uint), .rawValueEnum(_, .uint32), .rawValueEnum(_, .uint64): + return .int + case .float, .rawValueEnum(_, .float): return .float + case .double, .rawValueEnum(_, .double): return .double + case .nullable(let wrapped, _): return wrapped.optionalScalarKind + default: return nil + } + } + + var wasmParams: [(name: String, type: WasmCoreType)] { + switch self { + case .bool, .int, .uint: + return [("value", .i32)] + case .float: + return [("value", .f32)] + case .double: + return [("value", .f64)] + case .string: + return [("bytes", .i32), ("length", .i32)] + case .jsObject: + return [("value", .i32)] + case .jsValue: + return [("kind", .i32), ("payload1", .i32), ("payload2", .f64)] + case .swiftHeapObject: + return [("pointer", .pointer)] + case .unsafePointer: + return [("pointer", .pointer)] + case .swiftProtocol: + return [("value", .i32)] + case .caseEnum: + return [("value", .i32)] + case .rawValueEnum(_, let rawType): + switch rawType { + case .string: + return [("bytes", .i32), ("length", .i32)] + case .float: + return [("value", .f32)] + case .double: + return [("value", .f64)] + case .bool, .int, .int32, .int64, .uint, .uint32, .uint64: + return [("value", .i32)] + } + case .associatedValueEnum: + return [("caseId", .i32)] + case .closure: + return [("funcRef", .i32)] + case .void, .namespaceEnum, .swiftStruct, .array, .dictionary: + return [] + case .nullable(let wrapped, _): + return wrapped.wasmParams + } + } + + var isSingleParamScalar: Bool { + switch self { + case .bool, .int, .uint, .float, .double, .unsafePointer, .caseEnum: return true + case .rawValueEnum(_, let rawType): return rawType != .string + default: return false + } + } + + var stackLowerCoerce: String? { + switch self { + case .bool, .rawValueEnum(_, .bool): return "$0 ? 1 : 0" + case .int, .uint, .unsafePointer, .caseEnum, + .rawValueEnum(_, .int), .rawValueEnum(_, .int32), .rawValueEnum(_, .int64), + .rawValueEnum(_, .uint), .rawValueEnum(_, .uint32), .rawValueEnum(_, .uint64): + return "($0 | 0)" + case .float, .rawValueEnum(_, .float): return "Math.fround($0)" + case .double, .rawValueEnum(_, .double): return nil + default: return nil + } + } + + var liftCoerce: String? { + switch self { + case .bool, .rawValueEnum(_, .bool): return "$0 !== 0" + case .uint: return "$0 >>> 0" + default: return nil + } + } + + var lowerCoerce: String? { + switch self { + case .bool, .rawValueEnum(_, .bool): return "$0 ? 1 : 0" + default: return nil + } + } + + var varHint: String { + switch self { + case .bool: return "bool" + case .int, .uint: return "int" + case .float: return "f32" + case .double: return "f64" + case .unsafePointer: return "pointer" + case .caseEnum: return "caseId" + case .rawValueEnum: return "rawValue" + default: return "value" + } + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index ba25b6ff9..dab5fae33 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -1208,7 +1208,6 @@ extension BridgeType { } extension WasmCoreType { - /// Returns a Swift statement that returns a placeholder value for this Wasm core type. public var swiftReturnPlaceholderStmt: String { switch self { case .i32: return "return 0" diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index e7bdf975b..b206b9a9f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -41,19 +41,17 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const __bjs_createPointHelpers = () => { - return () => ({ - lower: (value) => { - f64Stack.push(value.x); - f64Stack.push(value.y); - }, - lift: () => { - const f64 = f64Stack.pop(); - const f641 = f64Stack.pop(); - return { x: f641, y: f64 }; - } - }); - }; + const __bjs_createPointHelpers = () => ({ + lower: (value) => { + f64Stack.push(value.x); + f64Stack.push(value.y); + }, + lift: () => { + const f64 = f64Stack.pop(); + const f641 = f64Stack.pop(); + return { x: f641, y: f64 }; + } + }); return { /** @@ -370,7 +368,7 @@ export async function createInstantiator(options, swift) { } } - const PointHelpers = __bjs_createPointHelpers()(); + const PointHelpers = __bjs_createPointHelpers(); structHelpers.Point = PointHelpers; const exports = { @@ -638,7 +636,6 @@ export async function createInstantiator(options, swift) { const isSome = elem != null ? 1 : 0; if (isSome) { structHelpers.Point.lower(elem); - } else { } i32Stack.push(isSome); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 0538b8078..a865882ef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -34,46 +34,42 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const __bjs_createConfigHelpers = () => { - return () => ({ - lower: (value) => { - const bytes = textEncoder.encode(value.name); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - i32Stack.push((value.value | 0)); - i32Stack.push(value.enabled ? 1 : 0); - }, - lift: () => { - const bool = i32Stack.pop() !== 0; - const int = i32Stack.pop(); - const string = strStack.pop(); - return { name: string, value: int, enabled: bool }; - } - }); - }; - const __bjs_createMathOperationsHelpers = () => { - return () => ({ - lower: (value) => { - f64Stack.push(value.baseValue); - }, - lift: () => { - const f64 = f64Stack.pop(); - const instance1 = { baseValue: f64 }; - instance1.add = function(a, b = 10.0) { - structHelpers.MathOperations.lower(this); - const ret = instance.exports.bjs_MathOperations_add(a, b); - return ret; - }.bind(instance1); - instance1.multiply = function(a, b) { - structHelpers.MathOperations.lower(this); - const ret = instance.exports.bjs_MathOperations_multiply(a, b); - return ret; - }.bind(instance1); - return instance1; - } - }); - }; + const __bjs_createConfigHelpers = () => ({ + lower: (value) => { + const bytes = textEncoder.encode(value.name); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + i32Stack.push((value.value | 0)); + i32Stack.push(value.enabled ? 1 : 0); + }, + lift: () => { + const bool = i32Stack.pop() !== 0; + const int = i32Stack.pop(); + const string = strStack.pop(); + return { name: string, value: int, enabled: bool }; + } + }); + const __bjs_createMathOperationsHelpers = () => ({ + lower: (value) => { + f64Stack.push(value.baseValue); + }, + lift: () => { + const f64 = f64Stack.pop(); + const instance1 = { baseValue: f64 }; + instance1.add = function(a, b = 10.0) { + structHelpers.MathOperations.lower(this); + const ret = instance.exports.bjs_MathOperations_add(a, b); + return ret; + }.bind(instance1); + instance1.multiply = function(a, b) { + structHelpers.MathOperations.lower(this); + const ret = instance.exports.bjs_MathOperations_multiply(a, b); + return ret; + }.bind(instance1); + return instance1; + } + }); return { /** @@ -343,12 +339,17 @@ export async function createInstantiator(options, swift) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); const isSome = tag != null; - let tagId, tagBytes; + let result, result1; if (isSome) { - tagBytes = textEncoder.encode(tag); - tagId = swift.memory.retain(tagBytes); + const tagBytes = textEncoder.encode(tag); + const tagId = swift.memory.retain(tagBytes); + result = tagId; + result1 = tagBytes.length; + } else { + result = 0; + result1 = 0; } - const ret = instance.exports.bjs_ConstructorDefaults_init(nameId, nameBytes.length, count, enabled, status, +isSome, isSome ? tagId : 0, isSome ? tagBytes.length : 0); + const ret = instance.exports.bjs_ConstructorDefaults_init(nameId, nameBytes.length, count, enabled, status, +isSome, result, result1); return ConstructorDefaults.__construct(ret); } get name() { @@ -391,18 +392,23 @@ export async function createInstantiator(options, swift) { } set tag(value) { const isSome = value != null; - let valueId, valueBytes; + let result, result1; if (isSome) { - valueBytes = textEncoder.encode(value); - valueId = swift.memory.retain(valueBytes); + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + result = valueId; + result1 = valueBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_ConstructorDefaults_tag_set(this.pointer, +isSome, isSome ? valueId : 0, isSome ? valueBytes.length : 0); + instance.exports.bjs_ConstructorDefaults_tag_set(this.pointer, +isSome, result, result1); } } - const ConfigHelpers = __bjs_createConfigHelpers()(); + const ConfigHelpers = __bjs_createConfigHelpers(); structHelpers.Config = ConfigHelpers; - const MathOperationsHelpers = __bjs_createMathOperationsHelpers()(); + const MathOperationsHelpers = __bjs_createMathOperationsHelpers(); structHelpers.MathOperations = MathOperationsHelpers; const exports = { @@ -435,24 +441,34 @@ export async function createInstantiator(options, swift) { }, testOptionalDefault: function bjs_testOptionalDefault(name = null) { const isSome = name != null; - let nameId, nameBytes; + let result, result1; if (isSome) { - nameBytes = textEncoder.encode(name); - nameId = swift.memory.retain(nameBytes); + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + result = nameId; + result1 = nameBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_testOptionalDefault(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); + instance.exports.bjs_testOptionalDefault(+isSome, result, result1); const optResult = tmpRetString; tmpRetString = undefined; return optResult; }, testOptionalStringDefault: function bjs_testOptionalStringDefault(greeting = "Hi") { const isSome = greeting != null; - let greetingId, greetingBytes; + let result, result1; if (isSome) { - greetingBytes = textEncoder.encode(greeting); - greetingId = swift.memory.retain(greetingBytes); + const greetingBytes = textEncoder.encode(greeting); + const greetingId = swift.memory.retain(greetingBytes); + result = greetingId; + result1 = greetingBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_testOptionalStringDefault(+isSome, isSome ? greetingId : 0, isSome ? greetingBytes.length : 0); + instance.exports.bjs_testOptionalStringDefault(+isSome, result, result1); const optResult = tmpRetString; tmpRetString = undefined; return optResult; @@ -485,12 +501,7 @@ export async function createInstantiator(options, swift) { i32Stack.push(+isSome); instance.exports.bjs_testOptionalStructDefault(); const isSome1 = i32Stack.pop(); - let optResult; - if (isSome1) { - optResult = structHelpers.Config.lift(); - } else { - optResult = null; - } + const optResult = isSome1 ? structHelpers.Config.lift() : null; return optResult; }, testOptionalStructWithValueDefault: function bjs_testOptionalStructWithValueDefault(point = { name: "default", value: 42, enabled: true }) { @@ -501,12 +512,7 @@ export async function createInstantiator(options, swift) { i32Stack.push(+isSome); instance.exports.bjs_testOptionalStructWithValueDefault(); const isSome1 = i32Stack.pop(); - let optResult; - if (isSome1) { - optResult = structHelpers.Config.lift(); - } else { - optResult = null; - } + const optResult = isSome1 ? structHelpers.Config.lift() : null; return optResult; }, testIntArrayDefault: function bjs_testIntArrayDefault(values = [1, 2, 3]) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 43cc9f964..55967a6a3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -109,528 +109,640 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const __bjs_createPointHelpers = () => { - return () => ({ - lower: (value) => { - f64Stack.push(value.x); - f64Stack.push(value.y); - }, - lift: () => { - const f64 = f64Stack.pop(); - const f641 = f64Stack.pop(); - return { x: f641, y: f64 }; + const __bjs_createPointHelpers = () => ({ + lower: (value) => { + f64Stack.push(value.x); + f64Stack.push(value.y); + }, + lift: () => { + const f64 = f64Stack.pop(); + const f641 = f64Stack.pop(); + return { x: f641, y: f64 }; + } + }); + const __bjs_createAPIResultValuesHelpers = () => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case APIResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + return APIResultValues.Tag.Success; + } + case APIResultValues.Tag.Failure: { + i32Stack.push((value.param0 | 0)); + return APIResultValues.Tag.Failure; + } + case APIResultValues.Tag.Flag: { + i32Stack.push(value.param0 ? 1 : 0); + return APIResultValues.Tag.Flag; + } + case APIResultValues.Tag.Rate: { + f32Stack.push(Math.fround(value.param0)); + return APIResultValues.Tag.Rate; + } + case APIResultValues.Tag.Precise: { + f64Stack.push(value.param0); + return APIResultValues.Tag.Precise; + } + case APIResultValues.Tag.Info: { + return APIResultValues.Tag.Info; + } + default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } - }); - }; - const __bjs_createAPIResultValuesHelpers = () => { - return () => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case APIResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - return APIResultValues.Tag.Success; - } - case APIResultValues.Tag.Failure: { - i32Stack.push((value.param0 | 0)); - return APIResultValues.Tag.Failure; - } - case APIResultValues.Tag.Flag: { - i32Stack.push(value.param0 ? 1 : 0); - return APIResultValues.Tag.Flag; - } - case APIResultValues.Tag.Rate: { - f32Stack.push(Math.fround(value.param0)); - return APIResultValues.Tag.Rate; - } - case APIResultValues.Tag.Precise: { - f64Stack.push(value.param0); - return APIResultValues.Tag.Precise; - } - case APIResultValues.Tag.Info: { - return APIResultValues.Tag.Info; - } - default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); + }, + lift: (tag) => { + tag = tag | 0; + switch (tag) { + case APIResultValues.Tag.Success: { + const string = strStack.pop(); + return { tag: APIResultValues.Tag.Success, param0: string }; } - }, - lift: (tag) => { - tag = tag | 0; - switch (tag) { - case APIResultValues.Tag.Success: { - const string = strStack.pop(); - return { tag: APIResultValues.Tag.Success, param0: string }; - } - case APIResultValues.Tag.Failure: { - const int = i32Stack.pop(); - return { tag: APIResultValues.Tag.Failure, param0: int }; - } - case APIResultValues.Tag.Flag: { - const bool = i32Stack.pop() !== 0; - return { tag: APIResultValues.Tag.Flag, param0: bool }; - } - case APIResultValues.Tag.Rate: { - const f32 = f32Stack.pop(); - return { tag: APIResultValues.Tag.Rate, param0: f32 }; - } - case APIResultValues.Tag.Precise: { - const f64 = f64Stack.pop(); - return { tag: APIResultValues.Tag.Precise, param0: f64 }; - } - case APIResultValues.Tag.Info: return { tag: APIResultValues.Tag.Info }; - default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); + case APIResultValues.Tag.Failure: { + const int = i32Stack.pop(); + return { tag: APIResultValues.Tag.Failure, param0: int }; + } + case APIResultValues.Tag.Flag: { + const bool = i32Stack.pop() !== 0; + return { tag: APIResultValues.Tag.Flag, param0: bool }; + } + case APIResultValues.Tag.Rate: { + const f32 = f32Stack.pop(); + return { tag: APIResultValues.Tag.Rate, param0: f32 }; + } + case APIResultValues.Tag.Precise: { + const f64 = f64Stack.pop(); + return { tag: APIResultValues.Tag.Precise, param0: f64 }; } + case APIResultValues.Tag.Info: return { tag: APIResultValues.Tag.Info }; + default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); } - }); - }; - const __bjs_createComplexResultValuesHelpers = () => { - return () => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case ComplexResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - return ComplexResultValues.Tag.Success; - } - case ComplexResultValues.Tag.Error: { - i32Stack.push((value.param1 | 0)); + } + }); + const __bjs_createComplexResultValuesHelpers = () => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case ComplexResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + return ComplexResultValues.Tag.Success; + } + case ComplexResultValues.Tag.Error: { + i32Stack.push((value.param1 | 0)); + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + return ComplexResultValues.Tag.Error; + } + case ComplexResultValues.Tag.Status: { + const bytes = textEncoder.encode(value.param2); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + i32Stack.push((value.param1 | 0)); + i32Stack.push(value.param0 ? 1 : 0); + return ComplexResultValues.Tag.Status; + } + case ComplexResultValues.Tag.Coordinates: { + f64Stack.push(value.param2); + f64Stack.push(value.param1); + f64Stack.push(value.param0); + return ComplexResultValues.Tag.Coordinates; + } + case ComplexResultValues.Tag.Comprehensive: { + const bytes = textEncoder.encode(value.param8); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + const bytes1 = textEncoder.encode(value.param7); + const id1 = swift.memory.retain(bytes1); + i32Stack.push(bytes1.length); + i32Stack.push(id1); + const bytes2 = textEncoder.encode(value.param6); + const id2 = swift.memory.retain(bytes2); + i32Stack.push(bytes2.length); + i32Stack.push(id2); + f64Stack.push(value.param5); + f64Stack.push(value.param4); + i32Stack.push((value.param3 | 0)); + i32Stack.push((value.param2 | 0)); + i32Stack.push(value.param1 ? 1 : 0); + i32Stack.push(value.param0 ? 1 : 0); + return ComplexResultValues.Tag.Comprehensive; + } + case ComplexResultValues.Tag.Info: { + return ComplexResultValues.Tag.Info; + } + default: throw new Error("Unknown ComplexResultValues tag: " + String(enumTag)); + } + }, + lift: (tag) => { + tag = tag | 0; + switch (tag) { + case ComplexResultValues.Tag.Success: { + const string = strStack.pop(); + return { tag: ComplexResultValues.Tag.Success, param0: string }; + } + case ComplexResultValues.Tag.Error: { + const int = i32Stack.pop(); + const string = strStack.pop(); + return { tag: ComplexResultValues.Tag.Error, param0: string, param1: int }; + } + case ComplexResultValues.Tag.Status: { + const string = strStack.pop(); + const int = i32Stack.pop(); + const bool = i32Stack.pop() !== 0; + return { tag: ComplexResultValues.Tag.Status, param0: bool, param1: int, param2: string }; + } + case ComplexResultValues.Tag.Coordinates: { + const f64 = f64Stack.pop(); + const f641 = f64Stack.pop(); + const f642 = f64Stack.pop(); + return { tag: ComplexResultValues.Tag.Coordinates, param0: f642, param1: f641, param2: f64 }; + } + case ComplexResultValues.Tag.Comprehensive: { + const string = strStack.pop(); + const string1 = strStack.pop(); + const string2 = strStack.pop(); + const f64 = f64Stack.pop(); + const f641 = f64Stack.pop(); + const int = i32Stack.pop(); + const int1 = i32Stack.pop(); + const bool = i32Stack.pop() !== 0; + const bool1 = i32Stack.pop() !== 0; + return { tag: ComplexResultValues.Tag.Comprehensive, param0: bool1, param1: bool, param2: int1, param3: int, param4: f641, param5: f64, param6: string2, param7: string1, param8: string }; + } + case ComplexResultValues.Tag.Info: return { tag: ComplexResultValues.Tag.Info }; + default: throw new Error("Unknown ComplexResultValues tag returned from Swift: " + String(tag)); + } + } + }); + const __bjs_createResultValuesHelpers = () => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case ResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + return ResultValues.Tag.Success; + } + case ResultValues.Tag.Failure: { + i32Stack.push((value.param1 | 0)); + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + return ResultValues.Tag.Failure; + } + case ResultValues.Tag.Status: { + const bytes = textEncoder.encode(value.param2); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + i32Stack.push((value.param1 | 0)); + i32Stack.push(value.param0 ? 1 : 0); + return ResultValues.Tag.Status; + } + default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); + } + }, + lift: (tag) => { + tag = tag | 0; + switch (tag) { + case ResultValues.Tag.Success: { + const string = strStack.pop(); + return { tag: ResultValues.Tag.Success, param0: string }; + } + case ResultValues.Tag.Failure: { + const int = i32Stack.pop(); + const string = strStack.pop(); + return { tag: ResultValues.Tag.Failure, param0: string, param1: int }; + } + case ResultValues.Tag.Status: { + const string = strStack.pop(); + const int = i32Stack.pop(); + const bool = i32Stack.pop() !== 0; + return { tag: ResultValues.Tag.Status, param0: bool, param1: int, param2: string }; + } + default: throw new Error("Unknown ResultValues tag returned from Swift: " + String(tag)); + } + } + }); + const __bjs_createNetworkingResultValuesHelpers = () => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case NetworkingResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + return NetworkingResultValues.Tag.Success; + } + case NetworkingResultValues.Tag.Failure: { + i32Stack.push((value.param1 | 0)); + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + return NetworkingResultValues.Tag.Failure; + } + default: throw new Error("Unknown NetworkingResultValues tag: " + String(enumTag)); + } + }, + lift: (tag) => { + tag = tag | 0; + switch (tag) { + case NetworkingResultValues.Tag.Success: { + const string = strStack.pop(); + return { tag: NetworkingResultValues.Tag.Success, param0: string }; + } + case NetworkingResultValues.Tag.Failure: { + const int = i32Stack.pop(); + const string = strStack.pop(); + return { tag: NetworkingResultValues.Tag.Failure, param0: string, param1: int }; + } + default: throw new Error("Unknown NetworkingResultValues tag returned from Swift: " + String(tag)); + } + } + }); + const __bjs_createAPIOptionalResultValuesHelpers = () => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case APIOptionalResultValues.Tag.Success: { + const isSome = value.param0 != null; + if (isSome) { const bytes = textEncoder.encode(value.param0); const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - return ComplexResultValues.Tag.Error; + } else { + i32Stack.push(0); + i32Stack.push(0); } - case ComplexResultValues.Tag.Status: { + i32Stack.push(isSome ? 1 : 0); + return APIOptionalResultValues.Tag.Success; + } + case APIOptionalResultValues.Tag.Failure: { + const isSome = value.param1 != null; + i32Stack.push(isSome ? (value.param1 ? 1 : 0) : 0); + i32Stack.push(isSome ? 1 : 0); + const isSome1 = value.param0 != null; + i32Stack.push(isSome1 ? (value.param0 | 0) : 0); + i32Stack.push(isSome1 ? 1 : 0); + return APIOptionalResultValues.Tag.Failure; + } + case APIOptionalResultValues.Tag.Status: { + const isSome = value.param2 != null; + if (isSome) { const bytes = textEncoder.encode(value.param2); const id = swift.memory.retain(bytes); i32Stack.push(bytes.length); i32Stack.push(id); - i32Stack.push((value.param1 | 0)); - i32Stack.push(value.param0 ? 1 : 0); - return ComplexResultValues.Tag.Status; - } - case ComplexResultValues.Tag.Coordinates: { - f64Stack.push(value.param2); - f64Stack.push(value.param1); - f64Stack.push(value.param0); - return ComplexResultValues.Tag.Coordinates; - } - case ComplexResultValues.Tag.Comprehensive: { - const bytes = textEncoder.encode(value.param8); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - const bytes1 = textEncoder.encode(value.param7); - const id1 = swift.memory.retain(bytes1); - i32Stack.push(bytes1.length); - i32Stack.push(id1); - const bytes2 = textEncoder.encode(value.param6); - const id2 = swift.memory.retain(bytes2); - i32Stack.push(bytes2.length); - i32Stack.push(id2); - f64Stack.push(value.param5); - f64Stack.push(value.param4); - i32Stack.push((value.param3 | 0)); - i32Stack.push((value.param2 | 0)); - i32Stack.push(value.param1 ? 1 : 0); - i32Stack.push(value.param0 ? 1 : 0); - return ComplexResultValues.Tag.Comprehensive; - } - case ComplexResultValues.Tag.Info: { - return ComplexResultValues.Tag.Info; - } - default: throw new Error("Unknown ComplexResultValues tag: " + String(enumTag)); + } else { + i32Stack.push(0); + i32Stack.push(0); + } + i32Stack.push(isSome ? 1 : 0); + const isSome1 = value.param1 != null; + i32Stack.push(isSome1 ? (value.param1 | 0) : 0); + i32Stack.push(isSome1 ? 1 : 0); + const isSome2 = value.param0 != null; + i32Stack.push(isSome2 ? (value.param0 ? 1 : 0) : 0); + i32Stack.push(isSome2 ? 1 : 0); + return APIOptionalResultValues.Tag.Status; } - }, - lift: (tag) => { - tag = tag | 0; - switch (tag) { - case ComplexResultValues.Tag.Success: { - const string = strStack.pop(); - return { tag: ComplexResultValues.Tag.Success, param0: string }; - } - case ComplexResultValues.Tag.Error: { - const int = i32Stack.pop(); + default: throw new Error("Unknown APIOptionalResultValues tag: " + String(enumTag)); + } + }, + lift: (tag) => { + tag = tag | 0; + switch (tag) { + case APIOptionalResultValues.Tag.Success: { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { const string = strStack.pop(); - return { tag: ComplexResultValues.Tag.Error, param0: string, param1: int }; + optional = string; + } else { + optional = null; } - case ComplexResultValues.Tag.Status: { - const string = strStack.pop(); - const int = i32Stack.pop(); + return { tag: APIOptionalResultValues.Tag.Success, param0: optional }; + } + case APIOptionalResultValues.Tag.Failure: { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { const bool = i32Stack.pop() !== 0; - return { tag: ComplexResultValues.Tag.Status, param0: bool, param1: int, param2: string }; - } - case ComplexResultValues.Tag.Coordinates: { - const f64 = f64Stack.pop(); - const f641 = f64Stack.pop(); - const f642 = f64Stack.pop(); - return { tag: ComplexResultValues.Tag.Coordinates, param0: f642, param1: f641, param2: f64 }; + optional = bool; + } else { + optional = null; } - case ComplexResultValues.Tag.Comprehensive: { - const string = strStack.pop(); - const string1 = strStack.pop(); - const string2 = strStack.pop(); - const f64 = f64Stack.pop(); - const f641 = f64Stack.pop(); + const isSome1 = i32Stack.pop(); + let optional1; + if (isSome1) { const int = i32Stack.pop(); - const int1 = i32Stack.pop(); - const bool = i32Stack.pop() !== 0; - const bool1 = i32Stack.pop() !== 0; - return { tag: ComplexResultValues.Tag.Comprehensive, param0: bool1, param1: bool, param2: int1, param3: int, param4: f641, param5: f64, param6: string2, param7: string1, param8: string }; - } - case ComplexResultValues.Tag.Info: return { tag: ComplexResultValues.Tag.Info }; - default: throw new Error("Unknown ComplexResultValues tag returned from Swift: " + String(tag)); - } - } - }); - }; - const __bjs_createResultValuesHelpers = () => { - return () => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case ResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - return ResultValues.Tag.Success; - } - case ResultValues.Tag.Failure: { - i32Stack.push((value.param1 | 0)); - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - return ResultValues.Tag.Failure; - } - case ResultValues.Tag.Status: { - const bytes = textEncoder.encode(value.param2); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - i32Stack.push((value.param1 | 0)); - i32Stack.push(value.param0 ? 1 : 0); - return ResultValues.Tag.Status; + optional1 = int; + } else { + optional1 = null; } - default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); + return { tag: APIOptionalResultValues.Tag.Failure, param0: optional1, param1: optional }; } - }, - lift: (tag) => { - tag = tag | 0; - switch (tag) { - case ResultValues.Tag.Success: { + case APIOptionalResultValues.Tag.Status: { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { const string = strStack.pop(); - return { tag: ResultValues.Tag.Success, param0: string }; + optional = string; + } else { + optional = null; } - case ResultValues.Tag.Failure: { + const isSome1 = i32Stack.pop(); + let optional1; + if (isSome1) { const int = i32Stack.pop(); - const string = strStack.pop(); - return { tag: ResultValues.Tag.Failure, param0: string, param1: int }; + optional1 = int; + } else { + optional1 = null; } - case ResultValues.Tag.Status: { - const string = strStack.pop(); - const int = i32Stack.pop(); + const isSome2 = i32Stack.pop(); + let optional2; + if (isSome2) { const bool = i32Stack.pop() !== 0; - return { tag: ResultValues.Tag.Status, param0: bool, param1: int, param2: string }; + optional2 = bool; + } else { + optional2 = null; } - default: throw new Error("Unknown ResultValues tag returned from Swift: " + String(tag)); + return { tag: APIOptionalResultValues.Tag.Status, param0: optional2, param1: optional1, param2: optional }; } + default: throw new Error("Unknown APIOptionalResultValues tag returned from Swift: " + String(tag)); } - }); - }; - const __bjs_createNetworkingResultValuesHelpers = () => { - return () => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case NetworkingResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - return NetworkingResultValues.Tag.Success; - } - case NetworkingResultValues.Tag.Failure: { - i32Stack.push((value.param1 | 0)); - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - return NetworkingResultValues.Tag.Failure; - } - default: throw new Error("Unknown NetworkingResultValues tag: " + String(enumTag)); + } + }); + const __bjs_createTypedPayloadResultValuesHelpers = () => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case TypedPayloadResultValues.Tag.Precision: { + f32Stack.push(Math.fround(value.param0)); + return TypedPayloadResultValues.Tag.Precision; } - }, - lift: (tag) => { - tag = tag | 0; - switch (tag) { - case NetworkingResultValues.Tag.Success: { - const string = strStack.pop(); - return { tag: NetworkingResultValues.Tag.Success, param0: string }; - } - case NetworkingResultValues.Tag.Failure: { - const int = i32Stack.pop(); - const string = strStack.pop(); - return { tag: NetworkingResultValues.Tag.Failure, param0: string, param1: int }; - } - default: throw new Error("Unknown NetworkingResultValues tag returned from Swift: " + String(tag)); + case TypedPayloadResultValues.Tag.Direction: { + i32Stack.push((value.param0 | 0)); + return TypedPayloadResultValues.Tag.Direction; } - } - }); - }; - const __bjs_createAPIOptionalResultValuesHelpers = () => { - return () => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case APIOptionalResultValues.Tag.Success: { - const isSome = value.param0 != null; - let id; - if (isSome) { - let bytes = textEncoder.encode(value.param0); - id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - } else { - i32Stack.push(0); - i32Stack.push(0); - } - i32Stack.push(isSome ? 1 : 0); - return APIOptionalResultValues.Tag.Success; - } - case APIOptionalResultValues.Tag.Failure: { - const isSome = value.param1 != null; - i32Stack.push(isSome ? (value.param1 ? 1 : 0) : 0); - i32Stack.push(isSome ? 1 : 0); - const isSome1 = value.param0 != null; - i32Stack.push(isSome1 ? (value.param0 | 0) : 0); - i32Stack.push(isSome1 ? 1 : 0); - return APIOptionalResultValues.Tag.Failure; - } - case APIOptionalResultValues.Tag.Status: { - const isSome = value.param2 != null; - let id; - if (isSome) { - let bytes = textEncoder.encode(value.param2); - id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - } else { - i32Stack.push(0); - i32Stack.push(0); - } - i32Stack.push(isSome ? 1 : 0); - const isSome1 = value.param1 != null; - i32Stack.push(isSome1 ? (value.param1 | 0) : 0); - i32Stack.push(isSome1 ? 1 : 0); - const isSome2 = value.param0 != null; - i32Stack.push(isSome2 ? (value.param0 ? 1 : 0) : 0); - i32Stack.push(isSome2 ? 1 : 0); - return APIOptionalResultValues.Tag.Status; - } - default: throw new Error("Unknown APIOptionalResultValues tag: " + String(enumTag)); - } - }, - lift: (tag) => { - tag = tag | 0; - switch (tag) { - case APIOptionalResultValues.Tag.Success: { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const string = strStack.pop(); - optional = string; - } else { - optional = null; - } - return { tag: APIOptionalResultValues.Tag.Success, param0: optional }; - } - case APIOptionalResultValues.Tag.Failure: { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const bool = i32Stack.pop() !== 0; - optional = bool; - } else { - optional = null; - } - const isSome1 = i32Stack.pop(); - let optional1; - if (isSome1) { - const int = i32Stack.pop(); - optional1 = int; - } else { - optional1 = null; - } - return { tag: APIOptionalResultValues.Tag.Failure, param0: optional1, param1: optional }; - } - case APIOptionalResultValues.Tag.Status: { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const string = strStack.pop(); - optional = string; - } else { - optional = null; - } - const isSome1 = i32Stack.pop(); - let optional1; - if (isSome1) { - const int = i32Stack.pop(); - optional1 = int; - } else { - optional1 = null; - } - const isSome2 = i32Stack.pop(); - let optional2; - if (isSome2) { - const bool = i32Stack.pop() !== 0; - optional2 = bool; - } else { - optional2 = null; - } - return { tag: APIOptionalResultValues.Tag.Status, param0: optional2, param1: optional1, param2: optional }; - } - default: throw new Error("Unknown APIOptionalResultValues tag returned from Swift: " + String(tag)); + case TypedPayloadResultValues.Tag.OptPrecision: { + const isSome = value.param0 != null; + f32Stack.push(isSome ? Math.fround(value.param0) : 0.0); + i32Stack.push(isSome ? 1 : 0); + return TypedPayloadResultValues.Tag.OptPrecision; + } + case TypedPayloadResultValues.Tag.OptDirection: { + const isSome = value.param0 != null; + i32Stack.push(isSome ? (value.param0 | 0) : 0); + i32Stack.push(isSome ? 1 : 0); + return TypedPayloadResultValues.Tag.OptDirection; + } + case TypedPayloadResultValues.Tag.Empty: { + return TypedPayloadResultValues.Tag.Empty; } + default: throw new Error("Unknown TypedPayloadResultValues tag: " + String(enumTag)); } - }); - }; - const __bjs_createTypedPayloadResultValuesHelpers = () => { - return () => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case TypedPayloadResultValues.Tag.Precision: { - f32Stack.push(Math.fround(value.param0)); - return TypedPayloadResultValues.Tag.Precision; - } - case TypedPayloadResultValues.Tag.Direction: { - i32Stack.push((value.param0 | 0)); - return TypedPayloadResultValues.Tag.Direction; - } - case TypedPayloadResultValues.Tag.OptPrecision: { - const isSome = value.param0 != null; - f32Stack.push(isSome ? Math.fround(value.param0) : 0.0); - i32Stack.push(isSome ? 1 : 0); - return TypedPayloadResultValues.Tag.OptPrecision; - } - case TypedPayloadResultValues.Tag.OptDirection: { - const isSome = value.param0 != null; - i32Stack.push(isSome ? (value.param0 | 0) : 0); - i32Stack.push(isSome ? 1 : 0); - return TypedPayloadResultValues.Tag.OptDirection; - } - case TypedPayloadResultValues.Tag.Empty: { - return TypedPayloadResultValues.Tag.Empty; - } - default: throw new Error("Unknown TypedPayloadResultValues tag: " + String(enumTag)); + }, + lift: (tag) => { + tag = tag | 0; + switch (tag) { + case TypedPayloadResultValues.Tag.Precision: { + const rawValue = f32Stack.pop(); + return { tag: TypedPayloadResultValues.Tag.Precision, param0: rawValue }; } - }, - lift: (tag) => { - tag = tag | 0; - switch (tag) { - case TypedPayloadResultValues.Tag.Precision: { + case TypedPayloadResultValues.Tag.Direction: { + const caseId = i32Stack.pop(); + return { tag: TypedPayloadResultValues.Tag.Direction, param0: caseId }; + } + case TypedPayloadResultValues.Tag.OptPrecision: { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { const rawValue = f32Stack.pop(); - return { tag: TypedPayloadResultValues.Tag.Precision, param0: rawValue }; + optional = rawValue; + } else { + optional = null; } - case TypedPayloadResultValues.Tag.Direction: { + return { tag: TypedPayloadResultValues.Tag.OptPrecision, param0: optional }; + } + case TypedPayloadResultValues.Tag.OptDirection: { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { const caseId = i32Stack.pop(); - return { tag: TypedPayloadResultValues.Tag.Direction, param0: caseId }; + optional = caseId; + } else { + optional = null; } - case TypedPayloadResultValues.Tag.OptPrecision: { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const rawValue = f32Stack.pop(); - optional = rawValue; - } else { - optional = null; - } - return { tag: TypedPayloadResultValues.Tag.OptPrecision, param0: optional }; + return { tag: TypedPayloadResultValues.Tag.OptDirection, param0: optional }; + } + case TypedPayloadResultValues.Tag.Empty: return { tag: TypedPayloadResultValues.Tag.Empty }; + default: throw new Error("Unknown TypedPayloadResultValues tag returned from Swift: " + String(tag)); + } + } + }); + const __bjs_createAllTypesResultValuesHelpers = () => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case AllTypesResultValues.Tag.StructPayload: { + structHelpers.Point.lower(value.param0); + return AllTypesResultValues.Tag.StructPayload; + } + case AllTypesResultValues.Tag.ClassPayload: { + ptrStack.push(value.param0.pointer); + return AllTypesResultValues.Tag.ClassPayload; + } + case AllTypesResultValues.Tag.JsObjectPayload: { + const objId = swift.memory.retain(value.param0); + i32Stack.push(objId); + return AllTypesResultValues.Tag.JsObjectPayload; + } + case AllTypesResultValues.Tag.NestedEnum: { + const caseId = enumHelpers.APIResult.lower(value.param0); + i32Stack.push(caseId); + return AllTypesResultValues.Tag.NestedEnum; + } + case AllTypesResultValues.Tag.ArrayPayload: { + for (const elem of value.param0) { + i32Stack.push((elem | 0)); } - case TypedPayloadResultValues.Tag.OptDirection: { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const caseId = i32Stack.pop(); - optional = caseId; - } else { - optional = null; - } - return { tag: TypedPayloadResultValues.Tag.OptDirection, param0: optional }; + i32Stack.push(value.param0.length); + return AllTypesResultValues.Tag.ArrayPayload; + } + case AllTypesResultValues.Tag.Empty: { + return AllTypesResultValues.Tag.Empty; + } + default: throw new Error("Unknown AllTypesResultValues tag: " + String(enumTag)); + } + }, + lift: (tag) => { + tag = tag | 0; + switch (tag) { + case AllTypesResultValues.Tag.StructPayload: { + const struct = structHelpers.Point.lift(); + return { tag: AllTypesResultValues.Tag.StructPayload, param0: struct }; + } + case AllTypesResultValues.Tag.ClassPayload: { + const ptr = ptrStack.pop(); + const obj = _exports['User'].__construct(ptr); + return { tag: AllTypesResultValues.Tag.ClassPayload, param0: obj }; + } + case AllTypesResultValues.Tag.JsObjectPayload: { + const objId = i32Stack.pop(); + const obj = swift.memory.getObject(objId); + swift.memory.release(objId); + return { tag: AllTypesResultValues.Tag.JsObjectPayload, param0: obj }; + } + case AllTypesResultValues.Tag.NestedEnum: { + const enumValue = enumHelpers.APIResult.lift(i32Stack.pop()); + return { tag: AllTypesResultValues.Tag.NestedEnum, param0: enumValue }; + } + case AllTypesResultValues.Tag.ArrayPayload: { + const arrayLen = i32Stack.pop(); + const arrayResult = []; + for (let i = 0; i < arrayLen; i++) { + const int = i32Stack.pop(); + arrayResult.push(int); } - case TypedPayloadResultValues.Tag.Empty: return { tag: TypedPayloadResultValues.Tag.Empty }; - default: throw new Error("Unknown TypedPayloadResultValues tag returned from Swift: " + String(tag)); + arrayResult.reverse(); + return { tag: AllTypesResultValues.Tag.ArrayPayload, param0: arrayResult }; } + case AllTypesResultValues.Tag.Empty: return { tag: AllTypesResultValues.Tag.Empty }; + default: throw new Error("Unknown AllTypesResultValues tag returned from Swift: " + String(tag)); } - }); - }; - const __bjs_createAllTypesResultValuesHelpers = () => { - return () => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case AllTypesResultValues.Tag.StructPayload: { + } + }); + const __bjs_createOptionalAllTypesResultValuesHelpers = () => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case OptionalAllTypesResultValues.Tag.OptStruct: { + const isSome = value.param0 != null; + if (isSome) { structHelpers.Point.lower(value.param0); - return AllTypesResultValues.Tag.StructPayload; } - case AllTypesResultValues.Tag.ClassPayload: { + i32Stack.push(isSome ? 1 : 0); + return OptionalAllTypesResultValues.Tag.OptStruct; + } + case OptionalAllTypesResultValues.Tag.OptClass: { + const isSome = value.param0 != null; + if (isSome) { ptrStack.push(value.param0.pointer); - return AllTypesResultValues.Tag.ClassPayload; + } else { + ptrStack.push(0); } - case AllTypesResultValues.Tag.JsObjectPayload: { + i32Stack.push(isSome ? 1 : 0); + return OptionalAllTypesResultValues.Tag.OptClass; + } + case OptionalAllTypesResultValues.Tag.OptJSObject: { + const isSome = value.param0 != null; + if (isSome) { const objId = swift.memory.retain(value.param0); i32Stack.push(objId); - return AllTypesResultValues.Tag.JsObjectPayload; + } else { + i32Stack.push(0); } - case AllTypesResultValues.Tag.NestedEnum: { + i32Stack.push(isSome ? 1 : 0); + return OptionalAllTypesResultValues.Tag.OptJSObject; + } + case OptionalAllTypesResultValues.Tag.OptNestedEnum: { + const isSome = value.param0 != null; + if (isSome) { const caseId = enumHelpers.APIResult.lower(value.param0); i32Stack.push(caseId); - return AllTypesResultValues.Tag.NestedEnum; + } else { + i32Stack.push(0); } - case AllTypesResultValues.Tag.ArrayPayload: { + i32Stack.push(isSome ? 1 : 0); + return OptionalAllTypesResultValues.Tag.OptNestedEnum; + } + case OptionalAllTypesResultValues.Tag.OptArray: { + const isSome = value.param0 != null; + if (isSome) { for (const elem of value.param0) { i32Stack.push((elem | 0)); } i32Stack.push(value.param0.length); - return AllTypesResultValues.Tag.ArrayPayload; } - case AllTypesResultValues.Tag.Empty: { - return AllTypesResultValues.Tag.Empty; - } - default: throw new Error("Unknown AllTypesResultValues tag: " + String(enumTag)); + i32Stack.push(isSome ? 1 : 0); + return OptionalAllTypesResultValues.Tag.OptArray; + } + case OptionalAllTypesResultValues.Tag.Empty: { + return OptionalAllTypesResultValues.Tag.Empty; } - }, - lift: (tag) => { - tag = tag | 0; - switch (tag) { - case AllTypesResultValues.Tag.StructPayload: { + default: throw new Error("Unknown OptionalAllTypesResultValues tag: " + String(enumTag)); + } + }, + lift: (tag) => { + tag = tag | 0; + switch (tag) { + case OptionalAllTypesResultValues.Tag.OptStruct: { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { const struct = structHelpers.Point.lift(); - return { tag: AllTypesResultValues.Tag.StructPayload, param0: struct }; + optional = struct; + } else { + optional = null; } - case AllTypesResultValues.Tag.ClassPayload: { + return { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: optional }; + } + case OptionalAllTypesResultValues.Tag.OptClass: { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { const ptr = ptrStack.pop(); const obj = _exports['User'].__construct(ptr); - return { tag: AllTypesResultValues.Tag.ClassPayload, param0: obj }; + optional = obj; + } else { + optional = null; } - case AllTypesResultValues.Tag.JsObjectPayload: { + return { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: optional }; + } + case OptionalAllTypesResultValues.Tag.OptJSObject: { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { const objId = i32Stack.pop(); const obj = swift.memory.getObject(objId); swift.memory.release(objId); - return { tag: AllTypesResultValues.Tag.JsObjectPayload, param0: obj }; + optional = obj; + } else { + optional = null; } - case AllTypesResultValues.Tag.NestedEnum: { - const enumValue = enumHelpers.APIResult.lift(i32Stack.pop(), ); - return { tag: AllTypesResultValues.Tag.NestedEnum, param0: enumValue }; + return { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: optional }; + } + case OptionalAllTypesResultValues.Tag.OptNestedEnum: { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { + const caseId = i32Stack.pop(); + optional = enumHelpers.APIResult.lift(caseId); + } else { + optional = null; } - case AllTypesResultValues.Tag.ArrayPayload: { + return { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: optional }; + } + case OptionalAllTypesResultValues.Tag.OptArray: { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { const arrayLen = i32Stack.pop(); const arrayResult = []; for (let i = 0; i < arrayLen; i++) { @@ -638,152 +750,17 @@ export async function createInstantiator(options, swift) { arrayResult.push(int); } arrayResult.reverse(); - return { tag: AllTypesResultValues.Tag.ArrayPayload, param0: arrayResult }; - } - case AllTypesResultValues.Tag.Empty: return { tag: AllTypesResultValues.Tag.Empty }; - default: throw new Error("Unknown AllTypesResultValues tag returned from Swift: " + String(tag)); - } - } - }); - }; - const __bjs_createOptionalAllTypesResultValuesHelpers = () => { - return () => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case OptionalAllTypesResultValues.Tag.OptStruct: { - const isSome = value.param0 != null; - if (isSome) { - structHelpers.Point.lower(value.param0); - } - i32Stack.push(isSome ? 1 : 0); - return OptionalAllTypesResultValues.Tag.OptStruct; - } - case OptionalAllTypesResultValues.Tag.OptClass: { - const isSome = value.param0 != null; - if (isSome) { - ptrStack.push(value.param0.pointer); - } else { - ptrStack.push(0); - } - i32Stack.push(isSome ? 1 : 0); - return OptionalAllTypesResultValues.Tag.OptClass; - } - case OptionalAllTypesResultValues.Tag.OptJSObject: { - const isSome = value.param0 != null; - let id; - if (isSome) { - id = swift.memory.retain(value.param0); - i32Stack.push(id); - } else { - id = undefined; - i32Stack.push(0); - } - i32Stack.push(isSome ? 1 : 0); - return OptionalAllTypesResultValues.Tag.OptJSObject; - } - case OptionalAllTypesResultValues.Tag.OptNestedEnum: { - const isSome = value.param0 != null; - let enumCaseId; - if (isSome) { - enumCaseId = enumHelpers.APIResult.lower(value.param0); - i32Stack.push(enumCaseId); - } else { - i32Stack.push(0); - } - i32Stack.push(isSome ? 1 : 0); - return OptionalAllTypesResultValues.Tag.OptNestedEnum; - } - case OptionalAllTypesResultValues.Tag.OptArray: { - const isSome = value.param0 != null; - if (isSome) { - for (const elem of value.param0) { - i32Stack.push((elem | 0)); - } - i32Stack.push(value.param0.length); - } - i32Stack.push(isSome ? 1 : 0); - return OptionalAllTypesResultValues.Tag.OptArray; - } - case OptionalAllTypesResultValues.Tag.Empty: { - return OptionalAllTypesResultValues.Tag.Empty; - } - default: throw new Error("Unknown OptionalAllTypesResultValues tag: " + String(enumTag)); - } - }, - lift: (tag) => { - tag = tag | 0; - switch (tag) { - case OptionalAllTypesResultValues.Tag.OptStruct: { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const struct = structHelpers.Point.lift(); - optional = struct; - } else { - optional = null; - } - return { tag: OptionalAllTypesResultValues.Tag.OptStruct, param0: optional }; - } - case OptionalAllTypesResultValues.Tag.OptClass: { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const ptr = ptrStack.pop(); - const obj = _exports['User'].__construct(ptr); - optional = obj; - } else { - optional = null; - } - return { tag: OptionalAllTypesResultValues.Tag.OptClass, param0: optional }; - } - case OptionalAllTypesResultValues.Tag.OptJSObject: { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const objId = i32Stack.pop(); - const obj = swift.memory.getObject(objId); - swift.memory.release(objId); - optional = obj; - } else { - optional = null; - } - return { tag: OptionalAllTypesResultValues.Tag.OptJSObject, param0: optional }; - } - case OptionalAllTypesResultValues.Tag.OptNestedEnum: { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const caseId = i32Stack.pop(); - optional = enumHelpers.APIResult.lift(caseId); - } else { - optional = null; - } - return { tag: OptionalAllTypesResultValues.Tag.OptNestedEnum, param0: optional }; - } - case OptionalAllTypesResultValues.Tag.OptArray: { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const arrayLen = i32Stack.pop(); - const arrayResult = []; - for (let i = 0; i < arrayLen; i++) { - const int = i32Stack.pop(); - arrayResult.push(int); - } - arrayResult.reverse(); - optional = arrayResult; - } else { - optional = null; - } - return { tag: OptionalAllTypesResultValues.Tag.OptArray, param0: optional }; + optional = arrayResult; + } else { + optional = null; } - case OptionalAllTypesResultValues.Tag.Empty: return { tag: OptionalAllTypesResultValues.Tag.Empty }; - default: throw new Error("Unknown OptionalAllTypesResultValues tag returned from Swift: " + String(tag)); + return { tag: OptionalAllTypesResultValues.Tag.OptArray, param0: optional }; } + case OptionalAllTypesResultValues.Tag.Empty: return { tag: OptionalAllTypesResultValues.Tag.Empty }; + default: throw new Error("Unknown OptionalAllTypesResultValues tag returned from Swift: " + String(tag)); } - }); - }; + } + }); return { /** @@ -1002,31 +979,31 @@ export async function createInstantiator(options, swift) { } } - const PointHelpers = __bjs_createPointHelpers()(); + const PointHelpers = __bjs_createPointHelpers(); structHelpers.Point = PointHelpers; - const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(); + const APIResultHelpers = __bjs_createAPIResultValuesHelpers(); enumHelpers.APIResult = APIResultHelpers; - const ComplexResultHelpers = __bjs_createComplexResultValuesHelpers()(); + const ComplexResultHelpers = __bjs_createComplexResultValuesHelpers(); enumHelpers.ComplexResult = ComplexResultHelpers; - const ResultHelpers = __bjs_createResultValuesHelpers()(); + const ResultHelpers = __bjs_createResultValuesHelpers(); enumHelpers.Result = ResultHelpers; - const NetworkingResultHelpers = __bjs_createNetworkingResultValuesHelpers()(); + const NetworkingResultHelpers = __bjs_createNetworkingResultValuesHelpers(); enumHelpers.NetworkingResult = NetworkingResultHelpers; - const APIOptionalResultHelpers = __bjs_createAPIOptionalResultValuesHelpers()(); + const APIOptionalResultHelpers = __bjs_createAPIOptionalResultValuesHelpers(); enumHelpers.APIOptionalResult = APIOptionalResultHelpers; - const TypedPayloadResultHelpers = __bjs_createTypedPayloadResultValuesHelpers()(); + const TypedPayloadResultHelpers = __bjs_createTypedPayloadResultValuesHelpers(); enumHelpers.TypedPayloadResult = TypedPayloadResultHelpers; - const AllTypesResultHelpers = __bjs_createAllTypesResultValuesHelpers()(); + const AllTypesResultHelpers = __bjs_createAllTypesResultValuesHelpers(); enumHelpers.AllTypesResult = AllTypesResultHelpers; - const OptionalAllTypesResultHelpers = __bjs_createOptionalAllTypesResultValuesHelpers()(); + const OptionalAllTypesResultHelpers = __bjs_createOptionalAllTypesResultValuesHelpers(); enumHelpers.OptionalAllTypesResult = OptionalAllTypesResultHelpers; const exports = { @@ -1048,19 +1025,16 @@ export async function createInstantiator(options, swift) { }, roundTripOptionalAPIResult: function bjs_roundTripOptionalAPIResult(result) { const isSome = result != null; - let resultCaseId; + let result1; if (isSome) { - resultCaseId = enumHelpers.APIResult.lower(result); - } - instance.exports.bjs_roundTripOptionalAPIResult(+isSome, isSome ? resultCaseId : 0); - const tag = i32Stack.pop(); - const isNull = (tag === -1); - let optResult; - if (isNull) { - optResult = null; + const resultCaseId = enumHelpers.APIResult.lower(result); + result1 = resultCaseId; } else { - optResult = enumHelpers.APIResult.lift(tag); + result1 = 0; } + instance.exports.bjs_roundTripOptionalAPIResult(+isSome, result1); + const tag = i32Stack.pop(); + const optResult = tag === -1 ? null : enumHelpers.APIResult.lift(tag); return optResult; }, handleComplex: function bjs_handleComplex(result) { @@ -1080,92 +1054,80 @@ export async function createInstantiator(options, swift) { }, roundTripOptionalComplexResult: function bjs_roundTripOptionalComplexResult(result) { const isSome = result != null; - let resultCaseId; + let result1; if (isSome) { - resultCaseId = enumHelpers.ComplexResult.lower(result); - } - instance.exports.bjs_roundTripOptionalComplexResult(+isSome, isSome ? resultCaseId : 0); - const tag = i32Stack.pop(); - const isNull = (tag === -1); - let optResult; - if (isNull) { - optResult = null; + const resultCaseId = enumHelpers.ComplexResult.lower(result); + result1 = resultCaseId; } else { - optResult = enumHelpers.ComplexResult.lift(tag); + result1 = 0; } + instance.exports.bjs_roundTripOptionalComplexResult(+isSome, result1); + const tag = i32Stack.pop(); + const optResult = tag === -1 ? null : enumHelpers.ComplexResult.lift(tag); return optResult; }, roundTripOptionalUtilitiesResult: function bjs_roundTripOptionalUtilitiesResult(result) { const isSome = result != null; - let resultCaseId; + let result1; if (isSome) { - resultCaseId = enumHelpers.Result.lower(result); - } - instance.exports.bjs_roundTripOptionalUtilitiesResult(+isSome, isSome ? resultCaseId : 0); - const tag = i32Stack.pop(); - const isNull = (tag === -1); - let optResult; - if (isNull) { - optResult = null; + const resultCaseId = enumHelpers.Result.lower(result); + result1 = resultCaseId; } else { - optResult = enumHelpers.Result.lift(tag); + result1 = 0; } + instance.exports.bjs_roundTripOptionalUtilitiesResult(+isSome, result1); + const tag = i32Stack.pop(); + const optResult = tag === -1 ? null : enumHelpers.Result.lift(tag); return optResult; }, roundTripOptionalNetworkingResult: function bjs_roundTripOptionalNetworkingResult(result) { const isSome = result != null; - let resultCaseId; + let result1; if (isSome) { - resultCaseId = enumHelpers.NetworkingResult.lower(result); - } - instance.exports.bjs_roundTripOptionalNetworkingResult(+isSome, isSome ? resultCaseId : 0); - const tag = i32Stack.pop(); - const isNull = (tag === -1); - let optResult; - if (isNull) { - optResult = null; + const resultCaseId = enumHelpers.NetworkingResult.lower(result); + result1 = resultCaseId; } else { - optResult = enumHelpers.NetworkingResult.lift(tag); + result1 = 0; } + instance.exports.bjs_roundTripOptionalNetworkingResult(+isSome, result1); + const tag = i32Stack.pop(); + const optResult = tag === -1 ? null : enumHelpers.NetworkingResult.lift(tag); return optResult; }, roundTripOptionalAPIOptionalResult: function bjs_roundTripOptionalAPIOptionalResult(result) { const isSome = result != null; - let resultCaseId; + let result1; if (isSome) { - resultCaseId = enumHelpers.APIOptionalResult.lower(result); - } - instance.exports.bjs_roundTripOptionalAPIOptionalResult(+isSome, isSome ? resultCaseId : 0); - const tag = i32Stack.pop(); - const isNull = (tag === -1); - let optResult; - if (isNull) { - optResult = null; + const resultCaseId = enumHelpers.APIOptionalResult.lower(result); + result1 = resultCaseId; } else { - optResult = enumHelpers.APIOptionalResult.lift(tag); + result1 = 0; } + instance.exports.bjs_roundTripOptionalAPIOptionalResult(+isSome, result1); + const tag = i32Stack.pop(); + const optResult = tag === -1 ? null : enumHelpers.APIOptionalResult.lift(tag); return optResult; }, compareAPIResults: function bjs_compareAPIResults(result1, result2) { const isSome = result1 != null; - let result1CaseId; + let result; if (isSome) { - result1CaseId = enumHelpers.APIOptionalResult.lower(result1); + const result1CaseId = enumHelpers.APIOptionalResult.lower(result1); + result = result1CaseId; + } else { + result = 0; } const isSome1 = result2 != null; - let result2CaseId; + let result3; if (isSome1) { - result2CaseId = enumHelpers.APIOptionalResult.lower(result2); - } - instance.exports.bjs_compareAPIResults(+isSome, isSome ? result1CaseId : 0, +isSome1, isSome1 ? result2CaseId : 0); - const tag = i32Stack.pop(); - const isNull = (tag === -1); - let optResult; - if (isNull) { - optResult = null; + const result2CaseId = enumHelpers.APIOptionalResult.lower(result2); + result3 = result2CaseId; } else { - optResult = enumHelpers.APIOptionalResult.lift(tag); + result3 = 0; } + instance.exports.bjs_compareAPIResults(+isSome, result, +isSome1, result3); + const tag = i32Stack.pop(); + const optResult = tag === -1 ? null : enumHelpers.APIOptionalResult.lift(tag); return optResult; }, roundTripTypedPayloadResult: function bjs_roundTripTypedPayloadResult(result) { @@ -1176,19 +1138,16 @@ export async function createInstantiator(options, swift) { }, roundTripOptionalTypedPayloadResult: function bjs_roundTripOptionalTypedPayloadResult(result) { const isSome = result != null; - let resultCaseId; + let result1; if (isSome) { - resultCaseId = enumHelpers.TypedPayloadResult.lower(result); - } - instance.exports.bjs_roundTripOptionalTypedPayloadResult(+isSome, isSome ? resultCaseId : 0); - const tag = i32Stack.pop(); - const isNull = (tag === -1); - let optResult; - if (isNull) { - optResult = null; + const resultCaseId = enumHelpers.TypedPayloadResult.lower(result); + result1 = resultCaseId; } else { - optResult = enumHelpers.TypedPayloadResult.lift(tag); + result1 = 0; } + instance.exports.bjs_roundTripOptionalTypedPayloadResult(+isSome, result1); + const tag = i32Stack.pop(); + const optResult = tag === -1 ? null : enumHelpers.TypedPayloadResult.lift(tag); return optResult; }, roundTripAllTypesResult: function bjs_roundTripAllTypesResult(result) { @@ -1199,19 +1158,16 @@ export async function createInstantiator(options, swift) { }, roundTripOptionalAllTypesResult: function bjs_roundTripOptionalAllTypesResult(result) { const isSome = result != null; - let resultCaseId; + let result1; if (isSome) { - resultCaseId = enumHelpers.AllTypesResult.lower(result); - } - instance.exports.bjs_roundTripOptionalAllTypesResult(+isSome, isSome ? resultCaseId : 0); - const tag = i32Stack.pop(); - const isNull = (tag === -1); - let optResult; - if (isNull) { - optResult = null; + const resultCaseId = enumHelpers.AllTypesResult.lower(result); + result1 = resultCaseId; } else { - optResult = enumHelpers.AllTypesResult.lift(tag); + result1 = 0; } + instance.exports.bjs_roundTripOptionalAllTypesResult(+isSome, result1); + const tag = i32Stack.pop(); + const optResult = tag === -1 ? null : enumHelpers.AllTypesResult.lift(tag); return optResult; }, roundTripOptionalPayloadResult: function bjs_roundTripOptionalPayloadResult(result) { @@ -1222,19 +1178,16 @@ export async function createInstantiator(options, swift) { }, roundTripOptionalPayloadResultOpt: function bjs_roundTripOptionalPayloadResultOpt(result) { const isSome = result != null; - let resultCaseId; + let result1; if (isSome) { - resultCaseId = enumHelpers.OptionalAllTypesResult.lower(result); - } - instance.exports.bjs_roundTripOptionalPayloadResultOpt(+isSome, isSome ? resultCaseId : 0); - const tag = i32Stack.pop(); - const isNull = (tag === -1); - let optResult; - if (isNull) { - optResult = null; + const resultCaseId = enumHelpers.OptionalAllTypesResult.lower(result); + result1 = resultCaseId; } else { - optResult = enumHelpers.OptionalAllTypesResult.lift(tag); + result1 = 0; } + instance.exports.bjs_roundTripOptionalPayloadResultOpt(+isSome, result1); + const tag = i32Stack.pop(); + const optResult = tag === -1 ? null : enumHelpers.OptionalAllTypesResult.lift(tag); return optResult; }, APIResult: APIResultValues, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index 77d106b57..efd75f1fa 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -305,12 +305,17 @@ export async function createInstantiator(options, swift) { }, roundTripOptionalTheme: function bjs_roundTripOptionalTheme(input) { const isSome = input != null; - let inputId, inputBytes; + let result, result1; if (isSome) { - inputBytes = textEncoder.encode(input); - inputId = swift.memory.retain(inputBytes); + const inputBytes = textEncoder.encode(input); + const inputId = swift.memory.retain(inputBytes); + result = inputId; + result1 = inputBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_roundTripOptionalTheme(+isSome, isSome ? inputId : 0, isSome ? inputBytes.length : 0); + instance.exports.bjs_roundTripOptionalTheme(+isSome, result, result1); const optResult = tmpRetString; tmpRetString = undefined; return optResult; @@ -328,12 +333,17 @@ export async function createInstantiator(options, swift) { }, roundTripOptionalTSTheme: function bjs_roundTripOptionalTSTheme(input) { const isSome = input != null; - let inputId, inputBytes; + let result, result1; if (isSome) { - inputBytes = textEncoder.encode(input); - inputId = swift.memory.retain(inputBytes); + const inputBytes = textEncoder.encode(input); + const inputId = swift.memory.retain(inputBytes); + result = inputId; + result1 = inputBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_roundTripOptionalTSTheme(+isSome, isSome ? inputId : 0, isSome ? inputBytes.length : 0); + instance.exports.bjs_roundTripOptionalTSTheme(+isSome, result, result1); const optResult = tmpRetString; tmpRetString = undefined; return optResult; @@ -351,12 +361,17 @@ export async function createInstantiator(options, swift) { }, roundTripOptionalFeatureFlag: function bjs_roundTripOptionalFeatureFlag(input) { const isSome = input != null; - let inputId, inputBytes; + let result, result1; if (isSome) { - inputBytes = textEncoder.encode(input); - inputId = swift.memory.retain(inputBytes); + const inputBytes = textEncoder.encode(input); + const inputId = swift.memory.retain(inputBytes); + result = inputId; + result1 = inputBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_roundTripOptionalFeatureFlag(+isSome, isSome ? inputId : 0, isSome ? inputBytes.length : 0); + instance.exports.bjs_roundTripOptionalFeatureFlag(+isSome, result, result1); const optResult = tmpRetString; tmpRetString = undefined; return optResult; @@ -468,7 +483,7 @@ export async function createInstantiator(options, swift) { }, roundTripOptionalPrecision: function bjs_roundTripOptionalPrecision(input) { const isSome = input != null; - instance.exports.bjs_roundTripOptionalPrecision(+isSome, isSome ? input : 0); + instance.exports.bjs_roundTripOptionalPrecision(+isSome, isSome ? input : 0.0); const optResult = tmpRetOptionalFloat; tmpRetOptionalFloat = undefined; return optResult; @@ -482,7 +497,7 @@ export async function createInstantiator(options, swift) { }, roundTripOptionalRatio: function bjs_roundTripOptionalRatio(input) { const isSome = input != null; - instance.exports.bjs_roundTripOptionalRatio(+isSome, isSome ? input : 0); + instance.exports.bjs_roundTripOptionalRatio(+isSome, isSome ? input : 0.0); const optResult = tmpRetOptionalDouble; tmpRetOptionalDouble = undefined; return optResult; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index 92230667c..c0c9704ef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -28,55 +28,56 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const __bjs_createFooContainerHelpers = () => { - return () => ({ - lower: (value) => { - let id; - if (value.foo != null) { - id = swift.memory.retain(value.foo); - } else { - id = undefined; - } - i32Stack.push(id !== undefined ? id : 0); - const isSome = value.optionalFoo != null; + const __bjs_createFooContainerHelpers = () => ({ + lower: (value) => { + let id; + if (value.foo != null) { + id = swift.memory.retain(value.foo); + } else { + id = undefined; + } + i32Stack.push(id !== undefined ? id : 0); + const isSome = value.optionalFoo != null; + if (isSome) { let id1; - if (isSome) { + if (value.optionalFoo != null) { id1 = swift.memory.retain(value.optionalFoo); - i32Stack.push(id1); } else { id1 = undefined; - i32Stack.push(0); - } - i32Stack.push(isSome ? 1 : 0); - }, - lift: () => { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const objectId = i32Stack.pop(); - let value; - if (objectId !== 0) { - value = swift.memory.getObject(objectId); - swift.memory.release(objectId); - } else { - value = null; - } - optional = value; - } else { - optional = null; } - const objectId1 = i32Stack.pop(); - let value1; - if (objectId1 !== 0) { - value1 = swift.memory.getObject(objectId1); - swift.memory.release(objectId1); + i32Stack.push(id1 !== undefined ? id1 : 0); + } else { + i32Stack.push(0); + } + i32Stack.push(isSome ? 1 : 0); + }, + lift: () => { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { + const objectId = i32Stack.pop(); + let value; + if (objectId !== 0) { + value = swift.memory.getObject(objectId); + swift.memory.release(objectId); } else { - value1 = null; + value = null; } - return { foo: value1, optionalFoo: optional }; - } - }); - }; + optional = value; + } else { + optional = null; + } + const objectId1 = i32Stack.pop(); + let value1; + if (objectId1 !== 0) { + value1 = swift.memory.getObject(objectId1); + swift.memory.release(objectId1); + } else { + value1 = null; + } + return { foo: value1, optionalFoo: optional }; + } + }); return { /** @@ -262,7 +263,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const FooContainerHelpers = __bjs_createFooContainerHelpers()(); + const FooContainerHelpers = __bjs_createFooContainerHelpers(); structHelpers.FooContainer = FooContainerHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index 0a4d37845..8571bbd6c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -368,15 +368,35 @@ export async function createInstantiator(options, swift) { constructor(value, optionalValue) { const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); const isSome = optionalValue != null; - const [optionalValueKind, optionalValuePayload1, optionalValuePayload2] = __bjs_jsValueLower(optionalValue); - const ret = instance.exports.bjs_JSValueHolder_init(valueKind, valuePayload1, valuePayload2, +isSome, optionalValueKind, optionalValuePayload1, optionalValuePayload2); + let result, result1, result2; + if (isSome) { + const [optionalValueKind, optionalValuePayload1, optionalValuePayload2] = __bjs_jsValueLower(optionalValue); + result = optionalValueKind; + result1 = optionalValuePayload1; + result2 = optionalValuePayload2; + } else { + result = 0; + result1 = 0; + result2 = 0.0; + } + const ret = instance.exports.bjs_JSValueHolder_init(valueKind, valuePayload1, valuePayload2, +isSome, result, result1, result2); return JSValueHolder.__construct(ret); } update(value, optionalValue) { const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); const isSome = optionalValue != null; - const [optionalValueKind, optionalValuePayload1, optionalValuePayload2] = __bjs_jsValueLower(optionalValue); - instance.exports.bjs_JSValueHolder_update(this.pointer, valueKind, valuePayload1, valuePayload2, +isSome, optionalValueKind, optionalValuePayload1, optionalValuePayload2); + let result, result1, result2; + if (isSome) { + const [optionalValueKind, optionalValuePayload1, optionalValuePayload2] = __bjs_jsValueLower(optionalValue); + result = optionalValueKind; + result1 = optionalValuePayload1; + result2 = optionalValuePayload2; + } else { + result = 0; + result1 = 0; + result2 = 0.0; + } + instance.exports.bjs_JSValueHolder_update(this.pointer, valueKind, valuePayload1, valuePayload2, +isSome, result, result1, result2); } echo(value) { const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); @@ -389,8 +409,18 @@ export async function createInstantiator(options, swift) { } echoOptional(value) { const isSome = value != null; - const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); - instance.exports.bjs_JSValueHolder_echoOptional(this.pointer, +isSome, valueKind, valuePayload1, valuePayload2); + let result, result1, result2; + if (isSome) { + const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); + result = valueKind; + result1 = valuePayload1; + result2 = valuePayload2; + } else { + result = 0; + result1 = 0; + result2 = 0.0; + } + instance.exports.bjs_JSValueHolder_echoOptional(this.pointer, +isSome, result, result1, result2); const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { @@ -433,8 +463,18 @@ export async function createInstantiator(options, swift) { } set optionalValue(value) { const isSome = value != null; - const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); - instance.exports.bjs_JSValueHolder_optionalValue_set(this.pointer, +isSome, valueKind, valuePayload1, valuePayload2); + let result, result1, result2; + if (isSome) { + const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); + result = valueKind; + result1 = valuePayload1; + result2 = valuePayload2; + } else { + result = 0; + result1 = 0; + result2 = 0.0; + } + instance.exports.bjs_JSValueHolder_optionalValue_set(this.pointer, +isSome, result, result1, result2); } } const exports = { @@ -450,8 +490,18 @@ export async function createInstantiator(options, swift) { }, roundTripOptionalJSValue: function bjs_roundTripOptionalJSValue(value) { const isSome = value != null; - const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); - instance.exports.bjs_roundTripOptionalJSValue(+isSome, valueKind, valuePayload1, valuePayload2); + let result, result1, result2; + if (isSome) { + const [valueKind, valuePayload1, valuePayload2] = __bjs_jsValueLower(value); + result = valueKind; + result1 = valuePayload1; + result2 = valuePayload2; + } else { + result = 0; + result1 = 0; + result2 = 0.0; + } + instance.exports.bjs_roundTripOptionalJSValue(+isSome, result, result1, result2); const isSome1 = i32Stack.pop(); let optResult; if (isSome1) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 03a3cf565..941d66ea9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -198,19 +198,25 @@ export async function createInstantiator(options, swift) { return swift.memory.retain(obj); }; const TestModule = importObject["TestModule"] = importObject["TestModule"] || {}; - TestModule["bjs_WithOptionalJSClass_init"] = function bjs_WithOptionalJSClass_init(valueOrNullIsSome, valueOrNullWrappedValue, valueOrUndefinedIsSome, valueOrUndefinedWrappedValue) { + TestModule["bjs_WithOptionalJSClass_init"] = function bjs_WithOptionalJSClass_init(valueOrNullIsSome, valueOrNullObjectId, valueOrUndefinedIsSome, valueOrUndefinedObjectId) { try { - let obj; + let optResult; if (valueOrNullIsSome) { - obj = swift.memory.getObject(valueOrNullWrappedValue); - swift.memory.release(valueOrNullWrappedValue); + const valueOrNullObjectIdObject = swift.memory.getObject(valueOrNullObjectId); + swift.memory.release(valueOrNullObjectId); + optResult = valueOrNullObjectIdObject; + } else { + optResult = null; } - let obj1; + let optResult1; if (valueOrUndefinedIsSome) { - obj1 = swift.memory.getObject(valueOrUndefinedWrappedValue); - swift.memory.release(valueOrUndefinedWrappedValue); + const valueOrUndefinedObjectIdObject = swift.memory.getObject(valueOrUndefinedObjectId); + swift.memory.release(valueOrUndefinedObjectId); + optResult1 = valueOrUndefinedObjectIdObject; + } else { + optResult1 = undefined; } - return swift.memory.retain(new imports.WithOptionalJSClass(valueOrNullIsSome ? obj : null, valueOrUndefinedIsSome ? obj1 : undefined)); + return swift.memory.retain(new imports.WithOptionalJSClass(optResult, optResult1)); } catch (error) { setException(error); return 0 @@ -220,11 +226,7 @@ export async function createInstantiator(options, swift) { try { let ret = swift.memory.getObject(self).stringOrNull; const isSome = ret != null; - if (isSome) { - tmpRetString = ret; - } else { - tmpRetString = null; - } + tmpRetString = isSome ? ret : null; } catch (error) { setException(error); } @@ -233,11 +235,7 @@ export async function createInstantiator(options, swift) { try { let ret = swift.memory.getObject(self).stringOrUndefined; const isSome = ret !== undefined; - if (isSome) { - tmpRetString = ret; - } else { - tmpRetString = null; - } + tmpRetString = isSome ? ret : undefined; } catch (error) { setException(error); } @@ -296,26 +294,32 @@ export async function createInstantiator(options, swift) { setException(error); } } - TestModule["bjs_WithOptionalJSClass_stringOrNull_set"] = function bjs_WithOptionalJSClass_stringOrNull_set(self, newValueIsSome, newValueWrappedValue) { + TestModule["bjs_WithOptionalJSClass_stringOrNull_set"] = function bjs_WithOptionalJSClass_stringOrNull_set(self, newValueIsSome, newValueObjectId) { try { - let obj; + let optResult; if (newValueIsSome) { - obj = swift.memory.getObject(newValueWrappedValue); - swift.memory.release(newValueWrappedValue); + const newValueObjectIdObject = swift.memory.getObject(newValueObjectId); + swift.memory.release(newValueObjectId); + optResult = newValueObjectIdObject; + } else { + optResult = null; } - swift.memory.getObject(self).stringOrNull = newValueIsSome ? obj : null; + swift.memory.getObject(self).stringOrNull = optResult; } catch (error) { setException(error); } } - TestModule["bjs_WithOptionalJSClass_stringOrUndefined_set"] = function bjs_WithOptionalJSClass_stringOrUndefined_set(self, newValueIsSome, newValueWrappedValue) { + TestModule["bjs_WithOptionalJSClass_stringOrUndefined_set"] = function bjs_WithOptionalJSClass_stringOrUndefined_set(self, newValueIsSome, newValueObjectId) { try { - let obj; + let optResult; if (newValueIsSome) { - obj = swift.memory.getObject(newValueWrappedValue); - swift.memory.release(newValueWrappedValue); + const newValueObjectIdObject = swift.memory.getObject(newValueObjectId); + swift.memory.release(newValueObjectId); + optResult = newValueObjectIdObject; + } else { + optResult = undefined; } - swift.memory.getObject(self).stringOrUndefined = newValueIsSome ? obj : undefined; + swift.memory.getObject(self).stringOrUndefined = optResult; } catch (error) { setException(error); } @@ -362,38 +366,36 @@ export async function createInstantiator(options, swift) { setException(error); } } - TestModule["bjs_WithOptionalJSClass_roundTripStringOrNull"] = function bjs_WithOptionalJSClass_roundTripStringOrNull(self, valueIsSome, valueWrappedValue) { + TestModule["bjs_WithOptionalJSClass_roundTripStringOrNull"] = function bjs_WithOptionalJSClass_roundTripStringOrNull(self, valueIsSome, valueObjectId) { try { - let obj; + let optResult; if (valueIsSome) { - obj = swift.memory.getObject(valueWrappedValue); - swift.memory.release(valueWrappedValue); - } - let ret = swift.memory.getObject(self).roundTripStringOrNull(valueIsSome ? obj : null); - const isSome = ret != null; - if (isSome) { - tmpRetString = ret; + const valueObjectIdObject = swift.memory.getObject(valueObjectId); + swift.memory.release(valueObjectId); + optResult = valueObjectIdObject; } else { - tmpRetString = null; + optResult = null; } + let ret = swift.memory.getObject(self).roundTripStringOrNull(optResult); + const isSome = ret != null; + tmpRetString = isSome ? ret : null; } catch (error) { setException(error); } } - TestModule["bjs_WithOptionalJSClass_roundTripStringOrUndefined"] = function bjs_WithOptionalJSClass_roundTripStringOrUndefined(self, valueIsSome, valueWrappedValue) { + TestModule["bjs_WithOptionalJSClass_roundTripStringOrUndefined"] = function bjs_WithOptionalJSClass_roundTripStringOrUndefined(self, valueIsSome, valueObjectId) { try { - let obj; + let optResult; if (valueIsSome) { - obj = swift.memory.getObject(valueWrappedValue); - swift.memory.release(valueWrappedValue); - } - let ret = swift.memory.getObject(self).roundTripStringOrUndefined(valueIsSome ? obj : undefined); - const isSome = ret !== undefined; - if (isSome) { - tmpRetString = ret; + const valueObjectIdObject = swift.memory.getObject(valueObjectId); + swift.memory.release(valueObjectId); + optResult = valueObjectIdObject; } else { - tmpRetString = null; + optResult = undefined; } + let ret = swift.memory.getObject(self).roundTripStringOrUndefined(optResult); + const isSome = ret !== undefined; + tmpRetString = isSome ? ret : undefined; } catch (error) { setException(error); } @@ -500,12 +502,17 @@ export async function createInstantiator(options, swift) { constructor(name) { const isSome = name != null; - let nameId, nameBytes; + let result, result1; if (isSome) { - nameBytes = textEncoder.encode(name); - nameId = swift.memory.retain(nameBytes); + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + result = nameId; + result1 = nameBytes.length; + } else { + result = 0; + result1 = 0; } - const ret = instance.exports.bjs_Greeter_init(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); + const ret = instance.exports.bjs_Greeter_init(+isSome, result, result1); return Greeter.__construct(ret); } greet() { @@ -516,12 +523,17 @@ export async function createInstantiator(options, swift) { } changeName(name) { const isSome = name != null; - let nameId, nameBytes; + let result, result1; if (isSome) { - nameBytes = textEncoder.encode(name); - nameId = swift.memory.retain(nameBytes); + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + result = nameId; + result1 = nameBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_Greeter_changeName(this.pointer, +isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); + instance.exports.bjs_Greeter_changeName(this.pointer, +isSome, result, result1); } get name() { instance.exports.bjs_Greeter_name_get(this.pointer); @@ -531,12 +543,17 @@ export async function createInstantiator(options, swift) { } set name(value) { const isSome = value != null; - let valueId, valueBytes; + let result, result1; if (isSome) { - valueBytes = textEncoder.encode(value); - valueId = swift.memory.retain(valueBytes); + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + result = valueId; + result1 = valueBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_Greeter_name_set(this.pointer, +isSome, isSome ? valueId : 0, isSome ? valueBytes.length : 0); + instance.exports.bjs_Greeter_name_set(this.pointer, +isSome, result, result1); } } class OptionalPropertyHolder extends SwiftHeapObject { @@ -556,12 +573,17 @@ export async function createInstantiator(options, swift) { } set optionalName(value) { const isSome = value != null; - let valueId, valueBytes; + let result, result1; if (isSome) { - valueBytes = textEncoder.encode(value); - valueId = swift.memory.retain(valueBytes); + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + result = valueId; + result1 = valueBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_OptionalPropertyHolder_optionalName_set(this.pointer, +isSome, isSome ? valueId : 0, isSome ? valueBytes.length : 0); + instance.exports.bjs_OptionalPropertyHolder_optionalName_set(this.pointer, +isSome, result, result1); } get optionalAge() { instance.exports.bjs_OptionalPropertyHolder_optionalAge_get(this.pointer); @@ -582,7 +604,13 @@ export async function createInstantiator(options, swift) { } set optionalGreeter(value) { const isSome = value != null; - instance.exports.bjs_OptionalPropertyHolder_optionalGreeter_set(this.pointer, +isSome, isSome ? value.pointer : 0); + let result; + if (isSome) { + result = value.pointer; + } else { + result = 0; + } + instance.exports.bjs_OptionalPropertyHolder_optionalGreeter_set(this.pointer, +isSome, result); } } const exports = { @@ -590,7 +618,13 @@ export async function createInstantiator(options, swift) { OptionalPropertyHolder, roundTripOptionalClass: function bjs_roundTripOptionalClass(value) { const isSome = value != null; - instance.exports.bjs_roundTripOptionalClass(+isSome, isSome ? value.pointer : 0); + let result; + if (isSome) { + result = value.pointer; + } else { + result = 0; + } + instance.exports.bjs_roundTripOptionalClass(+isSome, result); const pointer = tmpRetOptionalHeapObject; tmpRetOptionalHeapObject = undefined; const optResult = pointer === null ? null : Greeter.__construct(pointer); @@ -598,7 +632,13 @@ export async function createInstantiator(options, swift) { }, testOptionalPropertyRoundtrip: function bjs_testOptionalPropertyRoundtrip(holder) { const isSome = holder != null; - instance.exports.bjs_testOptionalPropertyRoundtrip(+isSome, isSome ? holder.pointer : 0); + let result; + if (isSome) { + result = holder.pointer; + } else { + result = 0; + } + instance.exports.bjs_testOptionalPropertyRoundtrip(+isSome, result); const pointer = tmpRetOptionalHeapObject; tmpRetOptionalHeapObject = undefined; const optResult = pointer === null ? null : OptionalPropertyHolder.__construct(pointer); @@ -606,12 +646,17 @@ export async function createInstantiator(options, swift) { }, roundTripString: function bjs_roundTripString(name) { const isSome = name != null; - let nameId, nameBytes; + let result, result1; if (isSome) { - nameBytes = textEncoder.encode(name); - nameId = swift.memory.retain(nameBytes); + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + result = nameId; + result1 = nameBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_roundTripString(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); + instance.exports.bjs_roundTripString(+isSome, result, result1); const optResult = tmpRetString; tmpRetString = undefined; return optResult; @@ -625,76 +670,96 @@ export async function createInstantiator(options, swift) { }, roundTripBool: function bjs_roundTripBool(flag) { const isSome = flag != null; - instance.exports.bjs_roundTripBool(+isSome, isSome ? flag : 0); + instance.exports.bjs_roundTripBool(+isSome, isSome ? flag ? 1 : 0 : 0); const optResult = tmpRetOptionalBool; tmpRetOptionalBool = undefined; return optResult; }, roundTripFloat: function bjs_roundTripFloat(number) { const isSome = number != null; - instance.exports.bjs_roundTripFloat(+isSome, isSome ? number : 0); + instance.exports.bjs_roundTripFloat(+isSome, isSome ? number : 0.0); const optResult = tmpRetOptionalFloat; tmpRetOptionalFloat = undefined; return optResult; }, roundTripDouble: function bjs_roundTripDouble(precision) { const isSome = precision != null; - instance.exports.bjs_roundTripDouble(+isSome, isSome ? precision : 0); + instance.exports.bjs_roundTripDouble(+isSome, isSome ? precision : 0.0); const optResult = tmpRetOptionalDouble; tmpRetOptionalDouble = undefined; return optResult; }, roundTripSyntax: function bjs_roundTripSyntax(name) { const isSome = name != null; - let nameId, nameBytes; + let result, result1; if (isSome) { - nameBytes = textEncoder.encode(name); - nameId = swift.memory.retain(nameBytes); + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + result = nameId; + result1 = nameBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_roundTripSyntax(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); + instance.exports.bjs_roundTripSyntax(+isSome, result, result1); const optResult = tmpRetString; tmpRetString = undefined; return optResult; }, roundTripMixSyntax: function bjs_roundTripMixSyntax(name) { const isSome = name != null; - let nameId, nameBytes; + let result, result1; if (isSome) { - nameBytes = textEncoder.encode(name); - nameId = swift.memory.retain(nameBytes); + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + result = nameId; + result1 = nameBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_roundTripMixSyntax(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); + instance.exports.bjs_roundTripMixSyntax(+isSome, result, result1); const optResult = tmpRetString; tmpRetString = undefined; return optResult; }, roundTripSwiftSyntax: function bjs_roundTripSwiftSyntax(name) { const isSome = name != null; - let nameId, nameBytes; + let result, result1; if (isSome) { - nameBytes = textEncoder.encode(name); - nameId = swift.memory.retain(nameBytes); + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + result = nameId; + result1 = nameBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_roundTripSwiftSyntax(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); + instance.exports.bjs_roundTripSwiftSyntax(+isSome, result, result1); const optResult = tmpRetString; tmpRetString = undefined; return optResult; }, roundTripMixedSwiftSyntax: function bjs_roundTripMixedSwiftSyntax(name) { const isSome = name != null; - let nameId, nameBytes; + let result, result1; if (isSome) { - nameBytes = textEncoder.encode(name); - nameId = swift.memory.retain(nameBytes); + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + result = nameId; + result1 = nameBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_roundTripMixedSwiftSyntax(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); + instance.exports.bjs_roundTripMixedSwiftSyntax(+isSome, result, result1); const optResult = tmpRetString; tmpRetString = undefined; return optResult; }, roundTripWithSpaces: function bjs_roundTripWithSpaces(value) { const isSome = value != null; - instance.exports.bjs_roundTripWithSpaces(+isSome, isSome ? value : 0); + instance.exports.bjs_roundTripWithSpaces(+isSome, isSome ? value : 0.0); const optResult = tmpRetOptionalDouble; tmpRetOptionalDouble = undefined; return optResult; @@ -708,31 +773,46 @@ export async function createInstantiator(options, swift) { }, roundTripOptionalAlias: function bjs_roundTripOptionalAlias(name) { const isSome = name != null; - let nameId, nameBytes; + let result, result1; if (isSome) { - nameBytes = textEncoder.encode(name); - nameId = swift.memory.retain(nameBytes); + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + result = nameId; + result1 = nameBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_roundTripOptionalAlias(+isSome, isSome ? nameId : 0, isSome ? nameBytes.length : 0); + instance.exports.bjs_roundTripOptionalAlias(+isSome, result, result1); const optResult = tmpRetString; tmpRetString = undefined; return optResult; }, testMixedOptionals: function bjs_testMixedOptionals(firstName, lastName, age, active) { const isSome = firstName != null; - let firstNameId, firstNameBytes; + let result, result1; if (isSome) { - firstNameBytes = textEncoder.encode(firstName); - firstNameId = swift.memory.retain(firstNameBytes); + const firstNameBytes = textEncoder.encode(firstName); + const firstNameId = swift.memory.retain(firstNameBytes); + result = firstNameId; + result1 = firstNameBytes.length; + } else { + result = 0; + result1 = 0; } const isSome1 = lastName != null; - let lastNameId, lastNameBytes; + let result2, result3; if (isSome1) { - lastNameBytes = textEncoder.encode(lastName); - lastNameId = swift.memory.retain(lastNameBytes); + const lastNameBytes = textEncoder.encode(lastName); + const lastNameId = swift.memory.retain(lastNameBytes); + result2 = lastNameId; + result3 = lastNameBytes.length; + } else { + result2 = 0; + result3 = 0; } const isSome2 = age != null; - instance.exports.bjs_testMixedOptionals(+isSome, isSome ? firstNameId : 0, isSome ? firstNameBytes.length : 0, +isSome1, isSome1 ? lastNameId : 0, isSome1 ? lastNameBytes.length : 0, +isSome2, isSome2 ? age : 0, active); + instance.exports.bjs_testMixedOptionals(+isSome, result, result1, +isSome1, result2, result3, +isSome2, isSome2 ? age : 0, active); const optResult = tmpRetString; tmpRetString = undefined; return optResult; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 9043d19ef..6e95d2ddf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -52,41 +52,39 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const __bjs_createResultValuesHelpers = () => { - return () => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case ResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - return ResultValues.Tag.Success; - } - case ResultValues.Tag.Failure: { - i32Stack.push((value.param0 | 0)); - return ResultValues.Tag.Failure; - } - default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); - } - }, - lift: (tag) => { - tag = tag | 0; - switch (tag) { - case ResultValues.Tag.Success: { - const string = strStack.pop(); - return { tag: ResultValues.Tag.Success, param0: string }; - } - case ResultValues.Tag.Failure: { - const int = i32Stack.pop(); - return { tag: ResultValues.Tag.Failure, param0: int }; - } - default: throw new Error("Unknown ResultValues tag returned from Swift: " + String(tag)); + const __bjs_createResultValuesHelpers = () => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case ResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + return ResultValues.Tag.Success; + } + case ResultValues.Tag.Failure: { + i32Stack.push((value.param0 | 0)); + return ResultValues.Tag.Failure; + } + default: throw new Error("Unknown ResultValues tag: " + String(enumTag)); + } + }, + lift: (tag) => { + tag = tag | 0; + switch (tag) { + case ResultValues.Tag.Success: { + const string = strStack.pop(); + return { tag: ResultValues.Tag.Success, param0: string }; + } + case ResultValues.Tag.Failure: { + const int = i32Stack.pop(); + return { tag: ResultValues.Tag.Failure, param0: int }; } + default: throw new Error("Unknown ResultValues tag returned from Swift: " + String(tag)); } - }); - }; + } + }); return { /** @@ -293,14 +291,17 @@ export async function createInstantiator(options, swift) { setException(error); } } - TestModule["bjs_MyViewControllerDelegate_optionalName_set"] = function bjs_MyViewControllerDelegate_optionalName_set(self, valueIsSome, valueWrappedValue) { + TestModule["bjs_MyViewControllerDelegate_optionalName_set"] = function bjs_MyViewControllerDelegate_optionalName_set(self, valueIsSome, valueObjectId) { try { - let obj; + let optResult; if (valueIsSome) { - obj = swift.memory.getObject(valueWrappedValue); - swift.memory.release(valueWrappedValue); + const valueObjectIdObject = swift.memory.getObject(valueObjectId); + swift.memory.release(valueObjectId); + optResult = valueObjectIdObject; + } else { + optResult = null; } - swift.memory.getObject(self).optionalName = valueIsSome ? obj : null; + swift.memory.getObject(self).optionalName = optResult; } catch (error) { setException(error); } @@ -313,14 +314,17 @@ export async function createInstantiator(options, swift) { setException(error); } } - TestModule["bjs_MyViewControllerDelegate_optionalRawEnum_set"] = function bjs_MyViewControllerDelegate_optionalRawEnum_set(self, valueIsSome, valueWrappedValue) { + TestModule["bjs_MyViewControllerDelegate_optionalRawEnum_set"] = function bjs_MyViewControllerDelegate_optionalRawEnum_set(self, valueIsSome, valueObjectId) { try { - let obj; + let optResult; if (valueIsSome) { - obj = swift.memory.getObject(valueWrappedValue); - swift.memory.release(valueWrappedValue); + const valueObjectIdObject = swift.memory.getObject(valueObjectId); + swift.memory.release(valueObjectId); + optResult = valueObjectIdObject; + } else { + optResult = null; } - swift.memory.getObject(self).optionalRawEnum = valueIsSome ? obj : null; + swift.memory.getObject(self).optionalRawEnum = optResult; } catch (error) { setException(error); } @@ -374,13 +378,16 @@ export async function createInstantiator(options, swift) { setException(error); } } - TestModule["bjs_MyViewControllerDelegate_optionalResult_set"] = function bjs_MyViewControllerDelegate_optionalResult_set(self, valueIsSome, valueWrappedValue) { + TestModule["bjs_MyViewControllerDelegate_optionalResult_set"] = function bjs_MyViewControllerDelegate_optionalResult_set(self, valueIsSome, valueCaseId) { try { - let enumValue; + let optResult; if (valueIsSome) { - enumValue = enumHelpers.Result.lift(valueWrappedValue); + const enumValue = enumHelpers.Result.lift(valueCaseId); + optResult = enumValue; + } else { + optResult = null; } - swift.memory.getObject(self).optionalResult = valueIsSome ? enumValue : null; + swift.memory.getObject(self).optionalResult = optResult; } catch (error) { setException(error); } @@ -405,7 +412,7 @@ export async function createInstantiator(options, swift) { try { let ret = swift.memory.getObject(self).directionOptional; const isSome = ret != null; - return isSome ? (ret | 0) : -1; + return isSome ? ret : -1; } catch (error) { setException(error); } @@ -509,9 +516,9 @@ export async function createInstantiator(options, swift) { return 0 } } - TestModule["bjs_MyViewControllerDelegate_onOptionalHelperUpdated"] = function bjs_MyViewControllerDelegate_onOptionalHelperUpdated(self, helperIsSome, helperWrappedValue) { + TestModule["bjs_MyViewControllerDelegate_onOptionalHelperUpdated"] = function bjs_MyViewControllerDelegate_onOptionalHelperUpdated(self, helperIsSome, helperPointer) { try { - swift.memory.getObject(self).onOptionalHelperUpdated(helperIsSome ? _exports['Helper'].__construct(helperWrappedValue) : null); + swift.memory.getObject(self).onOptionalHelperUpdated(helperIsSome ? _exports['Helper'].__construct(helperPointer) : null); } catch (error) { setException(error); } @@ -664,7 +671,13 @@ export async function createInstantiator(options, swift) { } set secondDelegate(value) { const isSome = value != null; - instance.exports.bjs_MyViewController_secondDelegate_set(this.pointer, +isSome, isSome ? swift.memory.retain(value) : 0); + let result; + if (isSome) { + result = swift.memory.retain(value); + } else { + result = 0; + } + instance.exports.bjs_MyViewController_secondDelegate_set(this.pointer, +isSome, result); } } class DelegateManager extends SwiftHeapObject { @@ -706,7 +719,7 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_DelegateManager_delegates_set(this.pointer); } } - const ResultHelpers = __bjs_createResultValuesHelpers()(); + const ResultHelpers = __bjs_createResultValuesHelpers(); enumHelpers.Result = ResultHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 109a403b4..0e8a5a7bb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -39,41 +39,39 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const __bjs_createAPIResultValuesHelpers = () => { - return () => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case APIResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - return APIResultValues.Tag.Success; - } - case APIResultValues.Tag.Failure: { - i32Stack.push((value.param0 | 0)); - return APIResultValues.Tag.Failure; - } - default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); + const __bjs_createAPIResultValuesHelpers = () => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case APIResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + return APIResultValues.Tag.Success; } - }, - lift: (tag) => { - tag = tag | 0; - switch (tag) { - case APIResultValues.Tag.Success: { - const string = strStack.pop(); - return { tag: APIResultValues.Tag.Success, param0: string }; - } - case APIResultValues.Tag.Failure: { - const int = i32Stack.pop(); - return { tag: APIResultValues.Tag.Failure, param0: int }; - } - default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); + case APIResultValues.Tag.Failure: { + i32Stack.push((value.param0 | 0)); + return APIResultValues.Tag.Failure; + } + default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); + } + }, + lift: (tag) => { + tag = tag | 0; + switch (tag) { + case APIResultValues.Tag.Success: { + const string = strStack.pop(); + return { tag: APIResultValues.Tag.Success, param0: string }; + } + case APIResultValues.Tag.Failure: { + const int = i32Stack.pop(); + return { tag: APIResultValues.Tag.Failure, param0: int }; } + default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); } - }); - }; + } + }); return { /** @@ -301,7 +299,7 @@ export async function createInstantiator(options, swift) { return ret; } } - const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(); + const APIResultHelpers = __bjs_createAPIResultValuesHelpers(); enumHelpers.APIResult = APIResultHelpers; if (typeof globalThis.Utils === 'undefined') { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index 1be36c28e..2eea1f12f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -39,41 +39,39 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const __bjs_createAPIResultValuesHelpers = () => { - return () => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case APIResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - return APIResultValues.Tag.Success; - } - case APIResultValues.Tag.Failure: { - i32Stack.push((value.param0 | 0)); - return APIResultValues.Tag.Failure; - } - default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); + const __bjs_createAPIResultValuesHelpers = () => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case APIResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + return APIResultValues.Tag.Success; } - }, - lift: (tag) => { - tag = tag | 0; - switch (tag) { - case APIResultValues.Tag.Success: { - const string = strStack.pop(); - return { tag: APIResultValues.Tag.Success, param0: string }; - } - case APIResultValues.Tag.Failure: { - const int = i32Stack.pop(); - return { tag: APIResultValues.Tag.Failure, param0: int }; - } - default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); + case APIResultValues.Tag.Failure: { + i32Stack.push((value.param0 | 0)); + return APIResultValues.Tag.Failure; + } + default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); + } + }, + lift: (tag) => { + tag = tag | 0; + switch (tag) { + case APIResultValues.Tag.Success: { + const string = strStack.pop(); + return { tag: APIResultValues.Tag.Success, param0: string }; + } + case APIResultValues.Tag.Failure: { + const int = i32Stack.pop(); + return { tag: APIResultValues.Tag.Failure, param0: int }; } + default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); } - }); - }; + } + }); return { /** @@ -301,7 +299,7 @@ export async function createInstantiator(options, swift) { return ret; } } - const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(); + const APIResultHelpers = __bjs_createAPIResultValuesHelpers(); enumHelpers.APIResult = APIResultHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index 12afbb82c..16bf8ba0c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -303,12 +303,17 @@ export async function createInstantiator(options, swift) { } static set optionalProperty(value) { const isSome = value != null; - let valueId, valueBytes; + let result, result1; if (isSome) { - valueBytes = textEncoder.encode(value); - valueId = swift.memory.retain(valueBytes); + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + result = valueId; + result1 = valueBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_PropertyClass_static_optionalProperty_set(+isSome, isSome ? valueId : 0, isSome ? valueBytes.length : 0); + instance.exports.bjs_PropertyClass_static_optionalProperty_set(+isSome, result, result1); } } if (typeof globalThis.PropertyNamespace === 'undefined') { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index e9c5d105c..ea6c448ed 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -303,12 +303,17 @@ export async function createInstantiator(options, swift) { } static set optionalProperty(value) { const isSome = value != null; - let valueId, valueBytes; + let result, result1; if (isSome) { - valueBytes = textEncoder.encode(value); - valueId = swift.memory.retain(valueBytes); + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + result = valueId; + result1 = valueBytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.bjs_PropertyClass_static_optionalProperty_set(+isSome, isSome ? valueId : 0, isSome ? valueBytes.length : 0); + instance.exports.bjs_PropertyClass_static_optionalProperty_set(+isSome, result, result1); } } const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index cd6c9062b..a74d49327 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -211,9 +211,9 @@ export async function createInstantiator(options, swift) { return 0 } } - TestModule["bjs_jsRoundTripOptionalGreeter"] = function bjs_jsRoundTripOptionalGreeter(greeterIsSome, greeterWrappedValue) { + TestModule["bjs_jsRoundTripOptionalGreeter"] = function bjs_jsRoundTripOptionalGreeter(greeterIsSome, greeterPointer) { try { - let ret = imports.jsRoundTripOptionalGreeter(greeterIsSome ? _exports['Greeter'].__construct(greeterWrappedValue) : null); + let ret = imports.jsRoundTripOptionalGreeter(greeterIsSome ? _exports['Greeter'].__construct(greeterPointer) : null); const isSome = ret != null; return isSome ? ret.pointer : 0; } catch (error) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 68bcfbe93..023a2fab0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -83,69 +83,67 @@ export async function createInstantiator(options, swift) { return swift.memory.retain(real); }; - const __bjs_createAPIResultValuesHelpers = () => { - return () => ({ - lower: (value) => { - const enumTag = value.tag; - switch (enumTag) { - case APIResultValues.Tag.Success: { - const bytes = textEncoder.encode(value.param0); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - return APIResultValues.Tag.Success; - } - case APIResultValues.Tag.Failure: { - i32Stack.push((value.param0 | 0)); - return APIResultValues.Tag.Failure; - } - case APIResultValues.Tag.Flag: { - i32Stack.push(value.param0 ? 1 : 0); - return APIResultValues.Tag.Flag; - } - case APIResultValues.Tag.Rate: { - f32Stack.push(Math.fround(value.param0)); - return APIResultValues.Tag.Rate; - } - case APIResultValues.Tag.Precise: { - f64Stack.push(value.param0); - return APIResultValues.Tag.Precise; - } - case APIResultValues.Tag.Info: { - return APIResultValues.Tag.Info; - } - default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); + const __bjs_createAPIResultValuesHelpers = () => ({ + lower: (value) => { + const enumTag = value.tag; + switch (enumTag) { + case APIResultValues.Tag.Success: { + const bytes = textEncoder.encode(value.param0); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + return APIResultValues.Tag.Success; } - }, - lift: (tag) => { - tag = tag | 0; - switch (tag) { - case APIResultValues.Tag.Success: { - const string = strStack.pop(); - return { tag: APIResultValues.Tag.Success, param0: string }; - } - case APIResultValues.Tag.Failure: { - const int = i32Stack.pop(); - return { tag: APIResultValues.Tag.Failure, param0: int }; - } - case APIResultValues.Tag.Flag: { - const bool = i32Stack.pop() !== 0; - return { tag: APIResultValues.Tag.Flag, param0: bool }; - } - case APIResultValues.Tag.Rate: { - const f32 = f32Stack.pop(); - return { tag: APIResultValues.Tag.Rate, param0: f32 }; - } - case APIResultValues.Tag.Precise: { - const f64 = f64Stack.pop(); - return { tag: APIResultValues.Tag.Precise, param0: f64 }; - } - case APIResultValues.Tag.Info: return { tag: APIResultValues.Tag.Info }; - default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); + case APIResultValues.Tag.Failure: { + i32Stack.push((value.param0 | 0)); + return APIResultValues.Tag.Failure; + } + case APIResultValues.Tag.Flag: { + i32Stack.push(value.param0 ? 1 : 0); + return APIResultValues.Tag.Flag; + } + case APIResultValues.Tag.Rate: { + f32Stack.push(Math.fround(value.param0)); + return APIResultValues.Tag.Rate; } + case APIResultValues.Tag.Precise: { + f64Stack.push(value.param0); + return APIResultValues.Tag.Precise; + } + case APIResultValues.Tag.Info: { + return APIResultValues.Tag.Info; + } + default: throw new Error("Unknown APIResultValues tag: " + String(enumTag)); } - }); - }; + }, + lift: (tag) => { + tag = tag | 0; + switch (tag) { + case APIResultValues.Tag.Success: { + const string = strStack.pop(); + return { tag: APIResultValues.Tag.Success, param0: string }; + } + case APIResultValues.Tag.Failure: { + const int = i32Stack.pop(); + return { tag: APIResultValues.Tag.Failure, param0: int }; + } + case APIResultValues.Tag.Flag: { + const bool = i32Stack.pop() !== 0; + return { tag: APIResultValues.Tag.Flag, param0: bool }; + } + case APIResultValues.Tag.Rate: { + const f32 = f32Stack.pop(); + return { tag: APIResultValues.Tag.Rate, param0: f32 }; + } + case APIResultValues.Tag.Precise: { + const f64 = f64Stack.pop(); + return { tag: APIResultValues.Tag.Precise, param0: f64 }; + } + case APIResultValues.Tag.Info: return { tag: APIResultValues.Tag.Info }; + default: throw new Error("Unknown APIResultValues tag returned from Swift: " + String(tag)); + } + } + }); return { /** @@ -577,21 +575,20 @@ export async function createInstantiator(options, swift) { }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO); } - bjs["invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO"] = function(callbackId, param0IsSome, param0WrappedValue) { + bjs["invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO"] = function(callbackId, param0IsSome, param0ObjectId) { try { const callback = swift.memory.getObject(callbackId); - let obj; + let optResult; if (param0IsSome) { - obj = swift.memory.getObject(param0WrappedValue); - swift.memory.release(param0WrappedValue); - } - let ret = callback(param0IsSome ? obj : null); - const isSome = ret != null; - if (isSome) { - tmpRetString = ret; + const param0ObjectIdObject = swift.memory.getObject(param0ObjectId); + swift.memory.release(param0ObjectId); + optResult = param0ObjectIdObject; } else { - tmpRetString = null; + optResult = null; } + let ret = callback(optResult); + const isSome = ret != null; + tmpRetString = isSome ? ret : null; } catch (error) { setException(error); } @@ -599,12 +596,17 @@ export async function createInstantiator(options, swift) { bjs["make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO = function(param0) { const isSome = param0 != null; - let param0Id, param0Bytes; + let result, result1; if (isSome) { - param0Bytes = textEncoder.encode(param0); - param0Id = swift.memory.retain(param0Bytes); + const param0Bytes = textEncoder.encode(param0); + const param0Id = swift.memory.retain(param0Bytes); + result = param0Id; + result1 = param0Bytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(boxPtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(boxPtr, +isSome, result, result1); const optResult = tmpRetString; tmpRetString = undefined; if (tmpRetException) { @@ -617,10 +619,10 @@ export async function createInstantiator(options, swift) { }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO); } - bjs["invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC"] = function(callbackId, param0IsSome, param0WrappedValue) { + bjs["invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC"] = function(callbackId, param0IsSome, param0Pointer) { try { const callback = swift.memory.getObject(callbackId); - let ret = callback(param0IsSome ? _exports['Person'].__construct(param0WrappedValue) : null); + let ret = callback(param0IsSome ? _exports['Person'].__construct(param0Pointer) : null); const isSome = ret != null; return isSome ? ret.pointer : 0; } catch (error) { @@ -630,7 +632,13 @@ export async function createInstantiator(options, swift) { bjs["make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC = function(param0) { const isSome = param0 != null; - instance.exports.invoke_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC(boxPtr, +isSome, isSome ? param0.pointer : 0); + let result; + if (isSome) { + result = param0.pointer; + } else { + result = 0; + } + instance.exports.invoke_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC(boxPtr, +isSome, result); const pointer = tmpRetOptionalHeapObject; tmpRetOptionalHeapObject = undefined; const optResult = pointer === null ? null : _exports['Person'].__construct(pointer); @@ -644,14 +652,17 @@ export async function createInstantiator(options, swift) { }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC); } - bjs["invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO"] = function(callbackId, param0IsSome, param0WrappedValue) { + bjs["invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO"] = function(callbackId, param0IsSome, param0CaseId) { try { const callback = swift.memory.getObject(callbackId); - let enumValue; + let optResult; if (param0IsSome) { - enumValue = enumHelpers.APIResult.lift(param0WrappedValue); + const enumValue = enumHelpers.APIResult.lift(param0CaseId); + optResult = enumValue; + } else { + optResult = null; } - let ret = callback(param0IsSome ? enumValue : null); + let ret = callback(optResult); const isSome = ret != null; if (isSome) { const caseId = enumHelpers.APIResult.lower(ret); @@ -666,19 +677,16 @@ export async function createInstantiator(options, swift) { bjs["make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO = function(param0) { const isSome = param0 != null; - let param0CaseId; + let result; if (isSome) { - param0CaseId = enumHelpers.APIResult.lower(param0); - } - instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(boxPtr, +isSome, isSome ? param0CaseId : 0); - const tag = i32Stack.pop(); - const isNull = (tag === -1); - let optResult; - if (isNull) { - optResult = null; + const param0CaseId = enumHelpers.APIResult.lower(param0); + result = param0CaseId; } else { - optResult = enumHelpers.APIResult.lift(tag); + result = 0; } + instance.exports.invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(boxPtr, +isSome, result); + const tag = i32Stack.pop(); + const optResult = tag === -1 ? null : enumHelpers.APIResult.lift(tag); if (tmpRetException) { const error = swift.memory.getObject(tmpRetException); swift.memory.release(tmpRetException); @@ -694,7 +702,7 @@ export async function createInstantiator(options, swift) { const callback = swift.memory.getObject(callbackId); let ret = callback(param0IsSome ? param0WrappedValue : null); const isSome = ret != null; - return isSome ? (ret | 0) : -1; + return isSome ? ret : -1; } catch (error) { setException(error); } @@ -715,21 +723,20 @@ export async function createInstantiator(options, swift) { }; return makeClosure(boxPtr, file, line, lower_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO); } - bjs["invoke_js_callback_TestModule_10TestModuleSqSS_SqSS"] = function(callbackId, param0IsSome, param0WrappedValue) { + bjs["invoke_js_callback_TestModule_10TestModuleSqSS_SqSS"] = function(callbackId, param0IsSome, param0ObjectId) { try { const callback = swift.memory.getObject(callbackId); - let obj; + let optResult; if (param0IsSome) { - obj = swift.memory.getObject(param0WrappedValue); - swift.memory.release(param0WrappedValue); - } - let ret = callback(param0IsSome ? obj : null); - const isSome = ret != null; - if (isSome) { - tmpRetString = ret; + const param0ObjectIdObject = swift.memory.getObject(param0ObjectId); + swift.memory.release(param0ObjectId); + optResult = param0ObjectIdObject; } else { - tmpRetString = null; + optResult = null; } + let ret = callback(optResult); + const isSome = ret != null; + tmpRetString = isSome ? ret : null; } catch (error) { setException(error); } @@ -737,12 +744,17 @@ export async function createInstantiator(options, swift) { bjs["make_swift_closure_TestModule_10TestModuleSqSS_SqSS"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSqSS_SqSS = function(param0) { const isSome = param0 != null; - let param0Id, param0Bytes; + let result, result1; if (isSome) { - param0Bytes = textEncoder.encode(param0); - param0Id = swift.memory.retain(param0Bytes); + const param0Bytes = textEncoder.encode(param0); + const param0Id = swift.memory.retain(param0Bytes); + result = param0Id; + result1 = param0Bytes.length; + } else { + result = 0; + result1 = 0; } - instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSS_SqSS(boxPtr, +isSome, isSome ? param0Id : 0, isSome ? param0Bytes.length : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSS_SqSS(boxPtr, +isSome, result, result1); const optResult = tmpRetString; tmpRetString = undefined; if (tmpRetException) { @@ -768,7 +780,7 @@ export async function createInstantiator(options, swift) { bjs["make_swift_closure_TestModule_10TestModuleSqSb_SqSb"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSqSb_SqSb = function(param0) { const isSome = param0 != null; - instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSb_SqSb(boxPtr, +isSome, isSome ? param0 : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSb_SqSb(boxPtr, +isSome, isSome ? param0 ? 1 : 0 : 0); const optResult = tmpRetOptionalBool; tmpRetOptionalBool = undefined; if (tmpRetException) { @@ -794,7 +806,7 @@ export async function createInstantiator(options, swift) { bjs["make_swift_closure_TestModule_10TestModuleSqSd_SqSd"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSqSd_SqSd = function(param0) { const isSome = param0 != null; - instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSd_SqSd(boxPtr, +isSome, isSome ? param0 : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSd_SqSd(boxPtr, +isSome, isSome ? param0 : 0.0); const optResult = tmpRetOptionalDouble; tmpRetOptionalDouble = undefined; if (tmpRetException) { @@ -820,7 +832,7 @@ export async function createInstantiator(options, swift) { bjs["make_swift_closure_TestModule_10TestModuleSqSf_SqSf"] = function(boxPtr, file, line) { const lower_closure_TestModule_10TestModuleSqSf_SqSf = function(param0) { const isSome = param0 != null; - instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSf_SqSf(boxPtr, +isSome, isSome ? param0 : 0); + instance.exports.invoke_swift_closure_TestModule_10TestModuleSqSf_SqSf(boxPtr, +isSome, isSome ? param0 : 0.0); const optResult = tmpRetOptionalFloat; tmpRetOptionalFloat = undefined; if (tmpRetException) { @@ -935,7 +947,7 @@ export async function createInstantiator(options, swift) { return TestProcessor.__construct(ret); } } - const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(); + const APIResultHelpers = __bjs_createAPIResultValuesHelpers(); enumHelpers.APIResult = APIResultHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index dbbbd6bc9..cc973e379 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -33,226 +33,214 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const __bjs_createDataPointHelpers = () => { - return () => ({ - lower: (value) => { - f64Stack.push(value.x); - f64Stack.push(value.y); - const bytes = textEncoder.encode(value.label); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - const isSome = value.optCount != null; - if (isSome) { - i32Stack.push(value.optCount | 0); - } else { - i32Stack.push(0); - } - i32Stack.push(isSome ? 1 : 0); - const isSome1 = value.optFlag != null; - if (isSome1) { - i32Stack.push(value.optFlag ? 1 : 0); - } else { - i32Stack.push(0); - } - i32Stack.push(isSome1 ? 1 : 0); - }, - lift: () => { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const bool = i32Stack.pop() !== 0; - optional = bool; - } else { - optional = null; - } - const isSome1 = i32Stack.pop(); - let optional1; - if (isSome1) { - const int = i32Stack.pop(); - optional1 = int; - } else { - optional1 = null; - } - const string = strStack.pop(); - const f64 = f64Stack.pop(); - const f641 = f64Stack.pop(); - return { x: f641, y: f64, label: string, optCount: optional1, optFlag: optional }; - } - }); - }; - const __bjs_createAddressHelpers = () => { - return () => ({ - lower: (value) => { - const bytes = textEncoder.encode(value.street); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - const bytes1 = textEncoder.encode(value.city); + const __bjs_createDataPointHelpers = () => ({ + lower: (value) => { + f64Stack.push(value.x); + f64Stack.push(value.y); + const bytes = textEncoder.encode(value.label); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + const isSome = value.optCount != null; + if (isSome) { + i32Stack.push((value.optCount | 0)); + } else { + i32Stack.push(0); + } + i32Stack.push(isSome ? 1 : 0); + const isSome1 = value.optFlag != null; + if (isSome1) { + i32Stack.push(value.optFlag ? 1 : 0); + } else { + i32Stack.push(0); + } + i32Stack.push(isSome1 ? 1 : 0); + }, + lift: () => { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { + const bool = i32Stack.pop() !== 0; + optional = bool; + } else { + optional = null; + } + const isSome1 = i32Stack.pop(); + let optional1; + if (isSome1) { + const int = i32Stack.pop(); + optional1 = int; + } else { + optional1 = null; + } + const string = strStack.pop(); + const f64 = f64Stack.pop(); + const f641 = f64Stack.pop(); + return { x: f641, y: f64, label: string, optCount: optional1, optFlag: optional }; + } + }); + const __bjs_createAddressHelpers = () => ({ + lower: (value) => { + const bytes = textEncoder.encode(value.street); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + const bytes1 = textEncoder.encode(value.city); + const id1 = swift.memory.retain(bytes1); + i32Stack.push(bytes1.length); + i32Stack.push(id1); + const isSome = value.zipCode != null; + if (isSome) { + i32Stack.push((value.zipCode | 0)); + } else { + i32Stack.push(0); + } + i32Stack.push(isSome ? 1 : 0); + }, + lift: () => { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { + const int = i32Stack.pop(); + optional = int; + } else { + optional = null; + } + const string = strStack.pop(); + const string1 = strStack.pop(); + return { street: string1, city: string, zipCode: optional }; + } + }); + const __bjs_createPersonHelpers = () => ({ + lower: (value) => { + const bytes = textEncoder.encode(value.name); + const id = swift.memory.retain(bytes); + i32Stack.push(bytes.length); + i32Stack.push(id); + i32Stack.push((value.age | 0)); + structHelpers.Address.lower(value.address); + const isSome = value.email != null; + if (isSome) { + const bytes1 = textEncoder.encode(value.email); const id1 = swift.memory.retain(bytes1); i32Stack.push(bytes1.length); i32Stack.push(id1); - const isSome = value.zipCode != null; - if (isSome) { - i32Stack.push(value.zipCode | 0); - } else { - i32Stack.push(0); - } - i32Stack.push(isSome ? 1 : 0); - }, - lift: () => { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const int = i32Stack.pop(); - optional = int; - } else { - optional = null; - } + } else { + i32Stack.push(0); + i32Stack.push(0); + } + i32Stack.push(isSome ? 1 : 0); + }, + lift: () => { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { const string = strStack.pop(); - const string1 = strStack.pop(); - return { street: string1, city: string, zipCode: optional }; - } - }); - }; - const __bjs_createPersonHelpers = () => { - return () => ({ - lower: (value) => { - const bytes = textEncoder.encode(value.name); - const id = swift.memory.retain(bytes); - i32Stack.push(bytes.length); - i32Stack.push(id); - i32Stack.push((value.age | 0)); - structHelpers.Address.lower(value.address); - const isSome = value.email != null; - let id1; - if (isSome) { - const bytes1 = textEncoder.encode(value.email); - id1 = swift.memory.retain(bytes1); - i32Stack.push(bytes1.length); - i32Stack.push(id1); - } else { - i32Stack.push(0); - i32Stack.push(0); - } - i32Stack.push(isSome ? 1 : 0); - }, - lift: () => { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const string = strStack.pop(); - optional = string; - } else { - optional = null; - } - const struct = structHelpers.Address.lift(); - const int = i32Stack.pop(); - const string1 = strStack.pop(); - return { name: string1, age: int, address: struct, email: optional }; - } - }); - }; - const __bjs_createSessionHelpers = () => { - return () => ({ - lower: (value) => { - i32Stack.push((value.id | 0)); - ptrStack.push(value.owner.pointer); - }, - lift: () => { - const ptr = ptrStack.pop(); - const obj = _exports['Greeter'].__construct(ptr); - const int = i32Stack.pop(); - return { id: int, owner: obj }; - } - }); - }; - const __bjs_createMeasurementHelpers = () => { - return () => ({ - lower: (value) => { - f64Stack.push(value.value); - f32Stack.push(Math.fround(value.precision)); - const isSome = value.optionalPrecision != null; - if (isSome) { - f32Stack.push(Math.fround(value.optionalPrecision)); - } else { - f32Stack.push(0.0); - } - i32Stack.push(isSome ? 1 : 0); - }, - lift: () => { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const rawValue = f32Stack.pop(); - optional = rawValue; - } else { - optional = null; - } - const rawValue1 = f32Stack.pop(); - const f64 = f64Stack.pop(); - return { value: f64, precision: rawValue1, optionalPrecision: optional }; - } - }); - }; - const __bjs_createConfigStructHelpers = () => { - return () => ({ - lower: (value) => { - }, - lift: () => { - return { }; - } - }); - }; - const __bjs_createContainerHelpers = () => { - return () => ({ - lower: (value) => { - let id; - if (value.object != null) { - id = swift.memory.retain(value.object); - } else { - id = undefined; - } - i32Stack.push(id !== undefined ? id : 0); - const isSome = value.optionalObject != null; + optional = string; + } else { + optional = null; + } + const struct = structHelpers.Address.lift(); + const int = i32Stack.pop(); + const string1 = strStack.pop(); + return { name: string1, age: int, address: struct, email: optional }; + } + }); + const __bjs_createSessionHelpers = () => ({ + lower: (value) => { + i32Stack.push((value.id | 0)); + ptrStack.push(value.owner.pointer); + }, + lift: () => { + const ptr = ptrStack.pop(); + const obj = _exports['Greeter'].__construct(ptr); + const int = i32Stack.pop(); + return { id: int, owner: obj }; + } + }); + const __bjs_createMeasurementHelpers = () => ({ + lower: (value) => { + f64Stack.push(value.value); + f32Stack.push(Math.fround(value.precision)); + const isSome = value.optionalPrecision != null; + if (isSome) { + f32Stack.push(Math.fround(value.optionalPrecision)); + } else { + f32Stack.push(0.0); + } + i32Stack.push(isSome ? 1 : 0); + }, + lift: () => { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { + const rawValue = f32Stack.pop(); + optional = rawValue; + } else { + optional = null; + } + const rawValue1 = f32Stack.pop(); + const f64 = f64Stack.pop(); + return { value: f64, precision: rawValue1, optionalPrecision: optional }; + } + }); + const __bjs_createConfigStructHelpers = () => ({ + lower: (value) => { + }, + lift: () => { + return { }; + } + }); + const __bjs_createContainerHelpers = () => ({ + lower: (value) => { + let id; + if (value.object != null) { + id = swift.memory.retain(value.object); + } else { + id = undefined; + } + i32Stack.push(id !== undefined ? id : 0); + const isSome = value.optionalObject != null; + if (isSome) { let id1; - if (isSome) { + if (value.optionalObject != null) { id1 = swift.memory.retain(value.optionalObject); - i32Stack.push(id1); } else { id1 = undefined; - i32Stack.push(0); - } - i32Stack.push(isSome ? 1 : 0); - }, - lift: () => { - const isSome = i32Stack.pop(); - let optional; - if (isSome) { - const objectId = i32Stack.pop(); - let value; - if (objectId !== 0) { - value = swift.memory.getObject(objectId); - swift.memory.release(objectId); - } else { - value = null; - } - optional = value; - } else { - optional = null; } - const objectId1 = i32Stack.pop(); - let value1; - if (objectId1 !== 0) { - value1 = swift.memory.getObject(objectId1); - swift.memory.release(objectId1); + i32Stack.push(id1 !== undefined ? id1 : 0); + } else { + i32Stack.push(0); + } + i32Stack.push(isSome ? 1 : 0); + }, + lift: () => { + const isSome = i32Stack.pop(); + let optional; + if (isSome) { + const objectId = i32Stack.pop(); + let value; + if (objectId !== 0) { + value = swift.memory.getObject(objectId); + swift.memory.release(objectId); } else { - value1 = null; + value = null; } - return { object: value1, optionalObject: optional }; - } - }); - }; + optional = value; + } else { + optional = null; + } + const objectId1 = i32Stack.pop(); + let value1; + if (objectId1 !== 0) { + value1 = swift.memory.getObject(objectId1); + swift.memory.release(objectId1); + } else { + value1 = null; + } + return { object: value1, optionalObject: optional }; + } + }); return { /** @@ -536,25 +524,25 @@ export async function createInstantiator(options, swift) { instance.exports.bjs_Greeter_name_set(this.pointer, valueId, valueBytes.length); } } - const DataPointHelpers = __bjs_createDataPointHelpers()(); + const DataPointHelpers = __bjs_createDataPointHelpers(); structHelpers.DataPoint = DataPointHelpers; - const AddressHelpers = __bjs_createAddressHelpers()(); + const AddressHelpers = __bjs_createAddressHelpers(); structHelpers.Address = AddressHelpers; - const PersonHelpers = __bjs_createPersonHelpers()(); + const PersonHelpers = __bjs_createPersonHelpers(); structHelpers.Person = PersonHelpers; - const SessionHelpers = __bjs_createSessionHelpers()(); + const SessionHelpers = __bjs_createSessionHelpers(); structHelpers.Session = SessionHelpers; - const MeasurementHelpers = __bjs_createMeasurementHelpers()(); + const MeasurementHelpers = __bjs_createMeasurementHelpers(); structHelpers.Measurement = MeasurementHelpers; - const ConfigStructHelpers = __bjs_createConfigStructHelpers()(); + const ConfigStructHelpers = __bjs_createConfigStructHelpers(); structHelpers.ConfigStruct = ConfigStructHelpers; - const ContainerHelpers = __bjs_createContainerHelpers()(); + const ContainerHelpers = __bjs_createContainerHelpers(); structHelpers.Container = ContainerHelpers; const exports = { @@ -578,7 +566,7 @@ export async function createInstantiator(options, swift) { const labelId = swift.memory.retain(labelBytes); const isSome = optCount != null; const isSome1 = optFlag != null; - instance.exports.bjs_DataPoint_init(x, y, labelId, labelBytes.length, +isSome, isSome ? optCount : 0, +isSome1, isSome1 ? optFlag : 0); + instance.exports.bjs_DataPoint_init(x, y, labelId, labelBytes.length, +isSome, isSome ? optCount : 0, +isSome1, isSome1 ? optFlag ? 1 : 0 : 0); const structValue = structHelpers.DataPoint.lift(); return structValue; }, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index cf64ab587..d00b7450d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -28,19 +28,17 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const __bjs_createPointHelpers = () => { - return () => ({ - lower: (value) => { - i32Stack.push((value.x | 0)); - i32Stack.push((value.y | 0)); - }, - lift: () => { - const int = i32Stack.pop(); - const int1 = i32Stack.pop(); - return { x: int1, y: int }; - } - }); - }; + const __bjs_createPointHelpers = () => ({ + lower: (value) => { + i32Stack.push((value.x | 0)); + i32Stack.push((value.y | 0)); + }, + lift: () => { + const int = i32Stack.pop(); + const int1 = i32Stack.pop(); + return { x: int1, y: int }; + } + }); return { /** @@ -228,7 +226,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const PointHelpers = __bjs_createPointHelpers()(); + const PointHelpers = __bjs_createPointHelpers(); structHelpers.Point = PointHelpers; const exports = { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index 30c40a18c..c141a7926 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -28,25 +28,23 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const __bjs_createPointerFieldsHelpers = () => { - return () => ({ - lower: (value) => { - ptrStack.push((value.raw | 0)); - ptrStack.push((value.mutRaw | 0)); - ptrStack.push((value.opaque | 0)); - ptrStack.push((value.ptr | 0)); - ptrStack.push((value.mutPtr | 0)); - }, - lift: () => { - const pointer = ptrStack.pop(); - const pointer1 = ptrStack.pop(); - const pointer2 = ptrStack.pop(); - const pointer3 = ptrStack.pop(); - const pointer4 = ptrStack.pop(); - return { raw: pointer4, mutRaw: pointer3, opaque: pointer2, ptr: pointer1, mutPtr: pointer }; - } - }); - }; + const __bjs_createPointerFieldsHelpers = () => ({ + lower: (value) => { + ptrStack.push((value.raw | 0)); + ptrStack.push((value.mutRaw | 0)); + ptrStack.push((value.opaque | 0)); + ptrStack.push((value.ptr | 0)); + ptrStack.push((value.mutPtr | 0)); + }, + lift: () => { + const pointer = ptrStack.pop(); + const pointer1 = ptrStack.pop(); + const pointer2 = ptrStack.pop(); + const pointer3 = ptrStack.pop(); + const pointer4 = ptrStack.pop(); + return { raw: pointer4, mutRaw: pointer3, opaque: pointer2, ptr: pointer1, mutPtr: pointer }; + } + }); return { /** @@ -222,7 +220,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const PointerFieldsHelpers = __bjs_createPointerFieldsHelpers()(); + const PointerFieldsHelpers = __bjs_createPointerFieldsHelpers(); structHelpers.PointerFields = PointerFieldsHelpers; const exports = { From 017f1721628e880e8829efa5674efb8a035489b4 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 19 Feb 2026 12:44:21 +0900 Subject: [PATCH 248/252] TS2Swift tests: warn on export assignment --- .../test/__snapshots__/ts2swift.test.js.snap | 13 +++++++++++++ .../test/fixtures/ExportAssignment.d.ts | 2 ++ .../TS2Swift/JavaScript/test/ts2swift.test.js | 17 ++++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ExportAssignment.d.ts diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap index 7f7a7de62..4122f4148 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap @@ -121,6 +121,19 @@ exports[`ts2swift > snapshots Swift output for Documentation.d.ts > Documentatio " `; +exports[`ts2swift > snapshots Swift output for ExportAssignment.d.ts > ExportAssignment 1`] = ` +"// 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 + +@JSGetter var foo: Double +" +`; + exports[`ts2swift > snapshots Swift output for Interface.d.ts > Interface 1`] = ` "// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ExportAssignment.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ExportAssignment.d.ts new file mode 100644 index 000000000..5f9543ecb --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/ExportAssignment.d.ts @@ -0,0 +1,2 @@ +export const foo: number; +export default foo; diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js index d0ccf220a..8882124ed 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js @@ -1,5 +1,5 @@ // @ts-check -import { describe, it, expect } from 'vitest'; +import { describe, it, expect, vi } from 'vitest'; import { readdirSync, mkdtempSync, writeFileSync, rmSync } from 'fs'; import { fileURLToPath } from 'url'; import path from 'path'; @@ -50,4 +50,19 @@ describe('ts2swift', () => { rmSync(tmpDir, { recursive: true, force: true }); } }); + + it('emits a warning when export assignments cannot be generated', () => { + const dtsPath = path.join(inputsDir, 'ExportAssignment.d.ts'); + const stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true); + try { + run([dtsPath], { tsconfigPath, logLevel: 'warning' }); + const combined = stderrSpy.mock.calls.map(args => String(args[0])).join(''); + expect(combined).toMatch(/Skipping export assignment/); + // Only warn once for the export assignment node + const occurrences = (combined.match(/Skipping export assignment/g) || []).length; + expect(occurrences).toBe(1); + } finally { + stderrSpy.mockRestore(); + } + }); }); From 2a92246ec8d2e75bc9fea6abe48edc8497376d1e Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 19 Feb 2026 12:48:20 +0900 Subject: [PATCH 249/252] [NFC] BridgeJS: Use consistent codegen helper for @_extern decl --- .../Sources/BridgeJSCore/ClosureCodegen.swift | 23 +- .../Sources/BridgeJSCore/ExportSwift.swift | 48 +---- .../Sources/BridgeJSCore/ImportTS.swift | 40 ++-- .../BridgeJSCodegenTests/Protocol.swift | 198 ++++++++++++++++++ .../Generated/BridgeJS.swift | 180 ++++++++++++++++ 5 files changed, 418 insertions(+), 71 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift index cbec4ba31..59b889ec6 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift @@ -46,17 +46,16 @@ public struct ClosureCodegen { // Generate extern declaration using CallJSEmission let externDecl = builder.renderImportDecl() - - let makeClosureExternDecl: DeclSyntax = """ - #if arch(wasm32) - @_extern(wasm, module: "bjs", name: "make_swift_closure_\(raw: signature.moduleName)_\(raw: signature.mangleName)") - fileprivate func make_swift_closure_\(raw: signature.moduleName)_\(raw: signature.mangleName)(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 - #else - fileprivate func make_swift_closure_\(raw: signature.moduleName)_\(raw: signature.mangleName)(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") - } - #endif - """ + let externABIName = "make_swift_closure_\(signature.moduleName)_\(signature.mangleName)" + let externDeclPrinter = CodeFragmentPrinter() + SwiftCodePattern.buildExternFunctionDecl( + printer: externDeclPrinter, + moduleName: "bjs", + abiName: externABIName, + functionName: externABIName, + signature: "(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32" + ) + let makeClosureExternDecl: DeclSyntax = "\(raw: externDeclPrinter.lines.joined(separator: "\n"))" let helperEnumDeclPrinter = CodeFragmentPrinter() helperEnumDeclPrinter.write("private enum \(helperName) {") @@ -98,7 +97,7 @@ public struct ClosureCodegen { extension JSTypedClosure where Signature == \(raw: swiftClosureType) { init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping \(raw: swiftClosureType)) { self.init( - makeClosure: make_swift_closure_\(raw: signature.moduleName)_\(raw: signature.mangleName), + makeClosure: \(raw: externABIName), body: body, fileID: fileID, line: line diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 525f6b73b..62ec2d3e6 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -701,26 +701,12 @@ public class ExportSwift { ) let externDeclPrinter = CodeFragmentPrinter() - SwiftCodePattern.buildWasmConditionalCompilationDecls( + SwiftCodePattern.buildExternFunctionDecl( printer: externDeclPrinter, - wasmDecl: { printer in - SwiftCodePattern.buildExternFunctionDecl( - printer: printer, - moduleName: moduleName, - abiName: externFunctionName, - functionName: wrapFunctionName, - signature: funcSignature - ) - }, - elseDecl: { printer in - printer.write( - multilineString: """ - fileprivate func \(wrapFunctionName)\(funcSignature) { - fatalError("Only available on WebAssembly") - } - """ - ) - } + moduleName: moduleName, + abiName: externFunctionName, + functionName: wrapFunctionName, + signature: funcSignature ) let externDecl: DeclSyntax = "\(raw: externDeclPrinter.lines.joined(separator: "\n"))" return [extensionDecl, externDecl] @@ -1297,26 +1283,12 @@ struct StructCodegen { functionName: String, signature: String ) { - SwiftCodePattern.buildWasmConditionalCompilationDecls( + SwiftCodePattern.buildExternFunctionDecl( printer: printer, - wasmDecl: { printer in - SwiftCodePattern.buildExternFunctionDecl( - printer: printer, - moduleName: "bjs", - abiName: externName, - functionName: functionName, - signature: signature - ) - }, - elseDecl: { printer in - printer.write( - multilineString: """ - fileprivate func \(functionName)\(signature) { - fatalError("Only available on WebAssembly") - } - """ - ) - } + moduleName: "bjs", + abiName: externName, + functionName: functionName, + signature: signature ) } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index 8eead20b7..ed5d5ff36 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -228,26 +228,12 @@ public struct ImportTS { ) let printer = CodeFragmentPrinter() - SwiftCodePattern.buildWasmConditionalCompilationDecls( + SwiftCodePattern.buildExternFunctionDecl( printer: printer, - wasmDecl: { printer in - SwiftCodePattern.buildExternFunctionDecl( - printer: printer, - moduleName: moduleName, - abiName: abiName, - functionName: abiName, - signature: signature - ) - }, - elseDecl: { printer in - printer.write( - multilineString: """ - fileprivate func \(abiName)\(signature) { - fatalError("Only available on WebAssembly") - } - """ - ) - } + moduleName: moduleName, + abiName: abiName, + functionName: abiName, + signature: signature ) return "\(raw: printer.lines.joined(separator: "\n"))" } @@ -658,8 +644,20 @@ enum SwiftCodePattern { functionName: String, signature: String ) { - printer.write(buildExternAttribute(moduleName: moduleName, abiName: abiName)) - printer.write("fileprivate func \(functionName)\(signature)") + buildWasmConditionalCompilationDecls( + printer: printer, + wasmDecl: { printer in + printer.write(buildExternAttribute(moduleName: moduleName, abiName: abiName)) + printer.write("fileprivate func \(functionName)\(signature)") + }, + elseDecl: { printer in + printer.write("fileprivate func \(functionName)\(signature) {") + printer.indent { + printer.write("fatalError(\"Only available on WebAssembly\")") + } + printer.write("}") + } + ) } /// Builds the standard @_expose and @_cdecl attributes for WebAssembly-exposed functions diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift index 65ff9e67c..56aeb71cc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift @@ -217,104 +217,302 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto } } +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onSomethingHappened") fileprivate func _extern_onSomethingHappened(_ jsObject: Int32) -> Void +#else +fileprivate func _extern_onSomethingHappened(_ jsObject: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onValueChanged") fileprivate func _extern_onValueChanged(_ jsObject: Int32, _ value: Int32) -> Void +#else +fileprivate func _extern_onValueChanged(_ jsObject: Int32, _ value: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onCountUpdated") fileprivate func _extern_onCountUpdated(_ jsObject: Int32, _ count: Int32) -> Int32 +#else +fileprivate func _extern_onCountUpdated(_ jsObject: Int32, _ count: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onLabelUpdated") fileprivate func _extern_onLabelUpdated(_ jsObject: Int32, _ prefix: Int32, _ suffix: Int32) -> Void +#else +fileprivate func _extern_onLabelUpdated(_ jsObject: Int32, _ prefix: Int32, _ suffix: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_isCountEven") fileprivate func _extern_isCountEven(_ jsObject: Int32) -> Int32 +#else +fileprivate func _extern_isCountEven(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onHelperUpdated") fileprivate func _extern_onHelperUpdated(_ jsObject: Int32, _ helper: UnsafeMutableRawPointer) -> Void +#else +fileprivate func _extern_onHelperUpdated(_ jsObject: Int32, _ helper: UnsafeMutableRawPointer) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createHelper") fileprivate func _extern_createHelper(_ jsObject: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func _extern_createHelper(_ jsObject: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onOptionalHelperUpdated") fileprivate func _extern_onOptionalHelperUpdated(_ jsObject: Int32, _ helperIsSome: Int32, _ helperPointer: UnsafeMutableRawPointer) -> Void +#else +fileprivate func _extern_onOptionalHelperUpdated(_ jsObject: Int32, _ helperIsSome: Int32, _ helperPointer: UnsafeMutableRawPointer) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createOptionalHelper") fileprivate func _extern_createOptionalHelper(_ jsObject: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func _extern_createOptionalHelper(_ jsObject: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createEnum") fileprivate func _extern_createEnum(_ jsObject: Int32) -> Int32 +#else +fileprivate func _extern_createEnum(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_handleResult") fileprivate func _extern_handleResult(_ jsObject: Int32, _ result: Int32) -> Void +#else +fileprivate func _extern_handleResult(_ jsObject: Int32, _ result: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_getResult") fileprivate func _extern_getResult(_ jsObject: Int32) -> Int32 +#else +fileprivate func _extern_getResult(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_get") fileprivate func bjs_MyViewControllerDelegate_eventCount_get(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_MyViewControllerDelegate_eventCount_get(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_set") fileprivate func bjs_MyViewControllerDelegate_eventCount_set(_ jsObject: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_MyViewControllerDelegate_eventCount_set(_ jsObject: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_delegateName_get") fileprivate func bjs_MyViewControllerDelegate_delegateName_get(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_MyViewControllerDelegate_delegateName_get(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_get") fileprivate func bjs_MyViewControllerDelegate_optionalName_get(_ jsObject: Int32) -> Void +#else +fileprivate func bjs_MyViewControllerDelegate_optionalName_get(_ jsObject: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_set") fileprivate func bjs_MyViewControllerDelegate_optionalName_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_MyViewControllerDelegate_optionalName_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalRawEnum_get") fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_get(_ jsObject: Int32) -> Void +#else +fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_get(_ jsObject: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalRawEnum_set") fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_rawStringEnum_get") fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_get(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_get(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_rawStringEnum_set") fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_set(_ jsObject: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_set(_ jsObject: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_get") fileprivate func bjs_MyViewControllerDelegate_result_get(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_MyViewControllerDelegate_result_get(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_set") fileprivate func bjs_MyViewControllerDelegate_result_set(_ jsObject: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_MyViewControllerDelegate_result_set(_ jsObject: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalResult_get") fileprivate func bjs_MyViewControllerDelegate_optionalResult_get(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_MyViewControllerDelegate_optionalResult_get(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalResult_set") fileprivate func bjs_MyViewControllerDelegate_optionalResult_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void +#else +fileprivate func bjs_MyViewControllerDelegate_optionalResult_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_direction_get") fileprivate func bjs_MyViewControllerDelegate_direction_get(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_MyViewControllerDelegate_direction_get(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_direction_set") fileprivate func bjs_MyViewControllerDelegate_direction_set(_ jsObject: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_MyViewControllerDelegate_direction_set(_ jsObject: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_directionOptional_get") fileprivate func bjs_MyViewControllerDelegate_directionOptional_get(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_MyViewControllerDelegate_directionOptional_get(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_directionOptional_set") fileprivate func bjs_MyViewControllerDelegate_directionOptional_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_MyViewControllerDelegate_directionOptional_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priority_get") fileprivate func bjs_MyViewControllerDelegate_priority_get(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_MyViewControllerDelegate_priority_get(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priority_set") fileprivate func bjs_MyViewControllerDelegate_priority_set(_ jsObject: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_MyViewControllerDelegate_priority_set(_ jsObject: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priorityOptional_get") fileprivate func bjs_MyViewControllerDelegate_priorityOptional_get(_ jsObject: Int32) -> Void +#else +fileprivate func bjs_MyViewControllerDelegate_priorityOptional_get(_ jsObject: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priorityOptional_set") fileprivate func bjs_MyViewControllerDelegate_priorityOptional_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_MyViewControllerDelegate_priorityOptional_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif extension Direction: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 253087c0d..12ec21574 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -1689,95 +1689,275 @@ struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { } } +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_increment") fileprivate func _extern_increment(_ jsObject: Int32, _ amount: Int32) -> Void +#else +fileprivate func _extern_increment(_ jsObject: Int32, _ amount: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getValue") fileprivate func _extern_getValue(_ jsObject: Int32) -> Int32 +#else +fileprivate func _extern_getValue(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_setLabelElements") fileprivate func _extern_setLabelElements(_ jsObject: Int32, _ labelPrefix: Int32, _ labelSuffix: Int32) -> Void +#else +fileprivate func _extern_setLabelElements(_ jsObject: Int32, _ labelPrefix: Int32, _ labelSuffix: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getLabel") fileprivate func _extern_getLabel(_ jsObject: Int32) -> Int32 +#else +fileprivate func _extern_getLabel(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_isEven") fileprivate func _extern_isEven(_ jsObject: Int32) -> Int32 +#else +fileprivate func _extern_isEven(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processGreeter") fileprivate func _extern_processGreeter(_ jsObject: Int32, _ greeter: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _extern_processGreeter(_ jsObject: Int32, _ greeter: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createGreeter") fileprivate func _extern_createGreeter(_ jsObject: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func _extern_createGreeter(_ jsObject: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processOptionalGreeter") fileprivate func _extern_processOptionalGreeter(_ jsObject: Int32, _ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _extern_processOptionalGreeter(_ jsObject: Int32, _ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createOptionalGreeter") fileprivate func _extern_createOptionalGreeter(_ jsObject: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func _extern_createOptionalGreeter(_ jsObject: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_handleAPIResult") fileprivate func _extern_handleAPIResult(_ jsObject: Int32, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void +#else +fileprivate func _extern_handleAPIResult(_ jsObject: Int32, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getAPIResult") fileprivate func _extern_getAPIResult(_ jsObject: Int32) -> Int32 +#else +fileprivate func _extern_getAPIResult(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_get") fileprivate func bjs_DataProcessor_count_get(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_DataProcessor_count_get(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_set") fileprivate func bjs_DataProcessor_count_set(_ jsObject: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_count_set(_ jsObject: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_name_get") fileprivate func bjs_DataProcessor_name_get(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_DataProcessor_name_get(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_get") fileprivate func bjs_DataProcessor_optionalTag_get(_ jsObject: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_optionalTag_get(_ jsObject: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_set") fileprivate func bjs_DataProcessor_optionalTag_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_optionalTag_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_get") fileprivate func bjs_DataProcessor_optionalCount_get(_ jsObject: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_optionalCount_get(_ jsObject: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_set") fileprivate func bjs_DataProcessor_optionalCount_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_optionalCount_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_get") fileprivate func bjs_DataProcessor_direction_get(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_DataProcessor_direction_get(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_set") fileprivate func bjs_DataProcessor_direction_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_direction_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_get") fileprivate func bjs_DataProcessor_optionalTheme_get(_ jsObject: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_optionalTheme_get(_ jsObject: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_set") fileprivate func bjs_DataProcessor_optionalTheme_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_optionalTheme_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_get") fileprivate func bjs_DataProcessor_httpStatus_get(_ jsObject: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_httpStatus_get(_ jsObject: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_set") fileprivate func bjs_DataProcessor_httpStatus_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_httpStatus_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_get") fileprivate func bjs_DataProcessor_apiResult_get(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_DataProcessor_apiResult_get(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_set") fileprivate func bjs_DataProcessor_apiResult_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_apiResult_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_get") fileprivate func bjs_DataProcessor_helper_get(_ jsObject: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func bjs_DataProcessor_helper_get(_ jsObject: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_set") fileprivate func bjs_DataProcessor_helper_set(_ jsObject: Int32, _ newValue: UnsafeMutableRawPointer) -> Void +#else +fileprivate func bjs_DataProcessor_helper_set(_ jsObject: Int32, _ newValue: UnsafeMutableRawPointer) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_get") fileprivate func bjs_DataProcessor_optionalHelper_get(_ jsObject: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func bjs_DataProcessor_optionalHelper_get(_ jsObject: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +#if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_set") fileprivate func bjs_DataProcessor_optionalHelper_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValuePointer: UnsafeMutableRawPointer) -> Void +#else +fileprivate func bjs_DataProcessor_optionalHelper_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValuePointer: UnsafeMutableRawPointer) -> Void { + fatalError("Only available on WebAssembly") +} +#endif extension Direction: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { From aa961dc0e5769cbe845ae20387062f0cbb867665 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 19 Feb 2026 12:59:48 +0900 Subject: [PATCH 250/252] [NFC] BridgeJS: Work around extern inlining by adding an extra non-inlined layer of indirection --- Benchmarks/Sources/Generated/BridgeJS.swift | 154 +- .../PlayBridgeJS/Generated/BridgeJS.swift | 63 +- .../Sources/BridgeJSCore/ClosureCodegen.swift | 3 +- .../Sources/BridgeJSCore/ExportSwift.swift | 66 +- .../Sources/BridgeJSCore/ImportTS.swift | 44 +- .../BridgeJSCodegenTests/ArrayTypes.swift | 70 +- .../CrossFileFunctionTypes.ReverseOrder.swift | 16 +- .../CrossFileFunctionTypes.swift | 16 +- .../CrossFileSkipsEmptySkeletons.swift | 7 +- ...CrossFileTypeResolution.ReverseOrder.swift | 16 +- .../CrossFileTypeResolution.swift | 16 +- .../DefaultParameters.swift | 51 +- .../DictionaryTypes.swift | 14 +- .../EnumAssociatedValue.swift | 23 +- .../EnumNamespace.Global.swift | 23 +- .../BridgeJSCodegenTests/EnumNamespace.swift | 23 +- .../BridgeJSCodegenTests/EnumRawType.swift | 14 +- .../BridgeJSCodegenTests/GlobalGetter.swift | 14 +- .../GlobalThisImports.swift | 35 +- .../BridgeJSCodegenTests/ImportArray.swift | 14 +- .../ImportedTypeInExportedInterface.swift | 21 +- .../InvalidPropertyNames.swift | 154 +- .../BridgeJSCodegenTests/JSClass.swift | 63 +- .../JSClassStaticFunctions.swift | 49 +- .../BridgeJSCodegenTests/JSValue.swift | 21 +- .../BridgeJSCodegenTests/MixedGlobal.swift | 9 +- .../BridgeJSCodegenTests/MixedPrivate.swift | 9 +- .../Namespaces.Global.swift | 23 +- .../BridgeJSCodegenTests/Namespaces.swift | 23 +- .../BridgeJSCodegenTests/Optionals.swift | 189 +- .../PrimitiveParameters.swift | 7 +- .../PrimitiveReturn.swift | 14 +- .../BridgeJSCodegenTests/PropertyTypes.swift | 9 +- .../BridgeJSCodegenTests/Protocol.swift | 254 ++- .../StaticFunctions.Global.swift | 9 +- .../StaticFunctions.swift | 9 +- .../StaticProperties.Global.swift | 9 +- .../StaticProperties.swift | 9 +- .../StringParameter.swift | 14 +- .../BridgeJSCodegenTests/StringReturn.swift | 7 +- .../BridgeJSCodegenTests/SwiftClass.swift | 35 +- .../BridgeJSCodegenTests/SwiftClosure.swift | 296 ++- .../SwiftClosureImports.swift | 28 +- .../BridgeJSCodegenTests/SwiftStruct.swift | 107 +- .../SwiftStructImports.swift | 21 +- .../BridgeJSCodegenTests/UnsafePointer.swift | 14 +- .../VoidParameterVoidReturn.swift | 7 +- .../Generated/BridgeJS.swift | 23 +- .../Generated/BridgeJS.swift | 1680 ++++++++++++----- 49 files changed, 2676 insertions(+), 1119 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 65e57bdf9..a19e2c53a 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -145,21 +145,27 @@ extension SimpleStruct: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_SimpleStruct") -fileprivate func _bjs_struct_lower_SimpleStruct(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_SimpleStruct_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_SimpleStruct(_ objectId: Int32) -> Void { +fileprivate func _bjs_struct_lower_SimpleStruct_extern(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lower_SimpleStruct(_ objectId: Int32) -> Void { + return _bjs_struct_lower_SimpleStruct_extern(objectId) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lift_SimpleStruct") -fileprivate func _bjs_struct_lift_SimpleStruct() -> Int32 +fileprivate func _bjs_struct_lift_SimpleStruct_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_SimpleStruct() -> Int32 { +fileprivate func _bjs_struct_lift_SimpleStruct_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lift_SimpleStruct() -> Int32 { + return _bjs_struct_lift_SimpleStruct_extern() +} extension Address: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Address { @@ -189,21 +195,27 @@ extension Address: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Address") -fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Address_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_Address_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Address() -> Int32 { +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 Person: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Person { @@ -239,21 +251,27 @@ extension Person: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Person") -fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Person_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Void { +fileprivate func _bjs_struct_lower_Person_extern(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Void { + return _bjs_struct_lower_Person_extern(objectId) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Person") -fileprivate func _bjs_struct_lift_Person() -> Int32 +fileprivate func _bjs_struct_lift_Person_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Person() -> Int32 { +fileprivate func _bjs_struct_lift_Person_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lift_Person() -> Int32 { + return _bjs_struct_lift_Person_extern() +} extension ComplexStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> ComplexStruct { @@ -289,21 +307,27 @@ extension ComplexStruct: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ComplexStruct") -fileprivate func _bjs_struct_lower_ComplexStruct(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_ComplexStruct_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_ComplexStruct(_ objectId: Int32) -> Void { +fileprivate func _bjs_struct_lower_ComplexStruct_extern(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lower_ComplexStruct(_ objectId: Int32) -> Void { + return _bjs_struct_lower_ComplexStruct_extern(objectId) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lift_ComplexStruct") -fileprivate func _bjs_struct_lift_ComplexStruct() -> Int32 +fileprivate func _bjs_struct_lift_ComplexStruct_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_ComplexStruct() -> Int32 { +fileprivate func _bjs_struct_lift_ComplexStruct_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lift_ComplexStruct() -> Int32 { + return _bjs_struct_lift_ComplexStruct_extern() +} extension Point: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Point { @@ -331,21 +355,27 @@ extension Point: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Point_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_Point_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Point() -> Int32 { +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() +} @_expose(wasm, "bjs_run") @_cdecl("bjs_run") @@ -473,12 +503,15 @@ extension EnumRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_EnumRoundtrip_wrap") -fileprivate func _bjs_EnumRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_EnumRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_EnumRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_EnumRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_EnumRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_EnumRoundtrip_wrap_extern(pointer) +} @_expose(wasm, "bjs_ComplexResultRoundtrip_init") @_cdecl("bjs_ComplexResultRoundtrip_init") @@ -607,12 +640,15 @@ extension ComplexResultRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_ComplexResultRoundtrip_wrap") -fileprivate func _bjs_ComplexResultRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ComplexResultRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ComplexResultRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ComplexResultRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_ComplexResultRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ComplexResultRoundtrip_wrap_extern(pointer) +} @_expose(wasm, "bjs_StringRoundtrip_init") @_cdecl("bjs_StringRoundtrip_init") @@ -664,12 +700,15 @@ extension StringRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_StringRoundtrip_wrap") -fileprivate func _bjs_StringRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_StringRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_StringRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_StringRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_StringRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_StringRoundtrip_wrap_extern(pointer) +} @_expose(wasm, "bjs_OptionalReturnRoundtrip_init") @_cdecl("bjs_OptionalReturnRoundtrip_init") @@ -788,12 +827,15 @@ extension OptionalReturnRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_OptionalReturnRoundtrip_wrap") -fileprivate func _bjs_OptionalReturnRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_OptionalReturnRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_OptionalReturnRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_OptionalReturnRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_OptionalReturnRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_OptionalReturnRoundtrip_wrap_extern(pointer) +} @_expose(wasm, "bjs_StructRoundtrip_init") @_cdecl("bjs_StructRoundtrip_init") @@ -952,12 +994,15 @@ extension StructRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_StructRoundtrip_wrap") -fileprivate func _bjs_StructRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_StructRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_StructRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_StructRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_StructRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_StructRoundtrip_wrap_extern(pointer) +} @_expose(wasm, "bjs_SimpleClass_init") @_cdecl("bjs_SimpleClass_init") @@ -1093,12 +1138,15 @@ extension SimpleClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_SimpleClass_wrap") -fileprivate func _bjs_SimpleClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_SimpleClass_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_SimpleClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_SimpleClass_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_SimpleClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_SimpleClass_wrap_extern(pointer) +} @_expose(wasm, "bjs_AddressClass_init") @_cdecl("bjs_AddressClass_init") @@ -1192,12 +1240,15 @@ extension AddressClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_AddressClass_wrap") -fileprivate func _bjs_AddressClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_AddressClass_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_AddressClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_AddressClass_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_AddressClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_AddressClass_wrap_extern(pointer) +} @_expose(wasm, "bjs_ClassRoundtrip_init") @_cdecl("bjs_ClassRoundtrip_init") @@ -1292,12 +1343,15 @@ extension ClassRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_ClassRoundtrip_wrap") -fileprivate func _bjs_ClassRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ClassRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ClassRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ClassRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_ClassRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ClassRoundtrip_wrap_extern(pointer) +} @_expose(wasm, "bjs_ArrayRoundtrip_init") @_cdecl("bjs_ArrayRoundtrip_init") @@ -1705,21 +1759,27 @@ extension ArrayRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_ArrayRoundtrip_wrap") -fileprivate func _bjs_ArrayRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ArrayRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ArrayRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ArrayRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_ArrayRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ArrayRoundtrip_wrap_extern(pointer) +} #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoop") -fileprivate func bjs_benchmarkHelperNoop() -> Void +fileprivate func bjs_benchmarkHelperNoop_extern() -> Void #else -fileprivate func bjs_benchmarkHelperNoop() -> Void { +fileprivate func bjs_benchmarkHelperNoop_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_benchmarkHelperNoop() -> Void { + return bjs_benchmarkHelperNoop_extern() +} func _$benchmarkHelperNoop() throws(JSException) -> Void { bjs_benchmarkHelperNoop() @@ -1730,12 +1790,15 @@ func _$benchmarkHelperNoop() throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoopWithNumber") -fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void +fileprivate func bjs_benchmarkHelperNoopWithNumber_extern(_ n: Float64) -> Void #else -fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void { +fileprivate func bjs_benchmarkHelperNoopWithNumber_extern(_ n: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void { + return bjs_benchmarkHelperNoopWithNumber_extern(n) +} func _$benchmarkHelperNoopWithNumber(_ n: Double) throws(JSException) -> Void { let nValue = n.bridgeJSLowerParameter() @@ -1747,12 +1810,15 @@ func _$benchmarkHelperNoopWithNumber(_ n: Double) throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkRunner") -fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void +fileprivate func bjs_benchmarkRunner_extern(_ name: Int32, _ body: Int32) -> Void #else -fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void { +fileprivate func bjs_benchmarkRunner_extern(_ name: Int32, _ body: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void { + return bjs_benchmarkRunner_extern(name, body) +} func _$benchmarkRunner(_ name: String, _ body: JSObject) throws(JSException) -> Void { let nameValue = name.bridgeJSLowerParameter() diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift index f2aaa9794..88cdf900e 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift @@ -37,21 +37,27 @@ extension PlayBridgeJSOutput: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PlayBridgeJSOutput") -fileprivate func _bjs_struct_lower_PlayBridgeJSOutput(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_PlayBridgeJSOutput_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_PlayBridgeJSOutput(_ objectId: Int32) -> Void { +fileprivate func _bjs_struct_lower_PlayBridgeJSOutput_extern(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lower_PlayBridgeJSOutput(_ objectId: Int32) -> Void { + return _bjs_struct_lower_PlayBridgeJSOutput_extern(objectId) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PlayBridgeJSOutput") -fileprivate func _bjs_struct_lift_PlayBridgeJSOutput() -> Int32 +fileprivate func _bjs_struct_lift_PlayBridgeJSOutput_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_PlayBridgeJSOutput() -> Int32 { +fileprivate func _bjs_struct_lift_PlayBridgeJSOutput_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lift_PlayBridgeJSOutput() -> Int32 { + return _bjs_struct_lift_PlayBridgeJSOutput_extern() +} extension PlayBridgeJSDiagnostic: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> PlayBridgeJSDiagnostic { @@ -87,21 +93,27 @@ extension PlayBridgeJSDiagnostic: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PlayBridgeJSDiagnostic") -fileprivate func _bjs_struct_lower_PlayBridgeJSDiagnostic(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_PlayBridgeJSDiagnostic_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_PlayBridgeJSDiagnostic(_ objectId: Int32) -> Void { +fileprivate func _bjs_struct_lower_PlayBridgeJSDiagnostic_extern(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lower_PlayBridgeJSDiagnostic(_ objectId: Int32) -> Void { + return _bjs_struct_lower_PlayBridgeJSDiagnostic_extern(objectId) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PlayBridgeJSDiagnostic") -fileprivate func _bjs_struct_lift_PlayBridgeJSDiagnostic() -> Int32 +fileprivate func _bjs_struct_lift_PlayBridgeJSDiagnostic_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_PlayBridgeJSDiagnostic() -> Int32 { +fileprivate func _bjs_struct_lift_PlayBridgeJSDiagnostic_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lift_PlayBridgeJSDiagnostic() -> Int32 { + return _bjs_struct_lift_PlayBridgeJSDiagnostic_extern() +} extension PlayBridgeJSResult: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> PlayBridgeJSResult { @@ -129,21 +141,27 @@ extension PlayBridgeJSResult: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PlayBridgeJSResult") -fileprivate func _bjs_struct_lower_PlayBridgeJSResult(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_PlayBridgeJSResult_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_PlayBridgeJSResult(_ objectId: Int32) -> Void { +fileprivate func _bjs_struct_lower_PlayBridgeJSResult_extern(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lower_PlayBridgeJSResult(_ objectId: Int32) -> Void { + return _bjs_struct_lower_PlayBridgeJSResult_extern(objectId) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PlayBridgeJSResult") -fileprivate func _bjs_struct_lift_PlayBridgeJSResult() -> Int32 +fileprivate func _bjs_struct_lift_PlayBridgeJSResult_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_PlayBridgeJSResult() -> Int32 { +fileprivate func _bjs_struct_lift_PlayBridgeJSResult_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lift_PlayBridgeJSResult() -> Int32 { + return _bjs_struct_lift_PlayBridgeJSResult_extern() +} @_expose(wasm, "bjs_PlayBridgeJS_init") @_cdecl("bjs_PlayBridgeJS_init") @@ -199,21 +217,27 @@ extension PlayBridgeJS: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJS_wrap") -fileprivate func _bjs_PlayBridgeJS_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PlayBridgeJS_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PlayBridgeJS_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PlayBridgeJS_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_PlayBridgeJS_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_PlayBridgeJS_wrap_extern(pointer) +} #if arch(wasm32) @_extern(wasm, module: "PlayBridgeJS", name: "bjs_createTS2Swift") -fileprivate func bjs_createTS2Swift() -> Int32 +fileprivate func bjs_createTS2Swift_extern() -> Int32 #else -fileprivate func bjs_createTS2Swift() -> Int32 { +fileprivate func bjs_createTS2Swift_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_createTS2Swift() -> Int32 { + return bjs_createTS2Swift_extern() +} func _$createTS2Swift() throws(JSException) -> TS2Swift { let ret = bjs_createTS2Swift() @@ -225,12 +249,15 @@ func _$createTS2Swift() throws(JSException) -> TS2Swift { #if arch(wasm32) @_extern(wasm, module: "PlayBridgeJS", name: "bjs_TS2Swift_convert") -fileprivate func bjs_TS2Swift_convert(_ self: Int32, _ ts: Int32) -> Int32 +fileprivate func bjs_TS2Swift_convert_extern(_ self: Int32, _ ts: Int32) -> Int32 #else -fileprivate func bjs_TS2Swift_convert(_ self: Int32, _ ts: Int32) -> Int32 { +fileprivate func bjs_TS2Swift_convert_extern(_ self: Int32, _ ts: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_TS2Swift_convert(_ self: Int32, _ ts: Int32) -> Int32 { + return bjs_TS2Swift_convert_extern(self, ts) +} func _$TS2Swift_convert(_ self: JSObject, _ ts: String) throws(JSException) -> String { let selfValue = self.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift index 59b889ec6..d974fc16d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift @@ -53,7 +53,8 @@ public struct ClosureCodegen { moduleName: "bjs", abiName: externABIName, functionName: externABIName, - signature: "(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32" + signature: "(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32", + parameterNames: ["boxPtr", "file", "line"] ) let makeClosureExternDecl: DeclSyntax = "\(raw: externDeclPrinter.lines.joined(separator: "\n"))" diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index 62ec2d3e6..2332918c1 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -695,18 +695,14 @@ public class ExportSwift { } """ // Build common function signature - let funcSignature = SwiftSignatureBuilder.buildABIFunctionSignature( - abiParameters: [("pointer", .pointer)], - returnType: .i32 - ) - let externDeclPrinter = CodeFragmentPrinter() SwiftCodePattern.buildExternFunctionDecl( printer: externDeclPrinter, moduleName: moduleName, abiName: externFunctionName, functionName: wrapFunctionName, - signature: funcSignature + abiParameters: [("pointer", .pointer)], + returnType: .i32 ) let externDecl: DeclSyntax = "\(raw: externDeclPrinter.lines.joined(separator: "\n"))" return [extensionDecl, externDecl] @@ -1251,24 +1247,22 @@ struct StructCodegen { let bridgedStructExtension: DeclSyntax = "\(raw: printer.lines.joined(separator: "\n"))" let lowerExternDeclPrinter = CodeFragmentPrinter() - Self.renderStructExtern( + SwiftCodePattern.buildExternFunctionDecl( printer: lowerExternDeclPrinter, - externName: lowerExternName, + moduleName: "bjs", + abiName: lowerExternName, functionName: lowerFunctionName, - signature: SwiftSignatureBuilder.buildABIFunctionSignature( - abiParameters: [("objectId", .i32)], - returnType: nil - ) + abiParameters: [("objectId", .i32)], + returnType: nil ) let liftExternDeclPrinter = CodeFragmentPrinter() - Self.renderStructExtern( + SwiftCodePattern.buildExternFunctionDecl( printer: liftExternDeclPrinter, - externName: liftExternName, + moduleName: "bjs", + abiName: liftExternName, functionName: liftFunctionName, - signature: SwiftSignatureBuilder.buildABIFunctionSignature( - abiParameters: [], - returnType: .i32 - ) + abiParameters: [], + returnType: .i32 ) return [ @@ -1277,21 +1271,6 @@ struct StructCodegen { ] } - private static func renderStructExtern( - printer: CodeFragmentPrinter, - externName: String, - functionName: String, - signature: String - ) { - SwiftCodePattern.buildExternFunctionDecl( - printer: printer, - moduleName: "bjs", - abiName: externName, - functionName: functionName, - signature: signature - ) - } - private func generateStructLiftCode(structDef: ExportedStruct) -> [String] { var lines: [String] = [] let instanceProps = structDef.properties.filter { !$0.isStatic } @@ -1357,17 +1336,14 @@ struct ProtocolCodegen { ) // Build extern declaration using helper function - let externSignature = SwiftSignatureBuilder.buildABIFunctionSignature( - abiParameters: builder.abiParameterSignatures, - returnType: builder.abiReturnType - ) let externDeclPrinter = CodeFragmentPrinter() SwiftCodePattern.buildExternFunctionDecl( printer: externDeclPrinter, moduleName: moduleName, abiName: method.abiName, functionName: "_extern_\(method.name)", - signature: externSignature + abiParameters: builder.abiParameterSignatures, + returnType: builder.abiReturnType ) externDecls.append(DeclSyntax("\(raw: externDeclPrinter.lines.joined(separator: "\n"))")) let methodImplPrinter = CodeFragmentPrinter() @@ -1448,17 +1424,14 @@ struct ProtocolCodegen { try getterBuilder.liftReturnValue(returnType: property.type) // Build getter extern declaration using helper function - let getterExternSignature = SwiftSignatureBuilder.buildABIFunctionSignature( - abiParameters: getterBuilder.abiParameterSignatures, - returnType: getterBuilder.abiReturnType - ) let getterExternDeclPrinter = CodeFragmentPrinter() SwiftCodePattern.buildExternFunctionDecl( printer: getterExternDeclPrinter, moduleName: moduleName, abiName: getterAbiName, functionName: getterAbiName, - signature: getterExternSignature + abiParameters: getterBuilder.abiParameterSignatures, + returnType: getterBuilder.abiReturnType ) let getterExternDecl = DeclSyntax("\(raw: getterExternDeclPrinter.lines.joined(separator: "\n"))") var externDecls: [DeclSyntax] = [getterExternDecl] @@ -1483,17 +1456,14 @@ struct ProtocolCodegen { try setterBuilder.call(returnType: .void) // Build setter extern declaration using helper function - let setterExternSignature = SwiftSignatureBuilder.buildABIFunctionSignature( - abiParameters: setterBuilder.abiParameterSignatures, - returnType: setterBuilder.abiReturnType - ) let setterExternDeclPrinter = CodeFragmentPrinter() SwiftCodePattern.buildExternFunctionDecl( printer: setterExternDeclPrinter, moduleName: moduleName, abiName: setterAbiName, functionName: setterAbiName, - signature: setterExternSignature + abiParameters: setterBuilder.abiParameterSignatures, + returnType: setterBuilder.abiReturnType ) let setterExternDecl = DeclSyntax("\(raw: setterExternDeclPrinter.lines.joined(separator: "\n"))") externDecls.append(setterExternDecl) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index ed5d5ff36..8f5ac511a 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -222,18 +222,14 @@ public struct ImportTS { } func renderImportDecl() -> DeclSyntax { - let signature = SwiftSignatureBuilder.buildABIFunctionSignature( - abiParameters: abiParameterSignatures, - returnType: abiReturnType - ) - let printer = CodeFragmentPrinter() SwiftCodePattern.buildExternFunctionDecl( printer: printer, moduleName: moduleName, abiName: abiName, functionName: abiName, - signature: signature + abiParameters: abiParameterSignatures, + returnType: abiReturnType ) return "\(raw: printer.lines.joined(separator: "\n"))" } @@ -634,6 +630,27 @@ enum SwiftCodePattern { elseDecl(printer) printer.write("#endif") } + static func buildExternFunctionDecl( + printer: CodeFragmentPrinter, + moduleName: String, + abiName: String, + functionName: String, + abiParameters: [(name: String, type: WasmCoreType)], + returnType: WasmCoreType? + ) { + let signature = SwiftSignatureBuilder.buildABIFunctionSignature( + abiParameters: abiParameters, + returnType: returnType + ) + buildExternFunctionDecl( + printer: printer, + moduleName: moduleName, + abiName: abiName, + functionName: functionName, + signature: signature, + parameterNames: abiParameters.map { $0.name } + ) + } /// Builds the @_extern attribute for WebAssembly extern function declarations /// Builds an @_extern function declaration (no body, just the declaration) @@ -642,22 +659,31 @@ enum SwiftCodePattern { moduleName: String, abiName: String, functionName: String, - signature: String + signature: String, + parameterNames: [String], ) { + // NOTE: Due to a Swift compiler issue, we can't declare possibly inlined functions as @_extern + // https://github.com/swiftlang/swift/pull/87250 + let inModuleDeclName = "\(functionName)_extern" buildWasmConditionalCompilationDecls( printer: printer, wasmDecl: { printer in printer.write(buildExternAttribute(moduleName: moduleName, abiName: abiName)) - printer.write("fileprivate func \(functionName)\(signature)") + printer.write("fileprivate func \(inModuleDeclName)\(signature)") }, elseDecl: { printer in - printer.write("fileprivate func \(functionName)\(signature) {") + printer.write("fileprivate func \(inModuleDeclName)\(signature) {") printer.indent { printer.write("fatalError(\"Only available on WebAssembly\")") } printer.write("}") } ) + printer.write("@inline(never) fileprivate func \(functionName)\(signature) {") + printer.indent { + printer.write("return \(inModuleDeclName)(\(parameterNames.joined(separator: ", ")))") + } + printer.write("}") } /// Builds the standard @_expose and @_cdecl attributes for WebAssembly-exposed functions diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift index 12edb29e3..be884310b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ArrayTypes.swift @@ -70,21 +70,27 @@ extension Point: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Point_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_Point_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Point() -> Int32 { +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() +} @_expose(wasm, "bjs_processIntArray") @_cdecl("bjs_processIntArray") @@ -482,21 +488,27 @@ extension Item: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Item_wrap") -fileprivate func _bjs_Item_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Item_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Item_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Item_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_Item_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Item_wrap_extern(pointer) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_checkArray") -fileprivate func bjs_checkArray(_ a: Int32) -> Void +fileprivate func bjs_checkArray_extern(_ a: Int32) -> Void #else -fileprivate func bjs_checkArray(_ a: Int32) -> Void { +fileprivate func bjs_checkArray_extern(_ a: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_checkArray(_ a: Int32) -> Void { + return bjs_checkArray_extern(a) +} func _$checkArray(_ a: JSObject) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() @@ -508,12 +520,15 @@ func _$checkArray(_ a: JSObject) throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_checkArrayWithLength") -fileprivate func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void +fileprivate func bjs_checkArrayWithLength_extern(_ a: Int32, _ b: Float64) -> Void #else -fileprivate func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void { +fileprivate func bjs_checkArrayWithLength_extern(_ a: Int32, _ b: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void { + return bjs_checkArrayWithLength_extern(a, b) +} func _$checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() @@ -526,12 +541,15 @@ func _$checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> V #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_importProcessNumbers") -fileprivate func bjs_importProcessNumbers() -> Void +fileprivate func bjs_importProcessNumbers_extern() -> Void #else -fileprivate func bjs_importProcessNumbers() -> Void { +fileprivate func bjs_importProcessNumbers_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_importProcessNumbers() -> Void { + return bjs_importProcessNumbers_extern() +} func _$importProcessNumbers(_ values: [Double]) throws(JSException) -> Void { let _ = values.bridgeJSLowerParameter() @@ -543,12 +561,15 @@ func _$importProcessNumbers(_ values: [Double]) throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_importGetNumbers") -fileprivate func bjs_importGetNumbers() -> Void +fileprivate func bjs_importGetNumbers_extern() -> Void #else -fileprivate func bjs_importGetNumbers() -> Void { +fileprivate func bjs_importGetNumbers_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_importGetNumbers() -> Void { + return bjs_importGetNumbers_extern() +} func _$importGetNumbers() throws(JSException) -> [Double] { bjs_importGetNumbers() @@ -560,12 +581,15 @@ func _$importGetNumbers() throws(JSException) -> [Double] { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_importTransformNumbers") -fileprivate func bjs_importTransformNumbers() -> Void +fileprivate func bjs_importTransformNumbers_extern() -> Void #else -fileprivate func bjs_importTransformNumbers() -> Void { +fileprivate func bjs_importTransformNumbers_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_importTransformNumbers() -> Void { + return bjs_importTransformNumbers_extern() +} func _$importTransformNumbers(_ values: [Double]) throws(JSException) -> [Double] { let _ = values.bridgeJSLowerParameter() @@ -578,12 +602,15 @@ func _$importTransformNumbers(_ values: [Double]) throws(JSException) -> [Double #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_importProcessStrings") -fileprivate func bjs_importProcessStrings() -> Void +fileprivate func bjs_importProcessStrings_extern() -> Void #else -fileprivate func bjs_importProcessStrings() -> Void { +fileprivate func bjs_importProcessStrings_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_importProcessStrings() -> Void { + return bjs_importProcessStrings_extern() +} func _$importProcessStrings(_ values: [String]) throws(JSException) -> [String] { let _ = values.bridgeJSLowerParameter() @@ -596,12 +623,15 @@ func _$importProcessStrings(_ values: [String]) throws(JSException) -> [String] #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_importProcessBooleans") -fileprivate func bjs_importProcessBooleans() -> Void +fileprivate func bjs_importProcessBooleans_extern() -> Void #else -fileprivate func bjs_importProcessBooleans() -> Void { +fileprivate func bjs_importProcessBooleans_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_importProcessBooleans() -> Void { + return bjs_importProcessBooleans_extern() +} func _$importProcessBooleans(_ values: [Bool]) throws(JSException) -> [Bool] { let _ = values.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.ReverseOrder.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.ReverseOrder.swift index 05437f540..4dda325bf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.ReverseOrder.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.ReverseOrder.swift @@ -60,12 +60,15 @@ extension FunctionA: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_FunctionA_wrap") -fileprivate func _bjs_FunctionA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_FunctionA_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_FunctionA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_FunctionA_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_FunctionA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_FunctionA_wrap_extern(pointer) +} @_expose(wasm, "bjs_FunctionB_init") @_cdecl("bjs_FunctionB_init") @@ -117,9 +120,12 @@ extension FunctionB: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_FunctionB_wrap") -fileprivate func _bjs_FunctionB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_FunctionB_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_FunctionB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_FunctionB_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_FunctionB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_FunctionB_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.swift index fa8e80cd8..fcf84a88f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileFunctionTypes.swift @@ -59,12 +59,15 @@ extension FunctionB: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_FunctionB_wrap") -fileprivate func _bjs_FunctionB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_FunctionB_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_FunctionB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_FunctionB_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_FunctionB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_FunctionB_wrap_extern(pointer) +} @_expose(wasm, "bjs_FunctionA_init") @_cdecl("bjs_FunctionA_init") @@ -117,9 +120,12 @@ extension FunctionA: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_FunctionA_wrap") -fileprivate func _bjs_FunctionA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_FunctionA_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_FunctionA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_FunctionA_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_FunctionA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_FunctionA_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.swift index 21e4e939a..48d06ee95 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileSkipsEmptySkeletons.swift @@ -1,11 +1,14 @@ #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_fetchNumber") -fileprivate func bjs_fetchNumber() -> Int32 +fileprivate func bjs_fetchNumber_extern() -> Int32 #else -fileprivate func bjs_fetchNumber() -> Int32 { +fileprivate func bjs_fetchNumber_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_fetchNumber() -> Int32 { + return bjs_fetchNumber_extern() +} func _$fetchNumber() throws(JSException) -> Int { let ret = bjs_fetchNumber() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.swift index 8d697f8ba..2868156a4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.ReverseOrder.swift @@ -37,12 +37,15 @@ extension ClassA: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_ClassA_wrap") -fileprivate func _bjs_ClassA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ClassA_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ClassA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ClassA_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_ClassA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ClassA_wrap_extern(pointer) +} @_expose(wasm, "bjs_ClassB_init") @_cdecl("bjs_ClassB_init") @@ -73,9 +76,12 @@ extension ClassB: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_ClassB_wrap") -fileprivate func _bjs_ClassB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ClassB_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ClassB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ClassB_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_ClassB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ClassB_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.swift index 0a0396075..09070a16f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/CrossFileTypeResolution.swift @@ -27,12 +27,15 @@ extension ClassB: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_ClassB_wrap") -fileprivate func _bjs_ClassB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ClassB_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ClassB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ClassB_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_ClassB_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ClassB_wrap_extern(pointer) +} @_expose(wasm, "bjs_ClassA_linkedB_get") @_cdecl("bjs_ClassA_linkedB_get") @@ -73,9 +76,12 @@ extension ClassA: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_ClassA_wrap") -fileprivate func _bjs_ClassA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ClassA_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ClassA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ClassA_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_ClassA_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ClassA_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift index c905c4239..df4969fa6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DefaultParameters.swift @@ -65,21 +65,27 @@ extension Config: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Config") -fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Config_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_Config_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Config() -> Int32 { +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 MathOperations: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> MathOperations { @@ -105,21 +111,27 @@ extension MathOperations: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MathOperations") -fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_MathOperations_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_MathOperations_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_MathOperations() -> Int32 { +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") @@ -424,12 +436,15 @@ extension DefaultGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_DefaultGreeter_wrap") -fileprivate func _bjs_DefaultGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_DefaultGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_DefaultGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_DefaultGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_DefaultGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_DefaultGreeter_wrap_extern(pointer) +} @_expose(wasm, "bjs_EmptyGreeter_init") @_cdecl("bjs_EmptyGreeter_init") @@ -460,12 +475,15 @@ extension EmptyGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_EmptyGreeter_wrap") -fileprivate func _bjs_EmptyGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_EmptyGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_EmptyGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_EmptyGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_EmptyGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_EmptyGreeter_wrap_extern(pointer) +} @_expose(wasm, "bjs_ConstructorDefaults_init") @_cdecl("bjs_ConstructorDefaults_init") @@ -601,9 +619,12 @@ extension ConstructorDefaults: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_ConstructorDefaults_wrap") -fileprivate func _bjs_ConstructorDefaults_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ConstructorDefaults_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ConstructorDefaults_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ConstructorDefaults_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_ConstructorDefaults_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ConstructorDefaults_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.swift index 016a5f814..742619f39 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/DictionaryTypes.swift @@ -71,21 +71,27 @@ extension Box: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Box_wrap") -fileprivate func _bjs_Box_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Box_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Box_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Box_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_Box_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Box_wrap_extern(pointer) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_importMirrorDictionary") -fileprivate func bjs_importMirrorDictionary() -> Void +fileprivate func bjs_importMirrorDictionary_extern() -> Void #else -fileprivate func bjs_importMirrorDictionary() -> Void { +fileprivate func bjs_importMirrorDictionary_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_importMirrorDictionary() -> Void { + return bjs_importMirrorDictionary_extern() +} func _$importMirrorDictionary(_ values: [String: Double]) throws(JSException) -> [String: Double] { let _ = values.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift index 588fb1cbc..838c55122 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumAssociatedValue.swift @@ -426,21 +426,27 @@ extension Point: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Point_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_Point_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Point() -> Int32 { +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() +} @_expose(wasm, "bjs_handle") @_cdecl("bjs_handle") @@ -658,9 +664,12 @@ extension User: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_User_wrap") -fileprivate func _bjs_User_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_User_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_User_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_User_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_User_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_User_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.swift index b1b5e9c8c..47d1ff60a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.Global.swift @@ -169,12 +169,15 @@ extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Converter_wrap_extern(pointer) +} @_expose(wasm, "bjs_HTTPServer_init") @_cdecl("bjs_HTTPServer_init") @@ -215,12 +218,15 @@ extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObje #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_HTTPServer_wrap") -fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_HTTPServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_HTTPServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_HTTPServer_wrap_extern(pointer) +} @_expose(wasm, "bjs_TestServer_init") @_cdecl("bjs_TestServer_init") @@ -261,9 +267,12 @@ extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_TestServer_wrap") -fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TestServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_TestServer_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.swift index b1b5e9c8c..47d1ff60a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumNamespace.swift @@ -169,12 +169,15 @@ extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Converter_wrap_extern(pointer) +} @_expose(wasm, "bjs_HTTPServer_init") @_cdecl("bjs_HTTPServer_init") @@ -215,12 +218,15 @@ extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObje #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_HTTPServer_wrap") -fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_HTTPServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_HTTPServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_HTTPServer_wrap_extern(pointer) +} @_expose(wasm, "bjs_TestServer_init") @_cdecl("bjs_TestServer_init") @@ -261,9 +267,12 @@ extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_TestServer_wrap") -fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TestServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_TestServer_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.swift index 210361b3b..c3c3d5e7f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/EnumRawType.swift @@ -453,12 +453,15 @@ public func _bjs_validateSession(_ session: Int32) -> Void { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_takesFeatureFlag") -fileprivate func bjs_takesFeatureFlag(_ flag: Int32) -> Void +fileprivate func bjs_takesFeatureFlag_extern(_ flag: Int32) -> Void #else -fileprivate func bjs_takesFeatureFlag(_ flag: Int32) -> Void { +fileprivate func bjs_takesFeatureFlag_extern(_ flag: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_takesFeatureFlag(_ flag: Int32) -> Void { + return bjs_takesFeatureFlag_extern(flag) +} func _$takesFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> Void { let flagValue = flag.bridgeJSLowerParameter() @@ -470,12 +473,15 @@ func _$takesFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_returnsFeatureFlag") -fileprivate func bjs_returnsFeatureFlag() -> Int32 +fileprivate func bjs_returnsFeatureFlag_extern() -> Int32 #else -fileprivate func bjs_returnsFeatureFlag() -> Int32 { +fileprivate func bjs_returnsFeatureFlag_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_returnsFeatureFlag() -> Int32 { + return bjs_returnsFeatureFlag_extern() +} func _$returnsFeatureFlag() throws(JSException) -> FeatureFlag { let ret = bjs_returnsFeatureFlag() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.swift index da3f1367b..b42f71563 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalGetter.swift @@ -1,11 +1,14 @@ #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_console_get") -fileprivate func bjs_console_get() -> Int32 +fileprivate func bjs_console_get_extern() -> Int32 #else -fileprivate func bjs_console_get() -> Int32 { +fileprivate func bjs_console_get_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_console_get() -> Int32 { + return bjs_console_get_extern() +} func _$console_get() throws(JSException) -> JSConsole { let ret = bjs_console_get() @@ -17,12 +20,15 @@ func _$console_get() throws(JSException) -> JSConsole { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_JSConsole_log") -fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void +fileprivate func bjs_JSConsole_log_extern(_ self: Int32, _ message: Int32) -> Void #else -fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void { +fileprivate func bjs_JSConsole_log_extern(_ self: Int32, _ message: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void { + return bjs_JSConsole_log_extern(self, message) +} func _$JSConsole_log(_ self: JSObject, _ message: String) throws(JSException) -> Void { let selfValue = self.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.swift index 56353b253..58d69eed1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/GlobalThisImports.swift @@ -1,11 +1,14 @@ #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_console_get") -fileprivate func bjs_console_get() -> Int32 +fileprivate func bjs_console_get_extern() -> Int32 #else -fileprivate func bjs_console_get() -> Int32 { +fileprivate func bjs_console_get_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_console_get() -> Int32 { + return bjs_console_get_extern() +} func _$console_get() throws(JSException) -> JSConsole { let ret = bjs_console_get() @@ -17,12 +20,15 @@ func _$console_get() throws(JSException) -> JSConsole { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_parseInt") -fileprivate func bjs_parseInt(_ string: Int32) -> Float64 +fileprivate func bjs_parseInt_extern(_ string: Int32) -> Float64 #else -fileprivate func bjs_parseInt(_ string: Int32) -> Float64 { +fileprivate func bjs_parseInt_extern(_ string: Int32) -> Float64 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_parseInt(_ string: Int32) -> Float64 { + return bjs_parseInt_extern(string) +} func _$parseInt(_ string: String) throws(JSException) -> Double { let stringValue = string.bridgeJSLowerParameter() @@ -35,12 +41,15 @@ func _$parseInt(_ string: String) throws(JSException) -> Double { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_JSConsole_log") -fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void +fileprivate func bjs_JSConsole_log_extern(_ self: Int32, _ message: Int32) -> Void #else -fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void { +fileprivate func bjs_JSConsole_log_extern(_ self: Int32, _ message: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_JSConsole_log(_ self: Int32, _ message: Int32) -> Void { + return bjs_JSConsole_log_extern(self, message) +} func _$JSConsole_log(_ self: JSObject, _ message: String) throws(JSException) -> Void { let selfValue = self.bridgeJSLowerParameter() @@ -53,21 +62,27 @@ func _$JSConsole_log(_ self: JSObject, _ message: String) throws(JSException) -> #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WebSocket_init") -fileprivate func bjs_WebSocket_init(_ url: Int32) -> Int32 +fileprivate func bjs_WebSocket_init_extern(_ url: Int32) -> Int32 #else -fileprivate func bjs_WebSocket_init(_ url: Int32) -> Int32 { +fileprivate func bjs_WebSocket_init_extern(_ url: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WebSocket_init(_ url: Int32) -> Int32 { + return bjs_WebSocket_init_extern(url) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WebSocket_close") -fileprivate func bjs_WebSocket_close(_ self: Int32) -> Void +fileprivate func bjs_WebSocket_close_extern(_ self: Int32) -> Void #else -fileprivate func bjs_WebSocket_close(_ self: Int32) -> Void { +fileprivate func bjs_WebSocket_close_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WebSocket_close(_ self: Int32) -> Void { + return bjs_WebSocket_close_extern(self) +} func _$WebSocket_init(_ url: String) throws(JSException) -> JSObject { let urlValue = url.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.swift index 33b987c76..db1f136e7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportArray.swift @@ -1,11 +1,14 @@ #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_roundtrip") -fileprivate func bjs_roundtrip() -> Void +fileprivate func bjs_roundtrip_extern() -> Void #else -fileprivate func bjs_roundtrip() -> Void { +fileprivate func bjs_roundtrip_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_roundtrip() -> Void { + return bjs_roundtrip_extern() +} func _$roundtrip(_ items: [Int]) throws(JSException) -> [Int] { let _ = items.bridgeJSLowerParameter() @@ -18,12 +21,15 @@ func _$roundtrip(_ items: [Int]) throws(JSException) -> [Int] { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_logStrings") -fileprivate func bjs_logStrings() -> Void +fileprivate func bjs_logStrings_extern() -> Void #else -fileprivate func bjs_logStrings() -> Void { +fileprivate func bjs_logStrings_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_logStrings() -> Void { + return bjs_logStrings_extern() +} func _$logStrings(_ items: [String]) throws(JSException) -> Void { let _ = items.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift index c142fbd04..c72cda7ed 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/ImportedTypeInExportedInterface.swift @@ -28,21 +28,27 @@ extension FooContainer: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_FooContainer") -fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_FooContainer_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_FooContainer_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_FooContainer() -> Int32 { +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() +} @_expose(wasm, "bjs_makeFoo") @_cdecl("bjs_makeFoo") @@ -120,12 +126,15 @@ public func _bjs_roundtripFooContainer() -> Void { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Foo_init") -fileprivate func bjs_Foo_init() -> Int32 +fileprivate func bjs_Foo_init_extern() -> Int32 #else -fileprivate func bjs_Foo_init() -> Int32 { +fileprivate func bjs_Foo_init_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_Foo_init() -> Int32 { + return bjs_Foo_init_extern() +} func _$Foo_init() throws(JSException) -> JSObject { let ret = bjs_Foo_init() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.swift index 86e72bb53..2ff17ea24 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/InvalidPropertyNames.swift @@ -1,11 +1,14 @@ #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_createWeirdObject") -fileprivate func bjs_createWeirdObject() -> Int32 +fileprivate func bjs_createWeirdObject_extern() -> Int32 #else -fileprivate func bjs_createWeirdObject() -> Int32 { +fileprivate func bjs_createWeirdObject_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_createWeirdObject() -> Int32 { + return bjs_createWeirdObject_extern() +} func _$createWeirdObject() throws(JSException) -> WeirdNaming { let ret = bjs_createWeirdObject() @@ -17,12 +20,15 @@ func _$createWeirdObject() throws(JSException) -> WeirdNaming { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_createWeirdClass") -fileprivate func bjs_createWeirdClass() -> Int32 +fileprivate func bjs_createWeirdClass_extern() -> Int32 #else -fileprivate func bjs_createWeirdClass() -> Int32 { +fileprivate func bjs_createWeirdClass_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_createWeirdClass() -> Int32 { + return bjs_createWeirdClass_extern() +} func _$createWeirdClass() throws(JSException) -> _Weird { let ret = bjs_createWeirdClass() @@ -34,165 +40,219 @@ func _$createWeirdClass() throws(JSException) -> _Weird { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_normalProperty_get") -fileprivate func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 +fileprivate func bjs_WeirdNaming_normalProperty_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WeirdNaming_normalProperty_get_extern(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 { + return bjs_WeirdNaming_normalProperty_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_property_with_dashes_get") -fileprivate func bjs_WeirdNaming_property_with_dashes_get(_ self: Int32) -> Float64 +fileprivate func bjs_WeirdNaming_property_with_dashes_get_extern(_ self: Int32) -> Float64 #else -fileprivate func bjs_WeirdNaming_property_with_dashes_get(_ self: Int32) -> Float64 { +fileprivate func bjs_WeirdNaming_property_with_dashes_get_extern(_ self: Int32) -> Float64 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_property_with_dashes_get(_ self: Int32) -> Float64 { + return bjs_WeirdNaming_property_with_dashes_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming__123invalidStart_get") -fileprivate func bjs_WeirdNaming__123invalidStart_get(_ self: Int32) -> Int32 +fileprivate func bjs_WeirdNaming__123invalidStart_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_WeirdNaming__123invalidStart_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WeirdNaming__123invalidStart_get_extern(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming__123invalidStart_get(_ self: Int32) -> Int32 { + return bjs_WeirdNaming__123invalidStart_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_property_with_spaces_get") -fileprivate func bjs_WeirdNaming_property_with_spaces_get(_ self: Int32) -> Int32 +fileprivate func bjs_WeirdNaming_property_with_spaces_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_WeirdNaming_property_with_spaces_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WeirdNaming_property_with_spaces_get_extern(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_property_with_spaces_get(_ self: Int32) -> Int32 { + return bjs_WeirdNaming_property_with_spaces_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming__specialChar_get") -fileprivate func bjs_WeirdNaming__specialChar_get(_ self: Int32) -> Float64 +fileprivate func bjs_WeirdNaming__specialChar_get_extern(_ self: Int32) -> Float64 #else -fileprivate func bjs_WeirdNaming__specialChar_get(_ self: Int32) -> Float64 { +fileprivate func bjs_WeirdNaming__specialChar_get_extern(_ self: Int32) -> Float64 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming__specialChar_get(_ self: Int32) -> Float64 { + return bjs_WeirdNaming__specialChar_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_constructor_get") -fileprivate func bjs_WeirdNaming_constructor_get(_ self: Int32) -> Int32 +fileprivate func bjs_WeirdNaming_constructor_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_WeirdNaming_constructor_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WeirdNaming_constructor_get_extern(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_constructor_get(_ self: Int32) -> Int32 { + return bjs_WeirdNaming_constructor_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_for_get") -fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 +fileprivate func bjs_WeirdNaming_for_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WeirdNaming_for_get_extern(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 { + return bjs_WeirdNaming_for_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_Any_get") -fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 +fileprivate func bjs_WeirdNaming_Any_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WeirdNaming_Any_get_extern(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 { + return bjs_WeirdNaming_Any_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_normalProperty_set") -fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_WeirdNaming_normalProperty_set_extern(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_WeirdNaming_normalProperty_set_extern(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void { + return bjs_WeirdNaming_normalProperty_set_extern(self, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_property_with_dashes_set") -fileprivate func bjs_WeirdNaming_property_with_dashes_set(_ self: Int32, _ newValue: Float64) -> Void +fileprivate func bjs_WeirdNaming_property_with_dashes_set_extern(_ self: Int32, _ newValue: Float64) -> Void #else -fileprivate func bjs_WeirdNaming_property_with_dashes_set(_ self: Int32, _ newValue: Float64) -> Void { +fileprivate func bjs_WeirdNaming_property_with_dashes_set_extern(_ self: Int32, _ newValue: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_property_with_dashes_set(_ self: Int32, _ newValue: Float64) -> Void { + return bjs_WeirdNaming_property_with_dashes_set_extern(self, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming__123invalidStart_set") -fileprivate func bjs_WeirdNaming__123invalidStart_set(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_WeirdNaming__123invalidStart_set_extern(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_WeirdNaming__123invalidStart_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_WeirdNaming__123invalidStart_set_extern(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming__123invalidStart_set(_ self: Int32, _ newValue: Int32) -> Void { + return bjs_WeirdNaming__123invalidStart_set_extern(self, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_property_with_spaces_set") -fileprivate func bjs_WeirdNaming_property_with_spaces_set(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_WeirdNaming_property_with_spaces_set_extern(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_WeirdNaming_property_with_spaces_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_WeirdNaming_property_with_spaces_set_extern(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_property_with_spaces_set(_ self: Int32, _ newValue: Int32) -> Void { + return bjs_WeirdNaming_property_with_spaces_set_extern(self, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming__specialChar_set") -fileprivate func bjs_WeirdNaming__specialChar_set(_ self: Int32, _ newValue: Float64) -> Void +fileprivate func bjs_WeirdNaming__specialChar_set_extern(_ self: Int32, _ newValue: Float64) -> Void #else -fileprivate func bjs_WeirdNaming__specialChar_set(_ self: Int32, _ newValue: Float64) -> Void { +fileprivate func bjs_WeirdNaming__specialChar_set_extern(_ self: Int32, _ newValue: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming__specialChar_set(_ self: Int32, _ newValue: Float64) -> Void { + return bjs_WeirdNaming__specialChar_set_extern(self, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_constructor_set") -fileprivate func bjs_WeirdNaming_constructor_set(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_WeirdNaming_constructor_set_extern(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_WeirdNaming_constructor_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_WeirdNaming_constructor_set_extern(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_constructor_set(_ self: Int32, _ newValue: Int32) -> Void { + return bjs_WeirdNaming_constructor_set_extern(self, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_for_set") -fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_WeirdNaming_for_set_extern(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_WeirdNaming_for_set_extern(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void { + return bjs_WeirdNaming_for_set_extern(self, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_any_set") -fileprivate func bjs_WeirdNaming_any_set(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_WeirdNaming_any_set_extern(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_WeirdNaming_any_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_WeirdNaming_any_set_extern(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_any_set(_ self: Int32, _ newValue: Int32) -> Void { + return bjs_WeirdNaming_any_set_extern(self, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_as") -fileprivate func bjs_WeirdNaming_as(_ self: Int32) -> Void +fileprivate func bjs_WeirdNaming_as_extern(_ self: Int32) -> Void #else -fileprivate func bjs_WeirdNaming_as(_ self: Int32) -> Void { +fileprivate func bjs_WeirdNaming_as_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_as(_ self: Int32) -> Void { + return bjs_WeirdNaming_as_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WeirdNaming_try") -fileprivate func bjs_WeirdNaming_try(_ self: Int32) -> Void +fileprivate func bjs_WeirdNaming_try_extern(_ self: Int32) -> Void #else -fileprivate func bjs_WeirdNaming_try(_ self: Int32) -> Void { +fileprivate func bjs_WeirdNaming_try_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WeirdNaming_try(_ self: Int32) -> Void { + return bjs_WeirdNaming_try_extern(self) +} func _$WeirdNaming_normalProperty_get(_ self: JSObject) throws(JSException) -> String { let selfValue = self.bridgeJSLowerParameter() @@ -356,21 +416,27 @@ func _$WeirdNaming_try(_ self: JSObject) throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs__Weird_init") -fileprivate func bjs__Weird_init() -> Int32 +fileprivate func bjs__Weird_init_extern() -> Int32 #else -fileprivate func bjs__Weird_init() -> Int32 { +fileprivate func bjs__Weird_init_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs__Weird_init() -> Int32 { + return bjs__Weird_init_extern() +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs__Weird_method_with_dashes") -fileprivate func bjs__Weird_method_with_dashes(_ self: Int32) -> Void +fileprivate func bjs__Weird_method_with_dashes_extern(_ self: Int32) -> Void #else -fileprivate func bjs__Weird_method_with_dashes(_ self: Int32) -> Void { +fileprivate func bjs__Weird_method_with_dashes_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs__Weird_method_with_dashes(_ self: Int32) -> Void { + return bjs__Weird_method_with_dashes_extern(self) +} func _$_Weird_init() throws(JSException) -> JSObject { let ret = bjs__Weird_init() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.swift index 09e828fba..11a644759 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClass.swift @@ -1,11 +1,14 @@ #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_returnAnimatable") -fileprivate func bjs_returnAnimatable() -> Int32 +fileprivate func bjs_returnAnimatable_extern() -> Int32 #else -fileprivate func bjs_returnAnimatable() -> Int32 { +fileprivate func bjs_returnAnimatable_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_returnAnimatable() -> Int32 { + return bjs_returnAnimatable_extern() +} func _$returnAnimatable() throws(JSException) -> Animatable { let ret = bjs_returnAnimatable() @@ -17,57 +20,75 @@ func _$returnAnimatable() throws(JSException) -> Animatable { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_init") -fileprivate func bjs_Greeter_init(_ name: Int32) -> Int32 +fileprivate func bjs_Greeter_init_extern(_ name: Int32) -> Int32 #else -fileprivate func bjs_Greeter_init(_ name: Int32) -> Int32 { +fileprivate func bjs_Greeter_init_extern(_ name: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_Greeter_init(_ name: Int32) -> Int32 { + return bjs_Greeter_init_extern(name) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_name_get") -fileprivate func bjs_Greeter_name_get(_ self: Int32) -> Int32 +fileprivate func bjs_Greeter_name_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_Greeter_name_get(_ self: Int32) -> Int32 { +fileprivate func bjs_Greeter_name_get_extern(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_Greeter_name_get(_ self: Int32) -> Int32 { + return bjs_Greeter_name_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_age_get") -fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 +fileprivate func bjs_Greeter_age_get_extern(_ self: Int32) -> Float64 #else -fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 { +fileprivate func bjs_Greeter_age_get_extern(_ self: Int32) -> Float64 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 { + return bjs_Greeter_age_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_name_set") -fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_Greeter_name_set_extern(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_Greeter_name_set_extern(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { + return bjs_Greeter_name_set_extern(self, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_greet") -fileprivate func bjs_Greeter_greet(_ self: Int32) -> Int32 +fileprivate func bjs_Greeter_greet_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_Greeter_greet(_ self: Int32) -> Int32 { +fileprivate func bjs_Greeter_greet_extern(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_Greeter_greet(_ self: Int32) -> Int32 { + return bjs_Greeter_greet_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_changeName") -fileprivate func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void +fileprivate func bjs_Greeter_changeName_extern(_ self: Int32, _ name: Int32) -> Void #else -fileprivate func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void { +fileprivate func bjs_Greeter_changeName_extern(_ self: Int32, _ name: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void { + return bjs_Greeter_changeName_extern(self, name) +} func _$Greeter_init(_ name: String) throws(JSException) -> JSObject { let nameValue = name.bridgeJSLowerParameter() @@ -125,21 +146,27 @@ func _$Greeter_changeName(_ self: JSObject, _ name: String) throws(JSException) #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Animatable_animate") -fileprivate func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 +fileprivate func bjs_Animatable_animate_extern(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 #else -fileprivate func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 { +fileprivate func bjs_Animatable_animate_extern(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_Animatable_animate(_ self: Int32, _ keyframes: Int32, _ options: Int32) -> Int32 { + return bjs_Animatable_animate_extern(self, keyframes, options) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Animatable_getAnimations") -fileprivate func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 +fileprivate func bjs_Animatable_getAnimations_extern(_ self: Int32, _ options: Int32) -> Int32 #else -fileprivate func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 { +fileprivate func bjs_Animatable_getAnimations_extern(_ self: Int32, _ options: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) -> Int32 { + return bjs_Animatable_getAnimations_extern(self, options) +} func _$Animatable_animate(_ self: JSObject, _ keyframes: JSObject, _ options: JSObject) throws(JSException) -> JSObject { let selfValue = self.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift index 5e297f929..94dfd002b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSClassStaticFunctions.swift @@ -1,47 +1,62 @@ #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_StaticBox_create_static") -fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 +fileprivate func bjs_StaticBox_create_static_extern(_ value: Float64) -> Int32 #else -fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 { +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: "TestModule", name: "bjs_StaticBox_value_static") -fileprivate func bjs_StaticBox_value_static() -> Float64 +fileprivate func bjs_StaticBox_value_static_extern() -> Float64 #else -fileprivate func bjs_StaticBox_value_static() -> Float64 { +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: "TestModule", name: "bjs_StaticBox_makeDefault_static") -fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 +fileprivate func bjs_StaticBox_makeDefault_static_extern() -> Int32 #else -fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 { +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: "TestModule", name: "bjs_StaticBox_dashed_static") -fileprivate func bjs_StaticBox_dashed_static() -> Int32 +fileprivate func bjs_StaticBox_dashed_static_extern() -> Int32 #else -fileprivate func bjs_StaticBox_dashed_static() -> Int32 { +fileprivate func bjs_StaticBox_dashed_static_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_StaticBox_dashed_static() -> Int32 { + return bjs_StaticBox_dashed_static_extern() +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_StaticBox_value") -fileprivate func bjs_StaticBox_value(_ self: Int32) -> Float64 +fileprivate func bjs_StaticBox_value_extern(_ self: Int32) -> Float64 #else -fileprivate func bjs_StaticBox_value(_ self: Int32) -> Float64 { +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_create(_ value: Double) throws(JSException) -> StaticBox { let valueValue = value.bridgeJSLowerParameter() @@ -87,21 +102,27 @@ func _$StaticBox_value(_ self: JSObject) throws(JSException) -> Double { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithCtor_init") -fileprivate func bjs_WithCtor_init(_ value: Float64) -> Int32 +fileprivate func bjs_WithCtor_init_extern(_ value: Float64) -> Int32 #else -fileprivate func bjs_WithCtor_init(_ value: Float64) -> Int32 { +fileprivate func bjs_WithCtor_init_extern(_ value: Float64) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithCtor_init(_ value: Float64) -> Int32 { + return bjs_WithCtor_init_extern(value) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithCtor_create_static") -fileprivate func bjs_WithCtor_create_static(_ value: Float64) -> Int32 +fileprivate func bjs_WithCtor_create_static_extern(_ value: Float64) -> Int32 #else -fileprivate func bjs_WithCtor_create_static(_ value: Float64) -> Int32 { +fileprivate func bjs_WithCtor_create_static_extern(_ value: Float64) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithCtor_create_static(_ value: Float64) -> Int32 { + return bjs_WithCtor_create_static_extern(value) +} func _$WithCtor_init(_ value: Double) throws(JSException) -> JSObject { let valueValue = value.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift index 41d04ebab..ba7fee7af 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/JSValue.swift @@ -145,21 +145,27 @@ extension JSValueHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_JSValueHolder_wrap") -fileprivate func _bjs_JSValueHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_JSValueHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_JSValueHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_JSValueHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_JSValueHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_JSValueHolder_wrap_extern(pointer) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_jsEchoJSValue") -fileprivate func bjs_jsEchoJSValue(_ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64) -> Void +fileprivate func bjs_jsEchoJSValue_extern(_ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64) -> Void #else -fileprivate func bjs_jsEchoJSValue(_ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64) -> Void { +fileprivate func bjs_jsEchoJSValue_extern(_ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsEchoJSValue(_ valueKind: Int32, _ valuePayload1: Int32, _ valuePayload2: Float64) -> Void { + return bjs_jsEchoJSValue_extern(valueKind, valuePayload1, valuePayload2) +} func _$jsEchoJSValue(_ value: JSValue) throws(JSException) -> JSValue { let (valueKind, valuePayload1, valuePayload2) = value.bridgeJSLowerParameter() @@ -172,12 +178,15 @@ func _$jsEchoJSValue(_ value: JSValue) throws(JSException) -> JSValue { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_jsEchoJSValueArray") -fileprivate func bjs_jsEchoJSValueArray() -> Void +fileprivate func bjs_jsEchoJSValueArray_extern() -> Void #else -fileprivate func bjs_jsEchoJSValueArray() -> Void { +fileprivate func bjs_jsEchoJSValueArray_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsEchoJSValueArray() -> Void { + return bjs_jsEchoJSValueArray_extern() +} func _$jsEchoJSValueArray(_ values: [JSValue]) throws(JSException) -> [JSValue] { let _ = values.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedGlobal.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedGlobal.swift index 981e01be4..195a00fa1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedGlobal.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedGlobal.swift @@ -49,9 +49,12 @@ extension GlobalClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_GlobalClass_wrap") -fileprivate func _bjs_GlobalClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_GlobalClass_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_GlobalClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_GlobalClass_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_GlobalClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_GlobalClass_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedPrivate.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedPrivate.swift index 1e9eae2bf..6112dd3e4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedPrivate.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/MixedPrivate.swift @@ -49,9 +49,12 @@ extension PrivateClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_PrivateClass_wrap") -fileprivate func _bjs_PrivateClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PrivateClass_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PrivateClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PrivateClass_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_PrivateClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_PrivateClass_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.swift index cb19c6854..c4db9f0fb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.Global.swift @@ -60,12 +60,15 @@ extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") -fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Greeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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_Converter_init") @_cdecl("bjs_Converter_init") @@ -107,12 +110,15 @@ extension Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Converter_wrap_extern(pointer) +} @_expose(wasm, "bjs_UUID_uuidString") @_cdecl("bjs_UUID_uuidString") @@ -143,9 +149,12 @@ extension UUID: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_UUID_wrap") -fileprivate func _bjs_UUID_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_UUID_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_UUID_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_UUID_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_UUID_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_UUID_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.swift index cb19c6854..c4db9f0fb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Namespaces.swift @@ -60,12 +60,15 @@ extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") -fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Greeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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_Converter_init") @_cdecl("bjs_Converter_init") @@ -107,12 +110,15 @@ extension Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Converter_wrap") -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Converter_wrap_extern(pointer) +} @_expose(wasm, "bjs_UUID_uuidString") @_cdecl("bjs_UUID_uuidString") @@ -143,9 +149,12 @@ extension UUID: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_UUID_wrap") -fileprivate func _bjs_UUID_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_UUID_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_UUID_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_UUID_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_UUID_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_UUID_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift index 471d38a6c..eafbd3253 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.swift @@ -234,12 +234,15 @@ extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") -fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Greeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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_OptionalPropertyHolder_init") @_cdecl("bjs_OptionalPropertyHolder_init") @@ -333,237 +336,315 @@ extension OptionalPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_OptionalPropertyHolder_wrap") -fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_OptionalPropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_init") -fileprivate func bjs_WithOptionalJSClass_init(_ valueOrNullIsSome: Int32, _ valueOrNullValue: Int32, _ valueOrUndefinedIsSome: Int32, _ valueOrUndefinedValue: Int32) -> Int32 +fileprivate func bjs_WithOptionalJSClass_init_extern(_ valueOrNullIsSome: Int32, _ valueOrNullValue: Int32, _ valueOrUndefinedIsSome: Int32, _ valueOrUndefinedValue: Int32) -> Int32 #else -fileprivate func bjs_WithOptionalJSClass_init(_ valueOrNullIsSome: Int32, _ valueOrNullValue: Int32, _ valueOrUndefinedIsSome: Int32, _ valueOrUndefinedValue: Int32) -> Int32 { +fileprivate func bjs_WithOptionalJSClass_init_extern(_ valueOrNullIsSome: Int32, _ valueOrNullValue: Int32, _ valueOrUndefinedIsSome: Int32, _ valueOrUndefinedValue: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_init(_ valueOrNullIsSome: Int32, _ valueOrNullValue: Int32, _ valueOrUndefinedIsSome: Int32, _ valueOrUndefinedValue: Int32) -> Int32 { + return bjs_WithOptionalJSClass_init_extern(valueOrNullIsSome, valueOrNullValue, valueOrUndefinedIsSome, valueOrUndefinedValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_stringOrNull_get") -fileprivate func bjs_WithOptionalJSClass_stringOrNull_get(_ self: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_stringOrNull_get_extern(_ self: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_stringOrNull_get(_ self: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_stringOrNull_get_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_stringOrNull_get(_ self: Int32) -> Void { + return bjs_WithOptionalJSClass_stringOrNull_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_stringOrUndefined_get") -fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_get(_ self: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_get_extern(_ self: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_get(_ self: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_get_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_get(_ self: Int32) -> Void { + return bjs_WithOptionalJSClass_stringOrUndefined_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_doubleOrNull_get") -fileprivate func bjs_WithOptionalJSClass_doubleOrNull_get(_ self: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_doubleOrNull_get_extern(_ self: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_doubleOrNull_get(_ self: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_doubleOrNull_get_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_doubleOrNull_get(_ self: Int32) -> Void { + return bjs_WithOptionalJSClass_doubleOrNull_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_doubleOrUndefined_get") -fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_get(_ self: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_get_extern(_ self: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_get(_ self: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_get_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_get(_ self: Int32) -> Void { + return bjs_WithOptionalJSClass_doubleOrUndefined_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_boolOrNull_get") -fileprivate func bjs_WithOptionalJSClass_boolOrNull_get(_ self: Int32) -> Int32 +fileprivate func bjs_WithOptionalJSClass_boolOrNull_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_WithOptionalJSClass_boolOrNull_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WithOptionalJSClass_boolOrNull_get_extern(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_boolOrNull_get(_ self: Int32) -> Int32 { + return bjs_WithOptionalJSClass_boolOrNull_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_boolOrUndefined_get") -fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_get(_ self: Int32) -> Int32 +fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_get_extern(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_get(_ self: Int32) -> Int32 { + return bjs_WithOptionalJSClass_boolOrUndefined_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_intOrNull_get") -fileprivate func bjs_WithOptionalJSClass_intOrNull_get(_ self: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_intOrNull_get_extern(_ self: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_intOrNull_get(_ self: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_intOrNull_get_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_intOrNull_get(_ self: Int32) -> Void { + return bjs_WithOptionalJSClass_intOrNull_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_intOrUndefined_get") -fileprivate func bjs_WithOptionalJSClass_intOrUndefined_get(_ self: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_intOrUndefined_get_extern(_ self: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_intOrUndefined_get(_ self: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_intOrUndefined_get_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_intOrUndefined_get(_ self: Int32) -> Void { + return bjs_WithOptionalJSClass_intOrUndefined_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_stringOrNull_set") -fileprivate func bjs_WithOptionalJSClass_stringOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_stringOrNull_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_stringOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_stringOrNull_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_stringOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_WithOptionalJSClass_stringOrNull_set_extern(self, newValueIsSome, newValueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_stringOrUndefined_set") -fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_stringOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_WithOptionalJSClass_stringOrUndefined_set_extern(self, newValueIsSome, newValueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_doubleOrNull_set") -fileprivate func bjs_WithOptionalJSClass_doubleOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void +fileprivate func bjs_WithOptionalJSClass_doubleOrNull_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void #else -fileprivate func bjs_WithOptionalJSClass_doubleOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void { +fileprivate func bjs_WithOptionalJSClass_doubleOrNull_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_doubleOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void { + return bjs_WithOptionalJSClass_doubleOrNull_set_extern(self, newValueIsSome, newValueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_doubleOrUndefined_set") -fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void +fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void #else -fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void { +fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_doubleOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Float64) -> Void { + return bjs_WithOptionalJSClass_doubleOrUndefined_set_extern(self, newValueIsSome, newValueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_boolOrNull_set") -fileprivate func bjs_WithOptionalJSClass_boolOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_boolOrNull_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_boolOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_boolOrNull_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_boolOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_WithOptionalJSClass_boolOrNull_set_extern(self, newValueIsSome, newValueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_boolOrUndefined_set") -fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_boolOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_WithOptionalJSClass_boolOrUndefined_set_extern(self, newValueIsSome, newValueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_intOrNull_set") -fileprivate func bjs_WithOptionalJSClass_intOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_intOrNull_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_intOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_intOrNull_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_intOrNull_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_WithOptionalJSClass_intOrNull_set_extern(self, newValueIsSome, newValueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_intOrUndefined_set") -fileprivate func bjs_WithOptionalJSClass_intOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_intOrUndefined_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_intOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_intOrUndefined_set_extern(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_intOrUndefined_set(_ self: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_WithOptionalJSClass_intOrUndefined_set_extern(self, newValueIsSome, newValueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripStringOrNull") -fileprivate func bjs_WithOptionalJSClass_roundTripStringOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_roundTripStringOrNull_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_roundTripStringOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_roundTripStringOrNull_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_roundTripStringOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { + return bjs_WithOptionalJSClass_roundTripStringOrNull_extern(self, valueIsSome, valueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripStringOrUndefined") -fileprivate func bjs_WithOptionalJSClass_roundTripStringOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_roundTripStringOrUndefined_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_roundTripStringOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_roundTripStringOrUndefined_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_roundTripStringOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { + return bjs_WithOptionalJSClass_roundTripStringOrUndefined_extern(self, valueIsSome, valueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripDoubleOrNull") -fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void +fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrNull_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void #else -fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void { +fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrNull_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void { + return bjs_WithOptionalJSClass_roundTripDoubleOrNull_extern(self, valueIsSome, valueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripDoubleOrUndefined") -fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void +fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrUndefined_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void #else -fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void { +fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrUndefined_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_roundTripDoubleOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Float64) -> Void { + return bjs_WithOptionalJSClass_roundTripDoubleOrUndefined_extern(self, valueIsSome, valueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripBoolOrNull") -fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 +fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrNull_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 #else -fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 { +fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrNull_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 { + return bjs_WithOptionalJSClass_roundTripBoolOrNull_extern(self, valueIsSome, valueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripBoolOrUndefined") -fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 +fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrUndefined_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 #else -fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 { +fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrUndefined_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_roundTripBoolOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Int32 { + return bjs_WithOptionalJSClass_roundTripBoolOrUndefined_extern(self, valueIsSome, valueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripIntOrNull") -fileprivate func bjs_WithOptionalJSClass_roundTripIntOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_roundTripIntOrNull_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_roundTripIntOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_roundTripIntOrNull_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_roundTripIntOrNull(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { + return bjs_WithOptionalJSClass_roundTripIntOrNull_extern(self, valueIsSome, valueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_WithOptionalJSClass_roundTripIntOrUndefined") -fileprivate func bjs_WithOptionalJSClass_roundTripIntOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void +fileprivate func bjs_WithOptionalJSClass_roundTripIntOrUndefined_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void #else -fileprivate func bjs_WithOptionalJSClass_roundTripIntOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { +fileprivate func bjs_WithOptionalJSClass_roundTripIntOrUndefined_extern(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_WithOptionalJSClass_roundTripIntOrUndefined(_ self: Int32, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { + return bjs_WithOptionalJSClass_roundTripIntOrUndefined_extern(self, valueIsSome, valueValue) +} func _$WithOptionalJSClass_init(_ valueOrNull: Optional, _ valueOrUndefined: JSUndefinedOr) throws(JSException) -> JSObject { let (valueOrNullIsSome, valueOrNullValue) = valueOrNull.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.swift index 763cf8ca4..3f9448a4b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveParameters.swift @@ -10,12 +10,15 @@ public func _bjs_check(_ a: Int32, _ b: Int32, _ c: Float32, _ d: Float64, _ e: #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_check") -fileprivate func bjs_check(_ a: Float64, _ b: Int32) -> Void +fileprivate func bjs_check_extern(_ a: Float64, _ b: Int32) -> Void #else -fileprivate func bjs_check(_ a: Float64, _ b: Int32) -> Void { +fileprivate func bjs_check_extern(_ a: Float64, _ b: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_check(_ a: Float64, _ b: Int32) -> Void { + return bjs_check_extern(a, b) +} func _$check(_ a: Double, _ b: Bool) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.swift index 3bbb2809b..ace70a9c6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PrimitiveReturn.swift @@ -55,12 +55,15 @@ public func _bjs_checkBool() -> Int32 { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_checkNumber") -fileprivate func bjs_checkNumber() -> Float64 +fileprivate func bjs_checkNumber_extern() -> Float64 #else -fileprivate func bjs_checkNumber() -> Float64 { +fileprivate func bjs_checkNumber_extern() -> Float64 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_checkNumber() -> Float64 { + return bjs_checkNumber_extern() +} func _$checkNumber() throws(JSException) -> Double { let ret = bjs_checkNumber() @@ -72,12 +75,15 @@ func _$checkNumber() throws(JSException) -> Double { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_checkBoolean") -fileprivate func bjs_checkBoolean() -> Int32 +fileprivate func bjs_checkBoolean_extern() -> Int32 #else -fileprivate func bjs_checkBoolean() -> Int32 { +fileprivate func bjs_checkBoolean_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_checkBoolean() -> Int32 { + return bjs_checkBoolean_extern() +} func _$checkBoolean() throws(JSException) -> Bool { let ret = bjs_checkBoolean() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.swift index b5b3c8d9e..de59f5166 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/PropertyTypes.swift @@ -336,9 +336,12 @@ extension PropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_PropertyHolder_wrap") -fileprivate func _bjs_PropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_PropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_PropertyHolder_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift index 56aeb71cc..785cb997a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Protocol.swift @@ -219,300 +219,399 @@ struct AnyMyViewControllerDelegate: MyViewControllerDelegate, _BridgedSwiftProto #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onSomethingHappened") -fileprivate func _extern_onSomethingHappened(_ jsObject: Int32) -> Void +fileprivate func _extern_onSomethingHappened_extern(_ jsObject: Int32) -> Void #else -fileprivate func _extern_onSomethingHappened(_ jsObject: Int32) -> Void { +fileprivate func _extern_onSomethingHappened_extern(_ jsObject: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _extern_onSomethingHappened(_ jsObject: Int32) -> Void { + return _extern_onSomethingHappened_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onValueChanged") -fileprivate func _extern_onValueChanged(_ jsObject: Int32, _ value: Int32) -> Void +fileprivate func _extern_onValueChanged_extern(_ jsObject: Int32, _ value: Int32) -> Void #else -fileprivate func _extern_onValueChanged(_ jsObject: Int32, _ value: Int32) -> Void { +fileprivate func _extern_onValueChanged_extern(_ jsObject: Int32, _ value: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _extern_onValueChanged(_ jsObject: Int32, _ value: Int32) -> Void { + return _extern_onValueChanged_extern(jsObject, value) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onCountUpdated") -fileprivate func _extern_onCountUpdated(_ jsObject: Int32, _ count: Int32) -> Int32 +fileprivate func _extern_onCountUpdated_extern(_ jsObject: Int32, _ count: Int32) -> Int32 #else -fileprivate func _extern_onCountUpdated(_ jsObject: Int32, _ count: Int32) -> Int32 { +fileprivate func _extern_onCountUpdated_extern(_ jsObject: Int32, _ count: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _extern_onCountUpdated(_ jsObject: Int32, _ count: Int32) -> Int32 { + return _extern_onCountUpdated_extern(jsObject, count) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onLabelUpdated") -fileprivate func _extern_onLabelUpdated(_ jsObject: Int32, _ prefix: Int32, _ suffix: Int32) -> Void +fileprivate func _extern_onLabelUpdated_extern(_ jsObject: Int32, _ prefix: Int32, _ suffix: Int32) -> Void #else -fileprivate func _extern_onLabelUpdated(_ jsObject: Int32, _ prefix: Int32, _ suffix: Int32) -> Void { +fileprivate func _extern_onLabelUpdated_extern(_ jsObject: Int32, _ prefix: Int32, _ suffix: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _extern_onLabelUpdated(_ jsObject: Int32, _ prefix: Int32, _ suffix: Int32) -> Void { + return _extern_onLabelUpdated_extern(jsObject, prefix, suffix) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_isCountEven") -fileprivate func _extern_isCountEven(_ jsObject: Int32) -> Int32 +fileprivate func _extern_isCountEven_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func _extern_isCountEven(_ jsObject: Int32) -> Int32 { +fileprivate func _extern_isCountEven_extern(_ jsObject: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _extern_isCountEven(_ jsObject: Int32) -> Int32 { + return _extern_isCountEven_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onHelperUpdated") -fileprivate func _extern_onHelperUpdated(_ jsObject: Int32, _ helper: UnsafeMutableRawPointer) -> Void +fileprivate func _extern_onHelperUpdated_extern(_ jsObject: Int32, _ helper: UnsafeMutableRawPointer) -> Void #else -fileprivate func _extern_onHelperUpdated(_ jsObject: Int32, _ helper: UnsafeMutableRawPointer) -> Void { +fileprivate func _extern_onHelperUpdated_extern(_ jsObject: Int32, _ helper: UnsafeMutableRawPointer) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _extern_onHelperUpdated(_ jsObject: Int32, _ helper: UnsafeMutableRawPointer) -> Void { + return _extern_onHelperUpdated_extern(jsObject, helper) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createHelper") -fileprivate func _extern_createHelper(_ jsObject: Int32) -> UnsafeMutableRawPointer +fileprivate func _extern_createHelper_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer #else -fileprivate func _extern_createHelper(_ jsObject: Int32) -> UnsafeMutableRawPointer { +fileprivate func _extern_createHelper_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _extern_createHelper(_ jsObject: Int32) -> UnsafeMutableRawPointer { + return _extern_createHelper_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_onOptionalHelperUpdated") -fileprivate func _extern_onOptionalHelperUpdated(_ jsObject: Int32, _ helperIsSome: Int32, _ helperPointer: UnsafeMutableRawPointer) -> Void +fileprivate func _extern_onOptionalHelperUpdated_extern(_ jsObject: Int32, _ helperIsSome: Int32, _ helperPointer: UnsafeMutableRawPointer) -> Void #else -fileprivate func _extern_onOptionalHelperUpdated(_ jsObject: Int32, _ helperIsSome: Int32, _ helperPointer: UnsafeMutableRawPointer) -> Void { +fileprivate func _extern_onOptionalHelperUpdated_extern(_ jsObject: Int32, _ helperIsSome: Int32, _ helperPointer: UnsafeMutableRawPointer) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _extern_onOptionalHelperUpdated(_ jsObject: Int32, _ helperIsSome: Int32, _ helperPointer: UnsafeMutableRawPointer) -> Void { + return _extern_onOptionalHelperUpdated_extern(jsObject, helperIsSome, helperPointer) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createOptionalHelper") -fileprivate func _extern_createOptionalHelper(_ jsObject: Int32) -> UnsafeMutableRawPointer +fileprivate func _extern_createOptionalHelper_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer #else -fileprivate func _extern_createOptionalHelper(_ jsObject: Int32) -> UnsafeMutableRawPointer { +fileprivate func _extern_createOptionalHelper_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _extern_createOptionalHelper(_ jsObject: Int32) -> UnsafeMutableRawPointer { + return _extern_createOptionalHelper_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_createEnum") -fileprivate func _extern_createEnum(_ jsObject: Int32) -> Int32 +fileprivate func _extern_createEnum_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func _extern_createEnum(_ jsObject: Int32) -> Int32 { +fileprivate func _extern_createEnum_extern(_ jsObject: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _extern_createEnum(_ jsObject: Int32) -> Int32 { + return _extern_createEnum_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_handleResult") -fileprivate func _extern_handleResult(_ jsObject: Int32, _ result: Int32) -> Void +fileprivate func _extern_handleResult_extern(_ jsObject: Int32, _ result: Int32) -> Void #else -fileprivate func _extern_handleResult(_ jsObject: Int32, _ result: Int32) -> Void { +fileprivate func _extern_handleResult_extern(_ jsObject: Int32, _ result: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _extern_handleResult(_ jsObject: Int32, _ result: Int32) -> Void { + return _extern_handleResult_extern(jsObject, result) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_getResult") -fileprivate func _extern_getResult(_ jsObject: Int32) -> Int32 +fileprivate func _extern_getResult_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func _extern_getResult(_ jsObject: Int32) -> Int32 { +fileprivate func _extern_getResult_extern(_ jsObject: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _extern_getResult(_ jsObject: Int32) -> Int32 { + return _extern_getResult_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_get") -fileprivate func bjs_MyViewControllerDelegate_eventCount_get(_ jsObject: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_eventCount_get_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func bjs_MyViewControllerDelegate_eventCount_get(_ jsObject: Int32) -> Int32 { +fileprivate func bjs_MyViewControllerDelegate_eventCount_get_extern(_ jsObject: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_eventCount_get(_ jsObject: Int32) -> Int32 { + return bjs_MyViewControllerDelegate_eventCount_get_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_eventCount_set") -fileprivate func bjs_MyViewControllerDelegate_eventCount_set(_ jsObject: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_MyViewControllerDelegate_eventCount_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_MyViewControllerDelegate_eventCount_set(_ jsObject: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_MyViewControllerDelegate_eventCount_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_eventCount_set(_ jsObject: Int32, _ newValue: Int32) -> Void { + return bjs_MyViewControllerDelegate_eventCount_set_extern(jsObject, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_delegateName_get") -fileprivate func bjs_MyViewControllerDelegate_delegateName_get(_ jsObject: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_delegateName_get_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func bjs_MyViewControllerDelegate_delegateName_get(_ jsObject: Int32) -> Int32 { +fileprivate func bjs_MyViewControllerDelegate_delegateName_get_extern(_ jsObject: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_delegateName_get(_ jsObject: Int32) -> Int32 { + return bjs_MyViewControllerDelegate_delegateName_get_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_get") -fileprivate func bjs_MyViewControllerDelegate_optionalName_get(_ jsObject: Int32) -> Void +fileprivate func bjs_MyViewControllerDelegate_optionalName_get_extern(_ jsObject: Int32) -> Void #else -fileprivate func bjs_MyViewControllerDelegate_optionalName_get(_ jsObject: Int32) -> Void { +fileprivate func bjs_MyViewControllerDelegate_optionalName_get_extern(_ jsObject: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_optionalName_get(_ jsObject: Int32) -> Void { + return bjs_MyViewControllerDelegate_optionalName_get_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalName_set") -fileprivate func bjs_MyViewControllerDelegate_optionalName_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_MyViewControllerDelegate_optionalName_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_MyViewControllerDelegate_optionalName_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +fileprivate func bjs_MyViewControllerDelegate_optionalName_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_optionalName_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_MyViewControllerDelegate_optionalName_set_extern(jsObject, newValueIsSome, newValueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalRawEnum_get") -fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_get(_ jsObject: Int32) -> Void +fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_get_extern(_ jsObject: Int32) -> Void #else -fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_get(_ jsObject: Int32) -> Void { +fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_get_extern(_ jsObject: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_get(_ jsObject: Int32) -> Void { + return bjs_MyViewControllerDelegate_optionalRawEnum_get_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalRawEnum_set") -fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_optionalRawEnum_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_MyViewControllerDelegate_optionalRawEnum_set_extern(jsObject, newValueIsSome, newValueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_rawStringEnum_get") -fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_get(_ jsObject: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_get_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_get(_ jsObject: Int32) -> Int32 { +fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_get_extern(_ jsObject: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_get(_ jsObject: Int32) -> Int32 { + return bjs_MyViewControllerDelegate_rawStringEnum_get_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_rawStringEnum_set") -fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_set(_ jsObject: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_set(_ jsObject: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_rawStringEnum_set(_ jsObject: Int32, _ newValue: Int32) -> Void { + return bjs_MyViewControllerDelegate_rawStringEnum_set_extern(jsObject, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_get") -fileprivate func bjs_MyViewControllerDelegate_result_get(_ jsObject: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_result_get_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func bjs_MyViewControllerDelegate_result_get(_ jsObject: Int32) -> Int32 { +fileprivate func bjs_MyViewControllerDelegate_result_get_extern(_ jsObject: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_result_get(_ jsObject: Int32) -> Int32 { + return bjs_MyViewControllerDelegate_result_get_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_result_set") -fileprivate func bjs_MyViewControllerDelegate_result_set(_ jsObject: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_MyViewControllerDelegate_result_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_MyViewControllerDelegate_result_set(_ jsObject: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_MyViewControllerDelegate_result_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_result_set(_ jsObject: Int32, _ newValue: Int32) -> Void { + return bjs_MyViewControllerDelegate_result_set_extern(jsObject, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalResult_get") -fileprivate func bjs_MyViewControllerDelegate_optionalResult_get(_ jsObject: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_optionalResult_get_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func bjs_MyViewControllerDelegate_optionalResult_get(_ jsObject: Int32) -> Int32 { +fileprivate func bjs_MyViewControllerDelegate_optionalResult_get_extern(_ jsObject: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_optionalResult_get(_ jsObject: Int32) -> Int32 { + return bjs_MyViewControllerDelegate_optionalResult_get_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_optionalResult_set") -fileprivate func bjs_MyViewControllerDelegate_optionalResult_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void +fileprivate func bjs_MyViewControllerDelegate_optionalResult_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void #else -fileprivate func bjs_MyViewControllerDelegate_optionalResult_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void { +fileprivate func bjs_MyViewControllerDelegate_optionalResult_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_optionalResult_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void { + return bjs_MyViewControllerDelegate_optionalResult_set_extern(jsObject, newValueIsSome, newValueCaseId) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_direction_get") -fileprivate func bjs_MyViewControllerDelegate_direction_get(_ jsObject: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_direction_get_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func bjs_MyViewControllerDelegate_direction_get(_ jsObject: Int32) -> Int32 { +fileprivate func bjs_MyViewControllerDelegate_direction_get_extern(_ jsObject: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_direction_get(_ jsObject: Int32) -> Int32 { + return bjs_MyViewControllerDelegate_direction_get_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_direction_set") -fileprivate func bjs_MyViewControllerDelegate_direction_set(_ jsObject: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_MyViewControllerDelegate_direction_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_MyViewControllerDelegate_direction_set(_ jsObject: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_MyViewControllerDelegate_direction_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_direction_set(_ jsObject: Int32, _ newValue: Int32) -> Void { + return bjs_MyViewControllerDelegate_direction_set_extern(jsObject, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_directionOptional_get") -fileprivate func bjs_MyViewControllerDelegate_directionOptional_get(_ jsObject: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_directionOptional_get_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func bjs_MyViewControllerDelegate_directionOptional_get(_ jsObject: Int32) -> Int32 { +fileprivate func bjs_MyViewControllerDelegate_directionOptional_get_extern(_ jsObject: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_directionOptional_get(_ jsObject: Int32) -> Int32 { + return bjs_MyViewControllerDelegate_directionOptional_get_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_directionOptional_set") -fileprivate func bjs_MyViewControllerDelegate_directionOptional_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_MyViewControllerDelegate_directionOptional_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_MyViewControllerDelegate_directionOptional_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +fileprivate func bjs_MyViewControllerDelegate_directionOptional_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_directionOptional_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_MyViewControllerDelegate_directionOptional_set_extern(jsObject, newValueIsSome, newValueValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priority_get") -fileprivate func bjs_MyViewControllerDelegate_priority_get(_ jsObject: Int32) -> Int32 +fileprivate func bjs_MyViewControllerDelegate_priority_get_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func bjs_MyViewControllerDelegate_priority_get(_ jsObject: Int32) -> Int32 { +fileprivate func bjs_MyViewControllerDelegate_priority_get_extern(_ jsObject: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_priority_get(_ jsObject: Int32) -> Int32 { + return bjs_MyViewControllerDelegate_priority_get_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priority_set") -fileprivate func bjs_MyViewControllerDelegate_priority_set(_ jsObject: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_MyViewControllerDelegate_priority_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_MyViewControllerDelegate_priority_set(_ jsObject: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_MyViewControllerDelegate_priority_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_priority_set(_ jsObject: Int32, _ newValue: Int32) -> Void { + return bjs_MyViewControllerDelegate_priority_set_extern(jsObject, newValue) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priorityOptional_get") -fileprivate func bjs_MyViewControllerDelegate_priorityOptional_get(_ jsObject: Int32) -> Void +fileprivate func bjs_MyViewControllerDelegate_priorityOptional_get_extern(_ jsObject: Int32) -> Void #else -fileprivate func bjs_MyViewControllerDelegate_priorityOptional_get(_ jsObject: Int32) -> Void { +fileprivate func bjs_MyViewControllerDelegate_priorityOptional_get_extern(_ jsObject: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_priorityOptional_get(_ jsObject: Int32) -> Void { + return bjs_MyViewControllerDelegate_priorityOptional_get_extern(jsObject) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewControllerDelegate_priorityOptional_set") -fileprivate func bjs_MyViewControllerDelegate_priorityOptional_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_MyViewControllerDelegate_priorityOptional_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_MyViewControllerDelegate_priorityOptional_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +fileprivate func bjs_MyViewControllerDelegate_priorityOptional_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_MyViewControllerDelegate_priorityOptional_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_MyViewControllerDelegate_priorityOptional_set_extern(jsObject, newValueIsSome, newValueValue) +} extension Direction: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { @@ -658,12 +757,15 @@ extension Helper: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Helper_wrap") -fileprivate func _bjs_Helper_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Helper_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Helper_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Helper_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_Helper_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Helper_wrap_extern(pointer) +} @_expose(wasm, "bjs_MyViewController_init") @_cdecl("bjs_MyViewController_init") @@ -798,12 +900,15 @@ extension MyViewController: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MyViewController_wrap") -fileprivate func _bjs_MyViewController_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_MyViewController_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_MyViewController_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_MyViewController_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_MyViewController_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_MyViewController_wrap_extern(pointer) +} @_expose(wasm, "bjs_DelegateManager_init") @_cdecl("bjs_DelegateManager_init") @@ -865,9 +970,12 @@ extension DelegateManager: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_DelegateManager_wrap") -fileprivate func _bjs_DelegateManager_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_DelegateManager_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_DelegateManager_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_DelegateManager_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_DelegateManager_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_DelegateManager_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift index 8ad34d283..b6d35a215 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.Global.swift @@ -152,9 +152,12 @@ extension MathUtils: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MathUtils_wrap") -fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_MathUtils_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_MathUtils_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_MathUtils_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift index 8ad34d283..b6d35a215 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticFunctions.swift @@ -152,9 +152,12 @@ extension MathUtils: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_MathUtils_wrap") -fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_MathUtils_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_MathUtils_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_MathUtils_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.swift index 6510fd89f..43b1861ca 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.Global.swift @@ -327,9 +327,12 @@ extension PropertyClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_PropertyClass_wrap") -fileprivate func _bjs_PropertyClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PropertyClass_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PropertyClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PropertyClass_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_PropertyClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_PropertyClass_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.swift index 6510fd89f..43b1861ca 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StaticProperties.swift @@ -327,9 +327,12 @@ extension PropertyClass: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_PropertyClass_wrap") -fileprivate func _bjs_PropertyClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PropertyClass_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PropertyClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PropertyClass_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_PropertyClass_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_PropertyClass_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringParameter.swift index e9e3c2d89..427c2b576 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringParameter.swift @@ -21,12 +21,15 @@ public func _bjs_roundtripString(_ aBytes: Int32, _ aLength: Int32) -> Void { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_checkString") -fileprivate func bjs_checkString(_ a: Int32) -> Void +fileprivate func bjs_checkString_extern(_ a: Int32) -> Void #else -fileprivate func bjs_checkString(_ a: Int32) -> Void { +fileprivate func bjs_checkString_extern(_ a: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_checkString(_ a: Int32) -> Void { + return bjs_checkString_extern(a) +} func _$checkString(_ a: String) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() @@ -38,12 +41,15 @@ func _$checkString(_ a: String) throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_checkStringWithLength") -fileprivate func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void +fileprivate func bjs_checkStringWithLength_extern(_ a: Int32, _ b: Float64) -> Void #else -fileprivate func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void { +fileprivate func bjs_checkStringWithLength_extern(_ a: Int32, _ b: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void { + return bjs_checkStringWithLength_extern(a, b) +} func _$checkStringWithLength(_ a: String, _ b: Double) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringReturn.swift index 9de24ef73..6a4cf795a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/StringReturn.swift @@ -11,12 +11,15 @@ public func _bjs_checkString() -> Void { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_checkString") -fileprivate func bjs_checkString() -> Int32 +fileprivate func bjs_checkString_extern() -> Int32 #else -fileprivate func bjs_checkString() -> Int32 { +fileprivate func bjs_checkString_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_checkString() -> Int32 { + return bjs_checkString_extern() +} func _$checkString() throws(JSException) -> String { let ret = bjs_checkString() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift index ca82b87c4..0e9434832 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClass.swift @@ -79,12 +79,15 @@ extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") -fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Greeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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_PublicGreeter_deinit") @_cdecl("bjs_PublicGreeter_deinit") @@ -104,12 +107,15 @@ extension PublicGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_PublicGreeter_wrap") -fileprivate func _bjs_PublicGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PublicGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PublicGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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") @@ -129,21 +135,27 @@ extension PackageGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_PackageGreeter_wrap") -fileprivate func _bjs_PackageGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PackageGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PackageGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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) +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_jsRoundTripGreeter") -fileprivate func bjs_jsRoundTripGreeter(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +fileprivate func bjs_jsRoundTripGreeter_extern(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer #else -fileprivate func bjs_jsRoundTripGreeter(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +fileprivate func bjs_jsRoundTripGreeter_extern(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripGreeter(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + return bjs_jsRoundTripGreeter_extern(greeter) +} func _$jsRoundTripGreeter(_ greeter: Greeter) throws(JSException) -> Greeter { let greeterPointer = greeter.bridgeJSLowerParameter() @@ -156,12 +168,15 @@ func _$jsRoundTripGreeter(_ greeter: Greeter) throws(JSException) -> Greeter { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_jsRoundTripOptionalGreeter") -fileprivate func bjs_jsRoundTripOptionalGreeter(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +fileprivate func bjs_jsRoundTripOptionalGreeter_extern(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer #else -fileprivate func bjs_jsRoundTripOptionalGreeter(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +fileprivate func bjs_jsRoundTripOptionalGreeter_extern(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripOptionalGreeter(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + return bjs_jsRoundTripOptionalGreeter_extern(greeterIsSome, greeterPointer) +} func _$jsRoundTripOptionalGreeter(_ greeter: Optional) throws(JSException) -> Optional { let (greeterIsSome, greeterPointer) = greeter.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift index 925ab5937..d4bdc4a58 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosure.swift @@ -1,20 +1,26 @@ #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO") -fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO_extern(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_TestModule_10TestModule10HttpStatusO_10HttpStatusO_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO") -fileprivate func make_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpStatusO_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModule10HttpStatusO_10HttpStatusO { static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> HttpStatus { @@ -57,21 +63,27 @@ public func _invoke_swift_closure_TestModule_10TestModule10HttpStatusO_10HttpSta #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO") -fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO_extern(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_TestModule_10TestModule5ThemeO_5ThemeO_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO") -fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModule5ThemeO_5ThemeO { static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Theme { @@ -114,21 +126,27 @@ public func _invoke_swift_closure_TestModule_10TestModule5ThemeO_5ThemeO(_ boxPt #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC") -fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC_extern(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer #else -fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC_extern(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + return invoke_js_callback_TestModule_10TestModule6PersonC_6PersonC_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule6PersonC_6PersonC") -fileprivate func make_swift_closure_TestModule_10TestModule6PersonC_6PersonC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModule6PersonC_6PersonC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModule6PersonC_6PersonC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModule6PersonC_6PersonC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModule6PersonC_6PersonC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModule6PersonC_6PersonC_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModule6PersonC_6PersonC { static func bridgeJSLift(_ callbackId: Int32) -> (Person) -> Person { @@ -171,21 +189,27 @@ public func _invoke_swift_closure_TestModule_10TestModule6PersonC_6PersonC(_ box #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO") -fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO_extern(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_TestModule_10TestModule9APIResultO_9APIResultO_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO") -fileprivate func make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModule9APIResultO_9APIResultO { static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> APIResult { @@ -228,21 +252,27 @@ public func _invoke_swift_closure_TestModule_10TestModule9APIResultO_9APIResultO #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO") -fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO_extern(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_TestModule_10TestModule9DirectionO_9DirectionO_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO") -fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModule9DirectionO_9DirectionO { static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Direction { @@ -285,21 +315,27 @@ public func _invoke_swift_closure_TestModule_10TestModule9DirectionO_9DirectionO #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSS_SS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_TestModule_10TestModuleSS_SS_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSS_SS") -fileprivate func make_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSS_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSS_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSS_SS_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSS_SS { static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { @@ -342,21 +378,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSS_SS(_ boxPtr: UnsafeM #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSb_Sb") -fileprivate func invoke_js_callback_TestModule_10TestModuleSb_Sb(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSb_Sb_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSb_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSb_Sb_extern(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSb_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_TestModule_10TestModuleSb_Sb_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSb_Sb") -fileprivate func make_swift_closure_TestModule_10TestModuleSb_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSb_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSb_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSb_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSb_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSb_Sb_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSb_Sb { static func bridgeJSLift(_ callbackId: Int32) -> (Bool) -> Bool { @@ -399,21 +441,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSb_Sb(_ boxPtr: UnsafeM #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSd_Sd") -fileprivate func invoke_js_callback_TestModule_10TestModuleSd_Sd(_ callback: Int32, _ param0: Float64) -> Float64 +fileprivate func invoke_js_callback_TestModule_10TestModuleSd_Sd_extern(_ callback: Int32, _ param0: Float64) -> Float64 #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSd_Sd(_ callback: Int32, _ param0: Float64) -> Float64 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSd_Sd_extern(_ callback: Int32, _ param0: Float64) -> Float64 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSd_Sd(_ callback: Int32, _ param0: Float64) -> Float64 { + return invoke_js_callback_TestModule_10TestModuleSd_Sd_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSd_Sd") -fileprivate func make_swift_closure_TestModule_10TestModuleSd_Sd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSd_Sd_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSd_Sd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSd_Sd_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSd_Sd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSd_Sd_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSd_Sd { static func bridgeJSLift(_ callbackId: Int32) -> (Double) -> Double { @@ -456,21 +504,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSd_Sd(_ boxPtr: UnsafeM #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSf_Sf") -fileprivate func invoke_js_callback_TestModule_10TestModuleSf_Sf(_ callback: Int32, _ param0: Float32) -> Float32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSf_Sf_extern(_ callback: Int32, _ param0: Float32) -> Float32 #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSf_Sf(_ callback: Int32, _ param0: Float32) -> Float32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSf_Sf_extern(_ callback: Int32, _ param0: Float32) -> Float32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSf_Sf(_ callback: Int32, _ param0: Float32) -> Float32 { + return invoke_js_callback_TestModule_10TestModuleSf_Sf_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSf_Sf") -fileprivate func make_swift_closure_TestModule_10TestModuleSf_Sf(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSf_Sf_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSf_Sf(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSf_Sf_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSf_Sf(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSf_Sf_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSf_Sf { static func bridgeJSLift(_ callbackId: Int32) -> (Float) -> Float { @@ -513,21 +567,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSf_Sf(_ boxPtr: UnsafeM #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSi_Si") -fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_TestModule_10TestModuleSi_Si_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSi_Si") -fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSi_Si_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSi_Si { static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Int { @@ -570,21 +630,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeM #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void +fileprivate func invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { +fileprivate func invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { + return invoke_js_callback_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO_extern(callback, param0IsSome, param0Value) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO") -fileprivate func make_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10HttpStatusO_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSq10HttpStatusO_Sq10HttpStatusO { static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { @@ -627,21 +693,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq10HttpStatusO_Sq10Htt #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void +fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { +fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { + return invoke_js_callback_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO_extern(callback, param0IsSome, param0Value) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO") -fileprivate func make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSq5ThemeO_Sq5ThemeO { static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { @@ -684,21 +756,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq5ThemeO_Sq5ThemeO(_ b #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + return invoke_js_callback_TestModule_10TestModuleSq6PersonC_Sq6PersonC_extern(callback, param0IsSome, param0Pointer) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC") -fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSq6PersonC_Sq6PersonC { static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { @@ -741,21 +819,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq6PersonC_Sq6PersonC(_ #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 { + return invoke_js_callback_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO_extern(callback, param0IsSome, param0CaseId) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO") -fileprivate func make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIResultO_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSq9APIResultO_Sq9APIResultO { static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { @@ -798,21 +882,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq9APIResultO_Sq9APIRes #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO") -fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + return invoke_js_callback_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO_extern(callback, param0IsSome, param0Value) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO") -fileprivate func make_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9DirectionO_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSq9DirectionO_Sq9DirectionO { static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { @@ -855,21 +945,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSq9DirectionO_Sq9Direct #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSqSS_SqSS") -fileprivate func invoke_js_callback_TestModule_10TestModuleSqSS_SqSS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSS_SqSS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSqSS_SqSS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSS_SqSS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSqSS_SqSS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { + return invoke_js_callback_TestModule_10TestModuleSqSS_SqSS_extern(callback, param0IsSome, param0Value) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSqSS_SqSS") -fileprivate func make_swift_closure_TestModule_10TestModuleSqSS_SqSS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSqSS_SqSS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSqSS_SqSS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSqSS_SqSS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSqSS_SqSS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSqSS_SqSS_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSqSS_SqSS { static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { @@ -912,21 +1008,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSqSS_SqSS(_ boxPtr: Uns #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSqSb_SqSb") -fileprivate func invoke_js_callback_TestModule_10TestModuleSqSb_SqSb(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSb_SqSb_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSqSb_SqSb(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSb_SqSb_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSqSb_SqSb(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + return invoke_js_callback_TestModule_10TestModuleSqSb_SqSb_extern(callback, param0IsSome, param0Value) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSqSb_SqSb") -fileprivate func make_swift_closure_TestModule_10TestModuleSqSb_SqSb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSqSb_SqSb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSqSb_SqSb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSqSb_SqSb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSqSb_SqSb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSqSb_SqSb_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSqSb_SqSb { static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { @@ -969,21 +1071,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSqSb_SqSb(_ boxPtr: Uns #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSqSd_SqSd") -fileprivate func invoke_js_callback_TestModule_10TestModuleSqSd_SqSd(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float64) -> Void +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSd_SqSd_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float64) -> Void #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSqSd_SqSd(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float64) -> Void { +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSd_SqSd_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSqSd_SqSd(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float64) -> Void { + return invoke_js_callback_TestModule_10TestModuleSqSd_SqSd_extern(callback, param0IsSome, param0Value) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSqSd_SqSd") -fileprivate func make_swift_closure_TestModule_10TestModuleSqSd_SqSd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSqSd_SqSd_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSqSd_SqSd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSqSd_SqSd_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSqSd_SqSd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSqSd_SqSd_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSqSd_SqSd { static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { @@ -1026,21 +1134,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSqSd_SqSd(_ boxPtr: Uns #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSqSf_SqSf") -fileprivate func invoke_js_callback_TestModule_10TestModuleSqSf_SqSf(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float32) -> Void +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSf_SqSf_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float32) -> Void #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSqSf_SqSf(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float32) -> Void { +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSf_SqSf_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSqSf_SqSf(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float32) -> Void { + return invoke_js_callback_TestModule_10TestModuleSqSf_SqSf_extern(callback, param0IsSome, param0Value) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSqSf_SqSf") -fileprivate func make_swift_closure_TestModule_10TestModuleSqSf_SqSf(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSqSf_SqSf_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSqSf_SqSf(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSqSf_SqSf_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSqSf_SqSf(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSqSf_SqSf_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSqSf_SqSf { static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { @@ -1083,21 +1197,27 @@ public func _invoke_swift_closure_TestModule_10TestModuleSqSf_SqSf(_ boxPtr: Uns #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSqSi_SqSi") -fileprivate func invoke_js_callback_TestModule_10TestModuleSqSi_SqSi(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSi_SqSi_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSqSi_SqSi(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { +fileprivate func invoke_js_callback_TestModule_10TestModuleSqSi_SqSi_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSqSi_SqSi(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { + return invoke_js_callback_TestModule_10TestModuleSqSi_SqSi_extern(callback, param0IsSome, param0Value) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSqSi_SqSi") -fileprivate func make_swift_closure_TestModule_10TestModuleSqSi_SqSi(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSqSi_SqSi_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSqSi_SqSi(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSqSi_SqSi_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSqSi_SqSi(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSqSi_SqSi_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSqSi_SqSi { static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { @@ -1490,12 +1610,15 @@ extension Person: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Person_wrap") -fileprivate func _bjs_Person_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Person_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Person_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Person_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_Person_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Person_wrap_extern(pointer) +} @_expose(wasm, "bjs_TestProcessor_init") @_cdecl("bjs_TestProcessor_init") @@ -1526,9 +1649,12 @@ extension TestProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_TestProcessor_wrap") -fileprivate func _bjs_TestProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TestProcessor_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TestProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestProcessor_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_TestProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_TestProcessor_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.swift index c42c3b36f..f87c8ecca 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftClosureImports.swift @@ -1,20 +1,26 @@ #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_TestModule_10TestModuleSi_Si") -fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_TestModule_10TestModuleSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_TestModule_10TestModuleSi_Si_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_TestModule_10TestModuleSi_Si") -fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 #else -fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func make_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_TestModule_10TestModuleSi_Si_extern(boxPtr, file, line) +} private enum _BJS_Closure_10TestModuleSi_Si { static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Int { @@ -57,12 +63,15 @@ public func _invoke_swift_closure_TestModule_10TestModuleSi_Si(_ boxPtr: UnsafeM #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_applyInt") -fileprivate func bjs_applyInt(_ value: Int32, _ transform: Int32) -> Int32 +fileprivate func bjs_applyInt_extern(_ value: Int32, _ transform: Int32) -> Int32 #else -fileprivate func bjs_applyInt(_ value: Int32, _ transform: Int32) -> Int32 { +fileprivate func bjs_applyInt_extern(_ value: Int32, _ transform: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_applyInt(_ value: Int32, _ transform: Int32) -> Int32 { + return bjs_applyInt_extern(value, transform) +} func _$applyInt(_ value: Int, _ transform: @escaping (Int) -> Int) throws(JSException) -> Int { let valueValue = value.bridgeJSLowerParameter() @@ -79,12 +88,15 @@ func _$applyInt(_ value: Int, _ transform: @escaping (Int) -> Int) throws(JSExce #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_makeAdder") -fileprivate func bjs_makeAdder(_ base: Int32) -> Int32 +fileprivate func bjs_makeAdder_extern(_ base: Int32) -> Int32 #else -fileprivate func bjs_makeAdder(_ base: Int32) -> Int32 { +fileprivate func bjs_makeAdder_extern(_ base: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_makeAdder(_ base: Int32) -> Int32 { + return bjs_makeAdder_extern(base) +} func _$makeAdder(_ base: Int) throws(JSException) -> (Int) -> Int { let baseValue = base.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift index 29abcebca..2adffc113 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStruct.swift @@ -41,21 +41,27 @@ extension DataPoint: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_DataPoint") -fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_DataPoint_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_DataPoint_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_DataPoint() -> Int32 { +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") @@ -100,21 +106,27 @@ extension Address: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Address") -fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Address_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_Address_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Address() -> Int32 { +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 Person: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Person { @@ -150,21 +162,27 @@ extension Person: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Person") -fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Person_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Void { +fileprivate func _bjs_struct_lower_Person_extern(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Void { + return _bjs_struct_lower_Person_extern(objectId) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Person") -fileprivate func _bjs_struct_lift_Person() -> Int32 +fileprivate func _bjs_struct_lift_Person_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Person() -> Int32 { +fileprivate func _bjs_struct_lift_Person_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lift_Person() -> Int32 { + return _bjs_struct_lift_Person_extern() +} extension Session: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Session { @@ -192,21 +210,27 @@ extension Session: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Session") -fileprivate func _bjs_struct_lower_Session(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Session_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Session(_ objectId: Int32) -> Void { +fileprivate func _bjs_struct_lower_Session_extern(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lower_Session(_ objectId: Int32) -> Void { + return _bjs_struct_lower_Session_extern(objectId) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Session") -fileprivate func _bjs_struct_lift_Session() -> Int32 +fileprivate func _bjs_struct_lift_Session_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Session() -> Int32 { +fileprivate func _bjs_struct_lift_Session_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lift_Session() -> Int32 { + return _bjs_struct_lift_Session_extern() +} extension Measurement: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Measurement { @@ -240,21 +264,27 @@ extension Measurement: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Measurement") -fileprivate func _bjs_struct_lower_Measurement(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Measurement_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Measurement(_ objectId: Int32) -> Void { +fileprivate func _bjs_struct_lower_Measurement_extern(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lower_Measurement(_ objectId: Int32) -> Void { + return _bjs_struct_lower_Measurement_extern(objectId) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Measurement") -fileprivate func _bjs_struct_lift_Measurement() -> Int32 +fileprivate func _bjs_struct_lift_Measurement_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Measurement() -> Int32 { +fileprivate func _bjs_struct_lift_Measurement_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lift_Measurement() -> Int32 { + return _bjs_struct_lift_Measurement_extern() +} extension ConfigStruct: _BridgedSwiftStruct { @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> ConfigStruct { @@ -278,21 +308,27 @@ extension ConfigStruct: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ConfigStruct") -fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_ConfigStruct_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_ConfigStruct_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_ConfigStruct() -> Int32 { +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_maxRetries_get") @_cdecl("bjs_ConfigStruct_static_maxRetries_get") @@ -399,21 +435,27 @@ extension Container: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Container") -fileprivate func _bjs_struct_lower_Container(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Container_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Container(_ objectId: Int32) -> Void { +fileprivate func _bjs_struct_lower_Container_extern(_ objectId: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lower_Container(_ objectId: Int32) -> Void { + return _bjs_struct_lower_Container_extern(objectId) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Container") -fileprivate func _bjs_struct_lift_Container() -> Int32 +fileprivate func _bjs_struct_lift_Container_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Container() -> Int32 { +fileprivate func _bjs_struct_lift_Container_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_struct_lift_Container() -> Int32 { + return _bjs_struct_lift_Container_extern() +} @_expose(wasm, "bjs_roundtrip") @_cdecl("bjs_roundtrip") @@ -498,9 +540,12 @@ extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_Greeter_wrap") -fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Greeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Greeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Greeter_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift index 29386e65f..fe79f786c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/SwiftStructImports.swift @@ -24,30 +24,39 @@ extension Point: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Point_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_Point_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Point() -> Int32 { +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() +} #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_translate") -fileprivate func bjs_translate(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 +fileprivate func bjs_translate_extern(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 #else -fileprivate func bjs_translate(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 { +fileprivate func bjs_translate_extern(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_translate(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 { + return bjs_translate_extern(point, dx, dy) +} func _$translate(_ point: Point, _ dx: Int, _ dy: Int) throws(JSException) -> Point { let pointObjectId = point.bridgeJSLowerParameter() diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift index 9385c0621..b97729084 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/UnsafePointer.swift @@ -30,21 +30,27 @@ extension PointerFields: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PointerFields") -fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_PointerFields_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_PointerFields_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_PointerFields() -> Int32 { +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") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/VoidParameterVoidReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/VoidParameterVoidReturn.swift index 3fa9619f8..777cd1c3a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/VoidParameterVoidReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/VoidParameterVoidReturn.swift @@ -10,12 +10,15 @@ public func _bjs_check() -> Void { #if arch(wasm32) @_extern(wasm, module: "TestModule", name: "bjs_check") -fileprivate func bjs_check() -> Void +fileprivate func bjs_check_extern() -> Void #else -fileprivate func bjs_check() -> Void { +fileprivate func bjs_check_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_check() -> Void { + return bjs_check_extern() +} func _$check() throws(JSException) -> Void { bjs_check() diff --git a/Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift b/Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift index 03fe0983a..b34b78bb0 100644 --- a/Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift @@ -215,12 +215,15 @@ extension GlobalNetworking.API.TestHTTPServer: ConvertibleToJSValue, _BridgedSwi #if arch(wasm32) @_extern(wasm, module: "BridgeJSGlobalTests", name: "bjs_TestHTTPServer_wrap") -fileprivate func _bjs_TestHTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TestHTTPServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TestHTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestHTTPServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_TestHTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_TestHTTPServer_wrap_extern(pointer) +} @_expose(wasm, "bjs_TestInternalServer_init") @_cdecl("bjs_TestInternalServer_init") @@ -261,12 +264,15 @@ extension Internal.TestInternalServer: ConvertibleToJSValue, _BridgedSwiftHeapOb #if arch(wasm32) @_extern(wasm, module: "BridgeJSGlobalTests", name: "bjs_TestInternalServer_wrap") -fileprivate func _bjs_TestInternalServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TestInternalServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TestInternalServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestInternalServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_TestInternalServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_TestInternalServer_wrap_extern(pointer) +} @_expose(wasm, "bjs_PublicConverter_init") @_cdecl("bjs_PublicConverter_init") @@ -308,9 +314,12 @@ extension GlobalUtils.PublicConverter: ConvertibleToJSValue, _BridgedSwiftHeapOb #if arch(wasm32) @_extern(wasm, module: "BridgeJSGlobalTests", name: "bjs_PublicConverter_wrap") -fileprivate func _bjs_PublicConverter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PublicConverter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PublicConverter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_PublicConverter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif +@inline(never) fileprivate func _bjs_PublicConverter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_PublicConverter_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 12ec21574..8a775c150 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -9,21 +9,27 @@ #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_ callback: Int32, _ param0: Int32) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -66,21 +72,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10H #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -123,21 +135,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5Th #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -180,21 +198,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5Th #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS_extern(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -237,21 +261,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7Gr #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC(_ callback: Int32, _ param0: Int32) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -294,21 +324,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JS #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -351,21 +387,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9AP #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -408,21 +450,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9Di #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -465,21 +513,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9Di #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ callback: Int32, _ param0: Int32) -> UnsafeMutableRawPointer +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(_ callback: Int32, _ param0: Int32) -> UnsafeMutableRawPointer #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ callback: Int32, _ param0: Int32) -> UnsafeMutableRawPointer { +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(_ callback: Int32, _ param0: Int32) -> UnsafeMutableRawPointer { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ callback: Int32, _ param0: Int32) -> UnsafeMutableRawPointer { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -522,21 +576,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_ #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 { +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(callback, param0) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -579,21 +639,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_ #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd(_ callback: Int32, _ param0: Float64) -> Float64 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd_extern(_ callback: Int32, _ param0: Float64) -> Float64 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd(_ callback: Int32, _ param0: Float64) -> Float64 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -636,21 +702,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_ #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Float64) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Float64) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Float64) -> Int32 { +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Float64) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Float64) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(callback, param0, param1, param2) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -695,21 +767,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiS #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Int32) -> Int32 +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(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Int32) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -754,21 +832,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiS #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si(_ callback: Int32, _ param0: Int32, _ param1: Int32) -> Int32 +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(_ callback: Int32, _ param0: Int32, _ param1: Int32) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -812,21 +896,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiS #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -869,21 +959,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_ #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(_ callback: Int32, _ param0: Int32) -> Void +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y_extern(_ callback: Int32, _ param0: Int32) -> Void #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(_ callback: Int32, _ param0: Int32) -> Void { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -924,21 +1020,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_ #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(callback, param0IsSome, param0Value) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -981,21 +1083,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5 #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 +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(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -1038,21 +1146,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7 #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +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(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -1095,21 +1209,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7 #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 +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(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -1152,21 +1272,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9 #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +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(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -1209,21 +1335,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9 #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(callback, param0IsSome, param0Value) +} #if arch(wasm32) @_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -1266,21 +1398,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqS #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +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(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -1323,21 +1461,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqS #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(_ callback: Int32) -> Int32 +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb_extern(_ callback: Int32) -> Int32 #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(_ callback: Int32) -> Int32 { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -1379,21 +1523,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_S #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_ callback: Int32) -> UnsafeMutableRawPointer +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC_extern(_ callback: Int32) -> UnsafeMutableRawPointer #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_ callback: Int32) -> UnsafeMutableRawPointer { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -1435,21 +1585,27 @@ public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_S #if arch(wasm32) @_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y(_ callback: Int32) -> Void +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y_extern(_ callback: Int32) -> Void #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y(_ callback: Int32) -> Void { +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +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(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +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 { @@ -1691,273 +1847,363 @@ struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_increment") -fileprivate func _extern_increment(_ jsObject: Int32, _ amount: Int32) -> Void +fileprivate func _extern_increment_extern(_ jsObject: Int32, _ amount: Int32) -> Void #else -fileprivate func _extern_increment(_ jsObject: Int32, _ amount: Int32) -> Void { +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(_ jsObject: Int32) -> Int32 +fileprivate func _extern_getValue_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func _extern_getValue(_ jsObject: Int32) -> Int32 { +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(_ jsObject: Int32, _ labelPrefix: Int32, _ labelSuffix: Int32) -> Void +fileprivate func _extern_setLabelElements_extern(_ jsObject: Int32, _ labelPrefix: Int32, _ labelSuffix: Int32) -> Void #else -fileprivate func _extern_setLabelElements(_ jsObject: Int32, _ labelPrefix: Int32, _ labelSuffix: Int32) -> Void { +fileprivate func _extern_setLabelElements_extern(_ jsObject: Int32, _ labelPrefix: Int32, _ labelSuffix: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _extern_setLabelElements(_ jsObject: Int32, _ labelPrefix: Int32, _ labelSuffix: Int32) -> Void { + return _extern_setLabelElements_extern(jsObject, labelPrefix, labelSuffix) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getLabel") -fileprivate func _extern_getLabel(_ jsObject: Int32) -> Int32 +fileprivate func _extern_getLabel_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func _extern_getLabel(_ jsObject: Int32) -> Int32 { +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(_ jsObject: Int32) -> Int32 +fileprivate func _extern_isEven_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func _extern_isEven(_ jsObject: Int32) -> Int32 { +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(_ jsObject: Int32, _ greeter: UnsafeMutableRawPointer) -> Int32 +fileprivate func _extern_processGreeter_extern(_ jsObject: Int32, _ greeter: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _extern_processGreeter(_ jsObject: Int32, _ greeter: UnsafeMutableRawPointer) -> Int32 { +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(_ jsObject: Int32) -> UnsafeMutableRawPointer +fileprivate func _extern_createGreeter_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer #else -fileprivate func _extern_createGreeter(_ jsObject: Int32) -> UnsafeMutableRawPointer { +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(_ jsObject: Int32, _ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _extern_processOptionalGreeter_extern(_ jsObject: Int32, _ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _extern_processOptionalGreeter(_ jsObject: Int32, _ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> Int32 { +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(_ jsObject: Int32) -> UnsafeMutableRawPointer +fileprivate func _extern_createOptionalGreeter_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer #else -fileprivate func _extern_createOptionalGreeter(_ jsObject: Int32) -> UnsafeMutableRawPointer { +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(_ jsObject: Int32, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void +fileprivate func _extern_handleAPIResult_extern(_ jsObject: Int32, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void #else -fileprivate func _extern_handleAPIResult(_ jsObject: Int32, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { +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(_ jsObject: Int32) -> Int32 +fileprivate func _extern_getAPIResult_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func _extern_getAPIResult(_ jsObject: Int32) -> Int32 { +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(_ jsObject: Int32) -> Int32 +fileprivate func bjs_DataProcessor_count_get_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func bjs_DataProcessor_count_get(_ jsObject: Int32) -> Int32 { +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(_ jsObject: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_DataProcessor_count_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_DataProcessor_count_set(_ jsObject: Int32, _ newValue: Int32) -> Void { +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(_ jsObject: Int32) -> Int32 +fileprivate func bjs_DataProcessor_name_get_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func bjs_DataProcessor_name_get(_ jsObject: Int32) -> Int32 { +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(_ jsObject: Int32) -> Void +fileprivate func bjs_DataProcessor_optionalTag_get_extern(_ jsObject: Int32) -> Void #else -fileprivate func bjs_DataProcessor_optionalTag_get(_ jsObject: Int32) -> Void { +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(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_DataProcessor_optionalTag_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_DataProcessor_optionalTag_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +fileprivate func bjs_DataProcessor_optionalTag_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_DataProcessor_optionalTag_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_DataProcessor_optionalTag_set_extern(jsObject, newValueIsSome, newValueValue) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_get") -fileprivate func bjs_DataProcessor_optionalCount_get(_ jsObject: Int32) -> Void +fileprivate func bjs_DataProcessor_optionalCount_get_extern(_ jsObject: Int32) -> Void #else -fileprivate func bjs_DataProcessor_optionalCount_get(_ jsObject: Int32) -> Void { +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(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_DataProcessor_optionalCount_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_DataProcessor_optionalCount_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +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(_ jsObject: Int32) -> Int32 +fileprivate func bjs_DataProcessor_direction_get_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func bjs_DataProcessor_direction_get(_ jsObject: Int32) -> Int32 { +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(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_DataProcessor_direction_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_DataProcessor_direction_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +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(_ jsObject: Int32) -> Void +fileprivate func bjs_DataProcessor_optionalTheme_get_extern(_ jsObject: Int32) -> Void #else -fileprivate func bjs_DataProcessor_optionalTheme_get(_ jsObject: Int32) -> Void { +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(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_DataProcessor_optionalTheme_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_DataProcessor_optionalTheme_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +fileprivate func bjs_DataProcessor_optionalTheme_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_DataProcessor_optionalTheme_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_DataProcessor_optionalTheme_set_extern(jsObject, newValueIsSome, newValueValue) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_get") -fileprivate func bjs_DataProcessor_httpStatus_get(_ jsObject: Int32) -> Void +fileprivate func bjs_DataProcessor_httpStatus_get_extern(_ jsObject: Int32) -> Void #else -fileprivate func bjs_DataProcessor_httpStatus_get(_ jsObject: Int32) -> Void { +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(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +fileprivate func bjs_DataProcessor_httpStatus_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void #else -fileprivate func bjs_DataProcessor_httpStatus_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { +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(_ jsObject: Int32) -> Int32 +fileprivate func bjs_DataProcessor_apiResult_get_extern(_ jsObject: Int32) -> Int32 #else -fileprivate func bjs_DataProcessor_apiResult_get(_ jsObject: Int32) -> Int32 { +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(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void +fileprivate func bjs_DataProcessor_apiResult_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void #else -fileprivate func bjs_DataProcessor_apiResult_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void { +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(_ jsObject: Int32) -> UnsafeMutableRawPointer +fileprivate func bjs_DataProcessor_helper_get_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer #else -fileprivate func bjs_DataProcessor_helper_get(_ jsObject: Int32) -> UnsafeMutableRawPointer { +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(_ jsObject: Int32, _ newValue: UnsafeMutableRawPointer) -> Void +fileprivate func bjs_DataProcessor_helper_set_extern(_ jsObject: Int32, _ newValue: UnsafeMutableRawPointer) -> Void #else -fileprivate func bjs_DataProcessor_helper_set(_ jsObject: Int32, _ newValue: UnsafeMutableRawPointer) -> Void { +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(_ jsObject: Int32) -> UnsafeMutableRawPointer +fileprivate func bjs_DataProcessor_optionalHelper_get_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer #else -fileprivate func bjs_DataProcessor_optionalHelper_get(_ jsObject: Int32) -> UnsafeMutableRawPointer { +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(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValuePointer: UnsafeMutableRawPointer) -> Void +fileprivate func bjs_DataProcessor_optionalHelper_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValuePointer: UnsafeMutableRawPointer) -> Void #else -fileprivate func bjs_DataProcessor_optionalHelper_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValuePointer: UnsafeMutableRawPointer) -> Void { +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) +} extension Direction: _BridgedSwiftCaseEnum { @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { @@ -2913,21 +3159,27 @@ extension Point: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Point_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_Point_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Point() -> Int32 { +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 { @@ -2961,21 +3213,27 @@ extension PointerFields: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PointerFields") -fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_PointerFields_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_PointerFields_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_PointerFields() -> Int32 { +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") @@ -3028,21 +3286,27 @@ extension DataPoint: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_DataPoint") -fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_DataPoint_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_DataPoint_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_DataPoint() -> Int32 { +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") @@ -3081,21 +3345,27 @@ extension PublicPoint: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PublicPoint") -fileprivate func _bjs_struct_lower_PublicPoint(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_PublicPoint_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_PublicPoint(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_PublicPoint_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_PublicPoint() -> Int32 { +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") @@ -3140,21 +3410,27 @@ extension Address: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Address") -fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Address_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_Address_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Address() -> Int32 { +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 { @@ -3192,21 +3468,27 @@ extension Contact: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Contact") -fileprivate func _bjs_struct_lower_Contact(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Contact_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Contact(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_Contact_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Contact() -> Int32 { +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 { @@ -3246,21 +3528,27 @@ extension Config: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Config") -fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_Config_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_Config_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_Config() -> Int32 { +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 { @@ -3292,21 +3580,27 @@ extension SessionData: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_SessionData") -fileprivate func _bjs_struct_lower_SessionData(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_SessionData_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_SessionData(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_SessionData_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_SessionData() -> Int32 { +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 { @@ -3346,21 +3640,27 @@ extension ValidationReport: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ValidationReport") -fileprivate func _bjs_struct_lower_ValidationReport(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_ValidationReport_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_ValidationReport(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_ValidationReport_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_ValidationReport() -> Int32 { +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 { @@ -3412,21 +3712,27 @@ extension AdvancedConfig: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_AdvancedConfig") -fileprivate func _bjs_struct_lower_AdvancedConfig(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_AdvancedConfig_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_AdvancedConfig(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_AdvancedConfig_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_AdvancedConfig() -> Int32 { +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 { @@ -3466,21 +3772,27 @@ extension MeasurementConfig: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MeasurementConfig") -fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_MeasurementConfig_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_MeasurementConfig_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_MeasurementConfig() -> Int32 { +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 { @@ -3506,21 +3818,27 @@ extension MathOperations: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MathOperations") -fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_MathOperations_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_MathOperations_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_MathOperations() -> Int32 { +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") @@ -3596,21 +3914,27 @@ extension CopyableCart: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableCart") -fileprivate func _bjs_struct_lower_CopyableCart(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_CopyableCart_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_CopyableCart(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_CopyableCart_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_CopyableCart() -> Int32 { +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") @@ -3649,21 +3973,27 @@ extension CopyableCartItem: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableCartItem") -fileprivate func _bjs_struct_lower_CopyableCartItem(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_CopyableCartItem_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_CopyableCartItem(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_CopyableCartItem_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_CopyableCartItem() -> Int32 { +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 { @@ -3693,21 +4023,27 @@ extension CopyableNestedCart: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableNestedCart") -fileprivate func _bjs_struct_lower_CopyableNestedCart(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_CopyableNestedCart_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_CopyableNestedCart(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_CopyableNestedCart_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_CopyableNestedCart() -> Int32 { +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") @@ -3746,21 +4082,27 @@ extension ConfigStruct: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ConfigStruct") -fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_ConfigStruct_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_ConfigStruct_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_ConfigStruct() -> Int32 { +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") @@ -3856,21 +4198,27 @@ extension JSObjectContainer: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_JSObjectContainer") -fileprivate func _bjs_struct_lower_JSObjectContainer(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_JSObjectContainer_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_JSObjectContainer(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_JSObjectContainer_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_JSObjectContainer() -> Int32 { +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 { @@ -3902,21 +4250,27 @@ extension FooContainer: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_FooContainer") -fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_FooContainer_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_FooContainer_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_FooContainer() -> Int32 { +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 { @@ -3944,21 +4298,27 @@ extension ArrayMembers: _BridgedSwiftStruct { #if arch(wasm32) @_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ArrayMembers") -fileprivate func _bjs_struct_lower_ArrayMembers(_ objectId: Int32) -> Void +fileprivate func _bjs_struct_lower_ArrayMembers_extern(_ objectId: Int32) -> Void #else -fileprivate func _bjs_struct_lower_ArrayMembers(_ objectId: Int32) -> Void { +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() -> Int32 +fileprivate func _bjs_struct_lift_ArrayMembers_extern() -> Int32 #else -fileprivate func _bjs_struct_lift_ArrayMembers() -> Int32 { +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") @@ -6387,12 +6747,15 @@ extension ClosureSupportExports: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportExports_wrap") -fileprivate func _bjs_ClosureSupportExports_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ClosureSupportExports_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ClosureSupportExports_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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_Greeter_init") @_cdecl("bjs_Greeter_init") @@ -6520,12 +6883,15 @@ extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Greeter_wrap") -fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Greeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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") @@ -6567,12 +6933,15 @@ extension Calculator: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Calculator_wrap") -fileprivate func _bjs_Calculator_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Calculator_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Calculator_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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") @@ -6592,12 +6961,15 @@ extension InternalGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_InternalGreeter_wrap") -fileprivate func _bjs_InternalGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_InternalGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_InternalGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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") @@ -6617,12 +6989,15 @@ extension PublicGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PublicGreeter_wrap") -fileprivate func _bjs_PublicGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PublicGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PublicGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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") @@ -6642,12 +7017,15 @@ extension PackageGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PackageGreeter_wrap") -fileprivate func _bjs_PackageGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PackageGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PackageGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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_Converter_init") @_cdecl("bjs_Converter_init") @@ -6689,12 +7067,15 @@ extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Converter_wrap") -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Converter_wrap_extern(pointer) +} @_expose(wasm, "bjs_HTTPServer_init") @_cdecl("bjs_HTTPServer_init") @@ -6735,12 +7116,15 @@ extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObje #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_HTTPServer_wrap") -fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_HTTPServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_HTTPServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_HTTPServer_wrap_extern(pointer) +} @_expose(wasm, "bjs_TestServer_init") @_cdecl("bjs_TestServer_init") @@ -6781,12 +7165,15 @@ extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TestServer_wrap") -fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TestServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_TestServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_TestServer_wrap_extern(pointer) +} @_expose(wasm, "bjs_SimplePropertyHolder_init") @_cdecl("bjs_SimplePropertyHolder_init") @@ -6838,12 +7225,15 @@ extension SimplePropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SimplePropertyHolder_wrap") -fileprivate func _bjs_SimplePropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_SimplePropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_SimplePropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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") @@ -7161,12 +7551,15 @@ extension PropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PropertyHolder_wrap") -fileprivate func _bjs_PropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_PropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_PropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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") @@ -7208,12 +7601,15 @@ extension MathUtils: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MathUtils_wrap") -fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_MathUtils_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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_ConstructorDefaults_init") @_cdecl("bjs_ConstructorDefaults_init") @@ -7360,12 +7756,15 @@ extension ConstructorDefaults: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ConstructorDefaults_wrap") -fileprivate func _bjs_ConstructorDefaults_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_ConstructorDefaults_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_ConstructorDefaults_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +fileprivate func _bjs_ConstructorDefaults_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func _bjs_ConstructorDefaults_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ConstructorDefaults_wrap_extern(pointer) +} @_expose(wasm, "bjs_StaticPropertyHolder_init") @_cdecl("bjs_StaticPropertyHolder_init") @@ -7607,12 +8006,15 @@ extension StaticPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticPropertyHolder_wrap") -fileprivate func _bjs_StaticPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_StaticPropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_StaticPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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") @@ -7896,12 +8298,15 @@ extension DataProcessorManager: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessorManager_wrap") -fileprivate func _bjs_DataProcessorManager_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_DataProcessorManager_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_DataProcessorManager_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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") @@ -8250,12 +8655,15 @@ extension SwiftDataProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftDataProcessor_wrap") -fileprivate func _bjs_SwiftDataProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_SwiftDataProcessor_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_SwiftDataProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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_TextProcessor_init") @_cdecl("bjs_TextProcessor_init") @@ -8506,12 +8914,15 @@ extension TextProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TextProcessor_wrap") -fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_TextProcessor_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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_OptionalHolder_init") @_cdecl("bjs_OptionalHolder_init") @@ -8584,12 +8995,15 @@ extension OptionalHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalHolder_wrap") -fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_OptionalHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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") @@ -8683,12 +9097,15 @@ extension OptionalPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalPropertyHolder_wrap") -fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_OptionalPropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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") @@ -8763,174 +9180,231 @@ extension Container: ConvertibleToJSValue, _BridgedSwiftHeapObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Container_wrap") -fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +fileprivate func _bjs_Container_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { +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) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyVoid_static") -fileprivate func bjs_ClosureSupportImports_jsApplyVoid_static(_ callback: Int32) -> Void +fileprivate func bjs_ClosureSupportImports_jsApplyVoid_static_extern(_ callback: Int32) -> Void #else -fileprivate func bjs_ClosureSupportImports_jsApplyVoid_static(_ callback: Int32) -> Void { +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(_ callback: Int32) -> Int32 +fileprivate func bjs_ClosureSupportImports_jsApplyBool_static_extern(_ callback: Int32) -> Int32 #else -fileprivate func bjs_ClosureSupportImports_jsApplyBool_static(_ callback: Int32) -> Int32 { +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(_ value: Int32, _ transform: Int32) -> Int32 +fileprivate func bjs_ClosureSupportImports_jsApplyInt_static_extern(_ value: Int32, _ transform: Int32) -> Int32 #else -fileprivate func bjs_ClosureSupportImports_jsApplyInt_static(_ value: Int32, _ transform: Int32) -> Int32 { +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(_ value: Float64, _ transform: Int32) -> Float64 +fileprivate func bjs_ClosureSupportImports_jsApplyDouble_static_extern(_ value: Float64, _ transform: Int32) -> Float64 #else -fileprivate func bjs_ClosureSupportImports_jsApplyDouble_static(_ value: Float64, _ transform: Int32) -> Float64 { +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(_ value: Int32, _ transform: Int32) -> Int32 +fileprivate func bjs_ClosureSupportImports_jsApplyString_static_extern(_ value: Int32, _ transform: Int32) -> Int32 #else -fileprivate func bjs_ClosureSupportImports_jsApplyString_static(_ value: Int32, _ transform: Int32) -> Int32 { +fileprivate func bjs_ClosureSupportImports_jsApplyString_static_extern(_ value: Int32, _ transform: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsApplyString_static(_ value: Int32, _ transform: Int32) -> Int32 { + return bjs_ClosureSupportImports_jsApplyString_static_extern(value, transform) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyJSObject_static") -fileprivate func bjs_ClosureSupportImports_jsApplyJSObject_static(_ value: Int32, _ transform: Int32) -> Int32 +fileprivate func bjs_ClosureSupportImports_jsApplyJSObject_static_extern(_ value: Int32, _ transform: Int32) -> Int32 #else -fileprivate func bjs_ClosureSupportImports_jsApplyJSObject_static(_ value: Int32, _ transform: Int32) -> Int32 { +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(_ base: Int32) -> Int32 +fileprivate func bjs_ClosureSupportImports_jsMakeIntToInt_static_extern(_ base: Int32) -> Int32 #else -fileprivate func bjs_ClosureSupportImports_jsMakeIntToInt_static(_ base: Int32) -> Int32 { +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(_ base: Float64) -> Int32 +fileprivate func bjs_ClosureSupportImports_jsMakeDoubleToDouble_static_extern(_ base: Float64) -> Int32 #else -fileprivate func bjs_ClosureSupportImports_jsMakeDoubleToDouble_static(_ base: Float64) -> Int32 { +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(_ prefix: Int32) -> Int32 +fileprivate func bjs_ClosureSupportImports_jsMakeStringToString_static_extern(_ prefix: Int32) -> Int32 #else -fileprivate func bjs_ClosureSupportImports_jsMakeStringToString_static(_ prefix: Int32) -> Int32 { +fileprivate func bjs_ClosureSupportImports_jsMakeStringToString_static_extern(_ prefix: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsMakeStringToString_static(_ prefix: Int32) -> Int32 { + return bjs_ClosureSupportImports_jsMakeStringToString_static_extern(prefix) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallTwice_static") -fileprivate func bjs_ClosureSupportImports_jsCallTwice_static(_ value: Int32, _ callback: Int32) -> Int32 +fileprivate func bjs_ClosureSupportImports_jsCallTwice_static_extern(_ value: Int32, _ callback: Int32) -> Int32 #else -fileprivate func bjs_ClosureSupportImports_jsCallTwice_static(_ value: Int32, _ callback: Int32) -> Int32 { +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(_ callback: Int32) -> Int32 +fileprivate func bjs_ClosureSupportImports_jsCallBinary_static_extern(_ callback: Int32) -> Int32 #else -fileprivate func bjs_ClosureSupportImports_jsCallBinary_static(_ callback: Int32) -> Int32 { +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(_ callback: Int32) -> Int32 +fileprivate func bjs_ClosureSupportImports_jsCallTriple_static_extern(_ callback: Int32) -> Int32 #else -fileprivate func bjs_ClosureSupportImports_jsCallTriple_static(_ callback: Int32) -> Int32 { +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(_ callback: Int32) -> Int32 +fileprivate func bjs_ClosureSupportImports_jsCallAfterRelease_static_extern(_ callback: Int32) -> Int32 #else -fileprivate func bjs_ClosureSupportImports_jsCallAfterRelease_static(_ callback: Int32) -> Int32 { +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(_ callbackIsSome: Int32, _ callbackFuncRef: Int32) -> Int32 +fileprivate func bjs_ClosureSupportImports_jsOptionalInvoke_static_extern(_ callbackIsSome: Int32, _ callbackFuncRef: Int32) -> Int32 #else -fileprivate func bjs_ClosureSupportImports_jsOptionalInvoke_static(_ callbackIsSome: Int32, _ callbackFuncRef: Int32) -> Int32 { +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(_ callback: Int32) -> Void +fileprivate func bjs_ClosureSupportImports_jsStoreClosure_static_extern(_ callback: Int32) -> Void #else -fileprivate func bjs_ClosureSupportImports_jsStoreClosure_static(_ callback: Int32) -> Void { +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() -> Void +fileprivate func bjs_ClosureSupportImports_jsCallStoredClosure_static_extern() -> Void #else -fileprivate func bjs_ClosureSupportImports_jsCallStoredClosure_static() -> Void { +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() -> Int32 +fileprivate func bjs_ClosureSupportImports_jsHeapCount_static_extern() -> Int32 #else -fileprivate func bjs_ClosureSupportImports_jsHeapCount_static() -> Int32 { +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() -> Void +fileprivate func bjs_ClosureSupportImports_runJsClosureSupportTests_static_extern() -> Void #else -fileprivate func bjs_ClosureSupportImports_runJsClosureSupportTests_static() -> Void { +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() @@ -9094,12 +9568,15 @@ func _$ClosureSupportImports_runJsClosureSupportTests() throws(JSException) -> V #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripDictionary") -fileprivate func bjs_jsRoundTripDictionary() -> Void +fileprivate func bjs_jsRoundTripDictionary_extern() -> Void #else -fileprivate func bjs_jsRoundTripDictionary() -> Void { +fileprivate func bjs_jsRoundTripDictionary_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripDictionary() -> Void { + return bjs_jsRoundTripDictionary_extern() +} func _$jsRoundTripDictionary(_ values: [String: Int]) throws(JSException) -> [String: Int] { let _ = values.bridgeJSLowerParameter() @@ -9112,12 +9589,15 @@ func _$jsRoundTripDictionary(_ values: [String: Int]) throws(JSException) -> [St #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripDictionaryBool") -fileprivate func bjs_jsRoundTripDictionaryBool() -> Void +fileprivate func bjs_jsRoundTripDictionaryBool_extern() -> Void #else -fileprivate func bjs_jsRoundTripDictionaryBool() -> Void { +fileprivate func bjs_jsRoundTripDictionaryBool_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripDictionaryBool() -> Void { + return bjs_jsRoundTripDictionaryBool_extern() +} func _$jsRoundTripDictionaryBool(_ values: [String: Bool]) throws(JSException) -> [String: Bool] { let _ = values.bridgeJSLowerParameter() @@ -9130,12 +9610,15 @@ func _$jsRoundTripDictionaryBool(_ values: [String: Bool]) throws(JSException) - #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripDictionaryDouble") -fileprivate func bjs_jsRoundTripDictionaryDouble() -> Void +fileprivate func bjs_jsRoundTripDictionaryDouble_extern() -> Void #else -fileprivate func bjs_jsRoundTripDictionaryDouble() -> Void { +fileprivate func bjs_jsRoundTripDictionaryDouble_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripDictionaryDouble() -> Void { + return bjs_jsRoundTripDictionaryDouble_extern() +} func _$jsRoundTripDictionaryDouble(_ values: [String: Double]) throws(JSException) -> [String: Double] { let _ = values.bridgeJSLowerParameter() @@ -9148,12 +9631,15 @@ func _$jsRoundTripDictionaryDouble(_ values: [String: Double]) throws(JSExceptio #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripDictionaryJSObject") -fileprivate func bjs_jsRoundTripDictionaryJSObject() -> Void +fileprivate func bjs_jsRoundTripDictionaryJSObject_extern() -> Void #else -fileprivate func bjs_jsRoundTripDictionaryJSObject() -> Void { +fileprivate func bjs_jsRoundTripDictionaryJSObject_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripDictionaryJSObject() -> Void { + return bjs_jsRoundTripDictionaryJSObject_extern() +} func _$jsRoundTripDictionaryJSObject(_ values: [String: JSObject]) throws(JSException) -> [String: JSObject] { let _ = values.bridgeJSLowerParameter() @@ -9166,12 +9652,15 @@ func _$jsRoundTripDictionaryJSObject(_ values: [String: JSObject]) throws(JSExce #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripDictionaryJSValue") -fileprivate func bjs_jsRoundTripDictionaryJSValue() -> Void +fileprivate func bjs_jsRoundTripDictionaryJSValue_extern() -> Void #else -fileprivate func bjs_jsRoundTripDictionaryJSValue() -> Void { +fileprivate func bjs_jsRoundTripDictionaryJSValue_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripDictionaryJSValue() -> Void { + return bjs_jsRoundTripDictionaryJSValue_extern() +} func _$jsRoundTripDictionaryJSValue(_ values: [String: JSValue]) throws(JSException) -> [String: JSValue] { let _ = values.bridgeJSLowerParameter() @@ -9184,12 +9673,15 @@ func _$jsRoundTripDictionaryJSValue(_ values: [String: JSValue]) throws(JSExcept #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripNestedDictionary") -fileprivate func bjs_jsRoundTripNestedDictionary() -> Void +fileprivate func bjs_jsRoundTripNestedDictionary_extern() -> Void #else -fileprivate func bjs_jsRoundTripNestedDictionary() -> Void { +fileprivate func bjs_jsRoundTripNestedDictionary_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripNestedDictionary() -> Void { + return bjs_jsRoundTripNestedDictionary_extern() +} func _$jsRoundTripNestedDictionary(_ values: [String: [Double]]) throws(JSException) -> [String: [Double]] { let _ = values.bridgeJSLowerParameter() @@ -9202,12 +9694,15 @@ func _$jsRoundTripNestedDictionary(_ values: [String: [Double]]) throws(JSExcept #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalDictionary") -fileprivate func bjs_jsRoundTripOptionalDictionary(_ values: Int32) -> Void +fileprivate func bjs_jsRoundTripOptionalDictionary_extern(_ values: Int32) -> Void #else -fileprivate func bjs_jsRoundTripOptionalDictionary(_ values: Int32) -> Void { +fileprivate func bjs_jsRoundTripOptionalDictionary_extern(_ values: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripOptionalDictionary(_ values: Int32) -> Void { + return bjs_jsRoundTripOptionalDictionary_extern(values) +} func _$jsRoundTripOptionalDictionary(_ values: Optional<[String: String]>) throws(JSException) -> Optional<[String: String]> { let valuesIsSome = values.bridgeJSLowerParameter() @@ -9220,12 +9715,15 @@ func _$jsRoundTripOptionalDictionary(_ values: Optional<[String: String]>) throw #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripUndefinedDictionary") -fileprivate func bjs_jsRoundTripUndefinedDictionary(_ values: Int32) -> Void +fileprivate func bjs_jsRoundTripUndefinedDictionary_extern(_ values: Int32) -> Void #else -fileprivate func bjs_jsRoundTripUndefinedDictionary(_ values: Int32) -> Void { +fileprivate func bjs_jsRoundTripUndefinedDictionary_extern(_ values: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripUndefinedDictionary(_ values: Int32) -> Void { + return bjs_jsRoundTripUndefinedDictionary_extern(values) +} func _$jsRoundTripUndefinedDictionary(_ values: JSUndefinedOr<[String: Int]>) throws(JSException) -> JSUndefinedOr<[String: Int]> { let valuesIsSome = values.bridgeJSLowerParameter() @@ -9238,21 +9736,27 @@ func _$jsRoundTripUndefinedDictionary(_ values: JSUndefinedOr<[String: Int]>) th #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Foo_init") -fileprivate func bjs_Foo_init(_ value: Int32) -> Int32 +fileprivate func bjs_Foo_init_extern(_ value: Int32) -> Int32 #else -fileprivate func bjs_Foo_init(_ value: Int32) -> Int32 { +fileprivate func bjs_Foo_init_extern(_ value: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_Foo_init(_ value: Int32) -> Int32 { + return bjs_Foo_init_extern(value) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Foo_value_get") -fileprivate func bjs_Foo_value_get(_ self: Int32) -> Int32 +fileprivate func bjs_Foo_value_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_Foo_value_get(_ self: Int32) -> Int32 { +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 valueValue = value.bridgeJSLowerParameter() @@ -9274,12 +9778,15 @@ func _$Foo_value_get(_ self: JSObject) throws(JSException) -> String { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_globalObject1_get") -fileprivate func bjs_globalObject1_get() -> Void +fileprivate func bjs_globalObject1_get_extern() -> Void #else -fileprivate func bjs_globalObject1_get() -> Void { +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() @@ -9291,12 +9798,15 @@ func _$globalObject1_get() throws(JSException) -> JSValue { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripVoid") -fileprivate func bjs_jsRoundTripVoid() -> Void +fileprivate func bjs_jsRoundTripVoid_extern() -> Void #else -fileprivate func bjs_jsRoundTripVoid() -> Void { +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() @@ -9307,12 +9817,15 @@ func _$jsRoundTripVoid() throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripNumber") -fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 +fileprivate func bjs_jsRoundTripNumber_extern(_ v: Float64) -> Float64 #else -fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 { +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() @@ -9325,12 +9838,15 @@ func _$jsRoundTripNumber(_ v: Double) throws(JSException) -> Double { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripBool") -fileprivate func bjs_jsRoundTripBool(_ v: Int32) -> Int32 +fileprivate func bjs_jsRoundTripBool_extern(_ v: Int32) -> Int32 #else -fileprivate func bjs_jsRoundTripBool(_ v: Int32) -> Int32 { +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() @@ -9343,12 +9859,15 @@ func _$jsRoundTripBool(_ v: Bool) throws(JSException) -> Bool { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripString") -fileprivate func bjs_jsRoundTripString(_ v: Int32) -> Int32 +fileprivate func bjs_jsRoundTripString_extern(_ v: Int32) -> Int32 #else -fileprivate func bjs_jsRoundTripString(_ v: Int32) -> Int32 { +fileprivate func bjs_jsRoundTripString_extern(_ v: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripString(_ v: Int32) -> Int32 { + return bjs_jsRoundTripString_extern(v) +} func _$jsRoundTripString(_ v: String) throws(JSException) -> String { let vValue = v.bridgeJSLowerParameter() @@ -9361,12 +9880,15 @@ func _$jsRoundTripString(_ v: String) throws(JSException) -> String { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripJSValue") -fileprivate func bjs_jsRoundTripJSValue(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void +fileprivate func bjs_jsRoundTripJSValue_extern(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void #else -fileprivate func bjs_jsRoundTripJSValue(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void { +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() @@ -9379,12 +9901,15 @@ func _$jsRoundTripJSValue(_ v: JSValue) throws(JSException) -> JSValue { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripJSValueArray") -fileprivate func bjs_jsRoundTripJSValueArray() -> Void +fileprivate func bjs_jsRoundTripJSValueArray_extern() -> Void #else -fileprivate func bjs_jsRoundTripJSValueArray() -> Void { +fileprivate func bjs_jsRoundTripJSValueArray_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripJSValueArray() -> Void { + return bjs_jsRoundTripJSValueArray_extern() +} func _$jsRoundTripJSValueArray(_ v: [JSValue]) throws(JSException) -> [JSValue] { let _ = v.bridgeJSLowerParameter() @@ -9397,12 +9922,15 @@ func _$jsRoundTripJSValueArray(_ v: [JSValue]) throws(JSException) -> [JSValue] #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripOptionalJSValueArray") -fileprivate func bjs_jsRoundTripOptionalJSValueArray(_ v: Int32) -> Void +fileprivate func bjs_jsRoundTripOptionalJSValueArray_extern(_ v: Int32) -> Void #else -fileprivate func bjs_jsRoundTripOptionalJSValueArray(_ v: Int32) -> Void { +fileprivate func bjs_jsRoundTripOptionalJSValueArray_extern(_ v: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripOptionalJSValueArray(_ v: Int32) -> Void { + return bjs_jsRoundTripOptionalJSValueArray_extern(v) +} func _$jsRoundTripOptionalJSValueArray(_ v: Optional<[JSValue]>) throws(JSException) -> Optional<[JSValue]> { let vIsSome = v.bridgeJSLowerParameter() @@ -9415,12 +9943,15 @@ func _$jsRoundTripOptionalJSValueArray(_ v: Optional<[JSValue]>) throws(JSExcept #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrVoid") -fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void +fileprivate func bjs_jsThrowOrVoid_extern(_ shouldThrow: Int32) -> Void #else -fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void { +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() @@ -9432,12 +9963,15 @@ func _$jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrNumber") -fileprivate func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 +fileprivate func bjs_jsThrowOrNumber_extern(_ shouldThrow: Int32) -> Float64 #else -fileprivate func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 { +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() @@ -9450,12 +9984,15 @@ func _$jsThrowOrNumber(_ shouldThrow: Bool) throws(JSException) -> Double { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrBool") -fileprivate func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 +fileprivate func bjs_jsThrowOrBool_extern(_ shouldThrow: Int32) -> Int32 #else -fileprivate func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 { +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() @@ -9468,12 +10005,15 @@ func _$jsThrowOrBool(_ shouldThrow: Bool) throws(JSException) -> Bool { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrString") -fileprivate func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 +fileprivate func bjs_jsThrowOrString_extern(_ shouldThrow: Int32) -> Int32 #else -fileprivate func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 { +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() @@ -9486,12 +10026,15 @@ func _$jsThrowOrString(_ shouldThrow: Bool) throws(JSException) -> String { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripFeatureFlag") -fileprivate func bjs_jsRoundTripFeatureFlag(_ flag: Int32) -> Int32 +fileprivate func bjs_jsRoundTripFeatureFlag_extern(_ flag: Int32) -> Int32 #else -fileprivate func bjs_jsRoundTripFeatureFlag(_ flag: Int32) -> Int32 { +fileprivate func bjs_jsRoundTripFeatureFlag_extern(_ flag: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripFeatureFlag(_ flag: Int32) -> Int32 { + return bjs_jsRoundTripFeatureFlag_extern(flag) +} func _$jsRoundTripFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> FeatureFlag { let flagValue = flag.bridgeJSLowerParameter() @@ -9504,12 +10047,15 @@ func _$jsRoundTripFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> Featur #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_runAsyncWorks") -fileprivate func bjs_runAsyncWorks() -> Int32 +fileprivate func bjs_runAsyncWorks_extern() -> Int32 #else -fileprivate func bjs_runAsyncWorks() -> Int32 { +fileprivate func bjs_runAsyncWorks_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_runAsyncWorks() -> Int32 { + return bjs_runAsyncWorks_extern() +} func _$runAsyncWorks() throws(JSException) -> JSPromise { let ret = bjs_runAsyncWorks() @@ -9521,12 +10067,15 @@ func _$runAsyncWorks() throws(JSException) -> JSPromise { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs__jsWeirdFunction") -fileprivate func bjs__jsWeirdFunction() -> Float64 +fileprivate func bjs__jsWeirdFunction_extern() -> Float64 #else -fileprivate func bjs__jsWeirdFunction() -> Float64 { +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() @@ -9538,12 +10087,15 @@ func _$_jsWeirdFunction() throws(JSException) -> Double { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripNumberArray") -fileprivate func bjs_jsRoundTripNumberArray() -> Void +fileprivate func bjs_jsRoundTripNumberArray_extern() -> Void #else -fileprivate func bjs_jsRoundTripNumberArray() -> Void { +fileprivate func bjs_jsRoundTripNumberArray_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripNumberArray() -> Void { + return bjs_jsRoundTripNumberArray_extern() +} func _$jsRoundTripNumberArray(_ values: [Double]) throws(JSException) -> [Double] { let _ = values.bridgeJSLowerParameter() @@ -9556,12 +10108,15 @@ func _$jsRoundTripNumberArray(_ values: [Double]) throws(JSException) -> [Double #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripStringArray") -fileprivate func bjs_jsRoundTripStringArray() -> Void +fileprivate func bjs_jsRoundTripStringArray_extern() -> Void #else -fileprivate func bjs_jsRoundTripStringArray() -> Void { +fileprivate func bjs_jsRoundTripStringArray_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripStringArray() -> Void { + return bjs_jsRoundTripStringArray_extern() +} func _$jsRoundTripStringArray(_ values: [String]) throws(JSException) -> [String] { let _ = values.bridgeJSLowerParameter() @@ -9574,12 +10129,15 @@ func _$jsRoundTripStringArray(_ values: [String]) throws(JSException) -> [String #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripBoolArray") -fileprivate func bjs_jsRoundTripBoolArray() -> Void +fileprivate func bjs_jsRoundTripBoolArray_extern() -> Void #else -fileprivate func bjs_jsRoundTripBoolArray() -> Void { +fileprivate func bjs_jsRoundTripBoolArray_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripBoolArray() -> Void { + return bjs_jsRoundTripBoolArray_extern() +} func _$jsRoundTripBoolArray(_ values: [Bool]) throws(JSException) -> [Bool] { let _ = values.bridgeJSLowerParameter() @@ -9592,12 +10150,15 @@ func _$jsRoundTripBoolArray(_ values: [Bool]) throws(JSException) -> [Bool] { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsSumNumberArray") -fileprivate func bjs_jsSumNumberArray() -> Float64 +fileprivate func bjs_jsSumNumberArray_extern() -> Float64 #else -fileprivate func bjs_jsSumNumberArray() -> Float64 { +fileprivate func bjs_jsSumNumberArray_extern() -> Float64 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsSumNumberArray() -> Float64 { + return bjs_jsSumNumberArray_extern() +} func _$jsSumNumberArray(_ values: [Double]) throws(JSException) -> Double { let _ = values.bridgeJSLowerParameter() @@ -9610,12 +10171,15 @@ func _$jsSumNumberArray(_ values: [Double]) throws(JSException) -> Double { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsCreateNumberArray") -fileprivate func bjs_jsCreateNumberArray() -> Void +fileprivate func bjs_jsCreateNumberArray_extern() -> Void #else -fileprivate func bjs_jsCreateNumberArray() -> Void { +fileprivate func bjs_jsCreateNumberArray_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsCreateNumberArray() -> Void { + return bjs_jsCreateNumberArray_extern() +} func _$jsCreateNumberArray() throws(JSException) -> [Double] { bjs_jsCreateNumberArray() @@ -9627,12 +10191,15 @@ func _$jsCreateNumberArray() throws(JSException) -> [Double] { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_parseInt") -fileprivate func bjs_parseInt(_ string: Int32) -> Float64 +fileprivate func bjs_parseInt_extern(_ string: Int32) -> Float64 #else -fileprivate func bjs_parseInt(_ string: Int32) -> Float64 { +fileprivate func bjs_parseInt_extern(_ string: Int32) -> Float64 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_parseInt(_ string: Int32) -> Float64 { + return bjs_parseInt_extern(string) +} func _$parseInt(_ string: String) throws(JSException) -> Double { let stringValue = string.bridgeJSLowerParameter() @@ -9645,57 +10212,75 @@ func _$parseInt(_ string: String) throws(JSException) -> Double { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_init") -fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 +fileprivate func bjs_JsGreeter_init_extern(_ name: Int32, _ prefix: Int32) -> Int32 #else -fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 { +fileprivate func bjs_JsGreeter_init_extern(_ name: Int32, _ prefix: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 { + return bjs_JsGreeter_init_extern(name, prefix) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_get") -fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 +fileprivate func bjs_JsGreeter_name_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 { +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(_ self: Int32) -> Int32 +fileprivate func bjs_JsGreeter_prefix_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 { +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(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_JsGreeter_name_set_extern(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_JsGreeter_name_set_extern(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { + return bjs_JsGreeter_name_set_extern(self, newValue) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_greet") -fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 +fileprivate func bjs_JsGreeter_greet_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 { +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(_ self: Int32, _ name: Int32) -> Void +fileprivate func bjs_JsGreeter_changeName_extern(_ self: Int32, _ name: Int32) -> Void #else -fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void { +fileprivate func bjs_JsGreeter_changeName_extern(_ self: Int32, _ name: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void { + return bjs_JsGreeter_changeName_extern(self, name) +} func _$JsGreeter_init(_ name: String, _ prefix: String) throws(JSException) -> JSObject { let nameValue = name.bridgeJSLowerParameter() @@ -9754,21 +10339,27 @@ func _$JsGreeter_changeName(_ self: JSObject, _ name: String) throws(JSException #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs__WeirdClass_init") -fileprivate func bjs__WeirdClass_init() -> Int32 +fileprivate func bjs__WeirdClass_init_extern() -> Int32 #else -fileprivate func bjs__WeirdClass_init() -> Int32 { +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(_ self: Int32) -> Int32 +fileprivate func bjs__WeirdClass_method_with_dashes_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs__WeirdClass_method_with_dashes(_ self: Int32) -> Int32 { +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() @@ -9789,57 +10380,75 @@ func _$_WeirdClass_method_with_dashes(_ self: JSObject) throws(JSException) -> S #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_init") -fileprivate func bjs_StaticBox_init(_ value: Float64) -> Int32 +fileprivate func bjs_StaticBox_init_extern(_ value: Float64) -> Int32 #else -fileprivate func bjs_StaticBox_init(_ value: Float64) -> Int32 { +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(_ value: Float64) -> Int32 +fileprivate func bjs_StaticBox_create_static_extern(_ value: Float64) -> Int32 #else -fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 { +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() -> Float64 +fileprivate func bjs_StaticBox_value_static_extern() -> Float64 #else -fileprivate func bjs_StaticBox_value_static() -> Float64 { +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() -> Int32 +fileprivate func bjs_StaticBox_makeDefault_static_extern() -> Int32 #else -fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 { +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() -> Int32 +fileprivate func bjs_StaticBox_with_dashes_static_extern() -> Int32 #else -fileprivate func bjs_StaticBox_with_dashes_static() -> Int32 { +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(_ self: Int32) -> Float64 +fileprivate func bjs_StaticBox_value_extern(_ self: Int32) -> Float64 #else -fileprivate func bjs_StaticBox_value(_ self: Int32) -> Float64 { +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() @@ -9894,84 +10503,111 @@ func _$StaticBox_value(_ self: JSObject) throws(JSException) -> Double { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_init") -fileprivate func bjs_Animal_init(_ name: Int32, _ age: Float64, _ isCat: Int32) -> Int32 +fileprivate func bjs_Animal_init_extern(_ name: Int32, _ age: Float64, _ isCat: Int32) -> Int32 #else -fileprivate func bjs_Animal_init(_ name: Int32, _ age: Float64, _ isCat: Int32) -> Int32 { +fileprivate func bjs_Animal_init_extern(_ name: Int32, _ age: Float64, _ isCat: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_Animal_init(_ name: Int32, _ age: Float64, _ isCat: Int32) -> Int32 { + return bjs_Animal_init_extern(name, age, isCat) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_name_get") -fileprivate func bjs_Animal_name_get(_ self: Int32) -> Int32 +fileprivate func bjs_Animal_name_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_Animal_name_get(_ self: Int32) -> Int32 { +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(_ self: Int32) -> Float64 +fileprivate func bjs_Animal_age_get_extern(_ self: Int32) -> Float64 #else -fileprivate func bjs_Animal_age_get(_ self: Int32) -> Float64 { +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(_ self: Int32) -> Int32 +fileprivate func bjs_Animal_isCat_get_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_Animal_isCat_get(_ self: Int32) -> Int32 { +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(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_Animal_name_set_extern(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_Animal_name_set(_ self: Int32, _ newValue: Int32) -> Void { +fileprivate func bjs_Animal_name_set_extern(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_Animal_name_set(_ self: Int32, _ newValue: Int32) -> Void { + return bjs_Animal_name_set_extern(self, newValue) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_age_set") -fileprivate func bjs_Animal_age_set(_ self: Int32, _ newValue: Float64) -> Void +fileprivate func bjs_Animal_age_set_extern(_ self: Int32, _ newValue: Float64) -> Void #else -fileprivate func bjs_Animal_age_set(_ self: Int32, _ newValue: Float64) -> Void { +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(_ self: Int32, _ newValue: Int32) -> Void +fileprivate func bjs_Animal_isCat_set_extern(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_Animal_isCat_set(_ self: Int32, _ newValue: Int32) -> Void { +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(_ self: Int32) -> Int32 +fileprivate func bjs_Animal_bark_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_Animal_bark(_ self: Int32) -> Int32 { +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(_ self: Int32) -> Int32 +fileprivate func bjs_Animal_getIsCat_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_Animal_getIsCat(_ self: Int32) -> Int32 { +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 nameValue = name.bridgeJSLowerParameter() @@ -10058,12 +10694,15 @@ func _$Animal_getIsCat(_ self: JSObject) throws(JSException) -> Bool { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripIntArray") -fileprivate func bjs_jsRoundTripIntArray() -> Void +fileprivate func bjs_jsRoundTripIntArray_extern() -> Void #else -fileprivate func bjs_jsRoundTripIntArray() -> Void { +fileprivate func bjs_jsRoundTripIntArray_extern() -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsRoundTripIntArray() -> Void { + return bjs_jsRoundTripIntArray_extern() +} func _$jsRoundTripIntArray(_ items: [Int]) throws(JSException) -> [Int] { let _ = items.bridgeJSLowerParameter() @@ -10076,12 +10715,15 @@ func _$jsRoundTripIntArray(_ items: [Int]) throws(JSException) -> [Int] { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsArrayLength") -fileprivate func bjs_jsArrayLength() -> Int32 +fileprivate func bjs_jsArrayLength_extern() -> Int32 #else -fileprivate func bjs_jsArrayLength() -> Int32 { +fileprivate func bjs_jsArrayLength_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_jsArrayLength() -> Int32 { + return bjs_jsArrayLength_extern() +} func _$jsArrayLength(_ items: [Int]) throws(JSException) -> Int { let _ = items.bridgeJSLowerParameter() @@ -10094,12 +10736,15 @@ func _$jsArrayLength(_ items: [Int]) throws(JSException) -> Int { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_makeArrayHost") -fileprivate func bjs_makeArrayHost() -> Int32 +fileprivate func bjs_makeArrayHost_extern() -> Int32 #else -fileprivate func bjs_makeArrayHost() -> Int32 { +fileprivate func bjs_makeArrayHost_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_makeArrayHost() -> Int32 { + return bjs_makeArrayHost_extern() +} func _$makeArrayHost(_ numbers: [Int], _ labels: [String]) throws(JSException) -> ArrayHost { let _ = labels.bridgeJSLowerParameter() @@ -10113,75 +10758,99 @@ func _$makeArrayHost(_ numbers: [Int], _ labels: [String]) throws(JSException) - #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_init") -fileprivate func bjs_ArrayHost_init() -> Int32 +fileprivate func bjs_ArrayHost_init_extern() -> Int32 #else -fileprivate func bjs_ArrayHost_init() -> Int32 { +fileprivate func bjs_ArrayHost_init_extern() -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_ArrayHost_init() -> Int32 { + return bjs_ArrayHost_init_extern() +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_numbers_get") -fileprivate func bjs_ArrayHost_numbers_get(_ self: Int32) -> Void +fileprivate func bjs_ArrayHost_numbers_get_extern(_ self: Int32) -> Void #else -fileprivate func bjs_ArrayHost_numbers_get(_ self: Int32) -> Void { +fileprivate func bjs_ArrayHost_numbers_get_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_ArrayHost_numbers_get(_ self: Int32) -> Void { + return bjs_ArrayHost_numbers_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_labels_get") -fileprivate func bjs_ArrayHost_labels_get(_ self: Int32) -> Void +fileprivate func bjs_ArrayHost_labels_get_extern(_ self: Int32) -> Void #else -fileprivate func bjs_ArrayHost_labels_get(_ self: Int32) -> Void { +fileprivate func bjs_ArrayHost_labels_get_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_ArrayHost_labels_get(_ self: Int32) -> Void { + return bjs_ArrayHost_labels_get_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_numbers_set") -fileprivate func bjs_ArrayHost_numbers_set(_ self: Int32) -> Void +fileprivate func bjs_ArrayHost_numbers_set_extern(_ self: Int32) -> Void #else -fileprivate func bjs_ArrayHost_numbers_set(_ self: Int32) -> Void { +fileprivate func bjs_ArrayHost_numbers_set_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_ArrayHost_numbers_set(_ self: Int32) -> Void { + return bjs_ArrayHost_numbers_set_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_labels_set") -fileprivate func bjs_ArrayHost_labels_set(_ self: Int32) -> Void +fileprivate func bjs_ArrayHost_labels_set_extern(_ self: Int32) -> Void #else -fileprivate func bjs_ArrayHost_labels_set(_ self: Int32) -> Void { +fileprivate func bjs_ArrayHost_labels_set_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_ArrayHost_labels_set(_ self: Int32) -> Void { + return bjs_ArrayHost_labels_set_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_concatNumbers") -fileprivate func bjs_ArrayHost_concatNumbers(_ self: Int32) -> Void +fileprivate func bjs_ArrayHost_concatNumbers_extern(_ self: Int32) -> Void #else -fileprivate func bjs_ArrayHost_concatNumbers(_ self: Int32) -> Void { +fileprivate func bjs_ArrayHost_concatNumbers_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_ArrayHost_concatNumbers(_ self: Int32) -> Void { + return bjs_ArrayHost_concatNumbers_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_concatLabels") -fileprivate func bjs_ArrayHost_concatLabels(_ self: Int32) -> Void +fileprivate func bjs_ArrayHost_concatLabels_extern(_ self: Int32) -> Void #else -fileprivate func bjs_ArrayHost_concatLabels(_ self: Int32) -> Void { +fileprivate func bjs_ArrayHost_concatLabels_extern(_ self: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_ArrayHost_concatLabels(_ self: Int32) -> Void { + return bjs_ArrayHost_concatLabels_extern(self) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayHost_firstLabel") -fileprivate func bjs_ArrayHost_firstLabel(_ self: Int32) -> Int32 +fileprivate func bjs_ArrayHost_firstLabel_extern(_ self: Int32) -> Int32 #else -fileprivate func bjs_ArrayHost_firstLabel(_ self: Int32) -> Int32 { +fileprivate func bjs_ArrayHost_firstLabel_extern(_ self: Int32) -> Int32 { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_ArrayHost_firstLabel(_ self: Int32) -> Int32 { + return bjs_ArrayHost_firstLabel_extern(self) +} func _$ArrayHost_init(_ numbers: [Int], _ labels: [String]) throws(JSException) -> JSObject { let _ = labels.bridgeJSLowerParameter() @@ -10261,12 +10930,15 @@ func _$ArrayHost_firstLabel(_ self: JSObject, _ values: [String]) throws(JSExcep #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsTranslatePoint") -fileprivate func bjs_jsTranslatePoint(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 +fileprivate func bjs_jsTranslatePoint_extern(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 #else -fileprivate func bjs_jsTranslatePoint(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 { +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() @@ -10281,12 +10953,15 @@ func _$jsTranslatePoint(_ point: Point, _ dx: Int, _ dy: Int) throws(JSException #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MyJSClassInternal_init") -fileprivate func bjs_MyJSClassInternal_init() -> Int32 +fileprivate func bjs_MyJSClassInternal_init_extern() -> Int32 #else -fileprivate func bjs_MyJSClassInternal_init() -> Int32 { +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() @@ -10298,12 +10973,15 @@ func _$MyJSClassInternal_init() throws(JSException) -> JSObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MyJSClassPublic_init") -fileprivate func bjs_MyJSClassPublic_init() -> Int32 +fileprivate func bjs_MyJSClassPublic_init_extern() -> Int32 #else -fileprivate func bjs_MyJSClassPublic_init() -> Int32 { +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() @@ -10315,12 +10993,15 @@ func _$MyJSClassPublic_init() throws(JSException) -> JSObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MyJSClassPackage_init") -fileprivate func bjs_MyJSClassPackage_init() -> Int32 +fileprivate func bjs_MyJSClassPackage_init_extern() -> Int32 #else -fileprivate func bjs_MyJSClassPackage_init() -> Int32 { +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() @@ -10332,12 +11013,15 @@ func _$MyJSClassPackage_init() throws(JSException) -> JSObject { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithPackageAccess") -fileprivate func bjs_jsFunctionWithPackageAccess() -> Void +fileprivate func bjs_jsFunctionWithPackageAccess_extern() -> Void #else -fileprivate func bjs_jsFunctionWithPackageAccess() -> Void { +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() @@ -10348,12 +11032,15 @@ func _$jsFunctionWithPackageAccess() throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithPublicAccess") -fileprivate func bjs_jsFunctionWithPublicAccess() -> Void +fileprivate func bjs_jsFunctionWithPublicAccess_extern() -> Void #else -fileprivate func bjs_jsFunctionWithPublicAccess() -> Void { +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() @@ -10364,12 +11051,15 @@ func _$jsFunctionWithPublicAccess() throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithInternalAccess") -fileprivate func bjs_jsFunctionWithInternalAccess() -> Void +fileprivate func bjs_jsFunctionWithInternalAccess_extern() -> Void #else -fileprivate func bjs_jsFunctionWithInternalAccess() -> Void { +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() @@ -10380,12 +11070,15 @@ func _$jsFunctionWithInternalAccess() throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithFilePrivateAccess") -fileprivate func bjs_jsFunctionWithFilePrivateAccess() -> Void +fileprivate func bjs_jsFunctionWithFilePrivateAccess_extern() -> Void #else -fileprivate func bjs_jsFunctionWithFilePrivateAccess() -> Void { +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() @@ -10396,12 +11089,15 @@ func _$jsFunctionWithFilePrivateAccess() throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithPrivateAccess") -fileprivate func bjs_jsFunctionWithPrivateAccess() -> Void +fileprivate func bjs_jsFunctionWithPrivateAccess_extern() -> Void #else -fileprivate func bjs_jsFunctionWithPrivateAccess() -> Void { +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() @@ -10412,48 +11108,63 @@ func _$jsFunctionWithPrivateAccess() throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static") -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static(_ valueIsSome: Int32, _ valueValue: Int32) -> Void +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static_extern(_ valueIsSome: Int32, _ valueValue: Int32) -> Void #else -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { +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(_ valueIsSome: Int32, _ valueValue: Int32) -> Void +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static_extern(_ valueIsSome: Int32, _ valueValue: Int32) -> Void #else -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { +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(_ nameIsSome: Int32, _ nameValue: Int32) -> Void +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static_extern(_ nameIsSome: Int32, _ nameValue: Int32) -> Void #else -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static_extern(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { + return bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static_extern(nameIsSome, nameValue) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static") -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static(_ nameIsSome: Int32, _ nameValue: Int32) -> Void +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static_extern(_ nameIsSome: Int32, _ nameValue: Int32) -> Void #else -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static_extern(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif +@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static(_ nameIsSome: Int32, _ nameValue: Int32) -> Void { + return bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static_extern(nameIsSome, nameValue) +} #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_runJsOptionalSupportTests_static") -fileprivate func bjs_OptionalSupportImports_runJsOptionalSupportTests_static() -> Void +fileprivate func bjs_OptionalSupportImports_runJsOptionalSupportTests_static_extern() -> Void #else -fileprivate func bjs_OptionalSupportImports_runJsOptionalSupportTests_static() -> Void { +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() @@ -10500,12 +11211,15 @@ func _$OptionalSupportImports_runJsOptionalSupportTests() throws(JSException) -> #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_gc") -fileprivate func bjs_gc() -> Void +fileprivate func bjs_gc_extern() -> Void #else -fileprivate func bjs_gc() -> Void { +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() @@ -10516,21 +11230,27 @@ func _$gc() throws(JSException) -> Void { #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftClassSupportImports_jsRoundTripGreeter_static") -fileprivate func bjs_SwiftClassSupportImports_jsRoundTripGreeter_static(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +fileprivate func bjs_SwiftClassSupportImports_jsRoundTripGreeter_static_extern(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer #else -fileprivate func bjs_SwiftClassSupportImports_jsRoundTripGreeter_static(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +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_jsRoundTripOptionalGreeter_static") -fileprivate func bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +fileprivate func bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static_extern(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer #else -fileprivate func bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { +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) +} func _$SwiftClassSupportImports_jsRoundTripGreeter(_ greeter: Greeter) throws(JSException) -> Greeter { let greeterPointer = greeter.bridgeJSLowerParameter() From eace50e6b9f73f484d5ced76b60c99551352fc87 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 19 Feb 2026 13:25:38 +0900 Subject: [PATCH 251/252] TS2Swift: inject diagnostics for export assignment test --- .../Sources/TS2Swift/JavaScript/src/cli.js | 10 ++++---- .../TS2Swift/JavaScript/test/ts2swift.test.js | 23 +++++++++---------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js index c7ac79051..17086e92e 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js @@ -97,13 +97,13 @@ Examples: /** * Run ts2swift for a single input file (programmatic API, no process I/O). * @param {string[]} filePaths - Paths to the .d.ts files - * @param {{ tsconfigPath: string, logLevel?: keyof typeof DiagnosticEngine.LEVELS, globalFiles?: string[] }} options + * @param {{ tsconfigPath: string, logLevel?: keyof typeof DiagnosticEngine.LEVELS, globalFiles?: string[], diagnosticEngine?: DiagnosticEngine }} options * @returns {string} Generated Swift source * @throws {Error} on parse/type-check errors (diagnostics are included in the message) */ export function run(filePaths, options) { - const { tsconfigPath, logLevel = 'info', globalFiles = [] } = options; - const diagnosticEngine = new DiagnosticEngine(logLevel); + const { tsconfigPath, logLevel = 'info', globalFiles = [], diagnosticEngine } = options; + const engine = diagnosticEngine ?? new DiagnosticEngine(logLevel); const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile); const configParseResult = ts.parseJsonConfigFileContent( @@ -164,7 +164,7 @@ export function run(filePaths, options) { const bodies = []; const globalFileSet = new Set(globalFiles); for (const inputPath of [...filePaths, ...globalFiles]) { - const processor = new TypeProcessor(program.getTypeChecker(), diagnosticEngine, { + const processor = new TypeProcessor(program.getTypeChecker(), engine, { defaultImportFromGlobal: globalFileSet.has(inputPath), }); const result = processor.processTypeDeclarations(program, inputPath); @@ -247,7 +247,7 @@ export function main(args) { let swiftOutput; try { - swiftOutput = run(filePaths, { tsconfigPath, logLevel, globalFiles }); + swiftOutput = run(filePaths, { tsconfigPath, logLevel, globalFiles, diagnosticEngine }); } catch (/** @type {unknown} */ err) { if (err instanceof Error) { diagnosticEngine.print("error", err.message); diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js index 8882124ed..4aefa19b5 100644 --- a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/ts2swift.test.js @@ -1,5 +1,5 @@ // @ts-check -import { describe, it, expect, vi } from 'vitest'; +import { describe, it, expect } from 'vitest'; import { readdirSync, mkdtempSync, writeFileSync, rmSync } from 'fs'; import { fileURLToPath } from 'url'; import path from 'path'; @@ -53,16 +53,15 @@ describe('ts2swift', () => { it('emits a warning when export assignments cannot be generated', () => { const dtsPath = path.join(inputsDir, 'ExportAssignment.d.ts'); - const stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true); - try { - run([dtsPath], { tsconfigPath, logLevel: 'warning' }); - const combined = stderrSpy.mock.calls.map(args => String(args[0])).join(''); - expect(combined).toMatch(/Skipping export assignment/); - // Only warn once for the export assignment node - const occurrences = (combined.match(/Skipping export assignment/g) || []).length; - expect(occurrences).toBe(1); - } finally { - stderrSpy.mockRestore(); - } + /** @type {{ level: string, message: string }[]} */ + const diagnostics = []; + const diagnosticEngine = { + print: (level, message) => diagnostics.push({ level, message }), + }; + run([dtsPath], { tsconfigPath, logLevel: 'warning', diagnosticEngine }); + const messages = diagnostics.map((d) => d.message).join('\n'); + expect(messages).toMatch(/Skipping export assignment/); + const occurrences = (messages.match(/Skipping export assignment/g) || []).length; + expect(occurrences).toBe(1); }); }); From 834b59a1415b9238a2f8e801632e7dc62d9ec23b Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Thu, 19 Feb 2026 10:41:48 +0100 Subject: [PATCH 252/252] BridgeJS: Register parameter names in scope instead of reserveNames --- Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift | 3 ++- Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift | 6 ------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 0afb287ab..3c7b197a4 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -1219,7 +1219,8 @@ public struct BridgeJSLink { loweringFragment.parameters.count == 1, "Lowering fragment should have exactly one parameter to lower" ) - let loweredValues = try loweringFragment.printCode([param.name], context) + let paramName = scope.variable(param.name) + let loweredValues = try loweringFragment.printCode([paramName], context) parameterForwardings.append(contentsOf: loweredValues) } diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift index c6c37a8db..6f848eb05 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift @@ -90,11 +90,6 @@ final class JSGlueVariableScope { JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) } - fileprivate func reserveNames(_ names: [String]) { - for name in names { - variables.insert(name) - } - } } extension JSGlueVariableScope { @@ -738,7 +733,6 @@ struct IntrinsicJSFragment: Sendable { printCode: { arguments, context in let (scope, printer) = (context.scope, context.printer) let value = arguments[0] - scope.reserveNames(arguments) let isSomeVar = scope.variable("isSome") printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));")

  • N%9OXk^B8efd`>u5Qbi2sq zkJ=2;D`xS^I2Yz`mAI{LB3K}FqF4<~RDI%%F4fakn8nozM2NS6BBH)9(9$*Of@UP2 zk&QEXft@eBL`4(64PrtX^TLftaz?OqwaQ{NJx=^JV<9fHKVa(Wl58s$zWBzsJ3nu; zNHX^KsD+BC>~w2P>E8k4USQ(|vuS$>K|b@#2q z5A6KGX}~SD^9|ClKB<=9+QI=$58zbLCtfbD!h{_njLb;KEAtT3{e5D&=50!`qybR- zE7*5!nSM>&ml3B=L|kb)=q1eeW%jt9D*kI68EUpCgkS30T|V^kA3_#Mso_iE771z# zWlb%Xq2E1HLeOglZ<46_6;N;;%aogWCaO;!ye26&s^o8EShk2Wi1ZKN(fNZXJF$S> z$70yi?rj3rJGT4=^6t73;in@QiWATnImpzdL2&}8VLh&M$@Uia577CZNOW6eYfd81 zms+(oAD!2gDLkOhn|$o>IN4)+4H2$)L5A^!ih&IRrz1Wp;2{)`84rjU|Lrs^WOVyeJ)uR@)4{?JxC&@%~jD|j#+`gnlGdBB~ z|9!{*!O&E_bSI2xJ+S$y)H5bK{1Z=&sJ?~hA8(3cq0RGPj5P`4cKVn2$w@dGAfvEZwqou-K&sP3536?q51j@G71d*`AE4!$tPin7PIL z;nv($+$}4s)hnC0dmY&UguDVcJY}effQuv_O{vKC-d^$I_x{5$0QF^pI}c+7rZyM> z4D#sH*j3m3sjqZ$*!e5}|FHK~QE^7i-X{TqTLKC0!QI`01@{o#-66O%P6z}D?h**@ z?k>UI-JQl8X_o8f0i z!k@X9uAZ4MS*ld>MVhanA&xV`>o;qo7&ej;_srZMcKMRi4}LZctAD9-O<muc*4X zy*|@JAWEr-`Tw8(f7}kT6-2x#WY}T&S8^Zio7=xx*V8YNNOL(MzhxEOo!b6UiBYaG zmzVXzlTDvW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